| | |
| | | throw new CoolException("库区标识不能为空!!"); |
| | | } |
| | | |
| | | |
| | | WarehouseAreas areasItem = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>().eq(WarehouseAreas::getId, params.getWhAreaId())); |
| | | if (Objects.isNull(areasItem)) { |
| | | throw new CoolException("数据错误:当前库区不存在!!"); |
| | |
| | | List<Fields> fields = fieldsMapper.selectList(new LambdaQueryWrapper<Fields>().eq(Fields::getFlagEnable, 1).eq(Fields::getStatus, 1)); |
| | | |
| | | List<ReceiptDetlsDto> receipts = params.getReceipts(); |
| | | List<WarehouseAreasItem> allOrders = new ArrayList<>(); |
| | | List<WarehouseAreasItem> allOrders = new ArrayList<>(); |
| | | |
| | | double receiptQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getReceiptQty).sum(); |
| | | |
| | | String asnCode = receipts.stream().findFirst().get().getAsnCode(); |
| | | |
| | | AsnOrder asnOrder = asnOrderMapper.selectOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, asnCode)); |
| | | asnOrder.setQty(receiptQty); |
| | | |
| | | if (asnOrderMapper.updateById(asnOrder) < 1) { |
| | | throw new CoolException("已收货数量修改失败!!"); |
| | | } |
| | | |
| | | receipts.forEach(dto -> { |
| | | Matnr matnr = matnrMapper.selectById(dto.getMatnrId()); |
| | | if (Objects.isNull(matnr)) { |
| | | throw new CoolException("数据错误:当前物料不存在!!"); |
| | | } |
| | | if (Objects.isNull(dto.getReceiptQty())) { |
| | | throw new CoolException("收货数据不能为空!!"); |
| | | } |
| | | if (dto.getReceiptQty() < dto.getPurQty()) { |
| | | throw new CoolException("收货数量不能大于采购数量!!"); |
| | | } |
| | | |
| | | AsnOrderItem orderItem = asnOrderItemMapper.selectOne(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnCode, asnCode) |
| | | .eq(AsnOrderItem::getMatnrId, dto.getMatnrId())); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("通知单明细不存在!!"); |
| | | } |
| | | orderItem.setQty(dto.getReceiptQty()); |
| | | |
| | | if (asnOrderItemMapper.updateById(orderItem) < 1) { |
| | | throw new CoolException("通知单明细数量修改失败!!"); |
| | | } |
| | | |
| | | WarehouseAreasItem item = new WarehouseAreasItem(); |
| | | item.setBarcode(dto.getBarcode()) |
| | | .setAreaName(areasItem.getName()) |