From e935889261ef38c8eaef31e54cbfc466d63d2ef4 Mon Sep 17 00:00:00 2001 From: hyingbo <1363390067@qq.com> Date: 星期四, 17 七月 2025 09:42:28 +0800 Subject: [PATCH] fanuc获取程序名、获取报警描述 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java | 62 ++++++++++++++++++------------- 1 files changed, 36 insertions(+), 26 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java index 5f89d3e..4e6a883 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; import org.jeecg.common.system.vo.DictModel; +import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; import org.jeecg.modules.mdc.entity.*; import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper; import org.jeecg.modules.mdc.service.*; @@ -14,6 +15,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; /** @@ -35,10 +37,7 @@ private IMdcSystemParametersService mdcSystemParametersService; @Resource - private ISysDictService sysDictService; - - @Resource - private IEquipmentStatisticalInfoService equipmentStatisticalInfoService; + private IMdcEquipmentFaultInfoService mdcEquipmentFaultInfoService; /** * 璁$畻璁惧鍗曟棩杩愯鏁版嵁 @@ -67,28 +66,8 @@ } if (!result.isEmpty()) { this.saveBatch(result); - List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); - if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { - List<EquipmentStatisticalInfo> list = this.dataHandle(result); - equipmentStatisticalInfoService.saveBatch(list); - } } - } - - private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { - List<EquipmentStatisticalInfo> result = new ArrayList<>(); - list.forEach(item -> { - EquipmentStatisticalInfo equipmentStatisticalInfo = new EquipmentStatisticalInfo(); - equipmentStatisticalInfo.setEquipment(item.getEquipmentId()); - equipmentStatisticalInfo.setTheDate(item.getTheDate()); - equipmentStatisticalInfo.setClosedLong(item.getCloseLong()); - equipmentStatisticalInfo.setOpeningLong(item.getOpenLong()); - equipmentStatisticalInfo.setErroringLong(item.getErrorLong()); - equipmentStatisticalInfo.setProcessingLong(item.getProcessLong()); - equipmentStatisticalInfo.setWaitingLong(item.getWaitLong()); - result.add(equipmentStatisticalInfo); - }); - return result; + mdcEquipmentFaultInfoService.runningAllEquFaultStatistical(dateTime); } private List<MdcEquipmentStatisticalInfo> equipmentStatisticalProcess(Equipment equipment, String dateTime) { @@ -139,7 +118,6 @@ List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.listForEquipmentStatisticalInfo(equipment.getEquipmentid(), startDate, endDate); return this.statisticsData(equipmentRunningSectionList, planTime, startDate, endDate, equipment); } else { - //寰呴獙璇� Date end = DateUtils.plusTime(initDate, 1); endDate = DateUtils.setTimeForDay(end, planTime); List<MdcEquipmentRunningSection> equipmentRunningSectionList = mdcEquipmentRunningSectionService.listForEquipmentStatisticalInfo(equipment.getEquipmentid(), startDate, endDate); @@ -299,4 +277,36 @@ } return equipmentStatisticalInfos; } + + /** + * 鏌ヨ璁惧杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public Integer selectProcessLong(String equipmentId, String validDate) { + Integer processLong = this.baseMapper.selectProcessLong(equipmentId, validDate); + if (processLong == null) { + return 0; + } else { + return Integer.parseInt(new BigDecimal(processLong).divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).toString()); + } + } + + @Override + public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) { + return this.baseMapper.findByEquipmentAndMonth(equipmentId, date); + } + + @Override + public MdcEquipmentStatisticalInfo findByEquIdsAndMonth(List<String> equipmentIdList, String month) { + return this.baseMapper.findByEquIdsAndMonth(equipmentIdList, month); + } + + @Override + public List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentIdList, String date) { + return this.baseMapper.findByEquipmentAndDate(equipmentIdList, date); + } } -- Gitblit v1.9.3