From d1cb09e7a23e7221b6c090ad33e4481a5b79f615 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 29 十一月 2023 17:44:29 +0800
Subject: [PATCH] 出入库报表搜索增加几个字段

---
 controllers/operation.go |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index 4cb2ab8..f42fe69 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -733,6 +733,7 @@
 
 func AddMoveHistory(operationList []*models.Operation, db *gorm.DB) error {
 	var histories []*models.MoveHistory
+	operationMap := make(map[string]*models.Operation, len(operationList))
 	for _, operation := range operationList {
 		for _, v := range operation.Details {
 			history := &models.MoveHistory{
@@ -753,12 +754,13 @@
 			}
 			histories = append(histories, history)
 		}
+		operationMap[operation.Number] = operation
 	}
 	if err := db.Model(&models.MoveHistory{}).Create(&histories).Error; err != nil {
 		return err
 	}
 	for _, history := range histories {
-		service.AddNewHistoryReportRecord(history)
+		service.AddNewHistoryReportRecord(history, operationMap[history.Number])
 	}
 	return nil
 }

--
Gitblit v1.8.0