From df97e66f99cf081abf212a8d97fc32afe9c6e7a7 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 17 一月 2025 13:46:32 +0800
Subject: [PATCH] 更新配置文件PDA版本

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/StackerCraneJob_CSJ.cs |   41 +++++++++++++++++------------------------
 1 files changed, 17 insertions(+), 24 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 c9593f4..e9a0996 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"
@@ -87,12 +87,9 @@
                                 if (sendFlag)
                                 {
                                     commonStackerCrane.LastTaskType = task.TaskType;
-                                    int oldState = task.TaskState;
-                                    task.TaskState = TaskStatusEnum.SC_Executing.ObjToInt();
                                     task.Dispatchertime = DateTime.Now;
                                     task.ExceptionMessage = "";
-                                    _taskRepository.UpdateData(task);
-                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�");
+                                    _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
                                 }
                             }
                         }
@@ -116,8 +113,9 @@
             CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
             if (commonStackerCrane != null)
             {
-                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
+                if (e.TaskNum != 0)
                 {
+                    WriteDebug(commonStackerCrane.DeviceCode, $"璇诲彇鍒颁换鍔″畬鎴�,浠诲姟鍙�:{e.TaskNum}");
                     StackerCraneTaskCompleted(e.TaskNum, commonStackerCrane.DeviceCode);
                     commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                 }
@@ -140,13 +138,8 @@
                             _taskService.UpdateTaskExceptionMessage(taskNum, $"AGV绔欑偣鏈厤缃�,{task.NextAddress}");
                             return WebResponseContent.Instance.Error($"AGV绔欑偣鏈厤缃�,{task.NextAddress}");
                         }
-                        int oldStatus = task.TaskState;
-                        task.DeviceCode = "AGV_CSJ";
-                        task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt();
-                        task.CurrentAddress = stationManger.AGVStationCode;
-                        task.NextAddress = task.TargetAddress;
-                        _taskRepository.UpdateData(task);
-                        _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"绯荤粺鑷姩娴佺▼,锛屼换鍔$姸鎬佷粠銆恵oldStatus}銆戣浆鍒般�恵task.TaskState}銆�");
+
+                        _taskService.UpdateTask(task, TaskStatusEnum.AGV_Execute, deviceCode: "AGV_CSJ", currentAddress: stationManger.AGVStationCode ?? throw new Exception($"agv绔欑偣閿欒"), nextAddress: task.TargetAddress);
                     }
                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                     {
@@ -154,14 +147,14 @@
                     }
                     else
                     {
-                        WriteInfo(deviceCode, $"鏈壘鍒拌浠诲姟绫诲瀷鍥炶皟WMS浠诲姟瀹屾垚鎺ュ彛,{task.TaskType}");
+                        WriteError(deviceCode, $"鏈壘鍒拌浠诲姟绫诲瀷鍥炶皟WMS浠诲姟瀹屾垚鎺ュ彛,{task.TaskType}");
                         _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"鏈壘鍒拌浠诲姟绫诲瀷鍥炶皟WMS浠诲姟瀹屾垚鎺ュ彛,{task.TaskType}");
                         _taskService.UpdateTaskExceptionMessage(taskNum, $"鏈壘鍒拌浠诲姟绫诲瀷鍥炶皟WMS浠诲姟瀹屾垚鎺ュ彛,{task.TaskType}");
                     }
                 }
                 else
                 {
-                    WriteInfo(deviceCode, $"鏈壘鍒颁换鍔′俊鎭�,浠诲姟鍙�:{taskNum}");
+                    WriteError(deviceCode, $"鏈壘鍒颁换鍔′俊鎭�,浠诲姟鍙�:{taskNum}");
                     return WebResponseContent.Instance.Error($"鏈壘鍒颁换鍔′俊鎭�,浠诲姟鍙�:{taskNum}");
                 }
 
@@ -230,11 +223,11 @@
 
             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
-                string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress;
+                string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress;
                 if (string.IsNullOrEmpty(url))
                 {
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛");
-                    WriteInfo(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛");
+                    WriteError(commonStackerCrane.DeviceCode, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛");
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒癢MS绉诲簱鍒ゆ柇鎺ュ彛");
                     return null;
                 }
@@ -268,13 +261,13 @@
                 }
                 else
                 {
-                    WriteInfo(task.DeviceCode, $"鏈壘鍒板嚭搴撶珯鍙般�恵stationManger.StationDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+                    WriteError(task.DeviceCode, $"鏈壘鍒板嚭搴撶珯鍙般�恵stationManger.StationDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵stationManger.StationDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                 }
             }
             else
             {
-                WriteInfo(task.DeviceCode, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+                WriteError(task.DeviceCode, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
                 _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
             }
             return null;
@@ -306,7 +299,7 @@
                 else
                 {
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"鍏ュ簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
+                    WriteError(task.DeviceCode, $"鍏ュ簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
                     return null;
                 }
 
@@ -321,7 +314,7 @@
                 {
                     //鏁版嵁閰嶇疆閿欒
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
+                    WriteError(task.DeviceCode, $"鍏ュ簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
                     return null;
                 }
             }
@@ -339,7 +332,7 @@
                 {
                     //鏁版嵁閰嶇疆閿欒
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"鍑哄簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
+                    WriteError(task.DeviceCode, $"鍑哄簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
                     return null;
                 }
 
@@ -354,7 +347,7 @@
                 {
                     //鏁版嵁閰嶇疆閿欒
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"鍑哄簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
+                    WriteError(task.DeviceCode, $"鍑哄簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
                     return null;
                 }
             }
@@ -371,7 +364,7 @@
                 {
                     //鏁版嵁閰嶇疆閿欒
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"绉诲簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"绉诲簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
+                    WriteError(task.DeviceCode, $"绉诲簱浠诲姟缁堢偣閿欒锛岀粓鐐癸細銆恵task.NextAddress}銆�");
                     return null;
                 }
                 string[] sourceCodes = task.CurrentAddress.Split("-");
@@ -385,7 +378,7 @@
                 {
                     //鏁版嵁閰嶇疆閿欒
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"绉诲簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
-                    WriteInfo(task.DeviceCode, $"绉诲簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
+                    WriteError(task.DeviceCode, $"绉诲簱浠诲姟璧风偣閿欒锛岃捣鐐癸細銆恵task.CurrentAddress}銆�");
                     return null;
                 }
             }

--
Gitblit v1.9.3