| | |
| | | private readonly ITask_HtyRepository _taskHtyRepository; |
| | | private readonly IDt_needBarcodeRepository _taskNeedBarcodeRepository; |
| | | |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | | { |
| | | {nameof(Dt_Task.Grade), OrderByType.Desc }, |
| | |
| | | |
| | | public WebResponseContent GetPlcState(string TargetAddress) |
| | | { |
| | | |
| | | Dt_StationManager dt_Station=_stationManagerRepository.QueryFirst(x => x.stationLocation == TargetAddress); |
| | | if(dt_Station == null) |
| | | return WebResponseContent.Instance.Error("æªæ¾å°åè£
ä½ä¿¡æ¯ï¼"); |
| | |
| | | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1000"); |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | |
| | | //DeviceProDTO? devicePr = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == "2033" && x.DeviceProParamName == "ConveyorLineSingal"); |
| | | short agv20 = conveyorLine.Communicator.Read<short>("DB5.794"); |
| | | if (agv20 != 1) //è·åä¸è½´å¤æ¯å¦ææå ç¨ |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ£æµå°agvåæç«å°æè´§ï¼ä¸å¯ä¸åä»»å¡ï¼è¯»åå°ï¼{agv20}"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | DeviceProDTO? deviceProDTOt = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == TargetAddress && x.DeviceProParamName == "ConveyorLineSingal"); |
| | | DeviceProDTO? deviceProDTOt2 = conveyorLine.DeviceProDTOs.Find(x => x.DeviceChildCode == TargetAddress && x.DeviceProParamName == "ResponState"); |
| | | if (conveyorLine.Communicator.Read<short>(deviceProDTOt.DeviceProAddress)==1) |
| | |
| | | return WebResponseContent.Instance.Error("读åå°åè£
ä½ä¿¡å·åé¦ä¸å¯æ¾è´§ï¼ä¸å¯çæagvä»»å¡"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public WebResponseContent SetPlcPalletCode(SaveModel saveModel) |
| | | { |
| | | WebResponseContent webResponse = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (saveModel.DelKeys.Count != 2) |
| | | { |
| | | return webResponse.Error("wcsä¼ åé误ï¼"); |
| | | } |
| | | string AddStitic = saveModel.DelKeys[0].ToString(); |
| | | if (AddStitic == "") return webResponse.Error("éæ©çç«å°ä¸ºç©ºï¼è¯·éæ©éæ©ç«å°ï¼"); |
| | | string PalletCode = saveModel.DelKeys[1].ToString(); |
| | | if (PalletCode == "") return webResponse.Error("è¾å
¥çæ¡ç 为空ï¼è¯·è¾å
¥æ¡ç ä¿¡æ¯ï¼"); |
| | | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1000"); |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | |
| | | bool setplc = false; |
| | | switch (AddStitic) |
| | | { |
| | | case "1010": |
| | | setplc = conveyorLine.Communicator.Write("DB5.914", (string)PalletCode); |
| | | break; |
| | | case "2015": |
| | | setplc = conveyorLine.Communicator.Write("DB5.434", (string)PalletCode); |
| | | break; |
| | | case "2017": |
| | | setplc = conveyorLine.Communicator.Write("DB5.554", (string)PalletCode); |
| | | break; |
| | | case "2021": |
| | | setplc = conveyorLine.Communicator.Write("DB5.794", (string)PalletCode); |
| | | break; |
| | | } |
| | | |
| | | if (setplc) |
| | | { |
| | | return webResponse.OK($"对{AddStitic}ç«å°åå
¥æ¡ç ï¼{PalletCode}ï¼æå"); |
| | | } |
| | | else |
| | | { |
| | | return webResponse.Error($"对{AddStitic}ç«å°åå
¥æ¡ç ï¼{PalletCode}ï¼å¤±è´¥"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return webResponse.Error($"é误信æ¯ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | } |