增加变色套检查逻辑
在 `MainViewModel.Check.cs` 文件中,新增了对变色套(绝缘软套)的检查逻辑。在 `else` 语句块中,增加了一个条件分支,调用 `CheckUseDiscoloration` 方法来检查是否使用了变色套,如果未匹配到变色套,则设置相应的错误信息。新增了 `CheckUseDiscoloration` 方法,该方法通过检查印记(imprint)是否符合特定前缀和标志类型的条件,来判断是否使用了变色套。`CheckUseDiscoloration` 方法中定义了一组印记条件,包括前缀和标志类型,并通过遍历这些条件来检查印记是否符合规范。
This commit is contained in:
parent
d9e039f168
commit
0ae84bd0ca
|
@ -174,6 +174,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
SetItemError(item, "未匹配到线材大小!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CheckUseDiscoloration(item.Imprint))
|
||||
{
|
||||
SetItemError(item, "未匹配到变色套(绝缘软套)!");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查引用的端子
|
||||
|
@ -385,5 +393,41 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查是否使用变色套
|
||||
/// </summary>
|
||||
/// <param name="imprint"></param>
|
||||
/// <returns></returns>
|
||||
private bool CheckUseDiscoloration(string imprint)
|
||||
{
|
||||
var imprintConditions = new List<(string Prefix, WireFlagType? FlagType)>
|
||||
{
|
||||
("L1", WireFlagType.Dual),
|
||||
("R", WireFlagType.Single ),
|
||||
("L1", WireFlagType.Mix ),
|
||||
("R", WireFlagType.Mix ),
|
||||
|
||||
("L2", WireFlagType.Dual ),
|
||||
("S", WireFlagType.Single ),
|
||||
("L2", WireFlagType.Mix ),
|
||||
("S", WireFlagType.Mix ),
|
||||
|
||||
("L3", WireFlagType.Dual ),
|
||||
("T", WireFlagType.Single ),
|
||||
("L3", WireFlagType.Mix ),
|
||||
("T", WireFlagType.Mix ),
|
||||
|
||||
("PE", null )
|
||||
};
|
||||
// 检查印记是否按照规范开头
|
||||
foreach (var condition in imprintConditions)
|
||||
{
|
||||
if (imprint.StartsWith(condition.Prefix) && (condition.FlagType == null || FlagType == condition.FlagType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue