From 0b7ac10fc4d26e1ef63470a42f40d666bec8692b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 04 七月 2024 19:51:11 +0800
Subject: [PATCH] 产品位置库存表增加仓库id冗余字段

---
 task/warehouse_month_stats.go          |    5 +----
 service/operation.go                   |    3 +++
 controllers/location_product_amount.go |    1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/controllers/location_product_amount.go b/controllers/location_product_amount.go
index 02d4bad..7754e46 100644
--- a/controllers/location_product_amount.go
+++ b/controllers/location_product_amount.go
@@ -248,6 +248,7 @@
 			ProductId:         reqParams.ProductId,
 			Amount:            decimal.NewFromInt(0),
 			CreateDate:        time.Now().Format("2006-01-02 15:04:05"),
+			WarehouseId:       location.WarehouseId,
 		}
 	}
 
diff --git a/service/operation.go b/service/operation.go
index 47902e3..0775865 100644
--- a/service/operation.go
+++ b/service/operation.go
@@ -149,6 +149,7 @@
 					ProductId:         v.ProductId,
 					Amount:            v.Amount,
 					CreateDate:        time.Now().Format("2006-01-02 15:04:05"),
+					WarehouseId:       operation.WarehouseId,
 				}); err != nil {
 					return err
 				}
@@ -175,6 +176,7 @@
 						ProductId:         v.ProductId,
 						Amount:            v.Amount,
 						CreateDate:        time.Now().Format("2006-01-02 15:04:05"),
+						WarehouseId:       operation.WarehouseId,
 					}); err != nil {
 						return err
 					}
@@ -193,6 +195,7 @@
 						ProductId:         v.ProductId,
 						Amount:            v.Amount,
 						CreateDate:        time.Now().Format("2006-01-02 15:04:05"),
+						WarehouseId:       operation.WarehouseId,
 					}); err != nil {
 						return err
 					}
diff --git a/task/warehouse_month_stats.go b/task/warehouse_month_stats.go
index ed764ab..34dfedf 100644
--- a/task/warehouse_month_stats.go
+++ b/task/warehouse_month_stats.go
@@ -62,9 +62,6 @@
 		}
 
 		for _, record := range statsRecords {
-			if len(record.InputItems) == 0 {
-				continue
-			}
 			record.BeginAmount = record.EndAmount
 			err = models.WithTransaction(func(db *gorm.DB) error {
 				err = models.NewWarehouseMonthStatsSearch().SetOrm(db).Create(record)
@@ -92,7 +89,7 @@
 		}
 	}
 	if err == nil {
-		service.SendAlarm("鎸変粨搴撴湀搴︾粺璁℃墽琛屾垚鍔�", "")
+		//service.SendAlarm("鎸変粨搴撴湀搴︾粺璁℃墽琛屾垚鍔�", "")
 	}
 
 	return

--
Gitblit v1.8.0