105040 Update 线材类型从线型号名中判断获取

This commit is contained in:
lihanbo 2024-12-23 12:06:32 +08:00
parent ec7916db1d
commit c25035284f
2 changed files with 13 additions and 17 deletions

View File

@ -183,8 +183,10 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
var occCable = (it as OccCableForked); var occCable = (it as OccCableForked);
var insulatorGraph = occCable.Children.First() as OccCablesInsulatorGraph; var insulatorGraph = occCable.Children.First() as OccCablesInsulatorGraph;
var isEncoderLine = GetLineType(insulatorGraph.Imprint,"L"); var isEncoderLine = GetLineType(insulatorGraph.LibraryName,"编码器线");
var isPowerLine = GetLineType(insulatorGraph.Imprint,"N"); var isPowerLine = GetLineType(insulatorGraph.LibraryName,"动力线");
var isBrakePowerLine = GetLineType(insulatorGraph.LibraryName,"动力刹车线");
var encoderLength = 0d; var encoderLength = 0d;
var powerLength = 0d; var powerLength = 0d;
if(double.TryParse(insulatorGraph.CableLength_VH?.StrVal ?? "0",out double length)){ if(double.TryParse(insulatorGraph.CableLength_VH?.StrVal ?? "0",out double length)){
@ -206,7 +208,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
IsPowerLine = isPowerLine, IsPowerLine = isPowerLine,
PowerLineLength = powerLength, PowerLineLength = powerLength,
EncoderLineLength = encoderLength, EncoderLineLength = encoderLength,
CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : "未知类型", CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : isBrakePowerLine ? "动力刹车线" : "未知类型",
}; };
}) })
.Where(it => it != null) .Where(it => it != null)
@ -389,22 +391,13 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
} }
/// <summary> /// <summary>
/// L -> 动力线 N -> 编码器线 /// L -> 动力线 N -> 编码器线
/// 20241223 改为按名称判断
/// </summary> /// </summary>
/// <param name="imprint"></param> /// <param name="libName"></param>
/// <returns></returns> /// <returns></returns>
public bool GetLineType(string imprint, string lineFlag) public bool GetLineType(string libName, string lineFlag)
{ {
if (imprint != null && imprint.Contains("-")) return libName.Contains(lineFlag);
{
var vals = imprint.Split('-');
var val = vals[1];
Trace.WriteLine($"{vals[1]},{lineFlag},{val.ToUpper() == lineFlag.ToUpper()}");
return val.ToUpper() == lineFlag.ToUpper();
}
else
{
return false;
}
} }
public string GetAxisNo(string imprint) public string GetAxisNo(string imprint)
{ {

View File

@ -121,6 +121,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
} }
} }
private void DebounceTimer_Tick(object sender, EventArgs e) private void DebounceTimer_Tick(object sender, EventArgs e)
{ {
_debounceTimer.Stop(); _debounceTimer.Stop();
@ -215,6 +216,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
} }
} }
public void OthersOccShow(bool show = false) public void OthersOccShow(bool show = false)
{ {
_currentFlexDesigner.GetOrganizerOccurrences().ToList().ForEach(occ => _currentFlexDesigner.GetOrganizerOccurrences().ToList().ForEach(occ =>