From 009c2bcdb77a5963a639fcaa5bfd96e068db5546 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期二, 11 二月 2025 17:59:20 +0800 Subject: [PATCH] 设备新增系统类型字段 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 54 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 45 insertions(+), 9 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index 1937aa0..b71a4db 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java @@ -24,16 +24,11 @@ import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil; import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil; import org.jeecg.modules.mdc.vo.*; -import org.jeecg.modules.system.entity.MdcEquipmentDepart; -import org.jeecg.modules.system.entity.MdcProduction; -import org.jeecg.modules.system.entity.MdcProductionEquipment; -import org.jeecg.modules.system.entity.SysDepart; +import org.jeecg.modules.system.entity.*; import org.jeecg.modules.system.mapper.MdcEquipmentDepartMapper; import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper; -import org.jeecg.modules.system.service.IMdcProductionService; -import org.jeecg.modules.system.service.IMdcUserProductionService; -import org.jeecg.modules.system.service.ISysDepartService; -import org.jeecg.modules.system.service.ISysUserDepartService; +import org.jeecg.modules.system.service.*; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -94,6 +89,9 @@ @Resource private IMdcOverrunAlarmService mdcOverrunAlarmService; + @Resource + private ISysParamsService ISysParamsService; + @Override public Map<String, String> getDepNamesByEquipmentIds(List<String> equipmentIds) { @@ -114,6 +112,31 @@ @Override @Transactional(rollbackFor = Exception.class) public void saveMdcEquipment(MdcEquipment mdcEquipment, String selectedDeparts, String selectedProduction) { + if (mdcEquipment.getSystemValue()!=null) { + switch (mdcEquipment.getSystemValue()){ + case "1": + mdcEquipment.setDeviceTypeDnc("1"); + break; + case "2": + mdcEquipment.setDeviceTypeMdc("1"); + break; + case "3": + mdcEquipment.setDeviceTypeDnc("1"); + mdcEquipment.setDeviceTypeMdc("1"); + break; + } + }else { + //鑾峰彇绯荤粺绫诲瀷 + SysParams sysParams = ISysParamsService.getSysPramBySettingKey("system_type"); + //MDC绯荤粺 + if ("-1".equals(sysParams.getSettingValue())){ + mdcEquipment.setDeviceTypeMdc("1"); + } + //DNC绯荤粺 + if ("1".equals(sysParams.getSettingValue())) { + mdcEquipment.setDeviceTypeDnc("1"); + } + } //step.1 淇濆瓨璁惧 this.save(mdcEquipment); //step.2 淇濆瓨鎵�灞為儴闂� @@ -734,7 +757,20 @@ List<String> productionIds = mdcProductionService.recursionChildren(mdcEquipment.getProductionName()); mdcEquipment.setProductionIds(productionIds); } - return this.baseMapper.pageList(page, mdcEquipment); + IPage<MdcEquipment> equipmentIPage= this.baseMapper.pageList(page, mdcEquipment); + equipmentIPage.getRecords().forEach(item->{ + if (("1").equals(item.getDeviceTypeDnc())&&("1").equals(item.getDeviceTypeMdc())){ + item.setSystemValue("3"); + }else { + if (("1").equals(item.getDeviceTypeDnc())){ + item.setSystemValue("1"); + } + if (("1").equals(item.getDeviceTypeMdc())){ + item.setSystemValue("2"); + } + } + }); + return equipmentIPage; } /** -- Gitblit v1.9.3