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

DataServer.cs 1.9 KiB

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