xiaoyi
2026-10-29 416558785276159b8730b2826e71995fc16b59a7
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
package cn.iocoder.yudao.module.mes.controller.admin.collect;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mes.controller.admin.collect.vo.*;
import cn.iocoder.yudao.module.mes.service.collect.MesCollectQueryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - MES 数采监控")
@RestController
@RequestMapping("/mes/collect")
@Validated
public class MesCollectController {
 
    @Resource
    private MesCollectQueryService queryService;
 
    @GetMapping("/device/list")
    @Operation(summary = "获取数采设备状态列表")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<List<MesCollectDeviceRespVO>> getDeviceList() {
        return success(queryService.getDeviceList());
    }
 
    @GetMapping("/realtime/get")
    @Operation(summary = "获取设备最新实时状态")
    @Parameter(name = "deviceCode", description = "数采设备编号", required = true, example = "C01")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<MesCollectRealtimeRespVO> getRealtime(@RequestParam("deviceCode") String deviceCode) {
        return success(queryService.getRealtime(deviceCode));
    }
 
    @GetMapping("/realtime/history-page")
    @Operation(summary = "分页查询实时状态历史")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<PageResult<MesCollectRealtimeRespVO>> getRealtimeHistoryPage(
            @Valid MesCollectRealtimeHistoryPageReqVO reqVO) {
        return success(queryService.getRealtimeHistoryPage(reqVO));
    }
 
    @GetMapping("/cycle/page")
    @Operation(summary = "分页查询周期过程数据")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<PageResult<MesCollectCycleRespVO>> getCyclePage(@Valid MesCollectCyclePageReqVO reqVO) {
        return success(queryService.getCyclePage(reqVO));
    }
 
    @GetMapping("/cycle/get")
    @Operation(summary = "获取周期过程数据明细")
    @Parameter(name = "id", description = "编号", required = true, example = "1")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<MesCollectCycleRespVO> getCycle(@RequestParam("id") Long id) {
        return success(queryService.getCycle(id));
    }
 
    @GetMapping("/tech/get")
    @Operation(summary = "获取设备最新工艺参数快照")
    @Parameter(name = "deviceCode", description = "数采设备编号", required = true, example = "C01")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<MesCollectTechRespVO> getTech(@RequestParam("deviceCode") String deviceCode) {
        return success(queryService.getTech(deviceCode));
    }
 
    @GetMapping("/operate-log/page")
    @Operation(summary = "分页查询参数变更日志")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<PageResult<MesCollectOperateLogRespVO>> getOperateLogPage(
            @Valid MesCollectOperateLogPageReqVO reqVO) {
        return success(queryService.getOperateLogPage(reqVO));
    }
 
    @GetMapping("/alarm/page")
    @Operation(summary = "分页查询报警记录")
    @PreAuthorize("@ss.hasPermission('mes:collect:query')")
    public CommonResult<PageResult<MesCollectAlarmRespVO>> getAlarmPage(@Valid MesCollectAlarmPageReqVO reqVO) {
        return success(queryService.getAlarmPage(reqVO));
    }
 
    @PutMapping("/alarm/ack")
    @Operation(summary = "人工确认消除报警")
    @Parameter(name = "id", description = "报警记录编号", required = true, example = "1")
    @PreAuthorize("@ss.hasPermission('mes:collect-alarm:ack')")
    public CommonResult<Boolean> ackAlarm(@RequestParam("id") Long id) {
        queryService.ackAlarm(id);
        return success(true);
    }
 
}