优化代码第一次启动出现的异常。

This commit is contained in:
liushoushan_notebook 2022-06-10 15:44:49 +08:00
parent a8f1d459a7
commit 115f917d7b
4 changed files with 10 additions and 1 deletions

View File

@ -31,7 +31,8 @@ namespace IoTGateway.ViewModel.BasicData.DeviceConfigVMs
.GetSelectListItems(Wtm, y => y.DeviceName); .GetSelectListItems(Wtm, y => y.DeviceName);
if (Entity.DeviceId != null) if (Entity.DeviceId != null)
{ {
if (Entity.EnumInfo != null) //if (Entity.EnumInfo != null)
if (!string.IsNullOrEmpty( Entity.EnumInfo))
{ {
AllTypes = new List<ComboSelectListItem>(); AllTypes = new List<ComboSelectListItem>();
var EnumInfos = JsonSerializer.Deserialize<Dictionary<string, int>>(Entity.EnumInfo); var EnumInfos = JsonSerializer.Deserialize<Dictionary<string, int>>(Entity.EnumInfo);

Binary file not shown.

View File

@ -87,6 +87,9 @@ namespace Plugin
{ {
var systemManage = DC.Set<SystemConfig>().FirstOrDefault(); var systemManage = DC.Set<SystemConfig>().FirstOrDefault();
var driver = _DrvierManager.DriverInfos.Where(x => x.Type.FullName == Device.Driver.AssembleName).SingleOrDefault(); var driver = _DrvierManager.DriverInfos.Where(x => x.Type.FullName == Device.Driver.AssembleName).SingleOrDefault();
if (driver == null)
return;
var settings = DC.Set<DeviceConfig>().Where(x => x.DeviceId == Device.ID).AsNoTracking().ToList(); var settings = DC.Set<DeviceConfig>().Where(x => x.DeviceId == Device.ID).AsNoTracking().ToList();
Type[] types = new Type[1] { typeof(Guid) }; Type[] types = new Type[1] { typeof(Guid) };
object[] param = new object[1] { Device.ID }; object[] param = new object[1] { Device.ID };

View File

@ -480,6 +480,11 @@ namespace Plugin
case IoTPlatformType.IoTSharp: case IoTPlatformType.IoTSharp:
foreach (var payload in SendModel[device.DeviceName]) foreach (var payload in SendModel[device.DeviceName])
{ {
//if (payload.Values.ContainsKey("ts"))
// payload.Values["ts"] = payload.TS;
//else
// payload.Values.Add("ts",payload.TS);
UploadISTelemetryDataAsync(device.DeviceName, payload.Values); UploadISTelemetryDataAsync(device.DeviceName, payload.Values);
} }
break; break;