From f58ec56bf94ac91792cb32cd6ed5ebe121595646 Mon Sep 17 00:00:00 2001 From: taoye Date: Mon, 13 Jun 2022 14:44:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=82=92=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BPASmartClient.Business.csproj | 2 +- .../BPASmartClient.CustomResource.csproj | 2 +- .../BPASmartClient.Device.csproj | 2 +- .../BPASmartClient.Model.csproj | 2 +- .../BPASmartClient.MorkF.csproj | 2 +- BPASmartClient.MorkF/Control_MorkF.cs | 1042 +++++++++++++---- BPASmartClient.MorkF/GVL_MorkF.cs | 20 +- .../BPASmartClient.MorkS.csproj | 2 +- .../BPASmartClient.MorkT_HQ.csproj | 2 +- 9 files changed, 831 insertions(+), 245 deletions(-) diff --git a/BPASmartClient.Business/BPASmartClient.Business.csproj b/BPASmartClient.Business/BPASmartClient.Business.csproj index a6ae8690..88631d12 100644 --- a/BPASmartClient.Business/BPASmartClient.Business.csproj +++ b/BPASmartClient.Business/BPASmartClient.Business.csproj @@ -8,7 +8,7 @@ - + diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index a29b2e0c..28267f47 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -229,7 +229,7 @@ - + diff --git a/BPASmartClient.Device/BPASmartClient.Device.csproj b/BPASmartClient.Device/BPASmartClient.Device.csproj index 2909a1c3..5e442528 100644 --- a/BPASmartClient.Device/BPASmartClient.Device.csproj +++ b/BPASmartClient.Device/BPASmartClient.Device.csproj @@ -7,7 +7,7 @@ - + diff --git a/BPASmartClient.Model/BPASmartClient.Model.csproj b/BPASmartClient.Model/BPASmartClient.Model.csproj index 4917a104..9a94b652 100644 --- a/BPASmartClient.Model/BPASmartClient.Model.csproj +++ b/BPASmartClient.Model/BPASmartClient.Model.csproj @@ -17,7 +17,7 @@ - + diff --git a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj index dd2bae25..79c30eda 100644 --- a/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj +++ b/BPASmartClient.MorkF/BPASmartClient.MorkF.csproj @@ -10,7 +10,7 @@ - + diff --git a/BPASmartClient.MorkF/Control_MorkF.cs b/BPASmartClient.MorkF/Control_MorkF.cs index 9828a889..1c0c1cf8 100644 --- a/BPASmartClient.MorkF/Control_MorkF.cs +++ b/BPASmartClient.MorkF/Control_MorkF.cs @@ -19,7 +19,7 @@ namespace BPASmartClient.MorkF public AutoResetEvent mainReset = new AutoResetEvent(false); GVL_MorkF morkF = new GVL_MorkF();//全局对象声明 public StirFryBom stirFryBom = new StirFryBom();//创建获取流程的对象 - + StirFryGoods stirFryGoods = new StirFryGoods();//创建商品对象 List resultorder = new List();//调试变量 /// /// 入口 @@ -43,7 +43,7 @@ namespace BPASmartClient.MorkF ActionManage.GetInstance.Register(MaterialFive, "MaterialFive"); ActionManage.GetInstance.Register(ManualOpenExhaust, "OpenExhaust"); ActionManage.GetInstance.Register(CloseExhaust, "CloaseExhaust"); - ActionManage.GetInstance.Register(StartQX,"StartQXOne"); + ActionManage.GetInstance.Register(StartQX, "StartQXOne"); ActionManage.GetInstance.Register(StartQX, "StartQXTwo"); ActionManage.GetInstance.Register(ShreddCabbage, "ShreddCabbage"); @@ -55,7 +55,7 @@ namespace BPASmartClient.MorkF ActionManage.GetInstance.Register(TakeMaterial, "TakeMaterial"); ActionManage.GetInstance.Register(ManualOutMeal, "OutMeal"); - ActionManage.GetInstance.Register(AddOil,"AddOil"); + ActionManage.GetInstance.Register(AddOil, "AddOil"); ActionManage.GetInstance.Register(TakeOff, "TakeOff"); ActionManage.GetInstance.Register(OneBlock, "OneBlock"); ActionManage.GetInstance.Register(TwoBlock, "TwoBlock"); @@ -161,7 +161,7 @@ namespace BPASmartClient.MorkF } public void StartQX(object obj) { - + if ((int)obj == 1) WriteData("M1.4", true); if ((int)obj == 2) @@ -169,23 +169,23 @@ namespace BPASmartClient.MorkF } public void ManualOpenExhaust() { - WriteData("M0.7",true); + WriteData("M0.7", true); } public void CloseExhaust() { - WriteData("M0.7",false); + WriteData("M0.7", false); } public void TakeMaterial() { - WriteData("M14.1",true); + WriteData("M14.1", true); } public void ManualOutMeal() { - WriteData("M14.2",true); + WriteData("M14.2", true); } public void MaterialOne() { - WriteData("M13.0",true); + WriteData("M13.0", true); } public void MaterialTwo() @@ -228,7 +228,7 @@ namespace BPASmartClient.MorkF } public void TakePot(object obj) { - + WriteData("M14.0", true); } @@ -286,21 +286,21 @@ namespace BPASmartClient.MorkF if ((int)obj == 1) WriteData("M7.2", true); if ((int)obj == 2) - WriteData("M7.6",true); + WriteData("M7.6", true); } public void OverThreeBlock(object obj) { if ((int)obj == 1) WriteData("M7.3", true); if ((int)obj == 2) - WriteData("M7.7",true); + WriteData("M7.7", true); } public void OverGoOn(object obj) { if ((int)obj == 1) WriteData("M8.0", true); if ((int)obj == 2) - WriteData("M8.4",true); + WriteData("M8.4", true); } public void OverGoDown(object obj) @@ -408,27 +408,7 @@ namespace BPASmartClient.MorkF EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { Status = oRDER_STATUS, SubOrderId = subid }); } - /// - /// 写入配方数据到 PLC - /// - private void WriteRecipeBoms() - { - //List recipeBoms = new List(); - //if (this.recipeBoms == null) return; - //foreach (var item in this.recipeBoms.RecipeIds) - //{ - // foreach (var rec in item.Recipes) - // { - // recipeBoms.Add((ushort)rec); - // } - //} - //if (recipeBoms.Count > 0) - //{ - // //配方数据地址范围:VW2000 - VW2278 - // WriteData("VW2000", recipeBoms.ToArray()); - //} - //else {DeviceProcessLogShow("配方数据为空"); } - } + /// /// 数据解析 @@ -591,12 +571,18 @@ namespace BPASmartClient.MorkF Task.Delay(res.During * 1000).Wait();//当前流程延迟 if (morkF.MainProcessWait) { - - KitchenAdjustGears(0);//关闭灶加热 - morkF.MinorProessStatus = false; - morkF.MainProcessStatus = true; - //阻塞辅流程 - minorReset.WaitOne(); + if (morkF.MinorHasTakeMaterial) + { + } + else + { + KitchenAdjustGears(0);//关闭灶加热 + morkF.MinorProessStatus = false; + morkF.MainProcessStatus = true; + //阻塞辅流程 + minorReset.WaitOne(); + } + } morkF.MinorProessStatus = true; morkF.MainProcessStatus = false; @@ -711,11 +697,18 @@ namespace BPASmartClient.MorkF Task.Delay(res.During * 1000).Wait();//当前流程延迟 if (morkF.MinorProcessWait) { - KitchenAdjustGears(0);//关闭灶加热 - morkF.MinorProessStatus = true; - morkF.MainProcessStatus = false; - //阻塞主流程 - mainReset.WaitOne(); + if (morkF.MainHasTakeMaterial)//针对主流程准备出餐但辅流程机器人忙碌情况下,辅流程不阻塞 + { + } + else + { + KitchenAdjustGears(0);//关闭灶加热 + morkF.MinorProessStatus = true; + morkF.MainProcessStatus = false; + //阻塞主流程 + mainReset.WaitOne(); + } + } morkF.MinorProessStatus = false; morkF.MainProcessStatus = true; @@ -742,17 +735,33 @@ namespace BPASmartClient.MorkF if (morkF.MainOutMealComplete) { morkF.TakePlateLock = false; - morkF.PotInPlace = false; morkF.MainProcessExcuteLock = false; morkF.MainOrderMaterialCom = false; + morkF.MinorProcessWait = false;//主流程出餐完成取消辅流程线程阻塞 + if (morkF.MainProcessPotLoc == 1) + { + morkF.PotInPlace = false; + } + else if (morkF.MainProcessPotLoc == 2) + { + morkF.SecondPotInPlace = false; + } } //辅流程出餐完成,相应变量复位 if (morkF.MinorOutMealComplete) { morkF.TakePlateLock = false; - morkF.SecondPotInPlace = false; morkF.MinorProcessExcuteLock = false; morkF.MinorOrderMaterialCom = false; + morkF.MainProcessWait = false;//辅流程出餐完成取消主流程线程阻塞 + if (morkF.MinorProcessPotLoc == 1) + { + morkF.PotInPlace = false; + } + else if (morkF.MinorProcessPotLoc == 2) + { + morkF.SecondPotInPlace = false; + } } } @@ -796,6 +805,7 @@ namespace BPASmartClient.MorkF { DeviceProcessLogShow("未找到可用的物料信息"); } + } } @@ -851,6 +861,13 @@ namespace BPASmartClient.MorkF morkF.CurrentPutPotLoc = 1; WriteData("M1.5", false);//清洗模组1完成复位 } + else if (!morkF.SecondCleanModule && !morkF.KitchenOneStatus && morkF.SecondCleanComplete) + { + //取2号锅到1号灶台 + TakePotToKitchen(1); + morkF.CurrentPutPotLoc = 1; + WriteData("M2.0", false);//清洗模组2完成复位 + } if (!morkF.SecondCleanModule && !morkF.KitchenSecondStatus && morkF.SecondCleanComplete) { //取2号锅到2号灶台 @@ -858,10 +875,23 @@ namespace BPASmartClient.MorkF morkF.CurrentPutPotLoc = 2; WriteData("M2.0", false);//清洗模组2完成复位 } + else if (!morkF.CleanModule && !morkF.KitchenSecondStatus && morkF.CleanComplete) + { + //取1号锅到2号灶台 + TakePotToKitchen(2); + morkF.CurrentPutPotLoc = 2; + WriteData("M2.0", false);//清洗模组1完成复位 + } if (morkF.MainProcessStatus) + { + morkF.MainProcessPotLoc = morkF.CurrentPutPotLoc; DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制"); + } if (morkF.MinorProessStatus) + { + morkF.MinorProcessPotLoc = morkF.CurrentPutPotLoc; DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); + } if (morkF.CurrentPutPotLoc == 1) { while (!morkF.PutPotToKitchenComlete) @@ -887,6 +917,28 @@ namespace BPASmartClient.MorkF + } + + /// + /// 写入配方数据到 PLC + /// + private void WriteRecipeBoms() + { + //List recipeBoms = new List(); + //if (this.recipeBoms == null) return; + //foreach (var item in this.recipeBoms.RecipeIds) + //{ + // foreach (var rec in item.Recipes) + // { + // recipeBoms.Add((ushort)rec); + // } + //} + //if (recipeBoms.Count > 0) + //{ + // //配方数据地址范围:VW2000 - VW2278 + // WriteData("VW2000", recipeBoms.ToArray()); + //} + //else {DeviceProcessLogShow("配方数据为空"); } } /// /// 转台复位 @@ -909,76 +961,158 @@ namespace BPASmartClient.MorkF private void TakeBurdenATask() { int loc = 0; - while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 - { - Task.Delay(5).Wait(); - } - if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) - { - loc = order.MaterialLoc; - TakeBurden(loc); - TurnReset(loc);//转台复位 - - DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); - } - //等待取料完成 - while (!morkF.TakeMaterialComplete) - { - Task.Delay(5).Wait(); - } - + //while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 + //{ + // Task.Delay(5).Wait(); + //} if (morkF.MainProcessStatus) { + if (morkF.MainProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MainOrderMaterialCom = false; + morkF.MainHasTakeMaterial = true; WriteData("M14.1", false);//机器人取料完成复位 } if (morkF.MinorProessStatus) { + if (morkF.MinorProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MinorOrderMaterialCom = false; + morkF.MinorHasTakeMaterial = true; WriteData("M14.5", false);//机器人取料完成复位 } morkF.TurnTableLock = false;//转台互锁解除 } + /// /// 取素菜B料 /// private void TakeBurdenBTask() { - while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 - { - Task.Delay(5).Wait(); - } - if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) - { - int loc = order.MaterialLoc; - TakeBurden(loc); - TurnReset(loc);//转台复位 - DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取B料"); - } - //等待取料完成 - while (!morkF.TakeMaterialComplete) - { - Task.Delay(5).Wait(); - } - morkF.MainOrderMaterialCom = false; + int loc = 0; + //while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 + //{ + // Task.Delay(5).Wait(); + //} if (morkF.MainProcessStatus) { + if (morkF.MainProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MainOrderMaterialCom = false; + morkF.MainHasTakeMaterial = true; WriteData("M14.1", false);//机器人取料完成复位 } if (morkF.MinorProessStatus) { + if (morkF.MinorProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MinorOrderMaterialCom = false; + morkF.MinorHasTakeMaterial = true; WriteData("M14.5", false);//机器人取料完成复位 } morkF.TurnTableLock = false;//转台互锁解除 - //while (!morkF.FallMaterialComplete)//等待倒料完成 - //{ - // Task.Delay(5).Wait(); - //} - //MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,B料倒料完成"); } /// /// 取调味品C料 @@ -986,42 +1120,110 @@ namespace BPASmartClient.MorkF /// private void TakeBurdenCTask() { - while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 - { - Task.Delay(5).Wait(); - } - if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) - { - int loc = order.MaterialLoc; - TakeBurden(loc); - TurnReset(loc);//转台复位 - DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料"); - } - DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}"); - //等待取料完成 - while (!morkF.TakeMaterialComplete) - { - Task.Delay(5).Wait(); - } - morkF.MainOrderMaterialCom = false; + #region 旧代码 + //while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 + //{ + // Task.Delay(5).Wait(); + //} + //if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + //{ + // int loc = order.MaterialLoc; + // TakeBurden(loc); + // TurnReset(loc);//转台复位 + // DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行取C料"); + //} + //DeviceProcessLogShow($"剩余配料数量{morkF.TakeMaterialQueue.Count}"); + ////等待取料完成 + //while (!morkF.TakeMaterialComplete) + //{ + // Task.Delay(5).Wait(); + //} + //morkF.MainOrderMaterialCom = false; + //if (morkF.MainProcessStatus) + //{ + // morkF.MainOrderMaterialCom = false; + // WriteData("M14.1", false);//机器人取料完成复位 + //} + //if (morkF.MinorProessStatus) + //{ + // morkF.MinorOrderMaterialCom = false; + // WriteData("M14.5", false);//机器人取料完成复位 + //} + //morkF.TurnTableLock = false;//转台互锁解除 + #endregion + int loc = 0; + //while (morkF.RoobotIdle || (!morkF.PotInPlace && !morkF.SecondPotInPlace) || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅到位 + //{ + // Task.Delay(5).Wait(); + //} if (morkF.MainProcessStatus) { + if (morkF.MainProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MainOrderMaterialCom = false; + morkF.MainHasTakeMaterial = true; WriteData("M14.1", false);//机器人取料完成复位 } if (morkF.MinorProessStatus) { + if (morkF.MinorProcessPotLoc == 1) + { + while (morkF.RoobotIdle || !morkF.PotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅1到位 + { + Task.Delay(5).Wait(); + } + } + else + { + while (morkF.RoobotIdle || !morkF.SecondPotInPlace || !morkF.MaterialArriveComplete)//等待机器人空闲以及锅2到位 + { + Task.Delay(5).Wait(); + } + } + if (morkF.TakeMaterialQueue.TryDequeue(out OrderLocInfo order)) + { + loc = order.MaterialLoc; + TakeBurden(loc); + TurnReset(loc);//转台复位 + + DeviceProcessLogShow($"订单【{ order.SuborderId}】,执行到转台{loc}位置取料"); + } + //等待取料完成 + while (!morkF.TakeMaterialComplete) + { + Task.Delay(5).Wait(); + } morkF.MinorOrderMaterialCom = false; + morkF.MinorHasTakeMaterial = true; WriteData("M14.5", false);//机器人取料完成复位 } morkF.TurnTableLock = false;//转台互锁解除 - //while (!morkF.FallMaterialComplete) - //{ - // Task.Delay(5).Wait(); - //} - //morkF.SingelOrderMaterialCom = true; - //MessageLog.GetInstance.Show($"订单【{ order.SuborderId}】,C料倒料完成"); - //} + } /// /// 出餐 @@ -1032,11 +1234,10 @@ namespace BPASmartClient.MorkF //{ // Task.Delay(5).Wait(); //} - while (morkF.RoobotIdle || (!morkF.CleanComplete && !morkF.SecondCleanComplete) || !morkF.ProvidePlateComplete)//等待条件满足 + while (morkF.RoobotIdle || (!morkF.CleanModule && !morkF.SecondCleanModule) || !morkF.ProvidePlateComplete)//等待条件满足 { Task.Delay(5).Wait(); } - if (morkF.TakePlateQueue.Count == 0) { WriteData("M0.7", false);//无订单关闭抽风机 @@ -1055,23 +1256,36 @@ namespace BPASmartClient.MorkF /// private void CleanPotTask() { - while (!morkF.PlaceRinseTableComplete || ((morkF.CleanModule && !morkF.MainProcessStatus) && (morkF.SecondCleanModule && !morkF.MinorProessStatus))) + while ((!morkF.PlaceRinseTableComplete || morkF.CleanModule) && (!morkF.PlaceRinseSecondTableComplete || morkF.SecondCleanModule)) { Task.Delay(5).Wait(); } if (morkF.MainProcessStatus) { - - WriteData("M14.2", false);//机器人2号锅出餐完成复位 - CleanModuleControl("Start"); + WriteData("M14.2", false);//机器人出餐完成复位 + if (morkF.PlaceRinseTableComplete && morkF.CleanModule) + { + CleanModuleControl("Start", 1); + } + if (morkF.PlaceRinseSecondTableComplete && morkF.SecondCleanModule) + { + CleanModuleControl("Start", 2); + } DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行清洗操作"); morkF.MainProcessFlag = false; minorReset.Set(); } if (morkF.MinorProessStatus) { - WriteData("M14.6", false);//机器人2号锅出餐完成复位 - CleanModuleControl("Start"); + WriteData("M14.6", false);//机器人出餐完成复位 + if (morkF.PlaceRinseTableComplete && morkF.CleanModule) + { + CleanModuleControl("Start", 1); + } + if (morkF.PlaceRinseSecondTableComplete && morkF.SecondCleanModule) + { + CleanModuleControl("Start", 2); + } DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行清洗操作"); morkF.MinorProcessFlag = false; mainReset.Set(); @@ -1111,9 +1325,9 @@ namespace BPASmartClient.MorkF /// public void TurnDownStatusDetect() { - TurnMachineOrientControl("Down"); + int potLoc= TurnMachineOrientControl("Down"); - if (morkF.MainProcessStatus) + if (potLoc==1) { while (!morkF.TurnMachineDownComplete)//等待翻转机下降完成 { @@ -1121,7 +1335,7 @@ namespace BPASmartClient.MorkF } WriteData("M8.3", false);//下降完成复位 } - if (morkF.MinorProessStatus) + if (potLoc==2) { while (!morkF.SecondTurnMachineDownComplete)//等待翻转机下降完成 { @@ -1140,6 +1354,7 @@ namespace BPASmartClient.MorkF //} } + /// /// 翻转机上升及状态检测 /// @@ -1152,72 +1367,146 @@ namespace BPASmartClient.MorkF TurnMachineOrientControl("Top");//翻转机上升 if (morkF.MainProcessStatus) { - while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 - { - Task.Delay(5).Wait(); - } - WriteData("M8.1", false);//上升完成复位 - } - if (morkF.MinorProessStatus) - { - while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 + if (morkF.MainProcessPotLoc==1) { - Task.Delay(5).Wait(); - } - WriteData("M8.5", false);//上升完成复位 - } - if (morkF.MainProcessStatus)//代表主流程执行的操作 - { - if (!morkF.MainOrderMaterialCom) - { - WriteData("M14.3", true);//倒料 - while (!morkF.FallMaterialComplete)//等待倒料完成 + while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 { Task.Delay(5).Wait(); } - morkF.MaterialCount++; - WriteData("M14.3", false);//倒料复位 - if (morkF.MaterialCount == 3) + WriteData("M8.1", false);//上升完成复位 + if (!morkF.MainOrderMaterialCom) { - //允许执行下一个订单流程 - morkF.MaterialCount = 0; - morkF.MinorProcessFlag = true; + WriteData("M14.3", true);//倒料 + while (!morkF.FallMaterialComplete)//等待倒料完成 + { + Task.Delay(5).Wait(); + } + morkF.MaterialCount++; + WriteData("M14.3", false);//倒料复位 + if (morkF.MaterialCount == 3) + { + //允许执行下一个订单流程 + morkF.MaterialCount = 0; + morkF.MinorProcessFlag = true; + } + morkF.MainOrderMaterialCom = true; + morkF.MainHasTakeMaterial = false; + DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成"); + } + else //辅程准备阻塞 + { + morkF.MainProcessWait = true; } - morkF.MainOrderMaterialCom = true; - DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成"); } - else //辅程准备阻塞 + if (morkF.MainProcessPotLoc==2) { - morkF.MainProcessWait = true; + while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 + { + Task.Delay(5).Wait(); + } + WriteData("M8.5", false);//上升完成复位 + if (!morkF.MainOrderMaterialCom) + { + WriteData("M14.7", true);//倒料 + while (!morkF.SecondFallMaterialComplete)//等待倒料完成 + { + Task.Delay(5).Wait(); + } + morkF.MaterialCount++; + WriteData("M14.7", false);//倒料复位 + if (morkF.MaterialCount == 3) + { + //允许执行下一个订单流程 + morkF.MaterialCount = 0; + morkF.MinorProcessFlag = true; + + } + morkF.MainOrderMaterialCom = true; + morkF.MainHasTakeMaterial = false; + DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成"); + } + else //辅流程准备阻塞 + { + morkF.MainProcessWait = true; + } } } - else if (morkF.MinorProessStatus)//代表辅流程执行的操作 + if (morkF.MinorProessStatus) { - if (!morkF.MinorOrderMaterialCom) + if (morkF.MinorProcessPotLoc == 1) { - WriteData("M14.3", true);//倒料 - while (!morkF.SecondFallMaterialComplete)//等待倒料完成 + while (!morkF.TurnMachineUpComplete)//等待翻转机上升完成以及取料完成 { Task.Delay(5).Wait(); } - morkF.MaterialCount++; - WriteData("M14.3", false);//倒料复位 - if (morkF.MaterialCount == 3) + WriteData("M8.1", false);//上升完成复位 + if (!morkF.MinorOrderMaterialCom) { - //允许执行下一个订单流程 - morkF.MaterialCount = 0; - morkF.MainProcessFlag = true; + WriteData("M14.3", true);//倒料 + while (!morkF.FallMaterialComplete)//等待倒料完成 + { + Task.Delay(5).Wait(); + } + morkF.MaterialCount++; + WriteData("M14.3", false);//倒料复位 + if (morkF.MaterialCount == 3) + { + //允许执行下一个订单流程 + morkF.MaterialCount = 0; + morkF.MainProcessFlag = true; + } + morkF.MinorOrderMaterialCom = true; + morkF.MinorHasTakeMaterial = false; + DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】,配料倒料完成"); + } + else //主程准备阻塞 + { + morkF.MinorProcessWait = true; } - morkF.MinorOrderMaterialCom = true; - DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成"); } - else //主流程准备阻塞 + if (morkF.MinorProcessPotLoc==2) { - morkF.MinorProcessWait = true; + while (!morkF.SecondTurnMachineUpComplete)//等待翻转机上升完成以及取料完成 + { + Task.Delay(5).Wait(); + } + WriteData("M8.5", false);//上升完成复位 + if (!morkF.MinorOrderMaterialCom) + { + WriteData("M14.7", true);//倒料 + while (!morkF.SecondFallMaterialComplete)//等待倒料完成 + { + Task.Delay(5).Wait(); + } + morkF.MaterialCount++; + WriteData("M14.7", false);//倒料复位 + if (morkF.MaterialCount == 3) + { + //允许执行下一个订单流程 + morkF.MaterialCount = 0; + morkF.MainProcessFlag = true; + + } + morkF.MinorOrderMaterialCom = true; + morkF.MinorHasTakeMaterial = false; + DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】,配料倒料完成"); + } + else //主流程准备阻塞 + { + morkF.MinorProcessWait = true; + } } } + //if (morkF.MainProcessStatus)//代表主流程执行的操作 + //{ + + //} + //else if (morkF.MinorProessStatus)//代表辅流程执行的操作 + //{ + + //} DeviceProcessLogShow("翻转机上升完成"); @@ -1238,85 +1527,199 @@ namespace BPASmartClient.MorkF { EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value }); } - /// - /// 灶台档位调节 - /// - public void KitchenAdjustGears(int number) + + public void FirstPotGears(int number) { - while (!morkF.PotInPlace) + switch (number) { - Task.Delay(5).Wait(); + case 0: + //if (morkF.MainProcessStatus && morkF.PotInPlace) + WriteData("M4.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 + //if (morkF.MinorProessStatus && morkF.SecondPotInPlace) + // WriteData("M5.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 + break; + case 1: + // 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; + case 2: + //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; + case 3: + //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; + case 4: + // 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; + case 5: + 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; + case 6: + // 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; + case 7: + // 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; + case 8: + //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; + case 9: + //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; + } + } + public void SecondPotGears(int number) + { switch (number) { case 0: - 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 + //if (morkF.MainProcessStatus && morkF.PotInPlace) + WriteData("M5.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 + //if (morkF.MinorProessStatus && morkF.SecondPotInPlace) + // WriteData("M5.0", new bool[] { false, false, false, false, false, false, false, false });//0000 0000 break; case 1: - 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 + // if (morkF.MainProcessStatus) + WriteData("M5.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; case 2: - 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 + //if (morkF.MainProcessStatus) + WriteData("M5.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; case 3: - 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 + //if (morkF.MainProcessStatus) + WriteData("M5.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; case 4: - 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 + // if (morkF.MainProcessStatus) + WriteData("M5.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; case 5: 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 + //if (morkF.MinorProessStatus) + // WriteData("M5.0", new bool[] { true, false, true, false, false, false, false, false });//0000 0101 break; case 6: - 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 + // if (morkF.MainProcessStatus) + WriteData("M5.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; case 7: - 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 + // if (morkF.MainProcessStatus) + WriteData("M5.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; case 8: - 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 + //if (morkF.MainProcessStatus) + WriteData("M5.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; case 9: - 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 + //if (morkF.MainProcessStatus) + WriteData("M5.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; } + } + /// + /// 灶台档位调节 + /// + public void KitchenAdjustGears(int number) + { + //while (!morkF.PotInPlace||!morkF.SecondPotInPlace) + //{ + // Task.Delay(5).Wait(); + //} + if (morkF.MainProcessStatus) + { + if (morkF.MainProcessPotLoc == 1) + { + while (!morkF.PotInPlace) + { + Task.Delay(5).Wait(); + } + FirstPotGears(number); + } + if (morkF.MainProcessPotLoc == 2) + { + while (!morkF.SecondPotInPlace) + { + Task.Delay(5).Wait(); + } + SecondPotGears(number); + } + + } + if (morkF.MinorProessStatus) + { + if (morkF.MinorProcessPotLoc == 1) + { + while (!morkF.PotInPlace) + { + Task.Delay(5).Wait(); + } + FirstPotGears(number); + } + if (morkF.MinorProcessPotLoc==2) + { + while (!morkF.SecondPotInPlace) + { + Task.Delay(5).Wait(); + } + SecondPotGears(number); + } + } if (morkF.MainProcessStatus) DeviceProcessLogShow($"订单【{ morkF.MainCurrentOrderId}】执行取锅到灶台控制"); if (morkF.MinorProessStatus) DeviceProcessLogShow($"订单【{ morkF.MinorCurrentOrderId}】执行取锅到灶台控制"); } + /// + /// PLC转台控制 + /// + /// public void TurnMaterialStore(int loc) { switch (loc) @@ -1367,65 +1770,231 @@ namespace BPASmartClient.MorkF public void RobotOutMeal() { if (morkF.MainProcessStatus) - WriteData("M14.2", true);//1号锅出餐 + { + if (morkF.MainProcessPotLoc == 1) + { + WriteData("M14.2", true);//1号锅出餐 + } + else if (morkF.MainProcessPotLoc == 2) + { + WriteData("M14.6", true);//2号锅出餐 + } + } if (morkF.MinorProessStatus) - WriteData("M14.6", true);//2号锅出餐 + { + if (morkF.MinorProcessPotLoc == 1) + { + WriteData("M14.2", true);//1号锅出餐 + } + else if (morkF.MinorProcessPotLoc == 2) + { + WriteData("M14.6", true);//2号锅出餐 + } + } + + } + public void OpenDraft() + { + WriteData("M0.7", true);//打开抽风机 } /// /// 注油 /// public void AddOil() { - while (!morkF.PotInPlace) + if (morkF.MainProcessStatus) { - Task.Delay(5).Wait(); + if (morkF.MainProcessPotLoc == 1) + { + while (!morkF.PotInPlace) + { + Task.Delay(5).Wait(); + } + WriteData("M2.7", true);//加油 + OpenDraft(); + DeviceProcessLogShow("开始注油"); + while (!morkF.FallOilComplete) + { + Task.Delay(5).Wait(); + } + } + if (morkF.MainProcessPotLoc==2) + { + while (!morkF.SecondPotInPlace) + { + Task.Delay(5).Wait(); + } + WriteData("M3.1", true);//加油 + OpenDraft(); + DeviceProcessLogShow("开始注油"); + while (!morkF.SecondOilComplete) + { + Task.Delay(5).Wait(); + } + } + } - if (morkF.MainProcessStatus) - WriteData("M2.7", true);//加油 if (morkF.MinorProessStatus) - WriteData("M3.1", true);//加油 - WriteData("M0.7", true);//打开抽风机 - DeviceProcessLogShow("开始注油"); - while (!morkF.FallOilComplete || !morkF.SecondOilComplete) { - Task.Delay(5).Wait(); + if (morkF.MinorProcessPotLoc == 1) + { + while (!morkF.PotInPlace) + { + Task.Delay(5).Wait(); + } + WriteData("M2.7", true);//加油 + OpenDraft(); + DeviceProcessLogShow("开始注油"); + while (!morkF.FallOilComplete) + { + Task.Delay(5).Wait(); + } + } + if (morkF.MinorProcessPotLoc == 2) + { + while (!morkF.SecondPotInPlace) + { + Task.Delay(5).Wait(); + } + WriteData("M3.1", true);//加油 + OpenDraft(); + DeviceProcessLogShow("开始注油"); + while (!morkF.SecondOilComplete) + { + Task.Delay(5).Wait(); + } + } } + //while (!morkF.FallOilComplete || !morkF.SecondOilComplete) + //{ + // Task.Delay(5).Wait(); + //} DeviceProcessLogShow("注油完成"); } + public void FirstPotTurnMachine(string orientation) + { + switch (orientation) + { + case "Top": WriteData("M8.0", true); break; + case "Down": WriteData("M8.2", true); break; + } + } + public void SecondPotTurnMachine(string orientation) + { + switch (orientation) + { + case "Top": WriteData("M8.4", true); break; + case "Down": WriteData("M8.6", true); break; + } + } + /// /// 翻转机方向控制 /// /// - public void TurnMachineOrientControl(string orientation) + public int TurnMachineOrientControl(string orientation) { - switch (orientation) + int potLoc=0; ; + //switch (orientation) + //{ + // 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; + //} + if (morkF.MainProcessStatus) + { + if (morkF.MainProcessPotLoc == 1) + { + FirstPotTurnMachine(orientation); + potLoc = 1; + } + if (morkF.MainProcessPotLoc == 2) + { + SecondPotTurnMachine(orientation); + potLoc=2; + } + } + if (morkF.MinorProessStatus) { - 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; + if (morkF.MinorProcessPotLoc == 1) + { + FirstPotTurnMachine(orientation); + potLoc = 1; + } + if (morkF.MinorProcessPotLoc == 2) + { + SecondPotTurnMachine(orientation); + potLoc = 2; + } } DeviceProcessLogShow($"翻转机执行{orientation}操作"); + return potLoc; + } + + public void FirstPotTurnMachine(int gear) + { + while (!morkF.PotInPlace) + { + Task.Delay(5).Wait(); + } + 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挡 + } + } + public void SecondPotTurnMachine(int gear) + { + while (!morkF.SecondPotInPlace) + { + Task.Delay(5).Wait(); + } + switch (gear) + { + case 0: WriteData("M7.4", true); Task.Delay(1000).Wait(); break;//关闭翻炒机 + case 1: WriteData("M7.5", true); break;//翻炒机1挡 + case 2: WriteData("M7.6", true); break;//翻炒机2挡 + case 3: WriteData("M7.7", true); break;//翻炒机3挡 + } } + /// /// 翻转机档位控制 /// public void TurnMachineGearsControl(int gear) { - while (!morkF.PotInPlace) + //while (!morkF.PotInPlace) + //{ + // Task.Delay(5).Wait(); + //} + if (morkF.MainProcessStatus) { - Task.Delay(5).Wait(); + if (morkF.MainProcessPotLoc==1) + { + FirstPotTurnMachine(gear); + } + if (morkF.MainProcessPotLoc == 2) + { + SecondPotTurnMachine(gear); + } } - switch (gear) + if (morkF.MinorProessStatus) { - 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挡 + if (morkF.MinorProcessPotLoc==1) + { + FirstPotTurnMachine(gear); + } + if (morkF.MinorProcessPotLoc == 2) + { + SecondPotTurnMachine(gear); + } } DeviceProcessLogShow($"翻转机档位调至{gear}挡"); } /// - /// 倒A,B,C料 + /// 取A,B,C料 /// public void TakeBurden(int loc) { @@ -1437,9 +2006,9 @@ namespace BPASmartClient.MorkF /// /// 清洗模组1启停控制 /// - public void CleanModuleControl(string status) + public void CleanModuleControl(string status, int loc) { - if (morkF.MainProcessStatus) + if (loc == 1) { if (status == "Start") { @@ -1451,7 +2020,7 @@ namespace BPASmartClient.MorkF } DeviceProcessLogShow($"清洗模组1执行【{status}】操作"); } - if (morkF.MinorProessStatus) + if (loc == 2) { if (status == "Start") { @@ -1472,6 +2041,7 @@ namespace BPASmartClient.MorkF public override void SimOrder() { + } } } \ No newline at end of file diff --git a/BPASmartClient.MorkF/GVL_MorkF.cs b/BPASmartClient.MorkF/GVL_MorkF.cs index 58f001ad..a74c25d0 100644 --- a/BPASmartClient.MorkF/GVL_MorkF.cs +++ b/BPASmartClient.MorkF/GVL_MorkF.cs @@ -231,7 +231,11 @@ namespace BPASmartClient.MorkF /// /// 主流程订单取料结束 /// - public bool MainOrderMaterialCom { get; set; } + public bool MainOrderMaterialCom { get; set; } + /// + /// 主流程是否取料判断 + /// + public bool MainHasTakeMaterial { get; set; } /// /// 主流程等待 /// @@ -245,6 +249,10 @@ namespace BPASmartClient.MorkF /// public bool MinorOrderMaterialCom { get; set; } /// + /// 辅流程是否取料判断 + /// + public bool MinorHasTakeMaterial { get; set; } + /// /// 存储订单对应流程对象 /// public List listStirBom=new List(); @@ -269,11 +277,19 @@ namespace BPASmartClient.MorkF /// /// 主流程执行状态 /// - public bool MainProcessStatus { get; set; } + public bool MainProcessStatus { get; set; } = true; /// /// 当前放锅位置 1:1号锅 2: 2号锅 /// public int CurrentPutPotLoc { get; set; } + /// + /// 主流程所执行的锅位置 + /// + public int MainProcessPotLoc { get; set; } + /// + /// 辅流程所执行的锅位置 + /// + public int MinorProcessPotLoc { get; set; } } } diff --git a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj index f5f6ce16..b6534cb0 100644 --- a/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj +++ b/BPASmartClient.MorkS/BPASmartClient.MorkS.csproj @@ -9,7 +9,7 @@ - + diff --git a/BPASmartClient.MorkT_HQ/BPASmartClient.MorkT_HQ.csproj b/BPASmartClient.MorkT_HQ/BPASmartClient.MorkT_HQ.csproj index 58a91183..89d5ed62 100644 --- a/BPASmartClient.MorkT_HQ/BPASmartClient.MorkT_HQ.csproj +++ b/BPASmartClient.MorkT_HQ/BPASmartClient.MorkT_HQ.csproj @@ -9,7 +9,7 @@ - +