| | |
| | | ApiResponse apiResponse = new ApiResponse(); |
| | | try |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1002"); |
| | | if (device == null) return apiResponse.ErrorResponse("WCSæªè½è·åå°åºå£å®ä¾"); |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | |
| | | |
| | | Dictionary<string, int> portStatusDict = new Dictionary<string, int>(); |
| | | |
| | | foreach (string DeStateName in datas) |
| | | { |
| | | string DeciceCodes = "1003"; |
| | | if (DeStateName.StartsWith("C")) DeciceCodes = "1004"; |
| | | |
| | | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeciceCodes); |
| | | if (device == null) return apiResponse.ErrorResponse("WCSæªè½è·åå°åºå£å®ä¾"); |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | |
| | | |
| | | //æ¯å¦å¯è¿åº |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == DeStateName && x.DeviceProParamName == "PermitHandShake"); |
| | | //æ¯å¦æè´§ |
| | |
| | | if (deviceProDTO == null || StationNumProDTO ==null) return apiResponse.ErrorResponse($"WCSæªæ¾å°åºå£ï¼{DeStateName},对åºçåè®®"); |
| | | |
| | | int statusValue = 0; |
| | | int portStatus = conveyorLine.Communicator.Read<int>(deviceProDTO.DeviceProAddress); |
| | | int StationStatus = conveyorLine.Communicator.Read<int>(StationNumProDTO.DeviceProAddress); |
| | | //1å
许å 2å
è®¸æ¾ |
| | | int portStatus = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | //æ¯å¦æè´§ |
| | | int StationStatus = conveyorLine.Communicator.Read<ushort>(StationNumProDTO.DeviceProAddress); |
| | | |
| | | //æè´§ï¼å¯è¿ä¿¡å· |
| | | statusValue = ((portStatus == 1 && StationStatus == 1) || (portStatus == 2 && StationStatus == 0)) ? 1 : (portStatus == 0) ? 0 : 0; |
| | |
| | | ApiResponse apiResponse = new ApiResponse(); |
| | | try |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1002"); |
| | | string DeciceCodes = "1003"; |
| | | if (agvUpdateRequest.warehousenumber.StartsWith("C")) DeciceCodes = "1004"; |
| | | |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == DeciceCodes); |
| | | if (device == null) return apiResponse.ErrorResponse("WCSæªè½è·åå°åºå£å®ä¾"); |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //æ¯å¦å¯è¿åº |
| | | DeviceProDTO? HandShake = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "HandShake"); |
| | | if (HandShake == null) return apiResponse.ErrorResponse($"WCSæªæ¾å°åºå£ï¼{agvUpdateRequest.warehousenumber},对åºçåè®®"); |
| | | |
| | | |
| | | |
| | | if (agvUpdateRequest.agvstatus == 1) |
| | | { |
| | | |
| | | |
| | | //æ¯å¦å¯è¿åº |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "PermitHandShake"); |
| | | //æ¯å¦æè´§ |
| | | DeviceProDTO? StationNumProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "StationNum"); |
| | | if (deviceProDTO == null || StationNumProDTO == null) return apiResponse.ErrorResponse($"WCSæªæ¾å°åºå£ï¼{agvUpdateRequest.warehousenumber},对åºçåè®®"); |
| | | int statusValue = 0; |
| | | int portStatus = conveyorLine.Communicator.Read<int>(deviceProDTO.DeviceProAddress); |
| | | int StationStatus = conveyorLine.Communicator.Read<int>(StationNumProDTO.DeviceProAddress); |
| | | //æè´§ï¼å¯è¿ä¿¡å· |
| | | statusValue = ((portStatus == 1 && StationStatus == 1) || (portStatus == 2 && StationStatus == 0)) ? 1 : (portStatus == 0) ? 0 : 0; |
| | | |
| | | if (statusValue == 1) |
| | | |
| | | {//åå
¥è¾éçº¿ä¿¡å· |
| | | bool HandShakebool = conveyorLine.Communicator.Write<short>(HandShake.DeviceProAddress, 1); |
| | | if (HandShakebool) |
| | | //åå
¥plcï¼agvè¿å
¥ä¿¡å· |
| | | bool HandShakebool = conveyorLine.Communicator.Write<short>(HandShake.DeviceProAddress, 1); |
| | | if (HandShakebool) |
| | | { |
| | | //æ¯å¦å¯è¿åº 1å
许å 2å
è®¸æ¾ |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "PermitHandShake"); |
| | | //æ¯å¦æè´§ |
| | | DeviceProDTO? StationNumProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == agvUpdateRequest.warehousenumber && x.DeviceProParamName == "StationNum"); |
| | | if (deviceProDTO == null || StationNumProDTO == null) return apiResponse.ErrorResponse($"WCSæªæ¾å°åºå£ï¼{agvUpdateRequest.warehousenumber},对åºçåè®®"); |
| | | int statusValue = 0; |
| | | int portStatus = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int StationStatus = conveyorLine.Communicator.Read<ushort>(StationNumProDTO.DeviceProAddress); |
| | | //æè´§ï¼å¯è¿ä¿¡å· |
| | | statusValue = ((portStatus == 1 && StationStatus == 1) || (portStatus == 2 && StationStatus == 0)) ? 1 : (portStatus == 0) ? 0 : 0; |
| | | if (statusValue == 1) |
| | | { |
| | | return apiResponse.SuccessResponse(); |
| | | } |
| | | else |
| | | { |
| | | return apiResponse.ErrorResponse("agvåå
¥plcç³è¯·å¤±è´¥"); |
| | | return apiResponse.ErrorResponse("读åplcä¸å¯è¿å
¥ä¿¡æ¯"); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return apiResponse.ErrorResponse("读åplcä¸å¯è¿å
¥ä¿¡æ¯"); |
| | | return apiResponse.ErrorResponse("åå
¥plcè¿å
¥ä¿¡å·å¤±è´¥"); |
| | | } |
| | | } |
| | | else if(agvUpdateRequest.agvstatus == 2) |