| | |
| | | import com.fasterxml.jackson.databind.cfg.CoercionInputShape; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.config.RemotesInfoProperties; |
| | | import com.vincent.rsf.server.api.entity.CommonResponse; |
| | |
| | | private SubsystemFlowTemplateServiceImpl subsystemFlowTemplateService; |
| | | @Autowired |
| | | private FlowStepTemplateServiceImpl flowStepTemplateService; |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | |
| | | /** |
| | |
| | | MissionTaskIssueParam missionTaskIssueParam = new MissionTaskIssueParam(flowStepInstance,subsystemFlowTemplate,flowStepTemplate); |
| | | |
| | | missionTaskIssueParam.setType(RcsTaskType.getTypeDesc(task.getTaskType())); |
| | | if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_IN.type)){ |
| | | boolean souSign = taskInstance.getSourceCode().matches("\\d+"); |
| | | if (souSign){ |
| | | WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(taskInstance.getSourceCode())); |
| | | if (Cools.isEmpty(warehouseAreas)){ |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getSourceCode())); |
| | | if (Cools.isEmpty(basStation)){ |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .apply("station_alias != '[]'") // 不是空数组 |
| | | .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getSourceCode()) |
| | | .eq(BasStation::getDeleted, 0) // 通常需要加上未删除条件 |
| | | .last("LIMIT 1")); |
| | | } |
| | | if (Cools.isEmpty(basStation)){ |
| | | flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1); |
| | | if (flowStepInstance.getRetryTimes()>5){ |
| | | flowStepInstance.setStatus((short)4); |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,源点未查询到,重试次数大于等于五次,标记为失败!!!"); |
| | | } else { |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,源点未查询到目标点未查询到,等待重试...."); |
| | | } |
| | | return; |
| | | } else { |
| | | missionTaskIssueParam.setSourceCode(basStation.getStationName()); |
| | | } |
| | | } else { |
| | | missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode()); |
| | | } |
| | | } else { |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getSourceCode())); |
| | | if (Cools.isEmpty(basStation)){ |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .apply("station_alias != '[]'") // 不是空数组 |
| | | .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getSourceCode()) |
| | | .eq(BasStation::getDeleted, 0) // 通常需要加上未删除条件 |
| | | .last("LIMIT 1")); } |
| | | if (Cools.isEmpty(basStation)){ |
| | | flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1); |
| | | if (flowStepInstance.getRetryTimes()>5){ |
| | | flowStepInstance.setStatus((short)4); |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,源点未查询到,重试次数大于等于五次,标记为失败!!!"); |
| | | } else { |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,源点未查询到目标点未查询到,等待重试...."); |
| | | } |
| | | return; |
| | | } else { |
| | | missionTaskIssueParam.setSourceCode(basStation.getStationName()); |
| | | } |
| | | } |
| | | boolean endSign = taskInstance.getTargetCode().matches("\\d+"); |
| | | if (endSign){ |
| | | WarehouseAreas warehouseAreas = warehouseAreasService.getById(Long.parseLong(taskInstance.getTargetCode())); |
| | | if (Cools.isEmpty(warehouseAreas)){ |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getTargetCode())); |
| | | if (Cools.isEmpty(basStation)){ |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .apply("station_alias != '[]'") // 不是空数组 |
| | | .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getTargetCode()) |
| | | .eq(BasStation::getDeleted, 0) // 通常需要加上未删除条件 |
| | | .last("LIMIT 1")); } |
| | | if (Cools.isEmpty(basStation)){ |
| | | flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1); |
| | | if (flowStepInstance.getRetryTimes()>5){ |
| | | flowStepInstance.setStatus((short)4); |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,目标点未查询到,重试次数大于等于五次,标记为失败!!!"); |
| | | } else { |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,目标点未查询到,等待重试...."); |
| | | } |
| | | return; |
| | | } else { |
| | | missionTaskIssueParam.setTargetCode(basStation.getStationName()); |
| | | } |
| | | |
| | | missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode()); |
| | | missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode()); |
| | | missionTaskIssueParam.setLocNo(task.getTargLoc()); |
| | | missionTaskIssueParam.setSourcelocNo(task.getOrgLoc()); |
| | | missionTaskIssueParam.setSourcestaNo(task.getOrgSite()); |
| | | missionTaskIssueParam.setStaNo(task.getTargSite()); |
| | | missionTaskIssueParam.setBarcode(task.getBarcode()); |
| | | missionTaskIssueParam.setTaskPri(task.getSort()); |
| | | } else { |
| | | missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode()); |
| | | } |
| | | } else { |
| | | BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, taskInstance.getTargetCode())); |
| | | if (Cools.isEmpty(basStation)){ |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .apply("station_alias != '[]'") // 不是空数组 |
| | | .apply("JSON_CONTAINS(station_alias, '\"{0}\"') = 1", taskInstance.getTargetCode()) |
| | | .eq(BasStation::getDeleted, 0) // 通常需要加上未删除条件 |
| | | .last("LIMIT 1")); } |
| | | if (Cools.isEmpty(basStation)){ |
| | | flowStepInstance.setRetryTimes(flowStepInstance.getRetryTimes() + 1); |
| | | if (flowStepInstance.getRetryTimes()>5){ |
| | | flowStepInstance.setStatus((short)4); |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,目标点未查询到,重试次数大于等于五次,标记为失败!!!"); |
| | | } else { |
| | | flowStepInstanceService.updateById(flowStepInstance); |
| | | log.error("任务下发失败,目标点未查询到,等待重试...."); |
| | | } |
| | | return; |
| | | } else { |
| | | missionTaskIssueParam.setTargetCode(basStation.getStationName()); |
| | | } |
| | | } |
| | | |
| | | missionTaskIssueParam.setLocNo(task.getTargLoc()); |
| | | missionTaskIssueParam.setSourcelocNo(task.getOrgLoc()); |
| | | missionTaskIssueParam.setSourcestaNo(task.getOrgSite()); |
| | | missionTaskIssueParam.setStaNo(task.getTargSite()); |
| | | missionTaskIssueParam.setBarcode(task.getBarcode()); |
| | | missionTaskIssueParam.setTaskPri(task.getSort()); |
| | | } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_OUT.type)){ |
| | | missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode()); |
| | | missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode()); |
| | | } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_TRANSFER.type)){ |
| | | missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode()); |
| | | missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode()); |
| | | } else if (missionTaskIssueParam.getType().equals(RcsTaskType.RCS_TASK_TYPE_ENUM_STA.type)){ |
| | | missionTaskIssueParam.setSourceCode(taskInstance.getSourceCode()); |
| | | missionTaskIssueParam.setTargetCode(taskInstance.getTargetCode()); |
| | | } |
| | | |
| | | /**任务下发接口*/ |
| | | String pubTakUrl = wmsOpenApi.getHost() + ":" + wmsOpenApi.getPort() + RcsConstant.MISSION_TRANSFER_STATION; |
| | | |