| | |
| | | OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), |
| | | elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), |
| | | DetlDto detlDto = new DetlDto(order.getOrderNo(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), |
| | | elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), |
| | | elem.getThreeCode()); |
| | | detlDto.setOrderId(order.getId()); |
| | | detlDto.setOrderNo(order.getOrderNo()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | if (DetlDto.hasOrder(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | assert one != null; |
| | | one.setAnfme(one.getAnfme() + detlDto.getAnfme()); |
| | |
| | | try { |
| | | response = new HttpHandler.Builder() |
| | | .setUri(MesConstant.URL) |
| | | .setPath(MesConstant.PACK_DOWN_URL) |
| | | .setPath(MesConstant.IN_DISPATCH_RESULT) |
| | | .setJson(JSON.toJSONString(mesCombParam)) |
| | | .build() |
| | | .doPost(); |
| | |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | success = true; |
| | | } else if (jsonObject.getInteger("code").equals(500)) { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT, |
| | | JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException(jsonObject.getString("msg")); |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.PACK_DOWN_URL, |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT, |
| | | JSON.toJSONString(mesCombParam), response); |
| | | throw new CoolException("上报mes系统失败"); |
| | | } |
| | |
| | | // 保存接口日志 |
| | | apiLogService.save( |
| | | "打包下线帮托上报", |
| | | MesConstant.URL + MesConstant.PACK_DOWN_URL, |
| | | MesConstant.URL + MesConstant.IN_DISPATCH_RESULT, |
| | | null, |
| | | "127.0.0.1", |
| | | JSON.toJSONString(mesCombParam), |
| | |
| | | throw new CoolException("数据错误,站点不存在!!"); |
| | | } |
| | | station.setLocSts(LocStsType.LOC_STS_TYPE_O.type); |
| | | station.setBarcode(null); |
| | | station.setBarcode(""); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态更新失败!!"); |
| | | } |
| | |
| | | } |
| | | |
| | | station.setLocSts(LocStsType.LOC_STS_TYPE_O.type); |
| | | station.setBarcode(null); |
| | | station.setBarcode(""); |
| | | if (!basStationService.updateById(station)) { |
| | | throw new CoolException("站点状态修改失败!"); |
| | | } |
| | |
| | | .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type) |
| | | .orderAsc(Arrays.asList("row1", "bay1", "lev1")) |
| | | .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY")); |
| | | |
| | | if (Objects.isNull(locMast)) { |
| | | throw new CoolException("未查询到可用的空板信息!!"); |
| | | } |
| | | |
| | | CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls); |
| | | locMasts.add(crnTaskDetlDTO); |
| | | |
| | | // 空板出库 |
| | | generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station); |
| | | } |
| | |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) { |
| | | List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Objects.isNull(pakins) || pakins.isEmpty()) { |
| | | throw new CoolException("组托信息不存在!!"); |
| | | } |
| | | |
| | | List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode)); |
| | | if (!tasks.isEmpty()) { |
| | | throw new CoolException("托盘已在任务执行中.."); |
| | |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | for (WaitPakin pakin : pakins) { |
| | | TaskDetl wrkDetl = new TaskDetl(); |
| | | BeanUtils.copyProperties(pakin, wrkDetl); |
| | | wrkDetl.setId(null).setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setOrderNo(pakin.getOrderNo()) |
| | | .setAnfme(pakin.getAnfme()) |
| | | .setZpallet(pakin.getZpallet()) |
| | | .setBatch(pakin.getBatch()) |
| | | .setMatnr(pakin.getMatnr()) |
| | | .setMaktx(pakin.getMaktx()) |
| | | .setAppeUser(userId) |
| | | .setUnit(pakin.getUnit()) |
| | | .setModel(pakin.getModel()) |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId); |
| | | if (!taskDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | if (!type.equals("agv_back")) { |
| | | List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Objects.isNull(pakins) || pakins.isEmpty()) { |
| | | throw new CoolException("组托信息不存在!!"); |
| | | } |
| | | |
| | | } |
| | | for (WaitPakin pakin : pakins) { |
| | | TaskDetl wrkDetl = new TaskDetl(); |
| | | BeanUtils.copyProperties(pakin, wrkDetl); |
| | | wrkDetl.setId(null).setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setOrderNo(pakin.getOrderNo()) |
| | | .setAnfme(pakin.getAnfme()) |
| | | .setZpallet(pakin.getZpallet()) |
| | | .setBatch(pakin.getBatch()) |
| | | .setMatnr(pakin.getMatnr()) |
| | | .setMaktx(pakin.getMaktx()) |
| | | .setAppeUser(userId) |
| | | .setUnit(pakin.getUnit()) |
| | | .setModel(pakin.getModel()) |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId); |
| | | if (!taskDetlService.insert(wrkDetl)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | | } |
| | | |
| | | for (WaitPakin pakin : pakins) { |
| | | pakin.setIoStatus("Y"); |
| | | if (!waitPakinService.updateById(pakin)) { |
| | | throw new CoolException("更新组托信息失败"); |
| | | } |
| | | |
| | | for (WaitPakin pakin : pakins) { |
| | | pakin.setIoStatus("Y"); |
| | | if (!waitPakinService.updateById(pakin)) { |
| | | throw new CoolException("更新组托信息失败"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type) || station.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) { |
| | | station.setLocSts("R"); // S.入库预约 |
| | | // station.setBarcode(barcode); |
| | | station.setBarcode(barcode); |
| | | station.setModiTime(new Date()); |
| | | station.setModiUser(userId); |
| | | if (!basStationService.updateById(station)) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 呼叫AGV返回 |
| | | * 呼叫AGV空台车返回 |
| | | * @author Ryan |
| | | * @date 2025/9/24 |
| | | * @param callAgvBackParam |
| | |
| | | if (Objects.isNull(locCache)) { |
| | | return R.error("未查询到可用库位"); |
| | | } |
| | | |
| | | |
| | | // 修改目标站点信息 |
| | | BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite())); |
| | | if (Objects.isNull(station)) { |
| | | throw new CoolException("站点不存在!!"); |
| | | } |
| | | |
| | | try { |
| | | generateAgvTask("agv", locCache, callAgvBackParam.getOrgSite(), callAgvBackParam.getBarcode(), userId); |
| | | //空台车回库 |
| | | generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.error(e.getMessage()); |