From f218dfc738f5f0557164127900bd086dbbbc5857 Mon Sep 17 00:00:00 2001
From: iioter <535915157@qq.com>
Date: Sun, 2 Jun 2024 16:12:03 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A9=B1=E5=8A=A8=E7=A8=8B=E5=BA=8F=E9=9B=86?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=8F=AF=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs | 7 +++++++
IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml | 2 +-
Plugins/Plugin/DeviceService.cs | 4 ++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs b/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
index 29d7bdb..c424ccf 100644
--- a/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
+++ b/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
@@ -36,6 +36,13 @@ namespace IoTGateway.ViewModel.BasicData.DriverVMs
public override void DoEdit(bool updateAllFields = false)
{
+ var DriverService = Wtm.ServiceProvider.GetService(typeof(DriverService)) as DriverService;
+ Entity.AssembleName = DriverService.GetAssembleNameByFileName(Entity.FileName);
+ if (string.IsNullOrEmpty(Entity.AssembleName))
+ {
+ MSD.AddModelError("", "程序集获取失败");
+ return;
+ }
base.DoEdit(updateAllFields);
}
diff --git a/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml b/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
index b306514..202b36c 100644
--- a/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
+++ b/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
@@ -5,7 +5,7 @@
-
+
diff --git a/Plugins/Plugin/DeviceService.cs b/Plugins/Plugin/DeviceService.cs
index 408b92b..7441380 100644
--- a/Plugins/Plugin/DeviceService.cs
+++ b/Plugins/Plugin/DeviceService.cs
@@ -82,9 +82,9 @@ namespace Plugin
{
var systemManage = dc.Set().FirstOrDefault();
var driver = DrvierManager.DriverInfos
- .SingleOrDefault(x => x.Type.FullName == device.Driver.AssembleName);
+ .SingleOrDefault(x => x.Type.FullName == device.Driver?.AssembleName);
if (driver == null)
- _logger.LogError($"找不到设备:[{device.DeviceName}]的驱动:[{device.Driver.AssembleName}]");
+ _logger.LogError($"找不到设备:[{device.DeviceName}]的驱动:[{device.Driver?.AssembleName}]");
else
{
var settings = dc.Set().Where(x => x.DeviceId == device.ID).AsNoTracking()