| | |
| | | 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 |
| | | { |
| | |
| | | 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) |
| | |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | |
| | | |
| | | //æ ¹æ®è®¾å¤æ¥æ¾åºå¯¹åºçç«å°ä¿¡æ¯ |
| | | /*List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode); |
| | | List<AGVStation> aGVStations = _agvStationService.GetYljSide(conveyorLine.DeviceCode); |
| | | foreach (var Stations in aGVStations) |
| | | { |
| | | PlatformStatus aQMConveyor = StoticCommand(conveyorLine, Stations.ChildPosiDeviceCode); |
| | | if(aQMConveyor.HCJ_GoodsStatus==0) //å¯è¿è¡æ¾è´§ |
| | | if (Stations.Station_material == (int)RGVEquipment.AQMexit) |
| | | { |
| | | 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 Security = SecurityDoorEquipment(conveyorLine, Stations); |
| | | if (Security) continue; |
| | | |
| | | } |
| | | }*/ |
| | | |
| | | |
| | | |
| | | /* |
| | | //å®å
¨é¨å¼é¨ç³è¯·+å®å
¨é¨ç¶æ 1 |
| | | if(aQMConveyor.DoorRequest==1) |
| | | { |
| | | if(aQMConveyor.ResetStatus == 1) |
| | | else |
| | | { |
| | | //åå
¥è¾é线è¿è¡åæ¢ä¿¡å· |
| | | var deviceProDtqh = GetDeviceProDTO(conveyorLine, "AQM001", "IndicatorStatus", "DeviceCommand"); |
| | | bool handoffbool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)3); |
| | | if (handoffbool) |
| | | { |
| | | //éè¦å¤ærgvï¼å åæºæ¯å¦å
许å¼é¨ |
| | | |
| | | //妿å
许å¼é¨ï¼ååå
¥4ï¼è¡¨ç¤ºåæ¢æåï¼ |
| | | bool Maintenancebool = conveyorLine.Communicator.Write(deviceProDtqh.DeviceProDataBlock, (short)4); |
| | | } |
| | | bool HCJPlat=PlatformEquipmentInformation(conveyorLine, Stations); |
| | | if (HCJPlat) continue; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | //读åDBW8=1,DBW6=1,DBW10=1,DBW4=1,符ååï¼è¿è¡åå
¥åæ¢ç¶æDBW0=3 |
| | | AQMReturnnormal aQMReturnnormal=AQMStoticCommand(conveyorLine, "AQM001"); //夿 |
| | | |
| | | }*/ |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | 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; |
| | | } |
| | | |
| | | public AQMReturnnormal AQMStoticCommand(CommonConveyorLine conveyorLine, string kladder) |
| | | //å®å
¨é¨è®¾å¤ä¿¡æ¯ç®¡ç |
| | | private bool SecurityDoorEquipment(CommonConveyorLine conveyorLine, AGVStation Stations) |
| | | { |
| | | 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) |
| | | try |
| | | { |
| | | var paramName = item.DeviceProParamName; |
| | | var propertyInfo = typeof(AQMReturnnormal).GetProperty(paramName); |
| | | // è·åå®å
¨é¨ä¿¡æ¯ |
| | | AQMReturnnormal aQMConveyor = AQMStoticCommand(conveyorLine, Stations.ChildPosiDeviceCode); |
| | | |
| | | if (propertyInfo != null) |
| | | if (aQMConveyor.SafetyLockStatus == 1) |
| | | { |
| | | if (item.DeviceDataType == "int") |
| | | //åå
¥æ¥è¦ |
| | | 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) |
| | | { |
| | | var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress); |
| | | propertyInfo.SetValue(conveyorRgvCommand, value); |
| | | //æ¥æ¾æ¯å¦æå¼å¸¸æ¬è¿ä»»å¡ |
| | | webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 1); //è¿éè¦ä¼ å
¥å°å |
| | | } |
| | | else |
| | | { |
| | | //åºåºç«å°çä»»å¡ |
| | | webResponseContent = _taskService.UpdateDeliveryAddress(Stations.HCJStorageaddress.ToString(), 2); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | return conveyorRgvCommand; |
| | | catch (Exception ex) |
| | | { |
| | | return true; |
| | | throw; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å®å
¨é¨ä¿¡å· |
| | | /// </summary> |
| | | public AQMReturnnormal AQMStoticCommand(CommonConveyorLine conveyorLine, string kladder) |
| | | { |
| | | 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 |
| | | && x.DeviceProParamName== "HCJ_GoodsStatus" |
| | | && x.DeviceProParamType == "ReadDeviceCommand") |
| | | .ToList(); |
| | | foreach (var item in deviceProDTO6) |
| | |
| | | |
| | | if (propertyInfo != null) |
| | | { |
| | | if (item.DeviceDataType == "int") |
| | | if (item.DeviceDataType == "short") |
| | | { |
| | | var value = conveyorLine.Communicator.Read<short>(item.DeviceProAddress); |
| | | propertyInfo.SetValue(conveyorRgvCommand, value); |