@@ -8,6 +8,7 @@ | |||||
<ItemGroup> | <ItemGroup> | ||||
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | <PackageReference Include="BPA.ApolloClient" Version="1.0.12" /> | ||||
<PackageReference Include="BPA.Communication" Version="1.0.106" /> | |||||
<PackageReference Include="BPA.Message" Version="1.0.86" /> | <PackageReference Include="BPA.Message" Version="1.0.86" /> | ||||
<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" /> | ||||
@@ -8,7 +8,7 @@ using System.IO; | |||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
using System.Threading; | using System.Threading; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPA.ApolloClient; | using BPA.ApolloClient; | ||||
using BPA.ApolloClient.Options; | using BPA.ApolloClient.Options; | ||||
using Com.Ctrip.Framework.Apollo; | using Com.Ctrip.Framework.Apollo; | ||||
@@ -1,5 +1,5 @@ | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPASmartClient.MQTT; | |||||
using BPA.Communication; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -9,7 +9,7 @@ using System.Threading.Tasks; | |||||
namespace BPASmartClient.Business | namespace BPASmartClient.Business | ||||
{ | { | ||||
public class LocalMqtt | |||||
public class LocalMqtt | |||||
{ | { | ||||
private volatile static LocalMqtt _Instance; | private volatile static LocalMqtt _Instance; | ||||
public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt()); | public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt()); | ||||
@@ -20,7 +20,7 @@ namespace BPASmartClient.Business | |||||
/// </summary> | /// </summary> | ||||
SendScreenDataModel MqttPushs = new SendScreenDataModel(); | SendScreenDataModel MqttPushs = new SendScreenDataModel(); | ||||
MQTTProxy mQTTProxy = new MQTTProxy(); | |||||
MqttHelper mQTTProxy = new MqttHelper(); | |||||
ScreenDeviceType LocDeviceType; | ScreenDeviceType LocDeviceType; | ||||
@@ -33,25 +33,32 @@ namespace BPASmartClient.Business | |||||
{ | { | ||||
MqttPushs.Name = DeviceType; | MqttPushs.Name = DeviceType; | ||||
LocDeviceType = DeviceType; | LocDeviceType = DeviceType; | ||||
mQTTProxy.Connected = new Action(() => | |||||
mQTTProxy.ConnectOk = new Action(() => | |||||
{ | { | ||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ; | |||||
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)); | |||||
}); | }); | ||||
MQTT_IP = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_IP"].ToString(); | MQTT_IP = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_IP"].ToString(); | ||||
MQTT_PORT = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Port"].ToString(); | MQTT_PORT = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Port"].ToString(); | ||||
MQTT_USERNAME = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_User"].ToString(); | MQTT_USERNAME = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_User"].ToString(); | ||||
MQTT_PASSWORD = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Password"].ToString(); | MQTT_PASSWORD = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Password"].ToString(); | ||||
mQTTProxy.Connect(MQTT_USERNAME, MQTT_PASSWORD, MQTT_IP, int.Parse(MQTT_PORT), $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public" | |||||
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions() | |||||
{ | |||||
UserName = MQTT_USERNAME, | |||||
Password = MQTT_PASSWORD, | |||||
IpAddress = MQTT_IP, | |||||
Port = int.Parse(MQTT_PORT), | |||||
ClientId = $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}" | |||||
}); | |||||
} | } | ||||
public void Start() | public void Start() | ||||
{ | { | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// MQTT消息推送 | /// MQTT消息推送 | ||||
@@ -1,5 +1,4 @@ | |||||
using BPASmartClient.Message; | |||||
using HBLConsole.Communication; | |||||
| |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -1,7 +1,7 @@ | |||||
using BPA.ApolloClient; | using BPA.ApolloClient; | ||||
using BPA.Message; | using BPA.Message; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.Device; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Http; | using BPASmartClient.Http; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.小炒机; | using BPASmartClient.Model.小炒机; | ||||
using BPASmartClient.Model.调酒机; | using BPASmartClient.Model.调酒机; | ||||
@@ -1,8 +1,7 @@ | |||||
using BPA.Message; | using BPA.Message; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.MQTT; | |||||
using HBLConsole.Communication; | |||||
using BPA.Communication; | |||||
using Microsoft.Extensions.Configuration; | using Microsoft.Extensions.Configuration; | ||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
@@ -29,7 +28,8 @@ namespace BPASmartClient.Business | |||||
//消息缓存 | //消息缓存 | ||||
private ConcurrentQueue<string> msg = new ConcurrentQueue<string>(); | private ConcurrentQueue<string> msg = new ConcurrentQueue<string>(); | ||||
//MQTT 代理 | //MQTT 代理 | ||||
private MQTTProxy mqttProxy = new MQTTProxy(); | |||||
private MqttHelper mqttProxy = new MqttHelper(); | |||||
//消息处理者 | //消息处理者 | ||||
private List<RecivedHandle> messageRecives = new List<RecivedHandle>(); | private List<RecivedHandle> messageRecives = new List<RecivedHandle>(); | ||||
@@ -43,28 +43,29 @@ namespace BPASmartClient.Business | |||||
running = true; | running = true; | ||||
//主题初始化 | //主题初始化 | ||||
TopicDefine.GetInstance().Initialize(Plugin.GetInstance().GetPlugin<DeviceMgr>().GetDevices()); | TopicDefine.GetInstance().Initialize(Plugin.GetInstance().GetPlugin<DeviceMgr>().GetDevices()); | ||||
//MQTT 连接成功 | |||||
mqttProxy.Connected = new Action(() => | |||||
{ | |||||
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); | |||||
}); | |||||
//MQTT 连接成功 | |||||
mqttProxy.LostConnect = new Action(() => | |||||
mqttProxy.ConnectOk = () => | |||||
{ | { | ||||
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); | mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray()); | ||||
}); | |||||
}; | |||||
//MQTT 数据接收 | //MQTT 数据接收 | ||||
mqttProxy.MessageRecive = new Action<string>((message) => | |||||
{ | |||||
msg.Enqueue(message); | |||||
}); | |||||
mqttProxy.MessageRecive = s => { msg.Enqueue(s); }; | |||||
var MqttServerConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config; | var MqttServerConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config; | ||||
var MqttServerAccount = Plugin.GetInstance().GetPlugin<ConfigMgr>().Mqtt_Account; | var MqttServerAccount = Plugin.GetInstance().GetPlugin<ConfigMgr>().Mqtt_Account; | ||||
var deviceConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().deviceConfigModelJsons; | var deviceConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().deviceConfigModelJsons; | ||||
string deviceId = deviceConfig[0].deviceModels[0].DeviceId; | |||||
string deviceId = deviceConfig[0].deviceModels[0].DeviceId; | |||||
clientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId; | clientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId; | ||||
//MQTT 初始化 | //MQTT 初始化 | ||||
mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "ClientId:" + clientId + "DeviceId:" + deviceId + Guid.NewGuid().ToString()); | |||||
mqttProxy.Connect(new BPA.Communication.Base.ConfigurationOptions() | |||||
{ | |||||
UserName = MqttServerAccount.UserName, | |||||
Password = MqttServerAccount.Password, | |||||
IpAddress = MqttServerConfig.Host, | |||||
Port = MqttServerConfig.Port, | |||||
ClientId = $"ClientId-[{clientId}]-DeviceId-[{deviceId}]-{Guid.NewGuid()}" | |||||
}); | |||||
ThreadManage.GetInstance().Start(() => | ThreadManage.GetInstance().Start(() => | ||||
{ | { | ||||
@@ -88,7 +89,7 @@ namespace BPASmartClient.Business | |||||
} | } | ||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
} | } | ||||
}, "MQTT 消息处理", true); | |||||
}, "MQTT 消息处理", isRestart: true); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -115,7 +116,7 @@ namespace BPASmartClient.Business | |||||
public void Dispose() | public void Dispose() | ||||
{ | { | ||||
running = false; | running = false; | ||||
mqttProxy.CloseConnect(); | |||||
mqttProxy.Dispose(); | |||||
messageRecives.Clear(); | messageRecives.Clear(); | ||||
} | } | ||||
@@ -6,7 +6,7 @@ using BPASmartClient.Device; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Http; | using BPASmartClient.Http; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.小炒机; | using BPASmartClient.Model.小炒机; | ||||
using BPASmartClient.Model.调酒机; | using BPASmartClient.Model.调酒机; | ||||
@@ -18,7 +18,7 @@ using System.Collections.ObjectModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.Business | namespace BPASmartClient.Business | ||||
{ | { | ||||
@@ -136,7 +136,7 @@ namespace BPASmartClient.Business | |||||
} | } | ||||
}); | }); | ||||
EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle); | |||||
EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle); | |||||
} | } | ||||
private void StartTargetDeviceOrderJob(int deviceId) | private void StartTargetDeviceOrderJob(int deviceId) | ||||
@@ -164,7 +164,7 @@ namespace BPASmartClient.Business | |||||
} | } | ||||
Thread.Sleep(50); | Thread.Sleep(50); | ||||
} | } | ||||
}, $"MQTT 订单接收处理-设备[{deviceId}]", true); | |||||
}, $"MQTT 订单接收处理-设备[{deviceId}]", isRestart: true); | |||||
} | } | ||||
public void OrderStatusChangedHandle(IEvent @event, EventCallBackHandle callBack) | public void OrderStatusChangedHandle(IEvent @event, EventCallBackHandle callBack) | ||||
@@ -28,8 +28,8 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
private AlarmTest() { } | private AlarmTest() { } | ||||
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | |||||
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>(); | |||||
public static ObservableCollection<BPASmartClient.Model.Alarm> Alarms { get; set; } = new(); | |||||
public static List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new(); | |||||
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | ||||
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | ||||
public static Action<string> AddAction { get; set; } | public static Action<string> AddAction { get; set; } | ||||
@@ -94,7 +94,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
/// <param name="AlarmInfo">报警信息</param> | /// <param name="AlarmInfo">报警信息</param> | ||||
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | ||||
{ | { | ||||
Alarm tempAlarm = new Alarm() | |||||
BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm() | |||||
{ | { | ||||
NumId = Alarms.Count + 1, | NumId = Alarms.Count + 1, | ||||
Date = DateTime.Now.ToString("yyyy/MM/dd"), | Date = DateTime.Now.ToString("yyyy/MM/dd"), | ||||
@@ -104,8 +104,8 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
Time = DateTime.Now.ToString("HH:mm:ss"), | Time = DateTime.Now.ToString("HH:mm:ss"), | ||||
}; | }; | ||||
var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm); | |||||
Sqlite<Alarm>.GetInstance.Save(); | |||||
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm); | |||||
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save(); | |||||
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | ||||
{ | { | ||||
@@ -35,7 +35,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
public ObservableCollection<UserLog> userLogs { get; set; } = new(); | public ObservableCollection<UserLog> userLogs { get; set; } = new(); | ||||
public ObservableCollection<Alarm> alarmLogs { get; set; } = new(); | |||||
public ObservableCollection<BPASmartClient.Model.Alarm> alarmLogs { get; set; } = new(); | |||||
public ObservableCollection<RecipeCompleteLog> recipeLogs { get; set; } = new(); | public ObservableCollection<RecipeCompleteLog> recipeLogs { get; set; } = new(); | ||||
@@ -43,7 +43,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
{ | { | ||||
Sqlite<UserLog>.GetInstance.Save(); | Sqlite<UserLog>.GetInstance.Save(); | ||||
Sqlite<RunLog>.GetInstance.Save(); | Sqlite<RunLog>.GetInstance.Save(); | ||||
Sqlite<Alarm>.GetInstance.Save(); | |||||
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save(); | |||||
Sqlite<RecipeCompleteLog>.GetInstance.Save(); | Sqlite<RecipeCompleteLog>.GetInstance.Save(); | ||||
} | } | ||||
@@ -122,7 +122,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
lock (alarmlock) | lock (alarmlock) | ||||
{ | { | ||||
AlarmID++; | AlarmID++; | ||||
Alarm alarmLog = new Alarm() | |||||
BPASmartClient.Model.Alarm alarmLog = new BPASmartClient.Model.Alarm() | |||||
{ | { | ||||
NumId = AlarmID, | NumId = AlarmID, | ||||
Date = DateTime.Now.ToString("yyyy-MM-dd"), | Date = DateTime.Now.ToString("yyyy-MM-dd"), | ||||
@@ -131,7 +131,7 @@ namespace BPASmartClient.CustomResource.Pages.Model | |||||
Value = AlarmNumber, | Value = AlarmNumber, | ||||
Grade = (level) + "" | Grade = (level) + "" | ||||
}; | }; | ||||
Sqlite<Alarm>.GetInstance.Base.Add(alarmLog); | |||||
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(alarmLog); | |||||
Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); })); | Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); })); | ||||
AlarmLog?.Invoke(info); | AlarmLog?.Invoke(info); | ||||
} | } | ||||
@@ -1,4 +1,4 @@ | |||||
using BPASmartClient.Message; | |||||
| |||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using Google.Protobuf.WellKnownTypes; | using Google.Protobuf.WellKnownTypes; | ||||
@@ -7,7 +7,7 @@ using System.Windows; | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace BPASmartClient.CustomResource.Pages.ViewModel | namespace BPASmartClient.CustomResource.Pages.ViewModel | ||||
{ | { | ||||
@@ -12,7 +12,7 @@ using BPASmartClient.CustomResource.Pages.Model; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace BPASmartClient.CustomResource.Pages.ViewModel | namespace BPASmartClient.CustomResource.Pages.ViewModel | ||||
{ | { | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.CustomResource.Pages.Enums; | using BPASmartClient.CustomResource.Pages.Enums; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPASmartClient.Nfc; | using BPASmartClient.Nfc; | ||||
using System.Threading; | using System.Threading; | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace BPASmartClient.CustomResource.Pages.ViewModel | namespace BPASmartClient.CustomResource.Pages.ViewModel | ||||
{ | { | ||||
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using System.Windows; | using System.Windows; | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.IO; | using System.IO; | ||||
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using System.Windows; | using System.Windows; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.CustomResource.Pages.View; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using System.Windows; | using System.Windows; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
namespace BPASmartClient.CustomResource.Pages.ViewModel | namespace BPASmartClient.CustomResource.Pages.ViewModel | ||||
@@ -2,7 +2,7 @@ | |||||
using BPASmartClient.CustomResource.Pages.Enums; | using BPASmartClient.CustomResource.Pages.Enums; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.CustomResource.UserControls; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -1,7 +1,6 @@ | |||||
using BPASmartClient.DRCoffee; | using BPASmartClient.DRCoffee; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.咖啡机.Enum; | using BPASmartClient.Model.咖啡机.Enum; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
@@ -9,7 +8,7 @@ using BPASmartClient.SerialPort; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Threading; | using System.Threading; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.DRCoffee | namespace BPASmartClient.DRCoffee | ||||
{ | { | ||||
@@ -147,7 +146,7 @@ namespace BPASmartClient.DRCoffee | |||||
if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running) | if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running) | ||||
{ | { | ||||
status["CoffeeStatus"] = package.Status; | status["CoffeeStatus"] = package.Status; | ||||
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }); | |||||
EventBus.GetInstance().Publish(new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }); | |||||
} | } | ||||
else status["CoffeeStatus"] = package.Status; | else status["CoffeeStatus"] = package.Status; | ||||
status["CoffeeAppStatus"] = package.ApplicationStatus; | status["CoffeeAppStatus"] = package.ApplicationStatus; | ||||
@@ -180,27 +179,27 @@ namespace BPASmartClient.DRCoffee | |||||
commProxy.SetDataStorage(dataStorage); | commProxy.SetDataStorage(dataStorage); | ||||
//咖博士咖啡机制作 | //咖博士咖啡机制作 | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令; | |||||
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode; | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令"); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令; | |||||
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode; | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令"); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
//咖博士咖啡机取消制作咖啡 | //咖博士咖啡机取消制作咖啡 | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -220,23 +219,23 @@ namespace BPASmartClient.DRCoffee | |||||
}); | }); | ||||
//咖博士咖啡机模式设置 | //咖博士咖啡机模式设置 | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd; | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令"); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd; | |||||
commProxy.SendData(DrCoffee.Packe(drinksOrder)); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令"); | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
InitStatus(); | InitStatus(); | ||||
//测试 | //测试 | ||||
Start(); | Start(); | ||||
@@ -1,5 +1,6 @@ | |||||
| | ||||
using BPA.Helper; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.咖啡机.Enum; | using BPASmartClient.Model.咖啡机.Enum; | ||||
using BPASmartClient.SerialPort; | using BPASmartClient.SerialPort; | ||||
@@ -9,10 +10,10 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.DRCoffee | |||||
{ | |||||
namespace BPASmartClient.DRCoffee | |||||
{ | |||||
/// <summary> | /// <summary> | ||||
/// 指令封装 | /// 指令封装 | ||||
/// </summary> | /// </summary> | ||||
@@ -35,9 +36,9 @@ namespace BPASmartClient.DRCoffee | |||||
cmdAsk = DrCoffee.Packe(package); | cmdAsk = DrCoffee.Packe(package); | ||||
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令; | drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令; | ||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(0,MakeCoffeeEventHandle); | |||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(0, CancelMakeCoffeeEventHandle); | |||||
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(0, CoffeeCommCmdEventHandle); | |||||
EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(0, MakeCoffeeEventHandle); | |||||
EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(0, CancelMakeCoffeeEventHandle); | |||||
EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(0, CoffeeCommCmdEventHandle); | |||||
} | } | ||||
@@ -1,5 +1,4 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
@@ -12,8 +11,8 @@ namespace BPASmartClient.Device | |||||
{ | { | ||||
public class AlarmHelper | public class AlarmHelper | ||||
{ | { | ||||
public List<Alarm> Alarms { get; set; } = new List<Alarm>(); | |||||
public List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>(); | |||||
public List<BPASmartClient.Model.Alarm> Alarms { get; set; } = new(); | |||||
public List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new(); | |||||
ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | ||||
ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | ||||
public Action<string> AddAction { get; set; } | public Action<string> AddAction { get; set; } | ||||
@@ -55,7 +54,7 @@ namespace BPASmartClient.Device | |||||
/// <param name="AlarmInfo">报警信息</param> | /// <param name="AlarmInfo">报警信息</param> | ||||
private void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | private void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | ||||
{ | { | ||||
Alarm tempAlarm = new Alarm() | |||||
BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm() | |||||
{ | { | ||||
NumId = Alarms.Count + 1, | NumId = Alarms.Count + 1, | ||||
Date = DateTime.Now.ToString("yyyy/MM/dd"), | Date = DateTime.Now.ToString("yyyy/MM/dd"), | ||||
@@ -65,8 +64,8 @@ namespace BPASmartClient.Device | |||||
Time = DateTime.Now.ToString("HH:mm:ss"), | Time = DateTime.Now.ToString("HH:mm:ss"), | ||||
}; | }; | ||||
var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm); | |||||
Sqlite<Alarm>.GetInstance.Save(); | |||||
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm); | |||||
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save(); | |||||
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | ||||
{ | { | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.Model.Bom; | using BPASmartClient.FoodStationTest.Model.Bom; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPASmartClient.FoodStationTest.View; | using BPASmartClient.FoodStationTest.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
namespace BPASmartClient.FoodStationTest.ViewModel | namespace BPASmartClient.FoodStationTest.ViewModel | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -1,6 +1,6 @@ | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.ComponentModel; | using System.ComponentModel; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.Model.HK_PLC; | using BPASmartClient.FoodStationTest.Model.HK_PLC; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.ComponentModel; | using System.ComponentModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -4,7 +4,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -1,7 +1,7 @@ | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.View; | using BPASmartClient.FoodStationTest.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.View; | using BPASmartClient.FoodStationTest.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -1,7 +1,7 @@ | |||||
using BPASmartClient.FoodStationTest.Model; | using BPASmartClient.FoodStationTest.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.View; | using BPASmartClient.FoodStationTest.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model; | |||||
using BPASmartClient.FoodStationTest.Model.RawMaterial; | using BPASmartClient.FoodStationTest.Model.RawMaterial; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.FoodStationTest.Model.HK_PLC; | |||||
using BPASmartClient.FoodStationTest.Model.Par; | using BPASmartClient.FoodStationTest.Model.Par; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace BPASmartClient.FoodStationTest.ViewModel | namespace BPASmartClient.FoodStationTest.ViewModel | ||||
{ | { | ||||
@@ -1,7 +1,8 @@ | |||||
| | ||||
using BPA.Helper; | |||||
using BPASmartClient.GSIceCream; | using BPASmartClient.GSIceCream; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using BPASmartClient.SerialPort; | using BPASmartClient.SerialPort; | ||||
@@ -11,7 +12,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.DRCoffee | namespace BPASmartClient.DRCoffee | ||||
{ | { | ||||
@@ -34,8 +35,8 @@ namespace BPASmartClient.DRCoffee | |||||
this.commProxy = commProxy; | this.commProxy = commProxy; | ||||
ICMSG_Heart_DW heartDW = new ICMSG_Heart_DW(); | ICMSG_Heart_DW heartDW = new ICMSG_Heart_DW(); | ||||
cmdHeartDW = IcPack.StructureToByte(heartDW); | cmdHeartDW = IcPack.StructureToByte(heartDW); | ||||
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_ModeSetEvent>(0, ModeSetEventHandle); | |||||
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(0,DischargeEventHandle); | |||||
EventBus.GetInstance().Subscribe<GSIceCream_ModeSetEvent>(0, ModeSetEventHandle); | |||||
EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(0, DischargeEventHandle); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 发送心跳 | /// 发送心跳 | ||||
@@ -1,6 +1,6 @@ | |||||
| | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
@@ -9,7 +9,7 @@ using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Threading; | using System.Threading; | ||||
using static BPA.Helper.EventBus; | |||||
using static BPASmartClient.GSIceCream.MessageDefine; | using static BPASmartClient.GSIceCream.MessageDefine; | ||||
namespace BPASmartClient.GSIceCream | namespace BPASmartClient.GSIceCream | ||||
@@ -176,7 +176,7 @@ namespace BPASmartClient.GSIceCream | |||||
private void ProcessHeart(ICMSG_Heart_UP heartUpMsg) | private void ProcessHeart(ICMSG_Heart_UP heartUpMsg) | ||||
{ | { | ||||
IsConnected = OnLine; | IsConnected = OnLine; | ||||
status["IceCreamIsConnected"] = OnLine; | status["IceCreamIsConnected"] = OnLine; | ||||
status["IceCreamCurrentMode"] = heartUpMsg.MS; | status["IceCreamCurrentMode"] = heartUpMsg.MS; | ||||
@@ -253,7 +253,7 @@ namespace BPASmartClient.GSIceCream | |||||
commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate); | commProxy = new SerialPortClient(communicationPar.SerialPort, (BaudRates)communicationPar.BaudRate); | ||||
commProxy.SetDataStorage(dataStorage); | commProxy.SetDataStorage(dataStorage); | ||||
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_ModeSetEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<GSIceCream_ModeSetEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -272,7 +272,7 @@ namespace BPASmartClient.GSIceCream | |||||
}); | }); | ||||
//广深冰淇淋机打料 | //广深冰淇淋机打料 | ||||
EventBus.EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<GSIceCream_DischargeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -1,6 +1,6 @@ | |||||
using BPASmartClient.GSIceCream; | using BPASmartClient.GSIceCream; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model.冰淇淋.Enum; | using BPASmartClient.Model.冰淇淋.Enum; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -7,7 +7,7 @@ using System.Collections.Concurrent; | |||||
using System.Reflection.Metadata; | using System.Reflection.Metadata; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Reflection; | using System.Reflection; | ||||
using BPASmartClient.Message; | |||||
namespace BPASmartClient.Helper | namespace BPASmartClient.Helper | ||||
{ | { | ||||
@@ -1,4 +1,4 @@ | |||||
using BPASmartClient.Message; | |||||
| |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Data; | using System.Data; | ||||
@@ -1,4 +1,4 @@ | |||||
using BPASmartClient.Message; | |||||
| |||||
using IWshRuntimeLibrary; | using IWshRuntimeLibrary; | ||||
using Microsoft.Win32; | using Microsoft.Win32; | ||||
using System; | using System; | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
using System.Collections.Concurrent; | using System.Collections.Concurrent; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.Message; | |||||
namespace BPASmartClient.Helper | namespace BPASmartClient.Helper | ||||
{ | { | ||||
@@ -31,32 +31,32 @@ namespace BPASmartClient.IceMaker | |||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
}), $"设备[{DeviceId}]制冰机读取线程", true); | }), $"设备[{DeviceId}]制冰机读取线程", true); | ||||
EventBus.EventBus.GetInstance().Subscribe<StartMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.StartCook(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<StopMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.EndCook(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<PumpMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<StartMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.StartCook(); | |||||
}); | |||||
EventBus.GetInstance().Subscribe<StopMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.EndCook(); | |||||
}); | |||||
EventBus.GetInstance().Subscribe<PumpMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
iceMakerHelper.pump(); | iceMakerHelper.pump(); | ||||
}); | }); | ||||
EventBus.EventBus.GetInstance().Subscribe<StandbyMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.Standby(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<PowerOnMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.PowerOn(); | |||||
}); | |||||
EventBus.EventBus.GetInstance().Subscribe<SetIceNumber>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<StandbyMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.Standby(); | |||||
}); | |||||
EventBus.GetInstance().Subscribe<PowerOnMakeIce>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
iceMakerHelper.PowerOn(); | |||||
}); | |||||
EventBus.GetInstance().Subscribe<SetIceNumber>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
var parm = @event as SetIceNumber; | var parm = @event as SetIceNumber; | ||||
@@ -5,7 +5,7 @@ using BPASmartClient.Business; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.IoT.Model; | using BPASmartClient.IoT.Model; | ||||
using BPASmartClient.Message; | |||||
using BPASmartDatavDeviceClient.IoT; | using BPASmartDatavDeviceClient.IoT; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -1,5 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartDatavDeviceClient.IoT; | using BPASmartDatavDeviceClient.IoT; | ||||
using DataVAPI.Tool.IOT; | using DataVAPI.Tool.IOT; | ||||
using System; | using System; | ||||
@@ -41,31 +41,31 @@ namespace BPASmartClient.JAKA | |||||
EventBus.EventBus.GetInstance().Subscribe<WriteJaka>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
var par = @event as WriteJaka; | |||||
switch (par?.TagName) | |||||
{ | |||||
case "Power_On": | |||||
jaKaHelper.Power_On(); | |||||
break; | |||||
case "Enable_robot": | |||||
jaKaHelper.Enable_robot(); | |||||
break; | |||||
case "Set_RobotAO1": | |||||
if (par?.Value is int intvalue) jaKaHelper.Set_RobotAO1(intvalue); | |||||
break; | |||||
case "JaKaProgramName": | |||||
if (par?.Value is string stringvalue) jaKaHelper.JaKaProgramName(stringvalue); | |||||
break; | |||||
case "JakaDOutput": | |||||
if (par?.Value is bool DO_value && par?.DO_Index is int DO_Index) jaKaHelper.Set_RobotDO(DO_Index, DO_value); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<WriteJaka>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
var par = @event as WriteJaka; | |||||
switch (par?.TagName) | |||||
{ | |||||
case "Power_On": | |||||
jaKaHelper.Power_On(); | |||||
break; | |||||
case "Enable_robot": | |||||
jaKaHelper.Enable_robot(); | |||||
break; | |||||
case "Set_RobotAO1": | |||||
if (par?.Value is int intvalue) jaKaHelper.Set_RobotAO1(intvalue); | |||||
break; | |||||
case "JaKaProgramName": | |||||
if (par?.Value is string stringvalue) jaKaHelper.JaKaProgramName(stringvalue); | |||||
break; | |||||
case "JakaDOutput": | |||||
if (par?.Value is bool DO_value && par?.DO_Index is int DO_Index) jaKaHelper.Set_RobotDO(DO_Index, DO_value); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
}); | |||||
} | } | ||||
//public override void ReadData(string address) | //public override void ReadData(string address) | ||||
@@ -5,7 +5,7 @@ using BPA.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -1,7 +1,7 @@ | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
@@ -3,7 +3,7 @@ using BPA.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.View; | using BPASmartClient.JXJFoodBigStation.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.View; | using BPASmartClient.JXJFoodBigStation.View; | ||||
using System.Windows.Forms; | using System.Windows.Forms; | ||||
@@ -6,7 +6,7 @@ using BPASmartClient.JXJFoodBigStation.Model; | |||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | using BPASmartClient.JXJFoodBigStation.Model.Siemens; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -5,7 +5,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.View; | using BPASmartClient.JXJFoodBigStation.View; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
@@ -6,7 +6,7 @@ using BPASmartClient.JXJFoodBigStation.Model; | |||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | using BPASmartClient.JXJFoodBigStation.Model.Siemens; | ||||
using BPASmartClient.JXJFoodBigStation.View; | using BPASmartClient.JXJFoodBigStation.View; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -2,7 +2,7 @@ | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.Siemens; | using BPASmartClient.JXJFoodBigStation.Model.Siemens; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -5,7 +5,7 @@ using BPA.Helper; | |||||
using BPASmartClient.JXJFoodBigStation.Model; | using BPASmartClient.JXJFoodBigStation.Model; | ||||
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -4,7 +4,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
namespace BPASmartClient.JXJFoodSmallStation.Model | namespace BPASmartClient.JXJFoodSmallStation.Model | ||||
{ | { | ||||
@@ -6,7 +6,7 @@ using BPASmartClient.JXJFoodSmallStation.Model; | |||||
using BPASmartClient.JXJFoodSmallStation.Model.Bom; | using BPASmartClient.JXJFoodSmallStation.Model.Bom; | ||||
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | namespace BPASmartClient.JXJFoodSmallStation.ViewModel | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.View; | using BPASmartClient.JXJFoodSmallStation.View; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
namespace BPASmartClient.JXJFoodSmallStation.ViewModel | namespace BPASmartClient.JXJFoodSmallStation.ViewModel | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -5,7 +5,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using System.Threading; | using System.Threading; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -3,7 +3,7 @@ using BPASmartClient.JXJFoodSmallStation.Model; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -5,7 +5,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
@@ -5,7 +5,7 @@ using System.Text; | |||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.CustomResource.Pages.Model; | using BPASmartClient.CustomResource.Pages.Model; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.JXJFoodSmallStation.View; | using BPASmartClient.JXJFoodSmallStation.View; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.JXJFoodSmallStation.View; | using BPASmartClient.JXJFoodSmallStation.View; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -3,7 +3,7 @@ using BPA.Helper; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | using BPASmartClient.JXJFoodSmallStation.Model.Siemens; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -8,7 +8,7 @@ using System.Collections.Concurrent; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using System.Windows; | using System.Windows; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.JXJFoodSmallStation.View; | using BPASmartClient.JXJFoodSmallStation.View; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
@@ -5,7 +5,7 @@ using BPA.Helper; | |||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial; | using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -7,7 +7,7 @@ using BPA.Helper; | |||||
using System.Collections.ObjectModel; | using System.Collections.ObjectModel; | ||||
using BPASmartClient.JXJFoodSmallStation.Model; | using BPASmartClient.JXJFoodSmallStation.Model; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using Microsoft.Toolkit.Mvvm.Input; | |||||
using BPASmartClient.CustomResource.UserControls.MessageShow; | using BPASmartClient.CustomResource.UserControls.MessageShow; | ||||
using BPASmartClient.CustomResource.UserControls; | using BPASmartClient.CustomResource.UserControls; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -3,7 +3,7 @@ using BPA.Helper; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
using BPASmartClient.SerialPort; | using BPASmartClient.SerialPort; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.Juicer | namespace BPASmartClient.Juicer | ||||
{ | { | ||||
@@ -32,7 +32,7 @@ namespace BPASmartClient.Juicer | |||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
}), $"设备[{DeviceId}]果汁机读取线程", true); | }), $"设备[{DeviceId}]果汁机读取线程", true); | ||||
EventBus.EventBus.GetInstance().Subscribe<WriteJuicer>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<WriteJuicer>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
var par = @event as WriteJuicer; | var par = @event as WriteJuicer; | ||||
@@ -1,5 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.SerialPort; | using BPASmartClient.SerialPort; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -1,7 +1,7 @@ | |||||
| | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.KLMCoffee.Protocal; | using BPASmartClient.KLMCoffee.Protocal; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.咖啡机.Enum; | using BPASmartClient.Model.咖啡机.Enum; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
@@ -12,7 +12,7 @@ using System.Linq; | |||||
using System.Text; | using System.Text; | ||||
using System.Threading; | using System.Threading; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.KLMCoffee | namespace BPASmartClient.KLMCoffee | ||||
{ | { | ||||
@@ -112,7 +112,7 @@ namespace BPASmartClient.KLMCoffee | |||||
{ | { | ||||
byte item = dataStorage.GetData(); | byte item = dataStorage.GetData(); | ||||
List<byte> data = new List<byte>() { item }; | List<byte> data = new List<byte>() { item }; | ||||
if (Encoding.ASCII.GetString(data.ToArray()) == ":") | |||||
if (Encoding.ASCII.GetString(data.ToArray()) == ":") | |||||
{ | { | ||||
temp.Add(item); | temp.Add(item); | ||||
while (dataStorage.GetSize() < 32) { Thread.Sleep(5); } | while (dataStorage.GetSize() < 32) { Thread.Sleep(5); } | ||||
@@ -127,7 +127,7 @@ namespace BPASmartClient.KLMCoffee | |||||
//帧尾 | //帧尾 | ||||
//if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") | //if (Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\\r\\n" || Encoding.ASCII.GetString(vs.ToArray()).ToLower() == "\r\n") | ||||
var package = Encoding.ASCII.GetString(temp.ToArray()); | var package = Encoding.ASCII.GetString(temp.ToArray()); | ||||
if(package.Contains("\\r\\n")) | |||||
if (package.Contains("\\r\\n")) | |||||
{ | { | ||||
ProcessMsg(package); | ProcessMsg(package); | ||||
} | } | ||||
@@ -147,10 +147,10 @@ namespace BPASmartClient.KLMCoffee | |||||
if (systemStatus != null) | if (systemStatus != null) | ||||
{ | { | ||||
status["CoffeeIsConnected"] = OnLine; | status["CoffeeIsConnected"] = OnLine; | ||||
if((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡&&systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) | |||||
if ((K95SysTemStatus)status["CoffeeStatus"] == K95SysTemStatus.正在制作咖啡 && systemStatus.temStatus != K95SysTemStatus.正在制作咖啡) | |||||
{ | { | ||||
status["CoffeeStatus"] = systemStatus.temStatus; | status["CoffeeStatus"] = systemStatus.temStatus; | ||||
EventBus.EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); | |||||
EventBus.GetInstance().Publish(new KLMCoffee_CoffeEndCookEvent { DeviceId = DeviceId }); | |||||
} | } | ||||
else status["CoffeeStatus"] = systemStatus.temStatus; | else status["CoffeeStatus"] = systemStatus.temStatus; | ||||
status["CoffeedrinkType"] = systemStatus.drinkType; | status["CoffeedrinkType"] = systemStatus.drinkType; | ||||
@@ -187,64 +187,64 @@ namespace BPASmartClient.KLMCoffee | |||||
commProxy.SetDataStorage(dataStorage); | commProxy.SetDataStorage(dataStorage); | ||||
//伽乐美咖啡机制作 | //伽乐美咖啡机制作 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(300); | |||||
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; | |||||
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); | |||||
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); | |||||
commProxy.SendData(data); | |||||
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(300); | |||||
K95deFaultCoffeeEnum K95Code = (K95deFaultCoffeeEnum)((KLMCoffee_MakeCoffeeEvent)@event).KLMDrinkFaultCode; | |||||
//byte[] data = command.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(), new RecipeModel().Packe(((KLMCoffee_MakeCoffeeEvent)@event).DrinkCode)); | |||||
byte[] data = command.ReturnsCommandData(K95CommandEnum.咖啡制作.GetString(), K95Code.GetString()); | |||||
commProxy.SendData(data); | |||||
MessageLog.GetInstance.Show($"制作{K95Code}数据发送完成"); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
//伽乐美咖啡机取消制作咖啡 | //伽乐美咖啡机取消制作咖啡 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsCancelMake(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsCancelMake(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
//伽乐美咖啡机清洗冲泡器 | //伽乐美咖啡机清洗冲泡器 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsWashCPJ(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_WashCPJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsWashCPJ(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
//伽乐美咖啡机放杯确认 | //伽乐美咖啡机放杯确认 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_CupIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -263,26 +263,26 @@ namespace BPASmartClient.KLMCoffee | |||||
//伽乐美咖啡机清洗奶沫器 | //伽乐美咖啡机清洗奶沫器 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsWashNMJ(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
try | |||||
{ | |||||
free = true; | |||||
Thread.Sleep(200); | |||||
byte[] data = command.ReturnsWashNMJ(); | |||||
commProxy.SendData(data); | |||||
Thread.Sleep(200); | |||||
free = false; | |||||
} | |||||
catch (Exception ex) | |||||
{ | |||||
MessageLog.GetInstance.ShowEx($"BPASmartClient.KLMCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]"); | |||||
} | |||||
}); | |||||
//伽乐美咖啡机清洗奶沫器确认 | //伽乐美咖啡机清洗奶沫器确认 | ||||
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<KLMCoffee_WashNMJIsOKEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -7,7 +7,7 @@ using System.Threading.Tasks; | |||||
using Lebai.SDK; | using Lebai.SDK; | ||||
using Lebai.SDK.Dtos; | using Lebai.SDK.Dtos; | ||||
using Robotc; | using Robotc; | ||||
using BPASmartClient.Message; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using TaskStatus = Lebai.SDK.Dtos.TaskStatus; | using TaskStatus = Lebai.SDK.Dtos.TaskStatus; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
@@ -16,6 +16,7 @@ using BPASmartClient.Peripheral; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.LebaiRobot; | using BPASmartClient.LebaiRobot; | ||||
using BPASmartClient.Model.乐白机器人; | using BPASmartClient.Model.乐白机器人; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.Lebai | namespace BPASmartClient.Lebai | ||||
{ | { | ||||
@@ -48,7 +49,7 @@ namespace BPASmartClient.Lebai | |||||
status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected; | status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected; | ||||
status["RobotOK"] = LebaiHelper.GetInstance().GetValueAsync().Ok; | status["RobotOK"] = LebaiHelper.GetInstance().GetValueAsync().Ok; | ||||
status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value; | status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value; | ||||
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] =(ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode; | |||||
if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = (ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode; | |||||
status["RobotValue1"] = LebaiHelper.GetInstance().GetValueAsync(1).Value; | status["RobotValue1"] = LebaiHelper.GetInstance().GetValueAsync(1).Value; | ||||
status["LeibaiGetTcpInput"] = LebaiHelper.GetInstance().GetTcpInput(0); | status["LeibaiGetTcpInput"] = LebaiHelper.GetInstance().GetTcpInput(0); | ||||
status["LeibaiGetInput1"] = LebaiHelper.GetInstance().GetInput(0); | status["LeibaiGetInput1"] = LebaiHelper.GetInstance().GetInput(0); | ||||
@@ -68,12 +69,12 @@ namespace BPASmartClient.Lebai | |||||
public override void Init() | public override void Init() | ||||
{ | { | ||||
EventBus.EventBus.GetInstance().Subscribe<Demo_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<Demo_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
}); | }); | ||||
//获取机器人信号 | //获取机器人信号 | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_GetInputEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_GetInputEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_GetInputEvent getInput) | if (@event is LebaiRobot_GetInputEvent getInput) | ||||
@@ -82,7 +83,7 @@ namespace BPASmartClient.Lebai | |||||
} | } | ||||
}); | }); | ||||
//获取Tcp信号 | //获取Tcp信号 | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_GetTCPInputEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_GetTCPInputEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_GetTCPInputEvent getTCPInput) | if (@event is LebaiRobot_GetTCPInputEvent getTCPInput) | ||||
@@ -91,7 +92,7 @@ namespace BPASmartClient.Lebai | |||||
} | } | ||||
}); | }); | ||||
//机器人输入信号 | //机器人输入信号 | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_SetValueEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_SetValueEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_SetValueEvent SetValueEvent) | if (@event is LebaiRobot_SetValueEvent SetValueEvent) | ||||
@@ -100,7 +101,7 @@ namespace BPASmartClient.Lebai | |||||
} | } | ||||
}); | }); | ||||
//控制机器人 | //控制机器人 | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_LebaiControlEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_LebaiControlEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_LebaiControlEvent lebaiControlEvent) | if (@event is LebaiRobot_LebaiControlEvent lebaiControlEvent) | ||||
@@ -132,7 +133,7 @@ namespace BPASmartClient.Lebai | |||||
} | } | ||||
}); | }); | ||||
//选择机器人场景 | //选择机器人场景 | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_LebaiSenceEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_LebaiSenceEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_LebaiSenceEvent lebaiSenceEvent) | if (@event is LebaiRobot_LebaiSenceEvent lebaiSenceEvent) | ||||
@@ -141,12 +142,12 @@ namespace BPASmartClient.Lebai | |||||
} | } | ||||
}); | }); | ||||
EventBus.EventBus.GetInstance().Subscribe<LebaiRobot_SetOutPutEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<LebaiRobot_SetOutPutEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
if (@event is LebaiRobot_SetOutPutEvent lebaiOutputEvent) | if (@event is LebaiRobot_SetOutPutEvent lebaiOutputEvent) | ||||
{ | { | ||||
LebaiHelper.GetInstance().SetOutput(lebaiOutputEvent.Value,lebaiOutputEvent.Pin); | |||||
LebaiHelper.GetInstance().SetOutput(lebaiOutputEvent.Value, lebaiOutputEvent.Pin); | |||||
} | } | ||||
}); | }); | ||||
@@ -157,8 +158,8 @@ namespace BPASmartClient.Lebai | |||||
public override void WriteData(string address, object value) | public override void WriteData(string address, object value) | ||||
{ | { | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -1,5 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using Lebai.SDK; | using Lebai.SDK; | ||||
using Lebai.SDK.Dtos; | using Lebai.SDK.Dtos; | ||||
@@ -1,9 +1,10 @@ | |||||
| | ||||
using BPA.Helper; | |||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
using BPASmartClient.Model.单片机; | using BPASmartClient.Model.单片机; | ||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
using BPASmartClient.SerialPort; | using BPASmartClient.SerialPort; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MCU | namespace BPASmartClient.MCU | ||||
{ | { | ||||
@@ -15,7 +16,7 @@ namespace BPASmartClient.MCU | |||||
{ | { | ||||
mCUSerialHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); | mCUSerialHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate); | ||||
EventBus.EventBus.GetInstance().Subscribe<ReadMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<ReadMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
var par = @event as ReadMcu; | var par = @event as ReadMcu; | ||||
@@ -25,7 +26,7 @@ namespace BPASmartClient.MCU | |||||
} | } | ||||
}); | }); | ||||
EventBus.EventBus.GetInstance().Subscribe<WriteMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<WriteMcu>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
var par = @event as WriteMcu; | var par = @event as WriteMcu; | ||||
@@ -1,11 +1,12 @@ | |||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Modbus; | using BPASmartClient.Modbus; | ||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using BPASmartClient.Model.PLC; | using BPASmartClient.Model.PLC; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.PLC | namespace BPASmartClient.PLC | ||||
{ | { | ||||
@@ -71,7 +72,7 @@ namespace BPASmartClient.PLC | |||||
//写入数据 | //写入数据 | ||||
EventBus.EventBus.GetInstance().Subscribe<WriteModel>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
EventBus.GetInstance().Subscribe<WriteModel>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | { | ||||
if (@event == null) return; | if (@event == null) return; | ||||
var par = @event as WriteModel; | var par = @event as WriteModel; | ||||
@@ -4,52 +4,51 @@ using BPASmartClient.Modbus; | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using System.Threading; | using System.Threading; | ||||
using BPASmartClient.Model.Ä̲èζħ·½; | using BPASmartClient.Model.Ä̲èζħ·½; | ||||
using static BPA.Helper.EventBus; | |||||
namespace BPASmartClient.MilkTeaCube | namespace BPASmartClient.MilkTeaCube | ||||
{ | { | ||||
public class MilkTeaCubeMachine: BasePeripheral | |||||
public class MilkTeaCubeMachine : BasePeripheral | |||||
{ | { | ||||
public ModbusTcp modbus =new ModbusTcp(); | |||||
public override void Init() | |||||
public ModbusTcp modbus = new ModbusTcp(); | |||||
public override void Init() | |||||
{ | { | ||||
modbus.ModbusTcpConnect(communicationPar.IPAddress); | modbus.ModbusTcpConnect(communicationPar.IPAddress); | ||||
EventBus.EventBus.GetInstance().Subscribe<MilkTea_MakeMilkTeaEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
var par = @event as MilkTea_MakeMilkTeaEvent; | |||||
switch (par?.TagName) | |||||
{ | |||||
case "Start": | |||||
modbus.Write("LB14", true); | |||||
Thread.Sleep(200); | |||||
modbus.Write("LB14", false); | |||||
EventBus.GetInstance().Subscribe<MilkTea_MakeMilkTeaEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack) | |||||
{ | |||||
if (@event == null) return; | |||||
var par = @event as MilkTea_MakeMilkTeaEvent; | |||||
switch (par?.TagName) | |||||
{ | |||||
case "Start": | |||||
modbus.Write("LB14", true); | |||||
Thread.Sleep(200); | |||||
modbus.Write("LB14", false); | |||||
break; | |||||
case "ParameterSet": | |||||
modbus.Write("LB14", false); | |||||
Thread.Sleep(500); | |||||
modbus.Write("LW1001", par.MilkTeaKind[0]); | |||||
modbus.Write("LW1003", par.MilkTeaKind[1]); | |||||
modbus.Write("LW1004", par.MilkTeaKind[2]); | |||||
modbus.Write("LW1005", par.MilkTeaKind[3]); | |||||
modbus.Write("LW1006", par.MilkTeaKind[4]); | |||||
modbus.Write("LW1007", par.MilkTeaKind[5]); | |||||
modbus.Write("LW1008", par.MilkTeaKind[6]); | |||||
modbus.Write("LW1009", par.MilkTeaKind[7]); | |||||
modbus.Write("LW1010", par.MilkTeaKind[8]); | |||||
modbus.Write("LW1011", par.MilkTeaKind[9]); | |||||
modbus.Write("LW1012", par.MilkTeaKind[10]); | |||||
modbus.Write("LW1013", par.MilkTeaKind[11]); | |||||
break; | |||||
case "StartSignReset": | |||||
modbus.Write("LB14", false); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
}); | |||||
break; | |||||
case "ParameterSet": | |||||
modbus.Write("LB14", false); | |||||
Thread.Sleep(500); | |||||
modbus.Write("LW1001", par.MilkTeaKind[0]); | |||||
modbus.Write("LW1003", par.MilkTeaKind[1]); | |||||
modbus.Write("LW1004", par.MilkTeaKind[2]); | |||||
modbus.Write("LW1005", par.MilkTeaKind[3]); | |||||
modbus.Write("LW1006", par.MilkTeaKind[4]); | |||||
modbus.Write("LW1007", par.MilkTeaKind[5]); | |||||
modbus.Write("LW1008", par.MilkTeaKind[6]); | |||||
modbus.Write("LW1009", par.MilkTeaKind[7]); | |||||
modbus.Write("LW1010", par.MilkTeaKind[8]); | |||||
modbus.Write("LW1011", par.MilkTeaKind[9]); | |||||
modbus.Write("LW1012", par.MilkTeaKind[10]); | |||||
modbus.Write("LW1013", par.MilkTeaKind[11]); | |||||
break; | |||||
case "StartSignReset": | |||||
modbus.Write("LB14", false); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
}); | |||||
ThreadManage.GetInstance().StartLong(new Action(() => | ThreadManage.GetInstance().StartLong(new Action(() => | ||||
{ | { | ||||
IsConnected = modbus.Connected; | IsConnected = modbus.Connected; | ||||
@@ -4,7 +4,7 @@ using BPASmartClient.CustomResource.UserControls.MessageShow; | |||||
using BPASmartClient.Device; | using BPASmartClient.Device; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.IoT; | using BPASmartClient.IoT; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Peripheral; | using BPASmartClient.Peripheral; | ||||
using BPASmartClient.ViewModel; | using BPASmartClient.ViewModel; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
@@ -1,7 +1,7 @@ | |||||
| | ||||
global using CommunityToolkit.Mvvm.Input; | global using CommunityToolkit.Mvvm.Input; | ||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
namespace BPASmartClient.MilkWithTea.ViewModel | namespace BPASmartClient.MilkWithTea.ViewModel | ||||
{ | { | ||||
@@ -176,7 +176,7 @@ namespace BPASmartClient.MilkWithTea.ViewModel | |||||
}), "AddOrder"); | }), "AddOrder"); | ||||
EventBus.EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle); | |||||
EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle); | |||||
ActionManage.GetInstance.Register(new Action<object[]>((o)=> | ActionManage.GetInstance.Register(new Action<object[]>((o)=> | ||||
{ | { | ||||
@@ -194,7 +194,7 @@ namespace BPASmartClient.MilkWithTea.ViewModel | |||||
} | } | ||||
private void OrderStatusChangedHandle(IEvent @event, EventBus.EventBus.EventCallBackHandle callBack) | |||||
private void OrderStatusChangedHandle(IEvent @event, EventBus.EventCallBackHandle callBack) | |||||
{ | { | ||||
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent; | OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent; | ||||
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId); | ||||
@@ -1,5 +1,5 @@ | |||||
using BPA.Helper; | using BPA.Helper; | ||||
using BPASmartClient.Message; | |||||
using BPASmartClient.Model; | using BPASmartClient.Model; | ||||
using CommunityToolkit.Mvvm.Input; | using CommunityToolkit.Mvvm.Input; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||