| | |
| | | using System; |
| | | using AutoMapper; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_DTO.AGVInfo; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob.ConveyorLineExtend; |
| | | |
| | | namespace WIDESEAWCS_Tasks.ConveyorLineJob.ConveyorLineExtend |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public class AGVsignal |
| | | public partial class AGVsignal |
| | | { |
| | | /// <summary> |
| | | /// AGVä¸è¾éçº¿äº¤äº |
| | | /// </summary> |
| | | /// <param name="conveyor"></param> |
| | | /// <returns></returns> |
| | | public static WebResponseContent AGVRequestin(ConveyorLineDTO conveyor) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (conveyor == null) throw new Exception("è¯·æ±æ°æ®ä¸ºç©º"); |
| | | if (string.IsNullOrEmpty(conveyor.Station)) throw new Exception("ç«ç¹ç¼å·ä¸ºç©º"); |
| | | CommonConveyorLine conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceName == "è¾é线") as CommonConveyorLine; |
| | | if (!conveyorLine.IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); |
| | | switch (conveyor.Type) |
| | | { |
| | | case 1: |
| | | content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestPut, true, conveyor.Station); |
| | | if (content.Status) content.Status = conveyorLine.GetValue<ConveyorLine_AGV, bool>(ConveyorLine_AGV.ConveyorLinePermitPut, conveyor.Station); |
| | | break; |
| | | case 2: |
| | | { |
| | | content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, true, conveyor.Station); |
| | | if (content.Status) |
| | | { |
| | | Thread.Sleep(1000); |
| | | conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestPut, false, conveyor.Station); |
| | | conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, false, conveyor.Station); |
| | | } |
| | | } |
| | | break; |
| | | case 3: |
| | | content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestTake, true, conveyor.Station); |
| | | if (content.Status) content.Status = conveyorLine.GetValue<ConveyorLine_AGV, bool>(ConveyorLine_AGV.ConveyorLinePermitTake, conveyor.Station); |
| | | break; |
| | | case 4: |
| | | { |
| | | content.Status = conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, true, conveyor.Station); |
| | | if (content.Status) |
| | | { |
| | | Thread.Sleep(1000); |
| | | conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestTake, false, conveyor.Station); |
| | | conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, false, conveyor.Station); |
| | | } |
| | | } |
| | | break; |
| | | default: throw new Exception($"ç±»åæè¯¯[Typeï¼{conveyor.Type}]"); |
| | | } |
| | | content = content.Status ? content.OK() : content.Error(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public static WebResponseContent AGVRequestin<T>(T conveyor) where T : ConveyorLineDTO, new() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |