From fd5a43c2e677740482b8d25195120ffa75c5ac77 Mon Sep 17 00:00:00 2001
From: yangpeixing <yangpeixing@hnkhzn.com>
Date: 星期一, 19 一月 2026 15:47:29 +0800
Subject: [PATCH] 1
---
WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs | 65 +++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 18 deletions(-)
diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Base/InboundOrderService.cs
index 798eb01..92a3b43 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>()
};
}
@@ -454,6 +455,7 @@
Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
Mgeneratetime = DateTime.Now,
WarehouseId = warehouse.WarehouseId,
+ System = inboundOrder.System,
Details = new List<Dt_StockInfoDetail>()
};
}
@@ -722,6 +724,7 @@
Wlstatus = (int)InventoryMaterialStatus.鍚堟牸,
Mgeneratetime = DateTime.Now,
WarehouseId = warehouse.WarehouseId,
+ System = inboundOrder.System,
Details = new List<Dt_StockInfoDetail>()
};
}
@@ -869,10 +872,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";
@@ -905,21 +944,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)
@@ -940,10 +964,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