From 5efc3d1d1042ac74e7319fb04e490dd7295b9e22 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期四, 07 八月 2025 16:20:35 +0800 Subject: [PATCH] 优化 WMS 接口请求和设备处理逻辑 在 `RequestInbound.cs` 中删除与 GW 相关的代码注释,添加 WMS 接口请求处理,更新 `RequestWmsTask` 方法以支持异步请求和结果处理。 在 `CommonConveyorLine_CWJob.cs` 中移除不必要的代码,简化设备处理逻辑,并增加调度执行时间记录,改进异常处理输出。 在 `CommonStackerCraneJob.cs` 中将设备类型转换从 `CommonConveyorLine_GW` 更新为 `CommonConveyorLine_CW`,确保任务处理的正确性。 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index 5deef7f..5f99e14 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -102,6 +102,8 @@ builder.AppendLine(); ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue); commonStackerCrane.LastTaskType = task.TaskType; + + _taskService.UpdateTaskStatusToNext(task.TaskNum); } } @@ -169,6 +171,24 @@ if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); + if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType==(int)TaskOutboundTypeEnum.InToOut) + { + var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode); + + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC); + if (device != null) + { + CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode); + Thread.Sleep(100); + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode); + } + WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘�戜换鍔″彿銆恵e.TaskNum}銆戞墭鐩樺彿銆恵task.PalletCode}銆�"); + } + + + + if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); @@ -198,7 +218,7 @@ Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); _taskService.UpdateData(newTask); } - if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001")) + if ((task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { var TASKHTY = task.Adapt<Dt_Task_Hty>(); _taskRepository.DeleteData(task); @@ -220,6 +240,12 @@ private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane) { Dt_Task task; + task = _taskService.QueryOutFireAlarmTask(commonStackerCrane.DeviceCode); + if (task != null) + { + return task; + } + if (commonStackerCrane.LastTaskType == null) { task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode); @@ -293,7 +319,7 @@ device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode); if (device != null) { - CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; + CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device; if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤 { return task; @@ -411,6 +437,7 @@ stackerCraneTaskCommand.WorkType = 1; stackerCraneTaskCommand.TrayType = 0; stackerCraneTaskCommand.StartCommand = 1; + stackerCraneTaskCommand.FireCommand = Convert.ToInt16(task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm ? 2 : 0); if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔� { var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue; @@ -476,7 +503,7 @@ } else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - if (task.Roadway.Contains("GW")) + if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { string[] endCodes = task.NextAddress.Split("-"); stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); @@ -489,7 +516,18 @@ } else { - if ((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) + if ( task.TaskType == (int)TaskOutboundTypeEnum.InToOut) + { + string[] endCodes = task.TargetAddress.Split("-"); + stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); + stackerCraneTaskCommand.EndColumn = Convert.ToInt16(endCodes[1]); + stackerCraneTaskCommand.EndLayer = Convert.ToInt16(endCodes[2]); + string[] sourceCodes = task.SourceAddress.Split("-"); + stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; + stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); + stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); + } + else if (((task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001") && task.Roadway.Contains("JZ")) || task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm) { string[] endCodes = task.NextAddress.Split("-"); stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); -- Gitblit v1.9.3