| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 移动端服务核心类 |
| | |
| | | } |
| | | // 判断是否有相同条码的数据 |
| | | if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>(). |
| | | eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) { |
| | | eq("zpallet", param.getBarcode()) |
| | | .eq("io_status", "N")) > 0) { |
| | | throw new CoolException(param.getBarcode() + "数据正在进行入库"); |
| | | } |
| | | |
| | |
| | | // 关联组托 |
| | | } else { |
| | | // Order order = orderService.selectByNo(param.getOrderNo()); |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo()); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 生成入库通知档 |
| | | List<DetlDto> detlDtos = new ArrayList<>(); |
| | | param.getCombMats().forEach(elem -> { |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, elem.getOrderNo()); |
| | | if (Cools.isEmpty(order) || order.getSettle() > 2) { |
| | | throw new CoolException("单据编号已过期"); |
| | | } |
| | | // 订单明细数量校验 |
| | | // OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | // elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3()); |
| | |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(), |
| | | elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme()); |
| | | detlDto.setOrderId(order.getId()); |
| | | detlDto.setOrderNo(order.getOrderNo()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.findDto(detlDtos, detlDto); |
| | | assert one != null; |
| | |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | BeanUtils.copyProperties(mat, waitPakin); |
| | | // waitPakin.sync(mat); |
| | | waitPakin.setOrderNo(order.getOrderNo()); // 单据编号 |
| | | waitPakin.setOrderId(order.getId()); |
| | | waitPakin.setOrderNo(detlDto.getOrderNo()); // 单据编号 |
| | | waitPakin.setOrderId(detlDto.getOrderId()); |
| | | waitPakin.setBatch(detlDto.getBatch()); // 序列码 |
| | | waitPakin.setZpallet(param.getBarcode()); // 托盘码 |
| | | waitPakin.setIoStatus("N"); // 入出状态 |
| | |
| | | throw new CoolException("保存入库通知档失败"); |
| | | } |
| | | } |
| | | // orderService.updateSettle(order.getId(), 2L, userId); |
| | | OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId); |
| | | |
| | | Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo).collect(Collectors.toSet()); |
| | | stringSet.forEach(orderNo -> { |
| | | Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, orderNo); |
| | | OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId); |
| | | }); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/24 |
| | | * @description: 获取订单物料信息 |
| | | * @version 1.0 |
| | | */ |
| | | @Override |
| | | public R getMatsByQRcode(PakinMatsByQRParams params) { |
| | | if (Objects.isNull(params)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(params.getOrderNo())) { |
| | | throw new CoolException("单号不能为空!!"); |
| | | } |
| | | OrderPakin orderPakin = orderPakinService.selectOne(new EntityWrapper<OrderPakin>().eq("order_no", params.getOrderNo())); |
| | | if (Objects.isNull(orderPakin)) { |
| | | throw new CoolException("数据错误:单据不存在!!"); |
| | | } |
| | | List<OrderDetlPakin> detlPakins = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>() |
| | | .eq(!Cools.isEmpty(params.getMatnr()), "matnr", params.getMatnr()) |
| | | .eq("order_id", orderPakin.getId())); |
| | | if (Objects.isNull(detlPakins) || detlPakins.isEmpty()) { |
| | | throw new CoolException("数据错误: 单据明细不存在!!"); |
| | | } |
| | | |
| | | return R.ok().add(detlPakins); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/22 |
| | | * @description: 生成AGV搬运任务 |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateAgvTask(String type, LocCache loc, String orgSite, String barcode, Long userId) { |
| | | WaitPakin pakin = waitPakinService.selectOne(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Objects.isNull(pakin)) { |
| | | List<WaitPakin> pakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode)); |
| | | if (Objects.isNull(pakins) || pakins.isEmpty()) { |
| | | throw new CoolException("组托信息不存在!!"); |
| | | } |
| | | OrderPakin orderPakin = orderPakinService.selectById(pakin.getOrderId()); |
| | | if (Objects.isNull(orderPakin)) { |
| | | throw new CoolException("单据不能为空!!"); |
| | | } |
| | | |
| | | List<OrderDetlPakin> detls = orderDetlPakinService.selectList(new EntityWrapper<OrderDetlPakin>().eq("order_id", pakin.getOrderId())); |
| | | if (Objects.isNull(detls) || detls.isEmpty()) { |
| | | throw new CoolException("数据错误:单据明细不存在!!"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | // 获取工作号 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PICK.type); |
| | | // 保存工作档 |
| | | Task task = new Task(); |
| | | task.setWrkNo(workNo) |
| | | .setIoTime(now) |
| | | .setIoTime(new Date()) |
| | | .setWrkSts(11L) // 工作状态:11.生成出库ID |
| | | .setIoType(11) // 入出库状态: 11.库格移载 |
| | | .setTaskType("agv") |
| | |
| | | .setFullPlt("Y") // 满板:Y |
| | | .setPicking("N") // 拣料 |
| | | .setExitMk("N")// 退出 |
| | | .setSourceLocNo(orgSite) |
| | | .setSourceStaNo(orgSite) |
| | | .setEmptyMk(loc.getLocSts().equals("D") ? "Y" : "N")// 空板 |
| | | .setBarcode(barcode)// 托盘码 |
| | | .setLinkMis("N") |
| | | .setAppeUser(userId) |
| | | .setAppeTime(now) |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId) |
| | | .setModiTime(now); |
| | | .setModiTime(new Date()); |
| | | if (!taskService.insert(task)) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | List<TaskDetl> taskDetls = new ArrayList<>(); |
| | | detls.forEach(detl -> { |
| | | pakins.forEach(pakin -> { |
| | | TaskDetl wrkDetl = new TaskDetl(); |
| | | BeanUtils.copyProperties(detl, wrkDetl); |
| | | BeanUtils.copyProperties(pakin, wrkDetl); |
| | | wrkDetl.setWrkNo(workNo) |
| | | .setIoTime(new Date()) |
| | | .setAnfme(detl.getAnfme()) |
| | | .setOrderNo(pakin.getOrderNo()) |
| | | .setAnfme(pakin.getAnfme()) |
| | | .setZpallet(pakin.getZpallet()) |
| | | .setBatch(detl.getBatch()) |
| | | .setMatnr(detl.getMatnr()) |
| | | .setMaktx(detl.getMaktx()) |
| | | .setBatch(pakin.getBatch()) |
| | | .setMatnr(pakin.getMatnr()) |
| | | .setMaktx(pakin.getMaktx()) |
| | | .setAppeUser(userId) |
| | | .setUnit(detl.getUnit()) |
| | | .setModel(detl.getModel()) |
| | | .setUnit(pakin.getUnit()) |
| | | .setModel(pakin.getModel()) |
| | | .setAppeTime(new Date()) |
| | | .setModiUser(userId); |
| | | taskDetls.add(wrkDetl); |
| | | }); |
| | | |
| | | //保存工作档明细 |
| | | if (!taskDetlService.insertBatch(taskDetls)) { |
| | | throw new CoolException("保存工作档明细失败"); |
| | |
| | | // 修改目标库位状态 |
| | | if (loc.getLocSts().equals("O")) { |
| | | loc.setLocSts("S"); // S.入库预约 |
| | | loc.setModiTime(now); |
| | | loc.setModiTime(new Date()); |
| | | loc.setModiUser(userId); |
| | | if (!locCacheService.updateById(loc)) { |
| | | throw new CoolException("更新目标库位状态失败"); |