Browse Source

线程管理修改

样式分支
pry 2 years ago
parent
commit
7eb25d6397
6 changed files with 17 additions and 6 deletions
  1. +1
    -1
      BPASmartClient.Business/Plugin/MQTTMgr.cs
  2. +1
    -1
      BPASmartClient.Business/Plugin/OrderProxy.cs
  3. +2
    -2
      BPASmartClient.Business/Plugin/StatusMgr.cs
  4. +11
    -1
      BPASmartClient.Device/BaseDevice.cs
  5. +2
    -0
      BPASmartClient.Helper/ThreadManage.cs
  6. +0
    -1
      BPASmartClient.MorkF/Control_MorkF.cs

+ 1
- 1
BPASmartClient.Business/Plugin/MQTTMgr.cs View File

@@ -84,7 +84,7 @@ namespace BPASmartClient.Business
} }
Thread.Sleep(50); Thread.Sleep(50);
} }
}, "MQTT 消息处理");
}, "MQTT 消息处理", true);
} }


/// <summary> /// <summary>


+ 1
- 1
BPASmartClient.Business/Plugin/OrderProxy.cs View File

@@ -116,7 +116,7 @@ namespace BPASmartClient.Business
} }
Thread.Sleep(50); Thread.Sleep(50);
} }
}, $"MQTT 订单接收处理-设备[{deviceId}]");
}, $"MQTT 订单接收处理-设备[{deviceId}]", true);
} }


public void OrderStatusChangedHandle(IEvent @event, EventCallBackHandle callBack) public void OrderStatusChangedHandle(IEvent @event, EventCallBackHandle callBack)


+ 2
- 2
BPASmartClient.Business/Plugin/StatusMgr.cs View File

@@ -44,7 +44,7 @@ namespace BPASmartClient.Business
} }
Thread.Sleep(50); Thread.Sleep(50);
} }
}, "设备状态收集");
}, "设备状态收集", true);


deviceStatus.BatchingInfo = new List<BPA.Models.BatchingInfo>(); deviceStatus.BatchingInfo = new List<BPA.Models.BatchingInfo>();


@@ -63,7 +63,7 @@ namespace BPASmartClient.Business
} }
Thread.Sleep(1000); Thread.Sleep(1000);
} }
}, "设备心跳上报");
}, "设备心跳上报", true);
} }


public void Dispose() public void Dispose()


+ 11
- 1
BPASmartClient.Device/BaseDevice.cs View File

@@ -46,7 +46,17 @@ namespace BPASmartClient.Device
/// </summary> /// </summary>
public bool IsHealth { get; protected set; } public bool IsHealth { get; protected set; }


//外设状态
/// <summary>
/// 设备流程日志
/// </summary>
public ConcurrentQueue<string> Log { get; set; } = new ConcurrentQueue<string>();

/// <summary>
/// 错误报警集合
/// </summary>
protected ConcurrentDictionary<string, object> Error = new ConcurrentDictionary<string, object>();

//外设状态,硬件设备数据
protected ConcurrentDictionary<string, object> peripheralStatus = new ConcurrentDictionary<string, object>(); protected ConcurrentDictionary<string, object> peripheralStatus = new ConcurrentDictionary<string, object>();
private List<IPeripheral> peripherals; private List<IPeripheral> peripherals;




+ 2
- 0
BPASmartClient.Helper/ThreadManage.cs View File

@@ -44,6 +44,7 @@ namespace BPASmartClient.Helper
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
{ {
Thread.CurrentThread.Name = key;
ReStart: ReStart:
try try
{ {
@@ -89,6 +90,7 @@ namespace BPASmartClient.Helper
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource()); CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() => bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
{ {
Thread.CurrentThread.Name = key;
try try
{ {
if (action != null) action(); if (action != null) action();


+ 0
- 1
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -178,7 +178,6 @@ namespace BPASmartClient.MorkF
{ {
ThreadManage.GetInstance().StartLong(new Action(() => ThreadManage.GetInstance().StartLong(new Action(() =>
{ {

IsHealth = true; //心跳 IsHealth = true; //心跳
TakePlatelTask(); TakePlatelTask();
TakePotTask(); TakePotTask();


Loading…
Cancel
Save