| | |
| | | private MatnrMapper matnrMapper; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private CusBarcodeSyncMatnrService cusBarcodeSyncMatnrService; |
| | | |
| | | |
| | | /** |
| | |
| | | throw new CoolException("无订单组托时物料ID不能为空!!"); |
| | | } |
| | | Matnr matnr = matnrMapper.selectById(pakinItem1.getMatnrId()); |
| | | if (matnr == null) { |
| | | throw new CoolException("物料信息不存在,物料ID:" + pakinItem1.getMatnrId()); |
| | | } |
| | | cusBarcodeSyncMatnrService.syncFromMatnrCodes(Collections.singletonList(matnr.getCode()), userId); |
| | | matnr = matnrMapper.selectById(pakinItem1.getMatnrId()); |
| | | if (matnr == null) { |
| | | throw new CoolException("物料信息不存在,物料ID:" + pakinItem1.getMatnrId()); |
| | | } |
| | |
| | | |
| | | for (PakinItem pakinItem1 : waitPakin.getItems()) { |
| | | WaitPakinItem pakinItem = new WaitPakinItem(); |
| | | if (StringUtils.isBlank(pakinItem1.getAsnCode())) { |
| | | // 原逻辑:if (StringUtils.isBlank(pakinItem1.getAsnCode())) { ... } else { 按单据限制 ... } |
| | | // 只有单据号存在且能查到单据时才按单据限制 |
| | | WkOrder bindOrder = StringUtils.isBlank(pakinItem1.getAsnCode()) ? null : |
| | | asnOrderService.getOne(new LambdaQueryWrapper<WkOrder>().eq(WkOrder::getCode, pakinItem1.getAsnCode())); |
| | | if (bindOrder == null) { |
| | | if (Objects.isNull(pakinItem1.getMatnrId())) { |
| | | throw new CoolException("物料ID不能为空!!"); |
| | | } |
| | |
| | | if (null == orderItem) { |
| | | throw new CoolException("订单明细不存在!!"); |
| | | } |
| | | WkOrder order = asnOrderService.getById(orderItem.getOrderId()); |
| | | if (null == order) { |
| | | throw new CoolException("订单不存在!!"); |
| | | WkOrder order = bindOrder; |
| | | if (orderItem.getOrderId() == null || !orderItem.getOrderId().equals(order.getId())) { |
| | | throw new CoolException("物料不在当前单据中,不能按单据组托!!"); |
| | | } |
| | | pakinItem.setAnfme(QuantityUtils.roundToScale(orderItem.getAnfme())) |
| | | .setPakinId(waitPakin1.getId()) |