From 2bfc37cbc679ceb5cef3b714e93ce4ebf55f9512 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期三, 08 十一月 2023 17:24:58 +0800 Subject: [PATCH] 修改缩略图尺寸 config文件覆盖修复 --- controllers/report_forms_controller.go | 50 ++++++++++++++++++-------------------------------- 1 files changed, 18 insertions(+), 32 deletions(-) diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go index 79ee050..7370006 100644 --- a/controllers/report_forms_controller.go +++ b/controllers/report_forms_controller.go @@ -132,7 +132,7 @@ if params.PageInfo.Check() { detailsSearch.SetPage(params.Page, params.PageSize) } - details, err := detailsSearch.SetProductId(params.ProduceId).FindNotTotal() + details, total, err := detailsSearch.SetProductId(params.ProduceId).Find() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鏌ヨ鎿嶄綔璇︽儏澶辫触") return @@ -142,8 +142,8 @@ operationIds = append(operationIds, detail.OperationID) } //鑾峰彇宸插畬鎴愮殑鎿嶄綔璁板綍 - operations, total, err := models.NewOperationSearch().SetIds(operationIds).SetBaseOperationType(params.BaseOperationType). - SetStatus(constvar.OperationStatus_Finish).Find() + operations, err := models.NewOperationSearch().SetIds(operationIds).SetBaseOperationType(params.BaseOperationType). + SetStatus(constvar.OperationStatus_Finish).FindNotTotal() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鏌ヨ鎿嶄綔璁板綍澶辫触") return @@ -152,8 +152,8 @@ for _, detail := range details { var resp response.InventoryHistory resp.Amount = detail.Amount - resp.Unit = params.Unit - resp.ProductName = params.ProductName + resp.Unit = detail.Product.Unit + resp.ProductName = detail.Product.Name for _, operation := range operations { if detail.OperationID == operation.Id { resp.Number = operation.Number @@ -162,6 +162,7 @@ resp.ContactedName = operation.ContacterName resp.FromLocation = operation.FromLocation.Name resp.ToLocation = operation.ToLocation.Name + resp.BaseOperationType = operation.BaseOperationType result = append(result, resp) break } @@ -183,10 +184,7 @@ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") return } - search := models.NewLocationProductSearch() - if params.PageInfo.Check() { - search.SetPage(params.Page, params.PageSize) - } + //鏌ヨ浣嶇疆 locations, err := models.NewLocationSearch().SetJointName(params.WareHouseCode).FindAll() if err != nil { @@ -198,36 +196,24 @@ ids = append(ids, location.Id) } - find, total, err := search.SetKeyword(params.KeyWord).SetProductId(params.ProductId).SetLocationIds(ids).FindByPage() - if err != nil { - util.ResponseFormat(c, code.RequestParamError, "鏌ヨ涓婃灦瑙勫垯澶辫触") - return - } - ruleIds := make([]int, 0) - for _, product := range find { - ruleIds = append(ruleIds, product.Id) - } - amounts, err := models.NewLocationProductAmountSearch().SetLocationProductIds(ruleIds).Find() + amounts, total, err := models.NewLocationProductAmountSearch().SetPage(params.Page, params.PageSize).SetPreload(true).SetKeyword(params.KeyWord).SetProductId(params.ProductId).SetLocationIds(ids).FindByPage() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鏌ヨ鏁伴噺澶辫触") return } + var result []response.LocationForms - for _, product := range find { + for _, amount := range amounts { var resp response.LocationForms - for _, amount := range amounts { - if product.Id == amount.LocationProductId { - resp.Amount = amount.Amount - break - } - } - resp.LocationName = product.Location.Name - resp.ProduceId = product.Product.ID - resp.ProductName = product.Product.Name - resp.ProductTypeName = product.ProductCategory.Name - resp.Unit = product.Product.Unit - resp.Value = resp.Amount.Mul(product.Product.Cost) + resp.Amount = amount.Amount + resp.LocationName = amount.Location.Name + resp.ProduceId = amount.Product.ID + resp.ProductName = amount.Product.Name + resp.ProductTypeName = amount.ProductCategory.Name + resp.Unit = amount.Product.Unit + resp.Value = resp.Amount.Mul(amount.Product.Cost) result = append(result, resp) } + util.ResponseFormatList(c, code.Success, result, int(total)) } -- Gitblit v1.8.0