25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 

398 satır
11 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 OperatingDeviceStatus operatingDeviceStatus { get; set; }
  17. /// <summary>
  18. /// 通知消息
  19. /// </summary>
  20. public InfoMessage infoMessage { get; set; }
  21. /// <summary>
  22. /// 折线图
  23. /// </summary>
  24. public object OrderLine { get; set; }
  25. /// <summary>
  26. /// 订单数据状态
  27. /// </summary>
  28. public object OrderDataState { get; set; }
  29. /// <summary>
  30. /// 区域销售
  31. /// </summary>
  32. public object LocSale { get; set; }
  33. /// <summary>
  34. /// 下单数量
  35. /// </summary>
  36. public OrderCount OrderNumber { get; set; }
  37. /// 返回JSON
  38. /// </summary>
  39. /// <returns></returns>
  40. public string ToJSON()
  41. {
  42. try
  43. {
  44. return Tools.JsonConvertTools(this);
  45. }
  46. catch (Exception ex)
  47. {
  48. return string.Empty;
  49. }
  50. }
  51. /// <summary>
  52. /// 序列化为对象
  53. /// </summary>
  54. /// <param name="JSON"></param>
  55. /// <returns></returns>
  56. public ScreenMonitorModel JSONtoDX(string JSON)
  57. {
  58. try
  59. {
  60. return Tools.JsonToObjectTools<ScreenMonitorModel>(JSON);
  61. }
  62. catch (Exception ex)
  63. {
  64. return new ScreenMonitorModel();
  65. }
  66. }
  67. }
  68. /// <summary>
  69. /// 下订单统计
  70. /// </summary>
  71. public class PlaceOrderCount
  72. {
  73. /// <summary>
  74. /// 今日下单量统计
  75. /// </summary>
  76. public string ToDayPlaceCount { get; set; }
  77. /// <summary>
  78. /// 本月下单量统计
  79. /// </summary>
  80. public string MonthPlaceCount { get; set; }
  81. /// <summary>
  82. /// 本年下单量统计
  83. /// </summary>
  84. public string YearPlaceCount { get; set; }
  85. }
  86. /// <summary>
  87. /// 制作流程
  88. /// </summary>
  89. public class ProcessMessage
  90. {
  91. public List<ProcessModel> data { get; set; }
  92. }
  93. /// <summary>
  94. /// 制作流程Model
  95. /// </summary>
  96. public class ProcessModel
  97. {
  98. /// <summary>
  99. /// 告警程度:提示 一般 严重
  100. /// </summary>
  101. private bool _IsMark { get; set; }
  102. public bool IsMark
  103. {
  104. get { return _IsMark; }
  105. set
  106. {
  107. _IsMark = value;
  108. if (_IsMark) ProcessColor = new ALYColor { r = 253, g = 234, b = 1, a = 1 };
  109. else ProcessColor = new ALYColor { r = 151, g = 150, b = 140, a = 1 };
  110. }
  111. }
  112. /// <summary>
  113. /// 流程名称
  114. /// </summary>
  115. public string ProcessName { get; set; }
  116. /// <summary>
  117. /// 流程描述
  118. /// </summary>
  119. public string ProcessMS { get; set; }
  120. /// <summary>
  121. /// 颜色
  122. /// </summary>
  123. public ALYColor ProcessColor { get; set; }
  124. public ProcessModel()
  125. {
  126. IsMark = false;
  127. ProcessMS = string.Empty;
  128. ProcessName = string.Empty;
  129. }
  130. }
  131. /// <summary>
  132. /// 通知消息
  133. /// </summary>
  134. public class InfoMessage
  135. {
  136. public List<DeviceBase> data { get; set; }
  137. }
  138. /// <summary>
  139. /// 运营设备及状态
  140. /// </summary>
  141. public class OperatingDeviceStatus
  142. {
  143. public List<DevStatus> data { get; set; }
  144. }
  145. /// <summary>
  146. /// 订单数量
  147. /// </summary>
  148. public class OrderCount
  149. {
  150. public int Year { get; set; }
  151. public int L_Year { get; set; }
  152. public int Month { get; set; }
  153. public int L_Month { get; set; }
  154. public int Day { get; set; }
  155. public int L_Day { get; set; }
  156. public string B_YearStr { get; set; }
  157. public ALYColor YearColor { get; set; }
  158. private int _B_Year { get; set; }
  159. public int B_Year
  160. {
  161. get { return _B_Year; }
  162. set
  163. {
  164. _B_Year = value;
  165. if (_B_Year > 0)
  166. {
  167. YearColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
  168. B_YearStr = $"增长 {_B_Year}%";
  169. }
  170. else
  171. {
  172. YearColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
  173. B_YearStr = $"下降 {_B_Year}%";
  174. }
  175. }
  176. }
  177. public string B_MonthStr { get; set; }
  178. public ALYColor MonthColor { get; set; }
  179. private int _B_Month { get; set; }
  180. public int B_Month
  181. {
  182. get { return _B_Month; }
  183. set
  184. {
  185. _B_Month = value;
  186. if (_B_Month > 0)
  187. {
  188. MonthColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
  189. B_MonthStr = $"增长 {_B_Month}%";
  190. }
  191. else
  192. {
  193. MonthColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
  194. B_MonthStr = $"下降 {_B_Month}%";
  195. }
  196. }
  197. }
  198. public string B_DayStr { get; set; }
  199. public ALYColor DayColor { get; set; }
  200. private int _B_Day { get; set; }
  201. public int B_Day
  202. {
  203. get { return _B_Day; }
  204. set
  205. {
  206. _B_Day = value;
  207. if (_B_Day > 0)
  208. {
  209. DayColor = new ALYColor { r = 18, g = 186, b = 96, a = 1 };
  210. B_DayStr = $"增长 {_B_Day}%";
  211. }
  212. else
  213. {
  214. DayColor = new ALYColor { r = 255, g = 0, b = 0, a = 1 };
  215. B_DayStr = $"下降 {_B_Day}%";
  216. }
  217. }
  218. }
  219. }
  220. /// <summary>
  221. /// 设备状态
  222. /// </summary>
  223. public class DevStatus : DeviceBase
  224. {
  225. /// <summary>
  226. /// 设备状态
  227. /// </summary>
  228. public string DeviceZT
  229. {
  230. get { return _DeviceZT; }
  231. set
  232. {
  233. _DeviceZT = value;
  234. if (_DeviceZT == "在线") DeviceColor = new ALYColor { r = 0, g = 255, b = 0, a = 1 };
  235. else DeviceColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
  236. }
  237. }
  238. private string _DeviceZT { get; set; }
  239. /// <summary>
  240. /// 设备状态异常
  241. /// </summary>
  242. public string DeviceStatus
  243. {
  244. get { return _DeviceStatus; }
  245. set
  246. {
  247. _DeviceStatus = value;
  248. }
  249. }
  250. private string _DeviceStatus { get; set; }
  251. /// <summary>
  252. /// 是否有告警
  253. /// </summary>
  254. public bool IsAlarm
  255. {
  256. get { return _IsAlarm; }
  257. set
  258. {
  259. _IsAlarm = value;
  260. if (_IsAlarm)
  261. {
  262. AlarmColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
  263. DeviceStatus = "异常";
  264. StatusColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
  265. }
  266. else
  267. {
  268. AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
  269. DeviceStatus = "正常";
  270. StatusColor = new ALYColor { r = 0, g = 255, b = 0, a = 1 };
  271. }
  272. }
  273. }
  274. private bool _IsAlarm { get; set; }
  275. /// <summary>
  276. /// 颜色
  277. /// </summary>
  278. public ALYColor DeviceColor { get; set; }
  279. /// <summary>
  280. /// 告警颜色
  281. /// </summary>
  282. public ALYColor AlarmColor { get; set; }
  283. /// <summary>
  284. /// 颜色
  285. /// </summary>
  286. public ALYColor StatusColor { get; set; }
  287. /// <summary>
  288. /// 初始化
  289. /// </summary>
  290. public DevStatus()
  291. {
  292. IsAlarm = false;
  293. AlarmColor = new ALYColor { r = 245, g = 13, b = 13, a = 0 };
  294. DeviceColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
  295. StatusColor = new ALYColor { r = 255, g = 55, b = 0, a = 1 };
  296. DeviceStatus = "正常";
  297. }
  298. /// <summary>
  299. /// 设置属性
  300. /// </summary>
  301. /// <param name="_deviceName"></param>
  302. /// <param name="_gmtCreate"></param>
  303. /// <param name="_DeviceMC"></param>
  304. /// <param name="_DeviceMS"></param>
  305. /// <param name="_DeviceSJ"></param>
  306. /// <param name="_DeviceZT"></param>
  307. public void SetTarget(string _deviceName, string _gmtCreate, string _DeviceMC, string _DeviceMS, string _DeviceSJ, string _DeviceZT)
  308. {
  309. deviceName = _deviceName;
  310. gmtCreate = _gmtCreate;
  311. DeviceMC = _DeviceMC;
  312. DeviceMS = _DeviceMS;
  313. DeviceSJ = _DeviceSJ;
  314. DeviceZT = _DeviceZT;
  315. }
  316. /// <summary>
  317. /// 状态
  318. /// </summary>
  319. /// <param name="_DeviceZT"></param>
  320. public void SetStatus(string _DeviceZT)
  321. {
  322. DeviceSJ = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  323. DeviceZT = _DeviceZT;
  324. }
  325. }
  326. /// <summary>
  327. /// 设备基本属性
  328. /// </summary>
  329. public class DeviceBase : DevBase
  330. {
  331. /// <summary>
  332. /// 设备名称
  333. /// </summary>
  334. public string DeviceMC { get; set; }
  335. /// <summary>
  336. /// 设备描述
  337. /// </summary>
  338. public string DeviceMS { get; set; }
  339. /// <summary>
  340. /// 设备时间
  341. /// </summary>
  342. public string DeviceSJ { get; set; }
  343. /// <summary>
  344. /// 设备状态:已处理 未处理
  345. /// </summary>
  346. public string DeviceZT { get; set; }
  347. }
  348. /// <summary>
  349. /// 设备基本信息
  350. /// </summary>
  351. public class DevBase
  352. {
  353. /// <summary>
  354. /// 唯一id
  355. /// </summary>
  356. public string id { get; set; }
  357. /// <summary>
  358. /// 设备key
  359. /// </summary>
  360. public string productKey { get; set; }
  361. /// <summary>
  362. /// 设备名称
  363. /// </summary>
  364. public string deviceName { get; set; }
  365. /// <summary>
  366. /// gmtCreate
  367. /// </summary>
  368. public string gmtCreate { get; set; }
  369. /// <summary>
  370. /// 客户端ID
  371. /// </summary>
  372. public string clientId { get; set; }
  373. /// <summary>
  374. /// 设备ID
  375. /// </summary>
  376. public string deviceId { get; set; }
  377. public DevBase()
  378. {
  379. id = Guid.NewGuid().ToString();
  380. }
  381. }
  382. }