zss
2023-09-21 2dbc49184bd74845c8da694c20d6fd03d7ac87e0
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
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;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-31
 */
@Api(tags = "技术管理-->标准BOM-->工艺路线")
@RestController
@RequestMapping("/technology")
public class TechnologyController {
 
    @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),
            @ApiImplicitParam(name = "version", value = "版本", dataTypeClass = Integer.class, required = true)
    })
    @GetMapping("/chooseFather")
    public Result<?> chooseFather(Integer specificationsId,Integer version) {
        return Result.success(technologyService.chooseFather(specificationsId,version));
    }
 
    @ApiOperation("右上角新增-->工艺路线")
    @PostMapping("/add")
    public Result<?> addTechnology(@Validated @RequestBody TechnologyDto technologyDto) {
        return Result.success(technologyService.addTechnology(technologyDto));
    }
 
    @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("选择设备组,鼠标移开保存")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "工艺路线id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "deviceGroup", value = "设备组", dataTypeClass = String.class, required = true)
 
    })
    @PostMapping("/writeDevice")
    public Result<?> writeDevice(Integer id, String deviceGroup) {
        Integer write = technologyService.writeDevice(id, deviceGroup);
        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("批量删除成功!");
    }
}