diff --git a/BPASmartClient.GSIceCream/BPASmartClient.GSIceCream.csproj b/BPASmartClient.GSIceCream/BPASmartClient.GSIceCream.csproj
index 9fe941ae..8289875b 100644
--- a/BPASmartClient.GSIceCream/BPASmartClient.GSIceCream.csproj
+++ b/BPASmartClient.GSIceCream/BPASmartClient.GSIceCream.csproj
@@ -5,7 +5,8 @@
-
+
+
diff --git a/BPASmartClient.GSIceCream/CommandHandler.cs b/BPASmartClient.GSIceCream/CommandHandler.cs
deleted file mode 100644
index c4b8ad81..00000000
--- a/BPASmartClient.GSIceCream/CommandHandler.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using BPASmartClient.Message;
-using BPASmartClient.MessageCommunication;
-using BPASmartClient.MessageCommunication.MsgControl;
-using BPASmartClient.SerialPort;
-using System;
-using System.Threading;
-
-namespace BPASmartClient.GSIceCream
-{
- ///
- /// 指令封装
- ///
- internal class CommandHandler
- {
- byte[] cmdHeartDW;
-
- private SerialPortClient commProxy;
- public Action PauseAsk { get; set; }
-
- ///
- /// 初始化
- ///
- internal void Init(SerialPortClient commProxy)
- {
- this.commProxy = commProxy;
- ICMSG_Heart_DW heartDW = new ICMSG_Heart_DW();
- cmdHeartDW = IcPack.StructureToByte(heartDW);
- Class_InnerMessageBus.GetInstance().ListenMessage(this,Class_MessageName.GSIceCream_ModeSet,"ModeSetHandler");
- Class_InnerMessageBus.GetInstance().ListenMessage(this,Class_MessageName.GSIceCream_Discharge,"DischargeHandler");
- }
-
- ///
- /// 发送心跳
- ///
- internal byte[] GetHeartDW()
- {
- return cmdHeartDW;
- }
- ///
- /// 模式设置
- ///
- public void ModeSetHandler(object sender,InnerMessageEventArgs e)
- {
- try
- {
- if (e.obj_MessageObj is MORKI_MODE)
- {
- PauseAsk?.Invoke(true);
- Thread.Sleep(200);
- var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build((MORKI_MODE)(e.obj_MessageObj)));
- commProxy.SendData(data);
- Thread.Sleep(200);
- PauseAsk?.Invoke(false);
- MessageLog.GetInstance.Show(string.Format("设置模式[{0}]",Enum.GetName(typeof(MORKI_MODE),(MORKI_MODE)e.obj_MessageObj)));
- }
- }
- catch (Exception ex)
- {
- MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,ModeSetHandler 类,描述:[{ex.Message}]");
- }
- }
-
- ///
- /// 打料
- ///
- public void DischargeHandler(object sender,InnerMessageEventArgs e)
- {
- try
- {
- if (e.obj_MessageObj is MORKI_MODE)
- {
- if (MorkIStatus.GetInstance().Fault != MORKI_FAULT.未发生故障)
- {
- MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作",MorkIStatus.GetInstance().Fault));
- //callBack?.Invoke(false);
- return;
- }
- if (MorkIStatus.GetInstance().CXB <= 86)
- {
- MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作",MorkIStatus.GetInstance().CXB));
- //callBack?.Invoke(false);
- return;
- }
-
- bool modeRight = MorkIStatus.GetInstance().CurrentMode == MORKI_MODE.制冷模式;
-
- if (!modeRight)
- {
- PauseAsk?.Invoke(true);
- Thread.Sleep(200);
-
- var temp = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.制冷模式));
- commProxy.SendData(temp);
-
- Thread.Sleep(200);
- PauseAsk?.Invoke(false);
- MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.制冷模式));
-
- DateTime freeTime = DateTime.Now.AddSeconds(5);
- while (DateTime.Now < freeTime)
- {
- Thread.Sleep(10);
- modeRight = MorkIStatus.GetInstance().CurrentMode == MORKI_MODE.制冷模式;
- if (modeRight)
- break;
- }
- }
-
- if (modeRight)
- {
- PauseAsk?.Invoke(true);
- Thread.Sleep(200);
- var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料));
- commProxy.SendData(data);
- Thread.Sleep(200);
- PauseAsk?.Invoke(false);
- Class_InnerMessageBus.GetInstance().PostMessage(this,Class_MessageName.GSIceCream_EndCook,"");
- MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.打料));
- //callBack?.Invoke(true);
- }
- else
- {
- MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料",MorkIStatus.GetInstance().CurrentMode));
- //callBack?.Invoke(false);
- }
- }
- }
- catch (Exception ex)
- {
- MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,ModeSetHandler 类,描述:[{ex.Message}]");
- }
- }
- }
-}
diff --git a/BPASmartClient.GSIceCream/IceCreamMachine.cs b/BPASmartClient.GSIceCream/IceCreamMachine.cs
index dab7e5dc..85e80e0a 100644
--- a/BPASmartClient.GSIceCream/IceCreamMachine.cs
+++ b/BPASmartClient.GSIceCream/IceCreamMachine.cs
@@ -1,47 +1,76 @@
-using BPASmartClient.Helper;
+using BPASmartClient.EventBus;
+using BPASmartClient.Helper;
+using BPASmartClient.Message;
+using BPASmartClient.Model;
+using BPASmartClient.Peripheral;
using BPASmartClient.SerialPort;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading;
+using static BPASmartClient.EventBus.EventBus;
using static BPASmartClient.GSIceCream.MessageDefine;
namespace BPASmartClient.GSIceCream
{
- public class IceCreamMachine
- {
- //指令组装
- private CommandHandler commandHandler = new CommandHandler();
+ public class IceCreamMachine :BasePeripheral
+ {
//通讯代理
SerialPortClient commProxy = null;
+ //是否下发指令,主线程等待
+ private bool free = false;
+ //心跳指令
+ private byte[] cmdHeartDW;
//数据仓库
private DataStorage dataStorage = new DataStorage();
- //主线程运行标识
- private bool running = false;
- //是否下发指令,主线程等待
- private bool free = true;
- public Action SendCallback;
- public Action ReciveCallback;
+ //串口COM口
+ public string PortName { get; set; }
+ //串口波特率
+ public string BaudRate { get; set; }
+ //心跳时间
+ private DateTime lastRefreshTime = DateTime.MinValue;
+ //是否在线
+ public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } }
- public IceCreamMachine(string portName, BaudRates baud)
+ public IceCreamMachine()
{
- commProxy = new SerialPortClient(portName, baud);
- commProxy.SetDataStorage(dataStorage);
- commandHandler.Init(commProxy);
- commandHandler.PauseAsk = delegate (bool pause)
- {
- free = !pause;
- };
+ ICMSG_Heart_DW heartDW = new ICMSG_Heart_DW();
+ cmdHeartDW = IcPack.StructureToByte(heartDW);
}
- public void Start()
+ ///
+ /// 主线程开始运行
+ ///
+ public override void Start()
{
- commProxy.Start();
- running = true;
- MainLoop();
+ try
+ {
+ commProxy.Start();
+ IsConnected = true;
+ free = false;
+ MainLoop();
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
+ }
}
- public void Stop()
+ ///
+ /// 停止运行
+ ///
+ public override void Stop()
{
+ try
+ {
+ commProxy.Stop();
+ IsConnected = false;
+ free = true;
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
+ }
}
private MSG_RESOLVE_STEP currentStep;
@@ -49,10 +78,9 @@ namespace BPASmartClient.GSIceCream
{
ThreadManage.GetInstance.StartLong(new Action(() =>
{
- if (free)
+ if (!free)
{
- commProxy.SendData(commandHandler.GetHeartDW());
- SendCallback?.Invoke(BitConverter.ToString(commandHandler.GetHeartDW()));
+ commProxy.SendData(cmdHeartDW);
}
Thread.Sleep(500);
}), "冰淇淋询问线程");
@@ -60,16 +88,12 @@ namespace BPASmartClient.GSIceCream
ThreadManage.GetInstance.StartLong(new Action(() =>
{
ResolveMsg();
- //Thread.Sleep(2000);
}), "冰淇淋解析线程");
}
int contentLength = 0;
int currentContentOffset = 0;
private void ResolveMsg()
{
-
- //while (running)
- //{
List temp = new List();
//一系列解包
while (dataStorage.GetSize() > 0)
@@ -142,13 +166,168 @@ namespace BPASmartClient.GSIceCream
}
temp.Add(dataStorage.GetData());
temp.Add(dataStorage.GetData());
- ReciveCallback?.Invoke(BitConverter.ToString(temp.ToArray()));
- MorkIStatus.GetInstance().ProcessMsg(temp.ToArray());
+ ProcessMsg(temp.ToArray());
currentStep = MSG_RESOLVE_STEP.NONE;
continue;
}
Thread.Sleep(5);
- //}
+ }
+
+ private void ProcessHeart(ICMSG_Heart_UP heartUpMsg)
+ {
+ status["CurrentMode"] = heartUpMsg.MS;
+ status["YLWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L,heartUpMsg.YLWD_H },0);
+ status["HQWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L,heartUpMsg.HQWD_H },0);
+ status["HJWD"] = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L,heartUpMsg.HJWD_H },0);
+ status["DL"] = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L,heartUpMsg.DL_H },0);
+ status["Fault"] = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L,heartUpMsg.GZ_H },0);
+ status["CXB"] = heartUpMsg.CXB;
+ status["DLCompleted"] = (heartUpMsg.DLTJ >> 4 & 1) == 1;
+
+ if (RTrig.GetInstance("打料完成检测").Start((bool)status["DLCompleted"]))
+ {
+ MessageLog.GetInstance.Show("打料完成");
+ }
+
+ if (RTrig.GetInstance("打料中检测").Start(!(bool)status["DLCompleted"]))
+ {
+ MessageLog.GetInstance.Show("打料中");
+ }
+ }
+
+ private void ProcessModeUp(ICMSG_MODE_UP modeUpMsg)
+ {
+ MessageLog.GetInstance.Show(string.Format("模式返回为:{0}",modeUpMsg.Mode));
+ }
+
+ public void ProcessMsg(byte[] data)
+ {
+ lastRefreshTime = DateTime.Now;
+ try
+ {
+ if (data.Length < 5)
+ return;
+ switch (data[2])
+ {
+ case (byte)IC_CMD.HEART:
+ var msg = IcPack.ByteToStructure(data.ToArray());
+ ProcessHeart(msg);
+ break;
+ case (byte)IC_CMD.MODE:
+ var modeUp = IcPack.ByteToStructure(data.ToArray());
+ ProcessModeUp(modeUp);
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+
+ protected override void InitStatus()
+ {
+ status["YLWD"] = (short)0;
+ status["HQWD"] = (short)0;
+ status["HJWD"] = (short)0;
+ status["DL"] = (short)0;
+ status["DY"] = (short)0;
+ status["CurrentMode"] = MORKI_MODE.待机模式;
+ status["Fault"] = MORKI_FAULT.未发生故障;
+ status["CXB"] = (byte)0;
+ status["CXB_Threshold"] = (byte)0;
+ status["DLCompleted"] = true;
+ }
+
+ public override void Init()
+ {
+ commProxy = new SerialPortClient(PortName,(BaudRates)Enum.Parse(typeof(BaudRates),BaudRate));
+ commProxy.SetDataStorage(dataStorage);
+
+
+ //广深冰淇淋机模式设置
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
+ {
+ try
+ {
+ free = true;
+ Thread.Sleep(200);
+ var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build((MORKI_MODE)((GSIceCream_ModeSetEvent)@event).Mode));
+ commProxy.SendData(data);
+ Thread.Sleep(200);
+ free = false;
+ MessageLog.GetInstance.Show(string.Format("设置模式[{0}]",Enum.GetName(typeof(MORKI_MODE),(MORKI_MODE)((GSIceCream_ModeSetEvent)@event).Mode)));
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
+ }
+ });
+
+ //广深冰淇淋机打料
+ EventBus.EventBus.GetInstance().Subscribe(DeviceId,delegate (IEvent @event,EventCallBackHandle callBack)
+ {
+ try
+ {
+ if ((MORKI_FAULT)status["Fault"] != MORKI_FAULT.未发生故障)
+ {
+ MessageLog.GetInstance.Show(string.Format("当前存在故障[{0}%],不允许制作",(MORKI_FAULT)status["Fault"]));
+ new GSIceCream_EndCookEvent() { Id = DeviceId,Status = false }.Publish();
+ return;
+ }
+ if ((byte)status["CXB"] <= 86)
+ {
+ MessageLog.GetInstance.Show(string.Format("当前成型比[{0}%],低于86%,不允许制作",(byte)status["CXB"]));
+ new GSIceCream_EndCookEvent() { Id = DeviceId,Status = false }.Publish();
+ return;
+ }
+
+ bool modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式;
+
+ if (!modeRight)
+ {
+ free = true;
+ Thread.Sleep(200);
+
+ var temp = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.制冷模式));
+ commProxy.SendData(temp);
+
+ Thread.Sleep(200);
+ free = false;
+ MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.制冷模式));
+
+ DateTime freeTime = DateTime.Now.AddSeconds(5);
+ while (DateTime.Now < freeTime)
+ {
+ Thread.Sleep(10);
+ modeRight = (MORKI_MODE)status["CurrentMode"] == MORKI_MODE.制冷模式;
+ if (modeRight)
+ break;
+ }
+ }
+
+ if (modeRight)
+ {
+ free = true;
+ Thread.Sleep(200);
+ var data = IcPack.StructureToByte(ICMSG_MODE_DW.Build(MORKI_MODE.打料));
+ commProxy.SendData(data);
+ Thread.Sleep(200);
+ free = false;
+ new GSIceCream_EndCookEvent() { Id = DeviceId,Status =true}.Publish();
+ MessageLog.GetInstance.Show(string.Format("出料操作->设置模式[{0}]",MORKI_MODE.打料));
+ }
+ else
+ {
+ MessageLog.GetInstance.Show(string.Format("出料操作->模式切换失败,当前模式[{0}],不允许出料",(MORKI_MODE)status["CurrentMode"]));
+ new GSIceCream_EndCookEvent() { Id = DeviceId,Status = false }.Publish();
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.Show($"BPASmartClient.GSIceCream 中引发错误,IceCreamMachine 类,描述:[{ex.Message}]");
+ }
+ });
}
}
diff --git a/BPASmartClient.GSIceCream/MorkIStatus.cs b/BPASmartClient.GSIceCream/MorkIStatus.cs
deleted file mode 100644
index 0057533b..00000000
--- a/BPASmartClient.GSIceCream/MorkIStatus.cs
+++ /dev/null
@@ -1,130 +0,0 @@
-using BPASmartClient.Helper;
-using BPASmartClient.Message;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using static BPASmartClient.GSIceCream.MessageDefine;
-
-namespace BPASmartClient.GSIceCream
-{
- public class MorkIStatus
- {
- private volatile static MorkIStatus _Instance;
- public static MorkIStatus GetInstance() => _Instance ?? (_Instance = new MorkIStatus());
- private MorkIStatus() { }
- private DateTime lastRefreshTime = DateTime.MinValue;
- ///
- /// 是否在线
- ///
- public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } }
- ///
- /// 预冷温度
- ///
- public short YLWD { get; set; }
- ///
- /// 回气温度
- ///
- public short HQWD { get; set; }
- ///
- /// 环境温度
- ///
- public short HJWD { get; set; }
- ///
- /// 电流
- ///
- public short DL { get; set; }
- ///
- /// 电压
- ///
- public short DY { get; set; }
- ///
- /// 当前模式
- ///
- public MORKI_MODE CurrentMode { get; set; }
- ///
- /// 故障
- ///
- public MORKI_FAULT Fault { get; set; }
- ///
- /// 成型比
- ///
- public byte CXB { get; set; }
- ///
- /// 成型比(门限)
- ///
- public byte CXB_Threshold { get; set; }
- ///
- /// 打料完成(完成为true,正在打料为false)
- ///
- public bool DLCompleted { get; set; }
-
-
- public bool CanDo
- {
- get
- {
- if (!OnLine)
- return false;
- if (Fault != MORKI_FAULT.未发生故障)
- return false;
- if (CXB < CXB_Threshold)
- return false;
- return true;
- }
- }
-
- private void ProcessHeart(ICMSG_Heart_UP heartUpMsg)
- {
- CurrentMode = heartUpMsg.MS;
- YLWD = BitConverter.ToInt16(new byte[] { heartUpMsg.YLWD_L, heartUpMsg.YLWD_H }, 0);
- HQWD = BitConverter.ToInt16(new byte[] { heartUpMsg.HQWD_L, heartUpMsg.HQWD_H }, 0);
- HJWD = BitConverter.ToInt16(new byte[] { heartUpMsg.HJWD_L, heartUpMsg.HJWD_H }, 0);
- DL = BitConverter.ToInt16(new byte[] { heartUpMsg.DL_L, heartUpMsg.DL_H }, 0);
- Fault = (MORKI_FAULT)BitConverter.ToInt16(new byte[] { heartUpMsg.GZ_L, heartUpMsg.GZ_H }, 0);
- CXB = heartUpMsg.CXB;
- DLCompleted = (heartUpMsg.DLTJ >> 4 & 1) == 1;
-
- if (RTrig.GetInstance("打料完成检测").Start(DLCompleted))
- {
- MessageLog.GetInstance.Show("打料完成");
- }
-
- if(RTrig.GetInstance("打料中检测").Start(!DLCompleted))
- {
- MessageLog.GetInstance.Show("打料中");
- }
- }
-
- private void ProcessModeUp(ICMSG_MODE_UP modeUpMsg)
- {
- MessageLog.GetInstance.Show(string.Format("模式返回为:{0}", modeUpMsg.Mode));
- }
-
- public void ProcessMsg(byte[] data)
- {
- lastRefreshTime = DateTime.Now;
- try
- {
- if (data.Length < 5)
- return;
- switch (data[2])
- {
- case (byte)IC_CMD.HEART:
- var msg = IcPack.ByteToStructure(data.ToArray());
- ProcessHeart(msg);
- break;
- case (byte)IC_CMD.MODE:
- var modeUp = IcPack.ByteToStructure(data.ToArray());
- ProcessModeUp(modeUp);
- break;
- }
- }
- catch (Exception ex)
- {
-
- }
- }
- }
-}
diff --git a/BPASmartClient.KLMCoffee/BPASmartClient.KLMCoffee.csproj b/BPASmartClient.KLMCoffee/BPASmartClient.KLMCoffee.csproj
index 9fe941ae..8289875b 100644
--- a/BPASmartClient.KLMCoffee/BPASmartClient.KLMCoffee.csproj
+++ b/BPASmartClient.KLMCoffee/BPASmartClient.KLMCoffee.csproj
@@ -5,7 +5,8 @@
-
+
+
diff --git a/BPASmartClient.KLMCoffee/CoffeeMachine.cs b/BPASmartClient.KLMCoffee/CoffeeMachine.cs
new file mode 100644
index 00000000..4742fc4d
--- /dev/null
+++ b/BPASmartClient.KLMCoffee/CoffeeMachine.cs
@@ -0,0 +1,36 @@
+using BPASmartClient.Helper;
+using BPASmartClient.SerialPort;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.KLMCoffee
+{
+ public class CoffeeMachine
+ {
+ //通讯代理
+ SerialPortClient commProxy = null;
+ //数据仓库
+ private DataStorage dataStorage = new DataStorage();
+ //是否下发指令,主线程等待
+ private bool free = false;
+ //状态询问指令
+ private byte[] cmdAsk;
+ //串口COM口
+ public string PortName { get; set; }
+ //串口波特率
+ public string BaudRate { get; set; }
+ //心跳时间
+ private DateTime lastRefreshTime = DateTime.MinValue;
+ //是否在线
+ public bool OnLine { get { return DateTime.Now.Subtract(lastRefreshTime).TotalSeconds <= 3; } }
+ public CoffeeMachine()
+ {
+
+ }
+
+
+ }
+}
diff --git a/BPASmartClient.KLMCoffee/CommandEvent.cs b/BPASmartClient.KLMCoffee/CommandEvent.cs
deleted file mode 100644
index e96c5a29..00000000
--- a/BPASmartClient.KLMCoffee/CommandEvent.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using BPASmartClient.KLMCoffee.Protocal;
-
-namespace BPASmartClient.KLMCoffee
-{
- ///
- /// 制作咖啡
- ///
- public class MakeCoffeeEvent
- {
- public DrinkType DrinkCode { get; set; }
- }
-
- ///
- /// 取消制作
- ///
- public class CancelMakeCoffeeEvent
- {
-
- }
-
- ///
- /// 模式设置
- ///
- public class CoffeeCommCmdEvent
- {
- //public DrCoffeeCommCmd CommCmd { get; set; }
- }
-
- ///
- /// 开始制作
- ///
- public class CoffeBeginCook
- {
-
- }
-
- ///
- /// 结束制作
- ///
- public class CoffeEndCook
- {
-
- }
-}
diff --git a/BPASmartClient.KLMCoffee/CommandHandler.cs b/BPASmartClient.KLMCoffee/CommandHandler.cs
deleted file mode 100644
index 23b23675..00000000
--- a/BPASmartClient.KLMCoffee/CommandHandler.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using BPASmartClient.KLMCoffee.Protocal;
-using BPASmartClient.MessageCommunication;
-using BPASmartClient.MessageCommunication.MsgControl;
-using BPASmartClient.SerialPort;
-using System;
-using System.Threading;
-
-namespace BPASmartClient.KLMCoffee
-{
- ///
- /// 指令封装
- ///
- internal class CommandHandler
- {
- byte[] cmdAsk;
- private SerialPortClient commProxy;
- private K95Command drinksOrder = new K95Command();
- public Action PauseAsk { get; set; }
-
- ///
- /// 初始化
- ///
- internal void Init(SerialPortClient commProxy)
- {
- this.commProxy = commProxy;
- Class_InnerMessageBus.GetInstance().ListenMessage(this,Class_MessageName.KLMCoffee_MakeCoffee,"MakeCoffeeHandler");
- Class_InnerMessageBus.GetInstance().ListenMessage(this,Class_MessageName.KLMCoffee_CancelMakeCoffee,"CancelMakeCoffeeHandler");
- Class_InnerMessageBus.GetInstance().ListenMessage(this,Class_MessageName.KLMCoffee_CoffeeCommCmd,"CoffeeCommCmdHandler");
- }
-
- /////
- ///// 制作咖啡
- /////
- //public void MakeCoffeeHandler(object sender,InnerMessageEventArgs e)
- //{
- // try
- // {
- // if (e.obj_MessageObj is MakeCoffeeEvent)
- // {
- // PauseAsk?.Invoke(true);
- // Thread.Sleep(200);
- // drinksOrder.ReturnsCommandData(K95CommandEnum.配方咖啡制作.GetString(),new new RecipeModel().Packe
- // );
- // drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;
- // drinksOrder.DrinksCode = (DrCoffeeDrinksCode)int.Parse(e.obj_MessageObj.ToString());
- // commProxy.SendData(DrCoffee.Packe(drinksOrder));
- // Thread.Sleep(200);
- // PauseAsk?.Invoke(false);
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageLog.GetInstance.Show($"BPASmartClient.DRCoffee 中引发错误,CancelMakeCoffeeHandler 类,描述:[{ex.Message}]");
- // }
- //}
-
- /////
- ///// 取消制作
- /////
- //public void CancelMakeCoffeeHandler(object sender,InnerMessageEventArgs e)
- //{
- // try
- // {
- // PauseAsk?.Invoke(true);
- // Thread.Sleep(200);
- // drinksOrder.CommCmd = DrCoffeeCommCmd.取消应用指令;
- // drinksOrder.DrinksCode = 0;
- // commProxy.SendData(DrCoffee.Packe(drinksOrder));
- // Thread.Sleep(200);
- // PauseAsk?.Invoke(false);
- // }
- // catch (Exception ex)
- // {
- // MessageLog.GetInstance.Show($"BPASmartClient.DRCoffee 中引发错误,CancelMakeCoffeeHandler 类,描述:[{ex.Message}]");
- // }
- //}
-
- /////
- ///// 模式设置
- /////
- /////
- /////
- //public void CoffeeCommCmdHandler(object sender,InnerMessageEventArgs e)
- //{
- // try
- // {
- // if (e.obj_MessageObj is string)
- // {
- // PauseAsk?.Invoke(true);
- // Thread.Sleep(200);
- // drinksOrder.CommCmd = (DrCoffeeCommCmd)int.Parse(e.obj_MessageObj.ToString());
- // commProxy.SendData(DrCoffee.Packe(drinksOrder));
- // Thread.Sleep(200);
- // PauseAsk?.Invoke(false);
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageLog.GetInstance.Show($"BPASmartClient.DRCoffee 中引发错误,CoffeeCommCmdHandler 类,描述:[{ex.Message}]");
- // }
- //}
-
- ///
- /// 发送状态询问
- ///
- internal byte[] GetStatusAsk()
- {
- return cmdAsk;
- }
- }
-}
diff --git a/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs b/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs
index 447dea1d..a4b413e9 100644
--- a/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs
+++ b/BPASmartClient.Model/冰淇淋/GSIceCreamEvent.cs
@@ -17,7 +17,7 @@ namespace BPASmartClient.Model
///
public class GSIceCream_ModeSetEvent :BaseEvent
{
-
+ public byte Mode { get; set; }
}
///
@@ -33,6 +33,9 @@ namespace BPASmartClient.Model
///
public class GSIceCream_EndCookEvent :BaseEvent
{
-
+ ///
+ /// 状态:true 成功 false 失败
+ ///
+ public bool Status { get; set; }
}
}