From 9c7551a7a752c07db11b0fd23bfba8da1ad062e0 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 21 六月 2024 20:39:12 +0800
Subject: [PATCH] fix 404
---
controllers/location_product_amount.go | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index f0a4ec6..5a62cb9 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -57,7 +57,7 @@
//wms_operation_details.amount as adjust_amount,wms_operation.id as operation_id,wms_operation.status
search.Orm = search.Orm.
Table("wms_location_product_amount").
- Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.name as location_name,
+ Select(`wms_location_product_amount.id as location_product_amount_id,wms_location.id as location_id,wms_location.joint_name as location_name,
material.id as product_id,material.name as product_name,wms_location_product_amount.amount,material.unit,
wms_location_product_amount.create_date,material.weight`).
InnerJoins("inner join material on material.id=wms_location_product_amount.product_id").
@@ -113,6 +113,32 @@
}
records[k].BaseOperationType = constvar.BaseOperationTypeAdjust
}
+
+ productIds = make([]string, 0)
+ for _, record := range records {
+ productIds = append(productIds, record.ProductId)
+ }
+
+ products, err := models.NewMaterialSearch().SetIDs(productIds).FindNotTotal()
+ if err != nil {
+ util.ResponseFormat(c, code.RequestError, "鏌ヨ浜у搧澶辫触")
+ return
+ }
+
+ productMap := models.MaterialMap(products)
+
+ for k, v := range records {
+ product := productMap[v.ProductId]
+ if product == nil {
+ continue
+ }
+
+ moreUnit := product.MoreUnit
+ if moreUnit != nil && *moreUnit {
+ records[k].AmountMoreUnits = service.CreateMoreUnit(v.Amount, product.MoreUnitList)
+ }
+ }
+
util.ResponseFormatListWithPage(c, code.Success, records, int(total), params.Page, params.PageSize)
}
--
Gitblit v1.8.0