From e4e304318532574e418bc01b5a45b8836dac3e1a Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期四, 11 十二月 2025 23:26:20 +0800
Subject: [PATCH] 提交
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs | 56 ++++++++++----------------------------------------------
1 files changed, 10 insertions(+), 46 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
index bf49e91..664827c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundOrderDetailService.cs"
@@ -78,13 +78,14 @@
// 鎸夌墿鏂欏拰鎵规鍒嗙粍澶勭悊
var groupDetails = outboundOrderDetails
- .GroupBy(x => new { x.MaterielCode, x.BatchNo, x.SupplyCode })
+ .GroupBy(x => new { x.MaterielCode, x.BatchNo, x.SupplyCode,x.WarehouseCode })
.Select(x => new
{
MaterielCode = x.Key.MaterielCode,
BatchNo = x.Key.BatchNo,
SupplyCode = x.Key.SupplyCode,
Details = x.ToList(),
+ WarehouseCode=x.Key.WarehouseCode,
TotalNeedQuantity = CalculateReassignNeedQuantity(x.ToList())
})
.Where(x => x.TotalNeedQuantity > 0)
@@ -93,9 +94,9 @@
foreach (var item in groupDetails)
{
var needQuantity = item.TotalNeedQuantity;
-
+
// 鑾峰彇鍙敤搴撳瓨锛堟寜鍏堣繘鍏堝嚭鎺掑簭锛�
- List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, item.SupplyCode);
+ List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, item.SupplyCode,item.WarehouseCode, outboundOrder.FactoryArea);
if (!stockInfos.Any())
{
@@ -311,12 +312,13 @@
// 鎸夌墿鏂欏拰鎵规鍒嗙粍澶勭悊锛堣繖閲屽彧鏈変竴涓槑缁嗭級
var groupDetails = new List<Dt_OutboundOrderDetail> { orderDetail }
- .GroupBy(x => new { x.MaterielCode, x.BatchNo, x.SupplyCode })
+ .GroupBy(x => new { x.MaterielCode, x.BatchNo, x.SupplyCode ,x.WarehouseCode})
.Select(x => new
{
MaterielCode = x.Key.MaterielCode,
BatchNo = x.Key.BatchNo,
SupplyCode = x.Key.SupplyCode,
+ WarehouseCode=x.Key.WarehouseCode,
Details = x.ToList(),
TotalNeedQuantity = batchQuantity // 浣跨敤鍒嗘壒鏁伴噺
})
@@ -328,7 +330,7 @@
var needQuantity = item.TotalNeedQuantity;
// 鑾峰彇鍙敤搴撳瓨锛堟寜鍏堣繘鍏堝嚭鎺掑簭锛�
- List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, item.SupplyCode);
+ List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterielCode, item.BatchNo, item.SupplyCode,item.WarehouseCode,outboundOrder.FactoryArea);
if (!stockInfos.Any())
{
throw new Exception($"鐗╂枡[{item.MaterielCode}]鎵规[{item.BatchNo}]鏈壘鍒板彲鍒嗛厤搴撳瓨");
@@ -669,47 +671,7 @@
if (remainingNeedQuantity > 0)
{
- //// 鍙�夛細杩欓噷鍙互鏍规嵁涓氬姟闇�姹傚喅瀹氭槸鍚﹀厑璁歌嚜鍔ㄥ垎閰�
- //// 濡傛灉瑕佹眰涓ユ牸鎸夌敤鎴烽�夋嫨鍑哄簱锛屽彲浠ユ姏鍑哄紓甯�
- //// throw new Exception($"鐢ㄦ埛閫夋嫨鐨勫簱瀛樻暟閲忎笉瓒筹紝杩橀渶{remainingNeedQuantity}锛岃閲嶆柊閫夋嫨");
-
- //// 濡傛灉闇�瑕佽嚜鍔ㄥ垎閰嶏紝璁板綍鏃ュ織
- //_logger.LogInformation($"鐢ㄦ埛閫夋嫨鐨勫簱瀛樻暟閲忎笉瓒筹紝杩橀渶{remainingNeedQuantity}锛岀郴缁熷皢鑷姩鍒嗛厤");
-
- //List<Dt_StockInfo> autoStocks = _stockService.StockInfoService.GetUseableStocks(
- // outboundOrderDetail.MaterielCode,
- // outboundOrderDetail.BatchNo,
- // "");
-
- //// 鎺掗櫎鐢ㄦ埛宸查�夋嫨涓斿凡鍒嗛厤鐨勬墭鐩�
- //var assignedPalletCodes = outStocks.Select(x => x.PalletCode).ToList();
- //autoStocks = autoStocks
- // .Where(x => !assignedPalletCodes.Contains(x.PalletCode))
- // .ToList();
-
- //var (autoAssignStocks, stockAllocations) = _stockService.StockInfoService.GetOutboundStocks(
- // autoStocks,
- // outboundOrderDetail.MaterielCode,
- // remainingNeedQuantity,
- // out decimal residueQuantity);
-
- //if (autoAssignStocks != null && autoAssignStocks.Any())
- //{
- // outStocks.AddRange(autoAssignStocks);
-
- // // 涓鸿嚜鍔ㄥ垎閰嶇殑搴撳瓨鍒涘缓閿佸畾璁板綍
- // var autoLockInfos = CreateLockInfosForAutoAssign(outboundOrder, outboundOrderDetail, autoAssignStocks, stockAllocations);
- // outStockLockInfos.AddRange(autoLockInfos);
-
- // // 鏇存柊宸插垎閰嶆暟閲�
- // decimal autoAssignedQuantity = remainingNeedQuantity - residueQuantity;
- // totalAssignedFromUserSelection += autoAssignedQuantity;
- // remainingNeedQuantity = residueQuantity; // 鏇存柊鍓╀綑闇�姹�
- //}
- //else if (remainingNeedQuantity > 0)
- //{
- // _logger.LogWarning($"鑷姩鍒嗛厤澶辫触锛屽墿浣欓渶姹倇remainingNeedQuantity}鏃犳硶婊¤冻");
- //}
+
}
// 鏇存柊閿佸畾鏁伴噺
@@ -762,6 +724,8 @@
.Where(d => d.MaterielCode == detail.MaterielCode &&
(d.StockQuantity - d.OutboundQuantity) > 0 &&
d.Barcode == barcode); // 鍙垎閰嶆寚瀹氭潯鐮�
+
+ query = query.Where(x => x.WarehouseCode == detail.WarehouseCode);
if (!string.IsNullOrEmpty(detail.BatchNo))
{
--
Gitblit v1.9.3