6 天以前 1e123568c2f561013f5636e45dc0db30b17a3517
src/main/java/com/ruoyi/stock/controller/StockInventoryController.java
@@ -51,6 +51,48 @@
        return R.ok(stockInventoryDtoIPage);
    }
    @GetMapping("/warnPage")
    @Operation(summary = "库存预警分页(可用数量<=预警值)")
    public R warnPage(Page page, StockInventoryDto stockInventoryDto) {
        stockInventoryDto.setWarnOnly(true);
        return R.ok(stockInventoryService.pagestockInventory(page, stockInventoryDto));
    }
    @GetMapping("/warnExport")
    @Operation(summary = "库存预警导出")
    public void warnExport(HttpServletResponse response, StockInventoryDto stockInventoryDto) {
        stockInventoryDto.setWarnOnly(true);
        List<StockInventoryDto> list = stockInventoryService.pagestockInventory(new Page<>(1, -1), stockInventoryDto).getRecords();
        List<StockInventoryExportData> exportList = new ArrayList<>();
        for (StockInventoryDto item : list) {
            StockInventoryExportData data = new StockInventoryExportData();
            data.setProductName(item.getProductName());
            data.setModel(item.getModel());
            data.setUnit(item.getUnit());
            data.setBatchNo(item.getBatchNo());
            data.setQualifiedQuantity(item.getQualitity());
            data.setWarnNum(item.getWarnNum());
            data.setQualifiedLockedQuantity(item.getLockedQuantity());
            data.setRemark(item.getRemark());
            exportList.add(data);
        }
        ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class);
        util.exportExcel(response, exportList, "库存预警");
    }
    /**
     * 查询对应批号和数量
     * @param page
     * @param stockInventoryDto
     * @return
     */
    @GetMapping("/getBatchNoQty")
    @Operation(summary = "查询对应批号和数量")
    public R getBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
        IPage<StockInventoryDto> stockInventoryDtoIPage = stockInventoryService.getBatchNoQty(page, stockInventoryDto);
        return R.ok(stockInventoryDtoIPage);
    }
    @PostMapping("/addstockInventory")
    @Operation(summary = "新增库存")
    public R addstockInventory(@RequestBody StockInventoryDto stockInventoryDto) {
@@ -68,8 +110,24 @@
        return R.ok(stockInventoryService.subtractStockInventory(stockInventoryDto));
    }
    @PostMapping("/addStockInRecordOnly")
    @Operation(summary = "新增入库记录(仅创建记录,不调整库存)")
    public R addStockInRecordOnly(@RequestBody StockInventoryDto stockInventoryDto) {
        stockInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()));
        stockInventoryDto.setRecordId(0L);
        return R.ok(stockInventoryService.addStockInRecordOnly(stockInventoryDto));
    }
    @PostMapping("importStockInventory")
    @PostMapping("/addStockOutRecordOnly")
    @Operation(summary = "新增出库记录(仅创建记录,不调整库存)")
    public R addStockOutRecordOnly(@RequestBody StockInventoryDto stockInventoryDto) {
        stockInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode()));
        stockInventoryDto.setRecordId(0L);
        return R.ok(stockInventoryService.addStockOutRecordOnly(stockInventoryDto));
    }
    @PostMapping("/importStockInventory")
    @Operation(summary = "导入库存")
    public R importStockInventory(MultipartFile file) {
        return stockInventoryService.importStockInventory(file);
@@ -89,13 +147,13 @@
        stockInventoryService.exportStockInventory(response, stockInventoryDto);
    }
    @GetMapping("stockInventoryPage")
    @GetMapping("/stockInventoryPage")
    @Operation(summary = "库存报表查询")
    public R stockInventoryPage(Page page, StockInventoryDto stockInventoryDto) {
        return R.ok(stockInventoryService.stockInventoryPage(stockInventoryDto,page));
    }
    @GetMapping("stockInAndOutRecord")
    @GetMapping("/stockInAndOutRecord")
    @Operation(summary = "统计各个产品的入库和出库记录")
    public R stockInAndOutRecord(StockInventoryDto stockInventoryDto,Page page) {
        return R.ok(stockInventoryService.stockInAndOutRecord(stockInventoryDto,page));
@@ -112,4 +170,10 @@
    public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) {
        return R.ok(stockInventoryService.thawStock(stockInventoryDto));
    }
    @GetMapping("/getByModelId")
    @Operation(summary = "根据产品规格ID获取入库记录")
    public R getByModelId(Long productModelId) {
        return R.ok(stockInventoryService.getByModelId(productModelId));
    }
}