diff --git a/HBLConsole.Communication/ConnectHelper.cs b/HBLConsole.Communication/ConnectHelper.cs
index dd242fa..5cfca89 100644
--- a/HBLConsole.Communication/ConnectHelper.cs
+++ b/HBLConsole.Communication/ConnectHelper.cs
@@ -8,7 +8,6 @@ using HBLConsole.Model;
using System.Threading;
using HBLConsole.GVL;
-
namespace HBLConsole.Communication
{
public class ConnectHelper
diff --git a/HBLConsole.Communication/MCUSerialHelper.cs b/HBLConsole.Communication/MCUSerialHelper.cs
index 4bcc6ac..aa7167a 100644
--- a/HBLConsole.Communication/MCUSerialHelper.cs
+++ b/HBLConsole.Communication/MCUSerialHelper.cs
@@ -81,10 +81,10 @@ namespace HBLConsole.Communication
/// 获取单片机输入端口状态
///
///
- ///
- public bool GetInputStatus(byte index)
+ /// 0:无意义 1:有信号 2:无信号 3:信号不正确
+ public int GetInputStatus(byte index)
{
- if (index <= 0 || index > 8) return false;
+ if (index <= 0 || index > 8) return 0;
byte[] buffers = new byte[6] { 0xCC, 0x01, 0x03, index, 0x00, 0xDD };
if (IsOpen)
{
@@ -107,11 +107,31 @@ namespace HBLConsole.Communication
if (Reindex < receive.Count && Reindex >= 0)
{
var res = receive.GetRange(Array.FindIndex(receive.ToArray(), p => p == 0xcc), 6);
- return res != null && res.Count() == 6 && res.ElementAt(4) == 0x01;
+ if (res.ElementAt(2) == 0x03)
+ {
+ if (res != null && res.Count() == 6 && res.ElementAt(4) == 0x01)
+ {
+ return 1;
+ }
+ else if (res != null && res.Count() == 6 && res.ElementAt(4) == 0x00)
+ {
+ return 2;
+ }
+
+ }
+ else
+ {
+ return 3;
+ }
+
+ }
+ else
+ {
+ return 0;
}
}
}
- return false;
+ return 0;
}
}
}
diff --git a/HBLConsole.Debug/Debug_MORKJC.xaml.cs b/HBLConsole.Debug/Debug_MORKJC.xaml.cs
index 2331e4a..2608a10 100644
--- a/HBLConsole.Debug/Debug_MORKJC.xaml.cs
+++ b/HBLConsole.Debug/Debug_MORKJC.xaml.cs
@@ -15,6 +15,8 @@ using HBLConsole.Communication;
using System.Threading;
using HBLConsole.Model;
using HBLConsole.Service;
+using HBLDevice.Coffee;
+using BPA.Message;
namespace HBLConsole.Debug
{
///
@@ -22,148 +24,221 @@ namespace HBLConsole.Debug
///
public partial class Debug_MORKJC : UserControl
{
+
public Debug_MORKJC()
{
InitializeComponent();
}
+ DateTime dt;
private void Wait(int value)
{
+ dt = DateTime.Now;
while (!((JaKaHelper.GetInstance.Get_RobotAO1() == value) && JaKaHelper.GetInstance.GetProgramStatus() == 0))//判断文件是否已经执行结束 且 文件末端变量值==文件名
{
Thread.Sleep(5);
+ if (DateTime.Now.Subtract(dt).TotalSeconds >= 600) break;
}
}
+ private AutoResetEvent are = new AutoResetEvent(false);
+ private CoffeeMachine coffeeMachine1;
+
+ private void CoffeEndCookHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
+ {
+ are.Set();
+ }
private void Btn_Coffee_Click(object sender, RoutedEventArgs e)
{
+ /*EventBus.GetInstance().Subscribe(CoffeEndCookHandle);
+ are.Reset();
+ System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
+ var com_Coffee = config.AppSettings.Settings["COM_Coffee"].Value;
+ var baud_Coffee = config.AppSettings.Settings["BAUD_Coffee"].Value;
+ coffeeMachine1 = new CoffeeMachine(com_Coffee, (BaudRates)Enum.Parse(typeof(BaudRates), baud_Coffee));
+ coffeeMachine1.Start();*/
+
+ int a1=MCUSerialHelper.GetInstance.GetInputStatus(1);
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
JaKaHelper.GetInstance.Set_RobotAO1(0);
Wait(0);
+
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
+ MCUSerialHelper.GetInstance.OutputControl(1, true);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接咖啡);
- Wait(int.Parse(JaKaHelper.SENCE_接咖啡));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放咖啡杯);
- Wait(int.Parse(JaKaHelper.SENCE_放咖啡杯));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
- Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
- Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ int a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (a2 == 3)
+ {
+ Thread.Sleep(100);
+ a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ }
+ if (a2==1)
+ {
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接咖啡);
+ Wait(int.Parse(JaKaHelper.SENCE_接咖啡));
+ new MakeCoffeeEvent() { DrinkCode = DrCoffeeDrinksCode.热水 }.Publish(); //接咖啡控制
+ are.WaitOne(1000 * 60);
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放咖啡杯);
+ Wait(int.Parse(JaKaHelper.SENCE_放咖啡杯));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
+ Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
+ }
+ int a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (a3 == 1)
+ {
+ Thread.Sleep(100);
+ a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ }
+ if (a3 == 2)
+ {
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ }
}
int[] devStatusBy=new int[2] { 0,0};
private void Btn_Juicer_Click(object sender, RoutedEventArgs e)
{
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
+
+ MCUSerialHelper.GetInstance.OutputControl(1, true);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
- byte JuicerNum = byte.Parse(txtJuicerNum.Text.Trim().ToString());
- int JuicerNum1 = int.Parse(txtJuicerNum.Text.Trim().ToString());
- switch (JuicerNum1)
+ int a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (a2 == 3 || a2 == 2)
{
- case 0:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
- break;
- case 1:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
- break;
- case 2:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁2);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁2));
- break;
- case 3:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁2);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁2));
- break;
- case 4:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁3);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁3));
- break;
- case 5:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁3);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁3));
- break;
- case 6:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁4);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁4));
- break;
- case 7:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁4);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁4));
- break;
- default:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
- Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
- break;
+ Thread.Sleep(100);
+ a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
}
- var devStatus = JuicerHelper.GetInstance.GetDeviceStatus();
- var devStatus1 = Convert.ToString(devStatus[0], 2);
- var devStatus2 = devStatus[1];
-
- if (devStatus1.IndexOf("0") == 1&& devStatus2==0)
+ if (a2 == 1)
{
- JuicerHelper.GetInstance.StartCook(JuicerNum);
- Thread.Sleep(100);
- devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
- while (!(devStatusBy[1]==0))
- {
- Thread.Sleep(100);
- devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
- while (devStatusBy.Length != 2)
- {
- Thread.Sleep(100);
- devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
- }
- }
- devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
- Thread.Sleep(1000);
+ byte JuicerNum = byte.Parse(txtJuicerNum.Text.Trim().ToString());
+ int JuicerNum1 = int.Parse(txtJuicerNum.Text.Trim().ToString());
switch (JuicerNum1)
{
case 0:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
break;
case 1:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
break;
case 2:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯2);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯2));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁2);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁2));
break;
case 3:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯2);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯2));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁2);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁2));
break;
case 4:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯3);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯3));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁3);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁3));
break;
case 5:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯3);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯3));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁3);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁3));
break;
case 6:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯4);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯4));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁4);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁4));
break;
case 7:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯4);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯4));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁4);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁4));
break;
default:
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
- Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接果汁1);
+ Wait(int.Parse(JaKaHelper.SENCE_接果汁1));
break;
}
+ var devStatus = JuicerHelper.GetInstance.GetDeviceStatus();
+ var devStatus1 = Convert.ToString(devStatus[0], 2);
+ var devStatus2 = devStatus[1];
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
- Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
- Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ if (devStatus1.IndexOf("0") == 1 && devStatus2 == 0)
+ {
+ JuicerHelper.GetInstance.StartCook(JuicerNum);
+ Thread.Sleep(100);
+ devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
+ while (!(devStatusBy[1] == 0))
+ {
+ Thread.Sleep(100);
+ devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
+ while (devStatusBy.Length != 2)
+ {
+ Thread.Sleep(100);
+ devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
+ }
+ }
+ devStatusBy = JuicerHelper.GetInstance.GetDeviceStatus();
+ Thread.Sleep(1000);
+ switch (JuicerNum1)
+ {
+ case 0:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ break;
+ case 1:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ break;
+ case 2:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯2);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯2));
+ break;
+ case 3:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯2);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯2));
+ break;
+ case 4:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯3);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯3));
+ break;
+ case 5:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯3);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯3));
+ break;
+ case 6:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯4);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯4));
+ break;
+ case 7:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯4);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯4));
+ break;
+ default:
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放果汁杯1);
+ Wait(int.Parse(JaKaHelper.SENCE_放果汁杯1));
+ break;
+ }
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
+ Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
+ int a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (a3 == 1)
+ {
+ Thread.Sleep(100);
+ a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ }
+ if (a3 == 2)
+ {
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ }
+ }
+
}
MessageLog.GetInstance.Show("测试流程执行完成");
}
@@ -178,7 +253,7 @@ namespace HBLConsole.Debug
Thread.Sleep(1000);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
- while (!MCUSerialHelper.GetInstance.GetInputStatus(1))
+ while (!(MCUSerialHelper.GetInstance.GetInputStatus(1)==1))
{
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
@@ -199,15 +274,22 @@ namespace HBLConsole.Debug
Wait(int.Parse(JaKaHelper.SENCE_接茶_接水));
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接水);
Wait(int.Parse(JaKaHelper.SENCE_接水));
-
+ MCUSerialHelper.GetInstance.OutputControl(3, false);
+ MCUSerialHelper.GetInstance.OutputControl(2, false);
+ Thread.Sleep(100);
MCUSerialHelper.GetInstance.OutputControl(2,true);
- Thread.Sleep(1000);
+ Thread.Sleep(3000);
MCUSerialHelper.GetInstance.OutputControl(2, false);
- Thread.Sleep(1000);
+ Thread.Sleep(100);
+
+ MCUSerialHelper.GetInstance.OutputControl(3, false);
+ Thread.Sleep(100);
MCUSerialHelper.GetInstance.OutputControl(3,true);
- Thread.Sleep(1000);
+ Thread.Sleep(500);
MCUSerialHelper.GetInstance.OutputControl(3, false);
- Thread.Sleep(3000);
+
+ Thread.Sleep(60000);
+
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放水杯);
Wait(int.Parse(JaKaHelper.SENCE_放水杯));
MCUSerialHelper.GetInstance.OutputControl(1, false);
@@ -224,11 +306,11 @@ namespace HBLConsole.Debug
Wait(0);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
- MCUSerialHelper.GetInstance.OutputControl(1, true);
+
Thread.Sleep(1000);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
- while (!MCUSerialHelper.GetInstance.GetInputStatus(1))
+ while (!(MCUSerialHelper.GetInstance.GetInputStatus(1)==1))
{
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
diff --git a/HBLConsole.MORKJC/Control_MORKJC.cs b/HBLConsole.MORKJC/Control_MORKJC.cs
index bcd286f..590e7f0 100644
--- a/HBLConsole.MORKJC/Control_MORKJC.cs
+++ b/HBLConsole.MORKJC/Control_MORKJC.cs
@@ -178,8 +178,11 @@ namespace HBLConsole.MORKJC
{
GeneralConfig.Healthy =
JaKaHelper.GetInstance.IsConnected &&
- MorkCStatus.GetInstance().CanDo;
- //GeneralConfig.Healthy = true;
+ /* MorkCStatus.GetInstance().CanDo &&
+ JuicerHelper.GetInstance.IsOpen &&*/
+ MCUSerialHelper.GetInstance.IsOpen;
+
+ // GeneralConfig.Healthy = true;
Thread.Sleep(100);
}), "MORK-IC心跳刷新");
ThreadManage.GetInstance.Start(new Action(() =>
@@ -231,38 +234,51 @@ namespace HBLConsole.MORKJC
int checkeNum = 0;
are.Reset();
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
JaKaHelper.GetInstance.Set_RobotAO1(0);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
-
+ MCUSerialHelper.GetInstance.OutputControl(1, true);
Thread.Sleep(500);
MessageLog.GetInstance.Show("咖啡杯取杯完成");
- p:
+
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
-
- if (!LebaiHelper.GetInstance.GetTcpInput())
+ int a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (MCUSerialHelper.GetInstance.GetInputStatus(1) == 3)
{
- MessageLog.GetInstance.Show("执行二次取咖啡杯");
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
- Wait(int.Parse(JaKaHelper.SENCE_取杯));
- goto p;
+ Thread.Sleep(100);
+ a2 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ }
+ if (a2 == 1)
+ {
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接咖啡);
+ Wait(int.Parse(JaKaHelper.SENCE_接咖啡));
+ new MakeCoffeeEvent() { DrinkCode = DrCoffeeDrinksCode.热水 }.Publish(); //接咖啡控制
+ are.WaitOne(1000 * 60);
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放咖啡杯);
+ Wait(int.Parse(JaKaHelper.SENCE_放咖啡杯));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
+ Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
+ int a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ while (a3 == 1)
+ {
+ Thread.Sleep(100);
+ a3 = MCUSerialHelper.GetInstance.GetInputStatus(1);
+ }
+ if (a3 == 2)
+ {
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ }
+ //订单状态改变:完成
+ SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
}
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接咖啡);
- Wait(int.Parse(JaKaHelper.SENCE_接咖啡));
-
- new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制
- are.WaitOne(1000 * 180);
-
- Thread.Sleep(3000);
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放咖啡杯);
- Wait(int.Parse(JaKaHelper.SENCE_放咖啡杯));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
- Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
- Wait(int.Parse(JaKaHelper.SENCE_初始位));
- //订单状态改变:完成
- SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
#endregion
}
///
@@ -270,26 +286,30 @@ namespace HBLConsole.MORKJC
///
private void DoTea()
{
- if (JaKaHelper.GetInstance.Get_RobotDI(1))
- return;
#region 流程
- are.Reset();
- JaKaHelper.GetInstance.Set_RobotAO1(0);
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
+ JaKaHelper.GetInstance.Set_RobotAO1(0);
+ Wait(0);
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
+ Wait(int.Parse(JaKaHelper.SENCE_初始位));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
+
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
-
- Thread.Sleep(500);
- MessageLog.GetInstance.Show("茶水杯取杯完成");
- p:
+ MCUSerialHelper.GetInstance.OutputControl(1, true);
+ Thread.Sleep(1000);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
- if (!LebaiHelper.GetInstance.GetTcpInput())
+ while (MCUSerialHelper.GetInstance.GetInputStatus(1) == 3)
+ {
+ Thread.Sleep(100);
+ }
+ while ((MCUSerialHelper.GetInstance.GetInputStatus(1) == 2))
{
- MessageLog.GetInstance.Show("执行二次取茶水杯");
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯);
Wait(int.Parse(JaKaHelper.SENCE_取杯));
- goto p;
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_取杯检测);
+ Wait(int.Parse(JaKaHelper.SENCE_取杯检测));
}
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接茶);
Wait(int.Parse(JaKaHelper.SENCE_接茶));
@@ -299,28 +319,39 @@ namespace HBLConsole.MORKJC
MCUSerialHelper.GetInstance.ServoControl(1, 130);
Thread.Sleep(1000);
MCUSerialHelper.GetInstance.ServoControl(1, 105);
+
+ Thread.Sleep(3000);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接茶_接水);
Wait(int.Parse(JaKaHelper.SENCE_接茶_接水));
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_接水);
Wait(int.Parse(JaKaHelper.SENCE_接水));
+ MCUSerialHelper.GetInstance.OutputControl(3, false);
+
+ MCUSerialHelper.GetInstance.OutputControl(2, false);
+ Thread.Sleep(100);
MCUSerialHelper.GetInstance.OutputControl(2, true);
- Thread.Sleep(1000);
+ Thread.Sleep(3000);
MCUSerialHelper.GetInstance.OutputControl(2, false);
- Thread.Sleep(1000);
+ Thread.Sleep(100);
+
+ MCUSerialHelper.GetInstance.OutputControl(3, false);
+ Thread.Sleep(100);
MCUSerialHelper.GetInstance.OutputControl(3, true);
- Thread.Sleep(1000);
+ Thread.Sleep(500);
MCUSerialHelper.GetInstance.OutputControl(3, false);
- Thread.Sleep(3000);
- are.WaitOne(1000 * 180);
- //添加控制接水机构程序
- JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放茶水杯);
- Wait(int.Parse(JaKaHelper.SENCE_放茶水杯));
+ Thread.Sleep(60000);
+
+ JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放水杯);
+ Wait(int.Parse(JaKaHelper.SENCE_放水杯));
+ MCUSerialHelper.GetInstance.OutputControl(1, false);
+ Thread.Sleep(1000);
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_放杯检测);
Wait(int.Parse(JaKaHelper.SENCE_放杯检测));
JaKaHelper.GetInstance.JaKaProgramName(JaKaHelper.SENCE_初始位);
Wait(int.Parse(JaKaHelper.SENCE_初始位));
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
+
#endregion
}
diff --git a/HBLConsole.MainConsole/Main.cs b/HBLConsole.MainConsole/Main.cs
index 921c849..5a9d572 100644
--- a/HBLConsole.MainConsole/Main.cs
+++ b/HBLConsole.MainConsole/Main.cs
@@ -71,39 +71,38 @@ namespace HBLConsole.MainConsole
ThreadManage.GetInstance.Start(new Action(() =>
{
- SimpleFactory.GetInstance.DeviceInit();//设备初始化
- //InternetInfo.ConfigInit();//从 consul 获取配置数据
- //IotReport.GetInstance.Initialize();
- //Topics.Clear();
- //Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
- //Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
- //Topics.Add(TOPIC.GetInstance.GetChargebackTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
-
- ////MQTT 连接成功
- //MqttHelper.GetInstance.ConnectOk = new Action(() =>
- //{
- // SimpleFactory.GetInstance.DeviceInit();//设备初始化
+ InternetInfo.ConfigInit();//从 consul 获取配置数据
+ IotReport.GetInstance.Initialize();
+ Topics.Clear();
+ Topics.Add(TOPIC.GetInstance.GetOrderPushTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
+ Topics.Add(TOPIC.GetInstance.GetBusinessTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
+ Topics.Add(TOPIC.GetInstance.GetChargebackTopic(GeneralConfig.DeviceType, InternetInfo.deviceId));
+
+ //MQTT 连接成功
+ MqttHelper.GetInstance.ConnectOk = new Action(() =>
+ {
+ SimpleFactory.GetInstance.DeviceInit();//设备初始化
- // MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅
+ MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray());//主题订阅
- // HeartbeatReport.GetInstance.Init();//心跳上报
+ HeartbeatReport.GetInstance.Init();//心跳上报
- // ServerData.GetInstance.Init();//数据处理初始化
+ ServerData.GetInstance.Init();//数据处理初始化
- // //接收MQTT消息
- // MqttHelper.GetInstance.MqttReceive = new Action((receivce) =>
- // {
- // ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload));
- // });
+ //接收MQTT消息
+ MqttHelper.GetInstance.MqttReceive = new Action((receivce) =>
+ {
+ ServerData.GetInstance.ReceiveData(Encoding.UTF8.GetString(receivce.ApplicationMessage.Payload));
+ });
- //});
+ });
- ////MQTT 重连成功
- //MqttHelper.GetInstance.Reconnection = new Action(() => { MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray()); });
+ //MQTT 重连成功
+ MqttHelper.GetInstance.Reconnection = new Action(() => { MqttHelper.GetInstance.MqttSubscriptionAsync(Topics.ToArray()); });
- ////MQTT 连接
- //MqttHelper.GetInstance.MqttInitAsync(InternetInfo.MqttUserName, InternetInfo.MqttPassword,
- // InternetInfo.MqttAddress, InternetInfo.MqttPort, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
+ //MQTT 连接
+ MqttHelper.GetInstance.MqttInitAsync(InternetInfo.MqttUserName, InternetInfo.MqttPassword,
+ InternetInfo.MqttAddress, InternetInfo.MqttPort, DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"));
}), "业务逻辑初始化");
}
diff --git a/HBLConsole/App.config b/HBLConsole/App.config
index 20dd685..5841083 100644
--- a/HBLConsole/App.config
+++ b/HBLConsole/App.config
@@ -11,20 +11,22 @@
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+