whyclxw
2025-04-21 0c57f51c98c6635ebd4e4d880cf6bb7adf7f880f
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
package com.whyc.controller;
 
import com.whyc.dto.DefectiveDto;
import com.whyc.dto.Response;
import com.whyc.pojo.BOMFeedback;
import com.whyc.pojo.DefectiveProducts;
import com.whyc.pojo.DefectiveProductsHistory;
import com.whyc.service.BOMFeedbakService;
import com.whyc.service.DefectiveProductsService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
 
import javax.mail.MessagingException;
import java.io.IOException;
import java.util.List;
 
@RestController
@Api(tags = "不良品管理")
@RequestMapping("defective")
public class DefectiveProductsController {
 
    @Autowired
    private DefectiveProductsService service;
 
    @ApiOperation("录入不良品信息")
    @PostMapping("addDefective")
    public Response addDefective(@RequestPart(required = false) List<MultipartFile> multipartFileList, @RequestParam String defectiveJson) throws IOException, MessagingException {
        DefectiveProducts defective= ActionUtil.getGson().fromJson(defectiveJson, DefectiveProducts.class);
        return service.addDefective(defective,multipartFileList);
    }
 
    @ApiOperation("处理不良品")
    @PostMapping("updateDefective")
    public Response updateDefective(@RequestPart(required = false) List<MultipartFile> multipartFileList, @RequestParam String defectiveHisJson) {
        DefectiveProductsHistory defectiveHis= ActionUtil.getGson().fromJson(defectiveHisJson, DefectiveProductsHistory.class);
        return service.updateDefective(defectiveHis,multipartFileList);
    }
 
    @ApiOperation("归档不良品")
    @PostMapping("stopDefective")
    public Response stopDefective(@RequestParam int  deftId) {
        return service.stopDefective(deftId);
    }
 
    @ApiOperation("获取不良品")
    @GetMapping("getDefectives")
    public Response getDefectives(@RequestParam String  message) {
        DefectiveDto defectiveDto= ActionUtil.getGson().fromJson(message, DefectiveDto.class);
        return service.getDefectiveLimit(defectiveDto);
    }
}