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_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs |  229 ++++++++++++++++++++++++++++-----------------------------
 1 files changed, 112 insertions(+), 117 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 c1a5208..b705d00 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"
@@ -1,24 +1,16 @@
-锘縰sing Autofac.Core;
-using AutoMapper;
+锘縰sing AutoMapper;
 using Quartz;
-using System.Diagnostics.CodeAnalysis;
-using System.Reflection;
-using System.Threading.Tasks;
 using WIDESEA_Common.Log;
-using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.Enum;
 using WIDESEAWCS_ISystemServices;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
-using WIDESEAWCS_Model.Models.System;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 using WIDESEAWCS_Tasks.StackerCraneJob;
-using static System.Collections.Specialized.BitVector32;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -51,105 +43,25 @@
                 CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams");
                 if (conveyorLine != null)
                 {
+                    
+
                     //鏍规嵁璁惧鏌ユ壘鍑哄搴旂殑绔欏彴淇℃伅
                     List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode);
                     foreach (var Stations in aGVStations)
                     {
-                        /*if (Stations.Station_material == (int)RGVEquipment.AQMexit)
+                        if (Stations.Station_material == (int)RGVEquipment.AQMexit)
                         {
-                            //鑾峰彇鍒板畨鍏ㄩ棬淇℃伅
-                            AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
-                            if(Stations.Station_tasktype== (int)RGVTasktype.Outbound)
-                            {
-                                //璇诲彇鍫嗗灈鏈轰笌RGV鏄惁鍦ㄦ姤璀︼紝濡傛灉鍦ㄦ姤璀︼紝鍒欏啓鍏ュ畨鍏ㄩ棬鎶ヨ
-                                if (_gvOperationService.AQMReadAlarminform(2) && _equipmentStatusService.GetSCstatus())
-                                {
-                                    //鍐欏叆鎶ヨ
-                                    GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1);
-                                }
 
+                            bool Security = SecurityDoorEquipment(conveyorLine, Stations);
+                            if (Security) continue;
 
-                                //瀹夊叏闂ㄦ�ュ仠鐘舵��
-                                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
-                            {
-                                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);
-                                        }
-                                    }
-                                }
-                            }
-                        }*/
-                        /*else
+                        }
+                        else
                         {
-                            PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
-                            if (aQMConveyor.HCJ_GoodsStatus == 0)    //鍙繘琛屾斁璐�
-                            {
-                                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);
-                                }
-                            }
-                        }*/
+                            bool HCJPlat=PlatformEquipmentInformation(conveyorLine, Stations);
+                            if (HCJPlat) continue;
+                        }
+                        
                     }
                 }
             }
@@ -160,30 +72,111 @@
             return;
         }
 
-
-        public AQMConveyorRgvommand AQMCommand(CommonConveyorLine conveyorLine, string kladder)
+       
+        //澶勭悊瀹夊叏闂ㄧ殑閫昏緫
+        private void HandleDoorRequest(AQMReturnnormal aQMConveyor, AGVStation aGVStation,int tasktype)  //1锛氬叆搴�  2锛氬嚭搴�
         {
-            AQMConveyorRgvommand conveyorRgvCommand = new AQMConveyorRgvommand();
-            List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
-                .Where(x => x.DeviceChildCode == kladder
-                            && DBLine.ConveyorAQMCommand.Contains(x.DeviceProParamName)
-                            && x.DeviceProParamType == "ReadDeviceCommand")
-                .ToList();
-            foreach (var item in deviceProDTO6)
+            if (_gvOperationService.AQMReadAlarminform(tasktype) && _equipmentStatusService.GetSCstatus())
             {
-                var paramName = item.DeviceProParamName;
-                var propertyInfo = typeof(AQMConveyorRgvommand).GetProperty(paramName);
+                //鍐欏叆鎶ヨ
+                GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "AlarmSummary", 1);
+                _gvOperationService.WriteOutbuttonpause(null);
+            }
 
-                if (propertyInfo != null)
+            if (aQMConveyor.DoorRequest == 1 && aQMConveyor.IndicatorStatus == (int)SafetyDoorStatus.YellowBlink2Hz)
+            {
+                if (aQMConveyor.EmergencyStopStatus == 1)
                 {
-                    if (item.DeviceDataType == "int")
+                    bool AQMzckm = tasktype == 1 ? GetDeviceAddress.InRGVRGVStepprocess() : GetDeviceAddress.OutRGVRGVStepprocess();    //鍒ゆ柇鏄惁鏈夎繘绋嬩换鍔�
+                    if (AQMzckm)
                     {
-                        var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
-                        propertyInfo.SetValue(conveyorRgvCommand, value);
+                        //鍐欏叆鍋滄鐨勪俊鎭�
+                        bool RGVRGV_DWorkingmode = tasktype == 1 ? _gvOperationService.InWriteOutbuttonpause(null).Status : _gvOperationService.WriteOutbuttonpause(null).Status;
+
+                        bool RGVstate = tasktype == 1 ? GetDeviceAddress.InRGVStatice() : GetDeviceAddress.OutRGVStatice();     //鍒ゆ柇鏄惁鍏ㄤ负鎵嬪姩
+                        if (RGVstate)
+                        {
+                            //鍐欏叆寮�闂ㄤ俊鍙�
+                            GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
+                        }
                     }
+
+                }
+                else
+                {
+                    bool AQMkm = tasktype == 1 ? GetDeviceAddress.InRGVStatice() : GetDeviceAddress.OutRGVStatice();
+                    if (AQMkm)
+                    {
+                        GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
+                    }
+                    
                 }
             }
-            return conveyorRgvCommand;
+        }
+
+        //瀹夊叏闂ㄨ澶囦俊鎭鐞�
+        private bool SecurityDoorEquipment(CommonConveyorLine conveyorLine, AGVStation Stations)
+        {
+            try
+            {
+                // 鑾峰彇瀹夊叏闂ㄤ俊鎭�
+                AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
+
+                if (aQMConveyor.SafetyLockStatus == 1)
+                {
+                    //鍐欏叆鎶ヨ
+                    GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 0);
+                    //鍐欏叆寮�闂ㄤ俊鍙�
+                    GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "OpenDoor", 0);
+                }
+
+                // 鏍规嵁浠诲姟绫诲瀷閫夋嫨澶勭悊绛栫暐
+                if (Stations.Station_tasktype == (int)RGVTasktype.Outbound)
+                {
+                    if (aQMConveyor.EmergencyStopStatus == 0) _gvOperationService.WriteOutbuttonpause(null);
+                    HandleDoorRequest(aQMConveyor, Stations, 2);
+                }
+                else
+                {
+                    if (aQMConveyor.EmergencyStopStatus == 0) _gvOperationService.InWriteOutbuttonpause(null);
+                    HandleDoorRequest(aQMConveyor, Stations, 1);
+                }
+                return false;
+            }
+            catch (Exception ex)
+            {
+                return true;
+                throw;
+            }
+        }
+
+        private bool PlatformEquipmentInformation(CommonConveyorLine conveyorLine, AGVStation Stations)
+        {
+            try
+            {
+                PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode);
+                if (aQMConveyor.HCJ_GoodsStatus == 0)    //鍙繘琛屾斁璐�
+                {
+                    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);
+                    }
+                }
+                return false;
+            }
+            catch (Exception ex)
+            {
+                return true;
+                throw;
+            }
         }
 
         /// <summary>
@@ -227,11 +220,13 @@
             return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == PLCmanipula && x.DeviceProParamName == DeviceProParamName && x.DeviceProParamType == DeviceProParamType);
         }
 
+        //绔欏彴淇″彿
         public PlatformStatus StoticCommand(CommonConveyorLine conveyorLine, string kladder)
         {
             PlatformStatus conveyorRgvCommand = new PlatformStatus();
             List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs
                 .Where(x => x.DeviceChildCode == kladder
+                            && x.DeviceProParamName== "HCJ_GoodsStatus"
                             && x.DeviceProParamType == "ReadDeviceCommand")
                 .ToList();
             foreach (var item in deviceProDTO6)
@@ -241,7 +236,7 @@
 
                 if (propertyInfo != null)
                 {
-                    if (item.DeviceDataType == "int")
+                    if (item.DeviceDataType == "short")
                     {
                         var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress);
                         propertyInfo.SetValue(conveyorRgvCommand, value);

--
Gitblit v1.9.3