From efc0923ff1e1dc995f6981c2559227df24da7623 Mon Sep 17 00:00:00 2001
From: zhangchengsong <zhangchengsong@hnkhzn.com>
Date: 星期四, 23 四月 2026 16:54:43 +0800
Subject: [PATCH] 1

---
 项目代码/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index f90cde9..987e148 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -27,6 +27,7 @@
 using WIDESEAWCS_ISystemServices;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_Model.Models.System;
 using WIDESEAWCS_QuartzJob;
@@ -49,17 +50,21 @@
         private readonly ITaskRepository _taskRepository;
         private readonly IRouterService _routerService;
         private readonly IDt_PlatformStationService _DtPlatformStationService;
+        private readonly IDt_roadwayinfoService _Dt_roadwayinfoService;
 
-        public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService)
+        public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IDt_roadwayinfoService dt_roadwayinfoService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _taskRepository = taskRepository;
             _routerService = routerService;
             _DtPlatformStationService = dt_PlatformStationService;
+            _Dt_roadwayinfoService = dt_roadwayinfoService;
         }
         private static readonly Dictionary<string, bool> _deviceLastStatus = new Dictionary<string, bool>();
         public string urlWMSdeverror = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSdeverror"];
+        private static readonly StackerFault[] _stackerFaultEnumCache = Enum.GetValues(typeof(StackerFault)).Cast<StackerFault>().ToArray();
+
 
 
         public Task Execute(IJobExecutionContext context)
@@ -124,7 +129,7 @@
                             WebResponseContent webResponse = _taskService.StackCraneTaskCompleted(commonStackerCrane.CurrentTaskNum, PalletCode);
                             if (webResponse.Status)
                             {
-                                Task.Run(() => WriteLog.Write_Log("鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", "鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", $"銆恵commonStackerCrane.DeviceCode}銆戝簱鍫嗗灈鏈轰笂鎶ヤ换鍔″彿:銆恵commonStackerCrane.CurrentTaskNum}銆戝畬鎴愪俊鍙凤紒"));
+                               WriteLog.Write_Log("鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", "鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", $"銆恵commonStackerCrane.DeviceCode}銆戝簱鍫嗗灈鏈轰笂鎶ヤ换鍔″彿:銆恵commonStackerCrane.CurrentTaskNum}銆戝畬鎴愪俊鍙凤紒");
 
                                 bool ddjfk = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                             }
@@ -468,7 +473,14 @@
                 {
                     var dtTask = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
                     if (dtTask == null) return;
-
+                //鍫嗗灈鏈烘斁璐т腑鏄换鍔$姸鎬佸洖璋冩嬁pickup
+                if (dtTask.TaskType == 200 && stackerCraneWorkStatusDes == "鏀捐揣涓�")
+                    {
+                        string Result = WMSTaskStatusEnum.pickup.GetDescription();
+                        Dt_roadwayinfo roadwayinfo = _Dt_roadwayinfoService.GetRoadwayinfo(dtTask.Roadway);
+                        CommandResult command = _taskService.taskreturn(int.Parse(dtTask.WMStaskid), Result, roadwayinfo.WarehouseInvType, "");
+                        return;
+                    }
                     string[] targets = { "G02", "G03", "G04", "C02", "C01" };
                     if (dtTask.TaskType != 100 || !targets.Contains(dtTask.TargetAddress)) return;
 
@@ -493,18 +505,21 @@
 
                     conveyorLine.Communicator.Write<short>(handShake.DeviceProAddress, writeValue);
                 }
-                catch
-                { }
+                catch(Exception e)
+                {
+                    WriteLog.Write_Log("鍑哄簱灞忚斀鍏夋爡/鍫嗗灈鍏ュ簱瑕佹斁璐у紓甯�", "閿欒", e.ToString());
+                }
         }
-
         /// <summary>
-        /// 璇诲彇鏁呴殰锛堜紭鍖朑C锛�
+        /// 鏁呴殰淇℃伅
         /// </summary>
+        /// <param name="crane"></param>
+        /// <returns></returns>
         public string ReadStackerFaults(CommonStackerCrane crane)
         {
             try
             {
-                foreach (StackerFault fault in Enum.GetValues(typeof(StackerFault)))
+                foreach (StackerFault fault in _stackerFaultEnumCache)
                 {
                     try
                     {
@@ -512,13 +527,10 @@
                         if (isFault)
                             return fault.GetDesc();
                     }
-                    catch { }
+                    catch { continue; }
                 }
             }
-            catch (Exception ex)
-            {
-                WriteLog.Write_Log("DB107鏁呴殰璇诲彇寮傚父", "閿欒", ex.ToString());
-            }
+            catch { }
             return string.Empty;
         }
     }

--
Gitblit v1.9.3