@@ -21,7 +21,6 @@ namespace BPASmartClient.MorkF
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象
public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象
List<int> resultorder = new List<int>();//调试变量
List<int> resultorder = new List<int>();//调试变量
public static readonly object taskLock = new object();
/// <summary>
/// <summary>
/// 入口
/// 入口
/// </summary>
/// </summary>
@@ -37,8 +36,26 @@ namespace BPASmartClient.MorkF
{
{
ActionManage.GetInstance.Register(PLCInite, "InitCommand");
ActionManage.GetInstance.Register(PLCInite, "InitCommand");
ActionManage.GetInstance.Register(InitialData, "SimultaorOrder");
ActionManage.GetInstance.Register(InitialData, "SimultaorOrder");
ActionManage.GetInstance.Register(MaterialOne, "MaterialOne");
ActionManage.GetInstance.Register(MaterialTwo, "MaterialTwo");
ActionManage.GetInstance.Register(MaterialThree, "MaterialThree");
ActionManage.GetInstance.Register(MaterialFour, "MaterialFour");
ActionManage.GetInstance.Register(MaterialFive, "MaterialFive");
ActionManage.GetInstance.Register(ManualOpenExhaust, "OpenExhaust");
ActionManage.GetInstance.Register(CloseExhaust, "CloaseExhaust");
ActionManage.GetInstance.Register(StartQX,"StartQXOne");
ActionManage.GetInstance.Register(StartQX, "StartQXTwo");
ActionManage.GetInstance.Register(ShreddCabbage, "ShreddCabbage");
ActionManage.GetInstance.Register(FryPork, "FryPork");
ActionManage.GetInstance.Register(XingBaoGu, "XingBaoGu");
ActionManage.GetInstance.Register(TakePot, "TakePot");
ActionManage.GetInstance.Register(TakePot, "TakePot");
ActionManage.GetInstance.Register(TakePotReset, "TakePotReset");
ActionManage.GetInstance.Register(TakePotReset, "TakePotReset");
ActionManage.GetInstance.Register(TakeMaterial, "TakeMaterial");
ActionManage.GetInstance.Register(ManualOutMeal, "OutMeal");
ActionManage.GetInstance.Register<Action>(AddOil,"AddOil");
ActionManage.GetInstance.Register(TakeOff, "TakeOff");
ActionManage.GetInstance.Register(TakeOff, "TakeOff");
ActionManage.GetInstance.Register(OneBlock, "OneBlock");
ActionManage.GetInstance.Register(OneBlock, "OneBlock");
ActionManage.GetInstance.Register(TwoBlock, "TwoBlock");
ActionManage.GetInstance.Register(TwoBlock, "TwoBlock");
@@ -49,9 +66,22 @@ namespace BPASmartClient.MorkF
ActionManage.GetInstance.Register(OverThreeBlock, "OverThreeBlock");
ActionManage.GetInstance.Register(OverThreeBlock, "OverThreeBlock");
ActionManage.GetInstance.Register(OverGoOn, "OverGoOn");
ActionManage.GetInstance.Register(OverGoOn, "OverGoOn");
ActionManage.GetInstance.Register(OverGoDown, "OverGoDown");
ActionManage.GetInstance.Register(OverGoDown, "OverGoDown");
ActionManage.GetInstance.Register(ShreddCabbage, "ShreddCabbage");
ActionManage.GetInstance.Register(FryPork, "FryPork");
ActionManage.GetInstance.Register(XingBaoGu, "XingBaoGu");
ActionManage.GetInstance.Register(AutoModel, "AutoModel");
ActionManage.GetInstance.Register(ManualModel, "ManualModel");
ActionManage.GetInstance.Register<Action>(AddOil, "SecAddOil");
ActionManage.GetInstance.Register(TakeOff, "SecTakeOff");
ActionManage.GetInstance.Register(OneBlock, "SecOneBlock");
ActionManage.GetInstance.Register(TwoBlock, "SecTwoBlock");
ActionManage.GetInstance.Register(ThreeBlock, "SecThreeBlock");
ActionManage.GetInstance.Register(OverTurnOff, "SecOverTurnOff");
ActionManage.GetInstance.Register(OverOneBlock, "SecOverOneBlock");
ActionManage.GetInstance.Register(OverTwoBlock, "SecOverTwoBlock");
ActionManage.GetInstance.Register(OverThreeBlock, "SecOverThreeBlock");
ActionManage.GetInstance.Register(OverGoOn, "SecOverGoOn");
ActionManage.GetInstance.Register(OverGoDown, "SecOverGoDown");
ActionManage.GetInstance.Register(AutoModel, "SecAutoModel");
ActionManage.GetInstance.Register(ManualModel, "SecManualModel");
}
}
/// <summary>
/// <summary>
/// 手撕包菜流程
/// 手撕包菜流程
@@ -129,65 +159,156 @@ namespace BPASmartClient.MorkF
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 55 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T6, PotActions = new List<StirFryPotAction>() { StirFryPotAction.搅拌臂下位, StirFryPotAction.快速旋转 }, During = 55 });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T11, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.灶取锅 } });
stirFryBom.AddAction(new StirFryAction() { Time = StirFryTime.T11, RobotActions = new List<StirFryRobotAction>() { StirFryRobotAction.灶取锅 } });
}
}
public void TakePot()
public void StartQX(object obj)
{
if ((int)obj == 1)
WriteData("M1.4", true);
if ((int)obj == 2)
WriteData("M1.7", true);
}
public void ManualOpenExhaust()
{
WriteData("M0.7",true);
}
public void CloseExhaust()
{
WriteData("M0.7",false);
}
public void TakeMaterial()
{
WriteData("M14.1",true);
}
public void ManualOutMeal()
{
WriteData("M14.2",true);
}
public void MaterialOne()
{
{
WriteData("M13.0",true);
}
WriteData("M14.0", true);
public void MaterialTwo()
{
WriteData("M13.1", true);
}
public void MaterialThree()
{
WriteData("M13.2", true);
}
public void MaterialFour()
{
WriteData("M13.3", true);
}
public void MaterialFive()
{
WriteData("M13.4", true);
}
}
public void AutoModel(object obj)
{
WriteData("0.3", true);
public void TakePotReset()
}
public void ManualModel()
{
WriteData("0.2", true);
}
public void AddOil(object obj)
{
{
if ((int)obj == 1)
{
Task.Run(() => { WriteData("M2.7", true); Task.Delay(4000).Wait(); WriteData("M2.7", false); });
}
if ((int)obj == 2)
{
Task.Run(() => { WriteData("M3.1", true); Task.Delay(4000).Wait(); WriteData("M3.1", false); });
}
}
public void TakePot(object obj)
{
WriteData("M14.0", true);
}
public void TakePotReset(object obj)
{
WriteData("M14.0", false);
WriteData("M14.0", false);
}
}
public void TakeOff()
public void TakeOff(object obj )
{
{
WriteData("M4.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0001
if ((int)obj == 1)
WriteData("M4.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000
if ((int)obj == 2)
WriteData("M5.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000
}
}
public void OneBlock()
public void OneBlock(object obj )
{
{
//WriteData("M13.1", true);
// WriteData("M4.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
//WriteData("M0.7", false);//无订单关闭抽风机
WriteData("M13.0", true);
if ((int)obj == 1)
WriteData("M4.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
if ((int)obj == 2)
WriteData("M5.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
}
}
public void TwoBlock()
public void TwoBlock(object obj )
{
{
//WriteData("M13.1", false);
WriteData("M4.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0001
if ((int)obj == 1)
WriteData("M4.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0010
if ((int)obj == 2)
WriteData("M5.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0010
}
}
public void ThreeBlock()
public void ThreeBlock(object obj )
{
{
// WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0001
WriteData("M4.0", new bool[] { false, true, true, false, false, false, false, false });
if ((int)obj == 1)
WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0011
if ((int)obj == 2)
WriteData("M5.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0011
}
}
public void OverTurnOff()
public void OverTurnOff(object obj )
{
{
WriteData("M7.0", true);
if ((int)obj == 1)
WriteData("M7.0", true);
if ((int)obj == 2)
WriteData("M7.4", true);
}
}
public void OverOneBlock()
public void OverOneBlock(object obj )
{
{
WriteData("M7.1", true);
if ((int)obj == 1)
WriteData("M7.1", true);
if ((int)obj == 2)
WriteData("M7.5", true);
}
}
public void OverTwoBlock()
public void OverTwoBlock(object obj )
{
{
WriteData("M7.2", true);
if ((int)obj == 1)
WriteData("M7.2", true);
if ((int)obj == 2)
WriteData("M7.6",true);
}
}
public void OverThreeBlock()
public void OverThreeBlock(object obj )
{
{
WriteData("M7.3", true);
if ((int)obj == 1)
WriteData("M7.3", true);
if ((int)obj == 2)
WriteData("M7.7",true);
}
}
public void OverGoOn()
public void OverGoOn(object obj )
{
{
WriteData("M8.0", true);
if ((int)obj == 1)
WriteData("M8.0", true);
if ((int)obj == 2)
WriteData("M8.4",true);
}
}
public void OverGoDown()
public void OverGoDown(object obj )
{
{
WriteData("M8.2", true);
if ((int)obj == 1)
WriteData("M8.2", true);
if ((int)obj == 2)
WriteData("M8.6", true);
}
}
public void FlowInite()
public void FlowInite()
{
{
@@ -255,6 +376,7 @@ namespace BPASmartClient.MorkF
GetStatus("M2.0", new Action<bool[]>((bools) =>
GetStatus("M2.0", new Action<bool[]>((bools) =>
{
{
morkF.KitchenOneStatus = bools[1];
morkF.KitchenOneStatus = bools[1];
morkF.KitchenSecondStatus = bools[4];
morkF.FallOilComplete = bools[8];
morkF.FallOilComplete = bools[8];
}));
}));
GetStatus("M8.0", new Action<bool[]>((bools) =>
GetStatus("M8.0", new Action<bool[]>((bools) =>
@@ -339,7 +461,7 @@ namespace BPASmartClient.MorkF
{
{
if (order.MorkOrder.GoodBatchings == null) return;
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
DeviceProcessLogShow($"接收到{OrderCount}次订单");
foreach (var item in order.MorkOrder.GoodBatchings)
foreach (var item in order.MorkOrder.GoodBatchings)
{
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
@@ -405,7 +527,7 @@ namespace BPASmartClient.MorkF
morkF.listStirBom.RemoveAt(0);
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)
foreach (var res in bom.StirFryActions)
{
{
DeviceProcessLogShow($"执行流程{res.Time}");
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
Task taskRobot = Task.Run(new Action(() =>
{
{
@@ -524,7 +646,7 @@ namespace BPASmartClient.MorkF
morkF.listStirBom.RemoveAt(0);
morkF.listStirBom.RemoveAt(0);
foreach (var res in bom.StirFryActions)//遍历所有流程
foreach (var res in bom.StirFryActions)//遍历所有流程
{
{
DeviceProcessLogShow($"执行流程{res.Time}");
DeviceProcessLogShow($"执行流程{res.Time}");
//机器人线程
//机器人线程
Task taskRobot = Task.Run(new Action(() =>
Task taskRobot = Task.Run(new Action(() =>
{
{
@@ -647,7 +769,7 @@ namespace BPASmartClient.MorkF
if (morkF.MinorOutMealComplete)
if (morkF.MinorOutMealComplete)
{
{
morkF.TakePlateLock = false;
morkF.TakePlateLock = false;
morkF.PotInPlace = false;
morkF.Second PotInPlace = false;
morkF.MinorProcessExcuteLock = false;
morkF.MinorProcessExcuteLock = false;
morkF.MinorOrderMaterialCom = false;
morkF.MinorOrderMaterialCom = false;
}
}
@@ -718,7 +840,7 @@ namespace BPASmartClient.MorkF
morkF.MainOutMealComplete = false;
morkF.MainOutMealComplete = false;
morkF.MinorOutMealComplete = false;
morkF.MinorOutMealComplete = false;
// OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING);
// OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{order.SuborderId}】执行取碗控制");
DeviceProcessLogShow($"订单【{order.SuborderId}】执行取碗控制");
}
}
}
}
}
}
@@ -741,20 +863,43 @@ namespace BPASmartClient.MorkF
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
TakePotToKitchen();
WriteData("M1.5", false);//清洗模组1完成复位
WriteData("M2.0", false);//清洗模组2完成复位
if (!morkF.CleanModule && !morkF.KitchenOneStatus && morkF.CleanComplete)
{
//取1号锅到1号灶台
TakePotToKitchen(1);
morkF.CurrentPutPotLoc = 1;
WriteData("M1.5", false);//清洗模组1完成复位
}
if (!morkF.SecondCleanModule && !morkF.KitchenSecondStatus && morkF.SecondCleanComplete)
{
//取2号锅到2号灶台
TakePotToKitchen(2);
morkF.CurrentPutPotLoc = 2;
WriteData("M2.0", false);//清洗模组2完成复位
}
if (morkF.MainProcessStatus)
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
while (!morkF.PutPotToKitchenComlete)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
if (morkF.CurrentPutPotLoc == 1)
{
{
Task.Delay(5).Wait();
while (!morkF.PutPotToKitchenComlete)
{
Task.Delay(5).Wait();
}
morkF.PotInPlace = morkF.PutPotToKitchenComlete;//锅到位
WriteData("M14.0", false);//机器人取锅完成复位
}
}
morkF.PotInPlace = morkF.PutPotToKitchenComlete;//锅到位
WriteData("M14.0", false);//机器人取锅完成复位
if (morkF.CurrentPutPotLoc == 2)
{
while (!morkF.PutPotToSecondKitchenComlete)
{
Task.Delay(5).Wait();
}
morkF.SecondPotInPlace = morkF.PutPotToSecondKitchenComlete;
WriteData("M14.4", false);//机器人取锅完成复位
}
Thread.Sleep(2000);
Thread.Sleep(2000);
@@ -783,7 +928,7 @@ namespace BPASmartClient.MorkF
private void TakeBurdenATask()
private void TakeBurdenATask()
{
{
int loc = 0;
int loc = 0;
while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
while (morkF.RoobotIdle || ( !morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
@@ -793,15 +938,24 @@ namespace BPASmartClient.MorkF
TakeBurden(loc);
TakeBurden(loc);
TurnReset(loc);//转台复位
TurnReset(loc);//转台复位
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料");
}
}
//等待取料完成
//等待取料完成
while (!morkF.TakeMaterialComplete)
while (!morkF.TakeMaterialComplete)
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
if (morkF.MainProcessStatus)
{
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
}
if (morkF.MinorProessStatus)
{
morkF.MinorOrderMaterialCom = false;
WriteData("M14.5", false);//机器人取料完成复位
}
morkF.TurnTableLock = false;//转台互锁解除
morkF.TurnTableLock = false;//转台互锁解除
@@ -811,7 +965,7 @@ namespace BPASmartClient.MorkF
/// </summary>
/// </summary>
private void TakeBurdenBTask()
private void TakeBurdenBTask()
{
{
while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
while (morkF.RoobotIdle || ( !morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
@@ -820,7 +974,7 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
int loc = order.MaterialLoc;
TakeBurden(loc);
TakeBurden(loc);
TurnReset(loc);//转台复位
TurnReset(loc);//转台复位
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取B料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取B料");
}
}
//等待取料完成
//等待取料完成
while (!morkF.TakeMaterialComplete)
while (!morkF.TakeMaterialComplete)
@@ -828,7 +982,16 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
morkF.MainOrderMaterialCom = false;
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
if (morkF.MainProcessStatus)
{
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
}
if (morkF.MinorProessStatus)
{
morkF.MinorOrderMaterialCom = false;
WriteData("M14.5", false);//机器人取料完成复位
}
morkF.TurnTableLock = false;//转台互锁解除
morkF.TurnTableLock = false;//转台互锁解除
//while (!morkF.FallMaterialComplete)//等待倒料完成
//while (!morkF.FallMaterialComplete)//等待倒料完成
//{
//{
@@ -842,7 +1005,7 @@ namespace BPASmartClient.MorkF
/// <exception cref="NotImplementedException"></exception>
/// <exception cref="NotImplementedException"></exception>
private void TakeBurdenCTask()
private void TakeBurdenCTask()
{
{
while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
while (morkF.RoobotIdle || ( !morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
@@ -851,7 +1014,7 @@ namespace BPASmartClient.MorkF
int loc = order.MaterialLoc;
int loc = order.MaterialLoc;
TakeBurden(loc);
TakeBurden(loc);
TurnReset(loc);//转台复位
TurnReset(loc);//转台复位
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料");
DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料");
}
}
DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}");
//等待取料完成
//等待取料完成
@@ -860,7 +1023,16 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
morkF.MainOrderMaterialCom = false;
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
if (morkF.MainProcessStatus)
{
morkF.MainOrderMaterialCom = false;
WriteData("M14.1", false);//机器人取料完成复位
}
if (morkF.MinorProessStatus)
{
morkF.MinorOrderMaterialCom = false;
WriteData("M14.5", false);//机器人取料完成复位
}
morkF.TurnTableLock = false;//转台互锁解除
morkF.TurnTableLock = false;//转台互锁解除
//while (!morkF.FallMaterialComplete)
//while (!morkF.FallMaterialComplete)
//{
//{
@@ -891,9 +1063,9 @@ namespace BPASmartClient.MorkF
RobotOutMeal();
RobotOutMeal();
WriteData("M1.2", false);//供盘复位
WriteData("M1.2", false);//供盘复位
if (morkF.MainProcessStatus)
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶 台控制");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到清洗 台控制");
if (morkF.MinorProessStatus)
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶 台控制");
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到清洗 台控制");
}
}
@@ -902,27 +1074,30 @@ namespace BPASmartClient.MorkF
/// </summary>
/// </summary>
private void CleanPotTask()
private void CleanPotTask()
{
{
while (!morkF.PlaceRinseTableComplete || morkF.CleanModule)
while (!morkF.PlaceRinseTableComplete || (( morkF.CleanModule && !morkF.MainProcessStatus) && (morkF.SecondCleanModule && !morkF.MinorProessStatus)) )
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
if (morkF.MainProcessStatus)
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
WriteData("M14.2", false);//机器人出餐完成复位
//OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK);
CleanModuleControl("Start");
if (morkF.MainProcessStatus)//主流程
{
{
WriteData("M14.2", false);//机器人2号锅出餐完成复位
CleanModuleControl("Start");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行清洗操作");
morkF.MainProcessFlag = false;
morkF.MainProcessFlag = false;
minorReset.Set();
minorReset.Set();
}
}
else if (morkF.MinorProessStatus)//辅流程
if (morkF.MinorProessStatus)
{
{
WriteData("M14.6", false);//机器人2号锅出餐完成复位
CleanModuleControl("Start");
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行清洗操作");
morkF.MinorProcessFlag = false;
morkF.MinorProcessFlag = false;
mainReset.Set();
mainReset.Set();
}
}
//OrderChange(morkF.CurrentOrderId, ORDER_STATUS.COMPLETED_COOK);
}
}
/// <summary>
/// <summary>
/// 任务复位重启
/// 任务复位重启
@@ -957,12 +1132,23 @@ namespace BPASmartClient.MorkF
{
{
TurnMachineOrientControl("Down");
TurnMachineOrientControl("Down");
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成
if (morkF.MainProcessStatus)
{
{
Task.Delay(5).Wait();
while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成
{
Task.Delay(5).Wait();
}
WriteData("M8.3", false);//下降完成复位
}
}
WriteData("M8.3", false);//下降完成复位
DeviceProcessLogShow($"翻转机下降完成");
if (morkF.MinorProessStatus)
{
while (!morkF.SecondTurnMachineDownComplete)//等待翻转机下降完成
{
Task.Delay(5).Wait();
}
WriteData("M8.7", false);//下降完成复位
}
DeviceProcessLogShow($"翻转机下降完成");
//if (morkF.MaterialCount == 3 && morkF.MainProcessStatus)
//if (morkF.MaterialCount == 3 && morkF.MainProcessStatus)
//{
//{
// morkF.MainProcessWait = true;
// morkF.MainProcessWait = true;
@@ -983,11 +1169,22 @@ namespace BPASmartClient.MorkF
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
TurnMachineOrientControl("Top");//翻转机上升
TurnMachineOrientControl("Top");//翻转机上升
while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成
if (morkF.MainProcessStatus)
{
{
Task.Delay(5).Wait();
while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成
{
Task.Delay(5).Wait();
}
WriteData("M8.1", false);//上升完成复位
}
if (morkF.MinorProessStatus)
{
while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成
{
Task.Delay(5).Wait();
}
WriteData("M8.5", false);//上升完成复位
}
}
WriteData("M8.1", false);//上升完成复位
if (morkF.MainProcessStatus)//代表主流程执行的操作
if (morkF.MainProcessStatus)//代表主流程执行的操作
{
{
if (!morkF.MainOrderMaterialCom)
if (!morkF.MainOrderMaterialCom)
@@ -1007,7 +1204,7 @@ namespace BPASmartClient.MorkF
}
}
morkF.MainOrderMaterialCom = true;
morkF.MainOrderMaterialCom = true;
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成");
}
}
else //辅程准备阻塞
else //辅程准备阻塞
{
{
@@ -1019,7 +1216,7 @@ namespace BPASmartClient.MorkF
if (!morkF.MinorOrderMaterialCom)
if (!morkF.MinorOrderMaterialCom)
{
{
WriteData("M14.3", true);//倒料
WriteData("M14.3", true);//倒料
while (!morkF.FallMaterialComplete)//等待倒料完成
while (!morkF.Second FallMaterialComplete)//等待倒料完成
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
@@ -1033,7 +1230,7 @@ namespace BPASmartClient.MorkF
}
}
morkF.MinorOrderMaterialCom = true;
morkF.MinorOrderMaterialCom = true;
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成");
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成");
}
}
else //主流程准备阻塞
else //主流程准备阻塞
{
{
@@ -1041,7 +1238,7 @@ namespace BPASmartClient.MorkF
}
}
}
}
DeviceProcessLogShow("翻转机上升完成");
DeviceProcessLogShow("翻转机上升完成");
}
}
private void GetStatus(string key, Action<bool[]> action)
private void GetStatus(string key, Action<bool[]> action)
@@ -1073,41 +1270,71 @@ namespace BPASmartClient.MorkF
switch (number)
switch (number)
{
{
case 0:
case 0:
WriteData("M4.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000
break;
break;
case 1:
case 1:
WriteData("M4.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { true, false, false, false, false, false, false, false });//0000 0001
break;
break;
case 2:
case 2:
WriteData("M4.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0010
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0010
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { false, true, false, false, false, false, false, false });//0000 0010
break;
break;
case 3:
case 3:
WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0011
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0011
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { true, true, false, false, false, false, false, false });//0000 0011
break;
break;
case 4:
case 4:
WriteData("M4.0", new bool[] { false, false, true, false, false, false, false, false });//0000 0100
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { false, false, true, false, false, false, false, false });//0000 0100
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { false, false, true, false, false, false, false, false });//0000 0100
break;
break;
case 5:
case 5:
WriteData("M4.0", new bool[] { true, false, true, false, false, false, false, false });//0000 0101
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { true, false, true, false, false, false, false, false });//0000 0101
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { true, false, true, false, false, false, false, false });//0000 0101
break;
break;
case 6:
case 6:
WriteData("M4.0", new bool[] { false, true, true, false, false, false, false, false });//0000 0110
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { false, true, true, false, false, false, false, false });//0000 0110
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { false, true, true, false, false, false, false, false });//0000 0110
break;
break;
case 7:
case 7:
WriteData("M4.0", new bool[] { true, true, true, false, false, false, false, false });//0000 0111
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { true, true, true, false, false, false, false, false });//0000 0111
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { true, true, true, false, false, false, false, false });//0000 0111
break;
break;
case 8:
case 8:
WriteData("M4.0", new bool[] { false, false, false, true, false, false, false, false });//0000 1000
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { false, false, false, true, false, false, false, false });//0000 1000
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { false, false, false, true, false, false, false, false });//0000 1000
break;
break;
case 9:
case 9:
WriteData("M4.0", new bool[] { true, false, false, true, false, false, false, false });//0000 1001
if (morkF.MainProcessStatus)
WriteData("M4.0", new bool[] { true, false, false, true, false, false, false, false });//0000 1001
if (morkF.MinorProessStatus)
WriteData("M5.0", new bool[] { true, false, false, true, false, false, false, false });//0000 1001
break;
break;
}
}
if (morkF.MainProcessStatus)
if (morkF.MainProcessStatus)
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制");
if (morkF.MinorProessStatus)
if (morkF.MinorProessStatus)
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制");
}
}
public void TurnMaterialStore(int loc)
public void TurnMaterialStore(int loc)
{
{
@@ -1146,16 +1373,22 @@ namespace BPASmartClient.MorkF
/// <summary>
/// <summary>
/// 取锅到灶台
/// 取锅到灶台
/// </summary>
/// </summary>
public void TakePotToKitchen()
public void TakePotToKitchen(int loc )
{
{
WriteData("M14.0", true);
if (loc == 1)
WriteData("M14.0", true);
if (loc == 2)
WriteData("M14.4", true);
}
}
/// <summary>
/// <summary>
/// 机器人出餐并将锅放置清洗台位置
/// 机器人出餐并将锅放置清洗台位置
/// </summary>
/// </summary>
public void RobotOutMeal()
public void RobotOutMeal()
{
{
WriteData("M14.2", true);
if (morkF.MainProcessStatus)
WriteData("M14.2", true);//1号锅出餐
if (morkF.MinorProessStatus)
WriteData("M14.6", true);//2号锅出餐
}
}
/// <summary>
/// <summary>
/// 注油
/// 注油
@@ -1166,15 +1399,17 @@ namespace BPASmartClient.MorkF
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
WriteData("M2.7", true);//加油
if (morkF.MainProcessStatus)
WriteData("M2.7", true);//加油
if (morkF.MinorProessStatus)
WriteData("M3.1", true);//加油
WriteData("M0.7", true);//打开抽风机
WriteData("M0.7", true);//打开抽风机
DeviceProcessLogShow("开始注油");
while (!morkF.FallOilComplete)
DeviceProcessLogShow("开始注油");
while (!morkF.FallOilComplete || !morkF.SecondOilComplete )
{
{
Task.Delay(5).Wait();
Task.Delay(5).Wait();
}
}
DeviceProcessLogShow("注油完成");
DeviceProcessLogShow("注油完成");
}
}
/// <summary>
/// <summary>
@@ -1185,11 +1420,10 @@ namespace BPASmartClient.MorkF
{
{
switch (orientation)
switch (orientation)
{
{
case "Top": WriteData("M8.0", true); break;
// case "Middle": WriteData("", 1); break;
case "Down": WriteData("M8.2", true); break;
case "Top": if (morkF.MainProcessStatus) WriteData("M8.0", true); if (morkF.MinorProessStatus) WriteData("M8.4", true); break;
case "Down": if (morkF.MainProcessStatus) WriteData("M8.2", true); if (morkF.MinorProessStatus) WriteData("M8.6", true); break;
}
}
DeviceProcessLogShow($"翻转机执行{orientation}操作");
DeviceProcessLogShow($"翻转机执行{orientation}操作");
}
}
/// <summary>
/// <summary>
/// 翻转机档位控制
/// 翻转机档位控制
@@ -1202,34 +1436,52 @@ namespace BPASmartClient.MorkF
}
}
switch (gear)
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挡
case 0: if (morkF.MainProcessStatus) WriteData("M7.0", true); Task.Delay(1000).Wait(); if (morkF.MinorProessStatus) WriteData("M7.4", true ); break;//关闭翻炒机
case 1: if (morkF.MainProcessStatus) WriteData("M7.1", true); if (morkF.MinorProessStatus) WriteData("M7.5 ", true); break;//翻炒机1挡
case 2: if (morkF.MainProcessStatus) WriteData("M7.2", true); if (morkF.MinorProessStatus) WriteData("M7.6 ", true); break;//翻炒机2挡
case 3: if (morkF.MainProcessStatus) WriteData("M7.3", true); if (morkF.MinorProessStatus) WriteData("M7.7 ", true); break;//翻炒机3挡
}
}
DeviceProcessLogShow($"翻转机档位调至{gear}挡");
DeviceProcessLogShow($"翻转机档位调至{gear}挡");
}
}
/// <summary>
/// <summary>
/// 取 A,B,C料
/// 倒 A,B,C料
/// </summary>
/// </summary>
public void TakeBurden(int loc)
public void TakeBurden(int loc)
{
{
WriteData("M14.1", true);//机器人取料
if (morkF.MainProcessStatus && morkF.PotInPlace)
WriteData("M14.1", true);//机器人倒料至1号锅
if (morkF.MinorProessStatus && morkF.SecondPotInPlace)
WriteData("M14.5", true);//机器人倒料至2号锅
}
}
/// <summary>
/// <summary>
/// 清洗模组1启停控制
/// 清洗模组1启停控制
/// </summary>
/// </summary>
public void CleanModuleControl(string status)
public void CleanModuleControl(string status)
{
{
if (status == "Start" )
if (morkF.MainProcessStatus )
{
{
WriteData("M1.4", true);
if (status == "Start")
{
WriteData("M1.4", true);
}
if (status == "Stop")
{
WriteData("M1.4", false);
}
DeviceProcessLogShow($"清洗模组1执行【{status}】操作");
}
}
if (status == "Stop")
if (morkF.MinorProe ssS tatus)
{
{
WriteData("M1.4", false);
if (status == "Start")
{
WriteData("M1.7", true);
}
if (status == "Stop")
{
WriteData("M1.7", false);
}
DeviceProcessLogShow($"清洗模组2执行【{status}】操作");
}
}
DeviceProcessLogShow($"清洗模组执行【{status}】操作");
}
}
public override void Stop()
public override void Stop()