diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml index aeb01a9..82a9c33 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml @@ -102,7 +102,7 @@ Width="100" VerticalAlignment="Center" Text="线材链接方式:" /> - + diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs index 7b0a428..f194b13 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/CableLectotypeViewModel.cs @@ -1,5 +1,6 @@ using HandyControl.Controls; using Sinvo.EplanHpD.Plugin.Service; +using Sinvo.EplanHpD.Plugin.Service.Model; using Sinvo.EplanHpD.Plugin.WPFUI.Enum; using Sinvo.EplanHpD.Plugin.WPFUI.Models; using Sinvo.EplanHpD.Plugin.WPFUI.Utils; @@ -8,6 +9,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices.WindowsRuntime; using System.Security.Cryptography.X509Certificates; using System.Security.RightsManagement; using System.Windows.Shapes; @@ -106,7 +108,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged //DrawingNo = DrawingNo, //CableModelNo = CableModelNo, CableConnectionClass = cableConnectionType, - CableType = "动力线", + CableType = CableType.Contains("刹车") ? "动力刹车线" : "动力线", LineCount = PowerLineParagraph, //PowerLineLength = PowerLineLength, //CurrentLineNumber = i, @@ -331,10 +333,10 @@ public class CableLectotypeViewModel : INotifyPropertyChanged public bool SaveToDb() { - var id = Motor.OccPartId; - var json = Newtonsoft.Json.JsonConvert.SerializeObject(this); var service = new MotorLectotypeService(); - return service.SaveMotorLectotypeData(id, json); + // 查找或添加 Motor + return service.SaveMotorLectotypeData(Motor.OccPartId, this); + } public event PropertyChangedEventHandler PropertyChanged;