From 866145a4215ef67545a1a0e4a3fcbc4d7cddfdce Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 14 四月 2026 11:26:31 +0800
Subject: [PATCH] q

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs |  140 ++++++++++++++++++++++++++++++----------------
 1 files changed, 90 insertions(+), 50 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs"
index b2ae635..2e3f397 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs"
@@ -14,6 +14,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEAWCS_Common;
+using WIDESEAWCS_Common.LocationEnum;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Communicator;
 using WIDESEAWCS_Core.Helper;
@@ -30,13 +31,16 @@
 {
     [DisallowConcurrentExecution]
     public class TSJJob : JobBase, IJob
-    { 
+    {
         private readonly ITaskService _taskService;
         private readonly IStationMangerService _stationMangerService;
-        public TSJJob(ITaskService taskService, IStationMangerService stationMangerService)
+        private readonly IStationInfoService _stationInfoService;
+        
+        public TSJJob(ITaskService taskService, IStationMangerService stationMangerService, IStationInfoService stationInfoService)
         {
             _taskService = taskService;//娉ㄥ叆
             _stationMangerService = stationMangerService;
+            _stationInfoService = stationInfoService;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -146,6 +150,7 @@
                                     }
                                     continue;
                                 }
+
                                 if (device.GetValue<HoistEnum, short>(HoistEnum.ROutScanningCompletionSignal, task.SourceAddress) != 1)
                                 {
                                     if (task.ExceptionMessage != "4妤兼彁鍗囨満鍑哄彛鎵爜瀹屾垚淇″彿娌℃湁瀹屾垚")
@@ -171,59 +176,94 @@
                             task.ExceptionMessage = "";
                             Uptasks.Add(task);
                         }
-                      
-
                     }
-
-                    #region 鎵樼洏鍙风‘璁や腑
-                    //鏌ユ壘涓夋ゼ鍏ュ簱浠诲姟鐘舵�佷负CheckPalletCodeing鐨勪换鍔℃墭鐩樺彿纭涓�
-                    var RK3FTasks = _taskService.Repository.QueryFirst(x => x.TaskType == TaskTypeEnum.RK3F.ObjToInt() && x.TaskState == (int)TaskStatusEnum.CheckPalletCodeing);
-                    if (RK3FTasks != null)
-                    {
-                        var Barcode = device.SetValue<HoistEnum, short>(HoistEnum.Codereadingtriggered, 1);
-                        //妫�鏌�3妤煎叆搴撶鍙锋槸澶氬皯锛岀劧鍚庝紶缁檞ms
-                        var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Inboxnumber, RK3FTasks.TargetAddress);
-                        if (device.GetValue<HoistEnum, short>(HoistEnum.RInScanningCompletionSignal, RK3FTasks.TargetAddress ) !=1 )
-                        {
-                            RK3FTasks.ExceptionMessage = "3妤兼壂鐮佸畬鎴愪俊鍙锋病鏈夊畬鎴�";
-                        }
-                        else //瀹屾垚灏辨妸浠诲姟鐘舵�佹敼鎴愭墭鐩樺彿纭瀹屾垚
-                        {
-                            //鏍规嵁璇诲埌鐨勭鍙疯繘琛屾枡绠辨楠岋紝妫�楠岄�氳繃灏辫Е鍙戣鐮佸櫒璇诲彇锛屽鏋滀笉閫氳繃灏辨姏鍑哄紓甯�
-                            //var Verification = _taskService.MaterialBoxInspection(RK3FTasks.WMSTaskNum, BinNumber.ToString());
-                            //if (!Verification.Status)
-                            //{
-                            //    if (!(RK3FTasks.ExceptionMessage == Verification.Message))
-                            //    {
-                            //        RK3FTasks.ExceptionMessage = Verification.Message;
-                            //        Uptasks.Add(RK3FTasks);
-                            //    }
-                            //    //鏂欑楠岃瘉鍐欏ソ鍚庯紝闇�瑕佹洿鏀�
-                            //    RK3FTasks.TargetAddress = Verification.Data.ToString();
-                            //}
-
-                            //濡傛灉鏂欑妫�楠屾垚鍔熷氨鍐欏叆璇荤爜鍣ㄧ殑鍊�
-                            var result = _taskService.Hikvisiontaskscontinue(RK3FTasks.WMSTaskNum, RK3FTasks.TargetAddress);
-                            if (result.Status == false)
-                            {
-                                if (RK3FTasks.ExceptionMessage != result.Message)
-                                {
-                                    RK3FTasks.ExceptionMessage = result.Message;
-                                    Uptasks.Add(RK3FTasks);
-                                }
-                            }
-                            RK3FTasks.TaskState = (int)TaskStatusEnum.CheckPalletCodeFinish;
-                        }
-                        Uptasks.Add(RK3FTasks);
-                    }
-                    #endregion
                     if (Uptasks.Count > 0)
                     {
                         _taskService.UpdateData(Uptasks);
                     }
-                    WriteInfo(device.DeviceName, "infoLog");
 
-                    WriteDebug(device.DeviceName, "debugLog");
+                    #region 鎵樼洏鍙风‘璁や腑
+                    //鏌ユ壘涓夋ゼ鍏ュ簱浠诲姟鐘舵�佷负CheckPalletCodeing鐨勪换鍔℃墭鐩樺彿纭涓�
+                    var RK3FTask = _taskService.Repository.QueryFirst(x => x.TaskType == TaskTypeEnum.RK3F.ObjToInt() && x.TaskState == (int)TaskStatusEnum.CheckPalletCodeing);
+                    if (RK3FTask != null)
+                    {
+                        if (device.GetValue<HoistEnum, short>(HoistEnum.RInScanningCompletionSignal, RK3FTask.TargetAddress) != 1)
+                        {
+                            RK3FTask.ExceptionMessage = "3妤兼壂鐮佸畬鎴愪俊鍙锋病鏈夊畬鎴�";
+                            _taskService.UpdateData(RK3FTask);
+                        }
+                        else //瀹屾垚灏辨妸浠诲姟鐘舵�佹敼鎴愭墭鐩樺彿纭瀹屾垚
+                        {
+                            //妫�鏌�3妤煎叆搴撶鍙锋槸澶氬皯锛岀劧鍚庝紶缁檞ms
+                            var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Inboxnumber, RK3FTask.TargetAddress);
+                            if (!string.IsNullOrEmpty(BinNumber))
+                            {
+                                BinNumber = BinNumber.TrimEnd('\0').Substring(2);
+                                //鏍规嵁璇诲埌鐨勭鍙疯繘琛屾枡绠辨楠岋紝妫�楠岄�氳繃灏辫Е鍙戣鐮佸櫒璇诲彇锛屽鏋滀笉閫氳繃灏辨姏鍑哄紓甯�
+                                var Verification = _taskService.MaterialBoxInspection(RK3FTask.WMSTaskNum, BinNumber);
+                                if (!Verification.Status)
+                                {
+                                    if (RK3FTask.ExceptionMessage != Verification.Message)
+                                    {
+                                        RK3FTask.ExceptionMessage = Verification.Message;
+                                        _taskService.UpdateData(RK3FTask);
+                                    }
+                                }
+                                else
+                                {
+
+                                    //濡傛灉璐ㄦ閫氳繃灏变笉鏀瑰彉RK3FTask.TargetAddress鐨勫�硷紝
+                                    if (!string.IsNullOrEmpty(Verification.Message))
+                                    {
+                                        //瀵绘壘骞冲簱璐т綅
+                                        var Location = _stationInfoService.Repository.QueryFirst(x=>x.StationRegion==Verification.Message.ObjToInt()&&x.StationStatus==(int)LocationStatusEnum.Free&&x.FloorNumber=="CC"&&x.IsOccupied==(int)LocationStatusEnum.Free);
+                                        //杩欓噷瑕佸垽鏂�
+                                        if (Location==null)
+                                        {
+                                            RK3FTask.ExceptionMessage = "$鏈壘鍒皗Verification.Message}鍖哄煙鐨勮揣浣峽Location}";
+                                        }
+                                        RK3FTask.CurrentAddress = RK3FTask.TargetAddress;
+                                        RK3FTask.NextAddress = Location.StationCode;
+                                        RK3FTask.TargetAddress = Location.StationCode;
+                                        _taskService.UpdateData(RK3FTask);
+                                    }
+                                        //璋冪敤娴峰悍杩涜鎵ц瀹屾垚鎺ュ彛
+                                        var result = _taskService.Hikvisiontaskscontinue(RK3FTask.WMSTaskNum, RK3FTask.NextAddress);
+                                    if (result.Status)
+                                    {
+                                        RK3FTask.ExceptionMessage = "";
+                                        RK3FTask.TaskState = (int)TaskStatusEnum.CheckPalletCodeFinish;
+                                        _taskService.UpdateData(RK3FTask);
+                                    }
+                                    else
+                                    {
+                                        if (RK3FTask.ExceptionMessage != result.Message)
+                                        {
+                                            RK3FTask.ExceptionMessage = result.Message;
+                                            _taskService.UpdateData(RK3FTask);
+                                        }
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    #endregion
+
+                    #region 4F鎻愬崌鏈哄嚭鍙f墭鐩樺彿涓婃姤WMS
+                    var Address = "TSJC4F";
+                    if (device.GetValue<HoistEnum, short>(HoistEnum.ROutScanningCompletionSignal, Address) == 1)
+                    {
+                        var BinNumber = device.GetValue<HoistEnum, string>(HoistEnum.Emptycontainernumber, Address);
+                        if (!string.IsNullOrEmpty(BinNumber))
+                        {
+                            BinNumber = BinNumber.TrimEnd('\0').Substring(2);
+                            _taskService.InboundElevatorExit(Address, BinNumber);
+                        }
+                    }
+                    #endregion
+                    //WriteInfo(device.DeviceName, "infoLog");
+
+                    //WriteDebug(device.DeviceName, "debugLog");
                 }
                 catch (Exception ex)
                 {
@@ -232,7 +272,7 @@
             }
             else
             {
-                WriteError(nameof(TestJob), "鍙傛暟閿欒,鏈紶閫掕澶囧弬鏁版垨璁惧绫诲瀷閿欒");
+                WriteError(nameof(TSJJob), "鍙傛暟閿欒,鏈紶閫掕澶囧弬鏁版垨璁惧绫诲瀷閿欒");
             }
 
 

--
Gitblit v1.9.3