|
|
@@ -42,20 +42,20 @@ namespace BPASmartClient.Business |
|
|
|
{ |
|
|
|
while (running) |
|
|
|
{ |
|
|
|
while (orders.Count > 0 && orders.TryDequeue(out MorkOrderPush temp)) |
|
|
|
while (orders.Count > 0) |
|
|
|
{ |
|
|
|
var temp = orders.ElementAt(0); |
|
|
|
var device = deviceMgr.GetDevices().FirstOrDefault(p => p.DeviceId == temp.DeviceId); |
|
|
|
if (null != device) |
|
|
|
{ |
|
|
|
if (!device.IsBusy && device.IsHealth) |
|
|
|
{ |
|
|
|
var orderEvent = DoOrderEvent.Make(temp); |
|
|
|
orderEvent.Id = device.DeviceId; |
|
|
|
orderEvent.Publish(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
if (orders.TryDequeue(out temp)) |
|
|
|
{ |
|
|
|
var orderEvent = DoOrderEvent.Make(temp); |
|
|
|
orderEvent.Id = device.DeviceId; |
|
|
|
orderEvent.Publish(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|