From 81946b468aff97b96fe50186246d3a853ce79b1b Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期五, 06 三月 2026 11:38:48 +0800
Subject: [PATCH] 增加已有任务超时提示在任务完成后自动清除
---
项目代码/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
index 374b95b..506accf 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_OutboundService/OutSGOrderDetailService.cs"
@@ -5,8 +5,10 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.StockEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Helper;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundRepository;
@@ -72,14 +74,16 @@
foreach (var item in groupDetails)
{
decimal needQuantity = item.XqLen;
- //鑾峰彇鍙敤搴撳瓨
- List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId);
+ //鑾峰彇鑰佸巶缂撳瓨鍙敤搴撳瓨
+ List<Dt_StockInfo> stockInfos = _stockService.StockInfoService.GetUseOldCacheStocks(item.MaterialNo, item.Width) ?? new List<Dt_StockInfo>();
+ //鑾峰彇绔嬪簱鍙敤搴撳瓨
+ stockInfos.AddRange(_stockService.StockInfoService.GetUseableStocks(item.MaterialNo, item.Width, outBSTOrders.FirstOrDefault().WarehouseId).Where(x=>!outStocks.Select(x=>x.PalletCode).Contains(x.PalletCode)).ToList());
if (!stockInfos.Any())
{
- throw new Exception($"鏈壘鍒板彲鍒嗛厤搴撳瓨");
+ continue;
}
//鍒嗛厤瀹為檯搴撳瓨
- List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, needQuantity).OrderBy(x => x.StockLength - x.StockOutLength).ToList();
+ List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutOldStocks(stockInfos, needQuantity).ToList();
//娣诲姞搴撳瓨鍒嗛厤
outStocks.AddRange(autoAssignStocks);
//鑾峰彇鎵�鏈夎鐗╂枡鍗曟嵁
@@ -100,17 +104,20 @@
decimal orderDetailNeedQuantity = details[i].XqLen - detailAssignQuantity;
+ if (autoAssignStocks.Count==0)
+ {
+ break;
+ }
+
decimal useStockLength = autoAssignStocks[0].StockLength- autoAssignStocks[0].StockOutLength;
Dt_OutSGOrder? sGOrder = outBSTOrders.FirstOrDefault(x => x.Id == details[i].OutSGOrderId);
if (orderDetailNeedQuantity > useStockLength)
{
-
//鐢熸垚璇︽儏
Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(sGOrder, details[i], autoAssignStocks[0], useStockLength);
outStockLockInfos.Add(outStockLockInfo);
details[i].AssignTotalUsage += useStockLength;
autoAssignStocks.Remove(autoAssignStocks[0]);
-
}
else
{
@@ -118,14 +125,18 @@
Dt_OutStockLockInfo outStockLockInfo = _outStockLockInfoService.GetOutStockLockInfo(sGOrder, details[i], autoAssignStocks[0], orderDetailNeedQuantity);
outStockLockInfos.Add(outStockLockInfo);
details[i].AssignTotalUsage = orderQuantity;
- autoAssignStocks[0].StockOutLength-= orderDetailNeedQuantity;
+ autoAssignStocks[0].StockOutLength+= orderDetailNeedQuantity;
+ if (autoAssignStocks[0].StockOutLength== autoAssignStocks[0].StockLength)
+ {
+ autoAssignStocks.Remove(autoAssignStocks[0]);
+ }
assignStop =false;
}
}
}
- locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()));
+ locationInfos.AddRange(_basicRepository.LocationInfoRepository.GetLocationInfos(outStocks.Where(x=>!x.LocationCode.IsNullOrEmpty() && !locationInfos.Select(x=>x.LocationCode).Contains(x.LocationCode)).Select(x => x.LocationCode).ToList()));
}
return (outStocks, outboundOrderDetails, outStockLockInfos, locationInfos);
@@ -137,6 +148,10 @@
{
try
{
+ stockInfos.Where(x => x.LocationCode.IsNullOrEmpty()).ToList().ForEach(x =>
+ {
+ x.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
+ });
_stockService.StockInfoService.Repository.UpdateData(stockInfos);
BaseDal.UpdateData(outboundOrderDetails);
--
Gitblit v1.9.3