buhuazhen
2 天以前 d562551c7efd2c19fd037ab4fb1b7a355ff80f42
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
package com.ruoyi.consumables.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.consumables.dto.ConsumablesInventoryDto;
import com.ruoyi.consumables.execl.ConsumablesInventoryExportData;
import com.ruoyi.consumables.service.ConsumablesInventoryService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
 
/**
 * <p>
 * 耗材库存表 前端控制器
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @since 2026-01-21 04:16:36
 */
@RestController
@RequestMapping("/consumablesInventory")
@Api(tags = "耗材库存表")
public class ConsumablesInventoryController {
 
    @Autowired
    private ConsumablesInventoryService ConsumablesInventoryService;
 
    @GetMapping("/pageConsumablesInventory")
    @ApiOperation("分页查询库存")
    public R pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) {
        IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = ConsumablesInventoryService.pageConsumablesInventory(page, ConsumablesInventoryDto);
        return R.ok(ConsumablesInventoryDtoIPage);
    }
 
    @PostMapping("/addConsumablesInventory")
    @ApiOperation("新增库存")
    public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
        ConsumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()));
        ConsumablesInventoryDto.setRecordId(0L);
        return R.ok(ConsumablesInventoryService.addConsumablesInventory(ConsumablesInventoryDto));
    }
 
 
    @PostMapping("/subtractConsumablesInventory")
    @ApiOperation("扣减库存")
    public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
        ConsumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode()));
        ConsumablesInventoryDto.setRecordId(0L);
        return R.ok(ConsumablesInventoryService.subtractConsumablesInventory(ConsumablesInventoryDto));
    }
 
 
    @PostMapping("importConsumablesInventory")
    @ApiOperation("导入库存")
    public R importConsumablesInventory(MultipartFile file) {
        return ConsumablesInventoryService.importConsumablesInventory(file);
    }
 
    @Log(title = "下载库存导入模板", businessType = BusinessType.EXPORT)
    @PostMapping("/downloadConsumablesInventory")
    public void downloadConsumablesInventory(HttpServletResponse response) {
        List<ConsumablesInventoryExportData> list = new ArrayList<>();
        ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class);
        util.exportExcel(response, list, "库存模板");
    }
 
    @PostMapping("/exportConsumablesInventory")
    @ApiOperation("导出库存")
    public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) {
        ConsumablesInventoryService.exportConsumablesInventory(response, ConsumablesInventoryDto);
    }
 
    @GetMapping("ConsumablesInventoryPage")
    @ApiOperation("库存报表查询")
    public R ConsumablesInventoryPage(Page page, ConsumablesInventoryDto consumablesInventoryDto) {
        return R.ok(ConsumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page));
    }
 
    @GetMapping("ConsumablesInAndOutRecord")
    @ApiOperation("统计各个产品的入库和出库记录")
    public R ConsumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) {
        return R.ok(ConsumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page));
    }
 
    @PostMapping("/frozenConsumables")
    @ApiOperation("冻结库存")
    public R frozenConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
        return R.ok(ConsumablesInventoryService.frozenConsumables(ConsumablesInventoryDto));
    }
 
    @PostMapping("/thawConsumables")
    @ApiOperation("解冻库存")
    public R thawConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
        return R.ok(ConsumablesInventoryService.thawConsumables(ConsumablesInventoryDto));
    }
}