| | |
| | | import com.zy.iot.entity.IotFeedbackMessage; |
| | | import com.zy.iot.entity.IotInstructionMessage; |
| | | import com.zy.iot.entity.IotPublishRecord; |
| | | import com.zy.iot.service.IotDbConfigService; |
| | | import com.zy.iot.service.IotPublishRecordService; |
| | | import com.zy.iot.util.IotInstructionIdGenerator; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | private IotPublishRecordService iotPublishRecordService; |
| | | @Autowired |
| | | private IotProperties iotProperties; |
| | | @Autowired |
| | | private IotDbConfigService iotDbConfigService; |
| | | @Autowired |
| | | private ExternalTaskFacadeService externalTaskFacadeService; |
| | | @Autowired |
| | |
| | | } |
| | | |
| | | String remoteDestination = extractFirstDestination(message.getDestinationLocationIds()); |
| | | Integer stationId = Cools.isEmpty(remoteDestination) ? null : iotProperties.getPickStationMappings().get(remoteDestination); |
| | | // Integer stationId = Cools.isEmpty(remoteDestination) ? null : iotProperties.getPickStationMappings().get(remoteDestination); |
| | | Integer stationId =311; |
| | | if (stationId == null) { |
| | | return updateAsFailure(record, IotConstants.ERROR_CODE_STATION_MAPPING, "未找到目标出库口映射"); |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void queueWorkCompletion(WrkMast wrkMast) { |
| | | if (!iotProperties.isEnabled() || wrkMast == null || wrkMast.getWrkNo() == null) { |
| | | if (!iotDbConfigService.isMqttEnabled() || wrkMast == null || wrkMast.getWrkNo() == null) { |
| | | return; |
| | | } |
| | | IotPublishRecord existed = iotPublishRecordService.selectOne(new EntityWrapper<IotPublishRecord>() |
| | |
| | | feedbackMessage.setCreationTime(System.currentTimeMillis()); |
| | | |
| | | record.setFeedbackStatus(status); |
| | | record.setPublishTopic(iotProperties.getTopics().getIngressFeedback()); |
| | | record.setPublishTopic(iotDbConfigService.getEffectiveTopics().getIngressFeedback()); |
| | | record.setPublishPayload(JSON.toJSONString(feedbackMessage)); |
| | | record.setPublishStatus(IotConstants.PUBLISH_STATUS_PENDING); |
| | | record.setUpdateTime(now); |
| | |
| | | payload.setReferenceId(wrkMast.getUserNo()); |
| | | } |
| | | payload.setCreationTime(System.currentTimeMillis()); |
| | | return initOutboundRecord(wrkMast, IotConstants.MESSAGE_TYPE_STOW, iotProperties.getTopics().getIngressStow(), payload); |
| | | return initOutboundRecord(wrkMast, IotConstants.MESSAGE_TYPE_STOW, iotDbConfigService.getEffectiveTopics().getIngressStow(), payload); |
| | | } |
| | | |
| | | private IotPublishRecord buildPickOutboundRecord(WrkMast wrkMast, String containerId) { |
| | |
| | | payload.setReferenceId(wrkMast.getUserNo()); |
| | | } |
| | | payload.setCreationTime(System.currentTimeMillis()); |
| | | return initOutboundRecord(wrkMast, IotConstants.MESSAGE_TYPE_PICK, iotProperties.getTopics().getIngressPick(), payload); |
| | | return initOutboundRecord(wrkMast, IotConstants.MESSAGE_TYPE_PICK, iotDbConfigService.getEffectiveTopics().getIngressPick(), payload); |
| | | } |
| | | |
| | | private IotPublishRecord initOutboundRecord(WrkMast wrkMast, String messageType, String publishTopic, IotInstructionMessage payload) { |