From a8914a16b23e93f6bfd12bcfd5cbe8b24cf7eb84 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期日, 07 四月 2024 21:49:01 +0800 Subject: [PATCH] 发货支持仓库传参 --- controllers/report_forms_controller.go | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go index 7c57613..ced1c45 100644 --- a/controllers/report_forms_controller.go +++ b/controllers/report_forms_controller.go @@ -97,8 +97,8 @@ Where("wms_operation.base_operation_type in (?)", []constvar.BaseOperationType{constvar.BaseOperationTypeOutgoing, constvar.BaseOperationTypeInternal, constvar.BaseOperationTypeDisuse}). Where("wms_operation.status in (?)", []constvar.OperationStatus{constvar.OperationStatus_Ready, constvar.OperationStatus_Finish}) if len(locationIds) > 0 { - dbIn.Where("wms_operation.to_location_id in (?)", locationIds) - dbOut.Where("wms_operation.from_location_id in (?)", locationIds) + dbIn.Where("wms_operation_details.to_location_id in (?)", locationIds) + dbOut.Where("wms_operation_details.from_location_id in (?)", locationIds) } if len(productIds) > 0 { dbIn.Where("wms_operation_details.product_id in (?)", productIds) @@ -265,13 +265,23 @@ } detailsSearch.Orm = detailsSearch.Orm.Model(&models.MoveHistory{}). - Select("number, updated_at as date, product_name as product_name, from_location_id," + - "to_location_id, amount, unit, operator as contacted_name, base_operation_type, weight, product_id, from_location, to_location").Order("id desc") + Select("number, updated_at as date, product_name as product_name, from_location_id, operation_id,to_location_id, amount, " + + "unit, operator as contacted_name, base_operation_type, weight, product_id, from_location, to_location, operation_type_name").Order("id desc") if len(ids) > 0 { detailsSearch.Orm = detailsSearch.Orm.Where("id in ?", ids) } if params.BaseOperationType != 0 { detailsSearch.Orm = detailsSearch.Orm.Where("base_operation_type = ?", params.BaseOperationType) + } + var t int64 + err = detailsSearch.Orm.Count(&t).Error + if err != nil { + util.ResponseFormat(c, code.RequestParamError, fmt.Errorf("鏌ヨ鎬绘潯鏁板け璐�: %v", err)) + return + } + total = uint64(t) + if params.Page*params.PageSize > 0 { + detailsSearch.Orm = detailsSearch.Orm.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize) } err = detailsSearch.Orm.Find(&result).Error if err != nil { @@ -329,6 +339,7 @@ for _, amount := range amounts { var resp response.LocationForms resp.Amount = amount.Amount + resp.LocationId = amount.LocationId resp.LocationName = amount.Location.Name resp.ProduceId = amount.Product.ID resp.ProductName = amount.Product.Name -- Gitblit v1.8.0