From 482ece71c06bcc49c38b0dc5d747b37a60d227fd Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期三, 11 二月 2026 17:25:04 +0800
Subject: [PATCH] 托盘半成品呼叫流程
---
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 274 ++++++++++++++++++++++++++++++------------------------
1 files changed, 150 insertions(+), 124 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
index 2fad111..f665f95 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs"
@@ -741,7 +741,7 @@
if (result.Item1 != null && result.Item1.Count > 0)
{
//鑾峰彇浠诲姟
- tasks = GetTasks(result.Item1, TaskTypeEnum.OldYLOutbound);
+ tasks = GetTasks(result.Item1.Where(x=> !x.LocationCode.IsNullOrEmpty()).ToList(), TaskTypeEnum.OldYLOutbound);
result.Item2.ForEach(x =>
{
if (result.Item3.FirstOrDefault(t=>t.OrderDetailId==x.Id)!=null)
@@ -751,7 +751,14 @@
});
result.Item3.ForEach(x =>
{
- x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+ if (x.LocationCode== "鑰佸巶缂撳瓨鍖�")
+ {
+ x.Status = OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ }
+ else
+ {
+ x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+ }
});
stockInfos = result.Item1;
@@ -829,42 +836,70 @@
WebResponseContent content = new WebResponseContent();
try
{
- //鏂板
- List<BSTPickInfoDTO> bSTPickInfosAdd = bSTPickInfoDTOs.Where(x => x.Way == 1).ToList();
- //鑾峰彇鏂板鏄庣粏棰嗘枡
- List<PaperMattakeDetailItem>? paperMattakeDetailItemsAdd = null;
- //淇敼
- List<BSTPickInfoDTO> bSTPickInfosUp = bSTPickInfoDTOs.Where(x => x.Way == 2).ToList();
- //鑾峰彇鏂板鏄庣粏棰嗘枡
- List<PaperMattakeDetailItem>? paperMattakeDetailItemsUp = null;
- if (bSTPickInfosAdd != null && bSTPickInfosAdd.Count > 0)
- {
- paperMattakeDetailItemsAdd = bSTPickInfosAdd.SelectMany(x => x.PaperMattakeDetails).ToList();
- }
- if (bSTPickInfosUp != null && bSTPickInfosUp.Count > 0)
- {
- paperMattakeDetailItemsUp = bSTPickInfosUp.SelectMany(x => x.PaperMattakeDetails).ToList();
- }
- //鑾峰彇鎵�鏈夊緟棰嗘枡鐨勫嚭搴撹鎯�
- List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.OrderType == OutOrderTypeEnum.OutSGPick.ObjToInt() && x.Status==OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt());
- #region 棰嗘枡閫昏緫
- if (paperMattakeDetailItemsAdd != null && paperMattakeDetailItemsAdd.Count > 0)
- {
- foreach (var item in paperMattakeDetailItemsAdd)
- {
- //鑾峰彇瀵瑰簲鐨�
- }
- }
- if (paperMattakeDetailItemsUp != null && paperMattakeDetailItemsUp.Count > 0)
+ //鑾峰彇棰嗘枡鏉$爜鍙婂簱瀛�
+ List<string> lockCodes = bSTPickInfoDTOs.SelectMany(x => x.PaperMattakeDetails).Select(x=>x.Barcode).Distinct().ToList();
+ List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.QueryData(x => lockCodes.Contains(x.PalletCode) && x.WarehouseId == WarehouseEnum.LLDOldCache.ObjToInt());
+ List<string> ExistNoCodes = lockCodes.Where(x => !stockInfos.Select(x=>x.PalletCode).Contains(x)).ToList();
+ //鑾峰彇寰呴鏂欑殑鍑哄簱璇︽儏
+ List<Dt_OutStockLockInfo> outStockLockInfos = _outboundRepository.OutStockLockInfoRepository.QueryData(x => x.OrderType == OutOrderTypeEnum.OutSGPick.ObjToInt() && x.Status==OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && lockCodes.Distinct().ToList().Contains(x.PalletCode));
+ //鍑哄簱璇︽儏鐘舵�佹洿鏂�
+ if (outStockLockInfos.Count > 0)
{
- foreach (var item in paperMattakeDetailItemsUp)
+ outStockLockInfos.ForEach(x =>
{
-
+ x.Status = OutLockStockStatusEnum.鍏抽棴.ObjToInt();
+ });
+ }
+ List<int> BSTPickDetailsId = outStockLockInfos.Select(x => x.OrderDetailId).Distinct().ToList();
+ //鑾峰彇瀵瑰簲鎺掔▼
+ List<Dt_OutSGOrder> outSGOrders = BaseDal.Db.Queryable<Dt_OutSGOrder>().Where(x => x.OutSGOrderStatus < OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).Includes(x => x.Details)
+ .Where(x => x.Details
+ .Any(v =>
+ BSTPickDetailsId.Contains(v.Id))
+ ).OrderBy(x => x.CreateDate).ToList();
+ List<Dt_OutSGOrderDetail> orderDetails = new List<Dt_OutSGOrderDetail>();
+ //澶勭悊鎺掔▼
+ if (outSGOrders.Count>0)
+ {
+ orderDetails = outSGOrders.SelectMany(x=>x.Details).Where(x=> BSTPickDetailsId.Contains(x.Id)).ToList();
+ orderDetails.ForEach(x =>
+ {
+ x.OutSGOrderDetailStatus = OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ });
+ foreach (var item in outSGOrders)
+ {
+ int overCount = item.Details.Where(x=>x.OutSGOrderDetailStatus==OutLockStockStatusEnum.鍑哄簱瀹屾垚.ObjToInt()).Count();
+ int thisCount = orderDetails.Where(x => x.OutSGOrderId == item.Id).Count();
+ if ((overCount + thisCount) == item.Details.Count)
+ {
+ item.OutSGOrderStatus = OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt();
+ }
}
-
+ }
+ //鑾峰彇鎵�鏈夊緟棰嗘枡鐨勫簱瀛�
+ #region 棰嗘枡閫昏緫
+ foreach (var item in stockInfos)
+ {
+ if (item.StockStatus==StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt())
+ {
+ item.StockLength = 0;
+ item.MaterielWeight = 0;
+ item.MaterielThickness = 0;
+ item.MaterielWide = 0;
+ item.StockOutLength = 0;
+ item.IsFull = WhetherEnum.True.ObjToInt();
+ item.IsPick = WhetherEnum.True.ObjToInt();
+ }
}
#endregion
+ _unitOfWorkManage.BeginTran();
+ _stockRepository.StockInfoRepository.UpdateData(stockInfos);
+ _outboundRepository.OutStockLockInfoRepository.UpdateData(outStockLockInfos);
+ _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders);
+ _outboundRepository.OutSGOrderDetailRepository.UpdateData(orderDetails);
+ _unitOfWorkManage.CommitTran();
+ content.OK(ExistNoCodes.Count>0 ? string.Join(",", ExistNoCodes)+"鑰佸巶鍙墸搴撳瓨涓嶅瓨鍦�" : "");
}
catch (Exception ex)
{
@@ -970,99 +1005,90 @@
_unitOfWorkManage.BeginTran();
//鎿嶄綔鏁版嵁锛屽苟鍒嗛厤闇�姹傚簱瀛�
_outboundRepository.OutMESOrderRepository.AddData(AddoutMESOrders);
- List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
- {
- List<Dt_Task> tasks = new List<Dt_Task>();
- List<Dt_ProStockInfo>? stockInfos = null;
- List<Dt_OutMESOrder>? Orders = null;
- List<Dt_OutStockLockInfo>? outStockLockInfos = null;
- List<Dt_LocationInfo>? locationInfos = null;
- {
- if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count>0)
- {
- //鍒嗛厤搴撳瓨
- (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
- if (result.Item1 != null && result.Item1.Count > 0)
- {
- //鍒涘缓浠诲姟
- tasks = GetTasks(result.Item1, result.Item3);
- result.Item2.ForEach(x =>
- {
- OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
- });
- result.Item3.ForEach(x =>
- {
- x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
- });
+ //List<Dt_OutMESOrder> mESOrders = _outboundRepository.OutMESOrderRepository.QueryData(x => AddoutMESOrders.Select(x => x.OutDetailId).Contains(x.OutDetailId));
+ //{
+ // List<Dt_Task> tasks = new List<Dt_Task>();
+ // List<Dt_ProStockInfo>? stockInfos = null;
+ // List<Dt_OutMESOrder>? Orders = null;
+ // List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+ // List<Dt_LocationInfo>? locationInfos = null;
+ // {
+ // if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList().Count>0)
+ // {
+ // //鍒嗛厤搴撳瓨
+ // (List<Dt_ProStockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignProStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDFL.ObjToInt()).ToList());
+ // if (result.Item1 != null && result.Item1.Count > 0)
+ // {
+ // //鍒涘缓浠诲姟
+ // tasks = GetTasks(result.Item1, result.Item3);
+ // result.Item3.ForEach(x =>
+ // {
+ // x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+ // });
+ // stockInfos = result.Item1;
+ // Orders = result.Item2;
+ // outStockLockInfos = result.Item3;
+ // locationInfos = result.Item4;
+ // }
+ // }
+ // }
+ // if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
+ // {
+ // BaseDal.AddData(tasks);
+ // stockInfos.ForEach(x =>
+ // {
+ // x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ // });
+ // WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
- stockInfos = result.Item1;
- Orders = result.Item2;
- outStockLockInfos = result.Item3;
- locationInfos = result.Item4;
- }
- }
- }
- if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
- {
- BaseDal.AddData(tasks);
- stockInfos.ForEach(x =>
- {
- x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
- });
- WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
-
- if (!contentResponse.Status)
- {
- _unitOfWorkManage.RollbackTran();
- return content.Error(contentResponse.Message);
- }
- }
- }
- {
- List<Dt_Task> tasks = new List<Dt_Task>();
- List<Dt_StockInfo>? stockInfos = null;
- List<Dt_OutMESOrder>? Orders = null;
- List<Dt_OutStockLockInfo>? outStockLockInfos = null;
- List<Dt_LocationInfo>? locationInfos = null;
- {
- if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
- {
- //鍒嗛厤搴撳瓨
- (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
- if (result.Item1 != null && result.Item1.Count > 0)
- {
- //鍒涘缓浠诲姟
- tasks = GetTasks(result.Item1, result.Item3);
- result.Item2.ForEach(x =>
- {
- OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
- });
- result.Item3.ForEach(x =>
- {
- x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
- });
- stockInfos = result.Item1;
- Orders = result.Item2;
- outStockLockInfos = result.Item3;
- locationInfos = result.Item4;
- }
- }
- }
- if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
- {
- BaseDal.AddData(tasks);
- stockInfos.ForEach(x =>
- {
- x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
- });
- WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
- if (!contentResponse.Status)
- {
- _unitOfWorkManage.RollbackTran();
- return content.Error(contentResponse.Message);
- }
- }
- }
+ // if (!contentResponse.Status)
+ // {
+ // _unitOfWorkManage.RollbackTran();
+ // return content.Error(contentResponse.Message);
+ // }
+ // }
+ //}
+ //{
+ // List<Dt_Task> tasks = new List<Dt_Task>();
+ // List<Dt_StockInfo>? stockInfos = null;
+ // List<Dt_OutMESOrder>? Orders = null;
+ // List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+ // List<Dt_LocationInfo>? locationInfos = null;
+ // {
+ // if (mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList().Count > 0)
+ // {
+ // //鍒嗛厤搴撳瓨
+ // (List<Dt_StockInfo>, List<Dt_OutMESOrder>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutMESOrderService.AssignStockOutbound(mESOrders.Where(x => x.WarehouseId == WarehouseEnum.LLDYL.ObjToInt()).ToList());
+ // if (result.Item1 != null && result.Item1.Count > 0)
+ // {
+ // //鍒涘缓浠诲姟
+ // tasks = GetTasks(result.Item1, result.Item3);
+ // result.Item3.ForEach(x =>
+ // {
+ // x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+ // });
+ // stockInfos = result.Item1;
+ // Orders = result.Item2;
+ // outStockLockInfos = result.Item3;
+ // locationInfos = result.Item4;
+ // }
+ // }
+ // }
+ // if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0 && tasks.Count>0)
+ // {
+ // BaseDal.AddData(tasks);
+ // stockInfos.ForEach(x =>
+ // {
+ // x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ // });
+ // WebResponseContent contentResponse = _outboundService.OutMESOrderService.LockOutboundStockDataUpdate(stockInfos, Orders, outStockLockInfos, locationInfos, tasks: tasks);
+ // if (!contentResponse.Status)
+ // {
+ // _unitOfWorkManage.RollbackTran();
+ // return content.Error(contentResponse.Message);
+ // }
+ // }
+ //}
_unitOfWorkManage.CommitTran();
return content.OK("鎺ユ敹鎴愬姛");
--
Gitblit v1.9.3