终端一体化运控平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

276 linhas
7.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace DataVAPI.Tool.IOT
  7. {
  8. /// <summary>
  9. /// 大屏监视Model
  10. /// </summary>
  11. public class ScreenMonitorModel
  12. {
  13. /// <summary>
  14. /// 服务商家数
  15. /// </summary>
  16. public string TotalSales { get; set; }
  17. /// <summary>
  18. /// 现场运营设备状态
  19. /// </summary>
  20. public OperatingDeviceStatus operatingDeviceStatus { get; set; }
  21. /// <summary>
  22. /// 通知消息
  23. /// </summary>
  24. public InfoMessage infoMessage { get; set; }
  25. /// <summary>
  26. /// 返回JSON
  27. /// </summary>
  28. /// <returns></returns>
  29. public string ToJSON()
  30. {
  31. try
  32. {
  33. return Tools.JsonConvertTools(this);
  34. }
  35. catch (Exception ex)
  36. {
  37. return string.Empty;
  38. }
  39. }
  40. /// <summary>
  41. /// 序列化为对象
  42. /// </summary>
  43. /// <param name="JSON"></param>
  44. /// <returns></returns>
  45. public ScreenMonitorModel JSONtoDX(string JSON)
  46. {
  47. try
  48. {
  49. return Tools.JsonToObjectTools<ScreenMonitorModel>(JSON);
  50. }
  51. catch (Exception ex)
  52. {
  53. return new ScreenMonitorModel();
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// 下订单统计
  59. /// </summary>
  60. public class PlaceOrderCount
  61. {
  62. /// <summary>
  63. /// 今日下单量统计
  64. /// </summary>
  65. public string ToDayPlaceCount { get; set; }
  66. /// <summary>
  67. /// 本月下单量统计
  68. /// </summary>
  69. public string MonthPlaceCount { get; set; }
  70. /// <summary>
  71. /// 本年下单量统计
  72. /// </summary>
  73. public string YearPlaceCount { get; set; }
  74. }
  75. /// <summary>
  76. /// 制作流程
  77. /// </summary>
  78. public class ProcessMessage
  79. {
  80. public List<ProcessModel> data { get; set; }
  81. }
  82. /// <summary>
  83. /// 制作流程Model
  84. /// </summary>
  85. public class ProcessModel
  86. {
  87. /// <summary>
  88. /// 告警程度:提示 一般 严重
  89. /// </summary>
  90. private bool _IsMark { get; set; }
  91. public bool IsMark
  92. {
  93. get { return _IsMark; }
  94. set
  95. {
  96. _IsMark = value;
  97. if (_IsMark) ProcessColor = new ALYColor { r = 253, g = 234, b = 1, a = 1 };
  98. else ProcessColor = new ALYColor { r = 151, g = 150, b = 140, a = 1 };
  99. }
  100. }
  101. /// <summary>
  102. /// 流程名称
  103. /// </summary>
  104. public string ProcessName { get; set; }
  105. /// <summary>
  106. /// 流程描述
  107. /// </summary>
  108. public string ProcessMS { get; set; }
  109. /// <summary>
  110. /// 颜色
  111. /// </summary>
  112. public ALYColor ProcessColor { get; set; }
  113. public ProcessModel()
  114. {
  115. IsMark = false;
  116. ProcessMS = string.Empty;
  117. ProcessName = string.Empty;
  118. }
  119. }
  120. /// <summary>
  121. /// 通知消息
  122. /// </summary>
  123. public class InfoMessage
  124. {
  125. public List<DeviceBase> data { get; set; }
  126. }
  127. /// <summary>
  128. /// 运营设备及状态
  129. /// </summary>
  130. public class OperatingDeviceStatus
  131. {
  132. public List<DevStatus> data { get; set; }
  133. }
  134. /// <summary>
  135. /// 设备状态
  136. /// </summary>
  137. public class DevStatus : DeviceBase
  138. {
  139. /// <summary>
  140. /// 设备状态
  141. /// </summary>
  142. public string DeviceZT
  143. {
  144. get { return _DeviceZT; }
  145. set
  146. {
  147. _DeviceZT = value;
  148. if (_DeviceZT == "在线") DeviceColor = new ALYColor { r = 13, g = 254, b = 73, a = 1 };
  149. else DeviceColor = new ALYColor { r = 249, g = 191, b = 0, a = 1 };
  150. }
  151. }
  152. private string _DeviceZT { get; set; }
  153. /// <summary>
  154. /// 是否有告警
  155. /// </summary>
  156. public bool IsAlarm
  157. {
  158. get { return _IsAlarm; }
  159. set
  160. {
  161. _IsAlarm = value;
  162. if (_IsAlarm) AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 1 };
  163. else AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
  164. }
  165. }
  166. private bool _IsAlarm { get; set; }
  167. /// <summary>
  168. /// 颜色
  169. /// </summary>
  170. public ALYColor DeviceColor { get; set; }
  171. /// <summary>
  172. /// 告警颜色
  173. /// </summary>
  174. public ALYColor AlarmColor { get; set; }
  175. /// <summary>
  176. /// 初始化
  177. /// </summary>
  178. public DevStatus()
  179. {
  180. IsAlarm = false;
  181. AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
  182. DeviceColor = new ALYColor { r = 249, g = 191, b = 0, a = 1 };
  183. }
  184. /// <summary>
  185. /// 设置属性
  186. /// </summary>
  187. /// <param name="_deviceName"></param>
  188. /// <param name="_gmtCreate"></param>
  189. /// <param name="_DeviceMC"></param>
  190. /// <param name="_DeviceMS"></param>
  191. /// <param name="_DeviceSJ"></param>
  192. /// <param name="_DeviceZT"></param>
  193. public void SetTarget(string _deviceName, string _gmtCreate, string _DeviceMC, string _DeviceMS, string _DeviceSJ, string _DeviceZT)
  194. {
  195. deviceName = _deviceName;
  196. gmtCreate = _gmtCreate;
  197. DeviceMC = _DeviceMC;
  198. DeviceMS = _DeviceMS;
  199. DeviceSJ = _DeviceSJ;
  200. DeviceZT = _DeviceZT;
  201. }
  202. /// <summary>
  203. /// 状态
  204. /// </summary>
  205. /// <param name="_DeviceZT"></param>
  206. public void SetStatus(string _DeviceZT)
  207. {
  208. DeviceSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  209. DeviceZT = _DeviceZT;
  210. }
  211. }
  212. /// <summary>
  213. /// 设备基本属性
  214. /// </summary>
  215. public class DeviceBase : DevBase
  216. {
  217. /// <summary>
  218. /// 设备名称
  219. /// </summary>
  220. public string DeviceMC { get; set; }
  221. /// <summary>
  222. /// 设备描述
  223. /// </summary>
  224. public string DeviceMS { get; set; }
  225. /// <summary>
  226. /// 设备时间
  227. /// </summary>
  228. public string DeviceSJ { get; set; }
  229. /// <summary>
  230. /// 设备状态:已处理 未处理
  231. /// </summary>
  232. public string DeviceZT { get; set; }
  233. }
  234. /// <summary>
  235. /// 设备基本信息
  236. /// </summary>
  237. public class DevBase
  238. {
  239. /// <summary>
  240. /// 唯一id
  241. /// </summary>
  242. public string id { get; set; }
  243. /// <summary>
  244. /// 设备key
  245. /// </summary>
  246. public string productKey { get; set; }
  247. /// <summary>
  248. /// 设备名称
  249. /// </summary>
  250. public string deviceName { get; set; }
  251. /// <summary>
  252. /// gmtCreate
  253. /// </summary>
  254. public string gmtCreate { get; set; }
  255. /// <summary>
  256. /// 客户端ID
  257. /// </summary>
  258. public string clientId { get; set; }
  259. public DevBase()
  260. {
  261. id = Guid.NewGuid().ToString();
  262. }
  263. }
  264. }