From e9fbecd61a9ab8c5d906269150b6cdc8ca86dfdb Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期二, 31 三月 2026 09:09:45 +0800
Subject: [PATCH] 1

---
 WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
index 55648df..4892c24 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
@@ -53,5 +53,37 @@
                 throw new Exception(ex.Message);
             }
         }
+
+        public void NEWAddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType, int? taskNum = null)
+        {
+            try
+            {
+                List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>();
+                stockQuantityChangeRecords = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(stockInfoDetails);
+                int index = 0;
+                decimal currentQuantity = 0;
+                stockQuantityChangeRecords.ForEach(x =>
+                {
+                    x.PalleCode = stockInfo.PalletCode;
+                    x.BeforeQuantity = beforeQuantity;
+                    if (totalQuantity <= beforeQuantity)
+                    {
+                        x.ChangeQuantity = stockInfoDetails[index].OutboundQuantity;
+                        currentQuantity += stockInfoDetails[index].OutboundQuantity;
+                        x.AfterQuantity = beforeQuantity - stockInfoDetails[index].OutboundQuantity ;
+                    }
+                    x.ChangeType = changeType.ObjToInt();
+                    beforeQuantity -= x.ChangeQuantity;
+                    x.TaskNum = taskNum;
+                    index++;
+                });
+                BaseDal.AddData(stockQuantityChangeRecords);
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
+
     }
 }

--
Gitblit v1.9.3