gongchunyi
12 小时以前 26e295956b81d6bfe5f181f040bf8ecd0079ba54
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
package com.ruoyi.production.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.ProductModel;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.production.dto.ProductMaterialConfigDto;
import com.ruoyi.production.dto.ProductMaterialGroupDto;
import com.ruoyi.production.pojo.ProductMaterial;
import com.ruoyi.production.pojo.ProductMaterialConfig;
import com.ruoyi.production.service.ProductMaterialConfigService;
import com.ruoyi.production.service.ProductMaterialService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <br>
 * 产品物料信息控制层
 * </br>
 *
 * @author deslrey
 * @version 1.0
 * @since 2026/03/11 16:38
 */
@RestController
@RequestMapping("/productMaterial")
public class ProductMaterialController {
 
    @Autowired
    private ProductMaterialService productMaterialService;
 
    @Autowired
    private ProductMaterialConfigService productMaterialConfigService;
 
    @GetMapping("/loadData")
    @ApiOperation("拉取物料编码数据")
    @Log(title = "拉取物料编码数据", businessType = BusinessType.INSERT)
    public AjaxResult loadProductMaterialData() {
        productMaterialService.loadProductMaterialData();
        return AjaxResult.success();
    }
 
    @GetMapping("/list")
    @ApiOperation("物料数据类别数据集合")
    @Log(title = "物料数据类别数据集合", businessType = BusinessType.OTHER)
    public AjaxResult productMaterialList(@RequestParam("type") Integer type) {
        List<ProductMaterialGroupDto> productMaterialMap = productMaterialService.ProductMaterialList(type);
        return AjaxResult.success(productMaterialMap);
    }
 
    @GetMapping("/listQuery")
    @ApiOperation("物料数据类别子类数据集合")
    @Log(title = "物料数据类别子类数据集合", businessType = BusinessType.OTHER)
    public AjaxResult productMaterialListByQuery(@RequestParam(value = "materialName", required = false) String materialName, @RequestParam(value = "materialTypeId", required = false) Integer materialTypeId) {
        List<ProductMaterialGroupDto> productMaterialMap = productMaterialService.productMaterialListByQuery(materialName, materialTypeId);
        return AjaxResult.success(productMaterialMap);
    }
 
    @PostMapping("/add")
    @ApiOperation("新增物料")
    @Log(title = "新增物料", businessType = BusinessType.INSERT)
    public AjaxResult addProductMaterial(@RequestBody ProductMaterial productMaterial) {
        productMaterialService.addProductMaterial(productMaterial);
        return AjaxResult.success();
    }
 
    @PutMapping("/update")
    @ApiOperation("修改物料")
    @Log(title = "修改物料", businessType = BusinessType.UPDATE)
    public AjaxResult updateProductMaterial(@RequestBody ProductMaterial productMaterial) {
        productMaterialService.updateProductMaterial(productMaterial);
        return AjaxResult.success();
    }
 
    @DeleteMapping("/delete")
    @ApiOperation("删除物料")
    @Log(title = "删除物料", businessType = BusinessType.DELETE)
    public AjaxResult deleteProductMaterial(@RequestBody List<Long> ids) {
        productMaterialService.deleteProductMaterial(ids);
        return AjaxResult.success();
    }
 
 
    @GetMapping("/materialTypeList")
    @ApiOperation("物料类型数据集合")
    @Log(title = "物料类型数据集合", businessType = BusinessType.OTHER)
    public AjaxResult materialTypeList() {
        List<ProductMaterialConfig> list = productMaterialConfigService.materialTypeList();
        return AjaxResult.success(list);
    }
 
    @GetMapping("/inventoryCategoryList")
    @ApiOperation("'存货类别数据集合")
    @Log(title = "'存货类别数据集合", businessType = BusinessType.OTHER)
    public AjaxResult inventoryCategoryList() {
        List<ProductMaterialConfig> list = productMaterialConfigService.inventoryCategoryList();
        return AjaxResult.success(list);
    }
 
    @PostMapping("/config/add")
    @ApiOperation("新增物料配置")
    @Log(title = "新增物料配置", businessType = BusinessType.INSERT)
    public AjaxResult addProductMaterialConfig(@RequestBody ProductMaterialConfigDto config) {
        productMaterialConfigService.addProductMaterialConfig(config);
        return AjaxResult.success();
    }
 
    @PutMapping("/config/update")
    @ApiOperation("修改物料配置")
    @Log(title = "修改物料配置", businessType = BusinessType.UPDATE)
    public AjaxResult updateProductMaterialConfig(@RequestBody ProductMaterialConfigDto config) {
        productMaterialConfigService.updateProductMaterialConfig(config);
        return AjaxResult.success();
    }
 
    @DeleteMapping("/config/delete")
    @ApiOperation("删除物料配置")
    @Log(title = "删除物料配置", businessType = BusinessType.DELETE)
    public AjaxResult deleteProductMaterialConfig(@RequestBody List<Integer> ids) {
        productMaterialConfigService.deleteProductMaterialConfig(ids);
        return AjaxResult.success();
    }
}