From eee43c4cb7f9018688cd6da6a3611512f3e5c5c3 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期六, 28 十二月 2024 09:18:06 +0800 Subject: [PATCH] 1 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/StackerCraneJob_CSJ.cs | 115 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 59 insertions(+), 56 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" index 2911a93..3cd1f34 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/StackerCraneJob_CSJ.cs" @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.APIEnum; @@ -73,28 +74,23 @@ { commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢 } - - if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) + commonStackerCrane.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆� + if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal && commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) { - commonStackerCrane.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆� - - if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) + Dt_Task? task = GetTask(commonStackerCrane); + if (task != null) { - Dt_Task? task = GetTask(commonStackerCrane); - if (task != null) + StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); + if (stackerCraneTaskCommand != null) { - StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); - if (stackerCraneTaskCommand != null) + bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); + if (sendFlag) { - bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); - if (sendFlag) - { - commonStackerCrane.LastTaskType = task.TaskType; - int oldState = task.TaskState; - task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt(); - _taskRepository.UpdateData(task); - _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�"); - } + commonStackerCrane.LastTaskType = task.TaskType; + int oldState = task.TaskState; + task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt(); + _taskRepository.UpdateData(task); + _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�"); } } } @@ -120,7 +116,6 @@ { if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) { - Console.Out.WriteLine("TaskCompleted" + e.TaskNum); StackerCraneTaskCompleted(e.TaskNum, commonStackerCrane.DeviceCode); commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); } @@ -144,19 +139,9 @@ _taskRepository.UpdateData(task); _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,锛屼换鍔$姸鎬佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�"); } - else if (task.TaskType.GetTaskTypeGroup() != TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) { - string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; - if (string.IsNullOrEmpty(url)) - { - _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"鏈壘鍒板洖璋僕MS浠诲姟瀹屾垚鎺ュ彛"); - WriteInfo(deviceCode, $"鏈壘鍒板洖璋僕MS浠诲姟瀹屾垚鎺ュ彛"); - return WebResponseContent.Instance.Error(); - } - - HttpHelper.Post($"{url}?taskNum={taskNum}", "");//todo 璋冪敤WMS浠诲姟瀹屾垚鏂规硶 - _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,浠诲姟瀹屾垚"); - _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.鑷姩瀹屾垚); + _taskService.TaskCompleted(taskNum); } else { @@ -302,13 +287,39 @@ if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔� { string[] startCodes = task.CurrentAddress.Split("-"); - - stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); - stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); - stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); + if (startCodes.Length == 3) + { + stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]); + stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]); + stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]); + } + else + { + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�"); + WriteInfo(task.DeviceCode, $"鍏ュ簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�"); + return null; + } string[] targetCodes = task.NextAddress.Split("-"); if (targetCodes.Length == 5) + { + stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); + stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); + stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); + } + else + { + //鏁版嵁閰嶇疆閿欒 + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�"); + WriteInfo(task.DeviceCode, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�"); + return null; + } + } + else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) + { + string[] targetCodes = task.NextAddress.Split("-"); + + if (targetCodes.Length == 3) { stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); @@ -317,25 +328,17 @@ else { //鏁版嵁閰嶇疆閿欒 - _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); - WriteInfo(task.DeviceCode, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); + WriteInfo(task.DeviceCode, $"鍑哄簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); return null; } - } - else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) - { - string[] targetCodes = task.NextAddress.Split("-"); - - stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); - stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); - stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); string[] sourceCodes = task.CurrentAddress.Split("-"); if (sourceCodes.Length == 5) { - stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); - stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); - stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); + stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); + stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); + stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); } else { @@ -350,23 +353,23 @@ string[] targetCodes = task.NextAddress.Split("-"); if (targetCodes.Length == 5) { - stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); - stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); - stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); + stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]); + stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]); + stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]); } else { //鏁版嵁閰嶇疆閿欒 - _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"绉诲簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); - WriteInfo(task.DeviceCode, $"绉诲簱浠诲姟缁堢偣閿欒锛岃捣鐐癸細銆恵task.NextAddress}銆�"); + _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"绉诲簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�"); + WriteInfo(task.DeviceCode, $"绉诲簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�"); return null; } string[] sourceCodes = task.CurrentAddress.Split("-"); if (sourceCodes.Length == 5) { - stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); - stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); - stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); + stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]); + stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]); + stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]); } else { -- Gitblit v1.9.3