GPS通讯参数已完成

main
潘建东 10 months ago
parent 8769cb13a3
commit 5694b2635d

@ -499,33 +499,595 @@ namespace LanShengModel
[SugarColumn(IsNullable = true,IsOnlyIgnoreInsert = true,DefaultValue = "0")] [SugarColumn(IsNullable = true,IsOnlyIgnoreInsert = true,DefaultValue = "0")]
public int? RunCount { get; set; } public int? RunCount { get; set; }
/// <summary>
/// 更新版本号
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? UVersion { get; set; } public int? UVersion { get; set; }
/// <summary>
/// FTP地址长度
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? FtpLength { get; set; } public int? FtpLength { get; set; }
/// <summary>
/// FTP地址
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public string? FtpUrl { get; set; } public string? FtpUrl { get; set; }
/// <summary>
/// 用户密码长度
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? UserLength { get; set; } public int? UserLength { get; set; }
/// <summary>
/// 用户密码
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public string? UserPwd { get; set; } public string? UserPwd { get; set; }
/// <summary>
/// Bin地址长度
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? BinLength { get; set; } public int? BinLength { get; set; }
/// <summary>
/// Bin地址
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public string? BinUrl { get; set; } public string? BinUrl { get; set; }
/// <summary>
/// Bin文件大小
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? BinSize { get; set; } public int? BinSize { get; set; }
/// <summary>
/// 更新时间范围
/// </summary>
[SugarColumn(IsNullable = true)] [SugarColumn(IsNullable = true)]
public int? UpdateSpan { get; set; } public int? UpdateSpan { get; set; }
/// <summary>
/// 外召主机通讯
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data16_B5_N { get; set; }
/// <summary>
/// 进料门上光电(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B7 { get; set; }
/// <summary>
/// 出料门上光电(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B6 { get; set; }
/// <summary>
/// 上行通道检测限位(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B5 { get; set; }
/// <summary>
/// 下行通道检测限位(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B4 { get; set; }
/// <summary>
/// 预留1限位(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B3 { get; set; }
/// <summary>
/// 预留2限位(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B2 { get; set; }
/// <summary>
/// 预留3限位(0断开1闭合)
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data19_B1 { get; set; }
/// <summary>
/// 左右笼设置 0左笼 1右笼
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B7 { get; set; }
/// <summary>
/// 中间B1楼层开关 0无B1层 1有B1层
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B6 { get; set; }
/// <summary>
/// 中途位置丢失功能 0不动作 1自动到1楼
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B5 { get; set; }
/// <summary>
/// 中途位置丢失自动到1楼高速开关 0不使能高速 1使能笼顶高速
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B4 { get; set; }
/// <summary>
/// 自动下降开关 0关闭 1开启
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B3 { get; set; }
/// <summary>
/// 满载直驶人数限制开关 0关闭 1开启
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B2 { get; set; }
/// <summary>
/// 满载直驶重量限制开关 0关闭 1开启
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B1 { get; set; }
/// <summary>
/// 货运模式开关 0关闭 1开启
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data28_B0 { get; set; }
/// <summary>
/// 预留
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data29_B7 { get; set; }
/// <summary>
/// 进料门光幕屏蔽 0不屏蔽 1屏蔽
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data29_B6 { get; set; }
/// <summary>
/// 出料门光幕屏蔽 0不屏蔽 1屏蔽
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data29_B5 { get; set; }
/// <summary>
/// 上行通道检测屏蔽 0不屏蔽 1屏蔽
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data29_B4 { get; set; }
/// <summary>
/// 下行通道检测屏蔽 0不屏蔽 1屏蔽
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data29_B3 { get; set; }
/// <summary>
/// 楼栋号
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data30 { get; set; }
/// <summary>
/// USR207模块信道
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data31 { get; set; }
/// <summary>
/// USR207模块目标地址
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data32_33 { get; set; }
/// <summary>
/// USR207模块速率
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data34 { get; set; }
/// <summary>
/// USR207模块前向纠错
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data35 { get; set; }
/// <summary>
/// 关门后运行等待时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data36 { get; set; }
/// <summary>
/// 停机后运行等待时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data37 { get; set; }
/// <summary>
/// 一体机开门超时时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data38_39 { get; set; }
/// <summary>
/// 吊笼内限制人数
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data40 { get; set; }
/// <summary>
/// 自动下降楼层
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data41 { get; set; }
/// <summary>
/// 自动下降等待时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data42_43 { get; set; }
/// <summary>
/// 满载直驶人数限制值
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data44 { get; set; }
/// <summary>
/// 满载直驶重量限制值
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data45_46 { get; set; }
/// <summary>
/// 自动关门延时时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data47_48 { get; set; }
/// <summary>
/// 延时按键延时时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data49_50 { get; set; }
/// <summary>
/// 进料门开门总时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data51_52 { get; set; }
/// <summary>
/// 进料门关门总时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data53_54 { get; set; }
/// <summary>
/// 出料门开门总时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data55_56 { get; set; }
/// <summary>
/// 出料门关门总时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data57_58 { get; set; }
/// <summary>
/// 进料门开门高速时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data59_60 { get; set; }
/// <summary>
/// 进料门关门高速时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data61_62 { get; set; }
/// <summary>
/// 出料门开门高速时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data63_64 { get; set; }
/// <summary>
/// 出料门关门高速时间
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data65_66 { get; set; }
/// <summary>
/// B1层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B7 { get; set; }
/// <summary>
/// 01层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B6 { get; set; }
/// <summary>
/// 02层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B5 { get; set; }
/// <summary>
/// 03层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B4 { get; set; }
/// <summary>
/// 04层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B3 { get; set; }
/// <summary>
/// 05层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B2 { get; set; }
/// <summary>
/// 06层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B1 { get; set; }
/// <summary>
/// 07层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data67_B0 { get; set; }
/// <summary>
/// 08层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B7 { get; set; }
/// <summary>
/// 09层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B6 { get; set; }
/// <summary>
/// 10层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B5 { get; set; }
/// <summary>
/// 11层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B4 { get; set; }
/// <summary>
/// 12层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B3 { get; set; }
/// <summary>
/// 13层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B2 { get; set; }
/// <summary>
/// 14层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B1 { get; set; }
/// <summary>
/// 15层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data68_B0 { get; set; }
/// <summary>
/// 16层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B7 { get; set; }
/// <summary>
/// 17层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B6 { get; set; }
/// <summary>
/// 18层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B5 { get; set; }
/// <summary>
/// 19层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B4 { get; set; }
/// <summary>
/// 20层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B3 { get; set; }
/// <summary>
/// 21层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B2 { get; set; }
/// <summary>
/// 22层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B1 { get; set; }
/// <summary>
/// 23层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data69_B0 { get; set; }
/// <summary>
/// 24层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B7 { get; set; }
/// <summary>
/// 25层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B6 { get; set; }
/// <summary>
/// 26层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B5 { get; set; }
/// <summary>
/// 27层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B4 { get; set; }
/// <summary>
/// 28层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B3 { get; set; }
/// <summary>
/// 29层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B2 { get; set; }
/// <summary>
/// 30层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B1 { get; set; }
/// <summary>
/// 31层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data70_B0 { get; set; }
/// <summary>
/// 32层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B7 { get; set; }
/// <summary>
/// 33层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B6 { get; set; }
/// <summary>
/// 34层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B5 { get; set; }
/// <summary>
/// 35层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B4 { get; set; }
/// <summary>
/// 36层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B3 { get; set; }
/// <summary>
/// 37层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B2 { get; set; }
/// <summary>
/// 38层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B1 { get; set; }
/// <summary>
/// 39层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data71_B0 { get; set; }
/// <summary>
/// 40层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data72_B7 { get; set; }
/// <summary>
/// 41层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data72_B6 { get; set; }
/// <summary>
/// 42层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data72_B5 { get; set; }
/// <summary>
/// 43层有效
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data72_B4 { get; set; }
/// <summary>
/// 恢复出厂设置
/// </summary>
[SugarColumn(IsIgnore = true)]
public int? Data8_B7_1104 { get; set; }
#region 业务字段 #region 业务字段
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public string? MsgType { get; set; } public string? MsgType { get; set; }

@ -140,8 +140,20 @@ namespace LanShengService
await temp.AsInsertable.ExecuteCommandAsync(); await temp.AsInsertable.ExecuteCommandAsync();
var TempType = typeof(DeviceData);
var TempPropertys = TempType.GetProperties();
var TempColumns1103 = new List<string>();
foreach (var TempProperty in TempPropertys) {
if (TempProperty.GetValue(Values1103[0]) != null) {
TempColumns1103.Add(TempProperty.Name);
}
}
await temp.AsUpdateable await temp.AsUpdateable
.UpdateColumns(Columns1103) .UpdateColumns(TempColumns1103.ToArray())
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }
} }

@ -9,6 +9,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonExtend; using CommonExtend;
using CommonModel; using CommonModel;
using static Google.Rpc.Context.AttributeContext.Types;
namespace LanShengService.Tcp namespace LanShengService.Tcp
{ {
@ -78,83 +79,18 @@ namespace LanShengService.Tcp
request.Content.ConnectString = Content.ReadString((int)request.Content.ConnectStrLength, Encoding.ASCII); request.Content.ConnectString = Content.ReadString((int)request.Content.ConnectStrLength, Encoding.ASCII);
break; break;
case "1103": case "1103":
request.Content.Version = Content.ReadInt(1); if (request.Content.Id.StartsWith("QC") || request.Content.Id.StartsWith("ZK"))
var Data2 = Content.ReadBitArray(); {
request.Content.Data2_B7 = Data2[0]; Decode1103ZK(request.Content, Content);
request.Content.Data2_B6 = Data2[1]; }
request.Content.Data2_B5 = Data2[2]; else
request.Content.Data2_B4 = Data2[3]; {
request.Content.Data2_B3 = Data2[4]; Decode1103RY(request.Content, Content);
request.Content.Data2_B2 = Data2[5]; }
request.Content.Data2_B1 = Data2[6];
request.Content.Data2_B0 = Data2[7];
var Data3 = Content.ReadBitArray();
request.Content.Data3_B7 = Data3[0];
request.Content.Data3_B6 = Data3[1];
request.Content.Data3_B5 = Data3[2];
request.Content.Data3_B4 = Data3[3];
request.Content.Data3_B3 = Data3[4];
request.Content.Data3_B2 = Data3[5];
request.Content.Data3_B1 = Data3[6];
request.Content.Data3_B0 = Data3[7];
request.Content.Data4 = Content.ReadInt(1);
request.Content.Data5 = Content.ReadInt(1);
request.Content.Data6 = Content.ReadInt(1);
request.Content.Data7 = Content.ReadInt(1);
request.Content.Data8 = Content.ReadInt(2);
request.Content.Data10 = Content.ReadInt(1);
request.Content.Data11 = Content.ReadInt(1);
request.Content.Data12 = Content.ReadInt(1);
request.Content.Data13 = Content.ReadInt(1);
var Data14 = Content.ReadBitArray();
request.Content.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
request.Content.Data14_B5 = Data14[2];
request.Content.Data14_B4 = Data14[3];
request.Content.Data14_B3 = Data14[4];
request.Content.Data14_B2 = Data14[5];
request.Content.Data14_B1 = Data14[6];
request.Content.Data14_B0 = Data14[7];
var Data15 = Content.ReadBitArray();
request.Content.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
request.Content.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
request.Content.Data15_B3 = Data15[4];
request.Content.Data15_B2 = Data15[5];
request.Content.Data15_B1 = Data15[6];
request.Content.Data15_B0 = Data15[7];
var Data16 = Content.ReadBitArray();
request.Content.Data16_B7 = Data16[0];
request.Content.Data16_B6 = Data16[1];
request.Content.Data16_B5 = Data16[2];
request.Content.Data16_B4 = Data16[3];
request.Content.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
request.Content.Data16_B1 = Data16[6];
request.Content.Data16_B0 = Data16[7];
request.Content.Data17 = Content.ReadInt(1);
request.Content.Data18 = Content.ReadInt(1);
request.Content.Data19 = Content.ReadInt(1);
request.Content.Data20 = Content.ReadInt(1);
request.Content.Data21 = Content.ReadInt(1);
request.Content.Data22 = Content.ReadInt(1);
request.Content.Data23 = Content.ReadInt(1);
request.Content.Data24 = Content.ReadInt(1);
var Data25 = Content.ReadBitArray();
request.Content.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
request.Content.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
var Data26 = Content.ReadBitArray();
request.Content.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
request.Content.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
var Data27 = Content.ReadBitArray();
request.Content.Data27_B7 = Data27[0];
request.Content.Data27_B6 = Data27[1];
request.Content.Data27_B5 = Data27[2];
request.Content.Data27_B4 = Data27[3];
request.Content.Data27_B3 = Data27[4];
request.Content.Data27_B0 = Data27[7];
break; break;
default: default:
break; break;
} }
request.Content = request.Content;
} }
catch catch
{ {
@ -174,5 +110,249 @@ namespace LanShengService.Tcp
return; return;
} }
} }
private void Decode1103RY(DeviceData device, IByteBuffer content)
{
device.Version = content.ReadInt(1);
var Data2 = content.ReadBitArray();
device.Data2_B7 = Data2[0];
device.Data2_B6 = Data2[1];
device.Data2_B5 = Data2[2];
device.Data2_B4 = Data2[3];
device.Data2_B3 = Data2[4];
device.Data2_B2 = Data2[5];
device.Data2_B1 = Data2[6];
device.Data2_B0 = Data2[7];
var Data3 = content.ReadBitArray();
device.Data3_B7 = Data3[0];
device.Data3_B6 = Data3[1];
device.Data3_B5 = Data3[2];
device.Data3_B4 = Data3[3];
device.Data3_B3 = Data3[4];
device.Data3_B2 = Data3[5];
device.Data3_B1 = Data3[6];
device.Data3_B0 = Data3[7];
device.Data4 = content.ReadInt(1);
device.Data5 = content.ReadInt(1);
device.Data6 = content.ReadInt(1);
device.Data7 = content.ReadInt(1);
device.Data8 = content.ReadInt(2);
device.Data10 = content.ReadInt(1);
device.Data11 = content.ReadInt(1);
device.Data12 = content.ReadInt(1);
device.Data13 = content.ReadInt(1);
var Data14 = content.ReadBitArray();
device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
device.Data14_B5 = Data14[2];
device.Data14_B4 = Data14[3];
device.Data14_B3 = Data14[4];
device.Data14_B2 = Data14[5];
device.Data14_B1 = Data14[6];
device.Data14_B0 = Data14[7];
var Data15 = content.ReadBitArray();
device.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
device.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
device.Data15_B3 = Data15[4];
device.Data15_B2 = Data15[5];
device.Data15_B1 = Data15[6];
device.Data15_B0 = Data15[7];
var Data16 = content.ReadBitArray();
device.Data16_B7 = Data16[0];
device.Data16_B6 = Data16[1];
device.Data16_B5 = Data16[2];
device.Data16_B4 = Data16[3];
device.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
device.Data16_B1 = Data16[6];
device.Data16_B0 = Data16[7];
device.Data17 = content.ReadInt(1);
device.Data18 = content.ReadInt(1);
device.Data19 = content.ReadInt(1);
device.Data20 = content.ReadInt(1);
device.Data21 = content.ReadInt(1);
device.Data22 = content.ReadInt(1);
device.Data23 = content.ReadInt(1);
device.Data24 = content.ReadInt(1);
var Data25 = content.ReadBitArray();
device.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
device.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
var Data26 = content.ReadBitArray();
device.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
device.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
var Data27 = content.ReadBitArray();
device.Data27_B7 = Data27[0];
device.Data27_B6 = Data27[1];
device.Data27_B5 = Data27[2];
device.Data27_B4 = Data27[3];
device.Data27_B3 = Data27[4];
device.Data27_B0 = Data27[7];
}
private void Decode1103ZK(DeviceData device, IByteBuffer content) {
device.Version = content.ReadInt(1);
var Data2 = content.ReadBitArray();
device.Data2_B7 = Data2[0];
device.Data2_B6 = Data2[1];
device.Data2_B5 = Data2[2];
device.Data2_B4 = Data2[3];
device.Data2_B3 = Data2[4];
device.Data2_B2 = Data2[5];
device.Data2_B1 = Data2[6];
device.Data2_B0 = Data2[7];
var Data3 = content.ReadBitArray();
device.Data3_B7 = Data3[0];
device.Data3_B6 = Data3[1];
device.Data3_B5 = Data3[2];
device.Data3_B4 = Data3[3];
device.Data3_B3 = Data3[4];
device.Data3_B2 = Data3[5];
device.Data3_B1 = Data3[6];
device.Data3_B0 = Data3[7];
device.Data4 = content.ReadInt(1);
device.Data5 = content.ReadInt(1);
device.Data6 = content.ReadInt(1);
device.Data7 = content.ReadInt(1);
device.Data8 = content.ReadInt(2);
device.Data10 = content.ReadInt(1);
device.Data11 = content.ReadInt(1);
device.Data12 = content.ReadInt(1);
content.SkipBytes(1);
var Data14 = content.ReadBitArray();
device.Data14_B6 = Convert.ToInt32($"{Data14[1]}{Data14[0]}", 2);
device.Data14_B5 = Data14[2];
device.Data14_B4 = Data14[3];
device.Data14_B3 = Data14[4];
device.Data14_B2 = Data14[5];
device.Data14_B1 = Data14[6];
device.Data14_B0 = Data14[7];
var Data15 = content.ReadBitArray();
device.Data15_B6 = Convert.ToInt32($"{Data15[1]}{Data15[0]}", 2);
device.Data15_B4 = Convert.ToInt32($"{Data15[3]}{Data15[2]}", 2);
device.Data15_B3 = Data15[4];
device.Data15_B2 = Data15[5];
device.Data15_B1 = Data15[6];
device.Data15_B0 = Data15[7];
var Data16 = content.ReadBitArray();
device.Data16_B7 = Data16[0];
device.Data16_B6 = Data16[1];
device.Data16_B5_N = Data16[2];
device.Data16_B4 = Data16[3];
device.Data16_B2 = Convert.ToInt32($"{Data16[5]}{Data16[4]}", 2);
device.Data16_B1 = Data16[6];
device.Data16_B0 = Data16[7];
device.Data17 = content.ReadInt(1);
device.Data18 = content.ReadInt(1);
var Data19 = content.ReadBitArray();
device.Data19_B7 = Data19[0];
device.Data19_B6 = Data19[1];
device.Data19_B5 = Data19[2];
device.Data19_B4 = Data19[3];
device.Data19_B3 = Data19[4];
device.Data19_B2 = Data19[5];
device.Data19_B1 = Data19[6];
device.Data20 = content.ReadInt(1);
device.Data21 = content.ReadInt(1);
device.Data22 = content.ReadInt(1);
device.Data23 = content.ReadInt(1);
device.Data24 = content.ReadInt(1);
var Data25 = content.ReadBitArray();
device.Data25_B4 = Convert.ToInt32($"{Data25[3]}{Data25[2]}{Data25[1]}{Data25[0]}", 2);
device.Data25_B0 = Convert.ToInt32($"{Data25[7]}{Data25[6]}{Data25[5]}{Data25[4]}", 2);
var Data26 = content.ReadBitArray();
device.Data26_B4 = Convert.ToInt32($"{Data26[3]}{Data26[2]}{Data26[1]}{Data26[0]}", 2);
device.Data26_B0 = Convert.ToInt32($"{Data26[7]}{Data26[6]}{Data26[5]}{Data26[4]}", 2);
var Data27 = content.ReadBitArray();
device.Data27_B7 = Data27[0];
device.Data27_B6 = Data27[1];
device.Data27_B5 = Data27[2];
device.Data27_B4 = Data27[3];
device.Data27_B3 = Data27[4];
var Data28 = content.ReadBitArray();
device.Data28_B7 = Data28[0];
device.Data28_B6 = Data28[1];
device.Data28_B5 = Data28[2];
device.Data28_B4 = Data28[3];
device.Data28_B3 = Data28[4];
device.Data28_B2 = Data28[5];
device.Data28_B1 = Data28[6];
device.Data28_B0 = Data28[7];
var Data29 = content.ReadBitArray();
device.Data29_B6 = Data29[1];
device.Data29_B5 = Data29[2];
device.Data29_B4 = Data29[3];
device.Data29_B3 = Data29[4];
device.Data30 = content.ReadInt(1);
device.Data31 = content.ReadInt(1);
device.Data32_33 = content.ReadInt(2);
device.Data34 = content.ReadInt(1);
device.Data35 = content.ReadInt(1);
device.Data36 = content.ReadInt(1);
device.Data37 = content.ReadInt(1);
device.Data38_39 = content.ReadInt(2);
device.Data40 = content.ReadInt(1);
device.Data41 = content.ReadInt(1);
device.Data42_43 = content.ReadInt(2);
device.Data44 = content.ReadInt(1);
device.Data45_46 = content.ReadInt(2);
device.Data47_48 = content.ReadInt(2);
device.Data49_50 = content.ReadInt(2);
device.Data51_52 = content.ReadInt(2);
device.Data53_54 = content.ReadInt(2);
device.Data55_56 = content.ReadInt(2);
device.Data57_58 = content.ReadInt(2);
device.Data59_60 = content.ReadInt(2);
device.Data61_62 = content.ReadInt(2);
device.Data63_64 = content.ReadInt(2);
device.Data65_66 = content.ReadInt(2);
var Data67 = content.ReadBitArray();
device.Data67_B7 = Data67[0];
device.Data67_B6 = Data67[1];
device.Data67_B5 = Data67[2];
device.Data67_B4 = Data67[3];
device.Data67_B3 = Data67[4];
device.Data67_B2 = Data67[5];
device.Data67_B1 = Data67[6];
device.Data67_B0 = Data67[7];
var Data68 = content.ReadBitArray();
device.Data68_B7 = Data68[0];
device.Data68_B6 = Data68[1];
device.Data68_B5 = Data68[2];
device.Data68_B4 = Data68[3];
device.Data68_B3 = Data68[4];
device.Data68_B2 = Data68[5];
device.Data68_B1 = Data68[6];
device.Data68_B0 = Data68[7];
var Data69 = content.ReadBitArray();
device.Data69_B7 = Data69[0];
device.Data69_B6 = Data69[1];
device.Data69_B5 = Data69[2];
device.Data69_B4 = Data69[3];
device.Data69_B3 = Data69[4];
device.Data69_B2 = Data69[5];
device.Data69_B1 = Data69[6];
device.Data69_B0 = Data69[7];
var Data70 = content.ReadBitArray();
device.Data70_B7 = Data70[0];
device.Data70_B6 = Data70[1];
device.Data70_B5 = Data70[2];
device.Data70_B4 = Data70[3];
device.Data70_B3 = Data70[4];
device.Data70_B2 = Data70[5];
device.Data70_B1 = Data70[6];
device.Data70_B0 = Data70[7];
var Data71 = content.ReadBitArray();
device.Data71_B7 = Data71[0];
device.Data71_B6 = Data71[1];
device.Data71_B5 = Data71[2];
device.Data71_B4 = Data71[3];
device.Data71_B3 = Data71[4];
device.Data71_B2 = Data71[5];
device.Data71_B1 = Data71[6];
device.Data71_B0 = Data71[7];
var Data72 = content.ReadBitArray();
device.Data72_B7 = Data72[0];
device.Data72_B6 = Data72[1];
device.Data72_B5 = Data72[2];
device.Data72_B4 = Data72[3];
}
} }
} }

@ -24,39 +24,13 @@ namespace LanShengService.Tcp
switch (message.Msg_ID) switch (message.Msg_ID)
{ {
case "1104": case "1104":
Temp.AddRange(((int)message.Content!.Version!).Int2Byte().BytePadLeft(1)); if (message.Content!.Id!.StartsWith("QC") || message.Content!.Id!.StartsWith("ZK"))
Temp.AddRange(((int)message.Content!.DataTick!).Int2Byte().BytePadLeft(2)); {
int[] Data1 = new int[] { Encode1104ZK(Temp, message.Content!);
(int)message.Content!.Data27_B7!, }
(int)message.Content!.Data27_B6!, else {
(int)message.Content!.Data27_B5!, Encode1104RY(Temp,message.Content!);
(int)message.Content!.Data27_B4!, }
(int)message.Content!.Data27_B3!,
0,
0,
(int)message.Content!.Data27_B0!,
};
Temp.AddRange(Data1.BitArray2Byte());
int[] Data2 = new int[] {
(int)message.Content!.Data23!,
(int)message.Content!.Data20!,
(int)message.Content!.Data19!,
(int)message.Content!.Data18!,
((int)message.Content!.Data16_B2!).Int2Bit(2)[1],
((int)message.Content!.Data16_B2!).Int2Bit(2)[0],
0,
0
};
Temp.AddRange(Data2.BitArray2Byte());
Temp.AddRange(((int)message.Content.Data25_B4!).Int2Byte().BytePadLeft(1));
Temp.AddRange(((int)message.Content.Data25_B0!).Int2Byte().BytePadLeft(1));
Temp.AddRange(((int)message.Content.Data26_B4!).Int2Byte().BytePadLeft(1));
Temp.AddRange(((int)message.Content.Data26_B0!).Int2Byte().BytePadLeft(1));
Temp.AddRange(((int)message.Content.UpdateTag!).Int2Byte().BytePadLeft(1));
var ConnectByte = Encoding.ASCII.GetBytes(message.Content.ConnectString!);
message.Content.ConnectStrLength = message.Content.ConnectString!.Length;
Temp.AddRange(((int)message.Content.ConnectStrLength!).Int2Byte().BytePadLeft(1));
Temp.AddRange(ConnectByte);
break; break;
case "1107": case "1107":
Temp.AddRange(((int)message.Content!.UVersion!).Int2Byte().BytePadLeft(2)); Temp.AddRange(((int)message.Content!.UVersion!).Int2Byte().BytePadLeft(2));
@ -85,5 +59,188 @@ namespace LanShengService.Tcp
Temp.AddRange(message.Frame_END!.HexString2Byte().BytePadLeft(2)); Temp.AddRange(message.Frame_END!.HexString2Byte().BytePadLeft(2));
output.WriteBytes(Temp.ToArray()); output.WriteBytes(Temp.ToArray());
} }
private void Encode1104RY(List<byte> bytes,DeviceData device) {
bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
int[] Data1 = new int[] {
(int)device.Data27_B7!,
(int)device.Data27_B6!,
(int)device.Data27_B5!,
(int)device.Data27_B4!,
(int)device.Data27_B3!,
0,
0,
(int)device.Data27_B0!,
};
bytes.AddRange(Data1.BitArray2Byte());
int[] Data2 = new int[] {
(int)device.Data23!,
(int)device.Data20!,
(int)device.Data19!,
(int)device.Data18!,
((int)device.Data16_B2!).Int2Bit(2)[1],
((int)device.Data16_B2!).Int2Bit(2)[0],
0,
0
};
bytes.AddRange(Data2.BitArray2Byte());
bytes.AddRange(((int)device.Data25_B4!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data25_B0!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data26_B4!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data26_B0!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.UpdateTag!).Int2Byte().BytePadLeft(1));
var ConnectByte = Encoding.ASCII.GetBytes(device.ConnectString!);
device.ConnectStrLength = device.ConnectString!.Length;
bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(ConnectByte);
}
private void Encode1104ZK(List<byte> bytes, DeviceData device)
{
bytes.AddRange(((int)device.Version!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.DataTick!).Int2Byte().BytePadLeft(2));
int[] Data1 = new int[] {
(int)device.Data27_B7!,
(int)device.Data27_B6!,
(int)device.Data27_B5!,
(int)device.Data27_B4!,
(int)device.Data27_B3!,
0,
0,
0
};
bytes.AddRange(Data1.BitArray2Byte());
int[] Data2 = new int[] {
(int)device.Data23!,
0,
((int)device.Data18!).Int2Bit(2)[1],
((int)device.Data18!).Int2Bit(2)[0],
((int)device.Data16_B2!).Int2Bit(2)[1],
((int)device.Data16_B2!).Int2Bit(2)[0],
0,
0
};
bytes.AddRange(Data2.BitArray2Byte());
bytes.AddRange(((int)device.Data25_B4!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data25_B0!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data26_B4!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data26_B0!).Int2Byte().BytePadLeft(1));
int[] Data7 = new int[] {
(int)device.Data28_B7!,
(int)device.Data28_B6!,
(int)device.Data28_B5!,
(int)device.Data28_B4!,
(int)device.Data28_B3!,
(int)device.Data28_B2!,
(int)device.Data28_B1!,
(int)device.Data28_B0!
};
bytes.AddRange(Data7.BitArray2Byte());
int[] Data8 = new int[] {
(int)device.Data8_B7_1104!,
(int)device.Data29_B6!,
(int)device.Data29_B5!,
(int)device.Data29_B4!,
(int)device.Data29_B3!,
0,
0,
0
};
bytes.AddRange(Data8.BitArray2Byte());
bytes.AddRange(((int)device.Data30!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data31!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data32_33!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data34!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data35!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data36!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data37!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data38_39!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data40!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data41!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data42_43!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data44!).Int2Byte().BytePadLeft(1));
bytes.AddRange(((int)device.Data45_46!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data47_48!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data49_50!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data51_52!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data53_54!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data55_56!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data57_58!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data59_60!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data61_62!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data63_64!).Int2Byte().BytePadLeft(2));
bytes.AddRange(((int)device.Data65_66!).Int2Byte().BytePadLeft(2));
int[] Data32 = new int[] {
(int)device.Data67_B7!,
(int)device.Data67_B6!,
(int)device.Data67_B5!,
(int)device.Data67_B4!,
(int)device.Data67_B3!,
(int)device.Data67_B2!,
(int)device.Data67_B1!,
(int)device.Data67_B0!
};
bytes.AddRange(Data32.BitArray2Byte());
int[] Data33 = new int[] {
(int)device.Data68_B7!,
(int)device.Data68_B6!,
(int)device.Data68_B5!,
(int)device.Data68_B4!,
(int)device.Data68_B3!,
(int)device.Data68_B2!,
(int)device.Data68_B1!,
(int)device.Data68_B0!
};
bytes.AddRange(Data33.BitArray2Byte());
int[] Data34 = new int[] {
(int)device.Data69_B7!,
(int)device.Data69_B6!,
(int)device.Data69_B5!,
(int)device.Data69_B4!,
(int)device.Data69_B3!,
(int)device.Data69_B2!,
(int)device.Data69_B1!,
(int)device.Data69_B0!
};
bytes.AddRange(Data34.BitArray2Byte());
int[] Data35 = new int[] {
(int)device.Data70_B7!,
(int)device.Data70_B6!,
(int)device.Data70_B5!,
(int)device.Data70_B4!,
(int)device.Data70_B3!,
(int)device.Data70_B2!,
(int)device.Data70_B1!,
(int)device.Data70_B0!
};
bytes.AddRange(Data35.BitArray2Byte());
int[] Data36 = new int[] {
(int)device.Data71_B7!,
(int)device.Data71_B6!,
(int)device.Data71_B5!,
(int)device.Data71_B4!,
(int)device.Data71_B3!,
(int)device.Data71_B2!,
(int)device.Data71_B1!,
(int)device.Data71_B0!
};
bytes.AddRange(Data36.BitArray2Byte());
int[] Data37 = new int[] {
(int)device.Data72_B7!,
(int)device.Data72_B6!,
(int)device.Data72_B5!,
(int)device.Data72_B4!,
0,
0,
0,
0
};
bytes.AddRange(Data37.BitArray2Byte());
var ConnectByte = Encoding.ASCII.GetBytes(device.ConnectString!);
device.ConnectStrLength = device.ConnectString!.Length;
bytes.AddRange(((int)device.ConnectStrLength!).Int2Byte().BytePadLeft(1));
bytes.AddRange(ConnectByte);
}
} }
} }

@ -26,6 +26,7 @@ using DotNetty.Transport.Channels.Groups;
using CommonModel; using CommonModel;
using DotNetty.Handlers.Timeout; using DotNetty.Handlers.Timeout;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection;
namespace LanShengService namespace LanShengService
{ {
@ -231,34 +232,8 @@ namespace LanShengService
{ {
var oldData = Db.Queryable<DeviceData>().Where(x => x.Id == deviceData.Id).First(); var oldData = Db.Queryable<DeviceData>().Where(x => x.Id == deviceData.Id).First();
if (deviceData.Version == null) Type TempType = typeof(DeviceData);
{ PropertyInfo[] TempPropertys = TempType.GetProperties();
deviceData.Version = oldData.Version;
}
if (deviceData.DataTick == null)
{
deviceData.DataTick = oldData.DataTick;
}
if (deviceData.Data27_B7 == null)
{
deviceData.Data27_B7 = oldData.Data27_B7;
}
if (deviceData.Data27_B6 == null)
{
deviceData.Data27_B6 = oldData.Data27_B6;
}
if (deviceData.Data27_B5 == null)
{
deviceData.Data27_B5 = oldData.Data27_B5;
}
if (deviceData.Data27_B4 == null)
{
deviceData.Data27_B4 = oldData.Data27_B4;
}
if (deviceData.Data27_B3 == null)
{
deviceData.Data27_B3 = oldData.Data27_B3;
}
if (deviceData.ConnectString != null && deviceData.ConnectString != oldData.ConnectString) if (deviceData.ConnectString != null && deviceData.ConnectString != oldData.ConnectString)
{ {
deviceData.Data27_B0 = 1; deviceData.Data27_B0 = 1;
@ -267,50 +242,20 @@ namespace LanShengService
{ {
deviceData.Data27_B0 = 0; deviceData.Data27_B0 = 0;
} }
if (deviceData.Data23 == null)
{
deviceData.Data23 = oldData.Data23;
}
if (deviceData.Data20 == null)
{
deviceData.Data20 = oldData.Data20;
}
if (deviceData.Data19 == null)
{
deviceData.Data19 = oldData.Data19;
}
if (deviceData.Data18 == null)
{
deviceData.Data18 = oldData.Data18;
}
if (deviceData.Data16_B2 == null)
{
deviceData.Data16_B2 = oldData.Data16_B2;
}
if (deviceData.Data25_B4 == null)
{
deviceData.Data25_B4 = oldData.Data25_B4;
}
if (deviceData.Data25_B0 == null)
{
deviceData.Data25_B0 = oldData.Data25_B0;
}
if (deviceData.Data26_B4 == null)
{
deviceData.Data26_B4 = oldData.Data26_B4;
}
if (deviceData.Data26_B0 == null)
{
deviceData.Data26_B0 = oldData.Data26_B0;
}
if (deviceData.UpdateTag == null) if (deviceData.UpdateTag == null)
{ {
deviceData.UpdateTag = 0; deviceData.UpdateTag = 0;
} }
if (deviceData.ConnectString == null) if (deviceData.Data8_B7_1104 == null) {
deviceData.Data8_B7_1104 = 0;
}
foreach (PropertyInfo propertyInfo in TempPropertys)
{ {
deviceData.ConnectString = oldData.ConnectString; if (propertyInfo.GetValue(deviceData) == null) {
propertyInfo.SetValue(deviceData, propertyInfo.GetValue(oldData));
}
} }
return Task.CompletedTask; return Task.CompletedTask;
} }

Loading…
Cancel
Save