105040 Update 处理电机型号

This commit is contained in:
lihanbo 2024-12-17 15:09:07 +08:00
parent 19e04eb3ed
commit 394427a193
1 changed files with 20 additions and 1 deletions

View File

@ -541,7 +541,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
var motor = new MotorModel
{
MotorModelStr = part.Name,
MotorModelStr = UnStuffMotorName(part.Name),
AxisNo = axisNo,
OccPartId = part.ID,
IsError = string.IsNullOrEmpty(axisNo)
@ -563,6 +563,25 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
Motors = motorsData;
return Task.CompletedTask;
}
private string UnStuffMotorName(string motorName)
{
if (motorName.Contains("&"))
{
return motorName.Split('&')[0]?.Trim() ?? motorName;
}
else if (motorName.Contains("_"))
{
return motorName.Split('_')[0]?.Trim() ?? motorName;
}
else if (motorName.Contains("^"))
{
return motorName.Split('^')[0]?.Trim() ?? motorName;
}
else
{
return motorName;
}
}
private void OnSelectedItemChange()
{
if (this.SelectedItem != null)