From 0b4792ff8245f9eac16e6d02452eb9a091f6f72b Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期二, 28 十月 2025 19:42:04 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |  171 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 118 insertions(+), 53 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
index bd5e5f3..c1a5208 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs"
@@ -30,14 +30,18 @@
         private readonly IRouterService _routerService;
         private readonly IAgvStationService _agvStationService;
         private readonly IMapper _mapper;
+        private readonly IRgvOperationService _gvOperationService;
+        private readonly IEquipmentStatusService _equipmentStatusService;
 
-        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IAgvStationService agvStation, IMapper mapper)
+        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IAgvStationService agvStation, IMapper mapper, IRgvOperationService gvOperationService, IEquipmentStatusService equipmentStatusService)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _routerService = routerService;
             _agvStationService = agvStation;
             _mapper = mapper;
+            _gvOperationService = gvOperationService;
+            _equipmentStatusService=equipmentStatusService;
         }
 
         public async Task Execute(IJobExecutionContext context)
@@ -48,55 +52,105 @@
                 if (conveyorLine != null)
                 {
                     //鏍规嵁璁惧鏌ユ壘鍑哄搴旂殑绔欏彴淇℃伅
-                    /*List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode);
+                    List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode);
                     foreach (var Stations in aGVStations)
                     {
-                        PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
-                        if(aQMConveyor.HCJ_GoodsStatus==0)    //鍙繘琛屾斁璐�
+                        /*if (Stations.Station_material == (int)RGVEquipment.AQMexit)
                         {
-                            WebResponseContent webResponseContent = new WebResponseContent();
-                            //鏍规嵁绫诲瀷鏌ユ壘浠诲姟
-                            if (Stations.Station_material== (int)RGVEquipment.AbnormalOutbound)
+                            //鑾峰彇鍒板畨鍏ㄩ棬淇℃伅
+                            AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
+                            if(Stations.Station_tasktype== (int)RGVTasktype.Outbound)
                             {
-                                //鏌ユ壘鏄惁鏈夊紓甯告惉杩愪换鍔�
-                                webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 1);   //杩橀渶瑕佷紶鍏ュ湴鍧�
+                                //璇诲彇鍫嗗灈鏈轰笌RGV鏄惁鍦ㄦ姤璀︼紝濡傛灉鍦ㄦ姤璀︼紝鍒欏啓鍏ュ畨鍏ㄩ棬鎶ヨ
+                                if (_gvOperationService.AQMReadAlarminform(2) && _equipmentStatusService.GetSCstatus())
+                                {
+                                    //鍐欏叆鎶ヨ
+                                    GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1);
+                                }
+
+
+                                //瀹夊叏闂ㄦ�ュ仠鐘舵��
+                                if (aQMConveyor.EmergencyStopStatus == 0)
+                                {
+                                    //绔嬮┈鍋滄鍏ㄩ儴RGV(寰楀垽鏂璕GV鐘舵��,娌″仠姝㈢殑鍒欏仠姝�)
+                                    _gvOperationService.WriteOutbuttonpause(null);
+
+                                }
+
+                                //瀹夊叏闂ㄨ繘琛岃姹�
+                                if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus== (int)SafetyDoorStatus.YellowBlink2Hz)
+                                {
+                                    //璇诲彇鍒拌姹傚悗锛屾牴鎹姸鎬佹寚绀虹伅杩涜鎿嶄綔
+                                    if (aQMConveyor.EmergencyStopStatus == 1 && aQMConveyor.EmergencyStopStatus == 0)   //鏈�ュ仠锛岄渶瑕佺敵璇疯繘鍏ヨ澶�
+                                    {
+                                        //鐩存帴鍋滄RGV鍔ㄤ綔
+                                        _gvOperationService.WriteOutbuttonpause(null);
+
+                                        //璇诲彇瀛愭瘝杞︽槸鍚﹂兘鍦ㄧ┖闂茬姸鎬�
+                                        if (GetDeviceAddress.OutRGVStatice())   //璇诲彇瀛愭瘝杞︾姸鎬�
+                                        {
+                                            //鍐欏叆寮�闂ㄤ俊鍙�
+                                            GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 1);
+                                        }
+                                    }
+                                }
                             }
                             else
                             {
-                                //鍑哄簱绔欏彴鐨勪换鍔�
-                                webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 2);
+                                if (_gvOperationService.AQMReadAlarminform(1) && _equipmentStatusService.GetSCstatus())
+                                {
+                                    //鍐欏叆鎶ヨ
+                                    GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1);
+                                }
+
+
+                                //瀹夊叏闂ㄦ�ュ仠鐘舵��
+                                if (aQMConveyor.EmergencyStopStatus == 0)
+                                {
+                                    //绔嬮┈鍋滄鍏ㄩ儴RGV(寰楀垽鏂璕GV鐘舵��,娌″仠姝㈢殑鍒欏仠姝�)
+                                    _gvOperationService.InWriteOutbuttonpause(null);
+
+                                }
+
+                                //瀹夊叏闂ㄨ繘琛岃姹�
+                                if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus == (int)SafetyDoorStatus.YellowBlink2Hz)
+                                {
+                                    //璇诲彇鍒拌姹傚悗锛屾牴鎹姸鎬佹寚绀虹伅杩涜鎿嶄綔
+                                    if (aQMConveyor.EmergencyStopStatus == 1 && aQMConveyor.EmergencyStopStatus == 0)   //鏈�ュ仠锛岄渶瑕佺敵璇疯繘鍏ヨ澶�
+                                    {
+                                        //鐩存帴鍋滄RGV鍔ㄤ綔
+                                        _gvOperationService.InWriteOutbuttonpause(null);
+
+                                        //璇诲彇瀛愭瘝杞︽槸鍚﹂兘鍦ㄧ┖闂茬姸鎬�
+                                        if (GetDeviceAddress.OutRGVStatice())   //璇诲彇瀛愭瘝杞︾姸鎬�
+                                        {
+                                            //鍐欏叆寮�闂ㄤ俊鍙�
+                                            GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 1);
+                                        }
+                                    }
+                                }
                             }
-
-
-                        }
-                    }*/
-
-
-
-                    /*
-                    //瀹夊叏闂ㄥ紑闂ㄧ敵璇�+瀹夊叏闂ㄧ姸鎬�  1
-                    if(aQMConveyor.DoorRequest==1)
-                    {
-                        if(aQMConveyor.ResetStatus == 1)
+                        }*/
+                        /*else
                         {
-                            //鍐欏叆杈撻�佺嚎杩涜鍒囨崲淇″彿
-                            var deviceProDtqh = GetDeviceProDTO(conveyorLine, "AQM001", "IndicatorStatus", "DeviceCommand");
-                            bool handoffbool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)3);
-                            if (handoffbool)
+                            PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
+                            if (aQMConveyor.HCJ_GoodsStatus == 0)    //鍙繘琛屾斁璐�
                             {
-                                //闇�瑕佸垽鏂璻gv锛屽爢鍨涙満鏄惁鍏佽寮�闂�
-
-                                //濡傛灉鍏佽寮�闂紝鍒欏啓鍏�4锛岃〃绀哄垏鎹㈡垚鍔燂紝
-                                bool Maintenancebool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)4);
+                                WebResponseContent webResponseContent = new WebResponseContent();
+                                //鏍规嵁绫诲瀷鏌ユ壘浠诲姟
+                                if (Stations.Station_material == (int)RGVEquipment.AbnormalOutbound)
+                                {
+                                    //鏌ユ壘鏄惁鏈夊紓甯告惉杩愪换鍔�
+                                    webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 1);   //杩橀渶瑕佷紶鍏ュ湴鍧�
+                                }
+                                else
+                                {
+                                    //鍑哄簱绔欏彴鐨勪换鍔�
+                                    webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 2);
+                                }
                             }
-                        }
+                        }*/
                     }
-                    else
-                    {
-                        //璇诲彇DBW8=1,DBW6=1,DBW10=1,DBW4=1,绗﹀悎鍚庯紝杩涜鍐欏叆鍒囨崲鐘舵�丏BW0=3
-                        AQMReturnnormal aQMReturnnormal=AQMStoticCommand(conveyorLine, "AQM001");   //鍒ゆ柇
-
-                    }*/
                 }
             }
             catch (Exception ex)
@@ -132,29 +186,40 @@
             return conveyorRgvCommand;
         }
 
+        /// <summary>
+        /// 瀹夊叏闂ㄤ俊鍙�
+        /// </summary>
         public AQMReturnnormal AQMStoticCommand(CommonConveyorLine conveyorLine, string kladder)
         {
-            AQMReturnnormal conveyorRgvCommand = new AQMReturnnormal();
-            List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
-                .Where(x => x.DeviceChildCode == kladder
-                            && DBLine.ConveyorAQMReturnnormal.Contains(x.DeviceProParamName)
-                            && x.DeviceProParamType == "ReadDeviceCommand")
-                .ToList();
-            foreach (var item in deviceProDTO6)
+            try
             {
-                var paramName = item.DeviceProParamName;
-                var propertyInfo = typeof(AQMReturnnormal).GetProperty(paramName);
-
-                if (propertyInfo != null)
+                AQMReturnnormal conveyorRgvCommand = new AQMReturnnormal();
+                List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
+                    .Where(x => x.DeviceChildCode == kladder
+                                //&& DBLine.ConveyorAQMReturnnormal.Contains(x.DeviceProParamName)
+                                && x.DeviceProParamType == "ReadDeviceCommand")
+                    .ToList();
+                foreach (var item in deviceProDTO6)
                 {
-                    if (item.DeviceDataType == "int")
+                    var paramName = item.DeviceProParamName;
+                    var propertyInfo = typeof(AQMReturnnormal).GetProperty(paramName);
+
+                    if (propertyInfo != null)
                     {
-                        var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
-                        propertyInfo.SetValue(conveyorRgvCommand, value);
+                        if (item.DeviceDataType == "short")
+                        {
+                            var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
+                            propertyInfo.SetValue(conveyorRgvCommand, value);
+                        }
                     }
                 }
+                return conveyorRgvCommand;
             }
-            return conveyorRgvCommand;
+            catch (Exception ex)
+            {
+                return null;
+                throw;
+            }
         }
 
         public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string PLCmanipula, string DeviceProParamName, string DeviceProParamType)

--
Gitblit v1.9.3