| | |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | |
| | | |
| | | @Autowired |
| | | private CommandInfoService commandInfoService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @RequestMapping(value = "/taskWrk/{wrkNo}/auth") |
| | | @ManagerAuth |
| | |
| | | if (taskWrk1 == null) { |
| | | return R.error(); |
| | | } |
| | | if ((taskWrk1.getIoType() == 1 || taskWrk1.getIoType() == 3) && taskWrk1.getWrkSts() >= 3 ){ |
| | | return R.error("任务已在执行,无法修改"); |
| | | } |
| | | if ((taskWrk1.getIoType() == 2 ) && taskWrk1.getWrkSts() >= 12 ){ |
| | | return R.error("任务已在执行,无法修改"); |
| | | } |
| | | if (Cools.isEmpty(taskWrk1.getStartPoint()) || Cools.isEmpty(taskWrk1.getTargetPoint())){ |
| | | return R.error("任务未分配库位,无法修改"); |
| | | } |
| | | |
| | | List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (!Cools.isEmpty(commandInfos)){ |
| | | for (CommandInfo commandInfo:commandInfos){ |
| | | commandInfoService.deleteById(commandInfo); |
| | | } |
| | | } |
| | | InetAddress localHost = InetAddress.getLocalHost(); |
| | | String ipAddress = localHost.getHostAddress(); |
| | | |
| | |
| | | taskWrk1.setOriginTargetPoint(Utils.getWmsLocNo(taskWrk.getTargetPoint())); |
| | | taskWrk1.setOriginStartPoint(Utils.getWmsLocNo(taskWrk.getStartPoint())); |
| | | } |
| | | taskWrk1.setStatus(1); |
| | | taskWrk1.setModiTime(new Date()); |
| | | taskWrk1.setModiUser(getUserId()); |
| | | |
| | |
| | | } |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("手动完成任务" |
| | | ,wmsUrl+"wcsManager/wcsInterface/inboundTaskApply" |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(taskOverToWms) |
| | | ,response |
| | | ,true |
| | | ); |
| | | if (jsonObject.getInteger("code").equals(200)){ |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (taskWrk.getStatus().equals(TaskStatusType.COMPLETE.id)) { |
| | | if (taskWrk.getStatus().equals(TaskStatusType.OVER.id)) { |
| | | return R.error(taskWrk.getTaskNo() + "已完结"); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.COMPLETE.id); |
| | | taskWrk.setStatus(TaskStatusType.OVER.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | try{ |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | |
| | | taskWrkService.updateById(taskWrk); |
| | | |
| | | |
| | | if (taskWrk.getIoType() == 1) { |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); |
| | | locMast.setLocSts("Z");//F.在库 |
| | | locMast.setBarcode(taskWrk.getBarcode());//托盘码 |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } else if (taskWrk.getIoType() == 2) { |
| | | //更新库位状态 |
| | | LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); |
| | | locMast.setLocSts("K");//O.空库位 |
| | | locMast.setBarcode("");//托盘码 |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(9999L); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | |
| | | |
| | | if (taskWrkService.saveToHistory(taskWrk.getTaskNo()) > 0) { |
| | | //任务已经转日志,将该任务下面的指令转日志 |
| | | commandInfoService.saveToHistory(taskWrk.getTaskNo()); |