终端一体化运控平台
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.
 
 
 

277 linhas
7.3 KiB

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