wuyouming666
2024-06-14 3123dbd3a5be75999f368fbe4aa722e3877074ab
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
package com.mes.uppattenusage.controller;
 
import com.mes.engineering.entity.Engineering;
import com.mes.engineering.service.EngineeringService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.pp.service.OptimizeProjectService;
import com.mes.uppattenusage.entity.UpPattenUsage;
import com.mes.uppattenusage.service.UpPattenUsageService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhoush
 * @since 2024-04-18
 */
@RestController
@RequestMapping("/up-patten-usage")
@Slf4j
public class UpPattenUsageController {
 
    @Autowired
    private UpPattenUsageService upPattenUsageService;
    @Autowired
    private  GlassInfoService glassInfoService;
    @Autowired
    private  EngineeringService engineeringService;
    @Autowired
    private OptimizeProjectService optimizeProjectService;
    @ApiOperation("显示选择的工程信息")
    @GetMapping("/prioritylist") //查询现在上片机的玻璃信息
    @ResponseBody
    public Result<List<UpPattenUsage>> prioritylist() {
        List<UpPattenUsage> glass = upPattenUsageService.prioritylist();
        log.info("显示正在出片的工程信息:{}", glass);
        return Result.build(200, "", glass);
    }
 
    @ApiOperation("选择工程号后显示上片顺序预览")
    @PostMapping("/selectUpPattenUsage") //查询现在上片机的玻璃信息
    @ResponseBody
    public Result<List<UpPattenUsage>> selectUpPattenUsage(@RequestBody Engineering engineering) {
        List<UpPattenUsage> upPattenUsages=null;
        UpPattenUsage upPattenUsage = upPattenUsageService.selectedEngineering(engineering.getEngineerId());
        if(upPattenUsage == null){
            upPattenUsages = upPattenUsageService.selectSaveUpPattenUsage(engineering.getEngineerId());
        }else {
            upPattenUsages= upPattenUsageService.selectUpPattenUsage(upPattenUsage);
        }
 
        if (!upPattenUsages.isEmpty()) {
            return Result.build(200, "成功", upPattenUsages);
        }else {
            return Result.build(100, "失败", upPattenUsages);
        }
 
        }
 
    @ApiOperation("切换原片上片状态")
    @PostMapping("/updateGlassState") //查询现在上片机的玻璃信息
    @ResponseBody
    public Result<Boolean> updateGlassState(@RequestBody UpPattenUsage upPattenUsage) {
        Boolean whether = upPattenUsageService.updateGlassState(upPattenUsage);
        if (whether){
            return Result.build(200, "成功", whether);
        }else {
            return Result.build(100, "失败", whether);
        }
 
    }
 
}