From d8db1698c125618c1b5f62b009204ddc5d4eed5a Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期三, 19 三月 2025 20:34:08 +0800 Subject: [PATCH] 成品代码更新.... --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 7 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 5d14e40..cf866ab 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -7,6 +7,7 @@ using System.Threading.Tasks; using WIDESEA_Common.CommonEnum; using WIDESEA_Common.LocationEnum; +using WIDESEA_Common.OrderEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; using WIDESEA_Common.WareHouseEnum; @@ -48,7 +49,7 @@ return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); } - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x=>x.PalletCode== palletCode).Includes(x=>x.Details).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); @@ -82,21 +83,49 @@ Roadway = "", SourceAddress = stationCode, TargetAddress = "", - TaskType = stockInfo.StockStatus == StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() ? TaskTypeEnum.InPick.ObjToInt() : TaskTypeEnum.Inbound.ObjToInt(), + TaskType = TaskTypeEnum.Inbound.ObjToInt(), TaskStatus = TaskStatusEnum.New.ObjToInt(), WarehouseId = stockInfo.WarehouseId, PalletType = stockInfo.PalletType }; - + //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� + Dt_InboundOrder? inboundOrder = null; + if (stockInfo!=null && stockInfo.Details.Count>0) + { + string? orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; + inboundOrder =_inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()); + if (inboundOrder!=null) + { + newTask.OrderNo = inboundOrder.InboundOrderNo; + } + } + + if (inboundOrder != null) + { + if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.InAllocate.ObjToInt(); + newTask.OrderNo = inboundOrder.InboundOrderNo; + } + else if (inboundOrder.OrderType == InOrderTypeEnum.Return.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.ProductionReturn.ObjToInt(); + newTask.OrderNo = inboundOrder.InboundOrderNo; + } + } if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) { stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + } + else if (stockInfo.StockStatus == StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + newTask.TaskType = TaskTypeEnum.InPick.ObjToInt(); } else { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); } - _unitOfWorkManage.BeginTran(); int taskId = BaseDal.AddData(newTask); newTask.TaskId = taskId; @@ -254,7 +283,7 @@ return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); } - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); + Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); if (stockInfo == null) { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); @@ -289,7 +318,25 @@ PalletType = stockInfo.PalletType }; + //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� + Dt_InboundOrder? inboundOrder = null; + if (stockInfo != null && stockInfo.Details.Count > 0) + { + string? orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; + inboundOrder = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()); + } + if (inboundOrder != null) + { + if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.InAllocate.ObjToInt(); + } + else if (inboundOrder.OrderType == InOrderTypeEnum.Return.ObjToInt()) + { + newTask.TaskType = TaskTypeEnum.ProductionReturn.ObjToInt(); + } + } if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) { stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); @@ -300,13 +347,13 @@ } else if (stockInfo.StockStatus == StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) { - stockInfo.StockStatus = StockStatusEmun.鎷i�夊畬鎴�.ObjToInt(); newTask.TaskType = TaskTypeEnum.InPick.ObjToInt(); } else { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); } + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; _unitOfWorkManage.BeginTran(); _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); @@ -355,7 +402,7 @@ { return WebResponseContent.Instance.Error($"鏈壘鍒扮粍鐩樹俊鎭�"); } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt()) + if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES閫�搴�.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()) { return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); } @@ -388,6 +435,12 @@ { newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); } + else if (stockInfo.StockStatus == StockStatusEmun.MES绌烘墭閫�搴�.ObjToInt()) + { + //todo 鏆傛椂鏈惎鐢� + return WebResponseContent.Instance.Error($"绌烘墭鏈惎鐢�"); + //newTask.TaskType = TaskTypeEnum.MesPalletReturn.ObjToInt(); + } else { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); -- Gitblit v1.9.3