From 2c889b38311883ceb703c4e0034c798fdaa2e21c Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期二, 12 八月 2025 23:11:57 +0800 Subject: [PATCH] 更新代码,货位分配优化等 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs | 26 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs | 66 ++- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs | 22 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs | 162 ++++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs | 18 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs | 24 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs | 13 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 25 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/AGV_ZHExtend.cs | 45 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs | 11 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/阻焊仓/AGV_ZHJob.cs | 5 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 30 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs | 5 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs | 6 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs | 59 +- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs | 66 +- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs | 11 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/成品仓/AGV_CPExtend.cs | 451 +++++++++++++++++++----- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP仓/StackerCraneJob_PP.cs | 14 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs | 4 22 files changed, 814 insertions(+), 257 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" index 5764332..f6be79e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" @@ -100,6 +100,12 @@ AGV_TakeError = 335, /// <summary> + /// AGV鏀捐揣鍐欏叆寮傚父 + /// </summary> + [Description("AGV鍙栬揣鍐欏叆寮傚父")] + AGV_PutError = 340, + + /// <summary> /// 浠诲姟瀹屾垚 /// </summary> [Description("浠诲姟瀹屾垚")] diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" index 887021e..dc24b96 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs" @@ -46,22 +46,22 @@ { var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } + //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -114,16 +114,16 @@ break; case "getSafetySignal"://瀹夊叏淇″彿鐢宠 { - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) throw new Exception(content.Message); - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) throw new Exception(content.Message); - } + //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) throw new Exception(content.Message); + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) throw new Exception(content.Message); + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -134,7 +134,12 @@ if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); - if (!content.Status) throw new Exception(content.Message); + if (!content.Status) + { + task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt(); + _taskRepository.UpdateData(task); + throw new Exception(content.Message); + } Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); if (dt_Station == null) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" index 6439995..b31fc0e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs" @@ -46,22 +46,22 @@ { var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); - if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) - //{ - // throw new Exception(content.Message); - //} - } + //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) + // //{ + // // throw new Exception(content.Message); + // //} + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -101,7 +101,12 @@ if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var content = TakeFinish(task.CurrentAddress); - if (!content.Status) throw new Exception(content.Message); + if (!content.Status) + { + task.TaskState = TaskStatusEnum.AGV_TakeError.ObjToInt(); + _taskRepository.UpdateData(task); + throw new Exception(content.Message); + } task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚); _taskService.TaskCompleted(task.TaskNum); @@ -112,16 +117,16 @@ break; case "getSafetySignal"://瀹夊叏淇″彿鐢宠 { - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) - { - var content = TakeRequest(task.CurrentAddress); - //if (!content.Status) throw new Exception(content.Message); - } - else - { - var content = PutRequest(task.NextAddress, task.PalletType); - //if (!content.Status) throw new Exception(content.Message); - } + //if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + //{ + // var content = TakeRequest(task.CurrentAddress); + // //if (!content.Status) throw new Exception(content.Message); + //} + //else + //{ + // var content = PutRequest(task.NextAddress, task.PalletType); + // //if (!content.Status) throw new Exception(content.Message); + //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -132,7 +137,12 @@ if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); - if (!content.Status) throw new Exception(content.Message); + if (!content.Status) + { + task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt(); + _taskRepository.UpdateData(task); + throw new Exception(content.Message); + } Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); if (dt_Station == null) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" index eb4e385..9e7bf06 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs" @@ -13,6 +13,7 @@ using WIDESEAWCS_DTO.Agv; using SqlSugar; using static Dm.net.buffer.ByteArrayBuffer; +using WIDESEAWCS_Core.Enums; namespace WIDESEAWCS_Tasks { @@ -190,6 +191,8 @@ } } _taskService.UpdateData(WaitToTasks); + + //鍙栨斁璐у畬鎴愬啓鍏ュ紓甯稿鐞� Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First(); if (TakeErroeTask!=null) { @@ -207,8 +210,31 @@ otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); Thread.Sleep(1000); otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); + TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); + var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.鑷姩瀹屾垚); _taskService.TaskCompleted(TakeErroeTask.TaskNum); } + Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First(); + if (PutErroeTask != null) + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress); + if (stationManger == null) + { + throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�"); + } + OtherDevice otherDevice = (OtherDevice)device; + otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); + PutErroeTask.CurrentAddress = stationManger.StationCode; + PutErroeTask.NextAddress = ""; + PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); + PutErroeTask.DeviceCode = "SC01_CSJ"; + var up = _taskRepository.UpdateData(PutErroeTask); + } } catch (Exception ex) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" index fa01a83..8b2576c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs" @@ -13,6 +13,7 @@ using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; +using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -28,14 +29,16 @@ private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; + private readonly ITaskRepository _taskRepository; - public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) + public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _routerService = routerService; _stationMangerRepository = stationMangerRepository; _mapper = mapper; + _taskRepository = taskRepository; } public Task Execute(IJobExecutionContext context) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" index 84563b0..3defe0a 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" @@ -52,6 +52,20 @@ _stationMangerRepository = stationMangerRepository; _cacheService = cacheService; _mapper=mapper; + + string? apiInfoStr = _cacheService.Get("apiInfos"); + if (!string.IsNullOrEmpty(apiInfoStr)) + { + List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr); + if (infos == null || infos.Count == 0) + { + apiInfos = new List<Dt_ApiInfo>(); + } + else + { + apiInfos = infos; + } + } } public Task Execute(IJobExecutionContext context) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/AGV_CPExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/AGV_CPExtend.cs" index bc39089..d267cb4 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/AGV_CPExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/AGV_CPExtend.cs" @@ -21,122 +21,385 @@ { try { - var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); - - if (newTasks.Count>0) + var AllTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (nameof(AGV_CPJob).Contains(x.DeviceCode))).ToList(); + var stationMangers = _stationMangerRepository.QueryData(); + #region 鍏ュ簱浠诲姟鎺ㄩ�� { - foreach (var task in newTasks) + var newTasksIn = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + if (newTasksIn.Count>0) { - try + foreach (var task in newTasksIn) { - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) - task.CurrentAddress = GetAGVAddress(task.CurrentAddress); - else - task.NextAddress = GetAGVAddress(task.NextAddress); - AgvTaskDTO taskDTO = new AgvTaskDTO() + try { - TaskCode = task.AgvTaskNum, - ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, - TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", - ctnrCode = task.PalletCode, - PositionCodePath = new List<CodePath>() + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + task.CurrentAddress = GetAGVAddress(task.CurrentAddress); + else + task.NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() { - new CodePath() + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, + TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() { - type = "05", - positionCode = task.CurrentAddress - }, - new CodePath() + new CodePath() + { + type = "05", + positionCode = task.CurrentAddress + }, + new CodePath() + { + type = "05", + positionCode = task.NextAddress + } + } + }; + if (taskDTO.TaskTyp== "CPC") + { + taskDTO.Priority = task.Grade.ToString(); + } + if (task.GroupId.IsNotEmptyOrNull()) + { + taskDTO.GroupId=task.GroupId; + } + if (task.TaskType==TaskTypeEnum.OutMesRworkProduct.ObjToInt()) + { + taskDTO.Priority = "127"; + } + //鍙戦�丄GV浠诲姟 + WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); + if (!content.Status) + throw new Exception(content.Message); + if (taskDTO.TaskTyp == "CPC") + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); + } + else + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); + } + Thread.Sleep(500); + } + catch (Exception ex) + { + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; + } + } + if (newTasksIn.Count > 0) + { + _taskService.UpdateData(newTasksIn); + } + } + } + #endregion + #region 鍑哄簱鎺ㄩ�佷换鍔�1绾� + { + var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); + var downTasksOut1 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236").ToList(); + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5236"); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device != null) + { + OtherDevice otherDevice = (OtherDevice)device; + short stationCurrentStatus = device.Communicator.Read<short>("DB29.112"); + if (newTasksOut1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1) + { + foreach (var task in newTasksOut1) + { + try + { + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + task.CurrentAddress = GetAGVAddress(task.CurrentAddress); + else + task.NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() { - type = "05", - positionCode = task.NextAddress + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, + TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type = "05", + positionCode = task.CurrentAddress + }, + new CodePath() + { + type = "05", + positionCode = task.NextAddress + } + } + }; + if (taskDTO.TaskTyp == "CPC") + { + taskDTO.Priority = task.Grade.ToString(); + } + if (task.GroupId.IsNotEmptyOrNull()) + { + taskDTO.GroupId = task.GroupId; + } + if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) + { + taskDTO.Priority = "127"; + } + //鍙戦�丄GV浠诲姟 + WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); + if (!content.Status) + throw new Exception(content.Message); + if (taskDTO.TaskTyp == "CPC") + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); + } + else + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); } } - }; - if (taskDTO.TaskTyp== "CPC") - { - taskDTO.Priority = task.Grade.ToString(); + catch (Exception ex) + { + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; + } } - if (task.GroupId.IsNotEmptyOrNull()) + if (newTasksOut1.Count > 0) { - taskDTO.GroupId=task.GroupId; + _taskService.UpdateData(newTasksOut1); } - if (task.TaskType==TaskTypeEnum.OutMesRworkProduct.ObjToInt()) + } + } + + } + #endregion + #region 鍑哄簱鎺ㄩ�佷换鍔�2绾� + { + var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); + var downTasksOut2 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").ToList(); + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5243"); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device != null) + { + OtherDevice otherDevice = (OtherDevice)device; + short stationCurrentStatus = device.Communicator.Read<short>("DB29.126"); + if (newTasksOut2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1) + { + foreach (var task in newTasksOut2) { - taskDTO.Priority = "127"; + try + { + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + task.CurrentAddress = GetAGVAddress(task.CurrentAddress); + else + task.NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, + TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type = "05", + positionCode = task.CurrentAddress + }, + new CodePath() + { + type = "05", + positionCode = task.NextAddress + } + } + }; + if (taskDTO.TaskTyp == "CPC") + { + taskDTO.Priority = task.Grade.ToString(); + } + if (task.GroupId.IsNotEmptyOrNull()) + { + taskDTO.GroupId = task.GroupId; + } + if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) + { + taskDTO.Priority = "127"; + } + //鍙戦�丄GV浠诲姟 + WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); + if (!content.Status) + throw new Exception(content.Message); + if (taskDTO.TaskTyp == "CPC") + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); + } + else + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); + } + } + catch (Exception ex) + { + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; + } } - //鍙戦�丄GV浠诲姟 - WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); - if (!content.Status) - throw new Exception(content.Message); - if (taskDTO.TaskTyp == "CPC") + if (newTasksOut2.Count > 0) { - task.Dispatchertime = DateTime.Now; + _taskService.UpdateData(newTasksOut2); + } + } + //else + //{ + // WriteInfo(nameof(AGV_CPJob), $"2绾挎棤浠诲姟锛岀姸鎬亄stationCurrentStatus}"); + //} + } + + } + #endregion + #region 鍑哄簱鎺ㄩ�佷换鍔�3绾� + { + var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); + var downTasksOut3 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").ToList(); + Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5250"); + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device != null) + { + OtherDevice otherDevice = (OtherDevice)device; + short stationCurrentStatus = device.Communicator.Read<short>("DB29.140"); + if (newTasksOut3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1) + { + foreach (var task in newTasksOut3) + { + try + { + if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + task.CurrentAddress = GetAGVAddress(task.CurrentAddress); + else + task.NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, + TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type = "05", + positionCode = task.CurrentAddress + }, + new CodePath() + { + type = "05", + positionCode = task.NextAddress + } + } + }; + if (taskDTO.TaskTyp == "CPC") + { + taskDTO.Priority = task.Grade.ToString(); + } + if (task.GroupId.IsNotEmptyOrNull()) + { + taskDTO.GroupId = task.GroupId; + } + if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) + { + taskDTO.Priority = "127"; + } + //鍙戦�丄GV浠诲姟 + WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); + if (!content.Status) + throw new Exception(content.Message); + if (taskDTO.TaskTyp == "CPC") + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); + } + else + { + task.Dispatchertime = DateTime.Now; + _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); + } + } + catch (Exception ex) + { + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; + } + } + if (newTasksOut3.Count > 0) + { + _taskService.UpdateData(newTasksOut3); + } + } + //else + //{ + // WriteInfo(nameof(AGV_CPJob), $"3绾挎棤浠诲姟锛岀姸鎬亄stationCurrentStatus}"); + //} + } + + } + #endregion + #region 绌烘鎼繍 + { + var newTasksLocations = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.Remark == "娴嬭瘯绌烘").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); + if (newTasksLocations.Count>0) + { + foreach (var task in newTasksLocations) + { + try + { + string CurrentAddress = GetAGVAddress(task.CurrentAddress); + string NextAddress = GetAGVAddress(task.NextAddress); + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + TaskCode = task.AgvTaskNum, + ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, + TaskTyp = "CP", + ctnrCode = task.PalletCode, + PositionCodePath = new List<CodePath>() + { + new CodePath() + { + type="05", + positionCode=CurrentAddress + }, + new CodePath() + { + type="05", + positionCode=NextAddress + } + }, + }; + //鍙戦�丄GV浠诲姟 + WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); + if (!content.Status) + throw new Exception(content.Message); + task.TaskState = TaskStatusEnum.AGV_Takeing.ObjToInt(); + task.CurrentAddress = CurrentAddress; + task.NextAddress = NextAddress; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); } - else + catch (Exception ex) { - task.Dispatchertime = DateTime.Now; - _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); + task.TaskState = TaskStatusEnum.Exception.ObjToInt(); + task.ExceptionMessage = ex.Message; } - Thread.Sleep(500); - } - catch (Exception ex) - { - task.TaskState = TaskStatusEnum.Exception.ObjToInt(); - task.ExceptionMessage = ex.Message; - } - } - if (newTasks.Count > 0) - { - _taskService.UpdateData(newTasks); - } - } - var newTasksLocations = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.Remark == "娴嬭瘯绌烘").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); - if (newTasksLocations.Count>0) - { - foreach (var task in newTasksLocations) - { - try - { - string CurrentAddress = GetAGVAddress(task.CurrentAddress); - string NextAddress = GetAGVAddress(task.NextAddress); - AgvTaskDTO taskDTO = new AgvTaskDTO() - { - TaskCode = task.AgvTaskNum, - ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, - TaskTyp = "CP", - ctnrCode = task.PalletCode, - PositionCodePath = new List<CodePath>() - { - new CodePath() - { - type="05", - positionCode=CurrentAddress - }, - new CodePath() - { - type="05", - positionCode=NextAddress - } - }, - }; - //鍙戦�丄GV浠诲姟 - WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); - if (!content.Status) - throw new Exception(content.Message); - task.TaskState = TaskStatusEnum.AGV_Takeing.ObjToInt(); - task.CurrentAddress = CurrentAddress; - task.NextAddress = NextAddress; - _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); - } - catch (Exception ex) - { - task.TaskState = TaskStatusEnum.Exception.ObjToInt(); - task.ExceptionMessage = ex.Message; } } } + #endregion } catch (Exception ex) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs" index 9d6beb7..5289c17 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHExtend.cs" @@ -7,6 +7,7 @@ using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; +using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -176,6 +177,50 @@ } } _taskService.UpdateData(WaitToTasks); + + //鍙栨斁璐у畬鎴愬啓鍏ュ紓甯稿鐞� + Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First(); + if (TakeErroeTask != null) + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == TakeErroeTask.CurrentAddress); + if (stationManger == null) + { + throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + throw new Exception($"鏈壘鍒板搴旇澶�"); + } + OtherDevice otherDevice = (OtherDevice)device; + otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); + Thread.Sleep(1000); + otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); + TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); + var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.鑷姩瀹屾垚); + _taskService.TaskCompleted(TakeErroeTask.TaskNum); + } + Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First(); + if (PutErroeTask != null) + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress); + if (stationManger == null) + { + throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�"); + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + throw new Exception($"鏈壘鍒扮珯鍙伴厤缃�"); + } + OtherDevice otherDevice = (OtherDevice)device; + otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); + PutErroeTask.CurrentAddress = stationManger.StationCode; + PutErroeTask.NextAddress = ""; + PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); + PutErroeTask.DeviceCode = "SC01_ZH"; + var up = _taskRepository.UpdateData(PutErroeTask); + } } catch (Exception ex) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHJob.cs" index 01bb0a8..8586dab 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHJob.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\351\230\273\347\204\212\344\273\223/AGV_ZHJob.cs" @@ -13,6 +13,7 @@ using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; +using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -28,14 +29,16 @@ private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; + private readonly ITaskRepository _taskRepository; - public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) + public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _routerService = routerService; _stationMangerRepository = stationMangerRepository; _mapper = mapper; + _taskRepository = taskRepository; } public Task Execute(IJobExecutionContext context) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" index 45d2faa..6333c29 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs" @@ -74,11 +74,13 @@ int maxDepth = locationInfos.Max(x => x.Depth); if (beRelocation.Row <= maxDepth) { - locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); + //杩囨护褰撳墠绉诲簱鐨勫悓鍒楀悓灞� + locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column!= beRelocation.Column && x.Layer!=beRelocation.Layer).ToList(); } else if (beRelocation.Row > maxDepth) { - locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); + //杩囨护褰撳墠绉诲簱鐨勫悓鍒楀悓灞� + locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } } @@ -120,12 +122,14 @@ { continue; } - Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); - if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + if (locationInfoExist.LocationType>0) { - continue; + Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); + if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + { + continue; + } } - } else { @@ -306,10 +310,10 @@ else { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); - moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� + moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); - littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� + littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� } //if (moreDepthFlag && littleDepthFlag) //{ @@ -337,10 +341,10 @@ else { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); - moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� + moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//鏌ヨ澶т簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓烘湁璐х殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娣辫揣浣嶆湁鏈浣跨敤鐨勬儏鍐� List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); - littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� + littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //鏌ヨ灏忎簬褰撳墠璐т綅娣卞害鐨勯泦鍚堥噷鏄惁鏈夌姸鎬佷笉涓虹┖锛屼笖绂佺敤鐘舵�佷笉涓虹鐢ㄤ互鍙婂彧鍏ョ殑璐т綅锛屽鏋滄槸true锛屽垯琛ㄧず娴呰揣浣嶈浣跨敤鎴栬�呰绂佺敤鐨勬儏鍐� } //List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs" index a50c9ec..a115707 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs" @@ -221,15 +221,20 @@ { continue; } - Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); - if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + if (locationInfoExist.LocationType > 0) { - continue; + Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); + if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + { + continue; + } } if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) { continue; } + + } locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); return locationInfo; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs" index a97ed86..8338d9b 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs" @@ -56,14 +56,15 @@ throw new Exception($"鏈壘鍒拌揣浣嶄俊鎭�"); } int maxDepth = locationInfos.Max(x => x.Depth); - int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; - if (mathCurrentRow <= maxDepth) + if (beRelocation.Row <= maxDepth) { - locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); + //杩囨护褰撳墠绉诲簱鐨勫悓鍒楀悓灞� + locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } - else + else if (beRelocation.Row > maxDepth) { - locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); + //杩囨护褰撳墠绉诲簱鐨勫悓鍒楀悓灞� + locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs" index 788d1de..ffb741f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs" @@ -114,10 +114,13 @@ { continue; } - Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); - if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + if (locationInfoExist.LocationType > 0) { - continue; + Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); + if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + { + continue; + } } } else @@ -137,10 +140,13 @@ { continue; } - Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); - if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + if (locationInfoExist.LocationType > 0) { - continue; + Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); + if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) + { + continue; + } } if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) { diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" index 7042b06..289db11 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs" @@ -465,10 +465,52 @@ for (int j = location.Depth + 1; j <= maxDepth; j++) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row + 1)); - if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅 + if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { - locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } } + if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + } + #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -478,10 +520,41 @@ for (int j = location.Depth - 1; j >= 1; j--) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row -1)); - if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅 + if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { - locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); + } } + if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -505,10 +578,52 @@ for (int j = location.Depth + 1; j <= maxDepth; j++) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); - if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅 + if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { - locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } } + if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + } + #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -518,10 +633,41 @@ for (int j = location.Depth - 1; j >= 1; j--) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); - if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) + #region 娴嬭瘯鏋躲�丳P鍒ゆ柇鍚岀粍璐т綅 + if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { - locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); + } } + if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) + { + if (row <= maxDepth) + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); + } + else + { + locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); + } + } + #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs" index 7e81ed0..41333f6 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs" @@ -11,8 +11,21 @@ /// </summary> public class ProInStaticDTO { + /// <summary> + /// 浜у搧缂栫爜 + /// </summary> public string ProductCode { get; set; } + /// <summary> + /// 浜у搧鐗堟湰 + /// </summary> public string ProductVersion { get; set; } + /// <summary> + /// 鎬籔CS鏁� + /// </summary> public float SumPcs { get; set; } + /// <summary> + /// 鎬婚潰绉� + /// </summary> + public float SumPcsArea { get; set; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs" index 6e238f2..502e3a0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs" @@ -76,6 +76,10 @@ /// </summary> public float OKPCSQTY { get; set; } /// <summary> + /// 鍐呭寘鎬婚潰绉� + /// </summary> + public float OKPCSArea { get; set; } + /// <summary> /// 鍛ㄦ湡 /// </summary> public string DateCode { get; set; } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index 3613253..fd61185 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -1813,6 +1813,10 @@ } return palletTypeInfo.PalletType; } + else if (warehouse.WarehouseCode == WarehouseEnum.HA60.ObjToString()) + { + return 4; + } return -1; } /// <summary> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs" index cd459fa..a7dfded 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs" @@ -30,33 +30,29 @@ _invokeERPService = invokeERPService; _basicRepository = basicRepository; } - + /// <summary> + /// 淇濆瓨鏁版嵁 + /// </summary> public void SaveStatic(MesBagInfoModel mesBagInfoModel) { - List<ProInStaticDTO> mESBagDetails = mesBagInfoModel.BagDetails.GroupBy(x=>new { x.ProductCode, x.ProductVersion }).Select(x=>new ProInStaticDTO + List<ProInStaticDTO> mESBagDetails = mesBagInfoModel.BagDetails.GroupBy(x => new { x.ProductCode, x.ProductVersion }).Select(x => new ProInStaticDTO { - ProductCode= x.Key.ProductCode, - ProductVersion= x.Key.ProductVersion, - SumPcs=x.Sum(x => x.OKPCSQTY) + ProductCode = x.Key.ProductCode, + ProductVersion = x.Key.ProductVersion, + SumPcs = x.Sum(x => x.OKPCSQTY), + SumPcsArea = x.Sum(x=>x.OKPCSArea) }).ToList(); List<Dt_ProInStatistics> proInStatistics= new List<Dt_ProInStatistics>(); Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==mesBagInfoModel.WarehouseCode); foreach (var m in mESBagDetails) { - string response = _invokeERPService.InvokeProInErpStatic(m.ProductCode, m.ProductCode + m.ProductVersion); - ErpProInErpStaticResponseContent erpProInErpStatic = response.DeserializeObject<ErpProInErpStaticResponseContent>(); - if (erpProInErpStatic.Code != 200) - { - return; - } - float adjusted = (float)Math.Round(erpProInErpStatic.Data[0].UnitArea, 3); Dt_ProInStatistics inStatistics = new Dt_ProInStatistics() { WarehouseId = warehouse.WarehouseId, ProductCode = m.ProductCode, ProductRev = m.ProductVersion, PcsQty = m.SumPcs, - SquareMeter = (float)Math.Round((adjusted * m.SumPcs), 3), + SquareMeter = (float)Math.Round(m.SumPcsArea, 3), Remark = mesBagInfoModel.BatchNo }; proInStatistics.Add(inStatistics); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs" index 6c21a1a..04c3cb0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs" @@ -285,39 +285,39 @@ _takeStockOrderDetailRepository.UpdateData(takeStockOrderDetail); BaseDal.UpdateData(takeStockOrder); //鎻愪氦ERP閫昏緫 - //if (takeStockOrder.TakeStockStatus== TakeStockStatusEnum.鐩樼偣瀹屾垚.ObjToInt()) - //{ - // ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel() - // { - // Way = 1, - // UniqueTag = takeStockOrder.Id.ToString(), - // Code = takeStockOrder.OrderNo, - // FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"), - // Name=takeStockOrder.OrderNo, - // WarehouseCode= warehouse.WarehouseCode, - // Createuser=takeStockOrder.Creater, - // Createtime= takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), - // Details=new List<TakeDetailsItem>() - // }; - // foreach (var item in takeStockOrderDetails) - // { - // TakeDetailsItem takeDetailsItem = new TakeDetailsItem() - // { - // MaterialsCode=item.MaterielCode, - // LocationCode=item.LocationCode, - // Lotno=item.BatchNo, - // Sysqty=item.SysQty.ObjToDecimal(), - // Qty=item.Qty.ObjToDecimal() - // }; - // eRPTakeStock.Details.Add(takeDetailsItem); - // } - // string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock); - // ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>(); - // if (erpRequestContent.res != 1) - // { - // throw new Exception("鍚屾ERP澶辫触,閿欒淇℃伅:" + erpRequestContent.Data); - // } - //} + if (takeStockOrder.TakeStockStatus == TakeStockStatusEnum.鐩樼偣瀹屾垚.ObjToInt()) + { + ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel() + { + Way = 1, + UniqueTag = takeStockOrder.Id.ToString(), + Code = takeStockOrder.OrderNo, + FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"), + Name = takeStockOrder.OrderNo, + WarehouseCode = warehouse.WarehouseCode, + Createuser = takeStockOrder.Creater, + Createtime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), + Details = new List<TakeDetailsItem>() + }; + foreach (var item in takeStockOrderDetails) + { + TakeDetailsItem takeDetailsItem = new TakeDetailsItem() + { + MaterialsCode = item.MaterielCode, + LocationCode = item.LocationCode, + Lotno = item.BatchNo, + Sysqty = item.SysQty.ObjToDecimal(), + Qty = item.Qty.ObjToDecimal() + }; + eRPTakeStock.Details.Add(takeDetailsItem); + } + string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock); + ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>(); + if (erpRequestContent.res != 1) + { + throw new Exception("鍚屾ERP澶辫触,閿欒淇℃伅:" + erpRequestContent.Data); + } + } _unitOfWorkManage.CommitTran(); content.OK("鐩樼偣鎴愬姛"); } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" index 21da66a..4c88553 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" @@ -525,6 +525,7 @@ /// <returns></returns> public MesResponseContent SubstrateOut(SubstrateOutModel model) { + MesResponseContent content = new MesResponseContent(); try { string line = string.Empty; @@ -539,15 +540,15 @@ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == line); if (warehouse == null) { - return MesResponseContent.Instance.Error($"浠撳簱鍩虹淇℃伅鏈厤缃�"); + return content.Error($"浠撳簱鍩虹淇℃伅鏈厤缃�"); } Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterialCode); if (materielInfo == null) { - return MesResponseContent.Instance.Error($"鏈壘鍒拌鐗╂枡淇℃伅"); + return content.Error($"鏈壘鍒拌鐗╂枡淇℃伅"); } - + //鐢熸垚MES鏉挎枡鍑哄簱鍗曟嵁 Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder() { CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), @@ -563,7 +564,6 @@ }; List<Dt_Task> tasks = new List<Dt_Task>(); - List<Dt_StockInfo>? stockInfos = null; List<Dt_OutStockLockInfo>? outStockLockInfos = null; List<Dt_LocationInfo>? locationInfos = null; @@ -606,23 +606,26 @@ _outboundService.MesOutboundOrderService.Repository.AddData(mesOutboundOrder); if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) { - WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); + WebResponseContent contentResponse = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); - if (!content.Status) + if (!contentResponse.Status) { _unitOfWorkManage.RollbackTran(); - return MesResponseContent.Instance.Error(content.Message); + return content.Error(contentResponse.Message); } } _unitOfWorkManage.CommitTran(); PushTasksToWCS(tasks); - - - return MesResponseContent.Instance.OK(); + //灏嗗紑鏂欏垎閰嶇殑搴撳瓨鎵樼洏杩斿洖缁橫ES + content.Content = new + { + VehicleCode = stockInfos?.Select(x => x.PalletCode).ToList() + }; + return content.OK(); } catch (Exception ex) { - return MesResponseContent.Instance.Error(ex.Message); + return content.Error(ex.Message); } } 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 f7f350b..9780a13 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" @@ -853,7 +853,7 @@ WebResponseContent content = new WebResponseContent(); try { - //鑾峰彇娴嬭瘯鏋跺師搴撳瓨淇℃伅 + //鑾峰彇闃荤剨搴撳瓨淇℃伅 Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); //鑾峰彇搴撳瓨璁板綍 List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => @@ -872,21 +872,21 @@ { return content.Error($"鎵樼洏绫诲瀷淇℃伅涓嶅瓨鍦�"); } - ////鑾峰彇闃荤剨鎵规 - //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); - //if (!requestLotInfo.Status) - //{ - // return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}"); - //} - //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); - MesLotInfoModel mesLotInfo = new MesLotInfoModel() + //鑾峰彇闃荤剨鎵规 + WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); + if (!requestLotInfo.Status) { - Product="FH001", - ProductVersion="A1", - Qty=20, - LotNo= materialLot, - IsFullNumber=true - }; + return content.Error($"璇锋眰闃荤剨鎵规淇℃伅澶辫触,{requestLotInfo.Message}"); + } + MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); + //MesLotInfoModel mesLotInfo = new MesLotInfoModel() + //{ + // Product="FH001", + // ProductVersion="A1", + // Qty=20, + // LotNo= materialLot, + // IsFullNumber=true + //}; Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() { MaterielSpec = mesLotInfo.ProductVersion, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" index 5330a30..f0433ba 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs" @@ -197,7 +197,7 @@ return _taskService.BoxStockin(model.Content); } /// <summary> - /// MES鎴愬搧鍑哄簱鎺ュ彛璋冪敤 + /// MWMS鍚屾鎴愬搧鍑哄簱淇℃伅鑷矼ES /// </summary> /// <returns></returns> [HttpPost, Route("ShipmentOrderSync"), AllowAnonymous] @@ -206,7 +206,7 @@ return _taskService.ShipmentOrderSync(model); } /// <summary> - /// MES鎴愬搧鍑哄簱鎺ュ彛璋冪敤 + /// WMS鍚屾鎴愬搧鍑哄簱淇℃伅鑷矼ES澶栧寘瑁呮満 /// </summary> /// <returns></returns> [HttpPost, Route("ShipmentOrderMESSync"), AllowAnonymous] -- Gitblit v1.9.3