From 9e579eda4601ed7b492b9d19a24e8146f6ebdf8d Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 19 四月 2025 19:50:43 +0800
Subject: [PATCH] 优化空托出入库逻辑

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index 7a9f88c..5df9012 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -16,6 +16,7 @@
 using WIDESEAWCS_Common.StackerCraneEnum;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Caches;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_IShuttleCar;
 using WIDESEAWCS_ITaskInfoRepository;
@@ -29,6 +30,7 @@
 using WIDESEAWCS_QuartzJob.StackerCrane.Enum;
 using WIDESEAWCS_TaskInfoService;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
+using WIDESEAWCS_Tasks.ShuttleCarJob;
 using WIDESEAWCS_Tasks.StackerCraneJob;
 
 namespace WIDESEAWCS_Tasks
@@ -41,14 +43,16 @@
         private readonly ITaskRepository _taskRepository;
         private readonly IRouterService _routerService;
         private readonly IShuttleCarService _shuttleCarService;
+        private readonly ICacheService _cacheService;
 
-        public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IShuttleCarService shuttleCarService)
+        public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IShuttleCarService shuttleCarService, ICacheService cacheService)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _taskRepository = taskRepository;
             _routerService = routerService;
             _shuttleCarService = shuttleCarService;
+            _cacheService = cacheService;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -59,14 +63,17 @@
                 if (commonStackerCrane != null)
                 {
                     commonStackerCrane.Communicator.IsReadAfterWrite = false;
+                    #region 鑾峰彇鍫嗗灈鏈轰俊鎭�
+                    StackerCraneTaskCommandR common = ReadCustomer<StackerCraneTaskCommandR>(commonStackerCrane, commonStackerCrane.DeviceCode);
+                    _cacheService.AddOrUpdate(commonStackerCrane.DeviceCode, common);
+                    #endregion
                     #region 淇″彿浜や簰澶勭悊
                     //Heartbeat(commonStackerCrane);
                     ShuttleCarSignal(commonStackerCrane);
                     #endregion
 
                     #region 浠诲姟瀹屾垚
-                    var completeStatus = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.CompleteStatus);
-                    if (completeStatus == 2 || completeStatus == 3)
+                    if (common.CompleteStatus == 2 || common.CompleteStatus == 3)
                     {
                         NormalCompleted(commonStackerCrane);
                     }
@@ -78,12 +85,10 @@
                     //}
                     #endregion
                     #region 浠诲姟閫昏緫澶勭悊
-                    var onlinestate = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.Onlinestate);
-                    var writeStatus = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WriteStatus);
-                    if (onlinestate == (short)Onlinestate.online /*&& writeStatus == (short)WriteStatus.Permit*/)
+                    if (common.Onlinestate == (short)Onlinestate.online)
                     {
                         #region 鏌ヨ浠诲姟,閫昏緫澶勭悊
-                        if (Enum.Parse<RunStatus>(commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.RunStatus).ToString()) == RunStatus.Standby)
+                        if (common.RunStatus == (short)RunStatus.Standby)
                         {
                             var Task = _taskService.GetTaskState((int)TaskCarStatusEnum.ShuttleCar_Finish, (int)TaskOtherTypeEnum.RelocationCar);//鑾峰彇绉昏溅浠诲姟
                             var Task1 = _taskService.GetTaskState((int)CarChargingTaskEnum.ShuttleCar_Finish, (int)TaskOtherTypeEnum.RelocationCarCharging);//鑾峰彇绉昏溅鍏呯數浠诲姟

--
Gitblit v1.9.3