| | |
| | | #region << ç æ¬ 注 é >> |
| | | #region << ç æ¬ 注 é >> |
| | | /*---------------------------------------------------------------- |
| | | * å½å空é´ï¼WIDESEAWCS_TaskInfoService |
| | | * å建è
ï¼è¡ç«¥åº |
| | |
| | | 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_Core.Enums; |
| | | using WIDESEAWCS_DTO.Enum; |
| | |
| | | { |
| | | 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 static CancellationTokenSource _cancellationTokenSource; |
| | | |
| | | |
| | | // å¨ç±»çº§å«æ·»å ç¬ç«ççæ§ç¶æ |
| | | private bool _isOutboundMonitoring = false; |
| | | private bool _isInboundMonitoring = false; |
| | | private bool _isSafetyDoorMonitoring = false; |
| | | private bool _isPlatformMonitoring = false; |
| | | |
| | | // å¨ç±»çåæ®µåº |
| | | private CancellationTokenSource? _platformCancellationTokenSource; |
| | | private CancellationTokenSource _outboundCancellationTokenSource; |
| | | private CancellationTokenSource _inboundCancellationTokenSource; |
| | | private CancellationTokenSource _safetyDoorCancellationTokenSource; |
| | | public RgvoperainformService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService, IServiceProvider serviceProvider) : base(BaseDal) |
| | | public RgvoperainformService(ITask_HtyRepository BaseDal, IAgvStationService agvStationService, IServiceProvider serviceProvider, IRepository<DeviceAlarmLog> deviceAlarmLog) : base(BaseDal) |
| | | { |
| | | _gvStationService = agvStationService; |
| | | _agvStationService = agvStationService; |
| | | _serviceProvider = serviceProvider; |
| | | _deviceAlarmLog = deviceAlarmLog; |
| | | } |
| | | |
| | | |
| | | //=================================================读å设å¤ä¿¡æ¯========================================================== |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·å设å¤ç¶æï¼æ¯æåºåºãå
¥åºåå®å
¨é¨ç¬ç«çæ§ï¼ |
| | | /// è·å设å¤ç¶æï¼æ¯æåºåºãå
¥åºãå®å
¨é¨åç«å°ç¬ç«çæ§ï¼ |
| | | /// </summary> |
| | | /// <param name="off">0:忢 1:å¯å¨ 2:ä»
æ¥è¯¢</param> |
| | | /// <param name="monitorType">çæ§ç±»åï¼outbound-åºåº inbound-å
¥åº safetydoor-å®å
¨é¨ all-å
¨é¨</param> |
| | | /// <param name="monitorType">çæ§ç±»åï¼outbound-åºåº inbound-å
¥åº safetydoor-å®å
¨é¨ platform-ç«å° all-å
¨é¨</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetDeviceStatusDto(int off, string monitorType = "outbound") |
| | | { |
| | | bool isOutbound = monitorType == "outbound" || monitorType == "all";//åºåº |
| | | bool isInbound = monitorType == "inbound" || monitorType == "all";//å
¥åº |
| | | bool isSafetyDoor = monitorType == "safetydoor" || monitorType == "all";//å®å
¨é¨ |
| | | bool isPlatform = monitorType == "platform" || monitorType == "all";//ç«å° |
| | | |
| | | if (off == 1) |
| | | { |
| | |
| | | _ = Task.Run(async () => await StartDeviceMonitoring(_safetyDoorCancellationTokenSource.Token, "safetydoor")); |
| | | } |
| | | |
| | | if (isPlatform && !_isPlatformMonitoring) |
| | | { |
| | | _isPlatformMonitoring = true; |
| | | _platformCancellationTokenSource = new CancellationTokenSource(); |
| | | _ = Task.Run(async () => await StartDeviceMonitoring(_platformCancellationTokenSource.Token, "platform")); |
| | | } |
| | | |
| | | var immediateData = GetImmediateDeviceData(monitorType); |
| | | string message = GetMonitorStatusMessage(monitorType); |
| | | return WebResponseContent.Instance.OK($"设å¤ç¶æçæ§å·²å¯å¨ - {message}", immediateData); |
| | |
| | | { |
| | | _isSafetyDoorMonitoring = false; |
| | | _safetyDoorCancellationTokenSource?.Cancel(); |
| | | } |
| | | |
| | | if (isPlatform && _isPlatformMonitoring) |
| | | { |
| | | _isPlatformMonitoring = false; |
| | | _platformCancellationTokenSource?.Cancel(); |
| | | } |
| | | |
| | | var finalData = GetImmediateDeviceData(monitorType); |
| | |
| | | case "safetydoor": |
| | | _isSafetyDoorMonitoring = false; |
| | | break; |
| | | case "platform": |
| | | _isPlatformMonitoring = false; |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | ["MaterialIn"] = new List<string> { "RGV101" }, |
| | | |
| | | // å®å
¨é¨è®¾å¤ |
| | | ["SafetyDoor"] = new List<string> { "HCJ2000" }, // å®å
¨é¨ |
| | | ["SafetyDoor"] = new List<string> { "HCJ2000" }, |
| | | |
| | | // ç«å°è®¾å¤ - æ ¹æ®æ¨æä¾çåè®®æ·»å ææç«å° |
| | | // ["Platform"] = new List<string> { |
| | | // "1001", "1002", "2016", "2017", "2018", "2019", "1021", "1061", "1131", "1171" |
| | | //} |
| | | ["Platform"] = new List<string> { "HCJ2000" }, |
| | | |
| | | }; |
| | | |
| | | // 设å¤ç±»å对åºçåæ°é
ç½® |
| | |
| | | ("ResetStatus", "ReadDeviceCommand", "å®å
¨é¨å¤ä½ç¶æ"), |
| | | ("AlarmSummary", "DeviceCommand", "æ¥è¦ä¿¡æ¯"), |
| | | ("OpenDoor", "DeviceCommand", "å¼é¨ä¿¡æ¯") |
| | | }, |
| | | |
| | | // ç«å°è®¾å¤åæ°é
ç½® - æ ¹æ®æ¨æä¾çå议添å |
| | | ["Platform"] = new List<(string, string, string)> |
| | | { |
| | | ("HCJ_GoodsStatus", "ReadDeviceCommand", "å
çµä¿¡å·"), |
| | | ("DoorRequest", "DeviceCommand", "ä»»å¡id") |
| | | } |
| | | }; |
| | | |
| | |
| | | { |
| | | "outbound" => group.Key == "MotherCar" || group.Key == "TransferCar" || group.Key == "MaterialOut", |
| | | "inbound" => group.Key == "MaterialIn" || group.Key == "InboundMotherCar" || group.Key == "InboundTransferCar", |
| | | "safetydoor" => group.Key == "SafetyDoor", // å®å
¨é¨çæ§ç±»å |
| | | "safetydoor" => group.Key == "SafetyDoor", |
| | | "platform" => group.Key == "Platform", // ç«å°çæ§ç±»å |
| | | "all" => true, |
| | | _ => group.Key == "MotherCar" || group.Key == "TransferCar" || group.Key == "MaterialOut" |
| | | }; |
| | | }).ToDictionary(x => x.Key, x => x.Value); |
| | | |
| | | int i = 0; |
| | | // éåçéåç设å¤ç» |
| | | foreach (var deviceGroup in filteredDeviceGroups) |
| | | { |
| | |
| | | } |
| | | else if (device is CommonConveyorLine conveyorLine) |
| | | { |
| | | // å¤çå®å
¨é¨è®¾å¤ï¼CommonConveyorLine ç±»åï¼ |
| | | // å建ä¸ä¸ªå®å
¨é¨è®¾å¤çæ°æ® |
| | | List<string> safetyDoorList = new List<string> { "AQM001", "AQM002", "AQM003" }; |
| | | |
| | | // 为æ¯ä¸ªå®å
¨é¨åå»ºæ°æ® |
| | | foreach (string safetyDoorCode in safetyDoorList) |
| | | // å¤çå®å
¨é¨è®¾å¤åç«å°è®¾å¤ï¼CommonConveyorLine ç±»åï¼ |
| | | if (deviceType == "SafetyDoor") |
| | | { |
| | | var deviceData = new Dictionary<string, int>(); |
| | | // å®å
¨é¨è®¾å¤å¤çé»è¾ï¼ä¿æä¸åï¼ |
| | | List<string> safetyDoorList = new List<string> { "AQM001", "AQM002", "AQM003" }; |
| | | |
| | | // éå该设å¤çææåæ° |
| | | foreach (var param in deviceParams) |
| | | foreach (string safetyDoorCode in safetyDoorList) |
| | | { |
| | | try |
| | | { |
| | | // 使ç¨å®å
¨é¨åç§°æ¥è¯¢å¯¹åºçåæ° |
| | | DeviceProDTO? devicePro = GetSafetyDoorDeviceProDTO( |
| | | conveyorLine, safetyDoorCode, param.DeviceProParamName, param.DeviceProParamType); |
| | | var deviceData = new Dictionary<string, int>(); |
| | | |
| | | if (devicePro != null) |
| | | { |
| | | // å¯¹äº CommonConveyorLine ç±»åï¼ä½¿ç¨éç¨çæ°æ®è¯»åæ¹æ³ |
| | | int res = ReadCommonConveyorLineData(conveyorLine, devicePro.DeviceProAddress); |
| | | deviceData[param.DeviceProRemark] = res; |
| | | } |
| | | else |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; // ä½¿ç¨ -1 表示æ¥è¯¢å¤±è´¥ |
| | | } |
| | | } |
| | | catch (Exception) |
| | | foreach (var param in deviceParams) |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; // ä½¿ç¨ -1 表示æ¥è¯¢å¼å¸¸ |
| | | try |
| | | { |
| | | DeviceProDTO? devicePro = GetSafetyDoorDeviceProDTO( |
| | | conveyorLine, safetyDoorCode, param.DeviceProParamName, param.DeviceProParamType); |
| | | |
| | | if (devicePro != null) |
| | | { |
| | | int res = ReadCommonConveyorLineData(conveyorLine, devicePro.DeviceProAddress); |
| | | deviceData[param.DeviceProRemark] = res; |
| | | } |
| | | else |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; |
| | | } |
| | | } |
| | | catch (Exception) |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; |
| | | } |
| | | } |
| | | |
| | | finalResult[safetyDoorCode] = deviceData; |
| | | } |
| | | } |
| | | |
| | | // å°å½åå®å
¨é¨è®¾å¤çæ°æ®æ·»å å°æç»ç»æä¸ï¼ä½¿ç¨å®å
¨é¨åç§°ä½ä¸ºkey |
| | | finalResult[safetyDoorCode] = deviceData; |
| | | if (deviceType == "Platform") |
| | | { |
| | | // å®å
¨é¨è®¾å¤å¤çé»è¾ï¼ä¿æä¸åï¼ |
| | | List<string> PlatformList = new List<string> { "1001", "1002", "2016", "2017", "2018", "2019", "1021", "1061", "1131", "1171" }; |
| | | |
| | | foreach (string Platform in PlatformList) |
| | | { |
| | | var deviceData = new Dictionary<string, int>(); |
| | | |
| | | foreach (var param in deviceParams) |
| | | { |
| | | try |
| | | { |
| | | DeviceProDTO? devicePro = GetSafetyDoorDeviceProDTO( |
| | | conveyorLine, Platform, param.DeviceProParamName, param.DeviceProParamType); |
| | | |
| | | if (devicePro != null) |
| | | { |
| | | int res = ReadCommonConveyorLineData(conveyorLine, devicePro.DeviceProAddress); |
| | | deviceData[param.DeviceProRemark] = res; |
| | | } |
| | | else |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; |
| | | } |
| | | } |
| | | catch (Exception) |
| | | { |
| | | deviceData[param.DeviceProRemark] = -1; |
| | | } |
| | | } |
| | | |
| | | finalResult[Platform] = deviceData; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // å³ä½¿è®¾å¤ä¸å卿䏿¯æ¯æçç±»åï¼ä¹å建ä¸ä¸ªç©ºåå
¸ |
| | | finalResult[deviceChildCode] = new Dictionary<string, int>(); |
| | | if (device != null) |
| | | { |
| | | Console.WriteLine($"è¦åï¼è®¾å¤ {deviceChildCode} ç±»å {device.GetType().Name} 䏿¯æï¼æ æ³è¯»åæ°æ®"); |
| | | } |
| | | else |
| | | { |
| | | Console.WriteLine($"è¦åï¼è®¾å¤ {deviceChildCode} ä¸åå¨"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | "outbound" => $"åºåºçæ§: {(_isOutboundMonitoring ? "è¿è¡ä¸" : "已忢")}", |
| | | "inbound" => $"å
¥åºçæ§: {(_isInboundMonitoring ? "è¿è¡ä¸" : "已忢")}", |
| | | "safetydoor" => $"å®å
¨é¨çæ§: {(_isSafetyDoorMonitoring ? "è¿è¡ä¸" : "已忢")}", |
| | | "all" => $"åºåºçæ§: {(_isOutboundMonitoring ? "è¿è¡ä¸" : "已忢")}, å
¥åºçæ§: {(_isInboundMonitoring ? "è¿è¡ä¸" : "已忢")}, å®å
¨é¨çæ§: {(_isSafetyDoorMonitoring ? "è¿è¡ä¸" : "已忢")}", |
| | | "platform" => $"ç«å°çæ§: {(_isPlatformMonitoring ? "è¿è¡ä¸" : "已忢")}", // ç«å°çæ§ç¶æ |
| | | "all" => $"åºåºçæ§: {(_isOutboundMonitoring ? "è¿è¡ä¸" : "已忢")}, å
¥åºçæ§: {(_isInboundMonitoring ? "è¿è¡ä¸" : "已忢")}, å®å
¨é¨çæ§: {(_isSafetyDoorMonitoring ? "è¿è¡ä¸" : "已忢")}, ç«å°çæ§: {(_isPlatformMonitoring ? "è¿è¡ä¸" : "已忢")}", |
| | | _ => $"åºåºçæ§: {(_isOutboundMonitoring ? "è¿è¡ä¸" : "已忢")}" |
| | | }; |
| | | } |
| | |
| | | "outbound" => "åºåº", |
| | | "inbound" => "å
¥åº", |
| | | "safetydoor" => "å®å
¨é¨", |
| | | "platform" => "ç«å°", // ç«å°æ¾ç¤ºåç§° |
| | | "all" => "å
¨é¨", |
| | | _ => "åºåº" |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 读å设å¤ä¿¡æ¯ |
| | |
| | | return Commonstacker.Communicator.Read<short>(DeviceProDataBlock); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¥è¯¢å®å
¨é¨è®¾å¤ |
| | | /// </summary> |
| | |
| | | public static DeviceProDTO? GetSafetyDoorDeviceProDTO(CommonConveyorLine Commonstacker, string SCAddress, string DeviceProParamName, string DeviceProParamType) |
| | | { |
| | | return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SCAddress && x.DeviceProParamName == DeviceProParamName && x.DeviceProParamType == DeviceProParamType); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥è¯¢ç«å°è®¾å¤ |
| | | /// </summary> |
| | | /// <param name="Commonstacker"></param> |
| | | /// <param name="PlatformCode">ç«å°ç¼å·</param> |
| | | /// <param name="DeviceProParamName">åæ°åç§°</param> |
| | | /// <param name="DeviceProParamType">åæ°ç±»å</param> |
| | | /// <returns></returns> |
| | | public static DeviceProDTO? GetPlatformDeviceProDTO(CommonConveyorLine Commonstacker, string PlatformCode, string DeviceProParamName, string DeviceProParamType) |
| | | { |
| | | return Commonstacker.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == PlatformCode && x.DeviceProParamName == DeviceProParamName && x.DeviceProParamType == DeviceProParamType); |
| | | } |
| | | |
| | | //=================================================读å设å¤ä¿¡æ¯========================================================== |
| | |
| | | int zhi = 1002011; |
| | | try |
| | | { |
| | | |
| | | |
| | | switch (operationType) |
| | | { |
| | | case "cs": //åå§å |
| | |
| | | DeviceProParamName = "RGV_Risingsignalplace"; |
| | | DeviceProParamType = "DeviceCommand"; |
| | | zhi = parameter; |
| | | break; |
| | | case "xj": //ä¸é |
| | | DeviceProDTO? RGV_Resetoperationss1 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, DeviceProParamName, DeviceProParamType); //ä¸å |
| | | RgvOperationService.RgvSetLine(Commonstacker, RGV_Resetoperationss1.DeviceProAddress, (short)zhi); |
| | | //DeviceProDTO? RGV_Resetoperationss2 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, "RGV_Risingsignalplace", "ReadDeviceCommand"); //ä¸åå°ä½ä¿¡å· |
| | | // int resss = 0; |
| | | // while (resss == 0) |
| | | // { |
| | | // Thread.Sleep(2000); |
| | | // resss = RgvOperationService.GetLine(Commonstacker, RGV_Resetoperationss2.DeviceProAddress); |
| | | // } |
| | | // DeviceProDTO? RGV_Resetoperationss3 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, DeviceProParamName, DeviceProParamType); //ä¸å |
| | | // RgvOperationService.RgvSetLine(Commonstacker, RGV_Resetoperationss3.DeviceProAddress, 0); |
| | | return webResponse.OK(); |
| | | |
| | | case "xj": //ä¸é |
| | | DeviceProParamName = "RGV_Descentsignal"; |
| | | DeviceProParamType = "DeviceCommand"; |
| | | zhi = parameter; |
| | | break; |
| | | DeviceProDTO? RGV_Resetoperationxj1 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, DeviceProParamName, DeviceProParamType); //ä¸é |
| | | RgvOperationService.RgvSetLine(Commonstacker, RGV_Resetoperationxj1.DeviceProAddress, (short)zhi); |
| | | //DeviceProDTO? RGV_Resetoperationxj2 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, "RGV_Descentsignal", "ReadDeviceCommand"); //ä¸éå°ä½ä¿¡å· |
| | | //int resxj = 0; |
| | | //while (resxj == 0) |
| | | //{ |
| | | // Thread.Sleep(2000); |
| | | // resxj = RgvOperationService.GetLine(Commonstacker, RGV_Resetoperationxj2.DeviceProAddress); |
| | | //} |
| | | //DeviceProDTO? RGV_Resetoperationxj3 = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, deviceName, DeviceProParamName, DeviceProParamType); //ä¸å |
| | | //RgvOperationService.RgvSetLine(Commonstacker, RGV_Resetoperationxj3.DeviceProAddress, 0); |
| | | return webResponse.OK(); |
| | | case "dz": //å°å |
| | | DeviceProParamName = "RGV_RGVTasklocationt"; |
| | | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | return webResponse.Error("è®¾å¤æä½å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥çæ¥è¦ |
| | | /// </summary> |
| | | public WebResponseContent LogAlarmToDatabase(string JobDeviceName) |
| | | { |
| | | // 设å¤åç±» - åå¹¶çæ¬ |
| | | var deviceCategories = new Dictionary<string, List<string>> |
| | | { |
| | | ["MotherCar"] = new List<string> { "RGV112", "RGV110", "RGV114", "RGV115", "RGV103", "RGV105", "RGV108", "RGV109" }, |
| | | ["TransferCar"] = new List<string> { "RGV116", "RGV111", "RGV104", "RGV107" }, |
| | | ["ExternalRGV"] = new List<string> { "RGV118", "RGV101" } |
| | | }; |
| | | |
| | | WebResponseContent webResponse = new WebResponseContent(); |
| | | string DeviceName = JobDeviceName; //设å¤åç§° |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeviceName); |
| | | if (device == null) return webResponse.Error(); |
| | | SpeStackerCrane Commonstacker = (SpeStackerCrane)device; |
| | | DeviceProDTO? RGV_Resetoperation = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Faultcode", "ReadDeviceCommand"); |
| | | DeviceProDTO? RGVCurrentlocation = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGVCurrentlocation", "RGVCurrentlocation"); |
| | | DeviceProDTO? RGV_Rgvtaskid = RgvOperationService.GetRGVDeviceProDTO(Commonstacker, DeviceName, "RGV_Rgvtaskid", "ReadDeviceCommand"); |
| | | |
| | | |
| | | int baoj = RgvOperationService.GetLine(Commonstacker, RGV_Resetoperation.DeviceProAddress); |
| | | |
| | | if (baoj<=0) |
| | | { |
| | | return null; |
| | | } |
| | | int Currentlocation = RgvOperationService.GetLine(Commonstacker, RGVCurrentlocation.DeviceProAddress); |
| | | int Rgvtaskid = RgvOperationService.GetLine(Commonstacker, RGV_Rgvtaskid.DeviceProAddress); |
| | | |
| | | string alarmMessage = ""; |
| | | if (deviceCategories["MotherCar"].Contains(DeviceName)) |
| | | { |
| | | // æ¯è½¦ä¸ç¨æ¥è¦å¤çé»è¾ |
| | | alarmMessage = HandleMotherCarAlarm(baoj); |
| | | } |
| | | else if (deviceCategories["TransferCar"].Contains(DeviceName)) |
| | | { |
| | | // å车ä¸ç¨æ¥è¦å¤çé»è¾ |
| | | alarmMessage = HandleTransferCarAlarm(baoj); |
| | | } |
| | | else if (deviceCategories["ExternalRGV"].Contains(DeviceName)) |
| | | { |
| | | // å¤å£RGVä¸ç¨æ¥è¦å¤çé»è¾ |
| | | alarmMessage = HandleExternalRGVAlarm(baoj); |
| | | } |
| | | |
| | | // åå
¥ææ¬æ¥å¿ï¼æè®¾å¤åç»/ææ¥ååï¼ |
| | | var logContent = $"设å¤:{DeviceName} | æ¥è¦ç :{baoj} | æ¥è¦æè¿°:{alarmMessage} | å½åä½ç½®:{Currentlocation} | ä»»å¡å·:{Rgvtaskid}"; |
| | | // groupName: Alarmï¼logName: 设å¤å |
| | | WriteLog.Write_Log("Alarm", DeviceName, logContent, new |
| | | { |
| | | DeviceCode = DeviceName, |
| | | AlarmCode = baoj, |
| | | AlarmContent = alarmMessage, |
| | | DeviceLocation = Currentlocation, |
| | | TaskNum = Rgvtaskid, |
| | | Time = DateTime.Now |
| | | }); |
| | | return webResponse.OK(); |
| | | } |
| | | |
| | | |
| | | // æ¥è¦ä»£ç æ å°æ¹æ³ |
| | | private string HandleExternalRGVAlarm(int alarmCode) |
| | | { |
| | | var alarmMessages = new Dictionary<int, string> |
| | | { |
| | | {0, "æ æ¥è¦"}, |
| | | {1, "RGVå°è½¦æ¥å被æä¸"}, |
| | | {2, "æ£è½¬é·è¾¾æ¥è¦"}, |
| | | {3, "å转é·è¾¾æ¥è¦"}, |
| | | {4, "åè¿é使¥è¦"}, |
| | | {5, "åéé使¥è¦"}, |
| | | {6, ""}, |
| | | {7, "PLC模åæ
é"}, |
| | | {8, "PLCæ©å±æ¨¡åæ
é"}, |
| | | {9, "ç§°éæ¨¡åæ
é"}, |
| | | {10, "æ«ç å®ä½æ
é"}, |
| | | {11, "RGVé¿æ¶é´ç©ºè½¬æ
é"}, |
| | | {12, "ç®çå°ä¸çäºå®é
ä½ç½®æ
é"}, |
| | | {13, "䏿»æ§é讯æ
é"}, |
| | | {14, "åé·è¾¾å±è½è¦å"}, |
| | | {15, "åé·è¾¾å±è½è¦å"}, |
| | | {16, "è¡èµ°åé¢å¨æ
é"}, |
| | | {17, "伸缩ååé¢å¨æ
é"}, |
| | | {18, "æ¶²ååå
è¿è½½ä¿æ¤æ
é"}, |
| | | {19, "æ¶²åä¸åè¶
æ¶æ¥è¦"}, |
| | | {20, "æ¶²åä¸éè¶
æ¶æ¥è¦"}, |
| | | {21, "伸缩å伸åºè¶
æ¶æ¥è¦"}, |
| | | {22, "伸缩å缩åè¶
æ¶æ¥è¦"}, |
| | | {23, "å¤å½¢æ£æµæ¥è¦"}, |
| | | {24, "ç§°éè¶
鿥è¦"}, |
| | | {25, "è´§åä¼¸åºæéé使¥è¦"}, |
| | | {26, "è´§å缩åæéé使¥è¦"}, |
| | | {27, "åè´§æ¶èªèº«æè´§ç©æ¥è¦"}, |
| | | {28, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {29, "è´§åæªåå°åå§ä½æ¥è¦"}, |
| | | {30, "触åä»
ç§»å¨å½ä»¤æ¶è´§åä¸å¨åå§ä½æ¥è¦"}, |
| | | {31, "è´§åå°è¾¾åå§ä½ä½ä¸ä½ä¼ æå¨æªæ£æµå°æ¥è¦"}, |
| | | {32, "è¡èµ°è½´æ²¡å°ä½ç¦æ¢è´§å伸åº"}, |
| | | {33, "åè´§å¼å¸¸æ¥è¦"}, |
| | | {34, "æ¾è´§å¼å¸¸æ¥è¦"}, |
| | | {35, "å¤åæ£æµ-åè¶
åºæ¥è¦"}, |
| | | {36, "å¤åæ£æµ-åè¶
åºæ¥è¦"}, |
| | | {37, "å¤åæ£æµ-å·¦è¶
åºæ¥è¦"}, |
| | | {38, "å¤åæ£æµ-å³è¶
åºæ¥è¦"}, |
| | | {39, "å¤åæ£æµ-ä¸è¶
åºæ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |
| | | } |
| | | |
| | | |
| | | private string HandleTransferCarAlarm(int alarmCode) |
| | | { |
| | | var alarmMessages = new Dictionary<int, string> |
| | | { |
| | | {0, "æ æ¥è¦"}, |
| | | {1, "RGVå°è½¦æ¥å被æä¸"}, |
| | | {2, "åè¿é使¥è¦"}, |
| | | {3, "åéé使¥è¦"}, |
| | | {4, "PLCæ¸åæ
é"}, |
| | | {5, "PLCæ©å±æ¨¡åæ
é"}, |
| | | {6, "æ«ç å®ä½æ
é"}, |
| | | {7, "RGVé¿æ¶é´ç©ºè½¬æ
é"}, |
| | | {8, "ç®çå°ä¸çäºå®é
ä½ç½®æ
é"}, |
| | | {9, "䏿»æ§é讯æ
é"}, |
| | | {10, "è¡èµ°åé¢å¨æ
é"}, |
| | | {11, "æ¶²ååå
è¿è½½ä¿æ¤æ
é"}, |
| | | {12, "æ¶²åä¸åè¶
æ¶æ¥è¦"}, |
| | | {13, "æ¶²åä¸éè¶
æ¶æ¥è¦"}, |
| | | {14, "åè´§æ¶èªèº«æè´§ç©æ¥è¦"}, |
| | | {15, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {16, "åè´§æ£æµä¸å°è´§ç©æ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |
| | | } |
| | | |
| | | private string HandleMotherCarAlarm(int alarmCode) |
| | | { |
| | | var alarmMessages = new Dictionary<int, string> |
| | | { |
| | | {0, "æ æ¥è¦"}, |
| | | {1, "RGVå°è½¦æ¥å被æä¸"}, |
| | | {2, "åè¿é使¥è¦"}, |
| | | {3, "åéé使¥è¦"}, |
| | | {4, "PLCæ¸åæ
é"}, |
| | | {5, "PLCæ©å±æ¨¡åæ
é"}, |
| | | {6, "RGVé¿æ¶é´ç©ºè½¬æ
é"}, |
| | | {7, "ç®çå°ä¸çäºå®é
ä½ç½®æ
é"}, |
| | | {8, "䏿»æ§é讯æ
é"}, |
| | | {9, "è¡èµ°åé¢å¨æ
é"}, |
| | | {10, "åè´§æ¶èªèº«æè´§ç©æ¥è¦"}, |
| | | {11, "æ¾è´§æ¶èªèº«æ è´§ç©æ¥è¦"}, |
| | | {12, "忢æ¶ä½ç½®è¿å²æ¥è¦"} |
| | | }; |
| | | |
| | | return alarmMessages.ContainsKey(alarmCode) ? alarmMessages[alarmCode] : "æªç¥æ¥è¦ä»£ç "; |
| | | } |
| | | } |
| | | } |
| | | |