终端一体化运控平台
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 

61 wiersze
2.3 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using BPA.Helper;
  8. using BPA.Message;
  9. using BPASmartClient.Model;
  10. using BPA.Communication;
  11. namespace BPASmartClient.MorkS
  12. {
  13. public class DataServer
  14. {
  15. private volatile static DataServer _Instance;
  16. public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
  17. private DataServer() { }
  18. public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();
  19. MqttHelper mQTTProxy = new MqttHelper();
  20. public void Init()
  21. {
  22. mQTTProxy.Connected = new Action(() =>
  23. {
  24. mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
  25. TaskManage.GetInstance.StartLong(new Action(() =>
  26. {
  27. morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count;
  28. SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
  29. sendScreenDataModel.Name = ScreenDeviceType.煮面机;
  30. sendScreenDataModel.Value = morkS.ToJSON();
  31. mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
  32. Thread.Sleep(100);
  33. }), "海科食堂大屏监听");
  34. });
  35. //mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
  36. mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
  37. {
  38. UserName = "UserName",
  39. Password = "Password",
  40. IpAddress = "Host",
  41. Port = 1883,
  42. ClientId = $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
  43. });
  44. }
  45. //订单信息(正在制作,等待制作,制作完成)
  46. //煮面炉上下状态(6个煮面炉上或下)
  47. //温度状态(煮面炉温度是否到达)
  48. //料仓位置(当前料仓在几号位置)
  49. //料仓上下物料检测
  50. //落碗机构缺碗检测
  51. //机器人状态
  52. //当日订单总量
  53. //报警信息
  54. }
  55. }