huanghongfeng
7 天以前 8c8a68df710d568f5f2b358c1e8c4b4799547d0b
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -1,24 +1,16 @@
using Autofac.Core;
using AutoMapper;
using 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(得判断RGV状态,没停止的则停止)
                                    _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(得判断RGV状态,没停止的则停止)
                                    _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);