Browse Source

ere

master
fyf 2 years ago
parent
commit
eaf46c8351
1 changed files with 49 additions and 29 deletions
  1. +49
    -29
      DataVAPI/UpAndDown/ProcessServer.cs

+ 49
- 29
DataVAPI/UpAndDown/ProcessServer.cs View File

@@ -26,6 +26,7 @@ namespace DataVAPI.UpAndDown
public ScreenController screenController { get; set; }
public AlarmController alarmController { get; set; }
public OrderProvider orderProvider { get; set; }
public List<DevStatus> devStatuses { get; set; }=new List<DevStatus>();
#region 不需要监听
private static ProcessServer _instance;
public static ProcessServer Instance
@@ -173,41 +174,60 @@ namespace DataVAPI.UpAndDown
{
try
{
devStatuses = devModel.operatingDeviceStatus.data;
ConsoleHelper.WriteSuccessLine("加载店铺集合中.");
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)
{


Loading…
Cancel
Save