| | |
| | | CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceName == "è¾é线") as CommonConveyorLine; |
| | | if (conveyorLine == null) throw new Exception("æªæ¾å°è¾é线设å¤ä¿¡æ¯"); |
| | | if (!conveyorLine.IsConnected) throw new Exception($"è¾é线设å¤é讯å¼å¸¸"); |
| | | //conveyorLine.SetValue(ConveyorLine_AGV.WriteRGPutComplete, true, "1001");//人工æ¾è´§å®æ |
| | | switch (conveyor.Type) |
| | | { |
| | | case 1: |
| | |
| | | } |
| | | break; |
| | | case 2: |
| | | break; |
| | | case 3: |
| | | { |
| | | if (conveyor.Station == "1001") |
| | | { |
| | | 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); |
| | | } |
| | | //if (content.Status) |
| | | //{ |
| | | // Thread.Sleep(1000); |
| | | // conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestPut, false, conveyor.Station); |
| | | // conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVPutComplete, false, conveyor.Station); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | 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); |
| | | } |
| | | //if (content.Status) |
| | | //{ |
| | | // Thread.Sleep(1000); |
| | | // conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVRequestTake, false, conveyor.Station); |
| | | // conveyorLine.SetValue(ConveyorLine_AGV.WriteAGVTakeComplete, false, conveyor.Station); |
| | | //} |
| | | } |
| | | } |
| | | break; |
| | | case 3: |
| | | |
| | | break; |
| | | case 4: |
| | | |
| | |
| | | public static WebResponseContent AGVRequestinProductionLine(ConveyorLineDTO conveyor) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | OtherDevice? ProductionLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == conveyor.Station) as OtherDevice; |
| | | try |
| | | { |
| | | OtherDevice? ProductionLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == conveyor.Station) as OtherDevice; |
| | | if (ProductionLine == null) throw new Exception("æªæ¾å°äº§çº¿è®¾å¤ä¿¡æ¯"); |
| | | if (!ProductionLine.IsConnected) throw new Exception($"产线设å¤é讯å¼å¸¸"); |
| | | content.Status = ProductionLine.SetValue(ProductionLineDBName.WagvState, conveyor.Type); |
| | |
| | | switch (conveyor.Type) |
| | | { |
| | | case 1: |
| | | if (agvState != conveyor.Type) throw new Exception("产线ä¸å
许è¿å
¥ä½ä¸"); |
| | | if (agvState != conveyor.Type) throw new Exception($"AGVç³è¯·è¿å
¥ï¼äº§çº¿ä¸å
许è¿å
¥ä½ä¸ï¼äº§çº¿ä¿¡å·ã{agvState}ã"); |
| | | ProductionLine?.Communicator.LogNet.WriteDebug($"AGVç³è¯·è¿å
¥ï¼äº§çº¿å
许è¿å
¥ä½ä¸ï¼äº§çº¿ä¿¡å·ã{agvState}ã"); |
| | | content.OK(); |
| | | break; |
| | | case 2: |
| | | if (agvState != conveyor.Type) throw new Exception("产线ä¸å
许离å¼"); |
| | | //if (agvState != conveyor.Type) throw new Exception("产线ä¸å
许离å¼"); |
| | | content.OK(); |
| | | break; |
| | | case 3: |
| | | content.Status = ProductionLine.SetValue(ProductionLineDBName.Wrequest, 2); |
| | | if (content.Status) content.Status = ProductionLine.SetValue(ProductionLineDBName.WagvState, 0); |
| | | ProductionLine?.Communicator.LogNet.WriteDebug($"AGV已离å¼ï¼ä»»å¡å®æ"); |
| | | break; |
| | | } |
| | | content = content.Status ? content.OK() : content.Error("åå
¥å¤±è´¥"); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | ProductionLine?.Communicator.LogNet.WriteDebug(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// å
¥åºè¾é线人工æ¾è´§å®æ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static WebResponseContent ReleaseCompleted() |
| | | { |
| | | try |
| | | { |
| | | CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceName == "è¾é线") as CommonConveyorLine; |
| | | if (conveyorLine == null) throw new Exception("æªæ¾å°è¾é线设å¤ä¿¡æ¯"); |
| | | if (!conveyorLine.IsConnected) throw new Exception($"è¾é线设å¤é讯å¼å¸¸"); |
| | | conveyorLine.SetValue(ConveyorLine_AGV.WriteRGPutComplete, true, "1001");//人工æ¾è´§å®æ |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |