|
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace DataVAPI.Tool.IOT
- {
-
- /// <summary>
- /// 大屏监视Model
- /// </summary>
- public class ScreenMonitorModel
- {
- /// <summary>
- /// 现场运营设备状态
- /// </summary>
- public OperatingDeviceStatus operatingDeviceStatus { get; set; }
- /// <summary>
- /// 通知消息
- /// </summary>
- public InfoMessage infoMessage { get; set; }
- /// <summary>
- /// 折线图
- /// </summary>
- public object OrderLine { get; set; }
- /// <summary>
- /// 订单数据状态
- /// </summary>
- public object OrderDataState { get; set; }
- /// <summary>
- /// 区域销售
- /// </summary>
- public object LocSale { get; set; }
- /// <summary>
- /// 下单数量
- /// </summary>
- public OrderCount OrderNumber { get; set; }
- /// 返回JSON
- /// </summary>
- /// <returns></returns>
- public string ToJSON()
- {
- try
- {
- return Tools.JsonConvertTools(this);
- }
- catch (Exception ex)
- {
- return string.Empty;
- }
- }
- /// <summary>
- /// 序列化为对象
- /// </summary>
- /// <param name="JSON"></param>
- /// <returns></returns>
- public ScreenMonitorModel JSONtoDX(string JSON)
- {
- try
- {
- return Tools.JsonToObjectTools<ScreenMonitorModel>(JSON);
- }
- catch (Exception ex)
- {
- return new ScreenMonitorModel();
- }
- }
- }
- /// <summary>
- /// 下订单统计
- /// </summary>
- public class PlaceOrderCount
- {
- /// <summary>
- /// 今日下单量统计
- /// </summary>
- public string ToDayPlaceCount { get; set; }
- /// <summary>
- /// 本月下单量统计
- /// </summary>
- public string MonthPlaceCount { get; set; }
- /// <summary>
- /// 本年下单量统计
- /// </summary>
- public string YearPlaceCount { get; set; }
-
- }
- /// <summary>
- /// 制作流程
- /// </summary>
- public class ProcessMessage
- {
- public List<ProcessModel> data { get; set; }
- }
- /// <summary>
- /// 制作流程Model
- /// </summary>
- public class ProcessModel
- {
- /// <summary>
- /// 告警程度:提示 一般 严重
- /// </summary>
- private bool _IsMark { get; set; }
- public bool IsMark
- {
- get { return _IsMark; }
- set
- {
- _IsMark = value;
- if (_IsMark) ProcessColor = new ALYColor { r = 253, g = 234, b = 1, a = 1 };
- else ProcessColor = new ALYColor { r = 151, g = 150, b = 140, a = 1 };
- }
- }
- /// <summary>
- /// 流程名称
- /// </summary>
- public string ProcessName { get; set; }
- /// <summary>
- /// 流程描述
- /// </summary>
- public string ProcessMS { get; set; }
- /// <summary>
- /// 颜色
- /// </summary>
- public ALYColor ProcessColor { get; set; }
- public ProcessModel()
- {
- IsMark = false;
- ProcessMS = string.Empty;
- ProcessName = string.Empty;
- }
-
- }
-
- /// <summary>
- /// 通知消息
- /// </summary>
- public class InfoMessage
- {
- public List<DeviceBase> data { get; set; }
-
- }
- /// <summary>
- /// 运营设备及状态
- /// </summary>
- public class OperatingDeviceStatus
- {
- public List<DevStatus> data { get; set; }
- }
- /// <summary>
- /// 订单数量
- /// </summary>
- public class OrderCount
- {
- public int Year { get; set; }
- public int L_Year { get; set; }
- public int Month { get; set; }
- public int L_Month { get; set; }
- public int Day { get; set; }
- public int L_Day { get; set; }
-
- public string B_YearStr { get; set; }
- public ALYColor YearColor { get; set; }
- private int _B_Year { get; set; }
- public int B_Year
- {
- get { return _B_Year; }
- set
- {
- _B_Year = value;
- if (_B_Year > 0)
- {
- YearColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
- B_YearStr = $"增长 {_B_Year}%";
- }
- else
- {
- YearColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
- B_YearStr = $"下降 {_B_Year}%";
- }
- }
- }
-
- public string B_MonthStr { get; set; }
- public ALYColor MonthColor { get; set; }
- private int _B_Month { get; set; }
- public int B_Month
- {
- get { return _B_Month; }
- set
- {
- _B_Month = value;
- if (_B_Month > 0)
- {
- MonthColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
- B_MonthStr = $"增长 {_B_Month}%";
- }
- else
- {
- MonthColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
- B_MonthStr = $"下降 {_B_Month}%";
- }
- }
- }
-
- public string B_DayStr { get; set; }
- public ALYColor DayColor { get; set; }
- private int _B_Day { get; set; }
- public int B_Day
- {
- get { return _B_Day; }
- set
- {
- _B_Day = value;
- if (_B_Day > 0)
- {
- DayColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
- B_DayStr = $"增长 {_B_Day}%";
- }
- else
- {
- DayColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
- B_DayStr = $"下降 {_B_Day}%";
- }
- }
- }
- }
- /// <summary>
- /// 设备状态
- /// </summary>
- public class DevStatus : DeviceBase
- {
- /// <summary>
- /// 设备状态
- /// </summary>
- public string DeviceZT
- {
- get { return _DeviceZT; }
- set
- {
- _DeviceZT = value;
- if (_DeviceZT == "在线") DeviceColor = new ALYColor { r = 0, g = 255, b = 0, a = 1 };
- else DeviceColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
- }
- }
- private string _DeviceZT { get; set; }
- /// <summary>
- /// 设备状态异常
- /// </summary>
- public string DeviceStatus
- {
- get { return _DeviceStatus; }
- set
- {
- _DeviceStatus = value;
- }
- }
- private string _DeviceStatus { get; set; }
- /// <summary>
- /// 是否有告警
- /// </summary>
- public bool IsAlarm
- {
- get { return _IsAlarm; }
- set
- {
- _IsAlarm = value;
- if (_IsAlarm)
- {
- AlarmColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
- DeviceStatus = "异常";
- StatusColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
- }
- else
- {
- AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
- DeviceStatus = "正常";
- StatusColor = new ALYColor { r = 0, g = 255, b = 0, a = 1 };
- }
- }
- }
- private bool _IsAlarm { get; set; }
-
- /// <summary>
- /// 颜色
- /// </summary>
- public ALYColor DeviceColor { get; set; }
- /// <summary>
- /// 告警颜色
- /// </summary>
- public ALYColor AlarmColor { get; set; }
- /// <summary>
- /// 颜色
- /// </summary>
- public ALYColor StatusColor { get; set; }
- /// <summary>
- /// 初始化
- /// </summary>
- public DevStatus()
- {
- IsAlarm = false;
- AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
- DeviceColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
- StatusColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
-
- DeviceStatus = "正常";
- }
- /// <summary>
- /// 设置属性
- /// </summary>
- /// <param name="_deviceName"></param>
- /// <param name="_gmtCreate"></param>
- /// <param name="_DeviceMC"></param>
- /// <param name="_DeviceMS"></param>
- /// <param name="_DeviceSJ"></param>
- /// <param name="_DeviceZT"></param>
- public void SetTarget(string _deviceName, string _gmtCreate, string _DeviceMC, string _DeviceMS, string _DeviceSJ, string _DeviceZT)
- {
- deviceName = _deviceName;
- gmtCreate = _gmtCreate;
- DeviceMC = _DeviceMC;
- DeviceMS = _DeviceMS;
- DeviceSJ = _DeviceSJ;
- DeviceZT = _DeviceZT;
- }
- /// <summary>
- /// 状态
- /// </summary>
- /// <param name="_DeviceZT"></param>
- public void SetStatus(string _DeviceZT)
- {
- DeviceSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- DeviceZT = _DeviceZT;
- }
- }
- /// <summary>
- /// 设备基本属性
- /// </summary>
- public class DeviceBase : DevBase
- {
- /// <summary>
- /// 设备名称
- /// </summary>
- public string DeviceMC { get; set; }
- /// <summary>
- /// 设备描述
- /// </summary>
- public string DeviceMS { get; set; }
- /// <summary>
- /// 设备时间
- /// </summary>
- public string DeviceSJ { get; set; }
- /// <summary>
- /// 设备状态:已处理 未处理
- /// </summary>
- public string DeviceZT { get; set; }
- }
- /// <summary>
- /// 设备基本信息
- /// </summary>
- public class DevBase
- {
- /// <summary>
- /// 唯一id
- /// </summary>
- public string id { get; set; }
- /// <summary>
- /// 设备key
- /// </summary>
- public string productKey { get; set; }
- /// <summary>
- /// 设备名称
- /// </summary>
- public string deviceName { get; set; }
- /// <summary>
- /// gmtCreate
- /// </summary>
- public string gmtCreate { get; set; }
- /// <summary>
- /// 客户端ID
- /// </summary>
- public string clientId { get; set; }
- /// <summary>
- /// 设备ID
- /// </summary>
- public string deviceId { get; set; }
-
- public DevBase()
- {
- id = Guid.NewGuid().ToString();
- }
- }
-
-
-
- }
|