From f9a9fb9090c2e9e1a4e00374d48181efe2463a56 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期五, 09 五月 2025 11:10:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml | 38 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java | 1 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml | 28 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java | 15 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java | 7 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml | 33 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java | 93 +++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java | 12 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java | 8 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 10 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java | 49 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java | 47 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java | 283 +++++++++++++++++++++ lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java | 3 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml | 15 + lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java | 5 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml | 22 + lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java | 8 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java | 15 + lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java | 9 lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java | 2 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 5 31 files changed, 759 insertions(+), 8 deletions(-) diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java index 3686e77..c51129a 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java +++ b/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); } diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java index cba730b..2446556 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java +++ b/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); } diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml index fbb1497..1d272bc 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml +++ b/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> \ No newline at end of file diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml index 19bb11d..8dbe98e 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml +++ b/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> diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java index 8dfe74b..c13462e 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java +++ b/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); } diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java index 076e641..0093c31 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java +++ b/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); /** * 鏌ヨ娉曟媺鍏嬭澶囧姞宸ュ伐浠跺紑濮嬫椂闂� diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java index dce27ed..76ddd1d 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java +++ b/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); } diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java index 3db46bc..67d9157 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java +++ b/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); + } } diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 3964351..5f44a71 100644 --- a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/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); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java new file mode 100644 index 0000000..6285356 --- /dev/null +++ b/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); +// } + + + + + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java index 03bb2bd..a21b8db 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java index 041a098..d37c1d0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml index 2d4f020..dcf3f48 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml +++ b/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> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml index 664b2fa..13a415c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml +++ b/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> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java new file mode 100644 index 0000000..2b02414 --- /dev/null +++ b/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); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java index 4b27b44..5050e95 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java index f544260..7c5c7e6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java index c0b336d..1692aad 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java +++ b/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 diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java new file mode 100644 index 0000000..468d909 --- /dev/null +++ b/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; + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java index 47fe41c..41a1684 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java +++ b/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()); } 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 87b92ae..efbad37 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 @@ -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); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java index 6906dbc..42269de 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java +++ b/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); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java new file mode 100644 index 0000000..6c938b4 --- /dev/null +++ b/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: 鐜囧垎鏋愯蛋鍔縱o + */ +@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; + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java index 0e00750..72c765c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml index 3052f63..131459f 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml +++ b/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> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java index 6e23de2..c04dcb6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java +++ b/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); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java index d6d4ad5..61b62bf 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java +++ b/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; + } + } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java index f53d482..cc1e3d6 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java +++ b/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); + } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml index 7d0b8f2..8c3c390 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml +++ b/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> diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java index 104a9db..8d1f5b6 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java +++ b/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); + } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java index c502486..6dee131 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java +++ b/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); + } + /** * 鎵撳紑 鐖惰妭鐐� 鍙� 浠ヤ笂鐨刴dc鏍囪 * @param parentId -- Gitblit v1.9.3