| | |
| | | import com.zy.asrs.entity.CommandInfo; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.TaskWrkLog; |
| | | import com.zy.asrs.entity.param.NotifyDto; |
| | | import com.zy.asrs.entity.param.TaskOverToWms; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.CommandInfoService; |
| | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Value("${wms.taskStatusFeedbackPath}") |
| | | private String taskStatusFeedbackPath; |
| | | @Value("${wms.TaskExecCallback}") |
| | | private String TaskExecCallback; |
| | | |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | |
| | | String response=""; |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("status",taskWrk.getStatus()); |
| | | headParam.put("ioType",taskWrk.getIoType()); |
| | | headParam.put("barcode",taskWrk.getBarcode()); |
| | | headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | headParam.put("Result",1); |
| | | // headParam.put("reportTime",new Date()); |
| | | log.info("wcs手动完成任务上报wms={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setPath(TaskExecCallback) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs手动完成任务上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,wmsUrl+TaskExecCallback |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动完成任务上报wms失{},返回值={}", taskWrk,response); |
| | | throw new CoolException(e); |
| | | // throw new CoolException(e); |
| | | } |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//手动完成任务 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/taskWrk/returnWorkingCondition/auth") |
| | | @ManagerAuth(memo = "重新给堆垛机下发任务") |
| | | public R returnWorkingCondition(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts()==12){ |
| | | taskWrk.setWrkSts(11); |
| | | if(!taskWrkService.updateById(taskWrk)){ |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts()==3) { |
| | | taskWrk.setWrkSts(2); |
| | | taskWrkService.updateById(taskWrk); |
| | | if(!taskWrkService.updateById(taskWrk)){ |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | }else{ |
| | | return R.error("任务状态不对无法重新给堆垛机下发任务"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PostMapping(value = "/taskWrk/cancel/auth") |
| | |
| | | taskWrk.setModiUser(9999L);//操作员 |
| | | } |
| | | String response=""; |
| | | try{ |
| | | HashMap<String, Object> headParam = new HashMap<>(); |
| | | headParam.put("taskNo",taskWrk.getTaskNo()); |
| | | headParam.put("status",taskWrk.getStatus()); |
| | | headParam.put("ioType",taskWrk.getIoType()); |
| | | headParam.put("barcode",taskWrk.getBarcode()); |
| | | // headParam.put("reportTime",new Date()); |
| | | // try{ |
| | | // HashMap<String, Object> headParam = new HashMap<>(); |
| | | // headParam.put("TaskNo",taskWrk.getTaskNo()); |
| | | // headParam.put("Result",0); |
| | | //// headParam.put("reportTime",new Date()); |
| | | // |
| | | // log.info("wcs手动取消任务上报wm={}", taskWrk); |
| | | // response = new HttpHandler.Builder() |
| | | // // .setHeaders(headParam) |
| | | // .setUri(wmsUrl) |
| | | // .setPath(TaskExecCallback) |
| | | // .setJson(JSON.toJSONString(headParam)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // apiLogService.save("wcs手动取消任务上报wms" |
| | | // ,wmsUrl+TaskExecCallback |
| | | // ,null |
| | | // ,"127.0.0.1" |
| | | // ,JSON.toJSONString(headParam) |
| | | // ,response |
| | | // ,true |
| | | // ); |
| | | // }catch (Exception e){ |
| | | // log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response); |
| | | //// throw new CoolException(e); |
| | | // } |
| | | |
| | | log.info("wcs手动取消任务上报wm={}", taskWrk); |
| | | response = new HttpHandler.Builder() |
| | | // .setHeaders(headParam) |
| | | .setUri(wmsUrl) |
| | | .setPath(taskStatusFeedbackPath) |
| | | .setJson(JSON.toJSONString(headParam)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | apiLogService.save("wcs手动取消任务上报wms" |
| | | ,wmsUrl+taskStatusFeedbackPath |
| | | ,null |
| | | ,"127.0.0.1" |
| | | ,JSON.toJSONString(headParam) |
| | | ,response |
| | | ,true |
| | | ); |
| | | }catch (Exception e){ |
| | | log.error("wcs手动取消任务上报wms失败={},返回值={}", taskWrk,response); |
| | | throw new CoolException(e); |
| | | } |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping(value = "/taskWrk/state") |
| | | // @ManagerAuth(memo = "接收RCS任务状态") |
| | | public R taskWrkState(@RequestBody NotifyDto notifyDto) { |
| | | log.info("接收RCS任务状态={}", notifyDto); |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(notifyDto.getSuperTaskNo());//wms任务号 |
| | | if (taskWrk == null) { |
| | | return R.error("没有找到该任务={"+notifyDto+"}"); |
| | | } |
| | | Date now = new Date(); |
| | | if (notifyDto.getMsgType().equals("task_complete")) { |
| | | if (taskWrk.getIoType() == 1 || taskWrk.getIoType() == 3) { |
| | | taskWrk.setWrkSts(8);//更新数据 |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(9998L);//操作员 |
| | | taskWrkService.updateById(taskWrk); |
| | | } else if (taskWrk.getIoType() == 2) { |
| | | taskWrk.setWrkSts(18);//更新数据 |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(9998L);//操作员 |
| | | taskWrkService.updateById(taskWrk); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |