From b91c166e2da452578c71423138a0291558b36344 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期五, 25 七月 2025 15:43:15 +0800 Subject: [PATCH] 1 --- 项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 401 --------------------------------------------------------- 1 files changed, 0 insertions(+), 401 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 8a041a3..3a26c86 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -23,139 +23,6 @@ public partial class TaskService { /// <summary> - /// 鐢宠鍏ュ簱浠诲姟(PDA浣跨敤锛屼粎鎵樼洏缁戝畾鍏ュ簱绔欏彴锛屼笉鍒嗛厤璐т綅) - /// </summary> - /// <param name="saveModel"></param> - /// <returns></returns> - public WebResponseContent RequestInboundTask(SaveModel saveModel) - { - try - { - var palletCode = saveModel.MainData["barcode"].ToString(); - var warehouseId = saveModel.MainData["warehouseId"].ObjToInt(); - var stationCode = saveModel.MainData["startPoint"].ToString(); - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); - if (warehouse == null) - { - return WebResponseContent.Instance.Error($"鏈壘鍒板簱鍖�"); - } - - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode && x.WarehouseId == warehouseId); - if (task != null) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟"); - } - - if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null && warehouse.WarehouseCode != WarehouseEnum.HA60.ToString()) - { - return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); - } - - 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($"鏈壘鍒扮粍鐩樹俊鎭�"); - } - if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.鎷i�夊畬鎴�.ObjToInt()) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); - } - if (!string.IsNullOrEmpty(stockInfo.LocationCode)) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); - } - if (warehouseId != stockInfo.WarehouseId) - { - return WebResponseContent.Instance.Error($"浠撳簱涓嶆纭�"); - } - if (warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) - { - Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseId); - if (locationInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒板綋鍓嶅簱鍖鸿揣浣嶄俊鎭�"); - return DeviceRequestInboundTask(stationCode, locationInfo.RoadwayNo, palletCode); - } - else - { - Dt_Task newTask = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = "", - PalletCode = palletCode, - Roadway = "", - SourceAddress = stationCode, - TargetAddress = "", - TaskType = TaskTypeEnum.Inbound.ObjToInt(), - TaskStatus = TaskStatusEnum.New.ObjToInt(), - WarehouseId = stockInfo.WarehouseId, - PalletType = stockInfo.PalletType, - MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, - Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, - }; - //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� - 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(); - } - - if (warehouse.WarehouseCode==WarehouseEnum.HA57.ToString()) - { - Dt_Task dt_TaskMesReturn = BaseDal.QueryFirst(x=>x.TaskType==TaskTypeEnum.MesMatReturn.ObjToInt() && x.TaskStatus!=TaskStatusEnum.SC_Executing.ObjToInt()); - if (dt_TaskMesReturn!=null) - { - return WebResponseContent.Instance.Error($"閫�鏂欎换鍔℃鎵ц"); - } - } - _unitOfWorkManage.BeginTran(); - int taskId = BaseDal.AddData(newTask); - newTask.TaskId = taskId; - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - _unitOfWorkManage.CommitTran(); - PushTasksToWCS(new List<Dt_Task> { newTask }); - return WebResponseContent.Instance.OK(data: newTask); - } - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - - /// <summary> /// 鍏ョ┖绠� /// </summary> /// <param name="barcode"></param> @@ -272,187 +139,6 @@ return WebResponseContent.Instance.Error(ex.Message); } } - - /// <summary> - /// - /// </summary> - /// <param name="stationCode"></param> - /// <param name="roadwayNo"></param> - /// <param name="palletCode"></param> - /// <returns></returns> - public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode,string materielBoxCode = "") - { - try - { - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); - if (task != null) - { - PushTasksToWCS(new List<Dt_Task> { task }); - return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task)); - } - - if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null && stationCode != "8005")//杈呮枡浠撲笉闄愬埗鍏ュ簱浠诲姟 - { - return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); - } - if (!string.IsNullOrEmpty(materielBoxCode)) - { - _unitOfWorkManage.BeginTran(); - WebResponseContent responseGroup = _inboundOrderService.MaterielPPorGM(materielBoxCode); - if (!responseGroup.Status) - { - return WebResponseContent.Instance.Error($"{responseGroup.Message}"); - } - Dt_StockInfo stockInfoPPorGM = responseGroup.Data as Dt_StockInfo ?? null; - if (stockInfoPPorGM==null) - { - return WebResponseContent.Instance.Error($"缁勭洏鏁版嵁杞崲澶辫触"); - } - Dt_LocationInfo? locationInfoPPorGM = _basicService.LocationInfoService.AssignLocation(roadwayNo, stockInfoPPorGM.PalletType, stockInfoPPorGM.WarehouseId); - if (locationInfoPPorGM == null) - { - return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); - } - Dt_Task newTaskPPorGM = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = locationInfoPPorGM.LocationCode, - PalletCode = stockInfoPPorGM.PalletCode, - Roadway = roadwayNo, - SourceAddress = stationCode, - TargetAddress = locationInfoPPorGM.LocationCode, - TaskType = TaskTypeEnum.Inbound.ObjToInt(), - TaskStatus = TaskStatusEnum.New.ObjToInt(), - WarehouseId = stockInfoPPorGM.WarehouseId, - PalletType = stockInfoPPorGM.PalletType, - TaskLength= stockInfoPPorGM.StockLength - }; - - //鑾峰彇鏄惁瀛樺湪鍏ュ簱鍗� - Dt_InboundOrder? inboundOrderPPorGM = null; - if (stockInfoPPorGM != null && stockInfoPPorGM.Details.Count > 0) - { - string? orderNo = stockInfoPPorGM.Details.FirstOrDefault()?.OrderNo ?? ""; - inboundOrderPPorGM = _inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt()); - } - - if (inboundOrderPPorGM != null) - { - if (inboundOrderPPorGM.OrderType == InOrderTypeEnum.Allocat.ObjToInt()) - { - newTaskPPorGM.TaskType = TaskTypeEnum.InAllocate.ObjToInt(); - } - else if (inboundOrderPPorGM.OrderType == InOrderTypeEnum.Return.ObjToInt()) - { - newTaskPPorGM.TaskType = TaskTypeEnum.ProductionReturn.ObjToInt(); - } - } - stockInfoPPorGM.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); - LocationStatusEnum lastStatusPPorGM = (LocationStatusEnum)locationInfoPPorGM.LocationStatus; - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfoPPorGM, lastStatusPPorGM, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); - _basicService.LocationInfoService.UpdateLocationStatus(locationInfoPPorGM, newTaskPPorGM.PalletType, LocationStatusEnum.Lock, newTaskPPorGM.WarehouseId); - int taskIdPPorGM = BaseDal.AddData(newTaskPPorGM); - newTaskPPorGM.TaskId = taskIdPPorGM; - _stockRepository.StockInfoRepository.Db.InsertNav(stockInfoPPorGM).Include(x => x.Details).ExecuteCommand(); - _unitOfWorkManage.CommitTran(); - WMSTaskDTO wMSTaskDTOPPorGM = _mapper.Map<WMSTaskDTO>(newTaskPPorGM); - - PushTasksToWCS(new List<Dt_Task> { newTaskPPorGM }); - return WebResponseContent.Instance.OK(data: wMSTaskDTOPPorGM); - } - 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($"鏈壘鍒扮粍鐩樹俊鎭�"); - } - 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()) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); - } - if (!string.IsNullOrEmpty(stockInfo.LocationCode)) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); - } - - Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, stockInfo.PalletType, stockInfo.WarehouseId); - if (locationInfo == null) - { - return WebResponseContent.Instance.Error($"璐т綅鍒嗛厤澶辫触,鏈壘鍒板彲鍒嗛厤璐т綅"); - } - - Dt_Task newTask = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = locationInfo.LocationCode, - PalletCode = palletCode, - Roadway = roadwayNo, - SourceAddress = stationCode, - TargetAddress = locationInfo.LocationCode, - 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) - { - 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(); - } - else if (stockInfo.StockStatus == StockStatusEmun.MES閫�搴�.ObjToInt()) - { - newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); - } - else if (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); - _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); - int taskId = BaseDal.AddData(newTask); - newTask.TaskId = taskId; - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - _unitOfWorkManage.CommitTran(); - WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); - - PushTasksToWCS(new List<Dt_Task> { newTask }); - if (newTask.WarehouseId == 5) PutFinish(stationCode.ToString(),newTask.PalletCode, newTask.TaskNum.ToString()); - return WebResponseContent.Instance.OK(data: wMSTaskDTO); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - /// <summary> /// 浠呯敵璇蜂换鍔★紝璁¦CS鏍规嵁璺敱纭畾涓嬩竴鍦板潃 /// </summary> @@ -547,93 +233,6 @@ return WebResponseContent.Instance.Error(ex.Message); } } - - /// <summary> - /// - /// </summary> - /// <param name="stationCode"></param> - /// <param name="palletCode"></param> - /// <param name="staions"></param> - /// <param name="heightType"></param> - /// <returns></returns> - public WebResponseContent DeviceRequestInboundTaskByRoadways(string stationCode, string palletCode, List<string> staions, int heightType) - { - try - { - Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); - if (task != null) - { - PushTasksToWCS(new List<Dt_Task> { task }); - return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task)); - } - - if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) - { - return WebResponseContent.Instance.Error($"璇ョ珯鐐瑰凡鏈夋湭鎵ц鐨勪换鍔�"); - } - - string roadwayNo = AssignRoadwayNo(staions, palletCode, heightType); - - Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); - if (stockInfo == null) - { - 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()) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樼姸鎬佷笉姝g‘,涓嶅彲鐢宠鍏ュ簱"); - } - if (!string.IsNullOrEmpty(stockInfo.LocationCode)) - { - return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡缁戝畾璐т綅"); - } - - Dt_Task newTask = new Dt_Task() - { - CurrentAddress = stationCode, - Grade = 0, - NextAddress = "", - PalletCode = palletCode, - Roadway = roadwayNo, - SourceAddress = stationCode, - TargetAddress = roadwayNo, - TaskType = TaskTypeEnum.Inbound.ObjToInt(), - TaskStatus = TaskStatusEnum.New.ObjToInt(), - WarehouseId = stockInfo.WarehouseId, - PalletType = stockInfo.PalletType, - }; - - if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) - { - stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); - } - else if (stockInfo.StockStatus == StockStatusEmun.MES閫�搴�.ObjToInt()) - { - newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); - } - else - { - stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); - } - - _unitOfWorkManage.BeginTran(); - int taskId = BaseDal.AddData(newTask); - newTask.TaskId = taskId; - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - _unitOfWorkManage.CommitTran(); - WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); - - PushTasksToWCS(new List<Dt_Task> { newTask }); - //if (newTask.WarehouseId == 5) PutFinish(stationCode); - return WebResponseContent.Instance.OK(data: wMSTaskDTO); - } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - return WebResponseContent.Instance.Error(ex.Message); - } - } - /// <summary> /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅 /// </summary> -- Gitblit v1.9.3