소스 검색

Revert "更新上下线转存"

This reverts commit 60172250ca.
master
fyf 2 년 전
부모
커밋
6dfe4decca
2개의 변경된 파일33개의 추가작업 그리고 71개의 파일을 삭제
  1. +1
    -1
      DataVAPI/Controllers/DeviceController.cs
  2. +32
    -70
      DataVAPI/UpAndDown/ProcessServer.cs

+ 1
- 1
DataVAPI/Controllers/DeviceController.cs 파일 보기

@@ -227,7 +227,7 @@ namespace DataVAPI.Controllers
st = System.Reflection.MethodBase.GetCurrentMethod().Name;
try
{
ProcessServer.Instance.LoadingShopInformationNew();
ProcessServer.Instance.LoadingShopInformation();
return JsonMsg<string>.OK("success!", st);
}
catch (Exception ex)


+ 32
- 70
DataVAPI/UpAndDown/ProcessServer.cs 파일 보기

@@ -58,7 +58,7 @@ namespace DataVAPI.UpAndDown
devModel.infoMessage = new InfoMessage(); devModel.infoMessage.data = new List<DeviceBase>();//通知消息

//加载店铺信息 //加载店铺信息
LoadingShopInformationNew();
LoadingShopInformation();
//MQTT 数据接收处理
ConsoleHelper.WriteInfoLine("尝试连接阿里云.");
//设置变量
@@ -163,29 +163,6 @@ namespace DataVAPI.UpAndDown
});
}

public void LoadingShopInformationNew()
{
devModel.operatingDeviceStatus.data.Clear();
var jsonMsg = deviceController.Query("", "", DateTime.MinValue, DateTime.MinValue);
jsonMsg.obj?.data?.ForEach(par =>
{
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}");
});
ConsoleHelper.WriteSuccessLine($"加载设备数[ {jsonMsg?.obj?.data?.Count} ]台...");
}

/// <summary>
/// 加载店铺信息
/// </summary>
@@ -284,53 +261,38 @@ namespace DataVAPI.UpAndDown
{
if (receiveModel?.deviceContext != null && receiveModel?.status != null)//状态变更消息
{
var k= devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName);
logController.Create(new LogTable
devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName)?.SetStatus(receiveModel.status.value);
//devModel?.infoMessage?.data?.Add(new DeviceBase { DeviceMC = receiveModel.deviceContext.deviceName, DeviceMS = $"设备{receiveModel.status.value}了!", DeviceSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

DevStatus dev = devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName);
if (dev == null) { LoadingShopInformation(); }
dev = devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName);
if (dev != null)
{
logController.Create(new LogTable
{
devicename = receiveModel.deviceContext.deviceName,
ClientId = dev.clientId,
DeviceId = dev.deviceId,
LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
LogType = "提示",
LogMessage = $"设备{receiveModel.status.value}了!",
LogVla = "通知"
});
OnOrOffline(receiveModel.status.value, devModel.operatingDeviceStatus.data, dev);
}
else
{
devicename = receiveModel.deviceContext.deviceName,
ClientId = k.clientId,
DeviceId = k.deviceId,
LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
LogType = "提示",
LogMessage = $"设备{receiveModel.status.value}了!",
LogVla = "通知"
});
LoadingShopInformation();
}
}
//if (receiveModel?.deviceContext != null && receiveModel?.status != null)//状态变更消息
//{
// devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName)?.SetStatus(receiveModel.status.value);
// //devModel?.infoMessage?.data?.Add(new DeviceBase { DeviceMC = receiveModel.deviceContext.deviceName, DeviceMS = $"设备{receiveModel.status.value}了!", DeviceSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

// DevStatus dev = devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName);
// if (dev == null) { LoadingShopInformation(); }
// dev = devModel?.operatingDeviceStatus.data?.Find(par => par.deviceName == receiveModel.deviceContext.deviceName);
// if (dev != null)
// {
// logController.Create(new LogTable
// {
// devicename = receiveModel.deviceContext.deviceName,
// ClientId = dev.clientId,
// DeviceId = dev.deviceId,
// LogTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
// LogType = "提示",
// LogMessage = $"设备{receiveModel.status.value}了!",
// LogVla = "通知"
// });
// OnOrOffline(receiveModel.status.value, devModel.operatingDeviceStatus.data, dev);
// }
// else
// {
// LoadingShopInformation();
// }
//}

//devModel.OrderLine = orderProvider.OrderLine(new DataVApi.Order.RequestModel.FullScreenBasic());
//devModel.OrderDataState = orderProvider.GetAllOrderDataState(new DataVApi.Order.RequestModel.FullScreenInput());
////devModel.LocSale = orderProvider.GetLocSale();
//object obj = orderProvider.OrderNumber(new DataVApi.Order.RequestModel.FullScreenBasic());
//devModel.OrderNumber = Tools.JsonToObjectTools<OrderCount>(Tools.JsonConvertTools(obj));
// ScreenMonitorModel screen1Monitor = Tools.JsonToObjectTools<ScreenMonitorModel>(devModel.ToJSON());
ScreenMonitorModel screen1Monitor = Tools.JsonToObjectTools<ScreenMonitorModel>(devModel.ToJSON());
#region 1.设置data默认值
//if (screen1Monitor.operatingDeviceStatus.data.Count == 0)
//{
@@ -342,12 +304,12 @@ namespace DataVAPI.UpAndDown
//}
#endregion

//string JSON = screen1Monitor.ToJSON();
//if (!string.IsNullOrEmpty(JSON))
//{
// //screenController.CreateOrUpdate(new LargeScreenTable() { json = JSON, devicename = "Transit", ClientId = "-10", DeviceId = "-10" });
// IOTDevServer.GetInstance().IOT_Publish(IOTDevServer.ScreenShowPubTopic, JSON);
//}
string JSON = screen1Monitor.ToJSON();
if (!string.IsNullOrEmpty(JSON))
{
//screenController.CreateOrUpdate(new LargeScreenTable() { json = JSON, devicename = "Transit", ClientId = "-10", DeviceId = "-10" });
IOTDevServer.GetInstance().IOT_Publish(IOTDevServer.ScreenShowPubTopic, JSON);
}

//if (devModel.infoMessage.data != null && devModel.infoMessage.data.Count > 0)
//{
@@ -456,7 +418,7 @@ namespace DataVAPI.UpAndDown
}
else if (message == "刷新店铺列表")
{
LoadingShopInformationNew();
LoadingShopInformation();
}
}
//else if (topic == IOTDevServer.TargetStatusSubTopic)//属性变更


불러오는 중...
취소
저장