From 28a788d3fca51fb4fd2f668b90fa95e87c2633a1 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期四, 16 四月 2026 19:07:58 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/RuiShengZhiNeng/GaoPuLiTiKu

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs |  215 ++---------------------------------------------------
 1 files changed, 9 insertions(+), 206 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 3dddd75..1338406 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;
@@ -29,14 +30,17 @@
 namespace WIDESEAWCS_Tasks
 {
     [DisallowConcurrentExecution]
-    public class TSJJob : JobBase, IJob
+    public partial 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)
@@ -45,212 +49,11 @@
             if (flag && value != null)
             {
                 OtherDevice device = (OtherDevice)value;
-                //Example
-                //device.GetValue  璇诲彇
-                //device.SetValue  鍐欏叆
-                // _taskService.Repository 浠撳偍灞傦紝杩涜鏁版嵁搴撹闂�
-                try
-                {
-                    List<Dt_Task> Uptasks = new List<Dt_Task>();
-                    //鏌ヨ鎵�鏈変换鍔$被鍨嬩负3,4妤肩殑鍏ュ簱浠诲姟绫诲瀷涓斾换鍔$姸鎬佷负AGV_WaitToExecute鐨勪换鍔� 
-                    var taskList = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt());
-                    //浠诲姟鐨勭洰鏍囧湴鍧�瀵逛簬绔欏彴鍙凤紱
-                    foreach (var task in taskList)
-                    {
-                        //鍏堟鏌ヨ澶囩姸鎬�
-                        if (device.GetValue<HoistEnum, short>(HoistEnum.EquipmentStatus, "TSJ") == 2)
-                        {
-                            if (task.ExceptionMessage == "鎻愬崌鏈鸿澶囨晠闅�")
-                            {
-                                continue;
-                            }
-                            task.ExceptionMessage = "鎻愬崌鏈鸿澶囨晠闅�";
-                            Uptasks.Add(task);
-                            continue;
-                            //throw new Exception("璁惧鏁呴殰");
-                        }
-                        if (task.TaskType == TaskTypeEnum.RK3F.ObjToInt() || task.TaskType == TaskTypeEnum.CHUKU1.ObjToInt() || task.TaskType == TaskTypeEnum.F04.ObjToInt())
-                        {
-                            if (task.TaskType == TaskTypeEnum.RK3F.ObjToInt())
-                            {
-                                //鍒ゆ柇3妤煎叆搴撶鍙锋湁鏃�
-                                if (device.GetValue<HoistEnum, short>(HoistEnum.OutboundInplace, task.TargetAddress) != 2)
-                                {
-                                    if (task.ExceptionMessage == "3妤煎叆搴撶鍙锋湁璐э紝璇峰厛澶勭悊")
-                                    {
-                                        continue;
-                                    }
-                                    task.ExceptionMessage = "3妤煎叆搴撶鍙锋湁璐э紝璇峰厛澶勭悊";
-                                    Uptasks.Add(task);
-                                    continue;
-                                }
-                            }
-                            else
-                            {
-                                if (device.GetValue<HoistEnum, short>(HoistEnum.ReturnbinAvailable, task.TargetAddress) != 2)
-                                {
-                                    if (task.ExceptionMessage != "4F鎻愬崌鏈哄叆鍙f湁璐�")
-                                    {
-                                        task.ExceptionMessage = "4F鎻愬崌鏈哄叆鍙f湁璐�";
-                                        Uptasks.Add(task);
-                                    }
-                                    continue;
-                                }
-                            }
+                HKConexecutTask(device);
 
+                PalletNumConfirmation(device);
 
-                            //鐒跺悗璋冪敤杈撻�佺嚎鎺ュ彛锛岄�氱煡杈撻�佺嚎鏈夋枡绠遍渶瑕佸叆搴擄紝浠诲姟涓捐鎵ц
-                            var result = _taskService.Hikvisiontaskscontinue(task.WMSTaskNum);
-                            if (result.Status == false)
-                            {
-                                if (task.ExceptionMessage != result.Message)
-                                {
-                                    task.ExceptionMessage = result.Message;
-                                    Uptasks.Add(task);
-                                }
-                                continue;
-                            }
-                            task.TaskState = (int)TaskStatusEnum.AGV_ToExecute;
-                            task.ExceptionMessage = "";
-                            Uptasks.Add(task);
-
-                            //杩欓噷浠诲姟鍙樻垚浜咰heckPalletCodeing
-
-                        }
-                        else if (task.TaskType == TaskTypeEnum.CK3F.ObjToInt() || task.TaskType == TaskTypeEnum.Q1TSJ4.ObjToInt() || task.TaskType == TaskTypeEnum.F03.ObjToInt()) //鍑哄簱
-                        {
-                            ////鍑哄簱鏂欑缂撳瓨鏁伴噺(杩欎釜鏄簱鍖烘煡璇㈢殑鏃跺�欒鏌ヤ竴涓嬶紝杩旂粰wms)
-                            //if (device.GetValue<HoistEnum, short>(HoistEnum.Outboundmaterialbox, "TSJ") == 0) throw new Exception("娌℃湁鍑哄簱鏂欑缂撳瓨鏁伴噺涓虹┖");
-
-                            if (task.TaskType == TaskTypeEnum.CK3F.ObjToInt())
-                            {
-                                //璇诲彇3妤煎嚭搴撴枡绠卞埌浣�
-                                if (device.GetValue<HoistEnum, short>(HoistEnum.SOutboundmaterialbox, task.SourceAddress) != 1)
-                                {
-                                    if (task.ExceptionMessage != "3妤兼彁鍗囨満鍑哄彛鍏夌數鍙嶉鏃犺揣")
-                                    {
-                                        task.ExceptionMessage = "3妤兼彁鍗囨満鍑哄彛鍏夌數鍙嶉鏃犺揣";
-                                        Uptasks.Add(task);
-                                    }
-                                    continue;
-                                }
-                            }
-                            else
-                            {
-                                if (device.GetValue<HoistEnum, short>(HoistEnum.FOutboundmaterialbox, task.SourceAddress) != 1)
-                                {
-                                    if (task.ExceptionMessage != "4妤兼彁鍗囨満鍑哄彛鍏夌數鍙嶉鏃犺揣")
-                                    {
-                                        task.ExceptionMessage = "4妤兼彁鍗囨満鍑哄彛鍏夌數鍙嶉鏃犺揣";
-                                        Uptasks.Add(task);
-                                    }
-                                    continue;
-                                }
-
-                                if (device.GetValue<HoistEnum, short>(HoistEnum.ROutScanningCompletionSignal, task.SourceAddress) != 1)
-                                {
-                                    if (task.ExceptionMessage != "4妤兼彁鍗囨満鍑哄彛鎵爜瀹屾垚淇″彿娌℃湁瀹屾垚")
-                                    {
-                                        task.ExceptionMessage = "4妤兼彁鍗囨満鍑哄彛鎵爜瀹屾垚淇″彿娌℃湁瀹屾垚";
-                                        Uptasks.Add(task);
-                                    }
-                                    continue;
-                                }
-                            }
-                            //鐒跺悗璋冪敤杈撻�佺嚎鎺ュ彛锛岄�氱煡杈撻�佺嚎鏈夋枡绠遍渶瑕佸叆搴擄紝浠诲姟涓捐鎵ц
-                            var result = _taskService.Hikvisiontaskscontinue(task.WMSTaskNum);
-                            if (result.Status == false)
-                            {
-                                if (task.ExceptionMessage != result.Message)
-                                {
-                                    task.ExceptionMessage = result.Message;
-                                    Uptasks.Add(task);
-                                }
-                                continue;
-                            }
-                            task.TaskState = (int)TaskStatusEnum.AGV_ToExecute;
-                            task.ExceptionMessage = "";
-                            Uptasks.Add(task);
-                        }
-                    }
-                    if (Uptasks.Count > 0)
-                    {
-                        _taskService.UpdateData(Uptasks);
-                    }
-
-                    #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.CurrentAddress = RK3FTask.TargetAddress;
-                                    if (!string.IsNullOrEmpty(Verification.Message)) RK3FTask.TargetAddress = Verification.Message;
-                                    //濡傛灉鏂欑妫�楠屾垚鍔熷氨鍐欏叆璇荤爜鍣ㄧ殑鍊�
-                                    var result = _taskService.Hikvisiontaskscontinue(RK3FTask.WMSTaskNum, RK3FTask.TargetAddress);
-                                    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)
-                {
-                    WriteError(device.DeviceName, "閿欒", ex);
-                }
+                PalletReportingToWMS(device);
             }
             else
             {

--
Gitblit v1.9.3