| | |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.execl.StockUnInventoryExportData; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockUninventory(HttpServletResponse response, StockUninventoryDto stockUninventoryDto) { |
| | | List<StockInventoryExportData> list = stockUninventoryMapper.listStockInventoryExportData(stockUninventoryDto); |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | List<StockUnInventoryExportData> list = stockUninventoryMapper.listStockInventoryExportData(stockUninventoryDto); |
| | | ExcelUtil<StockUnInventoryExportData> util = new ExcelUtil<>(StockUnInventoryExportData.class); |
| | | util.exportExcel(response,list, "不合格库存信息"); |
| | | } |
| | | |