Browse Source

冲突解决

master
pry 2 years ago
parent
commit
0c21f4ccb2
4 changed files with 74 additions and 15 deletions
  1. +22
    -9
      HBLConsole.Communication/LebaiHelper.cs
  2. +50
    -4
      HBLConsole.MORKIC/Control_MORKIC.cs
  3. +1
    -1
      HBLConsole/App.xaml.cs
  4. +1
    -1
      HBLConsole/ViewModel/ViewModelBase.cs

+ 22
- 9
HBLConsole.Communication/LebaiHelper.cs View File

@@ -23,9 +23,13 @@ namespace HBLConsole.Communication
#region 新增场景
public const int SENCE_取咖啡杯 = 10013;
public const int SENCE_咖啡杯检测 = 10014;
public const int SENCE_接咖啡 = 10015;
public const int SENCE_送咖啡 = 10016;
public const int SENCE_再次取杯 = 10017;
public const int SENCE_接咖啡 = 10015;
public const int SENCE_送咖啡 = 10016; //无取走咖啡检测配合场景
public const int SENCE_New送咖啡 = 10021;//有取走咖啡检测配合场景
public const int SENCE_有无咖啡检测 = 10019;
public const int SENCE_再送咖啡 = 10020;
public const int SENCE_复位 = 10018;
#endregion
public const int SENCE_欢迎 = 10002;

@@ -140,14 +144,23 @@ namespace HBLConsole.Communication
public void Scene(int id)
{
if (robotData == null || client == null) return;
client?.RunScene(id);
var r= client?.RunScene(id).Result;
int t = r.Id;
TaskInfo res = client.GetTask(id).Result;
while (res.Status != Lebai.SDK.Dtos.TaskStatus.Running)
{
client?.RunScene(id);
res = client.GetTask(id).Result;
Thread.Sleep(1);
}
//var res1 = GetValueAsync();
//while (res1.Value != id)
//{
// client?.RunScene(id);
// Thread.Sleep(5);
//}
//LebaiHelper.GetInstance.SetValue(1000);
//while (res.Status != Lebai.SDK.Dtos.TaskStatus.RunSuccess)
//{
// client?.RunScene(id);
// res = client.GetTask(id).Result;
// Thread.Sleep(1);
//}

}
}


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

@@ -315,6 +315,7 @@ namespace HBLConsole.MORKIC
//while (!ChipStatus.GetInstance().CompletedTake_CPU_CUP_COFFEE) { Thread.Sleep(5); }
MessageLog.GetInstance.Show("咖啡杯取杯完成");
LebaiHelper.GetInstance.SetValue(100);
Thread.Sleep(1500);
//咖啡杯检测场景
while (!ChipStatus.GetInstance().ArticleExits)
{
@@ -330,8 +331,10 @@ namespace HBLConsole.MORKIC
Thread.Sleep(500);
}
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测);
//场景需要两次才能进去
Thread.Sleep(2000);
if (lebai.Value != 2)
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_咖啡杯检测);
while (!(lebai.Ok && lebai.Value == 2))
{
Thread.Sleep(5);
@@ -341,6 +344,7 @@ namespace HBLConsole.MORKIC
}
checkeNum = 0;
ChipStatus.GetInstance().ArticleExits = false;
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_接咖啡);
while (!(lebai.Ok && lebai.Value == 4))
@@ -354,14 +358,55 @@ namespace HBLConsole.MORKIC
//are.WaitOne(1 * 180);
MessageLog.GetInstance.Show("咖啡机制作咖啡完成");
LebaiHelper.GetInstance.SetValue(101);
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_送咖啡);
Thread.Sleep(2000);
//LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_送咖啡);
//while (!(lebai.Ok && lebai.Value == 5))
//{
// Thread.Sleep(5);
//}
//MessageLog.GetInstance.Show("机器人到达顾客取咖啡位置");
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_New送咖啡);
Thread.Sleep(500);
while (!(lebai.Ok && lebai.Value == 5))
{
Thread.Sleep(5);
}
MessageLog.GetInstance.Show("机器人到达顾客取咖啡位置");
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_有无咖啡检测);
while (!(lebai.Ok && lebai.Value == 6))
{
Thread.Sleep(5);
}
new ArticleExitsEvent() { }.Publish();
Thread.Sleep(1000);
//有咖啡
while (ChipStatus.GetInstance().ArticleExits)
{
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_再送咖啡);
while (!(lebai.Ok&&lebai.Value==7))
{
Thread.Sleep(5);
}
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_有无咖啡检测);
while (!(lebai.Ok && lebai.Value == 6))
{
Thread.Sleep(5);
}
new ArticleExitsEvent() { }.Publish();
Thread.Sleep(1000);
}
ChipStatus.GetInstance().ArticleExits = false;
MessageLog.GetInstance.Show("顾客已经取走咖啡");
//无咖啡
LebaiHelper.GetInstance.Scene(LebaiHelper.SENCE_复位);
while (!(lebai.Ok && lebai.Value == 8))
{
Thread.Sleep(8);
}
MessageLog.GetInstance.Show("机器人复位");
//订单状态改变:完成
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_TAKE);
#endregion
}

@@ -404,6 +449,7 @@ namespace HBLConsole.MORKIC
{
Thread.Sleep(5);
}
MessageLog.GetInstance.Show("冰淇凌制作完成");
SimpleFactory.GetInstance.OrderChanged(subOrderId, BPA.Message.Enum.ORDER_STATUS.COMPLETED_COOK);
}



+ 1
- 1
HBLConsole/App.xaml.cs View File

@@ -111,7 +111,7 @@ namespace HBLConsole
LogTime = DateTime.Now,
LogType = "1",
LogMessage = ErroLog,
LogVla = "常",
LogVla = "常",
});
// Process.Start($"{AppDomain.CurrentDomain.BaseDirectory}{AppDomain.CurrentDomain.FriendlyName}.exe");
}


+ 1
- 1
HBLConsole/ViewModel/ViewModelBase.cs View File

@@ -46,7 +46,7 @@ namespace HBLConsole.ViewModel
LogTime = DateTime.Now,
LogType = "1",
LogMessage = s,
LogVla = "常",
LogVla = "常",
});
});
}


Loading…
Cancel
Save