From a9262d9b1c5b570d077c2dc7d3fdda9058f88ec7 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 25 六月 2024 11:15:07 +0800
Subject: [PATCH] 调拨和库存调整产生的出入库补充对应仓库的业务类型

---
 controllers/operation.go |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/controllers/operation.go b/controllers/operation.go
index 8db06b8..2b5fdc5 100644
--- a/controllers/operation.go
+++ b/controllers/operation.go
@@ -486,19 +486,19 @@
 		}
 
 		if operation.BaseOperationType == constvar.BaseOperationTypeOutgoing || operation.BaseOperationType == constvar.BaseOperationTypeDisuse {
-			if err := service.FinishOperationOutput(tx, listDetails, mapLocAmount); err != nil {
+			if err := service.FinishOperationOutput(tx, listDetails, mapLocAmount, operation); err != nil {
 				return err
 			}
 		}
 
 		if operation.BaseOperationType == constvar.BaseOperationTypeInternal {
-			if err := service.FinishOperationInternal(tx, listDetails); err != nil {
+			if err := service.FinishOperationInternal(tx, listDetails, operation); err != nil {
 				return err
 			}
 		}
 
 		if operation.BaseOperationType == constvar.BaseOperationTypeAdjust {
-			if err := service.FinishOperationAdjust(tx, listDetails, mapLocAmount); err != nil {
+			if err := service.FinishOperationAdjust(tx, listDetails, mapLocAmount, operation); err != nil {
 				return err
 			}
 		}
@@ -781,7 +781,7 @@
 	if err != nil {
 		return "", errors.New("鑾峰彇妯$増璁板綍澶辫触:" + err.Error())
 	}
-
+	fmt.Println(template)
 	// 鏍规嵁妯℃澘璺緞鑾峰彇妯℃澘娑堟伅
 	readerCloser, err := http.HttpGetWithReadCloser(template.FileUrl)
 	if err != nil {
@@ -818,6 +818,10 @@
 	f.SetCellValue(sheet, "L3", date[5:7])  // 鏈�
 	f.SetCellValue(sheet, "N3", date[8:10]) // 鏃�
 
+	var entityIDs []string
+	for _, v := range operation.Details {
+		entityIDs = append(entityIDs, v.ProductId)
+	}
 	attributeMap := make(map[string]uint)
 	attributeValueMap := make(map[string]string)
 	attributes, err := models.NewAttributeSearch().SetEntityType(1).FindNotTotal()
@@ -827,7 +831,7 @@
 	for _, v := range attributes {
 		attributeMap[v.Name] = v.ID
 	}
-	attributeValues, err := models.NewAttributeValueSearch().FindNotTotal()
+	attributeValues, err := models.NewAttributeValueSearch().SetEntityIDs(entityIDs).FindNotTotal()
 	if err != nil {
 		return "", errors.New("鑾峰彇鍔ㄦ�佸睘鎬у�煎け璐ワ細" + err.Error())
 	}
@@ -919,7 +923,6 @@
 		logx.Errorf("file upload err: %v", err)
 		return "", err
 	}
-
 	return fileUrl, nil
 }
 

--
Gitblit v1.8.0