终端一体化运控平台
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

60 строки
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.Message;
  8. using BPASmartClient.Model;
  9. using BPA.Communication;
  10. namespace BPASmartClient.MorkSUpgradedVer
  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. MqttHelper mQTTProxy = new MqttHelper();
  19. public void Init()
  20. {
  21. mQTTProxy.Connected = new Action(() =>
  22. {
  23. mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
  24. TaskManage.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. mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
  36. {
  37. UserName = "UserName",
  38. Password = "Password",
  39. IpAddress = "Host",
  40. Port = 1883,
  41. ClientId = $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
  42. });
  43. }
  44. //订单信息(正在制作,等待制作,制作完成)
  45. //煮面炉上下状态(6个煮面炉上或下)
  46. //温度状态(煮面炉温度是否到达)
  47. //料仓位置(当前料仓在几号位置)
  48. //料仓上下物料检测
  49. //落碗机构缺碗检测
  50. //机器人状态
  51. //当日订单总量
  52. //报警信息
  53. }
  54. }