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 java.time.LocalDateTime;
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
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("/offline/intervals")
|
@Operation(summary = "查询数采离线停机区间")
|
@PreAuthorize("@ss.hasPermission('mes:collect:query')")
|
public CommonResult<MesCollectOfflineResultRespVO> getOfflineIntervals(
|
@RequestParam("deviceCode") String deviceCode,
|
@RequestParam("startTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
|
@RequestParam("endTime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
|
return success(queryService.getOfflineIntervals(deviceCode, startTime, endTime));
|
}
|
|
@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);
|
}
|
|
}
|