diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 055e5df6..6efc5c19 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -119,7 +119,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public HttpResponse feedDeviceStatusType(JSONObject param) { - log.info("acs开始向mes反馈设备状态,请求参数:{}", JSON.toJSONString(param)); + // log.info("acs开始向mes反馈设备状态,请求参数:{}", JSON.toJSONString(param)); try { MDC.put(log_file_type, log_type); if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { @@ -132,9 +132,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result = HttpRequest.post(url) .body(JSON.toJSONString(param)) .execute(); - log.info("acs向mes反馈设备状态成功,请求参数:{},请求路径:{},响应参数:{}", JSON.toJSONString(param), url, JSON.toJSONString(result)); + // log.info("acs向mes反馈设备状态成功,请求参数:{},请求路径:{},响应参数:{}", JSON.toJSONString(param), url, JSON.toJSONString(result)); } catch (Exception e) { - log.error("acs向mes反馈设备状态失败,请求参数:{},请求路径:{},失败原因:{}", JSON.toJSONString(param), url, e.getMessage()); + //log.error("acs向mes反馈设备状态失败,请求参数:{},请求路径:{},失败原因:{}", JSON.toJSONString(param), url, e.getMessage()); } return result; } diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java b/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java index e29b78d7..0baa826f 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/TaskService.java @@ -175,7 +175,7 @@ public interface TaskService { * * @param ids */ - Instruction createInst(String ids) throws Exception; + void createInst(String ids) throws Exception; /** diff --git a/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 2778979d..adfb3b2c 100644 --- a/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/wcs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -35,6 +35,7 @@ import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.exception.WDKException; +import org.nl.modules.wql.util.SpringContextHolder; import org.nl.modules.wql.util.WqlUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; @@ -557,70 +558,35 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } @Override - public Instruction createInst(String ids) throws Exception { - return null; -// TaskDto acsTask = this.findById(ids); -// if (acsTask == null) throw new BadRequestException("被删除或无权限,操作失败!"); -// InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); -// InstructionDto inst = instructionservice.findByTaskId(ids, "instruction_status < 2 "); -// if (inst != null) throw new BadRequestException("有指令未完成!"); -// String link_no = CodeUtil.getNewCode("LINK_NO"); -// String taskid = acsTask.getTask_id(); -// String taskcode = acsTask.getTask_code(); -// String vehiclecode = acsTask.getVehicle_code(); -// String priority = acsTask.getPriority(); -// String material = acsTask.getMaterial(); -// String start_point_code = acsTask.getStart_point_code(); -// String start_device_code = acsTask.getStart_device_code(); -// String route_plan_code = acsTask.getRoute_plan_code(); -// String vehicleType = acsTask.getVehicle_type(); -// //是否复合任务 =0非复合任务 -// String compound_task = acsTask.getCompound_task(); -// String next_point_code = acsTask.getNext_point_code(); -// String next_device_code = acsTask.getNext_device_code(); -// String agv_system_type = acsTask.getAgv_system_type(); -// String put_device_code = acsTask.getPut_device_code(); -// String put_point_code = acsTask.getPut_point_code(); -// String remark = acsTask.getRemark(); -// String task_type = acsTask.getTask_type(); -// String quantity = acsTask.getQuantity(); -// String is_send = acsTask.getIs_send(); -// if (StrUtil.equals(is_send, "0")) { -// throw new BadRequestException("is_send"); -// } -// Instruction instdto = new Instruction(); -// instdto.setInstruction_type(task_type); -// instdto.setInstruction_id(IdUtil.simpleUUID()); -// instdto.setRoute_plan_code(route_plan_code); -// instdto.setRemark(remark); -// instdto.setLink_num(link_no); -// instdto.setMaterial(material); -// instdto.setQuantity(quantity); -// instdto.setPut_device_code(put_device_code); -// instdto.setPut_point_code(put_point_code); -// instdto.setAgv_system_type(agv_system_type); -// instdto.setTask_id(taskid); -// instdto.setTask_code(taskcode); -// instdto.setVehicle_code(vehiclecode); -// String now = DateUtil.now(); -// String currentUsername = SecurityUtils.getCurrentUsername(); -// instdto.setCreate_time(now); -// instdto.setCreate_by(currentUsername); -// instdto.setStart_device_code(start_device_code); -// instdto.setNext_device_code(next_device_code); -// instdto.setStart_point_code(start_point_code); -// instdto.setNext_point_code(next_point_code); -// instdto.setPriority(priority); -// instdto.setInstruction_status("0"); -// instdto.setExecute_device_code(start_point_code); -// instdto.setVehicle_type(vehicleType); -// instructionservice.create(instdto); -// //创建指令后修改任务状态 -// acsTask.setTask_status("1"); -// acsTask.setTask_type("2"); -// acsTask.setLink_num(link_no); -// this.update(acsTask); -// return instdto; + public void createInst(String ids) throws Exception { + TaskDto acsTask = this.findById(ids); + if (acsTask == null) throw new BadRequestException("被删除或无权限,操作失败!"); + List tasksByLinkNum = this.findByLinkNumFromCache(acsTask.getLink_num()); + String link_no = CodeUtil.getNewCode("LINK_NO"); + if (tasksByLinkNum.size() == 1) { + TaskDto taskDto = tasksByLinkNum.get(0); + Instruction instruction = instructionService.findByTaskCodeFromCache(taskDto.getTask_code()); + if (instruction != null) { + throw new BadRequestException("单任务有指令未完成!指令号:" + instruction.getInstruction_code()); + } + Instruction dto = instructionService.createInstDtoByTask(taskDto, link_no); + instructionService.create(dto); + } + if (tasksByLinkNum.size() == 2) { + TaskDto taskDto1 = tasksByLinkNum.get(0); + Instruction inst1 = instructionService.findByTaskCodeFromCache(taskDto1.getTask_code()); + if (inst1 != null) { + throw new BadRequestException("双任务存有指令未完成!指令号:" + inst1.getInstruction_code()); + } + TaskDto taskDto2 = tasksByLinkNum.get(1); + Instruction inst2 = instructionService.findByTaskCodeFromCache(taskDto2.getTask_code()); + if (inst2 != null) { + throw new BadRequestException("双任务有指令未完成!指令号:" + inst2.getInstruction_code()); + } + Instruction dto1 = instructionService.createInstDtoByTask(taskDto1, link_no); + Instruction dto2 = instructionService.createInstDtoByTask(taskDto2, link_no); + instructionService.createTwoInst(dto1, dto2); + } } @Override