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 insulatorGraph = occCable.Children.First() as OccCablesInsulatorGraph;
var isEncoderLine = GetLineType(insulatorGraph.Imprint,"L");
var isPowerLine = GetLineType(insulatorGraph.Imprint,"N");
var isEncoderLine = GetLineType(insulatorGraph.LibraryName,"编码器线");
var isPowerLine = GetLineType(insulatorGraph.LibraryName,"动力线");
var isBrakePowerLine = GetLineType(insulatorGraph.LibraryName,"动力刹车线");
var encoderLength = 0d;
var powerLength = 0d;
if(double.TryParse(insulatorGraph.CableLength_VH?.StrVal ?? "0",out double length)){
@ -206,7 +208,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
IsPowerLine = isPowerLine,
PowerLineLength = powerLength,
EncoderLineLength = encoderLength,
CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : "未知类型",
CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : isBrakePowerLine ? "动力刹车线" : "未知类型",
};
})
.Where(it => it != null)
@ -389,22 +391,13 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
}
/// <summary>
/// L -> 动力线 N -> 编码器线
/// 20241223 改为按名称判断
/// </summary>
/// <param name="imprint"></param>
/// <param name="libName"></param>
/// <returns></returns>
public bool GetLineType(string imprint, string lineFlag)
public bool GetLineType(string libName, string lineFlag)
{
if (imprint != null && imprint.Contains("-"))
{
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;
}
return libName.Contains(lineFlag);
}
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)
{
_debounceTimer.Stop();
@ -215,6 +216,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
}
}
public void OthersOccShow(bool show = false)
{
_currentFlexDesigner.GetOrganizerOccurrences().ToList().ForEach(occ =>