| | |
| | | stockInRecordDto.setStockInNum(stockUninventoryDto.getQualitity()); |
| | | stockInRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockInRecordDto.setType("1"); |
| | | stockInRecordDto.setSalesLedgerId(stockUninventoryDto.getSalesLedgerId()); |
| | | stockInRecordDto.setSalesLedgerProductId(stockUninventoryDto.getSalesLedgerProductId()); |
| | | stockInRecordService.add(stockInRecordDto); |
| | | //再进行新增库存数量库存 |
| | | //先查询库存表中的产品是否存在,不存在新增,存在更新 |
| | |
| | | stockOutRecordDto.setStockOutNum(stockUninventoryDto.getQualitity()); |
| | | stockOutRecordDto.setProductModelId(stockUninventoryDto.getProductModelId()); |
| | | stockOutRecordDto.setType("1"); |
| | | stockOutRecordDto.setSalesLedgerId(stockUninventoryDto.getSalesLedgerId()); |
| | | stockOutRecordDto.setSalesLedgerProductId(stockUninventoryDto.getSalesLedgerProductId()); |
| | | stockOutRecordService.add(stockOutRecordDto); |
| | | StockUninventory oldStockInventory = stockUninventoryMapper.selectOne(new QueryWrapper<StockUninventory>().lambda().eq(StockUninventory::getProductModelId, stockUninventoryDto.getProductModelId())); |
| | | if (ObjectUtils.isEmpty(oldStockInventory)) { |
| | | throw new RuntimeException("产品库存不存在"); |
| | | }else { |
| | | stockUninventoryMapper.updateSubtractStockUnInventory(stockUninventoryDto); |
| | | int affectRows = stockUninventoryMapper.updateSubtractStockUnInventory(stockUninventoryDto); |
| | | if (affectRows <= 0) { |
| | | throw new RuntimeException("库存不足无法出库"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |