From e8255951172ffbcb25fe47dd1e294c30ebb53f9d Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 13 Jan 2025 11:22:45 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Update=20=E8=B0=83=E6=95=B4=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=BA=BF=E6=AE=B5=E7=B1=BB=E5=9E=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/CableLectotype.cs | 5 +- .../Service/MotorLectotypeService.cs | 15 ++- .../Utils/LectotypeManager.cs | 2 +- .../View/CableLectotypeUserControl.xaml | 45 ++++++--- .../View/CableLectotypeUserControl.xaml.cs | 29 ++++++ .../View/LayoutHelperWindow.xaml | 71 ++++++++------ .../View/LectotypeWindow.xaml | 2 +- .../View/LectotypeWindow.xaml.cs | 1 + .../ViewModel/CableLectotypeViewModel.cs | 94 +++++++++++-------- 9 files changed, 178 insertions(+), 86 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs index 3106776..f73940f 100644 --- a/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs +++ b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs @@ -24,7 +24,10 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model public string AxisNo { get; set; } [SugarColumn(IsNullable = true)] - public string CableType { get; set; } + public string CableTypePrimary { get; set; } + + [SugarColumn(IsNullable = true)] + public string CableTypeSecond { get; set; } [SugarColumn(IsNullable = true)] public int EncoderLineParagraph { get; set; } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs index 515c78b..7e85fb1 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs @@ -82,7 +82,8 @@ namespace Sinvo.EplanHpD.Plugin.Service }, CableConnectionType = (ConnectionType)Enum.Parse(typeof(ConnectionType), cableLectotype.CableConnectionType.ToString()), AxisNo = cableLectotype.AxisNo, - CableType = cableLectotype.CableType, + CableTypePrimary = cableLectotype.CableTypePrimary, + CableTypeSecond = cableLectotype.CableTypeSecond, EncoderLineParagraph = cableLectotype.EncoderLineParagraph, PowerLineParagraph = cableLectotype.PowerLineParagraph, CableModelStr = cableLectotype.CableModelStr, @@ -127,6 +128,14 @@ namespace Sinvo.EplanHpD.Plugin.Service }).ToList(); } + public bool ClearSubLines(string motorOccId) + { + var changeCount = DBHelper.DB.Deleteable() + .Where(sl => sl.MotorId == motorOccId) + .ExecuteCommand(); + return changeCount > 0; + } + public bool SaveMotorLectotypeData(string motorOccId, CableLectotypeViewModel data) { var db = DBHelper.DB; @@ -163,8 +172,10 @@ namespace Sinvo.EplanHpD.Plugin.Service CableLectotypeId = Guid.NewGuid().ToString(), MotorId = motor.OccPartId, CableConnectionType = (int)data.CableConnectionType, + AxisNo = data.AxisNo, - CableType = data.CableType, + CableTypePrimary = data.CableTypePrimary, + CableTypeSecond = data.CableTypeSecond, EncoderLineParagraph = data.EncoderLineParagraph, PowerLineParagraph = data.PowerLineParagraph, CableModelStr = data.CableModelStr, diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/LectotypeManager.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/LectotypeManager.cs index 3dd9189..04129f8 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/LectotypeManager.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/LectotypeManager.cs @@ -14,7 +14,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils { public static class LectotypeManager { - + public static string CURRENT_DOC_ID = ""; public class LectotypeViewModelFactory { diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml index 4ab8f7b..de2b941 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml @@ -120,7 +120,7 @@ Text="{Binding AxisNo, Mode=TwoWay}" /> - + - - + + Orientation="Horizontal"> + + + - + Orientation="Horizontal"> + + + - + 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 b824984..2567219 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/LayoutHelperWindow.xaml @@ -48,32 +48,47 @@ VerticalAlignment="Top" Panel.ZIndex="99" /> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +