From 4a1ef7f62d8fc364bef0e0caa02b1792bd052513 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期一, 15 一月 2024 17:45:34 +0800 Subject: [PATCH] 扭矩工作曲线展示 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 45 ++++++++++++++++++++++++++++++++++----------- 1 files changed, 34 insertions(+), 11 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 0a74de7..83bebd6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java @@ -35,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.*; @@ -73,6 +74,9 @@ @Resource private IEquipmentLogService equipmentLogService; + + @Resource + private IEquipmentBaseInfoService equipmentBaseInfoService; @Override public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) { @@ -393,15 +397,23 @@ if ("CollectTime".equals(englishName)) { Date date = result == null ? null : (Date) result; value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL); - } else { - value = result == null ? null : result.toString(); - } - // ZUOLAN璁惧鐢垫祦瀛楁AI01 - if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) { + } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) { + // ZUOLAN璁惧鐢垫祦瀛楁AI01 value = BigDecimal.valueOf(Math.random() * 15 + 0).setScale(1, RoundingMode.HALF_UP).toString(); - } - // 鍏朵粬璁惧鐢垫祦瀛楁 - if ("spindle_current".equals(englishName)) { + } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlespeed".equals(englishName) && oporation == 3) { + // ZUOLAN璁惧涓昏酱杞�熷瓧娈祍pindlespeed + value = String.valueOf(((new Random().nextInt(35)) + 1) * 100); + } else if ("ZUOLAN".equals(mdcEquipment.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) { + // ZUOLAN璁惧涓昏酱鍊嶇巼瀛楁spindlebeilv + value = String.valueOf((new Random().nextInt(13)) * 10); + } else if ("ZUOLAN".equals(mdcEquipment.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"); BigDecimal load = spindleload == null ? BigDecimal.ZERO : new BigDecimal(spindleload.toString()); @@ -410,19 +422,25 @@ } else { value = "0"; } - } - // 鎵煩瀛楁 - if ("torque".equals(englishName)) { + } else if ("torque".equals(englishName)) { + // 鎵煩瀛楁 MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipment.getEquipmentId()); if (mdcTorqueConfig != null) { value = String.valueOf(mdcTorqueConfig.getTorqueValue()); } else { value = "0"; } + } else { + value = result == null ? null : result.toString(); } mdcDriveTypeParamConfig.setValue(value); } mdcEquipmentDto.setMdcDriveTypeParamConfigList(mdcDriveTypeParamList); + } + EquipmentBaseInfo equipmentBaseInfo = equipmentBaseInfoService.getByEquipmentId(mdcEquipment.getEquipmentId()); + if (equipmentBaseInfo != null) { + mdcEquipmentDto.setMaxAxis(equipmentBaseInfo.getMaxAxis()); + mdcEquipmentDto.setValidAxis(equipmentBaseInfo.getValidAxis()); } } } @@ -677,4 +695,9 @@ return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); } + @Override + public IPage<MdcEquipment> pageList(Page<MdcEquipment> page, MdcEquipmentVo mdcEquipment, HttpServletRequest req) { + return this.baseMapper.pageList(page, mdcEquipment); + } + } -- Gitblit v1.9.3