From 3728e855a109de211c3164cf348fea585d944a47 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Thu, 3 Apr 2025 17:31:17 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Fix=20=E9=83=A8=E5=88=86=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E7=94=B5=E6=9C=BA=E6=95=B0=E6=8D=AE=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BF=9D=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/MotorLectotypeService.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs index 40d7779..2bda638 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs @@ -182,6 +182,13 @@ namespace Sinvo.EplanHpD.Plugin.Service try { var motor = GetMotorByFlag(motorUniqueFlag);//.FirstOrDefault(m => m.OccPartId == Motor.OccPartId); + // 电机不为空 且不等于当前电机的型号,则清空再重新加入 + if(motor != null && motor.MotorModelStr != data.Motor.MotorModelStr) + { + db.Deleteable().Where(it => it.MotorUniqueFlag == motorUniqueFlag).ExecuteCommand(); + motor = null; + } + if (motor == null) { motor = new Motor @@ -197,7 +204,9 @@ namespace Sinvo.EplanHpD.Plugin.Service MotorUniqueFlag = motorUniqueFlag, CableLectotypeLines = [] }; - AddMotor(motor); + //AddMotor(motor); + // 插入新电机信息 + db.Insertable(motor).ExecuteCommand(); } else {