From b7b763a20e3925577ceced76460be0ccd7654f6a Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 13 Jan 2025 17:16:25 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Remove=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/AssemblyInfo.cs | 6 ++-- .../View/CableLectotypeUserControl.xaml.cs | 25 +-------------- .../View/LayoutHelperWindow.xaml | 6 ++-- .../View/LayoutHelperWindow.xaml.cs | 32 ++++++++++++++++++- .../ViewModel/CableLectotypeViewModel.cs | 6 ++-- .../ViewModel/LayoutHelperViewModel.cs | 10 +++--- .../Properties/AssemblyInfo.cs | 6 ++-- 7 files changed, 51 insertions(+), 40 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Properties/AssemblyInfo.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Properties/AssemblyInfo.cs index a6e5709..64f1c9e 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Properties/AssemblyInfo.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Properties/AssemblyInfo.cs @@ -46,6 +46,6 @@ using System.Windows; // 生成号 // 修订号 // -[assembly: AssemblyVersion("1.0.0.19")] -[assembly: AssemblyFileVersion("1.0.0.19")] -[assembly: AssemblyInformationalVersion("1.0.0.19")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.0.20")] +[assembly: AssemblyFileVersion("1.0.0.20")] +[assembly: AssemblyInformationalVersion("1.0.0.20-rls")] \ No newline at end of file diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml.cs index 8f095a7..e611db4 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml.cs @@ -147,29 +147,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View } } - public void ToMotorSource(string motorId) - { - try - { - if (string.IsNullOrEmpty(LectotypeManager.CURRENT_DOC_ID)) return; - var doc = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == LectotypeManager.CURRENT_DOC_ID); - var part = doc.GetOccurrenceByID(motorId); - //var cable = doc.GetOccurrenceByName(cableName, typeof(OccCableForked)); - if (part != null) - { - doc.SelectSet.Clear(); - var oriOcc = SelfControler.FindInstance(part.ID); - oriOcc.SetVisibility(true, null); - doc.SelectSet.Add(oriOcc); - - doc.FitToSelectSet(); - doc.SelectSet.OnSelectionChanged(); - } - } - catch (Exception ex) - { - FlexMessageBox.Error(ex.Message); - } - } + } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml index 2567219..5b216ac 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml @@ -86,6 +86,7 @@ Grid.Row="0" Grid.RowSpan="2" Grid.Column="1" + Click="ToMotorBtn_Click" Content="转到电机" Style="{StaticResource ButtonPrimary}" /> @@ -110,11 +111,12 @@ Width="80" DisplayMemberBinding="{Binding CableType}" Header="线类型" /> - + diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml.cs index 8fbe4bb..2e5b017 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml.cs @@ -8,8 +8,10 @@ using EPLAN.Harness.Core.Controls; using EPLAN.Harness.Core.UIFactory; using EPLAN.Harness.Primitives.ActionControls; using EPLAN.Harness.ProjectCore; +using EPLAN.Harness.ProjectCore.Occurrences; using EPLAN.Harness.ProjectCore.Occurrences.Designer; using HandyControl.Controls; +using Sinvo.EplanHpD.Plugin.WPFUI.Utils; using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel; using System; using System.Collections.Generic; @@ -162,6 +164,34 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View { return _currentFlexDesigner.CurrentView.UserControlFactory_Create(UIObject.ctrl_Designer_ForkedPathPlace, new object[] { side }); } - + + private void ToMotorBtn_Click(object sender, RoutedEventArgs e) + { + ToMotorSource(viewModel.Motor.OccPartId); + } + public void ToMotorSource(string motorId) + { + try + { + if (string.IsNullOrEmpty(LectotypeManager.CURRENT_DOC_ID)) return; + var doc = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == LectotypeManager.CURRENT_DOC_ID); + var part = doc.GetOccurrenceByID(motorId); + //var cable = doc.GetOccurrenceByName(cableName, typeof(OccCableForked)); + if (part != null) + { + doc.SelectSet.Clear(); + var oriOcc = SelfControler.FindInstance(part.ID); + oriOcc.SetVisibility(true, null); + doc.SelectSet.Add(oriOcc); + + doc.FitToSelectSet(); + doc.SelectSet.OnSelectionChanged(); + } + } + catch (Exception ex) + { + FlexMessageBox.Error(ex.Message); + } + } } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs index 37c5487..54405c8 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs @@ -177,8 +177,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged //CurrentLineNumber = i, CurrentLine = i, Motor = Motor, - IsLectotype = true - + IsLectotype = true //CableFlag = GetCableModelFlag(MotorPower, PowerLineName, cableConnectionType, false) }; powerLine.DrawingNo = powerLine.GetCableDrawNo(); @@ -232,7 +231,8 @@ public class CableLectotypeViewModel : INotifyPropertyChanged { return MotorExcelHelper.Instance.GetBomList(drawingNo).Where(it => { - return it.Name == "编码器线" || it.Name == "动力线"; + // BOM表中只有 编码器线 和 动力线 不区分是不是带刹车 + return it.Name == "编码器线" || it.Name == "动力线" || it.Name == "刹车线"; }).Select(it => new LectotypeLineModel { SeqNo = 0, diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs index f831348..f5ef4a6 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/LayoutHelperViewModel.cs @@ -216,7 +216,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel cableLectotypeViewModel = data; if (cableLectotypeViewModel?.SelectedLines?.Any() ?? false) { - SelectedLines = cableLectotypeViewModel.SelectedLines; + SelectedLines = cableLectotypeViewModel.SelectedLines.OrderBy(it => it.CableType).ThenBy(it => it.CurrentLine).ToList(); SelectedLine = SelectedLines[CurrentMotorSelectLineIndex]; ReSetSubLines(); Motor = cableLectotypeViewModel.Motor; @@ -329,7 +329,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { subLine.IsChecked = true; //cableLectotypeViewModel.SaveToDb(); - SetSubLineAndSave(subLine.CableLectotypeId); + SetSubLineAndSave(subLine.LectotypeLineId); return SubLines.All(it => it.IsChecked); } else @@ -386,9 +386,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { SubLines = SelectedLine.SubLines.Distinct(it => it.CableModel).ToList(); } - internal void SetSubLineAndSave(string cableLectotypeId) + internal void SetSubLineAndSave(string lectotypeLineId) { - + var motorId = Motor.OccPartId; + var service = new MotorLectotypeService(); + service.SetLineDone(motorId, lectotypeLineId); } } } diff --git a/Sinvo.EplanHpD.Plugin/Properties/AssemblyInfo.cs b/Sinvo.EplanHpD.Plugin/Properties/AssemblyInfo.cs index 1ef83af..130ee34 100644 --- a/Sinvo.EplanHpD.Plugin/Properties/AssemblyInfo.cs +++ b/Sinvo.EplanHpD.Plugin/Properties/AssemblyInfo.cs @@ -28,6 +28,6 @@ using System.Runtime.InteropServices; // 生成号 // 修订号 // -[assembly: AssemblyVersion("1.0.0.19")] -[assembly: AssemblyFileVersion("1.0.0.19")] -[assembly: AssemblyInformationalVersion("1.0.0.19")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.0.20")] +[assembly: AssemblyFileVersion("1.0.0.20")] +[assembly: AssemblyInformationalVersion("1.0.0.20-rls")] \ No newline at end of file