From 5b11cae2cd3b70d7e957fdada4b27f5f57a6a61a Mon Sep 17 00:00:00 2001 From: lihanbo Date: Mon, 23 Dec 2024 12:04:21 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Fix=20=E5=8A=A8=E5=8A=9B=E5=88=B9?= =?UTF-8?q?=E8=BD=A6=E7=BA=BF=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/CableLectotypeUserControl.xaml | 2 +- .../ViewModel/CableLectotypeViewModel.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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;