From 72d236d8ea93d375f2ae7ca9875421ac5672c055 Mon Sep 17 00:00:00 2001 From: supercjj2023 Date: Fri, 12 Sep 2025 15:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A3=80=E5=85=A5=E6=A3=80?= =?UTF-8?q?=E6=9F=A5=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ec_enginedata_pixelBLL.cs | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_enginedata_pixel/ec_enginedata_pixelBLL.cs b/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_enginedata_pixel/ec_enginedata_pixelBLL.cs index 64eed1dd..071f27c6 100644 --- a/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_enginedata_pixel/ec_enginedata_pixelBLL.cs +++ b/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_enginedata_pixel/ec_enginedata_pixelBLL.cs @@ -484,32 +484,52 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC } } } + + // 构建一个字典,key = (EngineDataID, PropertyID),value = PropertyValue + var propDict = AllPropsOfEng + .GroupBy(x => (x.EngineDataID, x.PropertyID)) + .ToDictionary(g => g.Key, g => g.First().PropertyValue); + //检查必填属性 foreach (var checkproperty in NeedCheckProperties) { - //如果ec_enginedata_propety里面没有必填属性要求的这个属性,就代表没有保存,认为是没有填值,为空 - if (AllPropsOfEng.Where(x => x.EngineDataID == checkproperty.EngineDataID).Select(x => x.PropertyID).Contains(checkproperty.PropertyID)) + var key = (checkproperty.EngineDataID, checkproperty.PropertyID); + if (propDict.TryGetValue(key, out var propertyValue)) { - var PropertyValue = AllPropsOfEng - .FirstOrDefault(x => - x.EngineDataID == checkproperty.EngineDataID && - x.PropertyID == checkproperty.PropertyID) - ?.PropertyValue; - //foreach (var property in AllPropsOfEng) - //{ - //如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID,且属性ID也能对上,且属性值为空或者NULL,则认为没有填写 - if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0") - { - errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。"; - return res = false; - } - //} + if (string.IsNullOrEmpty(propertyValue) || propertyValue == "0") + { + errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。"; + return res = false; + } } else { errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】不存在,认为空,需要填写,不能检入,请执行“属性检查”功能对图纸进行属性检查。"; return res = false; } + //如果ec_enginedata_propety里面没有必填属性要求的这个属性,就代表没有保存,认为是没有填值,为空 + //if (AllPropsOfEng.Where(x => x.EngineDataID == checkproperty.EngineDataID).Select(x => x.PropertyID).Contains(checkproperty.PropertyID)) + //{ + // var PropertyValue = AllPropsOfEng + // .FirstOrDefault(x => + // x.EngineDataID == checkproperty.EngineDataID && + // x.PropertyID == checkproperty.PropertyID) + // ?.PropertyValue; + // //foreach (var property in AllPropsOfEng) + // //{ + // //如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID,且属性ID也能对上,且属性值为空或者NULL,则认为没有填写 + // if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0") + // { + // errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。"; + // return res = false; + // } + // //} + //} + //else + //{ + // errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】不存在,认为空,需要填写,不能检入,请执行“属性检查”功能对图纸进行属性检查。"; + // return res = false; + //} } //需要去看依赖项的数据了,这里的条件为无需必填或者即时更新版必填又或者Isrequired=null,都要去检查,又由于会去这个List里面找上级关联对象,所以也不能针对dependency_type去做过滤,不然可能就找不到上级对象了