From ee94d6b5b5719159370c5e0055957d2dffb3f815 Mon Sep 17 00:00:00 2001 From: Zhang-Hong-Lin <a3219986988@163.com> Date: 星期五, 07 三月 2025 09:49:49 +0800 Subject: [PATCH] 天车移动 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/OHT/OHTJob.cs | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/OHT/OHTJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/OHT/OHTJob.cs" index 07f4c0a..e2590a8 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/OHT/OHTJob.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/OHT/OHTJob.cs" @@ -37,7 +37,7 @@ private readonly ITaskService _taskService; private readonly Idt_ErrormsginfoService _ErrormsginfoService; WebSocketServer _webSocketServer; - public OHTJob(ITaskService taskService, WebSocketServer webSocketServer,Idt_ErrormsginfoService errormsginfoService) + public OHTJob(ITaskService taskService, WebSocketServer webSocketServer, Idt_ErrormsginfoService errormsginfoService) { _taskService = taskService;//娉ㄥ叆 _webSocketServer = webSocketServer; @@ -54,10 +54,10 @@ var ZXJdevice = Storage.Devices.Find(v => v.DeviceName == "闃虫瀬鏁村舰鏈�"); //瑙勬暣鏈篜LC瀵硅薄 var GZJevice = Storage.Devices.Find(v => v.DeviceName == "闃虫瀬瑙勬暣鏈�"); - //if (!device.Communicator.IsConnected || !ZXJdevice.Communicator.IsConnected || !GZJevice.Communicator.IsConnected) - //{ - // return Task.CompletedTask; - //} + if (!device.Communicator.IsConnected || !ZXJdevice.Communicator.IsConnected || !GZJevice.Communicator.IsConnected) + { + return Task.CompletedTask; + } try { #region 澶╄溅瀹屾垚浠诲姟閫昏緫 @@ -115,10 +115,20 @@ } return Task.CompletedTask; } + else if (oHTReadData.R_RunState == (int)RunStateEnum.MoveCompleted && oHTReadData.R_TaskState == (int)TaskStateEnum.TaskComplete) + { + //澶╄溅绉诲姩瀹屾垚 + WebResponseContent result = _taskService.StackCraneTaskCompleted(oHTReadData.R_TaskNumber, oHTReadData.weight); + if (result.Status) + { + device.SetValue(DeviceDBName.W_ConfirmSignal, 3); + } + return Task.CompletedTask; + } #endregion #region 澶╄溅鍙戦�佷换鍔¢�昏緫 - if (oHTReadData.R_RunMode == (int)RunModeEnum.Automatic ) + if (oHTReadData.R_RunMode == (int)RunModeEnum.Automatic) { if (oHTReadData.R_RunState == (int)RunStateEnum.Standby) { @@ -159,7 +169,7 @@ } catch (Exception ex) { - _ErrormsginfoService.UpdateErrorMsg(ex.Message,1); + _ErrormsginfoService.UpdateErrorMsg(ex.Message, 1); } } return Task.CompletedTask; @@ -176,7 +186,7 @@ { OHTTaskCommand oHtTaskCommand = new OHTTaskCommand(); - if (task.TaskState==(int)TaskInStatusEnum.InNew || task.TaskState == (int)TaskOutStatusEnum.OutNew) + if (task.TaskState == (int)TaskInStatusEnum.InNew || task.TaskState == (int)TaskOutStatusEnum.OutNew) { oHtTaskCommand.W_Task_Type = 2; string[] SourceCodes = task.SourceAddress.Split("-"); @@ -185,7 +195,7 @@ oHtTaskCommand.W_Pick_Line = Convert.ToInt16(SourceCodes[0]); oHtTaskCommand.W_Pick_Column = Convert.ToInt16(SourceCodes[1]); oHtTaskCommand.W_Put_Line = 0; - oHtTaskCommand.W_Put_Column = 0; + oHtTaskCommand.W_Put_Column = 0; } else { @@ -214,6 +224,25 @@ } oHtTaskCommand.W_CheckValue = 3 + Convert.ToInt16(SourceCodes[0]) + Convert.ToInt16(SourceCodes[1]); } + else if(task.TaskState == (int)TaskMoveStatusEnum.OutNewMove ) + { + oHtTaskCommand.W_Task_Type = 4; + string[] SourceCodes = task.TargetAddress.Split("-"); + if (SourceCodes.Length == 3) + { + oHtTaskCommand.W_Pick_Line = 0; + oHtTaskCommand.W_Pick_Column = 0; + oHtTaskCommand.W_Put_Line = Convert.ToInt16(SourceCodes[0]); + oHtTaskCommand.W_Put_Column = Convert.ToInt16(SourceCodes[1]); + } + else + { + //鏁版嵁閰嶇疆閿欒 + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"浠诲姟婧愬湴鍧�閰嶇疆閿欒锛�"); + return null; + } + oHtTaskCommand.W_CheckValue = 4 + Convert.ToInt16(SourceCodes[0]) + Convert.ToInt16(SourceCodes[1]); + } if (task.WMSId==1) { -- Gitblit v1.9.3