| | |
| | | @Override |
| | | public R operateToStock(OpStockParams params) { |
| | | if (org.apache.commons.lang3.StringUtils.isBlank(params.getBarcode())) { |
| | | throw new CoolException("拖盘码不能为空!!"); |
| | | throw new CoolException("托盘码不能为空!!"); |
| | | } |
| | | if (StringUtils.isBlank(params.getAsnCode())) { |
| | | throw new CoolException("单据不能为空!!"); |
| | | WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, params.getBarcode()) |
| | | .eq(WaitPakin::getIoStatus,PakinIOStatus.PAKIN_IO_STATUS_DONE.val) |
| | | ); |
| | | if (Cools.isEmpty(waitPakin)){ |
| | | throw new CoolException("未找到组托数据,请检查状态"); |
| | | } |
| | | if (StringUtils.isBlank(params.getMatnrCode())) { |
| | | throw new CoolException("物料编码不能为空!!"); |
| | | List<WaitPakinItem> waitPakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId())); |
| | | if (Cools.isEmpty(waitPakinItems)){ |
| | | throw new CoolException("数据错误,未找到组托明细"); |
| | | } |
| | | AsnOrder asnOrders = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, params.getAsnCode())); |
| | | if (Objects.isNull(asnOrders)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.getBarcode())); |
| | | if (!locs.isEmpty()) { |
| | | throw new CoolException("拖盘已使用"); |
| | | } |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, params.getBarcode())); |
| | | if (!waitPakins.isEmpty()) { |
| | | throw new CoolException("拖盘已使用!!"); |
| | | } |
| | | AsnOrderItem orderItems = asnOrderItemMapper.selectOne(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnId, asnOrders.getId()) |
| | | .eq(AsnOrderItem::getMatnrCode, params.getMatnrCode())); |
| | | if (Objects.isNull(orderItems)) { |
| | | return R.ok(null); |
| | | } |
| | | orderItems.setBarcode(params.getBarcode()); |
| | | |
| | | return R.ok(orderItems); |
| | | |
| | | return R.ok(waitPakinItems); |
| | | } |
| | | |
| | | /** |