From e042d530a290bb0e45e59fe5c06d813618d0e546 Mon Sep 17 00:00:00 2001 From: yinbentan <yinbentan@live.com> Date: 星期四, 11 七月 2024 11:56:53 +0800 Subject: [PATCH] 仓库位置查询从仓库缩写变更为仓库ID查询 --- request/report_forms_request.go | 7 ++++--- service/inventory_report_forms.go | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/request/report_forms_request.go b/request/report_forms_request.go index b140319..ad59fb9 100644 --- a/request/report_forms_request.go +++ b/request/report_forms_request.go @@ -4,9 +4,10 @@ type GetInventoryForms struct { PageInfo - CategoryIds []int `json:"categoryIds"` //浜у搧绫诲瀷id - WarehouseCode string `json:"warehouseCode"` //浠撳簱缂╁啓 - KeyWord string `json:"keyWord"` //鎼滅储鏉′欢 + CategoryIds []int `json:"categoryIds"` //浜у搧绫诲瀷id + //WarehouseCode string `json:"warehouseCode"` //浠撳簱缂╁啓 + WarehouseId int `json:"warehouseId"` //浠撳簱ID + KeyWord string `json:"keyWord"` //鎼滅储鏉′欢 } type GetInventoryHistory struct { diff --git a/service/inventory_report_forms.go b/service/inventory_report_forms.go index 4409d83..45d3795 100644 --- a/service/inventory_report_forms.go +++ b/service/inventory_report_forms.go @@ -130,8 +130,11 @@ err error) { productAmounts = make([]*models.LocationProductAmount, 0) locationSearch := models.NewLocationSearch() - if params.WarehouseCode != "" { - locationSearch.SetJointName(params.WarehouseCode) + //if params.WarehouseCode != "" { + // locationSearch.SetJointName(params.WarehouseCode) + //} + if params.WarehouseId > 0 { + locationSearch.SetWarehouseId(params.WarehouseId) } locations, err := locationSearch.FindNotTotal() @@ -154,9 +157,9 @@ //鏌ヨ浜у搧 search = models.NewMaterialSearch() - search.Orm = search.Orm.Model(&models.Material{}). - Select(`material.id, material.name, material.cost, material.amount, material.unit, material.more_unit, material.more_unit_value, wms_product_category.name as category_name `). - Joins("left join wms_product_category on material.category_id = wms_product_category.id") + search.Orm = search.Orm.Model(&models.Material{}). // material + Select(`material.id, material.name, material.cost, material.amount, material.unit, material.more_unit, material.more_unit_value, wms_product_category.name as category_name `). + Joins("left join wms_product_category on material.category_id = wms_product_category.id") if len(params.CategoryIds) > 0 { search.Orm.Where("material.category_id in (?)", params.CategoryIds) } -- Gitblit v1.8.0