生成条码优化
This commit is contained in:
@ -21,14 +21,17 @@ namespace WCS.BLL.Manager
|
||||
public static List<TCPClient> TCPClients = new List<TCPClient>();
|
||||
public static void InitTcpClient()
|
||||
{
|
||||
var ips = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ShelfCode.Contains("C")).Select(t => t.ClientIp).ToList();
|
||||
var ips = DbHelp.db.Queryable<ShelfInfo>()
|
||||
//.Where(t => t.ShelfCode.Contains("C"))
|
||||
.Select(t => t.ClientIp)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
foreach (var ip in ips)
|
||||
{
|
||||
var tcpCleint = new TCPClient(ip, "192.168.9.183:20003");
|
||||
//配置断线重连
|
||||
tcpCleint.tcpClient.Received += (client, e) =>
|
||||
{
|
||||
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||
if (TcpCleint == null)
|
||||
@ -99,33 +102,34 @@ namespace WCS.BLL.Manager
|
||||
Logs.Write("协议处理完毕!");
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
TCPClients.Add(tcpCleint);
|
||||
tcpCleint.Connect();
|
||||
}
|
||||
}
|
||||
|
||||
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
|
||||
public static void InitStatus()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
Thread.Sleep(1000);
|
||||
//给所有板子发复位
|
||||
TCPClients.ForEach(tcpClient =>
|
||||
{
|
||||
//板子复位
|
||||
new SmartShelfModule() { BoardId = 2047 }.Reset(tcpClient);
|
||||
new SmartShelfModule()
|
||||
{
|
||||
BoardId = 2047
|
||||
}.Reset(tcpClient);
|
||||
//报警灯复位
|
||||
new WarningLight().CloseLight(tcpClient);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logs.Write($"启动时复位异常,{ex.Message}");
|
||||
Logs.Write($"启动时复位异常,{ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user