From 8c8a68df710d568f5f2b358c1e8c4b4799547d0b Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期五, 31 十月 2025 15:24:34 +0800
Subject: [PATCH] 安全门,出入库

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs |   98 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 91 insertions(+), 7 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
index 9a57388..dddc198 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RgvOperationService.cs"
@@ -49,15 +49,18 @@
 using System.Net;
 using WIDESEAWCS_ISystemServices;
 using System.Security.Claims;
+using WIDESEAWCS_Common.TaskEnum;
 
 namespace WIDESEAWCS_TaskInfoService
 {
     public class RgvOperationService : ServiceBase<Dt_Task_hty, ITask_HtyRepository>, IRgvOperationService
     {
         private readonly IAgvStationService _gvStationService;
-        public RgvOperationService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService) : base(BaseDal)
+        private readonly ITaskRepository _taskRepository;
+        public RgvOperationService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService, ITaskRepository taskRepository) : base(BaseDal)
         {
             _gvStationService = agvStationService;
+            _taskRepository = taskRepository;
         }
 
 
@@ -164,7 +167,7 @@
         }
 
         /// <summary>
-        /// 鍐欏叆澶嶄綅锛堝叆搴撶锛�
+        /// 涓�閿惎鍔ㄥ叆搴撳瓙姣嶈溅
         /// </summary>
         public WebResponseContent WriteInReset(SaveModel saveModel)
         {
@@ -173,7 +176,7 @@
             List<AGVStation> rgvdata = _gvStationService.GetInStroller();
             foreach (AGVStation rgvstation in rgvdata)
             {
-                string DeviceName = saveModel.DelKeys[0].ToString();    //璁惧鍚嶇О
+                string DeviceName = rgvstation.ChildPosiDeviceCode;    //璁惧鍚嶇О
                 IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
                 if (device == null) continue;
                 SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
@@ -201,7 +204,7 @@
 
                 //鑾峰彇闇�瑕佸浣嶇殑璁惧
                 DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Resetoperation", "DeviceCommand");        //澶嶄綅鎶ヨ淇℃伅
-                RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
+                RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
             }
             return webResponse.OK();
         }
@@ -223,7 +226,25 @@
                 SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
 
                 //鑾峰彇闇�瑕佸浣嶇殑璁惧
-                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        //澶嶄綅鎶ヨ淇℃伅
+                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        
+                RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
+            }
+            return webResponse.OK();
+        }
+
+        public WebResponseContent InWriteOutbuttonpause(SaveModel saveModel)
+        {
+            WebResponseContent webResponse = new WebResponseContent();
+            List<AGVStation> rgvdata = _gvStationService.InGetOutStroller();
+            foreach (AGVStation rgvstation in rgvdata)
+            {
+                string DeviceName = rgvstation.ChildPosiDeviceCode;    //璁惧鍚嶇О
+                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName);
+                if (device == null) continue;
+                SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
+
+                //鑾峰彇闇�瑕佸浣嶇殑璁惧
+                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");
                 RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)0);
             }
             return webResponse.OK();
@@ -246,7 +267,7 @@
                 SpeStackerCrane Commonstacker = (SpeStackerCrane)device;
 
                 //鑾峰彇闇�瑕佸浣嶇殑璁惧
-                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        //澶嶄綅鎶ヨ淇℃伅
+                DeviceProDTO? RGV_Resetoperation = GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_DWorkingmode", "DeviceCommand");        
                 RgvSetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress, (short)1);
             }
             return webResponse.OK();
@@ -285,6 +306,69 @@
         public static bool RgvSetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock, short rgvvalues)
         {
             return Commonstacker.Communicator.Write<short>(DeviceProDataBlock, rgvvalues);
+        }
+
+        /// <summary>
+        /// 姝e父鍏ュ簱
+        /// </summary>
+        public WebResponseContent WriteInNormal(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
+            if (dt_Task == null)
+            {
+               return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+            }
+            dt_Task.TaskState = (int)TaskInStatusEnum.RGV_InPickupFinish;
+            dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+            dt_Task.NextAddress = "1021";
+            _taskRepository.UpdateData(dt_Task);
+            return content;
+        }
+        /// <summary>
+        /// 鍏ュ簱寮傚父鎺掑嚭
+        /// </summary>
+        public WebResponseContent WriteInAbnormal(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskInStatusEnum.InAbnormalFinish);
+            if (dt_Task == null)
+            {
+                return WebResponseContent.Instance.Error("娌℃湁寮傚父鍏ュ簱浠诲姟");
+            }
+            dt_Task.TaskState = (int)TaskInStatusEnum.InexceptionalSelection;
+            dt_Task.RGVTaskType = (int)RGVTaskTypeEnum.Placing;
+            _taskRepository.UpdateData(dt_Task);
+            return content;
+        }
+
+
+
+        public static List<string> OutStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+        public static List<string> InStationareaList = new List<string>() { "RGV111", "RGV116", "RGV110", "RGV112", "RGV114", "RGV115", "RGV118" };
+        /// <summary>
+        /// 鏌ョ湅鎶ヨ
+        /// </summary>
+        public bool AQMReadAlarminform(int tasktype)
+        {
+            var deviceList = tasktype == 1 ? InStationareaList : OutStationareaList;
+
+            foreach (string deviceName in deviceList)
+            {
+                IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceName);
+                if (device == null) return false;
+
+                SpeStackerCrane stacker = (SpeStackerCrane)device;
+                DeviceProDTO? faultInfo = GetRGVDeviceProDTO(stacker, deviceName, "RGV_Faultcode", "ReadDeviceCommand");
+                int alarmCode = GetLine(stacker, faultInfo.DeviceProAddress);
+
+                if (alarmCode != 0)
+                {
+                    return true;
+                }
+            }
+
+            return false;
         }
 
 
@@ -354,7 +438,7 @@
         {28, "鏀捐揣鏃惰嚜韬棤璐х墿鎶ヨ"},
         {29, "璐у弶鏈洖鍒板垵濮嬩綅鎶ヨ"},
         {30, "瑙﹀彂浠呯Щ鍔ㄥ懡浠ゆ椂璐у弶涓嶅湪鍒濆浣嶆姤璀�"},
-        {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
+                {31, "璐у弶鍒拌揪鍒濆浣嶄絾涓綅浼犳劅鍣ㄦ湭妫�娴嬪埌鎶ヨ"}
             };
 
             return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "鏈煡鎶ヨ浠g爜";

--
Gitblit v1.9.3