105040 Update 优化安川逻辑,直通线允许选择两种

This commit is contained in:
lihanbo 2025-02-11 14:48:15 +08:00
parent 6465a465ac
commit aaa8a77ccc
5 changed files with 69 additions and 16 deletions

View File

@ -295,8 +295,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
{
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
DrawingNo = "";
if (Motor == null)
{
{
return "";
}
string ModelNo = "MR-";
@ -306,8 +307,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
}
var cableFlag = GetCableModelFlag(Motor?.MotorPower, CableType, CableConnectionClass, IsFlexibility);
if (string.IsNullOrWhiteSpace(cableFlag))
{
DrawingNo = "";
{
return "";
}

View File

@ -176,8 +176,9 @@
Orientation="Horizontal">
<hc:ComboBox
Width="153"
hc:InfoElement.ShowClearButton="True"
DisplayMemberPath="ItemName"
IsEnabled="{Binding IsEnableParagraph}"
IsEnabled="{Binding IsEnableSecCableType}"
ItemsSource="{Binding CableTypes}"
SelectedIndex="0"
SelectedValue="{Binding CableTypeSecond}"

View File

@ -56,16 +56,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public CableLectotypeUserControl()
{
InitializeComponent();
Debug.WriteLine($"CableLectotypeWindow_Created -> {_motor?.MotorModelStr} => {_motor?.OccPartId}");
}
private void OnMotorChanged()
{
_motor = (Motor as MotorModel);
@ -96,6 +92,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
//var motor = Motor as MotorModel;
if(Motor is CableLectotypeViewModel motor)
{
// 发送消息,用户生成了数据
WeakReferenceMessenger.Default.Send<LectotypeMessage,string>(new LectotypeMessage
(new System.Collections.Generic.Dictionary<string, string>
{

View File

@ -224,6 +224,39 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
else
{
LectotypeList.Add(line);
// 安川电机,允许有两条直通线
if ( !string.IsNullOrEmpty(CableTypeSecond) && Motor.Brand == Brands.ANCHUAN)
{
var secLine = new LectotypeLineModel
{
SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
CableConnectionClass = "直通",
CableType = CableTypeSecond,
//IsFlexibility = IsFlexibility,
//PowerLineLength = PowerLineLength,
//EncoderLineLength = EncoderLineLength,
//PowerBrakeLineLength = PowerBrakeLineLength,
//DrawingNo = LineModelStr,
CableModelNo = CableModelStr,
//LineCount = Math.Max(PowerLineCount, EncoderLineCount),
//CurrentLineNumber = 1,
//BomList = GenBomListByCurrent(DrawingNo)
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
};
secLine.DrawingNo = secLine.GetCableDrawNo();
secLine.SubLines = GetSubLines(secLine.DrawingNo);
LectotypeList.Add(secLine);
}
}
SelectedLines = LectotypeList;
}
@ -327,9 +360,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
IsEnableParagraph = !(_cableConnectionType == ConnectionType.Passthrough);
PowerLineParagraph = 0;
EncoderLineParagraph = 0;
if (!IsEnableParagraph)
if (!IsEnableParagraph && Motor.Brand != Brands.ANCHUAN)
{
EncoderLineParagraph = 1;
IsEnableSecCableType = false;
}
else
{
IsEnableSecCableType = true;
}
}
}
@ -406,6 +443,16 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
OnPropertyChanged(nameof(IsEnableParagraph));
}
}
private bool _isEnableSecCableType = true;
public bool IsEnableSecCableType
{
get => _isEnableSecCableType;
set
{
_isEnableSecCableType = value;
OnPropertyChanged(nameof(IsEnableSecCableType));
}
}
public bool SaveToDb()

View File

@ -163,12 +163,12 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
OnPropertyChanged();
}
}
public List<string> Drivers { get; set; } = [
"脉冲型驱动器",
"总线型驱动器CCLINK IE TSN)",
"总线型驱动器(SSCNET III/H)",
"总线型驱动器(EtherCAT)"
];
//public List<string> Drivers { get; set; } = [
// "脉冲型驱动器",
// "总线型驱动器CCLINK IE TSN)",
// "总线型驱动器(SSCNET III/H)",
// "总线型驱动器(EtherCAT)"
// ];
public Task LoadData()
{
@ -667,6 +667,14 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
{
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;