lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java
@@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Select; import org.jeecg.modules.mdc.entity.Equipment; import java.util.List; /** * @Description: éé设å¤è¡¨ * @Author: liuS @@ -25,4 +27,6 @@ void deleteTableData(@Param("tableName") String saveTableName, @Param("day") String day); void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date); List<Equipment> listByProds(@Param("proIds") List<String> proIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -135,4 +135,8 @@ List<MdcEquipment> findByProIdsAndTeamCode(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("teamCodeList") List<String> teamCodeList); List<MdcEquipment> findByProIdsAndType(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("typeList") List<String> typeList); List<String> getEquIdsByProIds(@Param("proIds") List<String> proIds); List<MdcEquipment> findByProIds(@Param("proIds") List<String> proIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml
@@ -22,4 +22,19 @@ <select id="checkTableDataNum" resultType="java.lang.Integer"> SELECT COUNT(CollectTime) num FROM ${saveTableName} WHERE CollectTime < '${day}' </select> <select id="listByProds" resultType="org.jeecg.modules.mdc.entity.Equipment"> SELECT t1.* FROM Equipment t1 LEFT JOIN mdc_equipment t2 ON t1.EquipmentID = t2.equipment_id LEFT JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id <where> t3.production_id IN <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> </select> </mapper> lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -340,4 +340,32 @@ </foreach> </select> <select id="getEquIdsByProIds" resultType="java.lang.String"> SELECT t1.equipment_id FROM mdc_equipment t1 LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id <where> t2.production_id IN <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> </select> <select id="findByProIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipment"> SELECT t1.* FROM mdc_equipment t1 LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id <where> t2.production_id IN <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> </select> </mapper> lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.Equipment; import java.util.List; /** * @Description: éé设å¤è¡¨ * @Author: liuS @@ -48,4 +50,11 @@ * @param day */ void insertNoTableData(String backupTableName, String tableName, String day); /** * * @param proIds * @return */ List<Equipment> listByProds(List<String> proIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java
@@ -34,13 +34,12 @@ /** * æ¥æ¾æ³å °å 设å¤è¿è¡çç¨åºå· * @param drivetype * @param equipmentid * @param saveTableName * @param startTime * @param endTime * @return */ List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime); List<EquipmentMachingDto> getEquipProgramNum(String saveTableName, Date startTime, Date endTime); /** * æ¥è¯¢æ³æå 设å¤å 工工件å¼å§æ¶é´ lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -239,4 +239,8 @@ * @return */ List<MdcEquipment> findByProIdsAndType(List<String> allProductionIds, List<String> typeList); List<String> getEquIdsByProIds(List<String> proIds); List<MdcEquipment> findByProIds(List<String> proIds); } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java
@@ -6,6 +6,9 @@ import org.jeecg.modules.mdc.service.IEquipmentService; import org.springframework.stereotype.Service; import java.util.Collections; import java.util.List; /** * @Description: éé设å¤è¡¨ * @Author: liuS @@ -39,4 +42,9 @@ public void insertNoTableData(String backupTableName, String tableName, String day) { this.baseMapper.insertNoTableData(backupTableName, tableName, day); } @Override public List<Equipment> listByProds(List<String> proIds) { return this.baseMapper.listByProds(proIds); } } lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1042,4 +1042,14 @@ return this.baseMapper.findByProIdsAndType(allProductionIds, typeList); } @Override public List<String> getEquIdsByProIds(List<String> proIds) { return this.baseMapper.getEquIdsByProIds(proIds); } @Override public List<MdcEquipment> findByProIds(List<String> proIds) { return this.baseMapper.findByProIds(proIds); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,93 @@ package org.jeecg.modules.mdc.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcBoardService; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @Author: Lius * @CreateTime: 2025-05-06 * @Description: çæ¿æ¥å£ */ @Slf4j @Api(tags = "MDCçæ¿æ¥å£") @RestController @RequestMapping("/mdc/board") public class MdcBoardController { @Resource private IMdcBoardService mdcBoardService; @ApiOperation(value = "MDCçæ¿æ¥å£-设å¤è¿è¡ç¶æç»è®¡", notes = "MDCçæ¿æ¥å£-设å¤è¿è¡ç¶æç»è®¡") @GetMapping("/equipmentStatusStatistics") public Result<?> equipmentStatusStatistics(String productionId) { Map<String, Object> result = mdcBoardService.equipmentStatusStatistics(productionId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-è·å车é´åç»", notes = "MDCçæ¿æ¥å£-è·å车é´åç»") @GetMapping("/proList") public Result<?> proList(String productionId) { List<MdcProduction> result = mdcBoardService.proList(productionId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-çåæèµ°å¿å¾", notes = "MDCçæ¿æ¥å£-çåæèµ°å¿å¾") @GetMapping("/rateAnalysisTrend") public Result<?> rateAnalysisTrend(String productionId) { Map<String, Object> result = mdcBoardService.rateAnalysisTrend(productionId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-设å¤å表", notes = "MDCçæ¿æ¥å£-设å¤å表") @GetMapping("/equipmentList") public Result<?> equipmentList(@RequestParam(name = "productionId", required = true) String productionId) { List<MdcEquipment> result = mdcBoardService.equipmentList(productionId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-è®¾å¤æ¥çåæ", notes = "MDCçæ¿æ¥å£-è®¾å¤æ¥çåæ") @GetMapping("/rateAnalysisTrendDay") public Result<?> rateAnalysisTrendDay(@RequestParam(name = "equipmentId", required = true) String equipmentId) { Map<String, Object> result = mdcBoardService.rateAnalysisTrendDay(equipmentId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-è®¾å¤æçåæåæ ¼ç", notes = "MDCçæ¿æ¥å£-è®¾å¤æçåæåæ ¼ç") @GetMapping("/rateAnalysisTrendMonth") public Result<?> rateAnalysisTrendMonth(@RequestParam(name = "equipmentId", required = true) String equipmentId) { Map<String, Object> result = mdcBoardService.rateAnalysisTrendMonth(equipmentId); return Result.OK(result); } @ApiOperation(value = "MDCçæ¿æ¥å£-设å¤è¿è¡ç¶æåè¿è¡åæ°ä¿¡æ¯", notes = "MDCçæ¿æ¥å£-设å¤è¿è¡ç¶æåè¿è¡åæ°ä¿¡æ¯") @GetMapping("/equipmentRealTimeDetail") public Result<?> equipmentRealTimeDetail(@RequestParam(name = "equipmentId", required = true) String equipmentId) { Map<String, Object> result = mdcBoardService.rateAnalysisTrendMonth(equipmentId); return Result.OK(result); } // @ApiOperation(value = "MDCé¦é¡µæ¥å£-设å¤äº§ååæ ¼ç", notes = "MDCé¦é¡µæ¥å£-设å¤äº§ååæ ¼ç") // @GetMapping("/passRate") // public Result<?> passRate(@RequestParam(name = "equipmentId", required = true) String equipmentId) { // Map<String, Object> result = mdcBoardService.passRate(equipmentId); // return Result.OK(result); // } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java
@@ -5,6 +5,8 @@ import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import java.util.List; /** * @Description: 设å¤åæ¥è¿è¡æ°æ®è¡¨ * @Author: jeecg-boot @@ -28,4 +30,10 @@ Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date); List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(@Param("equipmentList") List<String> equipmentList, @Param("start") String start, @Param("end") String end); List<MdcEquipmentStatisticalInfo> findByEquIdAndDate(@Param("equipmentId") String equipmentId, @Param("start") String start, @Param("end") String end); MdcEquipmentStatisticalInfo findByEquIdAndMonth(@Param("equipmentId") String equipmentId, @Param("month") String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java
@@ -7,6 +7,9 @@ import org.jeecg.modules.mdc.entity.MdcOeeInfo; import org.jeecg.modules.mdc.vo.MdcOeeInfoVo; import java.math.BigDecimal; import java.util.List; /** * @Description: OEE表 * @Author: lius @@ -22,4 +25,10 @@ * @return */ IPage<MdcOeeInfo> pageList(Page<MdcOeeInfo> page, @Param("mdcOeeInfoVo") MdcOeeInfoVo mdcOeeInfoVo); List<MdcOeeInfo> findByEquIdsAndDate(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end); List<MdcOeeInfo> findByEquIdAndDate(@Param("equipmentId") String equipmentId, @Param("start") String start, @Param("end") String end); BigDecimal findByEquIdAndMonth(@Param("equipmentId") String equipmentId, @Param("month") String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -26,4 +26,42 @@ WHERE equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%') </select> <select id="findByEquipmentAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> SELECT the_date, AVG ( open_long ) openLong, AVG ( wait_long ) waitLong, AVG ( process_long ) processLong, AVG ( close_long ) closeLong, AVG ( error_long ) errorLong FROM mdc_equipment_statistical_info <where> the_date BETWEEN #{start} AND #{end} AND equipment_id IN <foreach collection="equipmentList" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> GROUP BY the_date </select> <select id="findByEquIdAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> SELECT * FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date BETWEEN #{start} AND #{end} ORDER BY the_date </select> <select id="findByEquIdAndMonth" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> SELECT AVG(open_long) openLong, AVG(close_long) closeLong, AVG(wait_long) waitLong, AVG(process_long) processLong, AVG(error_long) errorLong FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{month}, '%') </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml
@@ -27,4 +27,37 @@ </where> ORDER BY the_date DESC, equipment_id ASC </select> <select id="findByEquIdsAndDate" resultType="org.jeecg.modules.mdc.entity.MdcOeeInfo"> SELECT the_date, AVG ( oee ) oee FROM mdc_oee_info <where> the_date BETWEEN #{start} AND #{end} AND equipment_id IN <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=","> #{ id } </foreach> </where> GROUP BY the_date ORDER BY the_date </select> <select id="findByEquIdAndDate" resultType="org.jeecg.modules.mdc.entity.MdcOeeInfo"> SELECT * FROM mdc_oee_info WHERE the_date BETWEEN #{start} AND #{end} AND equipment_id = #{equipmentId} ORDER BY the_date </select> <select id="findByEquIdAndMonth" resultType="java.math.BigDecimal"> SELECT AVG(oee) FROM mdc_oee_info WHERE the_date LIKE CONCAT(#{month}, '%') AND equipment_id = #{equipmentId} </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,49 @@ package org.jeecg.modules.mdc.service; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; import java.util.Map; /** * @Author: Lius * @CreateTime: 2025-05-06 * @Description: çæ¿æ¥å£ */ public interface IMdcBoardService { /** * 设å¤ç¶æ */ Map<String, Object> equipmentStatusStatistics(String productionId); /** * è·å车é´å表 */ List<MdcProduction> proList(String productionId); /** * çåæèµ°å¿ */ Map<String, Object> rateAnalysisTrend(String productionId); /** * 设å¤å表 */ List<MdcEquipment> equipmentList(String productionId); /** * è®¾å¤æ¥å©ç¨çåæ */ Map<String, Object> rateAnalysisTrendDay(String equipmentId); /** * è®¾å¤æçåæ */ Map<String, Object> rateAnalysisTrendMonth(String equipmentId); // /** // * 设å¤äº§ååæ ¼ç // */ // Map<String, Object> passRate(String equipmentId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -1,8 +1,11 @@ package org.jeecg.modules.mdc.service; import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto; import org.jeecg.modules.mdc.entity.Equipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** * @Description: 设å¤åæ¥è¿è¡æ°æ®è¡¨ @@ -29,4 +32,10 @@ Integer selectProcessLong(String equipmentId, String validDate); MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date); List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentList, String start, String end); List<MdcEquipmentStatisticalInfo> findByEquIdAndDate(String equipmentId, String start, String end); MdcEquipmentStatisticalInfo findByEquIdAndMonth(String equipmentId, String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java
@@ -9,6 +9,8 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.List; /** * @Description: OEE表 @@ -44,4 +46,9 @@ */ void computeOee(MdcOeeComputeVo mdcOeeComputeVo); List<MdcOeeInfo> findByEquIdsAndDate(List<String> equipmentIdList, String start, String end); List<MdcOeeInfo> findByEquIdAndDate(String equipmentId, String start, String end); BigDecimal findByEquIdAndMonth(String equipmentId, String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java
@@ -55,8 +55,8 @@ } @Override public List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime) { return equipmentWorkLineMapper.getEquipProgramNum(drivetype + "_" + equipmentid, startTime, endTime); public List<EquipmentMachingDto> getEquipProgramNum(String saveTableName, Date startTime, Date endTime) { return equipmentWorkLineMapper.getEquipProgramNum(saveTableName, startTime, endTime); } @Override lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,283 @@ package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.sun.org.apache.bcel.internal.generic.NEW; import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.mdc.constant.MdcConstant; import org.jeecg.modules.mdc.entity.Equipment; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import org.jeecg.modules.mdc.entity.MdcOeeInfo; import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcBoardRateVo; import org.jeecg.modules.mdc.vo.MdcEquipmentStatusVo; import org.jeecg.modules.mdcJc.service.IMdcJcRcJobreportService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; /** * @Author: Lius * @CreateTime: 2025-05-06 * @Description: çæ¿æ¥å£ */ @Service public class MdcBoardServiceImpl implements IMdcBoardService { @Resource private IMdcProductionService mdcProductionService; @Resource private IEquipmentService equipmentService; @Resource private IMdcEquipmentService mdcEquipmentService; @Resource private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; @Resource private IMdcOeeInfoService mdcOeeInfoService; @Resource private IMdcJcRcJobreportService mdcJcRcJobreportService; /** * 设å¤ç¶æ */ @Override public Map<String, Object> equipmentStatusStatistics(String productionId) { Map<String, Object> result = new HashMap<>(); if (StringUtils.isBlank(productionId)) { MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); productionId = mdcProduction.getId(); } List<String> proIds = mdcProductionService.findChildByProId(productionId); if (proIds == null || proIds.isEmpty()) { return result; } List<Equipment> equipmentList = equipmentService.listByProds(proIds); if (equipmentList == null || equipmentList.isEmpty()) { return result; } MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo(); for (Equipment equipment : equipmentList) { if (equipment.getOporation() != null) { switch (equipment.getOporation()) { case 1: case 2: mdcEquipmentStatusVo.setWaitCount(mdcEquipmentStatusVo.getWaitCount() + 1); break; case 3: mdcEquipmentStatusVo.setRunCount(mdcEquipmentStatusVo.getRunCount() + 1); break; case 22: mdcEquipmentStatusVo.setAlarmCount(mdcEquipmentStatusVo.getAlarmCount() + 1); break; default: mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1); break; } } else { mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1); } } result.put("equipmentStatus", mdcEquipmentStatusVo); return result; } /** * è·å产线å表 */ @Override public List<MdcProduction> proList(String productionId) { if (StringUtils.isBlank(productionId)) { MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); productionId = mdcProduction.getId(); } return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, productionId).eq(MdcProduction::getMdcFlag, "1").eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0).orderByAsc(MdcProduction::getProductionOrder)); } /** * çåæèµ°å¿ */ @Override public Map<String, Object> rateAnalysisTrend(String productionId) { Map<String, Object> result = new HashMap<>(); if (StringUtils.isBlank(productionId)) { MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, "")); productionId = mdcProduction.getId(); } List<String> proIds = mdcProductionService.findChildByProId(productionId); if (proIds == null || proIds.isEmpty()) { return result; } List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds); if (equipmentIdList == null || equipmentIdList.isEmpty()) { return result; } LocalDate now = LocalDate.now(); Date startDate = DateUtils.toDate(now.plusDays(-15).toString(), DateUtils.STR_DATE); Date endDate = DateUtils.toDate(now.plusDays(-1).toString(), DateUtils.STR_DATE); String start = DateUtils.format(startDate, DateUtils.STR_DATE); String end = DateUtils.format(endDate, DateUtils.STR_DATE); List<String> dateList = DateUtils.getDatesStringList(startDate, endDate); List<String> dates = dateList.stream().map(date -> date.substring(5, 10)).collect(Collectors.toList()); result.put("dateList", dates); Map<String, MdcBoardRateVo> statisticsMap = new LinkedHashMap<>(); dateList.forEach(date -> { statisticsMap.put(date, new MdcBoardRateVo(date.substring(5, 10))); }); // TEEP 弿ºç å¼å¨ç List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquipmentAndDate(equipmentIdList, start.replaceAll("-", ""), end.replaceAll("-", "")); if (mdcEquipmentStatisticalInfo != null && !mdcEquipmentStatisticalInfo.isEmpty()) { mdcEquipmentStatisticalInfo.forEach(equipmentStatisticalInfo -> { String date = DateUtils.format(DateUtils.toDate(equipmentStatisticalInfo.getTheDate(), DateUtils.STRDATE), DateUtils.STR_DATE); if (statisticsMap.containsKey(date)) { MdcBoardRateVo mdcBoardRateVo = statisticsMap.get(date); if (equipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setUtilizationRate(equipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); } if (equipmentStatisticalInfo.getOpenLong().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setOpenRate(equipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); } if (equipmentStatisticalInfo.getOpenLong().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setStartRate(equipmentStatisticalInfo.getProcessLong().multiply(new BigDecimal("100").divide(equipmentStatisticalInfo.getOpenLong(), 2, RoundingMode.HALF_UP))); } statisticsMap.put(date, mdcBoardRateVo); } }); } // OEE List<MdcOeeInfo> oeeInfo = mdcOeeInfoService.findByEquIdsAndDate(equipmentIdList, start, end); if (oeeInfo != null && !oeeInfo.isEmpty()) { oeeInfo.forEach(mdcOeeInfo -> { if (statisticsMap.containsKey(mdcOeeInfo.getTheDate())) { MdcBoardRateVo mdcBoardRateVo = statisticsMap.get(mdcOeeInfo.getTheDate()); if (mdcOeeInfo.getOee().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setOee(mdcOeeInfo.getOee().setScale(2, RoundingMode.HALF_UP)); } statisticsMap.put(mdcOeeInfo.getTheDate(), mdcBoardRateVo); } }); } List<MdcBoardRateVo> dataList = new ArrayList<>(statisticsMap.values()); result.put("dataList", dataList); return result; } /** * 设å¤å表 */ @Override public List<MdcEquipment> equipmentList(String productionId) { List<String> proIds = mdcProductionService.findChildByProId(productionId); if (proIds == null || proIds.isEmpty()) { return null; } return mdcEquipmentService.findByProIds(proIds); } /** * è®¾å¤æ¥å©ç¨çåæ */ @Override public Map<String, Object> rateAnalysisTrendDay(String equipmentId) { Map<String, Object> result = new HashMap<>(); LocalDate now = LocalDate.now(); Date startDate = DateUtils.toDate(now.plusDays(-7).toString(), DateUtils.STR_DATE); Date endDate = DateUtils.toDate(now.plusDays(-1).toString(), DateUtils.STR_DATE); String start = DateUtils.format(startDate, DateUtils.STR_DATE); String end = DateUtils.format(endDate, DateUtils.STR_DATE); List<String> dayBetween = DateUtils.getDatesStringList(startDate, endDate); List<String> dateList = dayBetween.stream().map(date -> date.substring(5, 10)).collect(Collectors.toList()); result.put("dateList", dateList); Map<String, MdcBoardRateVo> statisticsMap = new LinkedHashMap<>(); dayBetween.forEach(date -> { statisticsMap.put(date, new MdcBoardRateVo(date.substring(5, 10))); }); // TEEP List<MdcEquipmentStatisticalInfo> mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdAndDate(equipmentId, start.replaceAll("-", ""), end.replaceAll("-", "")); if (mdcEquipmentStatisticalInfo != null && !mdcEquipmentStatisticalInfo.isEmpty()) { mdcEquipmentStatisticalInfo.forEach(equipmentStatisticalInfo -> { String date = DateUtils.format(DateUtils.toDate(equipmentStatisticalInfo.getTheDate(), DateUtils.STRDATE), DateUtils.STR_DATE); if (statisticsMap.containsKey(date)) { MdcBoardRateVo mdcBoardRateVo = statisticsMap.get(date); if (equipmentStatisticalInfo.getProcessLong().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setUtilizationRate(equipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); } statisticsMap.put(date, mdcBoardRateVo); } }); } // OEE List<MdcOeeInfo> oeeInfo = mdcOeeInfoService.findByEquIdAndDate(equipmentId, start, end); if (oeeInfo != null && !oeeInfo.isEmpty()) { oeeInfo.forEach(mdcOeeInfo -> { if (statisticsMap.containsKey(mdcOeeInfo.getTheDate())) { MdcBoardRateVo mdcBoardRateVo = statisticsMap.get(mdcOeeInfo.getTheDate()); if (mdcOeeInfo.getOee().compareTo(BigDecimal.ZERO) > 0) { mdcBoardRateVo.setOee(mdcOeeInfo.getOee().setScale(2, RoundingMode.HALF_UP)); } statisticsMap.put(mdcOeeInfo.getTheDate(), mdcBoardRateVo); } }); } List<MdcBoardRateVo> dataList = new ArrayList<>(statisticsMap.values()); result.put("dataList", dataList); return result; } /** * è®¾å¤æçåæ */ @Override public Map<String, Object> rateAnalysisTrendMonth(String equipmentId) { Map<String, Object> result = new HashMap<>(); LocalDate now = LocalDate.now(); Date start = DateUtils.toDate(now.plusMonths(-6).toString(), DateUtils.STR_DATE); Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE); List<String> monthBetween = DateUtils.getMonthBetween(start, end); List<String> dateList = new ArrayList<>(); List<MdcBoardRateVo> dataList = new ArrayList<>(); for (String month : monthBetween) { String name = month.substring(month.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "æ"; dateList.add(name); MdcBoardRateVo mdcBoardRateVo = new MdcBoardRateVo(); mdcBoardRateVo.setDate(name); // TEEP MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdAndMonth(equipmentId, month.replaceAll("-", "")); if (mdcEquipmentStatisticalInfo != null) { mdcBoardRateVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP)); } // OEE BigDecimal oee = mdcOeeInfoService.findByEquIdAndMonth(equipmentId, month); if (oee != null) { mdcBoardRateVo.setOee(oee.setScale(2, RoundingMode.HALF_UP)); } // åæ ¼ç BigDecimal passRate = mdcJcRcJobreportService.findRateByMonth(equipmentId, month); if (passRate != null) { mdcBoardRateVo.setPassRate(passRate); } dataList.add(mdcBoardRateVo); } result.put("dateList", dateList); result.put("dataList", dataList); return result; } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -553,13 +553,13 @@ if (e.getStatus() == 3) { equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, e.getEquipmentId())); if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("FANUC")) { List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipProgramNum(equip.getDrivetype(), equip.getEquipmentid(), List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipProgramNum(equip.getSavetablename(), e.getStartTime(), e.getEndTime()); if (esList != null && esList.size() > 1) { e.setSequenceNumber(esList.get(0).getProgramnumber()); } } else if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("SIEMENS")) { List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getDrivetype() + "_" + equip.getEquipmentid(), e.getStartTime(), e.getEndTime()); List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getSavetablename(), e.getStartTime(), e.getEndTime()); if (esList != null && esList.size() > 1) { e.setSequenceNumber(esList.get(0).getSequencenumber()); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -323,4 +323,19 @@ public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) { return this.baseMapper.findByEquipmentAndMonth(equipmentId, date); } @Override public List<MdcEquipmentStatisticalInfo> findByEquipmentAndDate(List<String> equipmentList, String start, String end) { return this.baseMapper.findByEquipmentAndDate(equipmentList, start, end); } @Override public List<MdcEquipmentStatisticalInfo> findByEquIdAndDate(String equipmentId, String start, String end) { return this.baseMapper.findByEquIdAndDate(equipmentId, start, end); } @Override public MdcEquipmentStatisticalInfo findByEquIdAndMonth(String equipmentId, String month) { return this.baseMapper.findByEquIdAndMonth(equipmentId, month); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
@@ -262,4 +262,19 @@ super.saveBatch(result); } @Override public List<MdcOeeInfo> findByEquIdsAndDate(List<String> equipmentIdList, String start, String end) { return this.baseMapper.findByEquIdsAndDate(equipmentIdList, start, end); } @Override public List<MdcOeeInfo> findByEquIdAndDate(String equipmentId, String start, String end) { return this.baseMapper.findByEquIdAndDate(equipmentId, start, end); } @Override public BigDecimal findByEquIdAndMonth(String equipmentId, String month) { return this.baseMapper.findByEquIdAndMonth(equipmentId, month); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,47 @@ package org.jeecg.modules.mdc.vo; import lombok.Data; import java.math.BigDecimal; /** * @Author: Lius * @CreateTime: 2025-05-07 * @Description: çåæèµ°å¿vo */ @Data public class MdcBoardRateVo { /** * æ¥æ MM-dd */ private String date; /** * å©ç¨ç */ private BigDecimal utilizationRate = BigDecimal.ZERO; /** * å¼å¨ç */ private BigDecimal startRate = BigDecimal.ZERO; /** * 弿ºç */ private BigDecimal openRate = BigDecimal.ZERO; /** * OEE */ private BigDecimal oee = BigDecimal.ZERO; /** * åæ ¼ç */ private BigDecimal passRate = BigDecimal.ZERO; public MdcBoardRateVo() { } public MdcBoardRateVo(String date) { this.date = date; } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java
@@ -18,4 +18,5 @@ Integer selectTotalPassCount(@Param("equipmentId") String equipmentId, @Param("date") String validDate); MesRcJobreport findRateByMonth(@Param("equipmentId") String equipmentId, @Param("month") String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml
@@ -3,11 +3,22 @@ <mapper namespace="org.jeecg.modules.mdcJc.mapper.MdcJcRcJobreportMapper"> <select id="selectTotalProcessCount" resultType="java.lang.Integer"> SELECT okuqty + nookqty FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date} SELECT process_count FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date} </select> <select id="selectTotalPassCount" resultType="java.lang.Integer"> SELECT okuqty FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date} </select> <select id="findRateByMonth" resultType="org.jeecg.modules.mdcJc.dto.MesRcJobreport"> SELECT SUM(okuqty) okuqty, SUM(process_count) qty FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{month}, '%') </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java
@@ -4,6 +4,7 @@ import org.jeecg.modules.mdcJc.dto.MesRcJobreport; import org.jeecg.modules.mdcJc.entity.MdcJcRcJobreport; import java.math.BigDecimal; import java.util.List; /** @@ -17,4 +18,5 @@ Integer selectTotalPassCount(String equipmentId, String validDate); BigDecimal findRateByMonth(String equipmentId, String month); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java
@@ -11,6 +11,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.List; /** @@ -42,4 +44,14 @@ } } @Override public BigDecimal findRateByMonth(String equipmentId, String month) { BigDecimal rate = BigDecimal.ZERO; MesRcJobreport mesRcJobreport = this.baseMapper.findRateByMonth(equipmentId, month); if (mesRcJobreport != null && mesRcJobreport.getQty().compareTo(BigDecimal.ZERO) > 0) { rate = mesRcJobreport.getOkuqty().divide(mesRcJobreport.getQty(), 2, RoundingMode.HALF_UP); } return rate; } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -61,4 +61,7 @@ List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList); List<String> findProIdsByUId(@Param("userId") String userId, @Param("allProductionIds") List<String> allProductionIds); List<String> findChildByProId(@Param("productionId") String productionId); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -138,4 +138,26 @@ </foreach> AND user_id = #{userId} </select> <select id="findChildByProId" resultType="java.lang.String"> WITH temp ( id ) AS ( SELECT id FROM mdc_production WHERE id = #{ productionId } AND mdc_flag = '1' UNION ALL SELECT a.id FROM mdc_production a INNER JOIN temp ON a.parent_id = temp.id WHERE a.mdc_flag = '1' ) SELECT * FROM temp </select> </mapper> lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -175,4 +175,12 @@ * @return */ List<String> findProIdsByUId(String userId, List<String> allProductionIds); /** * * @param productionId * @return */ List<String> findChildByProId(String productionId); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -600,6 +600,11 @@ return this.baseMapper.findProIdsByUId(userId, allProductionIds); } @Override public List<String> findChildByProId(String productionId) { return this.baseMapper.findChildByProId(productionId); } /** * æå¼ ç¶èç¹ å 以ä¸çmdcæ è®° * @param parentId