huang
4 天以前 9dcde5b27b70a4b0c0885347af5405eb2d1ef089
mes-processes/mes-plcSend/src/main/java/com/mes/device/service/impl/DevicePlcOperationServiceImpl.java
@@ -40,15 +40,27 @@
    private final PlcTestWriteService plcTestWriteService;
    private final ObjectMapper objectMapper;
    public enum PlcOperationType {
    public static enum PlcOperationType {
        /** PLC请求操作 */
        REQUEST("PLC请求", "PLC 请求发送成功", "PLC 请求发送失败"),
        /** PLC汇报操作 */
        REPORT("PLC汇报", "PLC 汇报模拟成功", "PLC 汇报模拟失败"),
        /** PLC重置操作 */
        RESET("PLC重置", "PLC 状态已重置", "PLC 状态重置失败");
        /** 操作显示名称 */
        private final String display;
        /** 操作成功提示信息 */
        private final String successMsg;
        /** 操作失败提示信息 */
        private final String failedMsg;
        /**
         * 构造方法
         * @param display 操作显示名称
         * @param successMsg 成功提示信息
         * @param failedMsg 失败提示信息
         */
        PlcOperationType(String display, String successMsg, String failedMsg) {
            this.display = display;
            this.successMsg = successMsg;
@@ -103,7 +115,7 @@
            return DevicePlcVO.StatusInfo.builder()
                    .deviceId(deviceId)
                    .deviceName("未知设备")
                    .data(Collections.emptyMap())
                    .fieldValues(Collections.emptyMap())
                    .timestamp(LocalDateTime.now())
                    .build();
        }
@@ -115,7 +127,7 @@
                    .deviceName(device.getDeviceName())
                    .deviceCode(device.getDeviceCode())
                    .projectId(String.valueOf(device.getProjectId()))
                    .data(data)
                    .fieldValues(data)
                    .timestamp(LocalDateTime.now())
                    .build();
        } catch (Exception e) {
@@ -125,7 +137,7 @@
                    .deviceName(device.getDeviceName())
                    .deviceCode(device.getDeviceCode())
                    .projectId(null)
                    .data(Collections.emptyMap())
                    .fieldValues(Collections.emptyMap())
                    .timestamp(LocalDateTime.now())
                    .build();
        }