| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Quartz.Util; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.Http; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEA_Common.Log; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | | public class RgvoperainformService : ServiceBase<Dt_Task_hty, ITask_HtyRepository>, IRgvoperainformService |
| | | { |
| | | private readonly IAgvStationService _gvStationService; |
| | | private readonly IAgvStationService _agvStationService; |
| | | private readonly IServiceProvider _serviceProvider; |
| | | private static bool _isMonitoring = false; |
| | | private readonly IRepository<DeviceAlarmLog> _deviceAlarmLog; |
| | |
| | | private CancellationTokenSource _safetyDoorCancellationTokenSource; |
| | | public RgvoperainformService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService, IServiceProvider serviceProvider, IRepository<DeviceAlarmLog> deviceAlarmLog) : base(BaseDal) |
| | | { |
| | | _gvStationService = agvStationService; |
| | | _agvStationService = agvStationService; |
| | | _serviceProvider = serviceProvider; |
| | | _deviceAlarmLog = deviceAlarmLog; |
| | | } |
| | |
| | | //RgvOperationService.RgvSetLine(Commonstacker, RGV_Resetoperationxj3.DeviceProAddress, 0); |
| | | return webResponse.OK(); |
| | | case "dz": //å°å |
| | | |
| | | if (!YiDongPD(Commonstacker, parameter)) { return webResponse.Error("ç®æ å°å被å ç¨ææ¡ä»¶ä¸æ»¡è¶³ï¼ç¦æ¢ç§»å¨"); } |
| | | DeviceProParamName = "RGV_RGVTasklocationt"; |
| | | DeviceProParamType = "DeviceCommand"; |
| | | zhi = parameter; |
| | |
| | | return webResponse.Error("è®¾å¤æä½å¤±è´¥"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 1ã夿å车åºå |
| | | /// 2ã夿å车å½åä½ç½® |
| | | /// 3ã夿å车è¦å»çä½ç½® |
| | | /// 4ãæ ¹æ®å车è¦å»ç为è·åæ¯è½¦ä½ç½® |
| | | /// |
| | | /// </summary> |
| | | /// <param name="device">è¦ç§»å¨ç设å¤</param> |
| | | /// <param name="parameter">è¦å»çç®æ å°å</param> |
| | | /// <returns></returns> |
| | | |
| | | private bool YiDongPD(SpeStackerCrane Commonstacker, int parameter) |
| | | { |
| | | |
| | | //å
¥åºè®¾å¤ |
| | | List<string> InDevices = new List<string> { "RGV104", "RGV107" }; |
| | | //åºåºè®¾å¤ |
| | | List<string> OutDevices = new List<string> {"RGV116", "RGV111"}; |
| | | |
| | | Dictionary<int, string> HCJ = new Dictionary<int, string> |
| | | { |
| | | { 1061, "HCJ106" }, |
| | | { 1021, "HCJ102" }, |
| | | { 1131, "HCJ113" }, |
| | | { 1171, "HCJ117" }, |
| | | }; |
| | | |
| | | AGVStation RGVTaskdevice = _agvStationService.Corridorequipment(Commonstacker.DeviceCode); //æ ¹æ®è®¾å¤è·åå°å
容 |
| | | |
| | | //æ ¹æ®å车è·åå°æ¯è½¦è®¾å¤ |
| | | // æ ¹æ®å车è·åå°æ¯è½¦è®¾å¤ |
| | | AGVStation Mu1 = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCarDeviceCode); |
| | | AGVStation Mu2 = _agvStationService.GetMothervehicle(RGVTaskdevice.MotherCardeputy); |
| | | |
| | | // è·åå车ä½ç½® |
| | | int zhicheWZ = GetzicheWZ(Commonstacker, Commonstacker.DeviceCode); |
| | | |
| | | // ç»ä¸ç®æ å ç¨æ£æ¥ï¼æ«æå
¶å® RGV æ¯å¦å¨åä¸ç®æ å°åï¼ |
| | | bool IsAddressOccupied(int addr) |
| | | { |
| | | var allCodes = InDevices.Concat(OutDevices).Where(code => code != Commonstacker.DeviceCode).ToList(); |
| | | foreach (var code in allCodes) |
| | | { |
| | | var dev = Storage.Devices.FirstOrDefault(x => x.DeviceCode == code) as SpeStackerCrane; |
| | | if (dev == null) continue; |
| | | try |
| | | { |
| | | DeviceProDTO? locDto = RgvOperationService.GetRGVDeviceProDTO(dev, code, "RGVCurrentlocation", "RGVCurrentlocation"); |
| | | if (locDto == null) continue; |
| | | int loc = RgvOperationService.GetLine(dev, locDto.DeviceProAddress); |
| | | if (loc == addr) return true; // ç®æ 被å ç¨ |
| | | } |
| | | catch |
| | | { |
| | | // 读åå¼å¸¸ä¸å½ä½å ç¨ï¼é¿å
误æ |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // ç®æ 被å
¶ä» RGV å ç¨åç¦æ¢ |
| | | if (IsAddressOccupied(parameter)) return false; |
| | | |
| | | if (RGVTaskdevice.Station_Area == 6) // å¤ä¾§ |
| | | { |
| | | if (zhicheWZ == RGVTaskdevice.WaitmomentOne) // çå¾
ç¹1 |
| | | { |
| | | // 夿å¤ä¾§å°è½¦æ¯å¦å¨ HCJ ä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | //å¤æä¼ è¿æ¥è®¾å¤æ¯å¦æ¯å
¥åº |
| | | if (InDevices.Contains(Commonstacker.DeviceCode)) |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1171) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (parameter == Mu1.ZicheMotherinlaw) //æ¯1 |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.ZicheMotherinlaw && mu1 != Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == Mu2.ZicheMotherinlaw) // æ¯2 |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.ZicheMotherinlaw && mu2 != Mu2.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == RGVTaskdevice.HCJStorageaddress) |
| | | { |
| | | string hcj = HCJ[RGVTaskdevice.HCJStorageaddress]; |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu2.ChildPosiDeviceCode) && Mucheywhaddres(hcj))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu2 != Mu2.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && !IsAddressOccupied(Mu2.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | }else if(parameter == 1021 || parameter == 1171) |
| | | { |
| | | if (RGVTaskdevice.ChildPosiDeviceCode == "RGV116" && Mucheywhaddres("HCJ102")) |
| | | { |
| | | return true; |
| | | } |
| | | string hcj = HCJ[parameter]; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(hcj))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 != Mu1.ZicheMotherinlaw && mu1 == Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && mu2 != Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | } |
| | | else if (zhicheWZ == RGVTaskdevice.WaitmomentTwo) // çå¾
ç¹2 |
| | | { |
| | | // 夿å¤ä¾§å°è½¦æ¯å¦å¨ HCJ ä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | //å¤æä¼ è¿æ¥è®¾å¤æ¯å¦æ¯å
¥åº |
| | | if (InDevices.Contains(Commonstacker.DeviceCode)) |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1171) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (parameter == Mu1.ZicheMotherinlaw) |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.ZicheMotherinlaw && mu1 != Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == Mu2.ZicheMotherinlaw) |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == RGVTaskdevice.HCJStorageaddress) |
| | | { |
| | | string hcj = HCJ[RGVTaskdevice.HCJStorageaddress]; |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu2.ChildPosiDeviceCode) && Mucheywhaddres(hcj))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu2 != Mu2.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && !IsAddressOccupied(Mu2.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == 1021 || parameter == 1171) |
| | | { |
| | | string hcj = HCJ[parameter]; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode) && Mucheywhaddres(hcj))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 != Mu1.ZicheMotherinlaw && mu1 == Mu1.Motherinlaw && mu2 != Mu2.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && mu2 != Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else if (RGVTaskdevice.Station_Area == 5) // å
ä¾§ |
| | | { |
| | | if (zhicheWZ == RGVTaskdevice.WaitmomentOne) // çå¾
ç¹1 |
| | | { |
| | | // 夿å¤ä¾§å°è½¦æ¯å¦å¨ HCJ ä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | //å¤æä¼ è¿æ¥è®¾å¤æ¯å¦æ¯å
¥åº |
| | | if (InDevices.Contains(Commonstacker.DeviceCode)) |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1171) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (parameter == Mu1.ZicheMotherinlaw) //æ¯1 |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.ZicheMotherinlaw && mu1 != Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == Mu2.ZicheMotherinlaw) // æ¯2 |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | }else if (parameter == RGVTaskdevice.HCJStorageaddress) |
| | | { |
| | | string hcj = HCJ[RGVTaskdevice.HCJStorageaddress]; |
| | | if (Mucheywhaddres(hcj)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && mu2 != Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | } |
| | | else if (zhicheWZ == RGVTaskdevice.WaitmomentTwo) // çå¾
ç¹2 |
| | | { |
| | | // 夿å¤ä¾§å°è½¦æ¯å¦å¨ HCJ ä¸ |
| | | var zichestation = _agvStationService.OutGetZicheDeepHCJ(RGVTaskdevice.HCJStorageaddress); |
| | | int waiziche = GetEquipmentlocation(zichestation.ChildPosiDeviceCode); |
| | | |
| | | //å¤æä¼ è¿æ¥è®¾å¤æ¯å¦æ¯å
¥åº |
| | | if (InDevices.Contains(Commonstacker.DeviceCode)) |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1021) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!((waiziche == zichestation.WaitmomentOne || waiziche == zichestation.WaitmomentTwo || waiziche == zichestation.MotherCardeputy || waiziche == zichestation.MotherCarDeviceCode || waiziche == 1171) && waiziche != zichestation.HCJStorageaddress)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (parameter == Mu1.ZicheMotherinlaw) |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.ZicheMotherinlaw && mu1 != Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == Mu2.ZicheMotherinlaw) |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else if (parameter == RGVTaskdevice.HCJStorageaddress) |
| | | { |
| | | string hcj = HCJ[RGVTaskdevice.HCJStorageaddress]; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode)&&Mucheywhaddres(hcj))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 != Mu1.ZicheMotherinlaw && mu1 == Mu1.Motherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | int taraddress = parameter; |
| | | int mu1 = GetEquipmentlocation(Mu1.ChildPosiDeviceCode); |
| | | int mu2 = GetEquipmentlocation(Mu2.ChildPosiDeviceCode); |
| | | |
| | | if (Mucheywhaddres(Mu1.ChildPosiDeviceCode) && Mucheywhaddres(Mu2.ChildPosiDeviceCode))//夿æ¯å¦æè´§ |
| | | { |
| | | if (mu1 == Mu1.Motherinlaw && mu1 != Mu1.ZicheMotherinlaw && mu2 == Mu2.Motherinlaw && mu2 != Mu2.ZicheMotherinlaw && !IsAddressOccupied(Mu1.ZicheMotherinlaw)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // é»è®¤ï¼æªè¢«æ¦æªä¸ç®æ æªå ç¨ -> æ¾è¡ |
| | | return true; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¼ å
¥è®¾å¤ï¼è¿åå½å设å¤ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="ChildPosiDeviceCode">设å¤</param> |
| | | /// <returns></returns> |
| | | public static int GetEquipmentInformation(string ChildPosiDeviceCode) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode); |
| | | SpeStackerCrane speStackerCrane = (SpeStackerCrane)device; |
| | | if (speStackerCrane == null) |
| | | { |
| | | Console.WriteLine($"读åå°è®¾å¤ä¸ºç©º,设å¤ç¼å·ï¼{ChildPosiDeviceCode},003"); |
| | | return 0; |
| | | } |
| | | DeviceProDTO? deviceProDTOGZMS = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RgvCraneAutoStatus" && x.DeviceProParamType == "RgvCraneAutoStatus"); |
| | | int GZMS = RGVGetLine(speStackerCrane, deviceProDTOGZMS.DeviceProAddress); |
| | | |
| | | DeviceProDTO? deviceProDTORWZT = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RGV_Rgvtaskstutas" && x.DeviceProParamType == "RGV_Rgvtaskstutas"); |
| | | int RWZT = RGVGetLine(speStackerCrane, deviceProDTORWZT.DeviceProAddress); |
| | | |
| | | DeviceProDTO? deviceProDTOBJGC = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RGVStepprocess" && x.DeviceProParamType == "RGVStepprocess"); |
| | | int BJGC = RGVGetLine(speStackerCrane, deviceProDTOBJGC.DeviceProAddress); |
| | | |
| | | DeviceProDTO? deviceProDTOWZ = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RGVCurrentlocation" && x.DeviceProParamType == "RGVCurrentlocation"); |
| | | int WZ = RGVGetLine(speStackerCrane, deviceProDTOWZ.DeviceProAddress); |
| | | |
| | | |
| | | if (GZMS == 1 && RWZT == 0 && BJGC == 0) |
| | | { |
| | | return WZ; |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | |
| | | public static bool Mucheywhaddres(string DeviceCode) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceCode); |
| | | SpeStackerCrane Commonstacker = (SpeStackerCrane)device; |
| | | |
| | | DeviceProDTO? deviceProDTO = Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeviceCode && x.DeviceProParamName == "RgvEquipmentStatus" && x.DeviceProParamType == "RgvEquipmentStatus"); |
| | | int MCGStatus = RGVGetLine(Commonstacker, deviceProDTO.DeviceProAddress); |
| | | if (MCGStatus == (int)RgvEquipmentStatus.NoCargo) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// RGV设å¤ç¶æ |
| | | /// </summary> |
| | | public enum RgvEquipmentStatus |
| | | { |
| | | /// <summary> |
| | | /// æ è´§ |
| | | /// </summary> |
| | | [Description("æ è´§")] |
| | | NoCargo, |
| | | /// <summary> |
| | | /// æè´§ |
| | | /// </summary> |
| | | [Description("æè´§")] |
| | | HasCargo, |
| | | /// <summary> |
| | | /// æªç¥ |
| | | /// </summary> |
| | | [Description("æªç¥")] |
| | | Unkonw = 6 |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä¼ å
¥è®¾å¤ï¼è·åå½åä½ç½®ä½ç½® |
| | | /// </summary> |
| | | /// <param name="ChildPosiDeviceCode">设å¤</param> |
| | | /// <returns></returns> |
| | | public static int GetEquipmentlocation(string ChildPosiDeviceCode) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == ChildPosiDeviceCode); |
| | | SpeStackerCrane speStackerCrane = (SpeStackerCrane)device; |
| | | if (speStackerCrane == null) return 0; |
| | | DeviceProDTO? deviceProDTO = speStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == ChildPosiDeviceCode && x.DeviceProParamName == "RGVCurrentlocation" && x.DeviceProParamType == "RGVCurrentlocation"); |
| | | int MCGStatus = RGVGetLine(speStackerCrane, deviceProDTO.DeviceProAddress); |
| | | return MCGStatus; |
| | | } |
| | | |
| | | public static int RGVGetLine(SpeStackerCrane Commonstacker, string DeviceProDataBlock) |
| | | { |
| | | return Commonstacker.Communicator.Read<short>(DeviceProDataBlock); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åå°å车ä½ç½® |
| | | /// </summary> |
| | | /// <param name="commonstacker"></param> |
| | | /// <param name="deviceCode"></param> |
| | | /// <returns></returns> |
| | | |
| | | private int GetzicheWZ(SpeStackerCrane commonstacker, string deviceCode) |
| | | { |
| | | DeviceProDTO? RGVCurrentlocation = RgvOperationService.GetRGVDeviceProDTO(commonstacker, commonstacker.DeviceCode, "RGVCurrentlocation", "RGVCurrentlocation"); |
| | | return RgvOperationService.GetLine(commonstacker, RGVCurrentlocation.DeviceProAddress); |
| | | } |
| | | |
| | | |
| | |
| | | {4, "åè¿é使¥è¦"}, |
| | | {5, "åéé使¥è¦"}, |
| | | {6, ""}, |
| | | {7, "PLCæ¸åæ
é"}, |
| | | {7, "PLC模åæ
é"}, |
| | | {8, "PLCæ©å±æ¨¡åæ
é"}, |
| | | {9, "ç§°éæ¨¡åæ
é"}, |
| | | {10, "æ«ç å®ä½æ
é"}, |
| | |
| | | {28, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {29, "è´§åæªåå°åå§ä½æ¥è¦"}, |
| | | {30, "触åä»
ç§»å¨å½ä»¤æ¶è´§åä¸å¨åå§ä½æ¥è¦"}, |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"} |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"}, |
| | | {32, "è¡èµ°è½´æ²¡å°ä½ç¦æ¢è´§å伸åº"}, |
| | | {33, "åè´§å¼å¸¸æ¥è¦"}, |
| | | {34, "æ¾è´§å¼å¸¸æ¥è¦"}, |
| | | {35, "å¤åæ£æµ-åè¶
åºæ¥è¦"}, |
| | | {36, "å¤åæ£æµ-åè¶
åºæ¥è¦"}, |
| | | {37, "å¤åæ£æµ-å·¦è¶
åºæ¥è¦"}, |
| | | {38, "å¤åæ£æµ-å³è¶
åºæ¥è¦"}, |
| | | {39, "å¤åæ£æµ-ä¸è¶
åºæ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |