Compare commits

..

No commits in common. 'eacc913d47c218fe4fb5717a9d01dd686835b50b' and '9406431c7222f30383a97667b7b2377864af026a' have entirely different histories.

@ -68,22 +68,22 @@ public class DeviceCollectionBusiness
{
try
{
_serilog.Info($"开始采集{item.deviceName};参数:{JsonConvert.SerializeObject(item.deviceParams)}");
_serilog.Info($"开始采集{item.deviceName}");
var opcItemValues = await this.ReadParam(item, opcua);
this.SaveParam(item, opcItemValues, out List<BaseDeviceParamVal> paramValues);
_serilog.Info($"{item.deviceName}数据采集完成:{JsonConvert.SerializeObject(opcItemValues)}");
// if(i == 10)
// {
//
// isFlag = false;
//
// opcua.DisconnectAsync().Wait();
//
// _serilog.Info($"读取完成断开连接");
// }
if(i == 10)
{
isFlag = false;
opcua.DisconnectAsync().Wait();
_serilog.Info($"读取完成断开连接");
}
}
catch (Exception e)
@ -213,16 +213,7 @@ public class DeviceCollectionBusiness
paramValues.Add(deviceParamVal);
}
var isRes = _paramValService.Insert(paramValues);
if (isRes)
{
_serilog.Info(($"{device.deviceName} 设备参数保存成功"));
}
else
{
_serilog.Info(($"{device.deviceName} 设备参数保存失败"));
}
_paramValService.Insert(paramValues);
}catch (Exception e)
{
throw new InvalidOperationException($"设备参数保存异常:{e.Message}");

@ -12,10 +12,10 @@ namespace Sln.Imm.Daemon.Model.dao;
public class BaseDeviceParamVal
{
/// <summary>
/// 备 注:主键 PARAMRECORD_SEQ_ID
/// 备 注:主键
///</summary>
[SugarColumn(ColumnName = "RECORD_ID", OracleSequenceName = "PARAMRECORD_SEQ_ID",IsPrimaryKey = true)]
public int objId { get; set; }
[SugarColumn(ColumnName = "RECORD_ID", IsPrimaryKey = true)]
public decimal objId { get; set; }
/// <summary>
/// 备 注:参数编号
@ -33,7 +33,7 @@ public class BaseDeviceParamVal
/// 备 注:设备ID
///</summary>
[SugarColumn(ColumnName = "DEVICE_ID")]
public int deviceId { get; set; }
public decimal? deviceId { get; set; }
/// <summary>
/// 备 注:参数名称

@ -41,24 +41,16 @@ namespace Sln.Imm.Daemon.Opc
if (opcDev != null)
{
try
var res = opcDev.ConnectAsync(item.networkAddress).Result;
if (!res)
{
var res = opcDev.ConnectAsync(item.networkAddress).Result;
Console.WriteLine($"{item.deviceName}设备连接失败");
if (!res)
{
Console.WriteLine($"{item.deviceName}设备连接失败");
}
else
{
Console.WriteLine($"{item.deviceName}设备连接成功");
opcs.Add(item, opcDev);
}
}
catch (Exception ex)
else
{
Console.WriteLine($"{item.deviceName}设备连接异常:{ex.Message}");
opcs.Add(item, opcDev);
}
}
}

Loading…
Cancel
Save