From c15afa484bd9f866bce980d01e18f1c9bdaa980f Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期三, 17 十二月 2025 17:06:58 +0800
Subject: [PATCH] 1
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs | 49 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 39 insertions(+), 10 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/OutboundService.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/OutboundService.cs"
index aa37561..6c5a0ce 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/OutboundService.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/OutboundService.cs"
@@ -44,8 +44,9 @@
private readonly IRepository<Dt_StockQuantityChangeRecord> _stockChangeRepository;
private readonly IRepository<Dt_StockInfoDetail_Hty> _stockDetailHistoryRepository;
private readonly IFeedbackMesService _feedbackMesService;
+ private readonly IRepository<Dt_Task> _taskRepository;
- public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService)
+ public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository)
{
_mapper = mapper;
_unitOfWorkManage = unitOfWorkManage;
@@ -63,6 +64,7 @@
_stockDetailHistoryRepository = stockDetailHistoryRepository;
_basicService = basicService;
_feedbackMesService = feedbackMesService;
+ _taskRepository = taskRepository;
}
#region 鍑哄簱鍒嗛厤
@@ -138,14 +140,18 @@
pickedDetails.AddRange(materielPickedDetails.PickedDetails);
+ decimal allallocatedQuantity = materielCalc.UnallocatedQuantity;
// 鏇存柊鍑哄簱鍗曟槑缁嗭紙澧炲姞閿佸畾鏁伴噺锛屼笉澧炲姞宸插嚭鏁伴噺锛�
foreach (var detail in materielCalc.Details)
{
+ if (allallocatedQuantity <= 0) break;
+
decimal lockQuantity = (detail.OrderQuantity - detail.OverOutQuantity);
if (lockQuantity < materielCalc.UnallocatedQuantity)
{
detail.LockQuantity += lockQuantity; // 澧炲姞閿佸畾鏁伴噺 涓嶆洿鏂� OverOutQuantity 鍜� OrderDetailStatus锛屽洜涓鸿繕娌℃湁瀹為檯鍑哄簱
outboundOrderDetails.Add(detail);
+ materielCalc.UnallocatedQuantity -= lockQuantity;
}
else
{
@@ -170,6 +176,9 @@
// 7. 鏇存柊搴撳瓨璇︽儏
UpdateOutStockLockInfo(outStockLockInfos);
+
+ // 8. 娣诲姞浠诲姟鏁版嵁
+ _taskRepository.AddData(tasks);
_unitOfWorkManage.CommitTran();
@@ -267,6 +276,18 @@
return result;
}
+ decimal inputQuantity = request.OutboundQuantity.Value;
+ List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>();
+ foreach (var item in selectedDetails)
+ {
+ inputQuantity -= (item.OrderQuantity - item.MoveQty - item.LockQuantity);
+ outboundOrderDetails.Add(item);
+ if (inputQuantity <= 0)
+ {
+ break;
+ }
+ }
+
result.MaterielCalculations = new List<MaterielOutboundCalculationDTO>()
{
new MaterielOutboundCalculationDTO
@@ -281,9 +302,11 @@
AssignedQuantity = lockQuantity,
UnallocatedQuantity = request.OutboundQuantity.Value,
MovedQuantity = moveQuantity,
- Details = selectedDetails
+ Details = outboundOrderDetails
}
};
+
+ outboundOrder.Details = outboundOrderDetails;
}
result.CanOutbound = true;
@@ -790,7 +813,7 @@
}
#endregion
-
+ #region 鎷i��
/// <summary>
/// 鍑哄簱瀹屾垚澶勭悊锛堟壂鎻忔潯鐮佹墸鍑忓簱瀛橈級
/// </summary>
@@ -885,12 +908,12 @@
return WebResponseContent.Instance.Error($"鏃犳硶鍑哄簱锛屾潯鐮侊細{request.Barcode}锛屽簱瀛橈細{stockDetail.StockQuantity}锛屽凡鍑哄簱锛歿totalAllocatedQuantity}锛屽垎閰嶉噺锛歿lockInfo.AssignQuantity}锛屾槑缁嗗墿浣欙細{detailRemainingQuantity}");
}
- if (actualOutboundQuantity + lockInfo.SortedQuantity > lockInfo.AssignQuantity)
- {
- response.Success = false;
- response.Message = $"鏃犳硶鍑哄簱锛屾潯鐮侊細{request.Barcode}锛屽簱瀛橈細{stockDetail.StockQuantity}锛屽嚭搴撻噺{actualOutboundQuantity + lockInfo.SortedQuantity}澶т簬鍒嗛厤閲弡lockInfo.AssignQuantity}";
- return WebResponseContent.Instance.Error($"鏃犳硶鍑哄簱锛屾潯鐮侊細{request.Barcode}锛屽簱瀛橈細{stockDetail.StockQuantity}锛屽嚭搴撻噺{actualOutboundQuantity + lockInfo.SortedQuantity}澶т簬鍒嗛厤閲弡lockInfo.AssignQuantity}");
- }
+ //if (actualOutboundQuantity + lockInfo.SortedQuantity > lockInfo.AssignQuantity)
+ //{
+ // response.Success = false;
+ // response.Message = $"鏃犳硶鍑哄簱锛屾潯鐮侊細{request.Barcode}锛屽簱瀛橈細{stockDetail.StockQuantity}锛屽嚭搴撻噺{actualOutboundQuantity + lockInfo.SortedQuantity}澶т簬鍒嗛厤閲弡lockInfo.AssignQuantity}";
+ // return WebResponseContent.Instance.Error($"鏃犳硶鍑哄簱锛屾潯鐮侊細{request.Barcode}锛屽簱瀛橈細{stockDetail.StockQuantity}锛屽嚭搴撻噺{actualOutboundQuantity + lockInfo.SortedQuantity}澶т簬鍒嗛厤閲弡lockInfo.AssignQuantity}");
+ //}
// 8. 鍒ゆ柇鏄惁闇�瑕佹媶鍖咃紙褰撳嚭搴撴暟閲忓皬浜庡簱瀛樻暟閲忔椂闇�瑕佹媶鍖咃級
bool isUnpacked = actualOutboundQuantity < stockDetail.StockQuantity;
@@ -930,6 +953,8 @@
// item.OverOutQuantity = item.OrderQuantity - item.MoveQty;
//}
+ decimal barcodeQuantity = allocatedQuantity;
+
if (item.LockQuantity - item.OverOutQuantity >= allocatedQuantity)
{
item.OverOutQuantity += allocatedQuantity;
@@ -938,6 +963,7 @@
}
else
{
+ barcodeQuantity = item.LockQuantity - item.OverOutQuantity;
allocatedQuantity -= (item.LockQuantity - item.OverOutQuantity);
item.OverOutQuantity = item.LockQuantity;
item.CurrentDeliveryQty = item.LockQuantity;
@@ -949,7 +975,7 @@
Barcodes barcodes = new Barcodes
{
Barcode = request.Barcode,
- Qty = actualOutboundQuantity,
+ Qty = barcodeQuantity,
SupplyCode = stockDetail?.SupplyCode ?? "",
BatchNo = stockDetail?.BatchNo ?? "",
Unit = stockDetail?.Unit ?? ""
@@ -1012,6 +1038,7 @@
if (CheckOutboundOrderCompleted(request.OrderNo))
{
UpdateOutboundOrderStatus(request.OrderNo, OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt());
+
//todo: 鍥炰紶MES
}
@@ -1325,5 +1352,7 @@
// 妫�鏌ユ墍鏈夋槑缁嗙殑宸插嚭鏁伴噺鏄惁閮界瓑浜庡崟鎹暟閲�
return details.All(x => x.OverOutQuantity >= x.OrderQuantity - x.MoveQty);
}
+
+ #endregion
}
}
--
Gitblit v1.9.3