package com.ruoyi.production.controller;
|
|
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();
|
}
|
}
|