| | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | //if (!commonStackerCrane.IsEventSubscribed) |
| | | //{ |
| | | // commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | //} |
| | | |
| | | |
| | | |
| | | |
| | | if ((int)commonStackerCrane.StackerCraneWorkStatusValue == 6) |
| | | //ä»»å¡å®æStackerCraneWorkStatus |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.WorkCompleted) |
| | | { |
| | | //夿å½å任塿¯å¦æ¯çç¹ |
| | | Dt_Task? currtask = _taskService.CurrtaskInfo(commonStackerCrane.CurrentTaskNum); |
| | |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.Communicator.Write("DB105.52", 1); |
| | | |
| | | WebResponseContent webResponseContent=_taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | } |
| | |
| | | { |
| | | if (taskItem.TaskType == (int)TaskTypeEnum.Outbound) |
| | | { |
| | | if (OutTaskStationIsOccupied(taskItem.NextAddress)) |
| | | if (OutTaskStationIsOccupied(taskItem.NextAddress,taskItem.Roadway)) |
| | | { |
| | | return taskItem; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½</param> |
| | | /// <returns>妿æªè¢«å ç¨ï¼è¿åä¼ å
¥çä»»å¡ä¿¡æ¯ï¼å¦åï¼è¿ånull</returns> |
| | | private bool OutTaskStationIsOccupied(string NextAddress) |
| | | private bool OutTaskStationIsOccupied(string NextAddress,string Roadway) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1003"); |
| | | if (device == null) return false; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationFree"); |
| | | if (deviceProDTO == null) return false; |
| | | return conveyorLine.Communicator.Read<bool>(deviceProDTO.DeviceProAddress); |
| | | try |
| | | { |
| | | if (Roadway == "C") |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1004"); |
| | | if (device == null) return false; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | if (StationNum == 0 && HandShake == 0 && Roadway == "C") |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1003"); |
| | | if (device == null) return false; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | if ((StationNum == 1 && HandShake == 0 && Roadway == "B") || (StationNum == 0 && HandShake == 0 && Roadway != "B")) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine("读åç«å°ä¿¡æ¯é误ï¼"+ex.Message); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | public StackerCraneTaskCommand? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task) |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | |
| | | if (EndCodest.Length == 3) |
| | | { |
| | | string EndRow = EndCodest[0].Substring(1); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(EndRow); |
| | | string SCEndRow = LaneModification(task.Roadway, int.Parse(EndRow)); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(SCEndRow ); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(EndCodest[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(EndCodest[2]); |
| | | } |
| | |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | string StartRow = sourceCodes[0].Substring(1); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(StartRow); |
| | | string SCStartRow = LaneModification(task.Roadway, int.Parse(StartRow)); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(SCStartRow); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | |
| | | } |
| | | |
| | | //è·åç«å°ç¼å· |
| | | Dt_PlatformStation dt_Platform = _DtPlatformStationService.getStatiomInfo(task.SourceAddress); |
| | | Dt_PlatformStation dt_Platform = _DtPlatformStationService.getStatiomInfo(task.NextAddress); |
| | | string[] EndCodest = dt_Platform.Station_storey.Split("-"); |
| | | if (EndCodest.Length == 3) |
| | | { |
| | |
| | | if (EndCodest.Length == 3) |
| | | { |
| | | string EndRow = EndCodest[0].Substring(1); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(EndRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(EndCodest[1]); |
| | | string SCEnRow=LaneModification(task.Roadway,int.Parse(EndRow)); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(SCEnRow); |
| | | stackerCraneTaskCommand.EndColumn = (short)(Convert.ToInt16(EndCodest[1]) + 1); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(EndCodest[2]); |
| | | } |
| | | else |
| | | { |
| | | |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | | |
| | | public string LaneModification(string Roadway,int SCRow) |
| | | { |
| | | if (Roadway == "F") |
| | | { |
| | | return SCRow == 1 ? "3" : "4"; |
| | | }else if(Roadway == "C") |
| | | { |
| | | return SCRow == 1 ? "5" : "6"; |
| | | } |
| | | else |
| | | { |
| | | return SCRow.ToString(); |
| | | } |
| | | } |
| | | } |
| | | } |