@@ -8,7 +8,8 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | <PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | ||||
<PackageReference Include="BPA.Message" Version="1.0.69" /> | |||||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | <PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> | ||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" /> | <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" /> | ||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | <PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" /> | ||||
@@ -0,0 +1,57 @@ | |||||
using BPA.Message; | |||||
using BPASmartClient.MQTT; | |||||
using Newtonsoft.Json; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Business | |||||
{ | |||||
public class LocalMqtt | |||||
{ | |||||
private volatile static LocalMqtt _Instance; | |||||
public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt()); | |||||
private LocalMqtt() { } | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
SendScreenDataModel MqttPushs = new SendScreenDataModel(); | |||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
ScreenDeviceType LocDeviceType; | |||||
public void Init(ScreenDeviceType DeviceType) | |||||
{ | |||||
MqttPushs.Name = DeviceType; | |||||
LocDeviceType = DeviceType; | |||||
mQTTProxy.Connected = new Action(() => | |||||
{ | |||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ; | |||||
}); | |||||
mQTTProxy.Connect("admin", "public", "10.2.1.254", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | |||||
} | |||||
public void Start() | |||||
{ | |||||
} | |||||
/// <summary> | |||||
/// MQTT消息推送 | |||||
/// </summary> | |||||
/// <param name="topic">主题</param> | |||||
/// <param name="message">消息体</param> | |||||
public void Publish(object message) | |||||
{ | |||||
MqttPushs.Value = message; | |||||
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(LocDeviceType), JsonConvert.SerializeObject(MqttPushs)); | |||||
} | |||||
} | |||||
} |
@@ -1,71 +0,0 @@ | |||||
using BPA.Message; | |||||
using BPASmartClient.MQTT; | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Business.Plugin | |||||
{ | |||||
public class LocalMqtt | |||||
{ | |||||
private volatile static LocalMqtt _Instance; | |||||
public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt()); | |||||
private LocalMqtt() { } | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
SendScreenDataModel MqttPushs = new SendScreenDataModel(); | |||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
public void Init(ScreenDeviceType DeviceType) | |||||
{ | |||||
Dictionary<string, string> MqttPushdata = new Dictionary<string, string>(); | |||||
MqttPushs.mqttDataDic.Add(DeviceType.ToString(), SetTopic(DeviceType, MqttPushdata)); | |||||
mQTTProxy.Connected = new Action(() => | |||||
{ | |||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ; | |||||
}); | |||||
mQTTProxy.Connect("UserName", "Password", "Host", 1880, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"); | |||||
} | |||||
public void Start() | |||||
{ | |||||
} | |||||
private Dictionary<string, string> SetTopic(ScreenDeviceType DeviceType, Dictionary<string, string> MqttPushdata ) | |||||
{ | |||||
switch (DeviceType) | |||||
{ | |||||
case ScreenDeviceType.大炒: | |||||
break; | |||||
case ScreenDeviceType.小炒: | |||||
break; | |||||
case ScreenDeviceType.分餐机: | |||||
break; | |||||
case ScreenDeviceType.煮面机: | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
return MqttPushdata; | |||||
} | |||||
/// <summary> | |||||
/// MQTT消息推送 | |||||
/// </summary> | |||||
/// <param name="topic">主题</param> | |||||
/// <param name="message">消息体</param> | |||||
public void Publish(string topic, string message) | |||||
{ | |||||
mqttProxy.Publish(topic, message); | |||||
} | |||||
} | |||||
} |
@@ -410,7 +410,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | <PackageReference Include="BPA.Helper" Version="1.0.28" /> | ||||
<PackageReference Include="BPA.Message" Version="1.0.66" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" /> | <PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" /> | ||||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | <PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -7,7 +7,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Message" Version="1.0.66" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -8,7 +8,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Message" Version="1.0.66" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | <PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | ||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -17,7 +17,7 @@ | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Message" Version="1.0.66" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | <PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -0,0 +1,14 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
using System.Collections.ObjectModel; | |||||
using System.Linq; | |||||
using System.Text; | |||||
using System.Threading.Tasks; | |||||
namespace BPASmartClient.Model | |||||
{ | |||||
public class GlobalFoodMenu | |||||
{ | |||||
public static ObservableCollection<FoodMenuModel> LocalFoodMenus = new ObservableCollection<FoodMenuModel>(); | |||||
} | |||||
} |
@@ -1,4 +1,6 @@ | |||||
using BPA.Message.Enum; | |||||
using BPA.Message; | |||||
using BPA.Message.Enum; | |||||
using BPASmartClient.Business; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPASmartClient.EventBus; | using BPASmartClient.EventBus; | ||||
using BPASmartClient.Helper; | using BPASmartClient.Helper; | ||||
@@ -27,6 +29,7 @@ namespace BPASmartClient.MorkBF | |||||
CommandRegist();//调试 | CommandRegist();//调试 | ||||
ServerInit(); | ServerInit(); | ||||
DataParse();//数据解析 | DataParse();//数据解析 | ||||
ScreenDataServer();//大屏数据上报 | |||||
DeviceProcessLogShow("MORKF 设备初始化完成"); | DeviceProcessLogShow("MORKF 设备初始化完成"); | ||||
} | } | ||||
@@ -754,5 +757,48 @@ namespace BPASmartClient.MorkBF | |||||
#endregion | #endregion | ||||
private void ScreenDataServer() | |||||
{ | |||||
LocalMqtt.GetInstance.Init(ScreenDeviceType.大炒); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | |||||
{ | |||||
List<StatsModel> statsModels = new List<StatsModel>(); | |||||
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 }); | |||||
ScreenModelMaxWok maxWok = new ScreenModelMaxWok | |||||
{ | |||||
IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止, | |||||
WorkStatus_1 = (WorkStatus)new Random().Next(0, 3), | |||||
WorkStatus_2 = (WorkStatus)new Random().Next(0, 3), | |||||
RobotStatu = (WorkStatus)new Random().Next(0, 3), | |||||
Alarm = new List<AlarmModel>(), | |||||
FailuresCount = 0, | |||||
StatsCount = statsModels, | |||||
MaxWok_Dishes_1 = "满汉全席", | |||||
MaxWok_Dishes_2 = "海鲜大餐", | |||||
MaxWok_Task_1 = "炒制菜品", | |||||
MaxWok_Task_2 = "热油", | |||||
MaxWok_Process_1 = new List<ProcessModel>(), | |||||
MaxWok_HeatGear_1 = new Random().Next(0, 5).ToString(), | |||||
MaxWok_HeatGear_2 = new Random().Next(0, 5).ToString(), | |||||
MaxWok_StirGear_1 = new Random().Next(0, 5).ToString(), | |||||
MaxWok_StirGear_2 = new Random().Next(0, 5).ToString(), | |||||
MaxWok_FlipSpeed_1 = new Random().Next(250, 450).ToString(), | |||||
MaxWok_FlipSpeed_2 = new Random().Next(250, 450).ToString(), | |||||
MaxWok_Temp_1 = new Random().Next(250, 450).ToString(), | |||||
MaxWok_Temp_2 = new Random().Next(250, 450).ToString(), | |||||
MaxWok_OrderCount_1 = 2, | |||||
MaxWok_OrderCount_2 = 2, | |||||
MaxWok_ErrorOrderCount_1 = 0, | |||||
MaxWok_ErrorOrderCount_2 = 0, | |||||
}; | |||||
LocalMqtt.GetInstance.Publish(maxWok); | |||||
Thread.Sleep(1000); | |||||
}), "大屏数据上报"); | |||||
} | |||||
} | } | ||||
} | } |
@@ -1,4 +1,4 @@ | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<Project Sdk="Microsoft.NET.Sdk"> | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<TargetFramework>net6.0-windows</TargetFramework> | <TargetFramework>net6.0-windows</TargetFramework> | ||||
@@ -10,7 +10,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Message" Version="1.0.69" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
</ItemGroup> | </ItemGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
@@ -13,7 +13,7 @@ namespace BPASmartClient.ViewModel | |||||
{ | { | ||||
public class FoodMenuViewModel: ObservableObject | public class FoodMenuViewModel: ObservableObject | ||||
{ | { | ||||
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = new ObservableCollection<FoodMenuModel>(); | |||||
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = GlobalFoodMenu.LocalFoodMenus; | |||||
public RelayCommand<object> StartOrder { get; set; } | public RelayCommand<object> StartOrder { get; set; } | ||||
@@ -17,7 +17,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.Helper" Version="1.0.28" /> | <PackageReference Include="BPA.Helper" Version="1.0.28" /> | ||||
<PackageReference Include="BPA.Message" Version="1.0.66" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.74" /> | |||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||||
</ItemGroup> | </ItemGroup> | ||||