From b31d961a3f0bcd2e555ea12b76c30c453826deba Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 28 七月 2025 09:42:58 +0800
Subject: [PATCH] 代码提交

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs |   82 ++++++++++++++++++++++------------------
 1 files changed, 45 insertions(+), 37 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs"
index 60de693..717bf2f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RGVJob/CommonRGVJob.cs"
@@ -82,12 +82,6 @@
                 CommonRGV commonRGV = (CommonRGV)context.JobDetail.JobDataMap.Get("JobParams");
                 if (commonRGV != null)
                 {
-                    //if (!commonRGV.IsEventSubscribed)
-                    //{
-                    //    commonRGV.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//璁㈤槄浠诲姟瀹屾垚浜嬩欢
-                    //}
-
-                    //commonRGV.CheckStackerCraneTaskCompleted();//闃叉浠诲姟瀹屾垚浜嬩欢鐩戞祴瓒呮椂锛屽啀鎵嬪姩瑙﹀彂涓�娆�
                     if (commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.WorkCompleted))
                     {
                         var x = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum);
@@ -122,20 +116,32 @@
                     }
                     var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
                     var userIds = tokenInfos?.Select(x => x.UserId).ToList();
-
+                    string RGVAutoStatus(bool AutoStatus) => AutoStatus switch
+                    {
+                        true => "鑱旀満妯″紡",
+                        false => "鍗曟満妯″紡",
+                    };
+                    string RGVWorkStatus(bool WorkStatus) => WorkStatus switch
+                    {
+                        true => "杩愯涓�",
+                        false => "寰呮満",
+                    };
+                    string RGVStatus(bool Status) => Status switch
+                    {
+                        true => "鏁呴殰",
+                        false => "姝e父",
+                    };
                     object obj = new
                     {
-                        Automatic = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Automatic),
-                        Fault = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Fault),
-                        Running = commonRGV.GetValue<StackerCraneDBName, bool>(StackerCraneDBName.Running),
-                        //commonRGV.StackerCraneAutoStatusDes,
-                        //commonRGV.StackerCraneWorkStatusDes,
-                        //commonRGV.DeviceCode,
-                        //commonRGV.DeviceName,
-                        //commonRGV.CurrentTaskNum,
-                        //commonRGV.LastTaskNum,
+                        Automatic = RGVAutoStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Automatic)),
+                        Fault = RGVStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Fault)),
+                        Running = RGVWorkStatus(commonRGV.GetValue<RGVDBName, bool>(RGVDBName.Running)),
+                        LevelPoint = commonRGV.GetValue<RGVDBName, int>(RGVDBName.LevelPoint),
+                        CurrentTaskNum = commonRGV.GetValue<RGVDBName, short>(RGVDBName.RGVTaskNum),
+                        commonRGV.DeviceCode,
+                        commonRGV.DeviceName,
                     };
-                    _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { commonRGV.DeviceName, data = obj });
+                    _noticeService.RGVData(userIds?.FirstOrDefault(), userTokenIds, new { commonRGV.DeviceName, data = obj });
 
                     #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
                 }
@@ -146,30 +152,12 @@
             }
             return Task.CompletedTask;
         }
-        /// <summary>
-        /// 浠诲姟瀹屾垚浜嬩欢璁㈤槄鐨勬柟娉�
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e)
-        {
-            CommonRGV? commonRGV = sender as CommonRGV;
-                       
-        }
+       
 
         public void RGVTaskFinish(CommonRGV commonRGV, int TaskNum)
         {
             if (commonRGV != null)
             {
-                #region 鏃ュ織璁板綍
-                ConsoleHelper.WriteColorLine($"銆恵commonRGV.DeviceName}銆戝爢鍨涙満浣滀笟鐘舵�侊細銆愩�戞椂闂淬�恵DateTime.Now}銆�", ConsoleColor.Magenta);
-
-                string str = $"銆恵commonRGV.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵TaskNum}銆戞椂闂淬�恵DateTime.Now}銆�";
-                WriteInfo(commonRGV.DeviceName, str);
-                ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
-
-                #endregion
-
                 var task = _taskRepository.QueryFirst(x => x.TaskNum == TaskNum);
                 if (task != null)
                 {
@@ -183,9 +171,10 @@
                             {
                                 CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                 Thread.Sleep(100);
+                                
                                 var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode);
 
-                                if (Barcode == null)
+                                if (Barcode == null||Barcode=="")
                                 {
                                     return;
                                 }
@@ -195,6 +184,25 @@
                     }
                     else
                     {
+                        if (task.TaskState == (int)TaskOutStatusEnum.RGV_OutExecuting)
+                        {
+                            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress && x.stationType == 7);
+                            if (stationManager != null)
+                            {
+                                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManager.stationPLC);
+                                if (device != null)
+                                {
+                                    CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
+                                    Thread.Sleep(100);
+                                    var Barcode = conveyorLine.GetValue<ConveyorLineDBName, string>(ConveyorLineDBName.ConveyorLineBarcode, stationManager.stationChildCode);
+                                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, Convert.ToInt16(stationManager.stationNextChildCode), stationManager.stationChildCode);
+                                    Thread.Sleep(100);
+                                    conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTaskNum, Convert.ToInt16(1000), stationManager.stationChildCode);
+                                    Thread.Sleep(100);
+                                    conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(2), stationManager.stationChildCode);
+                                }
+                            }
+                        }
                         var content = _taskService.RGVTaskCompleted(TaskNum);
                     }
                 }

--
Gitblit v1.9.3