| | |
| | | * @date 2026/1/10 13:58 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R pubWrkToWcs(WorkTaskParams params) { |
| | | if (Objects.isNull(params.getTaskNo())) { |
| | | return R.error("任务号不能为空!!"); |
| | | } |
| | | // if (params.getType().equals("in")) |
| | | // if (Objects.isNull(params.getBarcode())) { |
| | | // return R.error("托盘码不能为空!!"); |
| | | // } |
| | | // if (Objects.isNull(params.getLocNo())) { |
| | | // return R.error("目标库位不能为空!!"); |
| | | // } |
| | | String url = MesConstant.PUB_TASK_IN; |
| | | if (!Objects.isNull(params.getType()) && params.getType().equals("out")) { |
| | | url = MesConstant.PUB_TASK_OUT; |
| | | } |
| | | |
| | | log.info("出库任务下发参数:{}", JSON.toJSONString(params)); |
| | | String response; |
| | | try { |
| | |
| | | .doPost(); |
| | | Map<String, Object> result = JSON.parseObject(response, Map.class); |
| | | |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", params.getTaskNo())); |
| | | wrkMast.setWrkSts(12L); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("更新失败!!"); |
| | | } |
| | | if (result.get("code").equals(200)) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", params.getTaskNo())); |
| | | wrkMast.setWrkSts(12L); |
| | | wrkMastService.updateById(wrkMast); |
| | | //TODO 上报是否成功 |
| | | } else { |
| | | return R.error().add(result); |
| | | throw new CoolException("出库下发任务下发失败!!"); |
| | | // return R.error().add(result); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | |
| | | log.info("任务执行参数回写:{}", JSON.toJSONString(params)); |
| | | if (params.getNotifyType().equals("task")) { |
| | | //任务 |
| | | if (params.getMsgType().equals("task_complete")) { |
| | | if (mast.getIoType() == 1 || mast.getIoType() == 10 || mast.getIoType() == 53 || mast.getIoType() == 54 || mast.getIoType() == 57) { |
| | | if (params.getMsgType().equals("task_complete") || params.getMsgType().equals("station_out_task_run")) { |
| | | if (mast.getIoType() == 1 || mast.getIoType() == 11 || mast.getIoType() == 10 || mast.getIoType() == 53 || mast.getIoType() == 54 || mast.getIoType() == 57) { |
| | | mast.setWrkSts(4L); |
| | | } else if (mast.getIoType() == 101 || mast.getIoType() == 110 || mast.getIoType() == 103 || mast.getIoType() == 104 || mast.getIoType() == 107) { |
| | | mast.setWrkSts(14L); |