Fancy
2024-07-30 94d3c6d6119ac0a1c8a24d20fe82bfa20411316c
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package com.dy.pmsStation.assemblyStep;
 
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.pmsGlobal.pojoPlt.PltProductFile;
import com.dy.pmsGlobal.pojoPlt.PltProductParams;
import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems;
import com.dy.pmsGlobal.pojoPlt.PltProductTestInspectionItems;
import com.dy.pmsGlobal.pojoPr.PrAssemblyPlan;
import com.dy.pmsGlobal.pojoPr.PrProductionNode;
import com.dy.pmsGlobal.pojoSta.StaDeviceLife;
import com.dy.pmsGlobal.pojoSta.StaDeviceProductionLog;
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;
import java.util.Map;
 
/**
 * 记录组装各步骤
 */
@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():" + vo);
        int count = sv.save(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
 
    /**
     * 测试
     * @param vo
     * @return
     */
    @PostMapping(path = "testing")
    public BaseResponse testing(@RequestBody @Valid QueryVo vo) {
        log.info("AssemblyStepCtrl.testing():" + vo);
        int count = sv.testing(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
 
    /**
     * 品检
     * @param vo
     * @return
     */
    @PostMapping(path = "inspectQuality")
    public BaseResponse<Boolean> inspectQuality(QueryVo vo) {
        log.info("AssemblyStepCtrl.inspectQuality():" + vo);
        int count = sv.inspectQuality(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
    /**
     * 无任务工作中的其他页面
     * @param vo
     * @return
     */
    @PostMapping(path = "otherWork")
    public BaseResponse<Boolean> otherWork(QueryVo vo) {
        log.info("AssemblyStepCtrl.otherWork():" + vo);
        int count = sv.otherWork(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():" + vo);
        int count = sv.repair(vo);
        if (count <= 0) {
            return BaseResponseUtils.buildFail("数据库存储失败");
        } else {
            return BaseResponseUtils.buildSuccess(true);
        }
    }
 
    /**
     * 根据节点的查出节点作业指导书
     *
     * @param
     * @return
     */
    @GetMapping(path = "getSopByNodeId")
    public BaseResponse<PrProductionNode> getSopByNodeId(String nodeId) {
        log.info("AssemblyStepCtrl.getSopByNodeId():" + nodeId);
        PrProductionNode result = sv.getSopByNodeId(nodeId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    /**
     * 根据产品查出 主要技术参数
     *
     * @param
     * @return
     */
    @GetMapping(path = "getParamsByProId")
    public BaseResponse<List<PltProductParams>> getParamsByProId(String proId) {
        log.info("AssemblyStepCtrl.getParamsByProId():" + proId);
        List<PltProductParams> result = sv.getParamsByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    /**
     * 根据产品查出产品文件 主要技术参数
     *
     * @param
     * @return
     */
    @GetMapping(path = "getFileByProId")
    public BaseResponse<List<PltProductFile>> getFileByProId(String proId) {
        log.info("AssemblyStepCtrl.getFileByProId():" + proId);
        List<PltProductFile> result = sv.getFileByProId(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    @GetMapping(path = "getQualityItems")
    public BaseResponse<List<PltProductQualityInspectionItems>> getQualityItems(String proId) {
        log.info("AssemblyStepCtrl.getQualityItems():" + proId);
        List<PltProductQualityInspectionItems> result = sv.getQualityItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    @GetMapping(path = "getTestItems")
    public BaseResponse<List<PltProductTestInspectionItems>> getTestItems(String proId) {
        log.info("AssemblyStepCtrl.getTestItems():" + proId);
        List<PltProductTestInspectionItems> result = sv.getTestItems(proId);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    @GetMapping(path = "queryByDeviceNo")
    public BaseResponse<Map<String, String>> queryByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryByDeviceNo():" + deviceNo);
        Map<String, String> result = sv.queryByDeviceNo(deviceNo, null);
        if (StringUtils.isBlank(result.get("proName"))) {
            return BaseResponseUtils.buildFail("该编码(" + deviceNo + ")不是主要物料(系统中管控的其他设备)");
        } else {
            return BaseResponseUtils.buildSuccess(result);
        }
    }
 
    @GetMapping(path = "queryLifeByDeviceNo")
    public BaseResponse<?> queryLifeByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLifeByDeviceNo():" + deviceNo);
        List<StaDeviceLife> result = sv.queryLifeByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
 
    @GetMapping(path = "queryLogByDeviceNo")
    public BaseResponse<?> queryLogByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLogByDeviceNo():" + deviceNo);
        List<StaDeviceProductionLog> result = sv.queryLogByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
    @GetMapping(path = "queryPlanByDeviceNo")
    public BaseResponse<PrAssemblyPlan> queryPlanByDeviceNo(String deviceNo) {
        log.info("AssemblyStepCtrl.queryLogByDeviceNo():" + deviceNo);
        PrAssemblyPlan result = sv.queryPlanByDeviceNo(deviceNo);
        return BaseResponseUtils.buildSuccess(result);
    }
 
}