|
|
@@ -6,8 +6,8 @@ using BPASmartClient.Helper; |
|
|
|
using BPASmartClient.Message; |
|
|
|
using BPASmartClient.Model; |
|
|
|
using BPASmartClient.Model.PLC; |
|
|
|
using static BPASmartClient.EventBus.EventBus; |
|
|
|
using BPA.Models; |
|
|
|
using static BPASmartClient.EventBus.EventBus; |
|
|
|
|
|
|
|
namespace BPASmartClient.MorkF |
|
|
|
{ |
|
|
@@ -16,18 +16,27 @@ namespace BPASmartClient.MorkF |
|
|
|
public override DeviceClientType DeviceType => DeviceClientType.MORKSF; |
|
|
|
|
|
|
|
GVL_MorkF morkF = new GVL_MorkF();//全局对象声明 |
|
|
|
//private OrderMaterialDelivery orderMaterialDelivery { get; set; } = new OrderMaterialDelivery(); |
|
|
|
//private RecipeBoms recipeBoms { get; set; } = new RecipeBoms(); |
|
|
|
//int OrderCount; |
|
|
|
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象 |
|
|
|
//public bool ProcessError { get; set; }//流程错误 |
|
|
|
/// <summary> |
|
|
|
/// 入口 |
|
|
|
/// </summary> |
|
|
|
public override void DoMain() |
|
|
|
{ |
|
|
|
ReadData(); //plc状态量读取 |
|
|
|
ServerInit(); |
|
|
|
DataParse();//数据解析 |
|
|
|
//Main(); |
|
|
|
//ResetProgram(); |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
{ |
|
|
|
IsHealth = true; |
|
|
|
ReadData(); |
|
|
|
Thread.Sleep(10); |
|
|
|
}), "ReadPLCData"); |
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
{ |
|
|
|
MainTask(); |
|
|
|
Thread.Sleep(10); |
|
|
|
}), "MainTask"); |
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("MORKF 设备初始化完成"); |
|
|
|
} |
|
|
|
|
|
|
@@ -46,7 +55,8 @@ namespace BPASmartClient.MorkF |
|
|
|
//{ |
|
|
|
GetStatus("M0.1", new Action<bool[]>((bools) => |
|
|
|
{ |
|
|
|
morkF.InitialComplete = bools[0]; |
|
|
|
Initing = bools[0]; |
|
|
|
morkF.InitialComplete = Initing; |
|
|
|
})); |
|
|
|
GetStatus("M1.0", new Action<bool[]>((bools) => |
|
|
|
{ |
|
|
@@ -151,80 +161,163 @@ namespace BPASmartClient.MorkF |
|
|
|
{ |
|
|
|
if (ushort.TryParse(res.BatchingLoc, out ushort loc)) |
|
|
|
{ |
|
|
|
if (loc >= 1 && loc <= 5) |
|
|
|
{ |
|
|
|
if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId }); |
|
|
|
} |
|
|
|
else if (loc >= 10 && loc <= 11) |
|
|
|
{ |
|
|
|
int index = 0; |
|
|
|
if (recipeBoms != null) |
|
|
|
{ |
|
|
|
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); |
|
|
|
index++; |
|
|
|
} |
|
|
|
if (morkF.TakePlateQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() |
|
|
|
{ |
|
|
|
Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 |
|
|
|
}); |
|
|
|
} |
|
|
|
//if (morkF.TakeMaterialQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
//将一个商品的ABC料位置存入队列 |
|
|
|
morkF.TakeMaterialQueue.Enqueue(new OrderLocInfo() { SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId, MaterialLoc = ushort.Parse(res.BatchingLoc) }); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//int index = 0; |
|
|
|
//if (recipeBoms != null) |
|
|
|
//{ |
|
|
|
// index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); |
|
|
|
// index++; |
|
|
|
//} |
|
|
|
if (morkF.TakePlateQueue.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
morkF.TakePlateQueue.Enqueue(new OrderLocInfo() |
|
|
|
{ |
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
BatchingId = res.BatchingId |
|
|
|
//RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//} |
|
|
|
/// <summary> |
|
|
|
/// 流程控制 |
|
|
|
/// 主任务 |
|
|
|
/// </summary> |
|
|
|
public override void MainTask() |
|
|
|
{ |
|
|
|
//ThreadManage.GetInstance().StartLong(new Action(() => |
|
|
|
//{ |
|
|
|
IsHealth = true; //心跳 |
|
|
|
TakePlatelTask(); |
|
|
|
TakePotTask(); |
|
|
|
TakeVegBurdenATask(); |
|
|
|
TakeMeatBurdenATask(); |
|
|
|
TakeVegBurdenBTask(); |
|
|
|
TakeBurdenCTask(); |
|
|
|
StartCookingTask(); |
|
|
|
OutDishTask(); |
|
|
|
CleanPotTask(); |
|
|
|
TurntableControl(); |
|
|
|
ProcessExecute(); |
|
|
|
SingleProcess(); |
|
|
|
} |
|
|
|
//机器人,锅灶流程执行 |
|
|
|
public void ProcessExecute() |
|
|
|
{ |
|
|
|
if (!morkF.ProcessExcuteLock) |
|
|
|
{ |
|
|
|
morkF.ProcessExcuteLock = true; |
|
|
|
Task.Run(new Action(() => |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.InitialComplete && morkF.TakeMaterialQueue.Count > 0 && morkF.TakePlateQueue.Count > 0) |
|
|
|
{ |
|
|
|
foreach (var res in stirFryBom.StirFryActions)//遍历所有流程 |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show($"执行流程{res.Time}"); |
|
|
|
//机器人线程 |
|
|
|
Task taskRobot = Task.Run(new Action(() => |
|
|
|
{ |
|
|
|
foreach (var temp in res.RobotActions) |
|
|
|
{ |
|
|
|
switch (temp) |
|
|
|
{ |
|
|
|
case StirFryRobotAction.清洗槽取锅: |
|
|
|
TakePotTask();//执行取锅操作 |
|
|
|
break; |
|
|
|
case StirFryRobotAction.取A料: |
|
|
|
TakeBurdenATask();//执行取A料操作 |
|
|
|
break; |
|
|
|
case StirFryRobotAction.加入B料: |
|
|
|
TakeBurdenBTask();//执行取B料操作 |
|
|
|
break; |
|
|
|
case StirFryRobotAction.加入C料: |
|
|
|
TakeBurdenCTask();//执行取C料操作 |
|
|
|
break; |
|
|
|
case StirFryRobotAction.灶取锅: |
|
|
|
OutDishTask();//执行出餐操作 |
|
|
|
CleanPotTask();//洗锅操作 |
|
|
|
break; |
|
|
|
} |
|
|
|
// Task.Delay(2000).Wait();//单一操作延时 |
|
|
|
} |
|
|
|
|
|
|
|
})); |
|
|
|
//炒锅线程操作 |
|
|
|
Task taskPot = Task.Run(new Action(() => |
|
|
|
{ |
|
|
|
foreach (var temp in res.PotActions) |
|
|
|
{ |
|
|
|
switch (temp) |
|
|
|
{ |
|
|
|
case StirFryPotAction.NONE: |
|
|
|
break; |
|
|
|
case StirFryPotAction.大火t1s: |
|
|
|
KitchenAdjustGears(3); |
|
|
|
Task.Delay(1000).Wait(); //大火加热1s//执行大火锅干操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.加油: |
|
|
|
AddOil();//注油//执行加油操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.中火t2s: |
|
|
|
KitchenAdjustGears(2); |
|
|
|
Task.Delay(2000).Wait();//执行操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.小火持续: |
|
|
|
KitchenAdjustGears(1); |
|
|
|
break; |
|
|
|
case StirFryPotAction.大火持续: |
|
|
|
KitchenAdjustGears(3); |
|
|
|
break; |
|
|
|
case StirFryPotAction.停止火力: |
|
|
|
KitchenAdjustGears(0);//关闭灶加热 |
|
|
|
break; |
|
|
|
case StirFryPotAction.搅拌臂上位: |
|
|
|
TurnUpStatusDetect();//执行搅拌臂上位操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.搅拌臂下位: |
|
|
|
TurnDownStatusDetect();//执行搅拌臂下位操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.低速旋转: |
|
|
|
TurnMachineGearsControl(1);//执行搅拌臂速度1挡操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.快速旋转: |
|
|
|
TurnMachineGearsControl(3);//执行搅拌臂速度3挡操作 |
|
|
|
break; |
|
|
|
case StirFryPotAction.停止旋转: |
|
|
|
TurnMachineGearsControl(0);//执行搅拌臂速度0挡操作 |
|
|
|
break; |
|
|
|
} |
|
|
|
// Task.Delay(2000).Wait();//单一操作延时 |
|
|
|
} |
|
|
|
})); |
|
|
|
Task.WhenAll(taskRobot, taskPot);//等待所有线程结束 |
|
|
|
Task.Delay(res.During).Wait();//当前流程延迟 |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
morkF.ProcessExcuteLock = false;//解除流程互锁 |
|
|
|
} |
|
|
|
})); |
|
|
|
} |
|
|
|
|
|
|
|
//}), "MainTask"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 信号处理 |
|
|
|
/// </summary> |
|
|
|
private void SingleProcess() |
|
|
|
{ |
|
|
|
//转台互锁解除 |
|
|
|
if (morkF.TakeMaterialComplete && morkF.TurnTableLock) |
|
|
|
{ |
|
|
|
morkF.TurnTableLock = false; |
|
|
|
} |
|
|
|
//待定 |
|
|
|
if (morkF.TakeVegALock && morkF.TakeMeatALock && morkF.TakeVegBLock) |
|
|
|
{ |
|
|
|
morkF.TakeAllBurdenComplete = true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//出餐完成,相应变量复位 |
|
|
|
if (morkF.OutMealComplete) |
|
|
|
{ |
|
|
|
morkF.TakePlateLock = false; |
|
|
|
morkF.TakePotLock = false; |
|
|
|
morkF.TakeVegALock = false; |
|
|
|
morkF.TakeMeatALock = false; |
|
|
|
morkF.TakeVegBLock = false; |
|
|
|
morkF.TakeBurdenCLcok = false; |
|
|
|
morkF.PotInPlace = false; |
|
|
|
morkF.ProcessExcuteLock = false; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@@ -235,7 +328,7 @@ namespace BPASmartClient.MorkF |
|
|
|
private void TurntableControl() |
|
|
|
{ |
|
|
|
//正常轮询 |
|
|
|
if (morkF.InitialComplete && morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock) |
|
|
|
if (morkF.TakeMaterialQueue.Count > 0 && !morkF.TurnTableLock) |
|
|
|
{ |
|
|
|
var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == morkF.TakeMaterialQueue.ElementAt(0).BatchingId).ToList(); |
|
|
|
if (result != null) |
|
|
@@ -266,76 +359,142 @@ namespace BPASmartClient.MorkF |
|
|
|
StartTakePlate(); |
|
|
|
morkF.CurrentOrderId = order.SuborderId; |
|
|
|
morkF.TakePlateLock = true; //订单完成后置false |
|
|
|
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取碗控制,位置:[{order.Loc}]"); |
|
|
|
morkF.OutMealComplete = false; |
|
|
|
OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING); |
|
|
|
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取碗控制"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.ShowEx($"订单【{ morkF.CurrentOrderId}】取碗失败"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 取锅到灶台 |
|
|
|
/// </summary> |
|
|
|
/// <exception cref="NotImplementedException"></exception> |
|
|
|
private void TakePotTask() |
|
|
|
private async void TakePotTask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.InitialComplete && morkF.TakePlateQueue.Count > 0 && !morkF.CleanModule && morkF.CleanComplete && !morkF.KitchenOneStatus && !morkF.TakePotLock) |
|
|
|
|
|
|
|
if (morkF.TakePlateQueue.Count > 0) |
|
|
|
{ |
|
|
|
while (!(!morkF.CleanModule && morkF.CleanComplete && !morkF.KitchenOneStatus))//等待清洗1准备就绪 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
while (morkF.RoobotIdle)//等待机器人空闲 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
TakePotToKitchen(); |
|
|
|
morkF.TakePotLock = true; //订单完成后置false |
|
|
|
// morkF.TakePotLock = true; //订单完成后置false |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M1.5", Value = false });//清洗模组1完成复位 |
|
|
|
MessageLog.GetInstance.Show($"订单【{ morkF.CurrentOrderId}】执行取锅到灶台控制"); |
|
|
|
while (!morkF.PutPotToKitchenComlete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
morkF.PotInPlace = morkF.PutPotToKitchenComlete;//锅到位 |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 取素菜A料 |
|
|
|
/// </summary> |
|
|
|
private void TakeVegBurdenATask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.PotInPlace && morkF.TurnMachineUpComplete && !morkF.TakeVegALock && morkF.AllowTakeMaterial) |
|
|
|
{ |
|
|
|
|
|
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
|
private void TakeBurdenATask() |
|
|
|
{ |
|
|
|
if (morkF.TakeMaterialQueue.Count > 0) |
|
|
|
{ |
|
|
|
TurnUpStatusDetect(); |
|
|
|
//while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
//{ |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
//} |
|
|
|
//EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false });//翻转机上升完成复位 |
|
|
|
//MessageLog.GetInstance.Show($"翻转机上升执行完成"); |
|
|
|
while (morkF.RoobotIdle || !morkF.PotInPlace)//等待机器人空闲以及锅到位 |
|
|
|
{ |
|
|
|
int loc = order.Loc; |
|
|
|
TakeBurden(loc); |
|
|
|
morkF.TakeVegALock = true;//订单完成置false |
|
|
|
morkF.AllowTakeMaterial = false; |
|
|
|
MessageLog.GetInstance.Show($"订单【{ order.SuborderId},翻转机上升完成,执行取素菜A控制"); |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 取荤菜A料 |
|
|
|
/// </summary> |
|
|
|
private void TakeMeatBurdenATask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.PotInPlace && morkF.TurnMachineUpComplete && morkF.TakeVegALock && !morkF.TakeMeatALock && morkF.AllowTakeMaterial) |
|
|
|
{ |
|
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
|
{ |
|
|
|
int loc = order.Loc; |
|
|
|
int loc = order.MaterialLoc; |
|
|
|
TakeBurden(loc); |
|
|
|
morkF.TakeMeatALock = true;//订单完成置false |
|
|
|
morkF.AllowTakeMaterial = false; |
|
|
|
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,,翻转机上升完成,执行取荤菜A控制"); |
|
|
|
//morkF.TakeVegALock = true;//订单完成置false |
|
|
|
// morkF.AllowTakeMaterial = false; |
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"订单【{ order.SuborderId},执行取A料"); |
|
|
|
} |
|
|
|
//等待取料完成 |
|
|
|
while (!morkF.TakeMaterialComplete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
//转台互锁解除 |
|
|
|
if (morkF.TurnTableLock) |
|
|
|
{ |
|
|
|
morkF.TurnTableLock = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
///// <summary> |
|
|
|
///// 取荤菜A料 |
|
|
|
///// </summary> |
|
|
|
//private void TakeBurdenATask() |
|
|
|
//{ |
|
|
|
// if (!morkF.RoobotIdle && morkF.PotInPlace && morkF.TurnMachineUpComplete && morkF.TakeVegALock && !morkF.TakeMeatALock && morkF.AllowTakeMaterial&& morkF.TakeMaterialQueue.Count > 0) |
|
|
|
// { |
|
|
|
// if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
|
// { |
|
|
|
// int loc = 0; |
|
|
|
// TakeBurden(loc); |
|
|
|
// morkF.TakeMeatALock = true;//订单完成置false |
|
|
|
// morkF.AllowTakeMaterial = false; |
|
|
|
// MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,,翻转机上升完成,执行取荤菜A控制"); |
|
|
|
// } |
|
|
|
// } |
|
|
|
//} |
|
|
|
/// <summary> |
|
|
|
/// 取素菜B料 |
|
|
|
/// </summary> |
|
|
|
private void TakeVegBurdenBTask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.PotInPlace && morkF.TurnMachineUpComplete && morkF.TakeMeatALock && !morkF.TakeVegBLock && morkF.AllowTakeMaterial) |
|
|
|
{ |
|
|
|
private void TakeBurdenBTask() |
|
|
|
{ |
|
|
|
if (morkF.TakeMaterialQueue.Count > 0) |
|
|
|
{ |
|
|
|
TurnUpStatusDetect(); |
|
|
|
//while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
//{ |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
//} |
|
|
|
//EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false });//翻转机上升完成复位 |
|
|
|
//MessageLog.GetInstance.Show($"翻转机上升执行完成"); |
|
|
|
while (morkF.RoobotIdle || !morkF.PotInPlace)//等待机器人空闲以及锅到位 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
|
{ |
|
|
|
int loc = order.Loc; |
|
|
|
int loc = order.MaterialLoc; |
|
|
|
TakeBurden(loc); |
|
|
|
morkF.TakeVegBLock = true;//订单完成置false |
|
|
|
morkF.AllowTakeMaterial = false; |
|
|
|
//morkF.TakeVegBLock = true;//订单完成置false |
|
|
|
//morkF.AllowTakeMaterial = false; |
|
|
|
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,,翻转机上升完成,执行取素菜B控制"); |
|
|
|
} |
|
|
|
//等待取料完成 |
|
|
|
while (!morkF.TakeMaterialComplete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
//转台互锁解除 |
|
|
|
if (morkF.TurnTableLock) |
|
|
|
{ |
|
|
|
morkF.TurnTableLock = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
@@ -344,17 +503,38 @@ namespace BPASmartClient.MorkF |
|
|
|
/// <exception cref="NotImplementedException"></exception> |
|
|
|
private void TakeBurdenCTask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.PotInPlace && morkF.TurnMachineUpComplete && morkF.TakeAllBurdenComplete && !morkF.TakeBurdenCLcok && morkF.AllowTakeMaterial) |
|
|
|
if (morkF.TakeMaterialQueue.Count > 0) |
|
|
|
{ |
|
|
|
TurnUpStatusDetect(); |
|
|
|
//while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
//{ |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
//} |
|
|
|
//EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false });//翻转机上升完成复位 |
|
|
|
//MessageLog.GetInstance.Show($"翻转机上升执行完成"); |
|
|
|
while (morkF.RoobotIdle || !morkF.PotInPlace)//等待机器人空闲以及锅到位 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) |
|
|
|
{ |
|
|
|
int loc = order.Loc; |
|
|
|
int loc = order.MaterialLoc; |
|
|
|
TakeBurden(loc); |
|
|
|
morkF.TakeBurdenCLcok = true;//订单完成置false |
|
|
|
morkF.AllowTakeMaterial = false; |
|
|
|
morkF.TakeAllBurdenComplete = false; |
|
|
|
//morkF.TakeBurdenCLcok = true;//订单完成置false |
|
|
|
//morkF.AllowTakeMaterial = false; |
|
|
|
//morkF.TakeAllBurdenComplete = false; |
|
|
|
MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,,翻转机上升完成,执行取调味品C料控制"); |
|
|
|
} |
|
|
|
//等待取料完成 |
|
|
|
while (!morkF.TakeMaterialComplete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
//转台互锁解除 |
|
|
|
if (morkF.TurnTableLock) |
|
|
|
{ |
|
|
|
morkF.TurnTableLock = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
@@ -418,11 +598,21 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
private void OutDishTask() |
|
|
|
{ |
|
|
|
if (!morkF.RoobotIdle && morkF.CookingComplete && morkF.ProvidePlateComplete && !morkF.CleanModule) |
|
|
|
TurnUpStatusDetect(); |
|
|
|
//while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
//{ |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
//} |
|
|
|
//EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false });//翻转机上升完成复位 |
|
|
|
//MessageLog.GetInstance.Show($"翻转机上升执行完成"); |
|
|
|
while (morkF.RoobotIdle || morkF.CleanModule || !morkF.ProvidePlateComplete)//等待条件满足 |
|
|
|
{ |
|
|
|
RobotOutMeal(); |
|
|
|
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】正在出餐"); |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
RobotOutMeal(); |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M1.2", Value = false });//供盘复位 |
|
|
|
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】正在出餐"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -430,12 +620,19 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
private void CleanPotTask() |
|
|
|
{ |
|
|
|
if (morkF.PlaceRinseTableComplete && !morkF.CleanModule) |
|
|
|
|
|
|
|
while (!morkF.PlaceRinseTableComplete || morkF.CleanModule) |
|
|
|
{ |
|
|
|
CleanModuleControl("Start"); |
|
|
|
Task.Delay(5000).Wait(); |
|
|
|
CleanModuleControl("Stop"); |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】出餐完成"); |
|
|
|
CleanModuleControl("Start"); |
|
|
|
morkF.OutMealComplete = true; |
|
|
|
Task.Delay(5000).Wait(); |
|
|
|
CleanModuleControl("Stop"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 任务复位重启 |
|
|
@@ -468,27 +665,49 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
public void TurnDownStatusDetect() |
|
|
|
{ |
|
|
|
TurnMachineOrientControl("Down"); |
|
|
|
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
|
//if (ProcessError) |
|
|
|
//{ |
|
|
|
// return; |
|
|
|
//} |
|
|
|
if (morkF.PotInPlace) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
//等待取料完成 |
|
|
|
while (!morkF.TakeMaterialComplete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
TurnMachineOrientControl("Down"); |
|
|
|
|
|
|
|
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.3", Value = false });//复位 |
|
|
|
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"翻转机下降完成"); |
|
|
|
} |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.3", Value = false });//复位 |
|
|
|
MessageLog.GetInstance.Show($"翻转机下降执行完成"); |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 翻转机上升及状态检测 |
|
|
|
/// </summary> |
|
|
|
public void TurnUpStatusDetect() |
|
|
|
{ |
|
|
|
TurnMachineOrientControl("Top");//翻转机上升 |
|
|
|
morkF.AllowTakeMaterial = true; |
|
|
|
while (!morkF.TurnMachineUpComplete || !morkF.TakeMaterialComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
//if (ProcessError) |
|
|
|
//{ |
|
|
|
// return; |
|
|
|
//} |
|
|
|
if (morkF.PotInPlace) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
TurnMachineOrientControl("Top");//翻转机上升 |
|
|
|
while (!morkF.TurnMachineUpComplete || !morkF.TakeMaterialComplete)//等待翻转机上升完成以及取料完成 |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false }); |
|
|
|
MessageLog.GetInstance.Show("翻转机上升完成"); |
|
|
|
} |
|
|
|
EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.1", Value = false }); |
|
|
|
MessageLog.GetInstance.Show("翻转机上升执行完成"); |
|
|
|
} |
|
|
|
private void GetStatus(string key, Action<bool[]> action) |
|
|
|
{ |
|
|
@@ -511,40 +730,47 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
public void KitchenAdjustGears(int number) |
|
|
|
{ |
|
|
|
switch (number) |
|
|
|
//if (ProcessError) |
|
|
|
//{ |
|
|
|
// return; |
|
|
|
//} |
|
|
|
if (morkF.PotInPlace) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
WriteData("352", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
WriteData("352", new bool[] { true, false, false, false, false, false, false, false });//0000 0001 |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
WriteData("352", new bool[] { false, true, false, false, false, false, false, false });//0000 0010 |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
WriteData("352", new bool[] { true, true, false, false, false, false, false, false });//0000 0011 |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
WriteData("352", new bool[] { false, false, true, false, false, false, false, false });//0000 0100 |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
WriteData("352", new bool[] { true, false, true, false, false, false, false, false });//0000 0101 |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
WriteData("352", new bool[] { false, true, true, false, false, false, false, false });//0000 0110 |
|
|
|
break; |
|
|
|
case 7: |
|
|
|
WriteData("352", new bool[] { true, true, true, false, false, false, false, false });//0000 0111 |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
WriteData("355", new bool[] { false, false, false, true, false, false, false, false });//0000 1000 |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
WriteData("352", new bool[] { true, false, false, true, false, false, false, false });//0000 1001 |
|
|
|
break; |
|
|
|
switch (number) |
|
|
|
{ |
|
|
|
case 0: |
|
|
|
WriteData("352", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
WriteData("352", new bool[] { true, false, false, false, false, false, false, false });//0000 0001 |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
WriteData("352", new bool[] { false, true, false, false, false, false, false, false });//0000 0010 |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
WriteData("352", new bool[] { true, true, false, false, false, false, false, false });//0000 0011 |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
WriteData("352", new bool[] { false, false, true, false, false, false, false, false });//0000 0100 |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
WriteData("352", new bool[] { true, false, true, false, false, false, false, false });//0000 0101 |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
WriteData("352", new bool[] { false, true, true, false, false, false, false, false });//0000 0110 |
|
|
|
break; |
|
|
|
case 7: |
|
|
|
WriteData("352", new bool[] { true, true, true, false, false, false, false, false });//0000 0111 |
|
|
|
break; |
|
|
|
case 8: |
|
|
|
WriteData("355", new bool[] { false, false, false, true, false, false, false, false });//0000 1000 |
|
|
|
break; |
|
|
|
case 9: |
|
|
|
WriteData("352", new bool[] { true, false, false, true, false, false, false, false });//0000 1001 |
|
|
|
break; |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】,加热档位调至{number}挡"); |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show($"订单【{morkF.CurrentOrderId}】,加热档位调至{number}挡"); |
|
|
|
} |
|
|
|
public void TurnMaterialStore(int loc) |
|
|
|
{ |
|
|
@@ -594,13 +820,20 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
public void AddOil() |
|
|
|
{ |
|
|
|
WriteData("M2.7", true); |
|
|
|
MessageLog.GetInstance.Show("开始注油"); |
|
|
|
while (!morkF.FallOilComplete) |
|
|
|
//if (ProcessError) |
|
|
|
//{ |
|
|
|
// return; |
|
|
|
//} |
|
|
|
if (morkF.PotInPlace) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
WriteData("M2.7", true); |
|
|
|
MessageLog.GetInstance.Show("开始注油"); |
|
|
|
while (!morkF.FallOilComplete) |
|
|
|
{ |
|
|
|
Task.Delay(5).Wait(); |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show("注油完成"); |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show("注油完成"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 翻转机方向控制 |
|
|
@@ -621,14 +854,36 @@ namespace BPASmartClient.MorkF |
|
|
|
/// </summary> |
|
|
|
public void TurnMachineGearsControl(int gear) |
|
|
|
{ |
|
|
|
switch (gear) |
|
|
|
{ |
|
|
|
case 0: WriteData("M7.0", true); break;//关闭翻炒机 |
|
|
|
case 1: WriteData("M7.1", true); break;//翻炒机1挡 |
|
|
|
case 2: WriteData("M7.2", true); break;//翻炒机2挡 |
|
|
|
case 3: WriteData("M7.3", true); break;//翻炒机3挡 |
|
|
|
//if (gear != 0) |
|
|
|
//{ |
|
|
|
// while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
|
// { |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
// } |
|
|
|
// EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.3", Value = false });//复位 |
|
|
|
// MessageLog.GetInstance.Show($"翻转机下降完成"); |
|
|
|
//} |
|
|
|
//if (ProcessError) |
|
|
|
//{ |
|
|
|
// return; |
|
|
|
//} |
|
|
|
if (morkF.PotInPlace) |
|
|
|
{ |
|
|
|
//while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 |
|
|
|
//{ |
|
|
|
// Task.Delay(5).Wait(); |
|
|
|
//} |
|
|
|
//EventBus.EventBus.GetInstance().Publish(new WriteModel() { Address = "M8.3", Value = false });//复位 |
|
|
|
switch (gear) |
|
|
|
{ |
|
|
|
case 0: WriteData("M7.0", true); Task.Delay(1000).Wait(); break;//关闭翻炒机 |
|
|
|
case 1: WriteData("M7.1", true); break;//翻炒机1挡 |
|
|
|
case 2: WriteData("M7.2", true); break;//翻炒机2挡 |
|
|
|
case 3: WriteData("M7.3", true); break;//翻炒机3挡 |
|
|
|
} |
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"翻转机档位调至{gear}挡"); |
|
|
|
} |
|
|
|
MessageLog.GetInstance.Show($"翻转机档位调至{gear}挡"); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 取A,B,C料 |
|
|
|