diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/LectotypeLineModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/LectotypeLineModel.cs index 5941f10..b74c780 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/LectotypeLineModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/LectotypeLineModel.cs @@ -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 ""; } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml index 5ba4c47..0637e19 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml @@ -176,8 +176,9 @@ Orientation="Horizontal"> {_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(new LectotypeMessage (new System.Collections.Generic.Dictionary { diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs index 4f04381..cfe34c9 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs @@ -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() diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs index c5f6301..e913793 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LectotypeViewModel.cs @@ -163,12 +163,12 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged OnPropertyChanged(); } } - public List Drivers { get; set; } = [ - "脉冲型驱动器", - "总线型驱动器(CCLINK IE TSN)", - "总线型驱动器(SSCNET III/H)", - "总线型驱动器(EtherCAT)" - ]; + //public List 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;