ソースを参照

MorkF

样式分支
NXX 2年前
コミット
54daa91a4c
12個のファイルの変更128行の追加81行の削除
  1. +2
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  2. +57
    -0
      BPASmartClient.Business/LocalMqtt.cs
  3. +0
    -71
      BPASmartClient.Business/Plugin/LocalMqtt.cs
  4. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  5. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  6. +1
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  7. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  8. +14
    -0
      BPASmartClient.Model/GlobalFoodMenu.cs
  9. +47
    -1
      BPASmartClient.MorkBF/Control_MorkBF.cs
  10. +2
    -2
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  11. +1
    -1
      BPASmartClient.ViewModel/FoodMenuViewModel.cs
  12. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj

+ 2
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj ファイルの表示

@@ -8,7 +8,8 @@

<ItemGroup>
<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.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 57
- 0
BPASmartClient.Business/LocalMqtt.cs ファイルの表示

@@ -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));
}
}
}

+ 0
- 71
BPASmartClient.Business/Plugin/LocalMqtt.cs ファイルの表示

@@ -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);
}
}
}

+ 1
- 1
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj ファイルの表示

@@ -410,7 +410,7 @@

<ItemGroup>
<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="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj ファイルの表示

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.66" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj ファイルの表示

@@ -8,7 +8,7 @@
</PropertyGroup>

<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="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj ファイルの表示

@@ -17,7 +17,7 @@
</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" />
</ItemGroup>



+ 14
- 0
BPASmartClient.Model/GlobalFoodMenu.cs ファイルの表示

@@ -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>();
}
}

+ 47
- 1
BPASmartClient.MorkBF/Control_MorkBF.cs ファイルの表示

@@ -1,4 +1,6 @@
using BPA.Message.Enum;
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
@@ -27,6 +29,7 @@ namespace BPASmartClient.MorkBF
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
DeviceProcessLogShow("MORKF 设备初始化完成");
}

@@ -754,5 +757,48 @@ namespace BPASmartClient.MorkBF


#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);

}), "大屏数据上报");
}
}
}

+ 2
- 2
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj ファイルの表示

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
@@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.69" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.ViewModel/FoodMenuViewModel.cs ファイルの表示

@@ -13,7 +13,7 @@ namespace BPASmartClient.ViewModel
{
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; }



+ 1
- 1
DosingSystem/BPASmartClient.DosingSystem.csproj ファイルの表示

@@ -17,7 +17,7 @@

<ItemGroup>
<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" />
</ItemGroup>



読み込み中…
キャンセル
保存