Browse Source

增加取杯流程

master
itachilee 2 years ago
parent
commit
4b7f84b4e6
4 changed files with 42 additions and 10 deletions
  1. +25
    -4
      HBLConsole.MORKIC/Control_MORKIC.cs
  2. +13
    -2
      HBLConsole.Service/ThreadOperate.cs
  3. +3
    -3
      HBLConsole/App.config
  4. +1
    -1
      HBLConsole/View/MainView.xaml

+ 25
- 4
HBLConsole.MORKIC/Control_MORKIC.cs View File

@@ -107,6 +107,9 @@ namespace HBLConsole.MORKIC
{
if (morkOrderPushes.TryDequeue(out MorkOrderPush order))
{
//Thread.Sleep(5000);
//SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);

//商品类型
GOODS_TYPE currentGoodsType = GOODS_TYPE.NEITHER;
//子订单ID
@@ -183,8 +186,17 @@ namespace HBLConsole.MORKIC
//订单状态改变:开始制作
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
//todo:先调用机器人

ThreadOperate.GetInstance.Start(new Action(() => { LebaiHelper.GetInstance.Scene(10002); }), "调用乐百机器人做咖啡场景");
while (!(lebai.Ok && lebai.Value == 1))
{
Thread.Sleep(5);
}
//todo:咖啡杯下杯
MessageLog.GetInstance.Show("咖啡杯取杯完成");
LebaiHelper.GetInstance.SetValue(100);


while (!(lebai.Ok && lebai.Value == 2))
{
@@ -192,9 +204,14 @@ namespace HBLConsole.MORKIC
}
MessageLog.GetInstance.Show("机器人到达接咖啡口位置");
new MakeCoffeeEvent() { DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish();
are.WaitOne(1000 * 90);
are.WaitOne(1000 * 180);
MessageLog.GetInstance.Show("咖啡机制作咖啡完成");
LebaiHelper.GetInstance.SetValue(101);
while (!(lebai.Ok && lebai.Value == 3))
{
Thread.Sleep(5);
}
MessageLog.GetInstance.Show("机器人到达接咖啡口位置");
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
}
@@ -245,11 +262,15 @@ namespace HBLConsole.MORKIC
//开始心跳刷新,根据咖啡机及冰淇淋机来判断
ThreadOperate.GetInstance.StartLong(new Action(() =>
{

//GeneralConfig.Healthy = true;
//GeneralConfig.Healthy =
// LebaiHelper.GetInstance.IsConnected &&
// MorkIStatus.GetInstance().CanDo &&
// MorkCStatus.GetInstance().CanDo;
GeneralConfig.Healthy =
LebaiHelper.GetInstance.IsConnected &&
MorkIStatus.GetInstance().CanDo &&
MorkCStatus.GetInstance().CanDo;
LebaiHelper.GetInstance.IsConnected &&
MorkCStatus.GetInstance().CanDo;
Thread.Sleep(100);
}), "MORK-IC心跳刷新");



+ 13
- 2
HBLConsole.Service/ThreadOperate.cs View File

@@ -43,9 +43,20 @@ namespace HBLConsole.Service
CancellationTokenSources.TryAdd(TaskName, new CancellationTokenSource());
bool result = Threads.TryAdd(TaskName, Task.Factory.StartNew(new Action(() =>
{
while (!CancellationTokenSources[TaskName].IsCancellationRequested)
try
{
if (action != null) action();
while (!CancellationTokenSources[TaskName].IsCancellationRequested)
{
if (action != null) action();
}
}
catch (Exception ex)
{
CancellationTokenSources.TryRemove(TaskName, out CancellationTokenSource temp);
Threads.TryRemove(TaskName, out Task temp1);
MessageLog.GetInstance.Show($"【{TaskName}】任务线程出现异常,已退出,并重启\r\n{ex.Message}");
StartLong(action, TaskName, RunComplete);
}
}), CancellationTokenSources[TaskName].Token).ContinueWith(new Action<Task, object>((t, o) =>
{


+ 3
- 3
HBLConsole/App.config View File

@@ -11,7 +11,7 @@

<!--客户端ID-->
<!--MorkD = 2,MorkS 且时且多 = 8,MorkS 珠海 = 9,冰淇淋 = 4,咖啡机 = 13-->
<add key="ClientId" value="2"/>
<add key="ClientId" value="4"/>
<!--IOT大屏上报-->
<add key="ProductKey" value="grgpECHSL7q"/>
<add key="DeviceName" value="qsqd_zmj"/>
@@ -19,9 +19,9 @@
<add key="DeviceMS" value="成都银泰且时且多"/>


<add key="COM_Coffee" value="COM10"/>
<add key="COM_Coffee" value="COM8"/>
<add key="BAUD_Coffee" value="115200"/>
<add key="COM_IceCream" value="COM12"/>
<add key="COM_IceCream" value="COM5"/>
<add key="BAUD_IceCream" value="9600"/>
<add key="IceCream_CXB_Threshold" value="90"/>



+ 1
- 1
HBLConsole/View/MainView.xaml View File

@@ -235,7 +235,7 @@
Grid.RowSpan="2"
Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="{Binding ContentHeight}" />
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>



Loading…
Cancel
Save