完成首层外招盒GPS调试

main
潘建东 10 months ago
parent 7f8e39bc43
commit fb791a5575

@ -14,5 +14,6 @@
"ThreadPool": 8, "ThreadPool": 8,
"Port": 9001 "Port": 9001
}, },
"Redis": "redis:6379" "Redis": "redis:6379",
"urls": "http://localhost:5000"
} }

@ -190,6 +190,18 @@ namespace LanShengModel
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? Data13 { get; set; } public int? Data13 { get; set; }
/// <summary>
/// 进料门接触器 0断开 1吸合
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data13_B7 { get; set; }
/// <summary>
/// 出料门接触器 0断开 1吸合
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data13_B6 { get; set; }
/// <summary> /// <summary>
/// 一体机操作模式1智能模式2笼顶操作3防坠测试 /// 一体机操作模式1智能模式2笼顶操作3防坠测试
/// </summary> /// </summary>
@ -448,6 +460,12 @@ namespace LanShengModel
[SugarColumn(Length = 50, IsNullable = true)] [SugarColumn(Length = 50, IsNullable = true)]
public string? ICCID { get; set; } public string? ICCID { get; set; }
/// <summary>
/// 外召盒GPS编号
/// </summary>
[SugarColumn(Length = 50, IsNullable = true)]
public string? WZGPS { get; set; }
/// <summary> /// <summary>
/// 东经 /// 东经
/// </summary> /// </summary>
@ -1088,9 +1106,38 @@ namespace LanShengModel
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public int? Data8_B7_1104 { get; set; } public int? Data8_B7_1104 { get; set; }
/// <summary>
/// 左笼配电箱急停按钮(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data2_B7_2103 { get; set; }
/// <summary>
/// 右笼配电箱急停按钮(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data2_B6_2103 { get; set; }
#region 业务字段 #region 业务字段
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public string? MsgType { get; set; } public string? MsgType { get; set; }
[SugarColumn(IsIgnore = true)]
public DeviceData? WZ { get; set; }
#endregion #endregion
public string[] GetNotNullColumns()
{
var Result = new List<string>();
var Type = typeof(DeviceData);
foreach (var Propety in Type.GetProperties())
{
if(Propety.GetValue(this) != null)
{
Result.Add(Propety.Name);
}
}
return Result.ToArray();
}
} }
} }

@ -36,10 +36,6 @@ namespace LanShengService
Db.CodeFirst.SplitTables().InitTables(typeof(DeviceError)); Db.CodeFirst.SplitTables().InitTables(typeof(DeviceError));
Columns1001 = DeviceData1001.GetColumns();
Columns1103 = DeviceData1103.GetColumns();
Logger.LogDebug("加载数据结构"); Logger.LogDebug("加载数据结构");
CacheService = services.GetRequiredService<CacheInterface.ICacheService>(); CacheService = services.GetRequiredService<CacheInterface.ICacheService>();
@ -69,21 +65,18 @@ namespace LanShengService
private readonly int ValidClearDataLogDo = 1000 * 60 * 60 * 24 * 3; private readonly int ValidClearDataLogDo = 1000 * 60 * 60 * 24 * 3;
private readonly string[] Columns1001;
private readonly string[] Columns1103;
public async Task InsertData(DeviceData deviceData) public async Task InsertData(DeviceData deviceData)
{ {
Logger.LogDebug($"设备数据插入队列{JsonSerializer.Serialize(deviceData)}"); Logger.LogDebug($"设备数据插入队列{JsonSerializer.Serialize(deviceData)}");
await SetError(deviceData); if (deviceData.MsgType!.StartsWith("1"))
{
await SetError(deviceData);
await SetRunCount(deviceData); await SetRunCount(deviceData);
}
await CacheService.Set($"DeviceData:{deviceData.Id}.{Guid.NewGuid().ToString()}", deviceData, 5); await CacheService.Set($"DeviceData:{deviceData.Id}.{Guid.NewGuid().ToString()}", deviceData, 5);
await CacheService.Set($"CacheData:{deviceData.Id}", deviceData, 5);
} }
public async Task TimerInsertDataDo() public async Task TimerInsertDataDo()
@ -128,7 +121,7 @@ namespace LanShengService
await temp.AsInsertable.ExecuteCommandAsync(); await temp.AsInsertable.ExecuteCommandAsync();
await temp.AsUpdateable await temp.AsUpdateable
.UpdateColumns(Columns1001) .UpdateColumns(Values1001[0].GetNotNullColumns())
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }
@ -140,20 +133,34 @@ namespace LanShengService
await temp.AsInsertable.ExecuteCommandAsync(); await temp.AsInsertable.ExecuteCommandAsync();
var TempType = typeof(DeviceData); await temp.AsUpdateable
.UpdateColumns(Values1103[0].GetNotNullColumns())
.ExecuteCommandAsync();
}
var TempPropertys = TempType.GetProperties(); var Values2001 = DeviceValues.Where(x => x != null && (x.MsgType == "2001" || x.MsgType == "8104")).ToList();
var TempColumns1103 = new List<string>(); if (Values2001.Count > 0)
{
var temp = Db.Storageable(Values2001).ToStorage();
foreach (var TempProperty in TempPropertys) { await temp.AsInsertable.ExecuteCommandAsync();
if (TempProperty.GetValue(Values1103[0]) != null) {
TempColumns1103.Add(TempProperty.Name); await temp.AsUpdateable
} .UpdateColumns(Values2001[0].GetNotNullColumns())
} .ExecuteCommandAsync();
}
var Values2103 = DeviceValues.Where(x => x != null && x.MsgType == "2103").ToList();
if (Values2103.Count > 0)
{
var temp = Db.Storageable(Values2103).ToStorage();
await temp.AsInsertable.ExecuteCommandAsync();
await temp.AsUpdateable await temp.AsUpdateable
.UpdateColumns(TempColumns1103.ToArray()) .UpdateColumns(Values2103[0].GetNotNullColumns())
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }
} }
@ -267,44 +274,17 @@ namespace LanShengService
public async Task<List<DeviceData>> GetDeviceData(string[] ids) public async Task<List<DeviceData>> GetDeviceData(string[] ids)
{ {
var Result = new List<DeviceData>(); var Result = await Db.Queryable<DeviceData>().In("Id", ids)
.IgnoreColumns(x => new
var CacheIds = new List<string>();
ids.ToList().ForEach((x) =>
{ {
CacheIds.Add($"CacheData:{x}"); x.Data25_B4,
}); x.Data25_B0,
var CacheResult = await CacheService.BatchGet<DeviceData>(CacheIds); x.Data26_B4,
x.Data26_B0
Result.AddRange(CacheResult.Where(x => x.Value != null).Select(x => x.Value)); })
.ToListAsync();
var NotCacheIds = CacheResult.Where(x => x.Value == null).Select(x => x.Key.Remove(0, 10)).ToList();
Result.ForEach(async x =>
if (NotCacheIds.Count() > 0)
{
var DbResult = await Db.Queryable<DeviceData>().In("Id", NotCacheIds)
.IgnoreColumns(x => new
{
x.Data25_B4,
x.Data25_B0,
x.Data26_B4,
x.Data26_B0
})
.ToListAsync();
Result.AddRange(DbResult.ToList());
var DbCache = new Dictionary<string, DeviceData>();
foreach (var Item in DbResult)
{
DbCache.Add($"CacheData:{Item.Id}", Item);
}
await CacheService.BatchSet<DeviceData>(DbCache, 60);
}
Result = JsonSerializer.Deserialize<List<DeviceData>>(JsonSerializer.Serialize(Result))!;
Result.ForEach(x =>
{ {
x.Data6 = x.Data6 / 10; x.Data6 = x.Data6 / 10;
decimal Latitude = 0; decimal Latitude = 0;
@ -313,6 +293,10 @@ namespace LanShengService
decimal Longitude = 0; decimal Longitude = 0;
Decimal.TryParse(x.Longitude, out Longitude); Decimal.TryParse(x.Longitude, out Longitude);
x.Longitude = (Longitude / 1000000).ToString(); x.Longitude = (Longitude / 1000000).ToString();
if (!string.IsNullOrEmpty(x.WZGPS)) {
x.WZ = await Db.Queryable<DeviceData>().FirstAsync(y => y.Id == x.WZGPS);
}
}); });
return Result; return Result;
@ -1298,7 +1282,8 @@ namespace LanShengService
throw new BadRequestException("单元无效"); throw new BadRequestException("单元无效");
} }
#endregion #endregion
if ((report.CompanyIds != null && report.CompanyIds.Count() > 0) || (report.ProjectIds != null && report.ProjectIds.Count() > 0) || (report.DeviceIds != null && report.DeviceIds.Count() > 0)) { if ((report.CompanyIds != null && report.CompanyIds.Count() > 0) || (report.ProjectIds != null && report.ProjectIds.Count() > 0) || (report.DeviceIds != null && report.DeviceIds.Count() > 0))
{
var TempCompanyIds = report.CompanyIds; var TempCompanyIds = report.CompanyIds;
var TempProjectIds = report.ProjectIds; var TempProjectIds = report.ProjectIds;
var TempDeviceIds = report.DeviceIds; var TempDeviceIds = report.DeviceIds;
@ -1313,17 +1298,19 @@ namespace LanShengService
.ToList(); .ToList();
var TempGpsIds = new List<string>(); var TempGpsIds = new List<string>();
TempGpss.ForEach(v => { TempGpss.ForEach(v =>
{
try try
{ {
var tempGps = JsonSerializer.Deserialize<IEnumerable<DeviceGpsDO>>(v!); var tempGps = JsonSerializer.Deserialize<IEnumerable<DeviceGpsDO>>(v!);
TempGpsIds.AddRange(tempGps!.Select(x => x.Id!)); TempGpsIds.AddRange(tempGps!.Select(x => x.Id!));
} }
catch { catch
{
} }
}); });
report.GpsIds = report.GpsIds == null? TempGpsIds!: report.GpsIds.Concat(TempGpsIds!); report.GpsIds = report.GpsIds == null ? TempGpsIds! : report.GpsIds.Concat(TempGpsIds!);
} }
var TempErrors = await GetDayError(report); var TempErrors = await GetDayError(report);
var TempErrorGroup = TempErrors.Select(x => x.ErrCode).Distinct(); var TempErrorGroup = TempErrors.Select(x => x.ErrCode).Distinct();
@ -1359,7 +1346,8 @@ namespace LanShengService
TempItems.Add(item); TempItems.Add(item);
} }
} }
else if (report.Unit.ToLower() == "month") { else if (report.Unit.ToLower() == "month")
{
var TempErrorDate = TempErrors.Select(x => x.Id!.Substring(0, 7)).Distinct(); var TempErrorDate = TempErrors.Select(x => x.Id!.Substring(0, 7)).Distinct();
foreach (var group in TempErrorGroup) foreach (var group in TempErrorGroup)
{ {
@ -1437,7 +1425,8 @@ namespace LanShengService
return Task.FromResult(result); return Task.FromResult(result);
} }
public async Task<IEnumerable<DeviceError>> GetErrorList(string search) { public async Task<IEnumerable<DeviceError>> GetErrorList(string search)
{
var _Query = Db.Queryable<DeviceError>() var _Query = Db.Queryable<DeviceError>()
.WhereIF(!string.IsNullOrWhiteSpace(search), x => x.ErrCode!.Contains(search) || x.ErrMsg!.Contains(search)) .WhereIF(!string.IsNullOrWhiteSpace(search), x => x.ErrCode!.Contains(search) || x.ErrMsg!.Contains(search))
.Distinct() .Distinct()

@ -43,15 +43,13 @@ namespace LanShengService.Tcp
DTU_Id = packet!.DTU_ID!; DTU_Id = packet!.DTU_ID!;
Logger.LogDebug($"接收到数据:{JsonSerializer.Serialize<TcpDataLog<DeviceData>>(packet!)}"); Logger.LogDebug($"接收到数据:{JsonSerializer.Serialize<TcpDataLog<DeviceData>>(packet!)}");
await TcpService.AddChannel(packet!.DTU_ID!, context); await TcpService.AddChannel(packet!.DTU_ID!, context);
await DeviceService.InsertDataLog(packet!);
if (packet!.Content != null)
{
await DeviceService.InsertData(packet!.Content);
}
if (packet.Msg_ID == "1001" || packet.Msg_ID == "1103") if (packet.Msg_ID == "1001" || packet.Msg_ID == "1103")
{ {
if (packet!.Content != null)
{
await DeviceService.InsertData(packet!.Content);
}
await DeviceService.InsertDataLog(packet!);
var Reply = new TcpDataLog<DeviceData> var Reply = new TcpDataLog<DeviceData>
{ {
Frame_START = packet.Frame_START, Frame_START = packet.Frame_START,
@ -63,7 +61,7 @@ namespace LanShengService.Tcp
{ {
Reply.Msg_ID = "9001"; Reply.Msg_ID = "9001";
} }
if (packet.Msg_ID == "1103") else if (packet.Msg_ID == "1103")
{ {
Reply.Msg_ID = "9103"; Reply.Msg_ID = "9103";
} }
@ -76,11 +74,45 @@ namespace LanShengService.Tcp
await context.CloseAsync(); await context.CloseAsync();
} }
} }
else if (packet.Msg_ID == "2001" || packet.Msg_ID == "2103")
{
if (packet!.Content != null)
{
await DeviceService.InsertData(packet!.Content);
}
var Reply = new TcpDataLog<DeviceData>
{
Frame_START = packet.Frame_START,
Frame_number = packet.Frame_number,
DTU_ID = packet.DTU_ID,
Frame_END = packet.Frame_END
};
if (packet.Msg_ID == "2001")
{
Reply.Msg_ID = "8001";
}
else if (packet.Msg_ID == "2103")
{
Reply.Msg_ID = "8103";
}
try
{
await context.WriteAndFlushAsync(Reply);
}
catch
{
await context.CloseAsync();
}
}
if (packet.Msg_ID == "9104") if (packet.Msg_ID == "9104")
{ {
await TcpService.RemoveMessageItem(packet); await TcpService.RemoveMessageItem(packet);
} }
if (packet.Msg_ID == "9107") { if (packet.Msg_ID == "9107")
{
await TcpService.RemoveMessageItem(packet);
}
if (packet.Msg_ID == "8104") {
await TcpService.RemoveMessageItem(packet); await TcpService.RemoveMessageItem(packet);
} }
TryCount = 0; TryCount = 0;

@ -69,14 +69,14 @@ namespace LanShengService.Tcp
{ {
case "1001": case "1001":
case "9104": case "9104":
request.Content.AgreementVersion = Content.ReadInt(1); if (request.Content.Id.StartsWith("QC") || request.Content.Id.StartsWith("ZK"))
request.Content.DataTick = Content.ReadInt(2); {
request.Content.ICCID = Content.ReadString(20, Encoding.ASCII); Decode1001ZK(request.Content, Content);
Content.SkipBytes(4); }
request.Content.Longitude = Content.ReadString(9, Encoding.ASCII); else
request.Content.Latitude = Content.ReadString(8, Encoding.ASCII); {
request.Content.ConnectStrLength = Content.ReadInt(1); Decode1001RY(request.Content, Content);
request.Content.ConnectString = Content.ReadString((int)request.Content.ConnectStrLength, Encoding.ASCII); }
break; break;
case "1103": case "1103":
if (request.Content.Id.StartsWith("QC") || request.Content.Id.StartsWith("ZK")) if (request.Content.Id.StartsWith("QC") || request.Content.Id.StartsWith("ZK"))
@ -88,6 +88,12 @@ namespace LanShengService.Tcp
Decode1103RY(request.Content, Content); Decode1103RY(request.Content, Content);
} }
break; break;
case "2001":
Decode2001ZK(request.Content, Content);
break;
case "2103":
Decode2103ZK(request.Content, Content);
break;
default: default:
break; break;
} }
@ -187,7 +193,8 @@ namespace LanShengService.Tcp
device.Data27_B0 = Data27[7]; device.Data27_B0 = Data27[7];
} }
private void Decode1103ZK(DeviceData device, IByteBuffer content) { private void Decode1103ZK(DeviceData device, IByteBuffer content)
{
device.Version = content.ReadInt(1); device.Version = content.ReadInt(1);
var Data2 = content.ReadBitArray(); var Data2 = content.ReadBitArray();
device.Data2_B7 = Data2[0]; device.Data2_B7 = Data2[0];
@ -215,7 +222,9 @@ namespace LanShengService.Tcp
device.Data10 = content.ReadInt(1); device.Data10 = content.ReadInt(1);
device.Data11 = content.ReadInt(1); device.Data11 = content.ReadInt(1);
device.Data12 = content.ReadInt(1); device.Data12 = content.ReadInt(1);
content.SkipBytes(1); var Data13 = content.ReadBitArray();
device.Data13_B7 = Data13[0];
device.Data13_B6 = Data13[1];
var Data14 = content.ReadBitArray(); var Data14 = content.ReadBitArray();
device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2); device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
device.Data14_B5 = Data14[2]; device.Data14_B5 = Data14[2];
@ -354,5 +363,51 @@ namespace LanShengService.Tcp
device.Data72_B5 = Data72[2]; device.Data72_B5 = Data72[2];
device.Data72_B4 = Data72[3]; device.Data72_B4 = Data72[3];
} }
private void Decode1001RY(DeviceData device, IByteBuffer content)
{
device.AgreementVersion = content.ReadInt(1);
device.DataTick = content.ReadInt(2);
device.ICCID = content.ReadString(20, Encoding.ASCII);
content.SkipBytes(4);
device.Longitude = content.ReadString(9, Encoding.ASCII);
device.Latitude = content.ReadString(8, Encoding.ASCII);
device.ConnectStrLength = content.ReadInt(1);
device.ConnectString = content.ReadString((int)device.ConnectStrLength, Encoding.ASCII);
}
private void Decode1001ZK(DeviceData device, IByteBuffer content)
{
device.AgreementVersion = content.ReadInt(1);
device.DataTick = content.ReadInt(2);
device.ICCID = content.ReadString(20, Encoding.ASCII);
device.WZGPS = content.ReadString(17, Encoding.ASCII);
content.SkipBytes(4);
device.Longitude = content.ReadString(9, Encoding.ASCII);
device.Latitude = content.ReadString(8, Encoding.ASCII);
device.ConnectStrLength = content.ReadInt(1);
device.ConnectString = content.ReadString((int)device.ConnectStrLength, Encoding.ASCII);
}
private void Decode2001ZK(DeviceData device,IByteBuffer content)
{
device.AgreementVersion = content.ReadInt(1);
device.DataTick = content.ReadInt(2);
device.ICCID = content.ReadString(20, Encoding.ASCII);
device.WZGPS = content.ReadString(17, Encoding.ASCII);
content.SkipBytes(4);
device.Longitude = content.ReadString(9, Encoding.ASCII);
device.Latitude = content.ReadString(8, Encoding.ASCII);
device.ConnectStrLength = content.ReadInt(1);
device.ConnectString = content.ReadString((int)device.ConnectStrLength, Encoding.ASCII);
}
private void Decode2103ZK(DeviceData device,IByteBuffer content)
{
device.AgreementVersion = content.ReadInt(1);
var Data2 = content.ReadBitArray();
device.Data2_B7_2103 = Data2[0];
device.Data2_B6_2103 = Data2[1];
}
} }
} }

@ -28,26 +28,16 @@ namespace LanShengService.Tcp
{ {
Encode1104ZK(Temp, message.Content!); Encode1104ZK(Temp, message.Content!);
} }
else { else
Encode1104RY(Temp,message.Content!); {
Encode1104RY(Temp, message.Content!);
} }
break; break;
case "1107": case "1107":
Temp.AddRange(((int)message.Content!.UVersion!).Int2Byte().BytePadLeft(2)); Encode1107ZK(Temp, message.Content!);
var FtpUrlByte = Encoding.ASCII.GetBytes(message.Content.FtpUrl!); break;
message.Content.FtpLength = message.Content.FtpUrl!.Length; case "2104":
Temp.AddRange(((int)message.Content.FtpLength!).Int2Byte().BytePadLeft(1)); Encode2104ZK(Temp, message.Content!);
Temp.AddRange(FtpUrlByte);
var FtpUserByte = Encoding.ASCII.GetBytes(message.Content.UserPwd!);
message.Content.UserLength = message.Content.UserPwd!.Length;
Temp.AddRange(((int)message.Content.UserLength!).Int2Byte().BytePadLeft(1));
Temp.AddRange(FtpUserByte);
var BinUrlByte = Encoding.ASCII.GetBytes(message.Content.BinUrl!);
message.Content.BinLength = message.Content.BinUrl!.Length;
Temp.AddRange(((int)message.Content.BinLength!).Int2Byte().BytePadLeft(1));
Temp.AddRange(BinUrlByte);
Temp.AddRange(((int)message.Content!.BinSize!).Int2Byte().BytePadLeft(3));
Temp.AddRange(((int)message.Content!.UpdateSpan!).Int2Byte().BytePadLeft(1));
break; break;
default: default:
break; break;
@ -60,7 +50,8 @@ namespace LanShengService.Tcp
output.WriteBytes(Temp.ToArray()); output.WriteBytes(Temp.ToArray());
} }
private void Encode1104RY(List<byte> bytes,DeviceData device) { private void Encode1104RY(List<byte> bytes, DeviceData device)
{
bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1)); bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2)); bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
int[] Data1 = new int[] { int[] Data1 = new int[] {
@ -242,5 +233,35 @@ namespace LanShengService.Tcp
bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1)); bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(ConnectByte); bytes.AddRange(ConnectByte);
} }
private void Encode1107ZK(List<byte> bytes, DeviceData device)
{
bytes.AddRange(((int)device.UVersion!).Int2Byte().BytePadLeft(2));
var FtpUrlByte = Encoding.ASCII.GetBytes(device.FtpUrl!);
device.FtpLength = device.FtpUrl!.Length;
bytes.AddRange(((int)device.FtpLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(FtpUrlByte);
var FtpUserByte = Encoding.ASCII.GetBytes(device.UserPwd!);
device.UserLength = device.UserPwd!.Length;
bytes.AddRange(((int)device.UserLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(FtpUserByte);
var BinUrlByte = Encoding.ASCII.GetBytes(device.BinUrl!);
device.BinLength = device.BinUrl!.Length;
bytes.AddRange(((int)device.BinLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(BinUrlByte);
bytes.AddRange(((int)device.BinSize!).Int2Byte().BytePadLeft(3));
bytes.AddRange(((int)device.UpdateSpan!).Int2Byte().BytePadLeft(1));
}
private void Encode2104ZK(List<byte> bytes, DeviceData device)
{
bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
bytes.AddRange(0.Int2Byte().BytePadLeft(4));
var ConnectByte = Encoding.ASCII.GetBytes(device.ConnectString!);
device.ConnectStrLength = device.ConnectString!.Length;
bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(ConnectByte);
}
} }
} }

@ -209,7 +209,7 @@ namespace LanShengService
Frame_START = "FAAA", Frame_START = "FAAA",
Frame_number = Frame_number, Frame_number = Frame_number,
DTU_ID = deviceData.Id, DTU_ID = deviceData.Id,
Msg_ID = deviceData.UVersion == null ? "1104" : "1107", Msg_ID = string.IsNullOrEmpty(deviceData.MsgType) ? "1104" : deviceData.MsgType,
Frame_END = "BBFB", Frame_END = "BBFB",
Content = deviceData Content = deviceData
}; };
@ -246,16 +246,18 @@ namespace LanShengService
{ {
deviceData.UpdateTag = 0; deviceData.UpdateTag = 0;
} }
if (deviceData.Data8_B7_1104 == null) { if (deviceData.Data8_B7_1104 == null)
{
deviceData.Data8_B7_1104 = 0; deviceData.Data8_B7_1104 = 0;
} }
if(deviceData.BinSize == null) if (deviceData.BinSize == null)
{ {
deviceData.BinSize = 0; deviceData.BinSize = 0;
} }
foreach (PropertyInfo propertyInfo in TempPropertys) foreach (PropertyInfo propertyInfo in TempPropertys)
{ {
if (propertyInfo.GetValue(deviceData) == null) { if (propertyInfo.GetValue(deviceData) == null)
{
propertyInfo.SetValue(deviceData, propertyInfo.GetValue(oldData)); propertyInfo.SetValue(deviceData, propertyInfo.GetValue(oldData));
} }
} }

Loading…
Cancel
Save