终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 line
1.9 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 BPASmartClient.MQTT;
  9. using BPA.Message;
  10. using BPASmartClient.Model;
  11. namespace BPASmartClient.MorkS3
  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. MQTTProxy mQTTProxy = new MQTTProxy();
  20. public void Init()
  21. {
  22. mQTTProxy.Connected = new Action(() =>
  23. {
  24. mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
  25. ThreadManage.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. }
  37. //订单信息(正在制作,等待制作,制作完成)
  38. //煮面炉上下状态(6个煮面炉上或下)
  39. //温度状态(煮面炉温度是否到达)
  40. //料仓位置(当前料仓在几号位置)
  41. //料仓上下物料检测
  42. //落碗机构缺碗检测
  43. //机器人状态
  44. //当日订单总量
  45. //报警信息
  46. }
  47. }