完成1107下发更新指令

main
潘建东 10 months ago
parent 2a22879453
commit 8769cb13a3

@ -7,7 +7,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Default": "Data Source=mysql;database=lsdb;User Id=root;Pwd=root;charset=utf8;pooling=true;"
"Default": "Data Source=127.0.0.1;database=devdb;User Id=root;Pwd=root;charset=utf8;pooling=true;"
},
"DotNetty": {
"Use": "Y",

@ -293,7 +293,7 @@ namespace LanShengModel
public int? Data16_B4 { get; set; }
/// <summary>
/// 门机控制 0无1进料门2出料门
/// 手动选择 0无1进料门2出料门
/// </summary>
[SugarColumn(IsNullable = true)]
public int? Data16_B2 { get; set; }
@ -499,6 +499,33 @@ namespace LanShengModel
[SugarColumn(IsNullable = true,IsOnlyIgnoreInsert = true,DefaultValue = "0")]
public int? RunCount { get; set; }
[SugarColumn(IsNullable = true)]
public int? UVersion { get; set; }
[SugarColumn(IsNullable = true)]
public int? FtpLength { get; set; }
[SugarColumn(IsNullable = true)]
public string? FtpUrl { get; set; }
[SugarColumn(IsNullable = true)]
public int? UserLength { get; set; }
[SugarColumn(IsNullable = true)]
public string? UserPwd { get; set; }
[SugarColumn(IsNullable = true)]
public int? BinLength { get; set; }
[SugarColumn(IsNullable = true)]
public string? BinUrl { get; set; }
[SugarColumn(IsNullable = true)]
public int? BinSize { get; set; }
[SugarColumn(IsNullable = true)]
public int? UpdateSpan { get; set; }
#region 业务字段
[SugarColumn(IsIgnore = true)]
public string? MsgType { get; set; }

@ -1290,14 +1290,16 @@ namespace LanShengService
var TempCompanyIds = report.CompanyIds;
var TempProjectIds = report.ProjectIds;
var TempDeviceIds = report.DeviceIds;
var TempGpss = Db.Queryable<DeviceDO>()
.LeftJoin<ProjectDO>((x, y) => x.ProjectId == y.Id)
.WhereIF(TempCompanyIds != null, (x, y) => TempCompanyIds!.Contains(y.CompanyId))
.WhereIF(TempProjectIds != null, (x, y) => TempProjectIds!.Contains(x.ProjectId))
.WhereIF(TempDeviceIds != null, (x, y) => TempDeviceIds!.Contains(x.Id))
.WhereIF(TempCompanyIds != null && TempCompanyIds.Count() > 0, (x, y) => TempCompanyIds!.Contains(y.CompanyId))
.WhereIF(TempProjectIds != null && TempProjectIds.Count() > 0, (x, y) => TempProjectIds!.Contains(x.ProjectId))
.WhereIF(TempDeviceIds != null && TempDeviceIds.Count() > 0, (x, y) => TempDeviceIds!.Contains(x.Id))
.Where((x, y) => x.Deleted == 0)
.Select((x,y)=> x.Gps!.ToString())
.Select((x, y) => x.Gps!.ToString())
.ToList();
var TempGpsIds = new List<string>();
TempGpss.ForEach(v => {
try
@ -1309,7 +1311,7 @@ namespace LanShengService
}
});
report.GpsIds = TempGpsIds!;
report.GpsIds = report.GpsIds == null? TempGpsIds!: report.GpsIds.Concat(TempGpsIds!);
}
var TempErrors = await GetDayError(report);
var TempErrorGroup = TempErrors.Select(x => x.ErrCode).Distinct();

@ -80,6 +80,9 @@ namespace LanShengService.Tcp
{
await TcpService.RemoveMessageItem(packet);
}
if (packet.Msg_ID == "9107") {
await TcpService.RemoveMessageItem(packet);
}
TryCount = 0;
}

@ -58,6 +58,23 @@ namespace LanShengService.Tcp
Temp.AddRange(((int)message.Content.ConnectStrLength!).Int2Byte().BytePadLeft(1));
Temp.AddRange(ConnectByte);
break;
case "1107":
Temp.AddRange(((int)message.Content!.UVersion!).Int2Byte().BytePadLeft(2));
var FtpUrlByte = Encoding.ASCII.GetBytes(message.Content.FtpUrl!);
message.Content.FtpLength = message.Content.FtpUrl!.Length;
Temp.AddRange(((int)message.Content.FtpLength!).Int2Byte().BytePadLeft(1));
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;
default:
break;
}

@ -117,7 +117,7 @@ namespace LanShengService
Bootstrap
.Option(ChannelOption.SoBacklog, 1024)
.Option(ChannelOption.Allocator, UnpooledByteBufferAllocator.Default)
.Option(ChannelOption.RcvbufAllocator,new AdaptiveRecvByteBufAllocator())
.Option(ChannelOption.RcvbufAllocator, new AdaptiveRecvByteBufAllocator())
.ChildOption(ChannelOption.Allocator, UnpooledByteBufferAllocator.Default)
.ChildOption(ChannelOption.RcvbufAllocator, new AdaptiveRecvByteBufAllocator())
.ChildOption(ChannelOption.SoKeepalive, true)
@ -146,9 +146,9 @@ namespace LanShengService
Logger.LogDebug("程序关闭");
if (Use == "Y")
{
Task.WaitAll(
BossGroup!.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(0)),
WorkerGroup!.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(0)));
Task.WaitAll(
BossGroup!.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(0)),
WorkerGroup!.ShutdownGracefullyAsync(TimeSpan.FromMilliseconds(0), TimeSpan.FromSeconds(0)));
}
DeviceService.Offline().Wait();
}
@ -208,7 +208,7 @@ namespace LanShengService
Frame_START = "FAAA",
Frame_number = Frame_number,
DTU_ID = deviceData.Id,
Msg_ID = "1104",
Msg_ID = deviceData.UVersion == null ? "1104" : "1107",
Frame_END = "BBFB",
Content = deviceData
};

Loading…
Cancel
Save