| | |
| | | } |
| | | Set<String> locs = binds.stream().map(LocAroundBind::getBLocNo).collect(Collectors.toSet()); |
| | | |
| | | reportLockLocs(locs); |
| | | reportLockLocs(locs, "lock"); |
| | | |
| | | return R.ok("上报成功!!"); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public R pubWrkToWcs(WorkTaskParams params) { |
| | | if (Objects.isNull(params.getTaskNo())) { |
| | | return R.error("任务号不能为空!!"); |
| | | } |
| | | 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; |
| | | } |
| | | String response; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(url) |
| | | .setJson(JSON.toJSONString(params)) |
| | | .build() |
| | | .doPost(); |
| | | R result = JSON.parseObject(response, R.class); |
| | | |
| | | |
| | | |
| | | if (result.get("code").equals("200")) { |
| | | //TODO 上报是否成功 |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 上报锁定库位信息 |
| | | * 上报锁定/释放库位信息 |
| | | * @author Ryan |
| | | * @date 2026/1/10 12:50 |
| | | * @param locs |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void reportLockLocs(Set<String> locs) { |
| | | public void reportLockLocs(Set<String> locs, String type) { |
| | | String url = MesConstant.LOCK_LOCS_URL; |
| | | if (!Objects.isNull(type)) { |
| | | if (type.equals("release")) { |
| | | url = MesConstant.RELEASE_LOCS_URL; |
| | | } |
| | | } |
| | | String response; |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.LOCK_LOCS_URL) |
| | | .setPath(url) |
| | | .setJson(JSON.toJSONString(locs)) |
| | | .build() |
| | | .doPost(); |