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" /> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +