1
HuBingJie
8 天以前 5da3a276b7847187a7c155ee069d3cd4c9e58074
´úÂë¹ÜÀí/WCS/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -1,5 +1,6 @@
using AutoMapper;
using Quartz;
using System.Net;
using WIDESEA_Common.Log;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.Enum;
@@ -103,8 +104,8 @@
                        WebResponseContent webResponse = _taskService.StkRunStatus();
                        if (RGVstate && webResponse.Status == true)
                        {
                            //写入开门信号
                            GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
                                //写入开门信号
                                GetDeviceAddress.WriteSecurityDoorpolice(aGVStation.ChildPosiDeviceCode, "OpenDoor", 1);
                        }
                    }
@@ -233,18 +234,61 @@
        }
        //站台信号
        public bool StoticCommand(CommonConveyorLine conveyorLine, string kladder)
     /*   public bool StoticCommand(CommonConveyorLine conveyorLine, string kladder)
        {
            DeviceProDTO? deviceProDTO6 = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == kladder
                            && x.DeviceProParamName == "HCJ_GoodsStatus"
                            && x.DeviceProParamType == "ReadDeviceCommand");
            if(deviceProDTO6 == null) { return false; }
            if (deviceProDTO6.DeviceChildCode == "2016"||deviceProDTO6.DeviceChildCode == "2017"|| deviceProDTO6.DeviceChildCode == "2018"|| deviceProDTO6.DeviceChildCode == "2019"
                || deviceProDTO6.DeviceChildCode == "1001"|| deviceProDTO6.DeviceChildCode == "1002")
            {
                var value1 = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
                //延时5秒
                System.Threading.Thread.Sleep(5000);
                var value2 = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
                if (value1 != value2 && (value1 !=0 && value2 !=0)) { return false; };
                return true;
            }
            var value = conveyorLine.Communicator.Read<short>(deviceProDTO6.DeviceProAddress);
            if (value == 0) {  return true; }
            return false;
        }*/
        //站台信号
        public bool StoticCommand(CommonConveyorLine conveyorLine, string kladder)
        {
            DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == kladder
                            && x.DeviceProParamName == "HCJ_GoodsStatus"
                            && x.DeviceProParamType == "ReadDeviceCommand");
            // è¿™äº›ç«™å°éœ€è¦â€œå»¶æ—¶5秒并比较第一次与最后一次结果”
            bool isPlatformCode =
                kladder == "2016" || kladder == "2017" || kladder == "2018" || kladder == "2019" ||
                kladder == "1001" || kladder == "1002";
            if (isPlatformCode)
            {
                // ç¬¬ä¸€æ¬¡è¯»å–
                short first = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                // å»¶æ—¶5秒
                System.Threading.Thread.Sleep(5000);
                // æœ€åŽä¸€æ¬¡è¯»å–
                short last = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                // åè®®ï¼š0=无信号=无货=空位
                return first == 0 && last == 0;
            }
            else
            {
                short value = conveyorLine.Communicator.Read<short>(deviceProDTO.DeviceProAddress);
                return value == 0; // 0=空位可放;1=有货不可放
            }
        }
    }
}