| | |
| | | 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; |
| | |
| | | private readonly IRouterService _routerService; |
| | | private readonly IAgvStationService _agvStationService; |
| | | private readonly IMapper _mapper; |
| | | private readonly IRgvOperationService _gvOperationService; |
| | | private readonly IEquipmentStatusService _equipmentStatusService; |
| | | |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IAgvStationService agvStation, IMapper mapper) |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IAgvStationService agvStation, IMapper mapper, IRgvOperationService gvOperationService, IEquipmentStatusService equipmentStatusService) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _routerService = routerService; |
| | | _agvStationService = agvStation; |
| | | _mapper = mapper; |
| | | _gvOperationService = gvOperationService; |
| | | _equipmentStatusService=equipmentStatusService; |
| | | } |
| | | |
| | | public async Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | |
| | | |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | AQMConveyorRgvommand aQMConveyor=AQMCommand(conveyorLine, "AQM001"); |
| | | //å®å
¨é¨å¼é¨ç³è¯·+å®å
¨é¨ç¶æ 1 |
| | | if(aQMConveyor.DoorRequest==1) |
| | | //æ ¹æ®è®¾å¤æ¥æ¾åºå¯¹åºçç«å°ä¿¡æ¯ |
| | | List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode); |
| | | foreach (var Stations in aGVStations) |
| | | { |
| | | if(aQMConveyor.ResetStatus == 1) |
| | | /*if (Stations.Station_material == (int)RGVEquipment.AQMexit) |
| | | { |
| | | //åå
¥è¾é线è¿è¡åæ¢ä¿¡å· |
| | | var deviceProDtqh = GetDeviceProDTO(conveyorLine, "AQM001", "IndicatorStatus", "DeviceCommand"); |
| | | bool handoffbool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)3); |
| | | if (handoffbool) |
| | | //è·åå°å®å
¨é¨ä¿¡æ¯ |
| | | AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode); |
| | | if(Stations.Station_tasktype== (int)RGVTasktype.Outbound) |
| | | { |
| | | //éè¦å¤ærgvï¼å åæºæ¯å¦å
许å¼é¨ |
| | | //读åå åæºä¸RGVæ¯å¦å¨æ¥è¦ï¼å¦æå¨æ¥è¦ï¼ååå
¥å®å
¨é¨æ¥è¦ |
| | | if (_gvOperationService.AQMReadAlarminform(2) && _equipmentStatusService.GetSCstatus()) |
| | | { |
| | | //åå
¥æ¥è¦ |
| | | GetDeviceAddress.WriteSecurityDoorpolice(Stations.ChildPosiDeviceCode, "AlarmSummary", 1); |
| | | } |
| | | |
| | | //妿å
许å¼é¨ï¼ååå
¥4ï¼è¡¨ç¤ºåæ¢æåï¼ |
| | | bool Maintenancebool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)4); |
| | | |
| | | //å®å
¨é¨æ¥åç¶æ |
| | | 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 |
| | | { |
| | | //读åDBW8=1,DBW6=1,DBW10=1,DBW4=1,符ååï¼è¿è¡åå
¥åæ¢ç¶æDBW0=3 |
| | | AQMReturnnormal aQMReturnnormal=AQMStoticCommand(conveyorLine, "AQM001"); //夿 |
| | | 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 |
| | | { |
| | | 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 conveyorRgvCommand; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å®å
¨é¨ä¿¡å· |
| | | /// </summary> |
| | | public AQMReturnnormal AQMStoticCommand(CommonConveyorLine conveyorLine, string kladder) |
| | | { |
| | | AQMReturnnormal conveyorRgvCommand = new AQMReturnnormal(); |
| | | try |
| | | { |
| | | AQMReturnnormal conveyorRgvCommand = new AQMReturnnormal(); |
| | | List<DeviceProDTO> deviceProDTO6 = conveyorLine.DeviceProDTOs |
| | | .Where(x => x.DeviceChildCode == kladder |
| | | //&& DBLine.ConveyorAQMReturnnormal.Contains(x.DeviceProParamName) |
| | | && x.DeviceProParamType == "ReadDeviceCommand") |
| | | .ToList(); |
| | | foreach (var item in deviceProDTO6) |
| | | { |
| | | var paramName = item.DeviceProParamName; |
| | | var propertyInfo = typeof(AQMReturnnormal).GetProperty(paramName); |
| | | |
| | | if (propertyInfo != null) |
| | | { |
| | | if (item.DeviceDataType == "short") |
| | | { |
| | | var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress); |
| | | propertyInfo.SetValue(conveyorRgvCommand, value); |
| | | } |
| | | } |
| | | } |
| | | return conveyorRgvCommand; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return null; |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string PLCmanipula, string DeviceProParamName, string DeviceProParamType) |
| | | { |
| | | 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 |
| | | && DBLine.ConveyorAQMReturnnormal.Contains(x.DeviceProParamName) |
| | | && x.DeviceProParamType == "ReadDeviceCommand") |
| | | .ToList(); |
| | | foreach (var item in deviceProDTO6) |
| | | { |
| | | var paramName = item.DeviceProParamName; |
| | | var propertyInfo = typeof(AQMReturnnormal).GetProperty(paramName); |
| | | var propertyInfo = typeof(PlatformStatus).GetProperty(paramName); |
| | | |
| | | if (propertyInfo != null) |
| | | { |
| | |
| | | return conveyorRgvCommand; |
| | | } |
| | | |
| | | public DeviceProDTO? GetDeviceProDTO(CommonConveyorLine conveyorLine, string PLCmanipula, string DeviceProParamName, string DeviceProParamType) |
| | | { |
| | | return conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == PLCmanipula && x.DeviceProParamName == DeviceProParamName && x.DeviceProParamType == DeviceProParamType); |
| | | } |
| | | |
| | | } |
| | | } |