| | |
| | | |
| | | /** |
| | | * 通知WCS锁定库位,及禁止当前库位的一切操作 |
| | | * @author Ryan |
| | | * @date 2026/1/10 11:18 |
| | | * |
| | | * @param params |
| | | * @return com.core.common.R |
| | | * @author Ryan |
| | | * @date 2026/1/10 11:18 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | /** |
| | | * 余料回库 (搬运余料回库) |
| | | * @author Ryan |
| | | * @date 2026/1/10 13:19 |
| | | * |
| | | * @param params |
| | | * @return com.core.common.R |
| | | * @author Ryan |
| | | * @date 2026/1/10 13:19 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | // throw new CoolException("配对任务编码错误,请检查后重新上传!!"); |
| | | // } |
| | | WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", params.getWrkNo())); |
| | | if (Objects.isNull(mast)) { |
| | | throw new CoolException("任务不存在!!"); |
| | | } |
| | | if (Objects.isNull(mast)) { |
| | | throw new CoolException("任务不存在!!"); |
| | | } |
| | | // if (!mast.getWrkSts().equals(103L)) { |
| | | // throw new CoolException("当前任务并非余料出库任务!!"); |
| | | // } |
| | |
| | | // } |
| | | workService.backLocOperation(mast.getWrkNo() + "", mast.getAppeUser()); |
| | | |
| | | return R.ok("接收成功,执行回库中..."); |
| | | return R.ok("接收成功,执行回库中..."); |
| | | } |
| | | |
| | | /** |
| | | * 下发任务至WCS |
| | | * @author Ryan |
| | | * @date 2026/1/10 13:58 |
| | | * |
| | | * @param params |
| | | * @return com.core.common.R |
| | | * @author Ryan |
| | | * @date 2026/1/10 13:58 |
| | | */ |
| | | @Override |
| | | public R pubWrkToWcs(WorkTaskParams params) { |
| | |
| | | } |
| | | String response; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(url) |
| | | .setJson(JSON.toJSONString(params)) |
| | |
| | | |
| | | /** |
| | | * 上报锁定/释放库位信息 |
| | | * |
| | | * @param locs |
| | | * @author Ryan |
| | | * @date 2026/1/10 12:50 |
| | | * @param locs |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | String response; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(url) |
| | | .setJson(JSON.toJSONString(locs)) |
| | | .build() |
| | | .doPost(); |
| | | R result = JSON.parseObject(response, R.class); |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(url) |
| | | .setJson(JSON.toJSONString(locs)) |
| | | .build() |
| | | .doPost(); |
| | | R result = JSON.parseObject(response, R.class); |
| | | |
| | | if (result.get("code").equals("200")) { |
| | | if (result.get("code").equals("200")) { |
| | | //TODO 上报是否成功 |
| | | } |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 堆垛机执行状态上报 |
| | | * @author Ryan |
| | | * @date 2026/1/10 16:30 |
| | | * |
| | | * @param params |
| | | * @return com.core.common.R |
| | | * @author Ryan |
| | | * @date 2026/1/10 16:30 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | if (Objects.isNull(mast)) { |
| | | throw new CoolException("任务档不存在!!"); |
| | | } |
| | | if ( params.getNotifyType().equals("task")) { |
| | | if (params.getNotifyType().equals("task")) { |
| | | //任务 |
| | | if (params.getMsgType().equals("task_complete")) { |
| | | mast.setWrkSts(4L); |
| | | if (!wrkMastService.updateById(mast)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } else if (params.getMsgType().equals("task_cancel")){ |
| | | } else if (params.getMsgType().equals("task_cancel")) { |
| | | |
| | | } |
| | | } else if (params.getNotifyType().equals("weight")) { |
| | |
| | | throw new CoolException("物料基础信息不存在!!"); |
| | | } |
| | | Double val = Math.round((params.getWeight() - matnr.getSafeQty()) * 10000) / 10000.0; |
| | | if (val.compareTo(0.0) > 0) { |
| | | //余料长度 |
| | | wrkDetl.setRealQty(val * matnr.getVolume()); |
| | | |
| | | } else { |
| | | //空板 |
| | | wrkDetl.setRealQty(0.0); |
| | | } |
| | | |
| | | Double realQty = val * matnr.getVolume(); |
| | | // if (val.compareTo(0.0) > 0) { |
| | | // //余料长度 |
| | | // wrkDetl.setRealQty(realQty); |
| | | // } else { |
| | | // //空板 |
| | | // wrkDetl.setRealQty(0.0); |
| | | // } |
| | | wrkDetl.setAnfme(realQty); |
| | | wrkDetl.setWeight(params.getWeight()); |
| | | if (!wrkDetlService.update(wrkDetl, new EntityWrapper<WrkDetl>().eq("wrk_no", mast.getWrkNo()).eq("matnr", wrkDetl.getMatnr()).eq("barcode", wrkDetl.getBarcode()))) { |
| | | throw new CoolException("任务档明细修改失败!!"); |
| | | } |
| | | // 更新原出库单 |
| | | int indexOf = mast.getWrkCode().indexOf("-1"); |
| | | if (indexOf != -1) { |
| | | String wrkNo = mast.getWrkCode().substring(0, indexOf); |
| | | WrkMast orgWrk = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", wrkNo)); |
| | | if (Objects.isNull(orgWrk)) { |
| | | throw new CoolException("数据错误,主任务档不存在或已删除!!"); |
| | | } |
| | | WrkDetl detl = wrkDetlService.selectOne(new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo)); |
| | | if (Objects.isNull(detl)) { |
| | | throw new CoolException("子任务档明细不存在!!"); |
| | | } |
| | | Double v = Math.round((wrkDetl.getStockQty() - realQty) * 10000) / 10000.0; |
| | | detl.setRealQty(v); |
| | | detl.setWeight(params.getWeight()); |
| | | if (!wrkDetlService.update(detl, new EntityWrapper<WrkDetl>().eq("wrk_no", wrkNo).eq("matnr", detl.getMatnr()).eq("barcode", detl.getBarcode()))) { |
| | | throw new CoolException("原任务档明细修改失败!!"); |
| | | } |
| | | } else { |
| | | throw new CoolException("任务号截取失败,请检查主任务档任档wrkCode字段"); |
| | | } |
| | | } |
| | | } else { |
| | | throw new CoolException("数据错误,当前任务状态有误 !"); |