Lius
2024-06-25 3e784708e465b4dca8c47514cf6119e63fd4b3a5
设备详细信息接口更新
已添加1个文件
已修改10个文件
193 ■■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDetailedDto.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -124,12 +124,12 @@
        return Result.OK(list);
    }
    @AutoLog(value = "设备表-设备详细信息")
    @ApiOperation(value = "设备表-设备详细信息", notes = "设备表-设备详细信息")
    @AutoLog(value = "设备表-设备实时详细信息")
    @ApiOperation(value = "设备表-设备实时详细信息", notes = "设备表-设备实时详细信息")
    @GetMapping(value = "/mdcEquipmentDetailedInfo")
    public Result<MdcEquipmentDto> mdcEquipmentDetailedInfo(@RequestParam(name = "id", required = true) String id) {
        MdcEquipmentDto mdcEquipmentDto = mdcEquipmentService.mdcEquipmentDetailedInfo(id);
        return Result.OK(mdcEquipmentDto);
    public Result<?> mdcEquipmentDetailedInfo(@RequestParam(name = "id", required = true) String id) {
        Map<String, Object> result = mdcEquipmentService.mdcEquipmentDetailedInfo(id);
        return Result.OK(result);
    }
    /**
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquipmentDetailedDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package org.jeecg.modules.mdc.dto;
import lombok.Data;
import org.jeecg.modules.mdc.entity.MdcEquipment;
/**
 * @author Lius
 * @date 2024/6/21 11:30
 */
@Data
public class MdcEquipmentDetailedDto extends MdcEquipment {
    /**
     * æœ€å¤§è½´æ•°
     */
    private String maxAxis;
    /**
     * æœ‰æ•ˆè½´æ•°
     */
    private String validAxis;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentWorklineMapper.java
@@ -49,4 +49,7 @@
    @InterceptorIgnore(tenantLine = "1")
    MdcEquipmentDto findProductCountEndTime(@Param("tableName") String saveTableName, @Param("productCount") String productCount, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
    @InterceptorIgnore(tenantLine = "1")
    Map<String, Object> getDataList(@Param("tableName") String saveTableName);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -8,6 +8,7 @@
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.mdc.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDetailedDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
@@ -117,4 +118,10 @@
    @InterceptorIgnore(tenantLine = "1")
    MdcEquipmentDto findWorkLineLast(@Param("tableName") String tableName);
    /**
     * æ ¹æ®id获取设备信息
     * @param id
     * @return
     */
    MdcEquipmentDetailedDto findById(@Param("id") String id);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
@@ -21,4 +21,8 @@
    <select id="findProductCountEndTime" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
        SELECT TOP 1 [${tableName}].* FROM [${tableName}] WHERE ProductCount = #{ productCount } AND CollectTime BETWEEN #{ startTime } AND #{ endTime } ORDER BY CollectTime DESC
    </select>
    <select id="getDataList" resultType="java.util.Map">
        select top 1 [${tableName}].* from [${tableName}] order by CollectTime  desc
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -263,4 +263,17 @@
        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
    </select>
    <!--根据id获取设备信息-->
    <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDetailedDto">
        SELECT
            t1.*,
            t2.MaxAxis maxAxis,
            t2.ValidAxis validAxis
        FROM
            mdc_equipment t1
                LEFT JOIN EquipmentBaseInfo t2 ON t1.equipment_id = t2.EquipmentID
        WHERE
            t1.id = #{ id }
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java
@@ -5,6 +5,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author: LiuS
@@ -56,4 +57,11 @@
     * @return
     */
    MdcEquipmentDto findProductCountEndTime(String saveTableName, String productCount, Date startTime, Date endTime);
    /**
     * èŽ·å–è®¾å¤‡è¿è¡Œæ•°æ®
     * @param saveTableName
     * @return
     */
    Map<String, Object> getDataList(String saveTableName);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -116,7 +116,7 @@
    /**
     * è®¾å¤‡ç›‘控 - è®¾å¤‡è¯¦ç»†ä¿¡æ¯
     */
    MdcEquipmentDto mdcEquipmentDetailedInfo(String id);
    Map<String, Object> mdcEquipmentDetailedInfo(String id);
    /**
     * é€šè¿‡ç”¨æˆ·éƒ¨é—¨å…³ç³»èŽ·å–è®¾å¤‡id集合
@@ -186,6 +186,7 @@
    /**
     * å¯¼å‡ºList
     *
     * @param mdcEquipment
     * @return
     */
@@ -193,6 +194,7 @@
    /**
     * é€šè¿‡è½¦é—´ids获取设备树
     *
     * @param ids
     * @return
     */
@@ -200,6 +202,7 @@
    /**
     * æŸ¥è¯¢å•表数据
     *
     * @param tableName
     * @return
     */
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java
@@ -77,6 +77,15 @@
        }
    }
    @Override
    public Map<String, Object> getDataList(String saveTableName) {
        try {
            return equipmentWorkLineMapper.getDataList(saveTableName);
        } catch (Exception e) {
            return null;
        }
    }
    private List<EquipmentMachingDto> convertData(List<Map<String, Object>> list) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        List<EquipmentMachingDto> dto = new ArrayList<>();
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -12,6 +12,7 @@
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.mdc.dto.MdcEquDepDto;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDetailedDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentDto;
import org.jeecg.modules.mdc.entity.*;
import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper;
@@ -354,87 +355,52 @@
     * è®¾å¤‡ç›‘控 - è®¾å¤‡è¯¦ç»†ä¿¡æ¯
     */
    @Override
    public MdcEquipmentDto mdcEquipmentDetailedInfo(String id) {
        MdcEquipmentDto mdcEquipmentDto = new MdcEquipmentDto();
        MdcEquipment mdcEquipment = this.baseMapper.selectById(id);
        //封装基础信息
        mdcEquipmentDto.setSystemVersion(mdcEquipment.getSystemVersion());
        mdcEquipmentDto.setSystemType(mdcEquipment.getControlSystem());
        mdcEquipmentDto.setDevicePower(mdcEquipment.getDevicePower());
        mdcEquipmentDto.setDeviceType(mdcEquipment.getDriveType());
        mdcEquipmentDto.setRemark(mdcEquipment.getRemark());
        //设备编号
        mdcEquipmentDto.setEquipmentID(mdcEquipment.getEquipmentId());
        mdcEquipmentDto.setEquipmentName(mdcEquipment.getEquipmentName());
        mdcEquipmentDto.setEquipmentIP(mdcEquipment.getEquipmentIp());
        //设备型号
        mdcEquipmentDto.setEquipmentModel(mdcEquipment.getEquipmentModel());
        mdcEquipmentDto.setDriveType(mdcEquipment.getDriveType());
        mdcEquipmentDto.setDataPort(mdcEquipment.getDataPort());
        mdcEquipmentDto.setDataFlag(Integer.parseInt(CommonConstant.STATUS_1));
        ControlSystem controlSystem = controlSystemService.getByDriveType(mdcEquipmentDto.getDriveType());
    public Map<String, Object> mdcEquipmentDetailedInfo(String id) {
        Map<String, Object> result = new HashMap<>();
        MdcEquipmentDetailedDto mdcEquipmentDetailedDto = this.baseMapper.findById(id);
        result.put("equipment", mdcEquipmentDetailedDto);
        // æŸ¥è¯¢è®¾å¤‡çŠ¶æ€
        EquipmentLog equipmentLog = equipmentLogService.selectEquipmentOporation(mdcEquipment.getEquipmentId());
        EquipmentLog equipmentLog = equipmentLogService.selectEquipmentOporation(mdcEquipmentDetailedDto.getEquipmentId());
        if (equipmentLog == null) {
            return mdcEquipmentDto;
            return result;
        }
        Integer oporation = equipmentLog.getOporation();
        if (controlSystem != null) {
            //获取工作数据并初始化
            String saveTableName = mdcEquipment.getSaveTableName();
            MdcEquipmentDto dto = equipmentWorkLineService.getMacingDataList(saveTableName);
            if (dto != null) {
                mdcEquipmentDto.setCollectTime(dto.getCollectTime());
                mdcEquipmentDto.setSpindlespeed(dto.getSpindlespeed());
                mdcEquipmentDto.setSpindleload(dto.getSpindleload());
                mdcEquipmentDto.setSpindlebeilv(dto.getSpindlebeilv());
                mdcEquipmentDto.setFeedrate(dto.getFeedrate());
                mdcEquipmentDto.setFeedbeilv(dto.getFeedbeilv());
                mdcEquipmentDto.setProgramnumber(dto.getProgramnumber());
                mdcEquipmentDto.setSequencenumber(dto.getSequencenumber());
                mdcEquipmentDto.setExecutingcode(dto.getExecutingcode());
                mdcEquipmentDto.setProductName(dto.getProductName());
                if ("LSV2".equals(mdcEquipment.getDriveType())) {
                    mdcEquipmentDto.setSpindlebeilv(dto.getSFeed());
                    mdcEquipmentDto.setFeedbeilv(dto.getFFeed());
                    mdcEquipmentDto.setRapidfeed(dto.getRapidfeed());
                    mdcEquipmentDto.setNCVersion(dto.getNCVersion());
                    mdcEquipmentDto.setTNCVersion(dto.getTNCVersion());
                    mdcEquipmentDto.setOPTVersion(dto.getOPTVersion());
                    mdcEquipmentDto.setPLCVersion(dto.getPLCVersion());
                }
                //获取 MDC é©±åŠ¨å¯¹åº”çš„å±•ç¤ºå‚æ•°   å¹¶æ ¹æ®key æ‹¼è£…从 workData  æŸ¥è¯¢çš„æ•°æ®
                List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(mdcEquipment.getDriveType());
                if (mdcDriveTypeParamList != null && !mdcDriveTypeParamList.isEmpty()) {
                    for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamList) {
                        String englishName = mdcDriveTypeParamConfig.getEnglishName();
                        JSONObject jsonObject = (JSONObject) JSONObject.toJSON(dto);
                        Object result = jsonObject.get(englishName);
        //获取工作数据并初始化
        String saveTableName = mdcEquipmentDetailedDto.getSaveTableName();
        Map<String, Object> mapData = equipmentWorkLineService.getDataList(saveTableName);
        if (mapData != null) {
            Map<String, Object> runData = new LinkedHashMap<>();
            //获取 MDC é©±åŠ¨å¯¹åº”çš„å±•ç¤ºå‚æ•°   å¹¶æ ¹æ®key æ‹¼è£…从 workData  æŸ¥è¯¢çš„æ•°æ®
            List<MdcDriveTypeParamConfig> mdcDriveTypeParamList = mdcDriveTypeParamConfigService.getShowDriveParam(mdcEquipmentDetailedDto.getDriveType());
            if (mdcDriveTypeParamList != null && !mdcDriveTypeParamList.isEmpty()) {
                for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamList) {
                    String englishName = mdcDriveTypeParamConfig.getEnglishName();
                    String chineseName = mdcDriveTypeParamConfig.getChineseName();
                    if (mapData.containsKey(englishName)) {
                        Object object = mapData.get(englishName);
                        String value = "";
                        if ("CollectTime".equals(englishName)) {
                            Date date = result == null ? null : (Date) result;
                            Date date = object == null ? null : (Date) object;
                            value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL);
                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) {
                        } else if ("ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && "AI01".equals(englishName) && oporation == 3) {
                            // ZUOLAN设备电流字段AI01
                            value = BigDecimal.valueOf(Math.random() * 15 + 0).setScale(1, RoundingMode.HALF_UP).toString();
                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlespeed".equals(englishName) && oporation == 3) {
                        } else if ("ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && "spindlespeed".equals(englishName) && oporation == 3) {
                            // ZUOLAN设备主轴转速字段spindlespeed
                            value = String.valueOf(((new Random().nextInt(35)) + 1) * 100);
                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindleload".equals(englishName) && oporation == 3) {
                        } else if ("ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && "spindleload".equals(englishName) && oporation == 3) {
                            // ZUOLAN设备主轴负荷字段spindleload
                            value = String.valueOf(Integer.valueOf(new Random().nextInt(21)));
                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlebeilv".equals(englishName) && oporation == 3) {
                        } else if ("ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && "spindlebeilv".equals(englishName) && oporation == 3) {
                            // ZUOLAN设备主轴倍率字段spindlebeilv
                            value = String.valueOf((new Random().nextInt(13)) * 10);
                        } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "feedbeilv".equals(englishName) && oporation == 3) {
                        } else if ("ZUOLAN".equals(mdcEquipmentDetailedDto.getDriveType()) && "feedbeilv".equals(englishName) && oporation == 3) {
                            // ZUOLAN设备进给倍率字段feedbeilv
                            value = String.valueOf((new Random().nextInt(13)) * 10);
                        } else if ("spindle_current".equals(englishName)) {
                            // å…¶ä»–设备电流字段
                            String devicePower = mdcEquipment.getDevicePower();
                            Object spindleload = jsonObject.get("spindleload");
                            String devicePower = mdcEquipmentDetailedDto.getDevicePower();
                            Object spindleload = mapData.get("spindleload");
                            BigDecimal load = spindleload == null ? BigDecimal.ZERO : new BigDecimal(spindleload.toString());
                            if (StringUtils.isNotEmpty(devicePower) && oporation == 3) {
                                value = new BigDecimal(devicePower).divide(new BigDecimal("380"), 2, BigDecimal.ROUND_HALF_UP).add(load).toString();
@@ -443,7 +409,7 @@
                            }
                        } else if ("torque".equals(englishName)) {
                            // æ‰­çŸ©å­—段
                            MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipment.getEquipmentId());
                            MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipmentDetailedDto.getEquipmentId());
                            if (mdcTorqueConfig != null) {
                                value = String.valueOf(mdcTorqueConfig.getTorqueValue());
                            } else {
@@ -457,7 +423,7 @@
                            }
                        } else if ("alarmContent".equals(englishName)) {
                            if (oporation == 22) {
                                List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, mdcEquipment.getDriveType()).eq(MdcAlarmInfo::getAlarmCode, equipmentLog.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                                List<MdcAlarmInfo> mdcAlarmInfo = mdcAlarmInfoService.list(new LambdaQueryWrapper<MdcAlarmInfo>().eq(MdcAlarmInfo::getDriveType, mdcEquipmentDetailedDto.getDriveType()).eq(MdcAlarmInfo::getAlarmCode, equipmentLog.getAlarm()).eq(MdcAlarmInfo::getIsUse, 0));
                                if (mdcAlarmInfo != null && !mdcAlarmInfo.isEmpty()) {
                                    value = mdcAlarmInfo.get(0).getAlarmContent();
                                }
@@ -465,20 +431,15 @@
                                value = "无";
                            }
                        } else {
                            value = result == null ? null : result.toString();
                            value = object == null ? "" : object.toString();
                        }
                        mdcDriveTypeParamConfig.setValue(value);
                        runData.put(chineseName, value);
                    }
                    mdcEquipmentDto.setMdcDriveTypeParamConfigList(mdcDriveTypeParamList);
                }
                EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId());
                if (equipmentBaseInfo != null) {
                    mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis());
                    mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis());
                }
            }
            result.put("runData", runData);
        }
        return mdcEquipmentDto;
        return result;
    }
    /**
@@ -861,6 +822,7 @@
    /**
     * æŸ¥è¯¢å•表数据
     *
     * @param tableName
     * @return
     */
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysUser.java
@@ -201,10 +201,6 @@
     */
    @TableField(exist = false)
    private String homePath;
    @Dict(dicCode = "id",dictTable = "mom_base_team",dicText = "name")
    private String teamId;
    @Dict(dicCode = "id",dictTable = "mom_base_area",dicText = "name")
    private String areaId;
    /**
     * å¯†ç é¦–次使用标识 1是 0否