添加了变量表的停用和启用功能,并优化了添加变量表和添加设备的逻辑

This commit is contained in:
2025-07-02 18:33:08 +08:00
parent 39a6366a5e
commit 31f6cf64f4
19 changed files with 415 additions and 181 deletions

View File

@@ -76,16 +76,26 @@ public static class ObjectExtensions
targetProperty.SetValue(ttarget, sourceValue);
}
// 场景 2: 属性类型不同,但可能是泛型 List<T> 类型
else if(isTargetList && isSourceList)
else if (isTargetList && isSourceList)
{
CopyGenericList(ttarget, sourceProperty, targetProperty, sourceValue);
}
// 场景 3: 属性类型不同,但是属性名称一样
else
{
var sObj = sourceProperty.GetValue(tsource);
if (sObj == null)
{
continue;
}
var tObj = targetProperty.GetValue(ttarget);
// if (sObj == null && tObj == null)
// CopyTo(sObj,tObj);
if (tObj == null)
{
tObj=Activator.CreateInstance(targetProperty.PropertyType);
}
CopyTo(sObj,tObj);
targetProperty.SetValue(ttarget,tObj);
}
}
}