From ce40df5daffae0d17b4e9fa7cb6d677afaa4d66f Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 17 十月 2025 11:20:30 +0800
Subject: [PATCH] 更新最新程序,ERP代码,MES代码等
---
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Outbound.cs | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 167 insertions(+), 10 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 cc38fa8..476fc92 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"
@@ -229,7 +229,7 @@
/// 鎴愬搧鍑哄簱
/// </summary>
/// <returns></returns>
- public WebResponseContent RequestCPWMSTaskOut(string materialCode,int Count, int targetId)
+ public WebResponseContent RequestCPWMSTaskOut(string materialCode,int Count, string targetId)
{
WebResponseContent content = new WebResponseContent();
try
@@ -241,13 +241,19 @@
}
//鑾峰彇璐т綅
List<Dt_LocationInfo> locationInfos = _basicRepository.LocationInfoRepository.QueryData(x => x.WarehouseId == WarehouseEnum.LLDCP.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyOut.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt());
-
- //鑾峰彇鍙敤搴撳瓨
- List<Dt_ProStockInfo> stockInfos = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).Includes(x => x.proStockInfoDetails)
- .Where(x => x.proStockInfoDetails
- .Any(v =>
- v.ProductCode == materialCode)
- ).Take(Count).ToList();
+ List<Dt_ProStockInfo> stockInfos = new List<Dt_ProStockInfo>();
+ if (materialCode=="1")
+ {
+ stockInfos = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.ProStockAttribute==ProStockAttributeEnum.绌烘墭.ObjToInt()).Take(Count).ToList();
+ }
+ else
+ {
+ stockInfos = BaseDal.Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Select(x => x.LocationCode).Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()).Includes(x => x.proStockInfoDetails)
+ .Where(x => x.proStockInfoDetails
+ .Any(v =>
+ v.ProductCode == materialCode)
+ ).Take(Count).ToList();
+ }
if (stockInfos.Count!=Count)
{
@@ -265,10 +271,15 @@
}
TaskTypeEnum typeEnum = targetId switch
{
- (int)AGVStationAreaEnum.AreaA => TaskTypeEnum.OutProduct,
- (int)AGVStationAreaEnum.AreaC => TaskTypeEnum.OutWFB,
+ nameof(AGVStationAreaEnum.涓�妤兼湀鍙扮爜澶�) => TaskTypeEnum.OutProduct,
+ nameof(AGVStationAreaEnum.涓�妤兼棤绾虹粐甯�) => TaskTypeEnum.OutWFB,
+ nameof(AGVStationAreaEnum.涓�妤兼棤绾烘穻鑶�) => TaskTypeEnum.OutWFBLM,
_ => throw new Exception("鏈壘鍒板搴斾换鍔�")
};
+ if (materialCode == "1")
+ {
+ typeEnum = TaskTypeEnum.OutEmpty;
+ }
List<Dt_Task> tasks = GetTasks(stockInfos, typeEnum, AssignLocations);
if (tasks == null || tasks.Count <= 0)
{
@@ -525,5 +536,151 @@
}
}
+ /// <summary>
+ /// 鍒涘缓鍘熺焊鐢熺鎺掔▼鍑哄簱浠诲姟
+ /// </summary>
+ /// <param name="keys"></param>
+ /// <returns></returns>
+ public WebResponseContent CreateSGOutboundTasks(int[] keys)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ List<Dt_Task> tasks = new List<Dt_Task>();
+ List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>();
+ List<Dt_OutSGOrderDetail> outSGOrderDetails = new List<Dt_OutSGOrderDetail>();
+ List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>();
+ List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
+ //鐢熸垚浠诲姟銆佸簱瀛樼瓑淇℃伅
+ (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutSGTaskDataHandle(keys);
+ if (result.Item2 != null && result.Item2.Count > 0)
+ {
+ stockInfos.AddRange(result.Item2);
+ }
+ if (result.Item3 != null && result.Item3.Count > 0)
+ {
+ outSGOrderDetails.AddRange(result.Item3);
+ }
+ if (result.Item4 != null && result.Item4.Count > 0)
+ {
+ outStockLockInfos.AddRange(result.Item4);
+ }
+ if (result.Item5 != null && result.Item5.Count > 0)
+ {
+ locationInfos.AddRange(result.Item5);
+ }
+ if (result.Item1 != null && result.Item1.Count > 0)
+ {
+ tasks.AddRange(result.Item1);
+ }
+ //澶勭悊鍑哄簱鏁版嵁
+ return GenerateOutboundTaskDataUpdate(tasks, stockInfos, outSGOrderDetails, outStockLockInfos, locationInfos);
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ /// <summary>
+ /// 鍑哄簱浠诲姟鏁版嵁澶勭悊
+ /// </summary>
+ /// <param name="orderDetailId"></param>
+ /// <param name="stockSelectViews"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutSGOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutSGTaskDataHandle(int[] keys)
+ {
+ List<Dt_Task> tasks = new List<Dt_Task>();
+ List<Dt_OutSGOrderDetail> outSGOrderDetails = _outboundRepository.OutSGOrderDetailRepository.QueryData(x => keys.Contains(x.Id));
+
+ if (outSGOrderDetails == null || outSGOrderDetails.Count == 0)
+ {
+ throw new Exception("鏈壘鍒板嚭搴撳崟鏄庣粏淇℃伅");
+ }
+ Dt_OutSGOrderDetail? outBSTOrderDetail = outSGOrderDetails.FirstOrDefault(x => x.OutSGOrderDetailStatus != OutOrderStatusEnum.鏈紑濮�.ObjToInt());
+ if (outBSTOrderDetail != null)
+ {
+ throw new Exception($"鍑哄簱鏄庣粏{nameof(Dt_OutSGOrderDetail.BoardMpsDetailId)}{outBSTOrderDetail.BoardMpsDetailId}鐗╂枡{outBSTOrderDetail.MaterialNo},鍑哄簱涓垨宸插畬鎴�");
+ }
+ List<Dt_StockInfo>? stockInfos = null;
+ List<Dt_OutSGOrderDetail>? orderDetails = null;
+ List<Dt_OutStockLockInfo>? outStockLockInfos = null;
+ List<Dt_LocationInfo>? locationInfos = null;
+
+ //鍒嗛厤搴撳瓨
+ (List<Dt_StockInfo>, List<Dt_OutSGOrderDetail>, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundService.OutSGOrderDetailService.AssignStockOutbound(outSGOrderDetails);
+ if (result.Item1 != null && result.Item1.Count > 0)
+ {
+ //鑾峰彇浠诲姟
+ tasks = GetTasks(result.Item1, TaskTypeEnum.OldYLOutbound);
+
+ result.Item2.ForEach(x =>
+ {
+ x.OutSGOrderDetailStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
+ });
+ result.Item3.ForEach(x =>
+ {
+ x.Status = OutLockStockStatusEnum.鍑哄簱涓�.ObjToInt();
+ });
+
+ stockInfos = result.Item1;
+ orderDetails = result.Item2;
+ outStockLockInfos = result.Item3;
+ locationInfos = result.Item4;
+ }
+ else
+ {
+ throw new Exception("鏃犲簱瀛�");
+ }
+
+ return (tasks, stockInfos, orderDetails, outStockLockInfos, locationInfos);
+ }
+ public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutSGOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null)
+ {
+ try
+ {
+ _unitOfWorkManage.BeginTran();
+
+ BaseDal.AddData(tasks);
+ if (stockInfos != null && stockInfos.Count > 0 && outboundOrderDetails != null && outboundOrderDetails.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0)
+ {
+ stockInfos.ForEach(x =>
+ {
+ x.StockStatus = StockStatusEmun.鍑哄簱閿佸畾.ObjToInt();
+ });
+ outboundOrderDetails.ForEach(x =>
+ {
+ x.OutSGOrderDetailStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
+ });
+ List<Dt_OutSGOrder> outSGOrders = _outboundRepository.OutSGOrderRepository.QueryData(x => outboundOrderDetails.Select(x=>x.OutSGOrderId).Distinct().Contains(x.Id));
+ if (outSGOrders.Count<=0)
+ {
+ throw new Exception("鏈壘鍒板崟鎹俊鎭�");
+ }
+ outSGOrders.ForEach(x =>
+ {
+ x.OutSGOrderStatus = OutOrderStatusEnum.鍑哄簱涓�.ObjToInt();
+ });
+ _outboundRepository.OutSGOrderRepository.UpdateData(outSGOrders);
+ WebResponseContent content = _outboundService.OutSGOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks);
+ if (!content.Status)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return content;
+ }
+ }
+ _unitOfWorkManage.CommitTran();
+ PushTasksToWCS(tasks);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3