lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/FillRuleConstant.java
@@ -18,6 +18,11 @@ public static final String DEPART = "org_num_role"; /** * 产线ç¼ç */ public static final String PRODUCTION = "org_num_rule"; /** * åç±»åå ¸ç¼ç */ public static final String CATEGORY = "category_code_rule"; lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEfficiencyListDto.java
@@ -12,6 +12,12 @@ @Data public class MdcEfficiencyListDto { private String level1; private String level2; private String level3; /** * 设å¤ç¼ç */ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquDepDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,39 @@ package org.jeecg.modules.mdc.dto; import lombok.Data; /** * @author: LiuS * @create: 2023-07-04 11:02 */ @Data public class MdcEquDepDto { /** * é¨é¨id */ private String id; /** * é¨é¨ç¶id */ private String parentId; /** * é¨é¨åç§° */ private String departName; /** * å±çº§ç¼å· */ private String orgType; /** * 设å¤id */ private String equipmentId; /** * 设å¤åç§° */ private String equipmentName; /** * 设å¤ç±»å */ private String equipmentType; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcEquProDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,41 @@ package org.jeecg.modules.mdc.dto; import lombok.Data; /** * @author: LiuS * @create: 2023-07-04 11:06 */ @Data public class MdcEquProDto { /** * 产线id */ private String id; /** * 产线ç¶id */ private String parentId; /** * 产线åç§° */ private String productionName; /** * å±çº§ç¼å· */ private String orgType; /** * 设å¤id */ private String equipmentId; /** * 设å¤åç§° */ private String equipmentName; /** * 设å¤ç±»å */ private String equipmentType; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.dto.MdcEquDepDto; import org.jeecg.modules.mdc.dto.MdcEquProDto; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.mdc.vo.MdcEquipmentDepVo; @@ -63,4 +65,20 @@ * æ ¹æ®é¨é¨idæ¥è¯¢è®¾å¤idéå */ List<String> queryIdsByDeparts(@Param("allDepartIds") List<String> allDepartIds); /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åé¨é¨ä¿¡æ¯ * * @param equipmentIdList * @return */ List<MdcEquDepDto> findEquDepList(@Param("equipmentIdList") List<String> equipmentIdList); /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åäº§çº¿ä¿¡æ¯ * * @param equipmentIdList * @return */ List<MdcEquProDto> findEquProList(@Param("equipmentIdList") List<String> equipmentIdList); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -146,5 +146,49 @@ </foreach> </select> <!--æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åé¨é¨ä¿¡æ¯--> <select id="findEquDepList" resultType="org.jeecg.modules.mdc.dto.MdcEquDepDto"> SELECT sd.id, sd.parent_id, sd.depart_name, sd.org_type, me.equipment_id, me.equipment_name, me.equipment_type FROM mdc_equipment_depart med LEFT JOIN sys_depart sd ON med.dep_id = sd.id LEFT JOIN mdc_equipment me ON me.id = med.equipment_id <where> me.equipment_id IN <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> </select> <!--æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯å产线信æ¯--> <select id="findEquProList" resultType="org.jeecg.modules.mdc.dto.MdcEquProDto"> SELECT mp.id, mp.parent_id, mp.production_name, mp.org_type, me.equipment_id, me.equipment_name, me.equipment_type FROM mdc_production_equipment mpe LEFT JOIN mdc_production mp ON mpe.production_id = mp.id LEFT JOIN mdc_equipment me ON me.id = mpe.equipment_id <where> me.equipment_id IN <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")"> #{id} </foreach> </where> </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.dto.MdcEquDepDto; import org.jeecg.modules.mdc.dto.MdcEquProDto; import org.jeecg.modules.mdc.dto.MdcEquipmentDto; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; @@ -124,6 +126,7 @@ /** * æ ¹æ®è®¾å¤idæ¥è¯¢è®¾å¤åç§° * * @param equipmentId * @return */ @@ -139,4 +142,19 @@ */ MdcEquipment getEquipmentByPid(String pid, String userId); /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åé¨é¨ä¿¡æ¯ * * @param equipmentIdList * @return */ List<MdcEquDepDto> findEquDepList(List<String> equipmentIdList); /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åäº§çº¿ä¿¡æ¯ * * @param equipmentIdList * @return */ List<MdcEquProDto> findEquProList(List<String> equipmentIdList); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEfficiencyReportServiceImpl.java
@@ -1,12 +1,9 @@ package org.jeecg.modules.mdc.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import net.sf.saxon.expr.Component; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.mdc.dto.MdcEfficiencyDto; import org.jeecg.modules.mdc.dto.MdcEfficiencyListDto; import org.jeecg.modules.mdc.dto.MdcEfficiencyResultDto; import org.jeecg.common.constant.CommonConstant; import org.jeecg.modules.mdc.dto.*; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcUtilizationRate; import org.jeecg.modules.mdc.mapper.MdcEfficiencyReportMapper; @@ -16,12 +13,15 @@ import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcEfficiencyReportQueryVo; import org.jeecg.modules.mdc.vo.MdcEfficiencyVo; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysDepart; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysDepartService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; /** * @author: LiuS @@ -38,6 +38,12 @@ @Resource private IMdcUtilizationRateService mdcUtilizationRateService; @Resource private ISysDepartService sysDepartService; @Resource private IMdcProductionService mdcProductionService; /** * å©ç¨çæ¥è¡¨ @@ -87,20 +93,130 @@ // å©ç¨çç级 List<MdcUtilizationRate> mdcUtilizationRateList = mdcUtilizationRateService.listByType("lyl"); //å°è£ ç»æ List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().in(MdcEquipment::getEquipmentId, vo.getEquipmentIdList())); // å°è£ ç»æ if ("2".equals(vo.getTypeTree())) { // é¨é¨å±çº§ List<MdcEquDepDto> equipmentList = mdcEquipmentService.findEquDepList(vo.getEquipmentIdList()); // æ¥è¯¢ææé¨é¨ä¿¡æ¯ List<SysDepart> departList = sysDepartService.list(new LambdaQueryWrapper<SysDepart>().ne(SysDepart::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); for (MdcEquipment mdcEquipment : equipmentList) { MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); mdcEfficiencyListDto.setEquipmentId(mdcEquipment.getEquipmentId()); mdcEfficiencyListDto.setEquipmentName(mdcEquipment.getEquipmentName()); mdcEfficiencyListDto.setEquipmentType(mdcEquipment.getEquipmentType()); List<MdcEfficiencyResultDto> list = new ArrayList<>(); for (String date : dates) { list.add(this.efficiencyRate(efficiencyList, date, mdcEquipment, mdcUtilizationRateList)); for (MdcEquDepDto mdcEquDepDto : equipmentList) { MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); mdcEfficiencyListDto.setEquipmentId(mdcEquDepDto.getEquipmentId()); mdcEfficiencyListDto.setEquipmentName(mdcEquDepDto.getEquipmentName()); mdcEfficiencyListDto.setEquipmentType(mdcEquDepDto.getEquipmentType()); switch (mdcEquDepDto.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(mdcEquDepDto.getDepartName()); break; case "2": mdcEfficiencyListDto.setLevel2(mdcEquDepDto.getDepartName()); break; case "3": mdcEfficiencyListDto.setLevel3(mdcEquDepDto.getDepartName()); break; default: } SysDepart sysDepart = departList.stream().filter(depart -> depart.getId().equals(mdcEquDepDto.getParentId())).findAny().orElse(null); if (sysDepart != null) { switch (sysDepart.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(sysDepart.getDepartName()); break; case "2": mdcEfficiencyListDto.setLevel2(sysDepart.getDepartName()); break; case "3": mdcEfficiencyListDto.setLevel3(sysDepart.getDepartName()); break; default: } if (StringUtils.isNotEmpty(sysDepart.getParentId())) { departList.stream().filter(depart -> depart.getId().equals(sysDepart.getParentId())).findAny().ifPresent(depart1 -> { switch (depart1.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(depart1.getDepartName()); break; case "2": mdcEfficiencyListDto.setLevel2(depart1.getDepartName()); break; case "3": mdcEfficiencyListDto.setLevel3(depart1.getDepartName()); break; default: } }); } } List<MdcEfficiencyResultDto> list = new ArrayList<>(); for (String date : dates) { list.add(this.efficiencyRate(efficiencyList, date, mdcEquDepDto.getEquipmentId(), mdcUtilizationRateList)); } mdcEfficiencyListDto.setDataList(list); listDtos.add(mdcEfficiencyListDto); } mdcEfficiencyListDto.setDataList(list); listDtos.add(mdcEfficiencyListDto); } else { // 产线å±çº§ List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList()); // æ¥è¯¢ææäº§çº¿ä¿¡æ¯ List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString())); for (MdcEquProDto mdcEquProDto : equipmentList) { MdcEfficiencyListDto mdcEfficiencyListDto = new MdcEfficiencyListDto(); mdcEfficiencyListDto.setEquipmentId(mdcEquProDto.getEquipmentId()); mdcEfficiencyListDto.setEquipmentName(mdcEquProDto.getEquipmentName()); mdcEfficiencyListDto.setEquipmentType(mdcEquProDto.getEquipmentType()); switch (mdcEquProDto.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(mdcEquProDto.getProductionName()); break; case "2": mdcEfficiencyListDto.setLevel2(mdcEquProDto.getProductionName()); break; case "3": mdcEfficiencyListDto.setLevel3(mdcEquProDto.getProductionName()); break; default: } MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null); if (mdcProduction != null) { switch (mdcProduction.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(mdcProduction.getProductionName()); break; case "2": mdcEfficiencyListDto.setLevel2(mdcProduction.getProductionName()); break; case "3": mdcEfficiencyListDto.setLevel3(mdcProduction.getProductionName()); break; default: } if (StringUtils.isNotEmpty(mdcProduction.getParentId())) { productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> { switch (production1.getOrgType()) { case "1": mdcEfficiencyListDto.setLevel1(production1.getProductionName()); break; case "2": mdcEfficiencyListDto.setLevel2(production1.getProductionName()); break; case "3": mdcEfficiencyListDto.setLevel3(production1.getProductionName()); break; default: } }); } } List<MdcEfficiencyResultDto> list = new ArrayList<>(); for (String date : dates) { list.add(this.efficiencyRate(efficiencyList, date, mdcEquProDto.getEquipmentId(), mdcUtilizationRateList)); } mdcEfficiencyListDto.setDataList(list); listDtos.add(mdcEfficiencyListDto); } } result.setMdcEfficiencyList(listDtos); @@ -114,11 +230,11 @@ return null; } private MdcEfficiencyResultDto efficiencyRate(List<MdcEfficiencyDto> efficiencyList, String date, MdcEquipment mdcEquipment, List<MdcUtilizationRate> mdcUtilizationRateList) { private MdcEfficiencyResultDto efficiencyRate(List<MdcEfficiencyDto> efficiencyList, String date, String equipmentId, List<MdcUtilizationRate> mdcUtilizationRateList) { MdcEfficiencyResultDto mdcEfficiencyResultDto = new MdcEfficiencyResultDto(); if (efficiencyList != null && !efficiencyList.isEmpty()) { for (MdcEfficiencyDto efficiencyDto : efficiencyList) { if (date.equals(efficiencyDto.getTheDate()) && efficiencyDto.getEquipmentId().equals(mdcEquipment.getEquipmentId())) { if (date.equals(efficiencyDto.getTheDate()) && efficiencyDto.getEquipmentId().equals(equipmentId)) { mdcEfficiencyResultDto.setTheDate(efficiencyDto.getTheDate()); mdcEfficiencyResultDto.setProcessLong(efficiencyDto.getProcessLong()); mdcEfficiencyResultDto.setUtilizationRate(efficiencyDto.getUtilizationRate()); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -10,6 +10,8 @@ import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.mdc.dto.EquipmentTemperatureDto; import org.jeecg.modules.mdc.dto.MdcEquDepDto; import org.jeecg.modules.mdc.dto.MdcEquProDto; import org.jeecg.modules.mdc.dto.MdcEquipmentDto; import org.jeecg.modules.mdc.entity.*; import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper; @@ -634,7 +636,7 @@ } /** * æ ¹æ®äº§çº¿å±çº§æ¥è¯¢è®¾å¤å个 * æ ¹æ®äº§çº¿å±çº§æ¥è¯¢è®¾å¤å个 */ @Override public MdcEquipment getEquipmentByPid(String pid, String userId) { @@ -645,4 +647,26 @@ return null; } /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åé¨é¨ä¿¡æ¯ * * @param equipmentIdList * @return */ @Override public List<MdcEquDepDto> findEquDepList(List<String> equipmentIdList) { return this.baseMapper.findEquDepList(equipmentIdList); } /** * æ ¹æ®è®¾å¤ç¼å·æ¥è¯¢è®¾å¤ä¿¡æ¯åäº§çº¿ä¿¡æ¯ * * @param equipmentIdList * @return */ @Override public List<MdcEquProDto> findEquProList(List<String> equipmentIdList) { return this.baseMapper.findEquProList(equipmentIdList); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcTorqueConfigServiceImpl.java
@@ -27,7 +27,7 @@ * @Date: 2023-06-29 */ @Service public class MdcTorqueConfigServiceImpl extends ServiceImpl<MdcTorqueConfigMapper, MdcTorqueConfig> implements IMdcTorqueConfigService{ public class MdcTorqueConfigServiceImpl extends ServiceImpl<MdcTorqueConfigMapper, MdcTorqueConfig> implements IMdcTorqueConfigService { @Autowired private IMdcEquipmentService mdcEquipmentService; @@ -59,38 +59,38 @@ @Override public List<MdcTorqueConfig> findSpindleRunningCurve(float torqueValue, String equipmentId) { return this.baseMapper.findSpindleRunningCurve(torqueValue,equipmentId); return this.baseMapper.findSpindleRunningCurve(torqueValue, equipmentId); } @Override public IPage<MdcTorqueConfig> pageList(String userId, Page page, HttpServletRequest req, MdcTorqueConfig mdcTorqueConfig) { List<String> equipmentIds=new ArrayList<>(); if (StringUtils.isNotEmpty(mdcTorqueConfig.getParentId())&&StringUtils.isEmpty(mdcTorqueConfig.getEquipmentId())){ if ("2".equals(mdcTorqueConfig.getTypeTree())){ List<String> equipmentIds = new ArrayList<>(); if (StringUtils.isNotEmpty(mdcTorqueConfig.getParentId()) && StringUtils.isEmpty(mdcTorqueConfig.getEquipmentId())) { if ("2".equals(mdcTorqueConfig.getTypeTree())) { //é¨é¨å±çº§ equipmentIds=mdcEquipmentService.getEquipmentIdsByDepart(userId,mdcTorqueConfig.getParentId()); }else { equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcTorqueConfig.getParentId()); } else { //产线å±çº§ equipmentIds=mdcEquipmentService.getEquipmentIdsProduction(userId,mdcTorqueConfig.getParentId()); equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcTorqueConfig.getParentId()); } }else if (StringUtils.isNotEmpty(mdcTorqueConfig.getEquipmentId())){ } else if (StringUtils.isNotEmpty(mdcTorqueConfig.getEquipmentId())) { //åå°è®¾å¤ä¿¡æ¯ mdcTorqueConfig.setMdcSectionIds(Collections.singletonList(mdcTorqueConfig.getEquipmentId())); }else { } else { //æ¥è¯¢ç¨æ·ææ¥æçææè®¾å¤ä¿¡æ¯ if ("2".equals(mdcTorqueConfig.getTypeTree())){ if ("2".equals(mdcTorqueConfig.getTypeTree())) { //é¨é¨å±çº§ equipmentIds=mdcEquipmentService.getEquipmentIdsByDepart(userId,null); }else { equipmentIds=mdcEquipmentService.getEquipmentIdsProduction(userId,null); equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); } else { equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); } } if (mdcTorqueConfig.getMdcSectionIds()==null||mdcTorqueConfig.getMdcSectionIds().isEmpty()){ if (mdcTorqueConfig.getMdcSectionIds() == null || mdcTorqueConfig.getMdcSectionIds().isEmpty()) { mdcTorqueConfig.setMdcSectionIds(equipmentIds); } if (mdcTorqueConfig.getMdcSectionIds()==null||mdcTorqueConfig.getMdcSectionIds().isEmpty()){ if (mdcTorqueConfig.getMdcSectionIds() == null || mdcTorqueConfig.getMdcSectionIds().isEmpty()) { return null; } return this.baseMapper.pageList(page,mdcTorqueConfig); return this.baseMapper.pageList(page, mdcTorqueConfig); } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/rule/OrgCodeProRule.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,98 @@ package org.jeecg.modules.system.rule; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.netty.util.internal.StringUtil; import org.jeecg.common.handler.IFillRuleHandler; import org.jeecg.common.util.SpringContextUtils; import org.jeecg.common.util.YouBianCodeUtil; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; import java.util.ArrayList; import java.util.List; /** * @author: LiuS * @create: 2023-07-04 16:15 * @Description: è½¦é´æºæç¼ç çæè§å */ public class OrgCodeProRule implements IFillRuleHandler { @Override public Object execute(JSONObject params, JSONObject formData) { IMdcProductionService mdcProductionService = (IMdcProductionService) SpringContextUtils.getBean("mdcProductionServiceImpl"); LambdaQueryWrapper<MdcProduction> query = new LambdaQueryWrapper<MdcProduction>(); LambdaQueryWrapper<MdcProduction> query1 = new LambdaQueryWrapper<MdcProduction>(); // å建ä¸ä¸ªListéå,å卿¥è¯¢è¿åçææMdcProduction对象 List<MdcProduction> mdcProductionList = new ArrayList<>(); String[] strArray = new String[2]; //å®ä¹è½¦é´ç±»å String orgType = ""; // å®ä¹æ°ç¼ç å符串 String newOrgCode = ""; // å®ä¹æ§ç¼ç å符串 String oldOrgCode = ""; String parentId = null; if (formData != null && formData.size() > 0) { Object obj = formData.get("parentId"); if (obj != null) { parentId = obj.toString(); } } else { if (params != null) { Object obj = params.get("parentId"); if (obj != null) { parentId = obj.toString(); } } } //å¦ææ¯æé«çº§,åæ¥è¯¢åºå级çorg_code, è°ç¨å·¥å ·ç±»çæç¼ç å¹¶è¿å if (StringUtil.isNullOrEmpty(parentId)) { // çº¿å¤ææ°æ®åºä¸ç表æ¯å¦ä¸ºç©º,空åç´æ¥è¿ååå§ç¼ç query1.eq(MdcProduction::getParentId, "").or().isNull(MdcProduction::getParentId); query1.orderByDesc(MdcProduction::getOrgCode); mdcProductionList = mdcProductionService.list(query1); if (mdcProductionList == null || mdcProductionList.size() == 0) { strArray[0] = YouBianCodeUtil.getNextYouBianCode(null); strArray[1] = "1"; return strArray; } else { MdcProduction mdcProduction = mdcProductionList.get(0); oldOrgCode = mdcProduction.getOrgCode(); orgType = mdcProduction.getOrgType(); newOrgCode = YouBianCodeUtil.getNextYouBianCode(oldOrgCode); } } else {//åä¹åæ¥è¯¢åºææå级ç车é´,è·åç»æåæä¸¤ç§æ åµ,æåçº§åæ²¡æå级 // å°è£ æ¥è¯¢åçº§çæ¡ä»¶ query.eq(MdcProduction::getParentId, parentId); // éåºæåº query.orderByDesc(MdcProduction::getOrgCode); // æ¥è¯¢åºå级产线çéå List<MdcProduction> parentList = mdcProductionService.list(query); // æ¥è¯¢åºç¶çº§äº§çº¿ MdcProduction production = mdcProductionService.getById(parentId); // è·åç¶çº§äº§çº¿çcode String parentCode = production.getOrgCode(); // æ ¹æ®ç¶çº§äº§çº¿ç±»åç®åºå½å产线çç±»å orgType = String.valueOf(Integer.valueOf(production.getOrgType()) + 1); // å¤çå级产线为nullçæ åµ if (parentList == null || parentList.size() == 0) { // ç´æ¥çæå½åç产线ç¼ç å¹¶è¿å newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, null); } else { //å¤çæåçº§äº§çº¿çæ åµ // è·åå级产线çç¼ç ,å©ç¨å·¥å ·ç±» String subCode = parentList.get(0).getOrgCode(); // è¿åçæçå½å产线ç¼ç newOrgCode = YouBianCodeUtil.getSubYouBianCode(parentCode, subCode); } } // è¿åæç»å°è£ äºäº§çº¿ç¼ç å产线类åçæ°ç» strArray[0] = newOrgCode; strArray[1] = orgType; return strArray; } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -1,10 +1,13 @@ package org.jeecg.modules.system.service.impl; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.FillRuleConstant; import org.jeecg.common.util.FillRuleUtil; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.MdcProductionEquipment; @@ -122,6 +125,15 @@ mdcProduction.setParentId(""); } mdcProduction.setId(IdWorker.getIdStr(mdcProduction)); // å å¤æè¯¥å¯¹è±¡ææ ç¶çº§ID,æåæå³ç䏿¯æé«çº§,å¦åæå³çæ¯æé«çº§ // è·åç¶çº§ID String parentId = mdcProduction.getParentId(); JSONObject formData = new JSONObject(); formData.put("parentId",parentId); String[] codeArray = (String[]) FillRuleUtil.executeRule(FillRuleConstant.PRODUCTION,formData); mdcProduction.setOrgCode(codeArray[0]); String orgType = codeArray[1]; mdcProduction.setOrgType(String.valueOf(orgType)); mdcProduction.setDelFlag(CommonConstant.DEL_FLAG_0.toString()); this.save(mdcProduction); }