| | |
| | | } |
| | | |
| | | //StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta())); |
| | | if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null){ |
| | | boolean sign = true; |
| | | if (inSta.getBarcode() == 7 || inSta.getBarcode() == 8){ |
| | | |
| | | }else { |
| | | if (taskWrk.getCrnNo() != inSta.getBarcode()){ |
| | | sign = false; |
| | | } |
| | | } |
| | | if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && sign){ |
| | | if ( taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() == workNo ){ |
| | | continue; |
| | | } |
| | |
| | | taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode()); |
| | | taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode())); |
| | | taskWrk.setStartPoint(String.valueOf(inSta.getBackSta())); |
| | | if (inSta.getBarcode() == 7 || inSta.getBarcode() == 8){ |
| | | |
| | | }else { |
| | | taskWrk.setCrnNo(inSta.getBarcode()); |
| | | } |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | log.error("保存wms库位号失败"); |
| | | } |
| | |
| | | } else if (taskWrk.getIoType() == 2) { |
| | | taskWrk.setWrkSts(14); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setCompleteTime(now); |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | log.error(taskWrk.getTaskNo()+ " 堆垛机任务完成,改变任务状态失败"); |
| | | } |
| | |
| | | log.error("进入修改工作档流程"); |
| | | Date now = new Date(); |
| | | taskWrk.setWrkSts(3); |
| | | taskWrk.setExecuteTime(now); |
| | | taskWrk.setModiTime(now); |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | | } |
| | | TaskWrk taskWrk2 = taskWrkService.selectByWrkNo(staProtocol.getWorkNo().intValue()); |
| | | TaskWrk taskWrk2 = taskWrkService.selectByWrkNo(taskWrk.getWrkNo()); |
| | | |
| | | if (taskWrk2.getWrkSts() != 3){ |
| | | continue; |
| | |
| | | // 修改工作档状态 11.生成出库ID => 12.吊车出库中 |
| | | Date now = new Date(); |
| | | taskWrk.setWrkSts(12); |
| | | taskWrk.setExecuteTime(now); |
| | | taskWrk.setModiTime(now); |
| | | if (taskWrkMapper.updateById(taskWrk) == 0) { |
| | | log.error("修改工作档状态 11.生成出库ID => 12.吊车出库中 失败!!,工作号={}", taskWrk.getWrkNo()); |
| | |
| | | } |
| | | |
| | | //获取指令ID |
| | | Integer commandId = crnProtocol.getCommandId(); |
| | | CommandInfo commandInfo = new CommandInfo(); |
| | | if (Cools.isEmpty(commandId)){ |
| | | commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>() |
| | | .eq("wrk_no",crnProtocol.getTaskNo()) |
| | | .eq("device","Crn")); |
| | | }else { |
| | | commandInfo = commandInfoService.selectById(commandId); |
| | | } |
| | | // Integer commandId = crnProtocol.getCommandId(); |
| | | // CommandInfo commandInfo = new CommandInfo(); |
| | | // if (Cools.isEmpty(commandId)){ |
| | | // commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>() |
| | | // .eq("wrk_no",crnProtocol.getTaskNo()) |
| | | // .eq("device","Crn")); |
| | | // }else { |
| | | // commandInfo = commandInfoService.selectById(commandId); |
| | | // } |
| | | |
| | | |
| | | if (commandInfo == null) { |
| | | //指令不存在 |
| | | continue; |
| | | } |
| | | if (commandInfo.getCommandStatus() == 3){ |
| | | continue; |
| | | } |
| | | commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//指令完成 |
| | | commandInfo.setCompleteTime(new Date());//指令完成时间 |
| | | if (commandInfoService.updateById(commandInfo)) {//修改成功后复位堆垛机 |
| | | // if (commandInfo == null) { |
| | | // //指令不存在 |
| | | // continue; |
| | | // } |
| | | // if (commandInfo.getCommandStatus() == 3){ |
| | | // continue; |
| | | // } |
| | | // commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//指令完成 |
| | | // commandInfo.setCompleteTime(new Date());//指令完成时间 |
| | | // if (commandInfoService.updateById(commandInfo)) {//修改成功后复位堆垛机 |
| | | // 堆垛机复位 |
| | | crnThread.setResetFlag(true); |
| | | if (taskWrk.getIoType() == 1 || taskWrk.getIoType() == 3){ |
| | |
| | | } else if (taskWrk.getIoType() == 2) { |
| | | taskWrk.setWrkSts(14); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setCompleteTime(now); |
| | | if (!taskWrkService.updateById(taskWrk)){ |
| | | log.error(taskWrk.getTaskNo()+ " 堆垛机任务完成,改变任务状态失败"); |
| | | } |
| | | } |
| | | // } |
| | | } |
| | | } |
| | | } |
| | |
| | | public synchronized void autoCompleteTask() { |
| | | List<TaskWrk> taskWrks = taskWrkMapper.selectWorkingTask(); |
| | | for (TaskWrk taskWrk : taskWrks) { |
| | | //获取命令集合 |
| | | List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (taskWrk.getCommandStep() < commandInfos.size()) { |
| | | continue;//当前步序没有到达最后一条命令 |
| | | } |
| | | |
| | | //判断末端命令是否执行完成 |
| | | if (!commandInfos.isEmpty()){ |
| | | CommandInfo commandInfo = commandInfos.get(commandInfos.size() - 1); |
| | | if (commandInfo.getCommandStatus() != CommandStatusType.COMPLETE.id) { |
| | | continue;//指令未完成 |
| | | } |
| | | } |
| | | // //获取命令集合 |
| | | // List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | // if (taskWrk.getCommandStep() < commandInfos.size()) { |
| | | // continue;//当前步序没有到达最后一条命令 |
| | | // } |
| | | // |
| | | // //判断末端命令是否执行完成 |
| | | // if (!commandInfos.isEmpty()){ |
| | | // CommandInfo commandInfo = commandInfos.get(commandInfos.size() - 1); |
| | | // if (commandInfo.getCommandStatus() != CommandStatusType.COMPLETE.id) { |
| | | // continue;//指令未完成 |
| | | // } |
| | | // } |
| | | |
| | | |
| | | Date now = new Date(); |
| | | //指令已完成,更新任务 |
| | | if (taskWrk.getIoType() == 1) { |
| | | if (taskWrk.getIoType() == 1 && taskWrk.getWrkSts() == 5) { |
| | | //入库任务 |
| | | // taskWrk.setWrkSts(4);//3.吊车入库中 => 4.入库完成 |
| | | taskWrk.setStatus(TaskStatusType.OVER.id); |
| | |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } else if (taskWrk.getIoType() == 2) { |
| | | } else if (taskWrk.getIoType() == 2 && taskWrk.getWrkSts() == 15) { |
| | | //出库任务 |
| | | // taskWrk.setWrkSts(14);//12.吊车出库中 => 14.出库完成 |
| | | taskWrk.setStatus(TaskStatusType.OVER.id); |
| | |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } else if (taskWrk.getIoType() == 3) { |
| | | } else if (taskWrk.getIoType() == 3 && taskWrk.getWrkSts() == 5) { |
| | | |
| | | //更新起始库位状态 |
| | | LocMast locMastStart = locMastService.selectByLocNo(taskWrk.getStartPoint()); |