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,6 +295,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
{ {
Stopwatch stopwatch = new Stopwatch(); Stopwatch stopwatch = new Stopwatch();
stopwatch.Start(); stopwatch.Start();
DrawingNo = "";
if (Motor == null) if (Motor == null)
{ {
return ""; return "";
@ -307,7 +308,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
var cableFlag = GetCableModelFlag(Motor?.MotorPower, CableType, CableConnectionClass, IsFlexibility); var cableFlag = GetCableModelFlag(Motor?.MotorPower, CableType, CableConnectionClass, IsFlexibility);
if (string.IsNullOrWhiteSpace(cableFlag)) if (string.IsNullOrWhiteSpace(cableFlag))
{ {
DrawingNo = "";
return ""; return "";
} }

View File

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

View File

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

View File

@ -224,6 +224,39 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
else else
{ {
LectotypeList.Add(line); 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; SelectedLines = LectotypeList;
} }
@ -327,9 +360,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
IsEnableParagraph = !(_cableConnectionType == ConnectionType.Passthrough); IsEnableParagraph = !(_cableConnectionType == ConnectionType.Passthrough);
PowerLineParagraph = 0; PowerLineParagraph = 0;
EncoderLineParagraph = 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)); OnPropertyChanged(nameof(IsEnableParagraph));
} }
} }
private bool _isEnableSecCableType = true;
public bool IsEnableSecCableType
{
get => _isEnableSecCableType;
set
{
_isEnableSecCableType = value;
OnPropertyChanged(nameof(IsEnableSecCableType));
}
}
public bool SaveToDb() public bool SaveToDb()

View File

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