From fd073a00f6813eada92b08f1884b115295ac1177 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 17 六月 2025 17:15:58 +0800
Subject: [PATCH] 添加版权注释

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs |   44 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 36 insertions(+), 8 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
index 4d04f61..1b571a4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
@@ -11,7 +11,10 @@
 using WIDESEAWCS_Common.ShuttleCarEnum;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Caches;
 using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_DTO.System;
+using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_DTO.WMSInfo;
 using WIDESEAWCS_IShuttleCar;
 using WIDESEAWCS_ITaskInfoRepository;
@@ -37,9 +40,10 @@
         private readonly IShuttleCarService _shuttleCarService;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly IRouterService _routerService;
+        private readonly ICacheService _cacheService;
         private readonly IMapper _mapper;
 
-        public CommonShuttleCarJob(ITaskService taskService, ITaskRepository taskRepository, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper)
+        public CommonShuttleCarJob(ITaskService taskService, ITaskRepository taskRepository, ITaskHtyService taskHtyService, IShuttleCarService shuttleCarService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, ICacheService cacheService, IMapper mapper)
         {
             _taskService = taskService;
             _taskRepository = taskRepository;
@@ -47,6 +51,7 @@
             _shuttleCarService = shuttleCarService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _routerService = routerService;
+            _cacheService = cacheService;
             _mapper = mapper;
         }
 
@@ -59,11 +64,12 @@
                 {
                     shuttleCar.Communicator.IsReadAfterWrite = false;
                     ShuttleCarTaskCommandR command = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar, shuttleCar.DeviceCode);//璇诲彇绌挎杞︿俊鎭�
+                    _cacheService.AddOrUpdate(shuttleCar.DeviceCode, command);
                     if (command != null && command.JoinStatus == 1)
                     {
                         #region 绌挎杞︿换鍔″畬鎴�
                         var complete = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.TaskComplete);
-                        if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby && command.Status == command.TaskTypeComplete)
+                        if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby)
                         {
                             _taskService.ShuttleCarTaskCompleted(command.number, command.TaskTypeComplete);
                             shuttleCar.SetValue(ShuttleCarDBName.ConfirmComplete, true, shuttleCar.DeviceCode);
@@ -77,6 +83,7 @@
                         #region 鍒涘缓绉昏溅鍏呯數浠诲姟
                         if (command.Err_Status == (short)ShuttleCarErr.LowBattery || command.ElectricQuantity <= (short)ShuttleCarErr.LowBattery)
                         {
+                            var ShuttleCar = QueryCode(shuttleCar.DeviceCode);//鍦ㄥ厖鐢典綅鐩存帴璁╃┛姊溅鍘诲厖鐢�
                             //鐢熸垚鍫嗗灈鏈虹Щ杞︿换鍔�&绌挎杞﹀厖鐢典换鍔�,鍒ゆ柇鏄惁鏈夌┛姊溅鍦ㄥ厖鐢�
                             Dt_Task _Task = _taskRepository.QueryFirst(x => x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt());
                             if (_Task != null)
@@ -87,10 +94,8 @@
                                     ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//璇诲彇绌挎杞︿俊鎭�
                                     if (command1 != null && command1.JoinStatus == 1)
                                     {
-                                        if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50)
+                                        if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity /*> command.ElectricQuantity*/ >= 50)
                                         {
-                                            var ShuttleCar = QueryCode(shuttleCar1.DeviceCode);
-                                            _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "", ShuttleCar.ShuttleCarCode);
                                             shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging);
                                         }
                                     }
@@ -98,14 +103,37 @@
                             }
                             else
                             {
-                                var ShuttleCar = QueryCode(shuttleCar.DeviceCode);
-                                _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "003-002-001", ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
+                                string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//鍏呯數浣�
+                                //鍒ゆ柇鍏呯數浣嶆槸鍚︽湁杞�
+                                var ShuttleCar1 = _shuttleCarService.QueryShuttleCar(CarChargingStation);
+                                if (ShuttleCar1 != null && ShuttleCar1.ShuttleCarCode != shuttleCar.DeviceCode)
+                                {
+                                    if (_taskRepository.QueryFirst(x => x.ShuttleCarCode == ShuttleCar1.ShuttleCarCode) == null)
+                                        _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode);
+                                }
+                                else
+                                {
+                                    _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, CarChargingStation, ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
+                                }
                             }
                         }
                         #endregion
 
                         #region 鑾峰彇绉昏溅/鍑哄叆搴撲换鍔�
-                        Get_CarTask(shuttleCar, command);
+                        if (command != null &&
+                            (command.Status == (short)ShuttleCarStatus.Standby ||
+                            command.Status == (short)ShuttleCarStatus.Charging) &&
+                            command.TaskTypeComplete == (short)ShuttleCarTaskComplete.Standby &&
+                            (command.Err_Status == (short)ShuttleCarErr.Normal ||
+                            command.Err_Status == (short)ShuttleCarErr.LowBattery)
+                            )
+                        {
+                            var dt_Task = GetTask(TaskRelocationStatusEnum.SC_RelocationFinish.ObjToInt(), TaskRelocationTypeEnum.Relocation.ObjToInt());//绉诲簱浠诲姟
+                            if (dt_Task != null && shuttleCar.DeviceCode == dt_Task.ShuttleCarCode)
+                                SendTask(dt_Task);
+                            else
+                                Get_CarTask(shuttleCar, command);
+                        }
                         #endregion
                     }
                 }

--
Gitblit v1.9.3