From ceb8c334e8ca10d569b4c7f72b74126ce1877e48 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期二, 07 一月 2025 21:51:51 +0800 Subject: [PATCH] 添加辅料仓功能,优化测试架仓代码 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 71 ++++++++++++++++++++++------------- 1 files changed, 44 insertions(+), 27 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 2da55a0..664fc0a 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 WIDESEA_Common.LocationEnum; using WIDESEA_Common.StockEnum; using WIDESEA_Common.TaskEnum; +using WIDESEA_Common.WareHouseEnum; using WIDESEA_Core; using WIDESEA_Core.Helper; using WIDESEA_DTO.Task; @@ -29,6 +30,11 @@ 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) { @@ -57,37 +63,45 @@ { return WebResponseContent.Instance.Error($"浠撳簱涓嶆纭�"); } - - Dt_Task newTask = new Dt_Task() + if (warehouse.WarehouseCode == WarehouseEnum.HA60.ToString()) { - 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 - }; - - if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) - { - stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouseId); + if (locationInfo == null) return WebResponseContent.Instance.Error($"鏈壘鍒板綋鍓嶅簱鍖鸿揣浣嶄俊鎭�"); + return DeviceRequestInboundTask(stationCode, locationInfo.RoadwayNo, palletCode); } else { - stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + 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 + }; + + if (stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鏆傚瓨.ObjToInt()) + { + stockInfo.StockStatus = StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt(); + } + else + { + stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); + } + _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); } - _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) { @@ -154,14 +168,17 @@ { stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt(); } + LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; _unitOfWorkManage.BeginTran(); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)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 }); + PushTasksToWCS(new List<Dt_Task> { newTask }); return WebResponseContent.Instance.OK(data: wMSTaskDTO); } catch (Exception ex) -- Gitblit v1.9.3