wu
2024-04-08 cb4da9b55edfdda5beacca036b99130b33b9449b
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
package com.mes.controller;
 
import com.mes.entity.DownWorkstation;
import com.mes.service.DownWorkstationService;
import com.mes.service.GlassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
import java.util.Map;
 
@RestController
@RequestMapping("/downWorkstation")
public class DownWorkstationController {
 
    @Autowired
    private DownWorkstationService downWorkstationService;
    @Autowired
    private GlassInfoService glassInfoService;
 
    @GetMapping("/getone")
    public List<DownWorkstation> getoneDownWorkstations() {
        return downWorkstationService.getoneDownWorkstations();
    }
 
    @GetMapping("/gettwo")
    public List<DownWorkstation> gettwoDownWorkstations() {
        return downWorkstationService.gettwoDownWorkstations();
    }
    @GetMapping("/getflowCardId")
    public List<Map<String, Object>> getflowCardId() {
        return downWorkstationService.getflowCardId();
    }
 
 
    @PostMapping("/updateFlowCardId")
    public String updateFlowCardId(@RequestBody Map<String, Object> requestData) {
        // 从 requestData 中获取传入的 flowCardId
        String flowCardId = (String) requestData.get("flowCardId");
 
        // 查询对应 flowCardId 的玻璃信息总数量
        int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId);
 
        // 更新 down_workstation 表中的总数量
        glassInfoService.updateFlowCardIdAndCount(flowCardId, glassInfoCount);
 
        // 返回处理结果,比如成功或失败信息
        return "updated successfully";
    }
 
 
    @DeleteMapping("/clear/{workstationId}")
    public String clearWorkstationInfo(@PathVariable("workstationId") int workstationId) {
        // 调用 DownWorkstationService 中的方法清除指定工位ID的信息
       downWorkstationService.clearFlowCardId(workstationId);
        // 返回处理结果,比如成功或失败信息
        return "cleared successfully";
    }
 
 
 
 
 
}