From f7ad3416dfc1558be842f3190688adc9a5a8933d Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期日, 18 一月 2026 14:51:23 +0800
Subject: [PATCH] 添加盘点,合托流程
---
WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 67 ++++++++++++++++++++++++---------
1 files changed, 48 insertions(+), 19 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
index 783f84f..a75be4d 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
@@ -213,6 +213,7 @@
Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
Mgeneratetime = DateTime.Now,
WarehouseId = warehouse.WarehouseId,
+ System = inboundOrder.System,
Details = new List<Dt_StockInfoDetail>()
};
}
@@ -442,7 +443,7 @@
{
stockInfo = new Dt_StockInfo()
{
- BatchNo = inboundOrderDet.BatchNo,
+ BatchNo = "",
PalletCode = palletCode,
PalletType = GetPalletType(warehouse, palletCode),//GetPalletType(warehouse, palletCode)
IsFull = true,
@@ -454,6 +455,7 @@
Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
Mgeneratetime = DateTime.Now,
WarehouseId = warehouse.WarehouseId,
+ System = inboundOrder.System,
Details = new List<Dt_StockInfoDetail>()
};
}
@@ -757,6 +759,7 @@
Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
Mgeneratetime = DateTime.Now,
WarehouseId = warehouse.WarehouseId,
+ System = inboundOrder.System,
Details = new List<Dt_StockInfoDetail>()
};
}
@@ -904,10 +907,46 @@
{
throw new Exception("搴撳瓨鏈壘鍒版墭鐩樺彿");
}
+
+ var sameItems = from sourceItem in stockInfo.Details
+ join targetItem in targetstockInfo.Details
+ on new
+ {
+ sourceItem.BatchNo,
+ sourceItem.MaterielName,
+ sourceItem.MaterielCode
+ }
+ equals new
+ {
+ targetItem.BatchNo,
+ targetItem.MaterielName,
+ targetItem.MaterielCode
+ }
+ select new
+ {
+ SourceItem = sourceItem,
+ TargetItem = targetItem,
+ BatchNo = sourceItem.BatchNo,
+ MaterialCode = sourceItem.MaterielCode,
+ MaterialType = sourceItem.MaterielName
+ };
+
+ var matchedSourceItemIds = sameItems.Select(x => x.SourceItem.Id).ToList();
+
foreach (var item in stockInfo.Details)
{
- item.StockId = targetstockInfo.Id;
+ if (!matchedSourceItemIds.Contains(item.Id))
+ {
+ item.StockId = targetstockInfo.Id;
+ }
}
+ var differentItems = stockInfo.Details
+ .Where(x => !matchedSourceItemIds.Contains(x.Id))
+ .ToList();
+ targetstockInfo.Details = targetstockInfo.Details
+ .Where(x => !matchedSourceItemIds.Contains(x.Id))
+ .Concat(differentItems)
+ .ToList();
if (warehouse.WarehouseCode == "SC02_CP")
{
warehouse.WarehouseCode = "SC01_CP";
@@ -940,21 +979,6 @@
}).ToList()
}
}
- // Parameters = stockInfo.Details.Select(g => new HouseSyncretism.data
- // {
- // Lpn = stockInfo.PalletCode,
- // MoveType = 0,
- // WareHouseCode = warehouse.WarehouseCode,
- // ItemCode = g.MaterielCode,
- // MoveNumber = g.StockQuantity,
- // //LotNo = g.,
- // WipBatch = g.BatchNo,
- // LocationName = stockInfo.PalletCode,
- // TargetLocName = targetstockInfo.PalletCode,
- // TargetLpn = targetstockInfo.PalletCode,
-
- // }).ToList()
- //};
};
var authResult = AuthenticateWithWMS();
if (authResult.IsSuccess)
@@ -975,10 +999,15 @@
}
_unitOfWorkManage.BeginTran();
- targetstockInfo.Details.AddRange(stockInfo.Details);
+ foreach (var sameItem in sameItems)
+ {
+ sameItem.TargetItem.StockQuantity += sameItem.SourceItem.StockQuantity;
+ _stockRepository.StockInfoDetailRepository.UpdateData(sameItem.TargetItem);
+ _stockRepository.StockInfoDetailRepository.DeleteData(sameItem.SourceItem);
+ }
_stockRepository.StockInfoRepository.UpdateData(targetstockInfo);
- _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details);
_stockRepository.StockInfoRepository.DeleteData(stockInfo);
+
_unitOfWorkManage.CommitTran();
webResponseContent = WebResponseContent.Instance.OK("鍚堟墭鎴愬姛");
}
--
Gitblit v1.9.3