zss
2023-09-07 9fe4b53620f1ea0a4278240a7acee7bc4ef739c6
standard-server/src/main/java/com/yuanchu/mom/controller/TechnologyController.java
@@ -1,6 +1,7 @@
package com.yuanchu.mom.controller;
import com.yuanchu.mom.pojo.dto.TechnologyDto;
import com.yuanchu.mom.service.TechnologyService;
import com.yuanchu.mom.vo.Result;
import io.swagger.annotations.Api;
@@ -8,17 +9,13 @@
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
@@ -32,5 +29,65 @@
    @Autowired
    private TechnologyService technologyService;
    @ApiOperation("右上角新增-->工艺路线-->选择设备组")
    @GetMapping("/chooseDevice")
    public Result<?> chooseDevice() {
        return Result.success(technologyService.chooseDevice());
    }
    @ApiOperation("右上角新增-->工艺路线-->选择工序")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/chooseFather")
    public Result<?> chooseFather(Integer specificationsId) {
        return Result.success(technologyService.chooseFather(specificationsId));
    }
    @ApiOperation("右上角新增-->工艺路线")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "型号id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/add")
    public Result<?> addTechnology(Integer specificationsId, @Validated @RequestBody TechnologyDto technologyDto) {
        technologyService.addTechnology(specificationsId, technologyDto);
        return Result.success("添加工艺【" + technologyDto.getName() + "】成功");
    }
    @ApiOperation("填写生产定额,鼠标移开保存")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺路线id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "productionQuota", value = "生产定额(个/天)", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/write")
    public Result<?> write(Integer id, Integer productionQuota) {
        Integer write = technologyService.write(id, productionQuota);
        if (write >= 1) {
            return Result.success("更新成功");
        }
        return Result.fail("更新失败");
    }
    @ApiOperation(value = "删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺路线id", dataTypeClass = Integer.class,required = true)
    })
    @PostMapping("/delTechById")
    public Result delTechById(Integer id) {
        technologyService.delTechById(id);
        return Result.success("删除"+id+"成功!");
    }
    @ApiOperation(value = "批量删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "ids", value = "工艺路线id", dataTypeClass = String.class,required = true)
    })
    @PostMapping("/delAllTech")
    public Result delAllTech(String ids) {
        technologyService.delAllTech(ids);
        return Result.success("批量删除成功!");
    }
}