刘小明
2024-07-04 973022f0585dbada665543db56e64e1ce3816150
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
package com.dy.pmsStation.assemblyStep;
 
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
import com.dy.pmsGlobal.pojoPlt.PltProductTestInspectionItems;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 *记录组装各步骤
 */
@Slf4j
@RestController
@RequestMapping(path = "assemblyStep")
public class AssemblyStepCtrl {
    private AssemblyStepSv sv;
    @Autowired
    public void setSv(AssemblyStepSv sv) {
        this.sv = sv;
    }
 
    @PostMapping(path = "save")
    public BaseResponse save(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.save()");
        int count = sv.save(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
 
    @PostMapping(path = "repair")
    public BaseResponse repair(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.repair()");
        int count = sv.repair(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    @GetMapping(path = "getQualityItems")
    public BaseResponse<List<PltProductQualityInspectionItems>> getQualityItems(String proId) {
        log.info("AssemblyStepCtrl.getQualityItems()");
        List<PltProductQualityInspectionItems> result = sv.getQualityItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "getTestItems")
    public BaseResponse<List<PltProductTestInspectionItems>> getTestItems(String proId) {
        log.info("AssemblyStepCtrl.getTestItems()");
        List<PltProductTestInspectionItems> result = sv.getTestItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    /**
     * 测试或品检都调用这个接口
     * @param vo
     * @return
     */
    @PostMapping(path = "testing")
    public BaseResponse testing(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.testing()");
        int count = sv.testing(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
}