From 0bd71968ff07a70c421a0f41a642742fedf125bd Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期三, 31 七月 2024 10:29:14 +0800 Subject: [PATCH] update --- lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml | 11 +++++ lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java | 7 +++ lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 5 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java | 8 ++++ lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java | 4 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java | 41 ++++++++++++++++++++ 6 files changed, 75 insertions(+), 1 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java index ea1fcea..6f02af1 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java @@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -38,6 +39,13 @@ @ApiModelProperty(value = "璁惧鍚嶇О") private String equipmentName; /** + * 杞﹂棿鍚嶇О + */ + @Excel(name = "杞﹂棿鍚嶇О", width = 15) + @ApiModelProperty(value = "杞﹂棿鍚嶇О") + @TableField(exist = false) + private String productionName; + /** * 璁惧鍨嬪彿 */ @Excel(name = "璁惧鍨嬪彿", width = 15) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java index 0bc60f5..e1f8fc0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java @@ -12,6 +12,8 @@ import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcOverallEquipmentEfficiencyVo; +import org.jeecg.modules.system.entity.MdcProduction; +import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -58,6 +60,9 @@ @Resource private IProcessCountService processCountService; + @Resource + private IMdcProductionService mdcProductionService; + /** * 璁$畻璁惧缁煎悎鏁堢巼OEE */ @@ -98,6 +103,8 @@ mdcOverallEquipmentEfficiency.setEquipmentName(mdcEquipment.getEquipmentName()); mdcOverallEquipmentEfficiency.setEquipmentModel(mdcEquipment.getEquipmentModel()); mdcOverallEquipmentEfficiency.setValidDate(validDate); + // +// mdcOverallEquipmentEfficiency.setProductionName(); // 鏌ヨ鐝埗鍒嗙被 List<String> shiftSubIdList = mdcDeviceCalendarService.findShiftSort(equipmentId, validDate); @@ -287,6 +294,38 @@ if (StringUtils.isNotEmpty(mdcOverallEquipmentEfficiencyVo.getDriveType())) { mdcOverallEquipmentEfficiencyVo.setDriveTypeList(Arrays.asList(mdcOverallEquipmentEfficiencyVo.getDriveType().split(","))); } - return this.baseMapper.pageList(page, mdcOverallEquipmentEfficiencyVo); + IPage<MdcOverallEquipmentEfficiency> mdcOverallEquipmentEfficiencyIPage = this.baseMapper.pageList(page, mdcOverallEquipmentEfficiencyVo); +// List<MdcOverallEquipmentEfficiency> list = mdcOverallEquipmentEfficiencyIPage.getRecords(); + for (MdcOverallEquipmentEfficiency mdcOverallEquipmentEfficiency : mdcOverallEquipmentEfficiencyIPage.getRecords()) { + mdcOverallEquipmentEfficiency.setProductionName(this.findProductionName(mdcOverallEquipmentEfficiency.getEquipmentId())); + } + return mdcOverallEquipmentEfficiencyIPage; } + + + /** + * 閫掑綊鏌ヨ璁惧杞﹂棿鍚嶇О + * + * @param equipmentId + * @return + */ + private String findProductionName(String equipmentId) { + MdcProduction mdcProduction = mdcProductionService.findProductionList(equipmentId); + if ("2".equals(mdcProduction.getOrgType())) { + return mdcProduction.getProductionName(); + } else { + return this.findProductionNameById(mdcProduction.getParentId()); + } + } + + private String findProductionNameById(String parentId) { + MdcProduction mdcProduction = mdcProductionService.getById(parentId); + if ("2".equals(mdcProduction.getOrgType())) { + return mdcProduction.getProductionName(); + } else { + return this.findProductionNameById(parentId); + } + } + + } 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 de6a479..3780573 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 @@ -29,6 +29,7 @@ /** * 鏍规嵁鐢ㄦ埛id鍜岃溅闂磇d鑾峰彇鐢ㄦ埛鎷ユ湁鐨勮溅闂磇d + * * @param userId * @param productionId * @return @@ -37,8 +38,11 @@ /** * 鏍规嵁鐢ㄦ埛id鏌ヨ鐢ㄦ埛宸ユ鏉冮檺 + * * @param userId * @return */ String findThreeProductionId(@Param("userId") String userId); + + MdcProduction findProductionList(@Param("equipmentId") String equipmentId); } 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 119e935..b08f1a8 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 @@ -31,4 +31,15 @@ <select id="findThreeProductionId" resultType="java.lang.String"> SELECT TOP 1 t2.id id FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id WHERE t1.user_id = #{userId} AND t2.org_type = '3' </select> + + <select id="findProductionList" resultType="org.jeecg.modules.system.entity.MdcProduction"> + SELECT + t1.* + FROM + mdc_production t1 + LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.production_id + LEFT JOIN mdc_equipment t3 ON t3.id = t2.equipment_id + WHERE + t3.equipment_id = #{equipmentId} + </select> </mapper> \ No newline at end of file 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 cfd203d..709087f 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 @@ -83,4 +83,11 @@ * 鏍规嵁鐢ㄦ埛id鏌ヨ鐢ㄦ埛宸ユ鏉冮檺 */ String findThreeProductionId(String userId); + + /** + * + * @param equipmentId + * @return + */ + MdcProduction findProductionList(String equipmentId); } 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 e0511bb..921d363 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 @@ -243,6 +243,11 @@ return this.baseMapper.findThreeProductionId(userId); } + @Override + public MdcProduction findProductionList(String equipmentId) { + return this.baseMapper.findProductionList(equipmentId); + } + /** * delete 鏂规硶璋冪敤 閫掑綊鏌ユ壘瀛愰泦id */ -- Gitblit v1.9.3