zss
2023-09-06 fa0d4fc230b44c04b969b4f7c7bd0ea72a61572d
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
package com.yuanchu.mom.controller;
 
import com.yuanchu.mom.pojo.RawInsProduct;
import com.yuanchu.mom.service.DeviceService;
import com.yuanchu.mom.utils.Jwt;
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.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yuanchu.mom.service.RawInsProductService;
 
import javax.annotation.Resource;
import java.util.Map;
 
/**
 * 原材料申请单中的项目列表(RawInsProduct)表控制层
 *
 * @author zss
 * @since 2023-08-01 13:52:30
 */
@Api(tags = "QMS管理-->原材料检验")
@RestController
@RequestMapping("/rawInsProduct")
public class RawInsProductController {
 
    @Autowired
    private RawInsProductService rawInsProductService;
 
    @Resource
    DeviceService deviceService;
 
    @Resource
    Jwt jwt;
 
    @ApiOperation(value = "选择设备")
    @GetMapping("/selectDevice")
    public Result selectDevice() {
        return Result.success(deviceService.chooseDevice());
    }
 
    @ApiOperation(value = "更新检验项目(填写检验值,检验设备)")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "rpId", value = "原材料检验项目id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "testValue", value = "检测值", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "DevId", value = "设备id", dataTypeClass = Integer.class,required = true)
    })
    @PostMapping("/updaterawInsProduct")
    public Result updaterawInsProduct(@RequestHeader("token") String token,Integer rpId ,String testValue,Integer devId) throws Exception {
        Map<String, String> map = jwt.readJWT(token);
        String data = map.get("data");
        JSONObject jsonObject = new JSONObject(data);
        int userId = Integer.parseInt(jsonObject.getString("id"));
        rawInsProductService.updaterawInsProduct(userId,rpId,testValue,devId);
        return Result.success();
    }
}