From 48e2278d7ac330c7f05deda6f884acb6f01206b4 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期一, 13 四月 2026 17:13:51 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs | 88 ++++++++++++++++++++++++++++++++-----------
1 files changed, 65 insertions(+), 23 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
index 4cad19b..4892c24 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/StockQuantityChangeRecordService.cs
@@ -15,33 +15,75 @@
{
public partial class StockQuantityChangeRecordService : ServiceBase<Dt_StockQuantityChangeRecord, IStockQuantityChangeRecordRepository>, IStockQuantityChangeRecordService
{
- public void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType)
+ public void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType, int? taskNum = null)
{
- List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>();
- stockQuantityChangeRecords = _mapper.Map<List<Dt_StockQuantityChangeRecord>>(stockInfoDetails);
- int index = 0;
- decimal currentQuantity = 0;
- stockQuantityChangeRecords.ForEach(x =>
+ try
{
- x.PalleCode = stockInfo.PalletCode;
- x.BeforeQuantity = beforeQuantity;
- if (totalQuantity > beforeQuantity)
+ 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.ChangeQuantity = stockInfoDetails[index].StockQuantity;
- currentQuantity += stockInfoDetails[index].StockQuantity;
- x.AfterQuantity = stockInfoDetails[index].StockQuantity + beforeQuantity;
- }
- else
- {
- x.ChangeQuantity = -stockInfoDetails[index].StockQuantity;
- currentQuantity -= stockInfoDetails[index].StockQuantity;
- x.AfterQuantity = beforeQuantity - stockInfoDetails[index].StockQuantity;
- }
+ x.PalleCode = stockInfo.PalletCode;
+ x.BeforeQuantity = beforeQuantity;
+ if (totalQuantity >= beforeQuantity)
+ {
+ x.ChangeQuantity = stockInfoDetails[index].StockQuantity;
+ currentQuantity += stockInfoDetails[index].StockQuantity;
+ x.AfterQuantity = stockInfoDetails[index].StockQuantity + beforeQuantity;
+ }
+ else
+ {
+ x.ChangeQuantity = -stockInfoDetails[index].StockQuantity;
+ currentQuantity -= stockInfoDetails[index].StockQuantity;
+ x.AfterQuantity = beforeQuantity - stockInfoDetails[index].StockQuantity;
+ }
- x.ChangeType = changeType.ObjToInt();
- beforeQuantity += x.ChangeQuantity;
- });
- BaseDal.AddData(stockQuantityChangeRecords);
+
+ x.ChangeType = changeType.ObjToInt();
+ beforeQuantity += x.ChangeQuantity;
+ x.TaskNum = taskNum;
+ index++;
+ });
+ BaseDal.AddData(stockQuantityChangeRecords);
+ }
+ catch (Exception ex)
+ {
+ 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