From 221108b0e0416968ca8417513ebf65c8b5109662 Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期三, 26 六月 2024 11:40:47 +0800
Subject: [PATCH] 库存盘点应用按钮记录创建人,创建时间,应用时间、应用人员等信息;根据条形码查询产品详情;新增编辑产品增加条形码字段->添加条形码被使用验证

---
 task/month_stats.go |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/task/month_stats.go b/task/month_stats.go
index 7a507f0..6d82bb4 100644
--- a/task/month_stats.go
+++ b/task/month_stats.go
@@ -104,13 +104,13 @@
 			inputMoreValueArr := make([]models.UnitItems, 0, len(product.MoreUnitList))
 			outputMoreValueArr := make([]models.UnitItems, 0, len(product.MoreUnitList))
 			for _, unitItem := range product.MoreUnitList {
-				moreValueArr = append(moreValueArr, models.UnitItems{
-					Amount:   amount.Mul(unitItem.Amount),
-					Unit:     unitItem.Unit,
-					Floating: unitItem.Floating,
-				})
-				bys, _ := json.Marshal(moreValueArr)
-				moreUnits = string(bys)
+				if !amount.IsZero() {
+					moreValueArr = append(moreValueArr, models.UnitItems{
+						Amount:   amount.Mul(unitItem.Amount),
+						Unit:     unitItem.Unit,
+						Floating: unitItem.Floating,
+					})
+				}
 
 				if !inputMap[productId].IsZero() {
 					inputMoreValueArr = append(inputMoreValueArr, models.UnitItems{
@@ -118,9 +118,6 @@
 						Unit:     unitItem.Unit,
 						Floating: unitItem.Floating,
 					})
-					bys, _ = json.Marshal(inputMoreValueArr)
-					inputMoreUnits = string(bys)
-
 				}
 
 				if !outputMap[productId].IsZero() {
@@ -129,11 +126,17 @@
 						Unit:     unitItem.Unit,
 						Floating: unitItem.Floating,
 					})
-					bys, _ = json.Marshal(outputMoreValueArr)
-					outputMoreUnits = string(bys)
-
 				}
 			}
+			bys, _ := json.Marshal(moreValueArr)
+			if len(moreValueArr) > 0 {
+				fmt.Println(moreValueArr)
+			}
+			moreUnits = string(bys)
+			bys, _ = json.Marshal(inputMoreValueArr)
+			inputMoreUnits = string(bys)
+			bys, _ = json.Marshal(outputMoreValueArr)
+			outputMoreUnits = string(bys)
 		}
 
 		record.BeginMoreUnits = moreUnits

--
Gitblit v1.8.0