diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs index 720c17e..6fddbb5 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs @@ -174,6 +174,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel SetItemError(item, "未匹配到线材大小!"); } } + else + { + if (CheckUseDiscoloration(item.Imprint)) + { + SetItemError(item, "未匹配到变色套(绝缘软套)!"); + + } + } } /// /// 检查引用的端子 @@ -385,5 +393,41 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel } } } + /// + /// 检查是否使用变色套 + /// + /// + /// + 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; + } } }