报警灯

This commit is contained in:
hehaibing-1996
2025-04-16 18:48:50 +08:00
parent aeb58bd0b1
commit 78f476ec9c
3 changed files with 43 additions and 34 deletions

View File

@ -219,8 +219,11 @@ namespace WCS.BLL.HardWare
shelfModel.WarningBoardId = shelfInfo.LightId;
shelfModel.ClientIp = ClientIp;
shelfModel.StoreList = new List<SingleLightStoreModel>();
Logs.Write($"[单灯后台刷新线程]亮灯任务数量{currentTasks.Count}");
currentTasks.ForEach(task =>
{
Logs.Write($"[单灯后台刷新线程]亮灯任务{task.ModuleCode}");
var module = MXL4Modules.Where(t => t.ModuleCode == task.ModuleCode).First();
if (module != null)
{
@ -406,19 +409,23 @@ namespace WCS.BLL.HardWare
var tcpClient = TCPClientManager.Service.GetClients().Where(t => t.IP + ":" + t.Port.ToString() == ClientIp).FirstOrDefault();
if (tcpClient != null)
{
try
lock (tcpClient)
{
tcpClient.Send(sendData, 0, sendData.Length);
Logs.Write("【单灯单独控制】发送指令" + BitConverter.ToString(sendData));
}
catch (Exception ex)
{
Logs.Write($"【单灯单独控制】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
return new ResponseCommon<object>()
try
{
Code = 201,
Message = $"【单灯单独控制】{client}指令发送中遇到异常{ex.Message}",
};
tcpClient.Send(sendData, 0, sendData.Length);
Logs.Write("【单灯单独控制】发送指令" + BitConverter.ToString(sendData));
}
catch (Exception ex)
{
Logs.Write($"【单灯单独控制】{client}以下指令发送中遇到异常{ex.Message}" + BitConverter.ToString(sendData));
return new ResponseCommon<object>()
{
Code = 201,
Message = $"【单灯单独控制】{client}指令发送中遇到异常{ex.Message}",
};
}
Thread.Sleep(100);
}
}
else