huminmin
昨天 7746f1fcb9b018735df79de7055170e6b1720775
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package com.ruoyi.stock.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.framework.web.domain.R;
import com.ruoyi.stock.dto.StockInventoryDto;
import com.ruoyi.stock.dto.StockUninventoryDto;
import com.ruoyi.stock.service.StockUninventoryService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
 
/**
 * <p>
 * 不合格库存表 前端控制器
 * </p>
 *
 * @author 芯导软件(江苏)有限公司
 * @since 2026-01-22 10:17:45
 */
@RestController
@RequestMapping("/stockUninventory")
@AllArgsConstructor
public class StockUninventoryController {
    private StockUninventoryService stockUninventoryService;
 
    @GetMapping("/pagestockUninventory")
    @Operation(summary = "分页查询库存")
    public R pagestockUninventory(Page page, StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setType("unqualified");
        IPage<StockUninventoryDto> stockUninventoryDtoIPage = stockUninventoryService.pageStockUninventory(page, stockUninventoryDto);
        return R.ok(stockUninventoryDtoIPage);
    }
 
    @GetMapping("/pageWasteQuery")
    @Operation(summary = "废品查询页面分页查询")
    public R pageWasteQuery(Page page, StockUninventoryDto stockUninventoryDto) {
        IPage<StockUninventoryDto> stockUninventoryDtoIPage = stockUninventoryService.pageWasteQuery(page, stockUninventoryDto);
        return R.ok(stockUninventoryDtoIPage);
    }
 
    @GetMapping("/getWasteBatchNoQty")
    @Operation(summary = "查询废品库存对应批号和数量")
    public R getWasteBatchNoQty(Page page, StockInventoryDto stockInventoryDto) {
        IPage<StockUninventoryDto> stockUninventoryDtoIPage = stockUninventoryService.getWasteBatchNoQty(page, stockInventoryDto);
        return R.ok(stockUninventoryDtoIPage);
    }
 
    @GetMapping("/getWasteByModelId")
    @Operation(summary = "根据产品规格ID获取废品库存记录")
    public R getWasteByModelId(Long productModelId) {
        return R.ok(stockUninventoryService.getWasteByModelId(productModelId));
    }
 
    @PostMapping("/addstockUninventory")
    @Operation(summary = "新增库存")
    public R addstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
        stockUninventoryDto.setRecordId(0L);
        if (stockUninventoryDto.getType() == null || stockUninventoryDto.getType().trim().isEmpty()) {
            stockUninventoryDto.setType("unqualified");
        }
        return R.ok(stockUninventoryService.addStockUninventory(stockUninventoryDto));
    }
 
 
    @PostMapping("/subtractstockUninventory")
    @Operation(summary = "扣减库存")
    public R subtractstockUninventory(@RequestBody StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
        stockUninventoryDto.setRecordId(0L);
        if (stockUninventoryDto.getType() == null || stockUninventoryDto.getType().trim().isEmpty()) {
            stockUninventoryDto.setType("unqualified");
        }
        return R.ok(stockUninventoryService.subtractStockUninventory(stockUninventoryDto));
    }
 
    @PostMapping("/addStockInRecordOnly")
    @Operation(summary = "新增入库记录(仅创建记录,不调整库存)")
    public R addStockInRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_IN.getCode()));
        stockUninventoryDto.setRecordId(0L);
        if (stockUninventoryDto.getType() == null || stockUninventoryDto.getType().trim().isEmpty()) {
            stockUninventoryDto.setType("unqualified");
        }
        return R.ok(stockUninventoryService.addStockInRecordOnly(stockUninventoryDto));
    }
 
    @PostMapping("/addStockOutRecordOnly")
    @Operation(summary = "新增出库记录(仅创建记录,不调整库存)")
    public R addStockOutRecordOnly(@RequestBody StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_UNSTOCK_OUT.getCode()));
        stockUninventoryDto.setRecordId(0L);
        if (stockUninventoryDto.getType() == null || stockUninventoryDto.getType().trim().isEmpty()) {
            stockUninventoryDto.setType("unqualified");
        }
        return R.ok(stockUninventoryService.addStockOutRecordOnly(stockUninventoryDto));
    }
 
    @PostMapping("/exportStockUninventory")
    @Operation(summary = "导出库存")
    public void exportStockUninventory(HttpServletResponse response, StockUninventoryDto stockUninventoryDto) {
        stockUninventoryDto.setType("unqualified");
        stockUninventoryService.exportStockUninventory(response,stockUninventoryDto);
    }
 
    @PostMapping("/exportWasteQuery")
    @Operation(summary = "导出废品查询页面数据")
    public void exportWasteQuery(HttpServletResponse response, StockUninventoryDto stockUninventoryDto) {
        stockUninventoryService.exportWasteQuery(response, stockUninventoryDto);
    }
 
 
    @PostMapping("/frozenStock")
    @Operation(summary = "冻结库存")
    public R frozenStock(@RequestBody StockInventoryDto stockInventoryDto) {
        return R.ok(stockUninventoryService.frozenStock(stockInventoryDto));
    }
 
    @PostMapping("/thawStock")
    @Operation(summary = "解冻库存")
    public R thawStock(@RequestBody StockInventoryDto stockInventoryDto) {
        return R.ok(stockUninventoryService.thawStock(stockInventoryDto));
    }
 
}