|
@@ -26,6 +26,7 @@ namespace DataVAPI.UpAndDown |
|
|
public ScreenController screenController { get; set; } |
|
|
public ScreenController screenController { get; set; } |
|
|
public AlarmController alarmController { get; set; } |
|
|
public AlarmController alarmController { get; set; } |
|
|
public OrderProvider orderProvider { get; set; } |
|
|
public OrderProvider orderProvider { get; set; } |
|
|
|
|
|
public List<DevStatus> devStatuses { get; set; }=new List<DevStatus>(); |
|
|
#region 不需要监听 |
|
|
#region 不需要监听 |
|
|
private static ProcessServer _instance; |
|
|
private static ProcessServer _instance; |
|
|
public static ProcessServer Instance |
|
|
public static ProcessServer Instance |
|
@@ -173,41 +174,60 @@ namespace DataVAPI.UpAndDown |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
devStatuses = devModel.operatingDeviceStatus.data; |
|
|
ConsoleHelper.WriteSuccessLine("加载店铺集合中."); |
|
|
ConsoleHelper.WriteSuccessLine("加载店铺集合中."); |
|
|
JsonMsg<List<DeviceTable>> jsonMsg = deviceController.Query("", "", DateTime.MinValue, DateTime.MinValue); |
|
|
JsonMsg<List<DeviceTable>> jsonMsg = deviceController.Query("", "", DateTime.MinValue, DateTime.MinValue); |
|
|
jsonMsg?.obj?.data?.ForEach(par => |
|
|
|
|
|
|
|
|
if (jsonMsg?.obj?.data.Count > 0) |
|
|
{ |
|
|
{ |
|
|
int chid = 0; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
chid = int.Parse(par.ClientId); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
chid = 0; |
|
|
|
|
|
} |
|
|
|
|
|
if (chid > 0) |
|
|
|
|
|
|
|
|
if (devStatuses.Count != devModel.operatingDeviceStatus.data.Count) |
|
|
{ |
|
|
{ |
|
|
DevStatus devStatus = new DevStatus() |
|
|
|
|
|
{ |
|
|
|
|
|
deviceName = par.devicename, |
|
|
|
|
|
gmtCreate = par.devicesecret, |
|
|
|
|
|
productKey = par.productkey, |
|
|
|
|
|
DeviceMC = par.devtype, |
|
|
|
|
|
DeviceMS = par.remark, |
|
|
|
|
|
DeviceSJ = par.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
|
|
DeviceZT = "离线", |
|
|
|
|
|
clientId = par.ClientId, |
|
|
|
|
|
deviceId = par.DeviceId |
|
|
|
|
|
}; |
|
|
|
|
|
if (devModel.operatingDeviceStatus.data.Find(o => o.gmtCreate == par.devicesecret) == null) |
|
|
|
|
|
|
|
|
devModel.operatingDeviceStatus.data.Clear(); |
|
|
|
|
|
jsonMsg?.obj?.data?.ForEach(par => |
|
|
{ |
|
|
{ |
|
|
ConsoleHelper.WriteSuccessLine($"加载设备.{par.devtype} {par.remark}"); |
|
|
|
|
|
devModel.operatingDeviceStatus.data.Insert(0, devStatus); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int chid = 0; |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
chid = int.Parse(par.ClientId); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
chid = 0; |
|
|
|
|
|
} |
|
|
|
|
|
if (chid > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
DevStatus devStatus = new DevStatus() |
|
|
|
|
|
{ |
|
|
|
|
|
deviceName = par.devicename, |
|
|
|
|
|
gmtCreate = par.devicesecret, |
|
|
|
|
|
productKey = par.productkey, |
|
|
|
|
|
DeviceMC = par.devtype, |
|
|
|
|
|
DeviceMS = par.remark, |
|
|
|
|
|
DeviceSJ = par.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
|
|
DeviceZT = "离线", |
|
|
|
|
|
clientId = par.ClientId, |
|
|
|
|
|
deviceId = par.DeviceId |
|
|
|
|
|
}; |
|
|
|
|
|
ConsoleHelper.WriteSuccessLine($"加载设备.{par.devtype} {par.remark}"); |
|
|
|
|
|
devModel.operatingDeviceStatus.data.Insert(0, devStatus); |
|
|
|
|
|
|
|
|
|
|
|
DevStatus dev= devStatuses?.Find(k => k.deviceName == par.devicename); |
|
|
|
|
|
|
|
|
|
|
|
if (dev != null && dev.DeviceZT == "在线") |
|
|
|
|
|
{ |
|
|
|
|
|
OnOrOffline(dev.DeviceZT, devModel.operatingDeviceStatus.data, devStatus); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
ConsoleHelper.WriteSuccessLine($"加载设备数[ {jsonMsg?.obj?.data?.Count} ]台..."); |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
ConsoleHelper.WriteSuccessLine($"加载设备数[ {jsonMsg?.obj?.data?.Count} ]台..."); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
ConsoleHelper.WriteSuccessLine("查询店铺集合为空."); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
|