From fda60dd56911c03330eb7330ebabd5d46e9d7622 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期五, 15 十二月 2023 16:14:03 +0800 Subject: [PATCH] 库存盘点列表bug --- controllers/location_product_amount.go | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go index 3f33ff3..36d7c28 100644 --- a/controllers/location_product_amount.go +++ b/controllers/location_product_amount.go @@ -12,8 +12,10 @@ "wms/extend/code" "wms/extend/util" "wms/models" + "wms/pkg/mysqlx" "wms/request" "wms/response" + "wms/service" ) type LocationProductAmountController struct { @@ -60,13 +62,13 @@ if params.Page*params.PageSize > 0 { search.Orm = search.Orm.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize) } - if err := search.Orm.Order("wms_location_product_amount.updated_at desc").Find(&records).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { + if err := search.Orm.Order("wms_location_product_amount.updated_at desc").Find(&records).Error; err != nil { util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err)) return } var operation models.Operation for k, v := range records { - if res := models.NewOperationSearch().Orm.Preload("Details", "product_id=?", v.ProductId).Where("wms_operation.base_operation_type=? and wms_operation.status=? and wms_operation.to_location_id=?", constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready, v.LocationId).First(&operation); res.Error != nil { + if res := mysqlx.GetDB().Table("wms_operation").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").Where("wms_operation.base_operation_type=? and wms_operation.status=? and wms_operation.to_location_id=? and wms_operation_details.product_id=?", constvar.BaseOperationTypeAdjust, constvar.OperationStatus_Ready, v.LocationId, v.ProductId).First(&operation); res.Error != nil { if errors.Is(res.Error, gorm.ErrRecordNotFound) { records[k].Status = constvar.OperationStatus_Finish records[k].BaseOperationType = constvar.BaseOperationTypeAdjust @@ -174,6 +176,8 @@ }); err != nil { return err } + + service.AddNewLocationReportRecord(locAmount.Id) return nil } -- Gitblit v1.8.0