From a481ed340285e8cd651c3babbe7b7bb7d71ecdc2 Mon Sep 17 00:00:00 2001
From: NXX <447201003@qq>
Date: Tue, 31 May 2022 14:01:25 +0800
Subject: [PATCH] MorkT
---
.../BPASmartClient.CustomResource.csproj | 2 +
BPASmartClient.DRCoffee/CoffeeMachine.cs | 9 +-
BPASmartClient.Device/BaseDevice.cs | 2 +-
BPASmartClient.IoT/DataVClient.cs | 3 +-
BPASmartClient.Lebai/LebaiRobot.cs | 2 +-
.../BPASmartClient.MorkT.csproj | 1 +
BPASmartClient.MorkT/Control_MorkT.cs | 176 +++++++++++-------
BPASmartClient.MorkT/GLV_MorkT.cs | 12 ++
BPASmartClient.MorkT/View/DebugView.xaml | 48 ++++-
BPASmartClient.MorkT/View/DebugView.xaml.cs | 9 +-
BPASmartClient.MorkT/View/Monitor.xaml | 75 ++++++++
BPASmartClient.MorkT/View/Monitor.xaml.cs | 34 ++++
BPASmartClient.MorkT/View/ParSer.xaml | 13 ++
BPASmartClient.MorkT/View/ParSer.xaml.cs | 28 +++
.../ViewModel/DebugViewModel.cs | 87 ++++++++-
.../ViewModel/MonitorViewModel.cs | 94 ++++++++++
BPASmartClient.SCChip/ICChipMachine.cs | 95 +++++++---
17 files changed, 578 insertions(+), 112 deletions(-)
create mode 100644 BPASmartClient.MorkT/View/Monitor.xaml
create mode 100644 BPASmartClient.MorkT/View/Monitor.xaml.cs
create mode 100644 BPASmartClient.MorkT/View/ParSer.xaml
create mode 100644 BPASmartClient.MorkT/View/ParSer.xaml.cs
create mode 100644 BPASmartClient.MorkT/ViewModel/MonitorViewModel.cs
diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index 5ab4bd64..d712bfdf 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -12,6 +12,7 @@
+
@@ -172,6 +173,7 @@
+
diff --git a/BPASmartClient.DRCoffee/CoffeeMachine.cs b/BPASmartClient.DRCoffee/CoffeeMachine.cs
index e897453f..e1874dd0 100644
--- a/BPASmartClient.DRCoffee/CoffeeMachine.cs
+++ b/BPASmartClient.DRCoffee/CoffeeMachine.cs
@@ -141,14 +141,13 @@ namespace BPASmartClient.DRCoffee
///
public void ProcessPackage(DrCoffeePackage package)
{
-
+ lastRefreshTime = DateTime.Now;
+ IsConnected = OnLine;
+ status["CoffeeIsConnected"] = OnLine;
if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
{
status["CoffeeStatus"] = package.Status;
- lastRefreshTime = DateTime.Now;
- IsConnected = OnLine;
- status["CoffeConnected"] = OnLine;
- new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId }.Publish();
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId });
}
else status["CoffeeStatus"] = package.Status;
status["CoffeeAppStatus"] = package.ApplicationStatus;
diff --git a/BPASmartClient.Device/BaseDevice.cs b/BPASmartClient.Device/BaseDevice.cs
index 8055356d..60943f21 100644
--- a/BPASmartClient.Device/BaseDevice.cs
+++ b/BPASmartClient.Device/BaseDevice.cs
@@ -325,7 +325,7 @@ namespace BPASmartClient.Device
{
MainTask();
Thread.Sleep(10);
- }), $"MainTask:{DeviceId}");
+ }) ,$"MainTask:{DeviceId}",true);
#endregion
#region 设备状态监控
diff --git a/BPASmartClient.IoT/DataVClient.cs b/BPASmartClient.IoT/DataVClient.cs
index c4ca8862..a0315030 100644
--- a/BPASmartClient.IoT/DataVClient.cs
+++ b/BPASmartClient.IoT/DataVClient.cs
@@ -35,8 +35,7 @@ namespace BPASmartClient.IoT
public DataVClient()
{
DataVApiAddress = InternetInfo.DataVApiAddress;
- //ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString();
- ClientId = Plugin.GetInstance().GetPlugin().ClientId.ToString();
+ ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString();
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString();
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString();
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
diff --git a/BPASmartClient.Lebai/LebaiRobot.cs b/BPASmartClient.Lebai/LebaiRobot.cs
index 721cc893..945029ea 100644
--- a/BPASmartClient.Lebai/LebaiRobot.cs
+++ b/BPASmartClient.Lebai/LebaiRobot.cs
@@ -48,7 +48,7 @@ namespace BPASmartClient.Lebai
status["RobotIsConnected"] = LebaiHelper.GetInstance().IsConnected;
status["RobotOK"] = LebaiHelper.GetInstance().GetValueAsync().Ok;
status["RobotValue"] = LebaiHelper.GetInstance().GetValueAsync().Value;
- if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] = LebaiHelper.GetInstance().robotData.RobotMode.Mode;
+ if (LebaiHelper.GetInstance().robotData != null) status["RobotMode"] =(ELebaiRModel)LebaiHelper.GetInstance().robotData.RobotMode.Mode;
LebaiHelper.GetInstance().GetRobotModeStatus();
Thread.Sleep(10);
},"获取乐白机器人数据");
diff --git a/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj b/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
index 08d23ce9..e3705e10 100644
--- a/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
+++ b/BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
@@ -9,6 +9,7 @@
+
diff --git a/BPASmartClient.MorkT/Control_MorkT.cs b/BPASmartClient.MorkT/Control_MorkT.cs
index 53d67dd1..247f2c7e 100644
--- a/BPASmartClient.MorkT/Control_MorkT.cs
+++ b/BPASmartClient.MorkT/Control_MorkT.cs
@@ -45,7 +45,7 @@ namespace BPASmartClient.MorkT
morkT.MakeCoffeeOrder.OrderStatus = 1;
});
int i = 0;
-
+ EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
MessageLog.GetInstance.Show("MORKT 设备初始化完成");
@@ -71,7 +71,21 @@ namespace BPASmartClient.MorkT
public override void MainTask()
{
-
+ if (morkT.waitMorkOrder != null)//更新订单取走状态
+ {
+ EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent() { DeviceId = DeviceId, Pin = 0 }, (o) =>
+ {
+ if (o != null && o.Length > 0 && o[0] is bool res)
+ {
+ if (!res)
+ {
+ OrderChange(morkT.waitMorkOrder.SuborderId, ORDER_STATUS.COMPLETED_TAKE);
+ DeviceProcessLogShow("订单取餐完成");
+ morkT.waitMorkOrder = null;
+ }
+ }
+ });
+ }
MakeCoffeeProcess();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 },(o)=>
{
@@ -84,7 +98,8 @@ namespace BPASmartClient.MorkT
}
}
});
-
+
+
}
public override void ReadData()
@@ -371,6 +386,7 @@ namespace BPASmartClient.MorkT
{
DeviceProcessLogShow($"开始制作 [咖啡] 订单[{orderLoc.SortNum}]");
GetAndCheeckCoffe(orderLoc);//取咖啡杯
+ if (!morkT.GetCoffeeCup) return;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10051}); //接咖啡后回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
@@ -380,6 +396,7 @@ namespace BPASmartClient.MorkT
}
}
+
}
@@ -411,6 +428,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
//订单状态改变:完成
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK);
+ morkT.waitMorkOrder = order;
DeviceProcessLogShow($"{order.GoodsName}等待取餐");
//WaitTakeMealOrder.Enqueue(order);
@@ -454,6 +472,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10050 }); //SENCE_咖啡杯回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
+ morkT.GetCoffeeCup = false;
return;
}
DeviceProcessLogShow("执行二次取咖啡杯");
@@ -464,6 +483,7 @@ namespace BPASmartClient.MorkT
count++;
goto p;
}
+ morkT.GetCoffeeCup = true;
DeviceProcessLogShow("取咖啡杯完成");
}
@@ -482,40 +502,45 @@ namespace BPASmartClient.MorkT
///
private void MakeIceCreamProcess()
{
- if (IceCreamCanMake())
- {
- if(peripheralStatus.ContainsKey("IceCreamCurrentMode"))
- {
- if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) new GSIceCream_ModeSetEvent() { Mode = MORKI_MODE.制冷模式 }.Publish();
- }
-
- if(peripheralStatus.ContainsKey("IceCreamCXB"))
- {
- if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
- {
- bool result = true;
- EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
- {
- if (res[0] is bool resultValue)
- {
- result = resultValue;
- }
- });
- if (result)
- {
- if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
- morkT.IceIsOK = false;
- }
- else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
- {
- morkT.IceIsOK = true;
- DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
- DoIceCream(order);
- }
- }
- }
-
- }
+ //if (IceCreamCanMake())
+ //{
+ if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
+ {
+ DoIceCream(order);
+ }
+
+ //if(peripheralStatus.ContainsKey("IceCreamCurrentMode"))
+ //{
+ // if ((MORKI_MODE)peripheralStatus["IceCreamCurrentMode"] != MORKI_MODE.制冷模式) EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent { DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
+ //}
+
+ //if(peripheralStatus.ContainsKey("IceCreamCXB"))
+ //{
+ // if ((byte)peripheralStatus["IceCreamCXB"] >= 86 && morkT.morkOrderPushesIceCream.Count > 0)//成型比大于86才可以制作
+ // {
+ // bool result = true;
+ // EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 3 }, (res) =>
+ // {
+ // if (res[0] is bool resultValue)
+ // {
+ // result = resultValue;
+ // }
+ // });
+ // if (result)
+ // {
+ // if (morkT.IceIsOK) DeviceProcessLogShow("请检查冰淇淋出料口有无遮挡");
+ // morkT.IceIsOK = false;
+ // }
+ // else if (morkT.morkOrderPushesIceCream.TryDequeue(out OrderLocInfo order))
+ // {
+ // morkT.IceIsOK = true;
+ // DeviceProcessLogShow($"开始制作 [冰淇淋] 订单[{order.SortNum}]");
+ // DoIceCream(order);
+ // }
+ // }
+ //}
+
+ //}
}
@@ -526,8 +551,12 @@ namespace BPASmartClient.MorkT
{
GetIceCreamCup();
CheckICeCreaCup();
- GetIceCream(order);
- PutIceCream(order);
+ if(morkT.GetIceCreamCup)
+ {
+ GetIceCream(order);
+ PutIceCream(order);
+ }
+
}
///
@@ -572,6 +601,7 @@ namespace BPASmartClient.MorkT
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10049 }); //SENCE_冰淇淋杯回原点
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
+ morkT.GetIceCreamCup = false;
return;
}
DeviceProcessLogShow($"执行{count}次取冰淇淋杯!");
@@ -582,6 +612,7 @@ namespace BPASmartClient.MorkT
count++;
goto p;
}
+ morkT.GetIceCreamCup = true;
DeviceProcessLogShow("冰淇淋杯检测完成");
}
@@ -592,34 +623,43 @@ namespace BPASmartClient.MorkT
private void GetIceCream(OrderLocInfo order)
{
//制冷模式
- EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
+ //EventBus.EventBus.GetInstance().Publish(new GSIceCream_ModeSetEvent {DeviceId = DeviceId, Mode = MORKI_MODE.制冷模式 });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 });
OrderChange(order.SuborderId, ORDER_STATUS.COOKING);
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10039 }); //SENCE_接1号冰淇淋
Wait();
bool doItResult = true;
+
//出料
- EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=>
- {
- doItResult = (bool)o[0];
- });
- if (doItResult)
- {
- IceCreamCookCheck();
- }
- else
- {
- int count_1 = 0;
+ EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = true });
+ Thread.Sleep(500);
+ EventBus.EventBus.GetInstance().Publish(new SCChip_RotorSwitchEvent { DeviceId = DeviceId, TurnOn = false });
+ EventBus.EventBus.GetInstance().Publish(new SCChip_MakeIceCreamEvent { DeviceId = DeviceId ,SteeringEngine = IC_SE.SE_2 });//冰淇淋出料
+ DeviceProcessLogShow("开始等待6s");
+ Thread.Sleep(6000);
- while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
- {
- Thread.Sleep(5);
- count_1++;
- if (count_1 >= 2000)
- break;
- }
- IceCreamCookCheck();
- }
+ //出料
+ //EventBus.EventBus.GetInstance().Publish(new GSIceCream_DischargeEvent { DeviceId = DeviceId },(o)=>
+ //{
+ // doItResult = (bool)o[0];
+ //});
+ //if (doItResult)
+ //{
+ // IceCreamCookCheck();
+ //}
+ //else
+ //{
+ // int count_1 = 0;
+
+ // while ((byte)peripheralStatus["IceCreamCXB"] <= 86)
+ // {
+ // Thread.Sleep(5);
+ // count_1++;
+ // if (count_1 >= 2000)
+ // break;
+ // }
+ // IceCreamCookCheck();
+ //}
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
}
@@ -629,21 +669,25 @@ namespace BPASmartClient.MorkT
///
private void PutIceCream(OrderLocInfo order)
{
- EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (res) =>
+ bool resultValue = true;
+ while (resultValue)
{
- if (res[0] is bool resultValue)
+ EventBus.EventBus.GetInstance().Publish(new LebaiRobot_GetInputEvent { DeviceId = DeviceId, Pin = 0 }, (res) =>
{
- while (resultValue)
+ if (res[0] is bool b)
{
- Thread.Sleep(500);
+ resultValue = b;
}
- }
- });
+ });
+ Thread.Sleep(500);
+ }
+
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = 10043 }); //SENCE_放冰淇淋位置
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 });
//订单状态改变:完成
OrderChange(order.SuborderId, ORDER_STATUS.COMPLETED_COOK);
+ morkT.waitMorkOrder = order;
DeviceProcessLogShow($"{order.GoodsName}等待取餐");
//WaitTakeMealOrder.Enqueue(order);
diff --git a/BPASmartClient.MorkT/GLV_MorkT.cs b/BPASmartClient.MorkT/GLV_MorkT.cs
index c825bbd2..f124da95 100644
--- a/BPASmartClient.MorkT/GLV_MorkT.cs
+++ b/BPASmartClient.MorkT/GLV_MorkT.cs
@@ -25,6 +25,10 @@ namespace BPASmartClient.MorkT
///
public ConcurrentQueue morkOrderPushesIceCream = new ConcurrentQueue();
///
+ /// 等待取餐订单
+ ///
+ public OrderLocInfo waitMorkOrder = null;
+ ///
/// 物料存放位置
///
public Dictionary batchings = new Dictionary();
@@ -44,6 +48,14 @@ namespace BPASmartClient.MorkT
/// 冰淇淋机器出料口传感器检测
///
public bool IceIsOK = true;
+ ///
+ /// 去咖啡杯成功
+ ///
+ public bool GetCoffeeCup;
+ ///
+ /// 取冰淇淋杯成功
+ ///
+ public bool GetIceCreamCup;
#region
diff --git a/BPASmartClient.MorkT/View/DebugView.xaml b/BPASmartClient.MorkT/View/DebugView.xaml
index 5a23087b..db1ee199 100644
--- a/BPASmartClient.MorkT/View/DebugView.xaml
+++ b/BPASmartClient.MorkT/View/DebugView.xaml
@@ -6,7 +6,7 @@
xmlns:vm ="clr-namespace:BPASmartClient.MorkT.ViewModel"
mc:Ignorable="d"
Name="调试界面"
- d:DesignHeight="450" d:DesignWidth="1000" >
+ d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
@@ -20,12 +20,13 @@
-
-
+
+
-
-
+
+
+
-
@@ -172,7 +173,7 @@
-
@@ -203,13 +204,13 @@
咖啡机状态
-
+ Text="{Binding CoffeeStatus}" Height="23" />
应用状态
+ Text="{Binding AppStatus}" Height="23"/>
告警信息
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkT/View/DebugView.xaml.cs b/BPASmartClient.MorkT/View/DebugView.xaml.cs
index c482d29d..b685bf7b 100644
--- a/BPASmartClient.MorkT/View/DebugView.xaml.cs
+++ b/BPASmartClient.MorkT/View/DebugView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPASmartClient.Helper;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -24,5 +25,11 @@ namespace BPASmartClient.MorkT.View
{
InitializeComponent();
}
+
+ private void Dubug_Unloaded(object sender, RoutedEventArgs e)
+ {
+ ThreadManage.GetInstance().StopTask("MorkT-状态刷新");
+ ThreadManage.GetInstance().StopTask("MorkT-传感器监视");
+ }
}
}
diff --git a/BPASmartClient.MorkT/View/Monitor.xaml b/BPASmartClient.MorkT/View/Monitor.xaml
new file mode 100644
index 00000000..4eaff171
--- /dev/null
+++ b/BPASmartClient.MorkT/View/Monitor.xaml
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.MorkT/View/Monitor.xaml.cs b/BPASmartClient.MorkT/View/Monitor.xaml.cs
new file mode 100644
index 00000000..b5d76d55
--- /dev/null
+++ b/BPASmartClient.MorkT/View/Monitor.xaml.cs
@@ -0,0 +1,34 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.MorkT.View
+{
+ ///
+ /// Monitor.xaml 的交互逻辑
+ ///
+ public partial class Monitor : UserControl
+ {
+ public Monitor()
+ {
+ InitializeComponent();
+ }
+
+
+ private void Monitor_Unloaded(object sender, RoutedEventArgs e)
+ {
+ }
+ }
+}
diff --git a/BPASmartClient.MorkT/View/ParSer.xaml b/BPASmartClient.MorkT/View/ParSer.xaml
new file mode 100644
index 00000000..8d87d132
--- /dev/null
+++ b/BPASmartClient.MorkT/View/ParSer.xaml
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/BPASmartClient.MorkT/View/ParSer.xaml.cs b/BPASmartClient.MorkT/View/ParSer.xaml.cs
new file mode 100644
index 00000000..ea8ef7c8
--- /dev/null
+++ b/BPASmartClient.MorkT/View/ParSer.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.MorkT.View
+{
+ ///
+ /// ParSer.xaml 的交互逻辑
+ ///
+ public partial class ParSer : UserControl
+ {
+ public ParSer()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs b/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
index 90913821..1f234724 100644
--- a/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
+++ b/BPASmartClient.MorkT/ViewModel/DebugViewModel.cs
@@ -9,6 +9,8 @@ using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.冰淇淋.Enum;
+using BPASmartClient.Model.单片机;
+using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -156,21 +158,100 @@ namespace BPASmartClient.MorkT.ViewModel
public List CoffeeCmds { get; set; } = new List();
public string SelectedCoffeeCmd { get; set; }
+ ///
+ /// 制作咖啡
+ ///
+ public RelayCommand Button_MakeCoffeeCommand { get; set; }
+ ///
+ /// 停止制作咖啡
+ ///
+ public RelayCommand Button_StopMakeCoffeCommand { get; set; }
+ ///
+ /// 咖啡模式设置
+ ///
+ public RelayCommand Button_CoffeeModeSetCommand { get; set; }
+
+ private void Button_MakeCoffee()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee)});
+ }
+ private void Button_StopMakeCoffe()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
+ }
+ private void Button_CoffeeModeSet()
+ {
+ EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd)});
+ }
#endregion
+ #region 单片机
///
- /// 设备ID
+ /// 咖啡杯或冰淇淋杯落杯
///
- public int DeviceId { get; set; }
+ public RelayCommand