Browse Source

调试更新

样式分支
taoye 2 years ago
parent
commit
868b5c36fc
8 changed files with 604 additions and 198 deletions
  1. +368
    -116
      BPASmartClient.MorkF/Control_MorkF.cs
  2. +41
    -8
      BPASmartClient.MorkF/GVL_MorkF.cs
  3. +71
    -22
      BPASmartClient.MorkF/View/DebugView.xaml
  4. +79
    -17
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  5. +37
    -27
      BPASmartClient.MorkM/View/DebugView.xaml
  6. +5
    -5
      BPASmartClient/DeviceInfo.xml
  7. +1
    -1
      BPASmartClient/MainWindow.xaml
  8. +2
    -2
      BPASmartClient/MainWindow.xaml.cs

+ 368
- 116
BPASmartClient.MorkF/Control_MorkF.cs View File

@@ -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.SecondPotInPlace = 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.SecondFallMaterialComplete)//等待倒料完成
{ {
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.MinorProessStatus)
{ {
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()


+ 41
- 8
BPASmartClient.MorkF/GVL_MorkF.cs View File

@@ -50,17 +50,30 @@ namespace BPASmartClient.MorkF
/// </summary> /// </summary>
public bool KitchenSecondStatus { get; set; } public bool KitchenSecondStatus { get; set; }
/// <summary> /// <summary>
/// 注油完成状态
/// 锅灶1注油完成状态
/// </summary> /// </summary>
public bool FallOilComplete { get; set; } public bool FallOilComplete { get; set; }
/// <summary> /// <summary>
/// 翻转机上升完成状态
/// 锅灶2注油完成状态
/// </summary>
public bool SecondOilComplete { get; set; }
/// <summary>
/// 锅灶1翻转机上升完成状态
/// </summary> /// </summary>
public bool TurnMachineUpComplete { get; set; } public bool TurnMachineUpComplete { get; set; }
/// <summary> /// <summary>
/// 翻转机下降完成状态
/// 锅灶2翻转机上升完成状态
/// </summary>
public bool SecondTurnMachineUpComplete { get; set; }
/// <summary>
/// 锅灶1翻转机下降完成状态
/// </summary> /// </summary>
public bool TurnMachineDownComplete { get; set; } public bool TurnMachineDownComplete { get; set; }

/// <summary>
/// 锅灶2翻转机下降完成状态
/// </summary>
public bool SecondTurnMachineDownComplete { get; set; }
/// <summary> /// <summary>
/// 料仓旋转到位状态 /// 料仓旋转到位状态
/// </summary> /// </summary>
@@ -70,18 +83,26 @@ namespace BPASmartClient.MorkF
/// </summary> /// </summary>
public bool RoobotIdle { get; set; } public bool RoobotIdle { get; set; }
/// <summary> /// <summary>
/// 放锅至灶台完成状态
/// 放锅至灶台1完成状态
/// </summary> /// </summary>
public bool PutPotToKitchenComlete { get; set; } public bool PutPotToKitchenComlete { get; set; }

/// <summary>
/// 放锅至灶台2完成状态
/// </summary>
public bool PutPotToSecondKitchenComlete { get; set; }
/// <summary> /// <summary>
/// 机器人取料完成状态 /// 机器人取料完成状态
/// </summary> /// </summary>
public bool TakeMaterialComplete { get; set; } public bool TakeMaterialComplete { get; set; }
/// <summary> /// <summary>
/// 机器人放锅至清洗台完成状态
/// 机器人放锅至清洗台1完成状态
/// </summary> /// </summary>
public bool PlaceRinseTableComplete { get; set; } public bool PlaceRinseTableComplete { get; set; }

/// <summary>
/// 机器人放锅至清洗台2完成状态
/// </summary>
public bool PlaceRinseSecondTableComplete { get; set; }
/// <summary> /// <summary>
/// 订单取配料队列 /// 订单取配料队列
/// </summary> /// </summary>
@@ -132,10 +153,14 @@ namespace BPASmartClient.MorkF
/// </summary> /// </summary>
public bool TakeAllBurdenComplete { get; set; } public bool TakeAllBurdenComplete { get; set; }
/// <summary> /// <summary>
/// 锅到位 true:到位 false:未到位
/// 锅1到位 true:到位 false:未到位
/// </summary> /// </summary>
public bool PotInPlace { get; set; } public bool PotInPlace { get; set; }
/// <summary> /// <summary>
/// 锅2到位 true:到位 false:未到位
/// </summary>
public bool SecondPotInPlace { get; set; }
/// <summary>
/// true:烹饪完成 /// true:烹饪完成
/// </summary> /// </summary>
public bool CookingComplete { get; set; } public bool CookingComplete { get; set; }
@@ -144,10 +169,14 @@ namespace BPASmartClient.MorkF
/// </summary> /// </summary>
public bool AddOilComplete { get; set; } public bool AddOilComplete { get; set; }
/// <summary> /// <summary>
/// 倒料完成
/// 1号锅倒料完成
/// </summary> /// </summary>
public bool FallMaterialComplete { get; set; } public bool FallMaterialComplete { get; set; }
/// <summary> /// <summary>
/// 2号锅倒料完成
/// </summary>
public bool SecondFallMaterialComplete { get; set; }
/// <summary>
/// 供盘互锁 /// 供盘互锁
/// </summary> /// </summary>
public bool TakePlateLock { get; set; } public bool TakePlateLock { get; set; }
@@ -241,6 +270,10 @@ namespace BPASmartClient.MorkF
/// 主流程执行状态 /// 主流程执行状态
/// </summary> /// </summary>
public bool MainProcessStatus { get; set; } public bool MainProcessStatus { get; set; }
/// <summary>
/// 当前放锅位置 1:1号锅 2: 2号锅
/// </summary>
public int CurrentPutPotLoc { get; set; }
} }
} }



+ 71
- 22
BPASmartClient.MorkF/View/DebugView.xaml View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkF.View" xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="600" d:DesignWidth="1300">
<UserControl.Resources> <UserControl.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
@@ -16,30 +16,79 @@
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="120" ></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<GroupBox Header="设备控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="120">
<WrapPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,5,0,0">
<Button Content="初始化" Command="{Binding PlcInite}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="模拟订单" Command="{Binding SimulateOrder}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="自动模式" Command="{ Binding AutoModel}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="手动模式" Command="{Binding ManualModel}" Margin="10,0,10,0"></Button>
<Button Content="打开抽风" Command="{Binding OpenExhaust}" Margin="10,0,10,0"></Button>
<Button Content="关闭抽风" Command="{Binding CloaseExhaust}" Margin="10,0,10,0"></Button>
<Button Content="料仓1" Command="{Binding MaterialOne}" Margin="10,0,10,0"></Button>
<Button Content="料仓2" Command="{Binding MaterialTwo}" Margin="10,0,10,0"></Button>
<Button Content="料仓3" Command="{Binding MaterialThree}" Margin="10,0,10,0"></Button>
<Button Content="料仓4" Command="{Binding MaterialFour}" Margin="10,0,10,0"></Button>
<Button Content="料仓5" Command="{Binding MaterialFive}" Margin="10,0,10,0"></Button>
<Button Content="供盘" Command="{Binding OutPlate}" Margin="10,0,10,0"></Button>
<Button Content="清洗模组1启动" Command="{Binding StartQXOne}" Margin="10,0,10,0"></Button>
<Button Content="清洗模组2启动" Command="{Binding StartQXTwo}" Margin="10,10,10,0" Cursor="Hand"></Button>
</WrapPanel>
</GroupBox>
<GroupBox Header="菜品选择" FontSize="15" Foreground="Aqua" Grid.Row="1" Margin="0,0,0,40" VerticalAlignment="Top" Height="100">
<WrapPanel Orientation="Horizontal" Height="52" VerticalAlignment="Center" >
<Button Content="手撕包菜" Command="{Binding ShreddCabbage}" Margin="10,0,10,0"></Button>
<Button Content="盐煎肉" Command="{Binding FryPork}" Margin="10,0,10,0"></Button>
<Button Content="酱烧杏鲍菇" Command="{Binding XingBaoGu}" Margin="10,0,10,0"></Button>
</WrapPanel>
</GroupBox>
<StackPanel Orientation="Vertical" Grid.Row="2">
<GroupBox Header="机器人控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="95">
<WrapPanel Orientation="Horizontal" Grid.RowSpan="2" VerticalAlignment="Top" Margin="0,5,0,0" >
<Button Content="取锅" Command="{Binding TakePot}" Margin="10,0,10,0"></Button>
<!--<Button Content="取锅复位" Command="{Binding TakePotReset}" Margin="10,0,10,0"></Button>-->
<Button Content="取料" Command="{Binding TakeMaterial}" Margin="10,0,10,0"></Button>
<Button Content="出餐" Command="{Binding OutMeal}" Margin="10,0,10,0"></Button>
</WrapPanel>
</GroupBox>

<GroupBox Header="炒锅1" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0">
<Button Content="注油" Command="{Binding AddOil}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding TempTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="加热1挡" Command="{Binding OneBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热2挡" Command="{Binding TwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热3挡" Command="{Binding ThreeBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机关闭" Command="{Binding OverTurnOff}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="翻炒机上升" Command="{Binding OverGoOn}" Margin="10,0,15,0" Cursor="Hand"></Button>
<Button Content="翻炒机下降" Command="{Binding OverGoDown}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机1挡" Command="{Binding OverOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机2挡" Command="{Binding OverTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机3挡" Command="{Binding OverThreeBlock}" Margin="10,0,10,0"></Button>
</WrapPanel>
</GroupBox>
<GroupBox Header="炒锅2" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0">
<Button Content="注油" Command="{Binding SecAddOil}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding SecTempTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="加热1挡" Command="{Binding SecOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热2挡" Command="{Binding SecTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热3挡" Command="{Binding SecThreeBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机关闭" Command="{Binding SecOverTurnOff}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="翻炒机上升" Command="{Binding SecOverGoOn}" Margin="10,0,15,0" Cursor="Hand"></Button>
<Button Content="翻炒机下降" Command="{Binding SecOverGoDown}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机1挡" Command="{Binding SecOverOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机2挡" Command="{Binding SecOverTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机3挡" Command="{Binding SecOverThreeBlock}" Margin="10,0,10,0"></Button>

</WrapPanel>
</GroupBox>


<StackPanel Orientation="Horizontal" Grid.Row="0">
<Button Content="初始化" Command="{Binding PlcInite}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="模拟订单" Command="{Binding SimulateOrder}" Margin="10,0,10,0"></Button>
<Button Content="手撕包菜" Command="{Binding ShreddCabbage}" Margin="10,0,10,0"></Button>
<Button Content="盐煎肉" Command="{Binding FryPork}" Margin="10,0,10,0"></Button>
<Button Content="酱烧杏鲍菇" Command="{Binding XingBaoGu}" Margin="10,0,10,0"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<Button Content="取锅" Command="{Binding TakePot}" Margin="10,0,10,0"></Button>
<Button Content="取锅复位" Command="{Binding TakePotReset}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding TempTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="加热1挡" Command="{Binding OneBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热2挡" Command="{Binding TwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="加热3挡" Command="{Binding ThreeBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机关闭" Command="{Binding OverTurnOff}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机上升" Command="{Binding OverGoOn}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机下降" Command="{Binding OverGoDown}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机1挡" Command="{Binding OverOneBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机2挡" Command="{Binding OverTwoBlock}" Margin="10,0,10,0"></Button>
<Button Content="翻炒机3挡" Command="{Binding OverThreeBlock}" Margin="10,0,10,0"></Button>
</StackPanel> </StackPanel>

</Grid> </Grid>
</UserControl> </UserControl>

+ 79
- 17
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs View File

@@ -14,42 +14,104 @@ namespace BPASmartClient.MorkF.ViewModel


public RelayCommand PlcInite { get; set; } public RelayCommand PlcInite { get; set; }
public RelayCommand SimulateOrder { get; set; } public RelayCommand SimulateOrder { get; set; }
public RelayCommand MaterialOne { get; set; }
public RelayCommand MaterialTwo { get; set; }
public RelayCommand MaterialThree { get; set; }
public RelayCommand MaterialFour { get; set; }
public RelayCommand MaterialFive { get; set; }
public RelayCommand OpenExhaust { get;set; }
public RelayCommand CloaseExhaust { get; set; }
public RelayCommand StartQXOne { get; set; }
public RelayCommand StartQXTwo { get; set; }


public RelayCommand ShreddCabbage { get; set; }
public RelayCommand FryPork { get; set; }
public RelayCommand XingBaoGu { get; set; }

public RelayCommand TakePot { get; set; } public RelayCommand TakePot { get; set; }
public RelayCommand TakePotReset { get; set; } public RelayCommand TakePotReset { get; set; }
public RelayCommand TakeMaterial { get; set; }
public RelayCommand OutMeal { get; set; }

public RelayCommand AddOil { get; set; }
public RelayCommand TempTurnOff { get; set; } public RelayCommand TempTurnOff { get; set; }
public RelayCommand OneBlock { get; set; } public RelayCommand OneBlock { get; set; }
public RelayCommand TwoBlock { get; set; } public RelayCommand TwoBlock { get; set; }
public RelayCommand ThreeBlock { get; set; } public RelayCommand ThreeBlock { get; set; }

public RelayCommand OverTurnOff { get; set; } public RelayCommand OverTurnOff { get; set; }
public RelayCommand OverOneBlock { get; set; } public RelayCommand OverOneBlock { get; set; }
public RelayCommand OverTwoBlock { get; set; } public RelayCommand OverTwoBlock { get; set; }
public RelayCommand OverThreeBlock { get; set; } public RelayCommand OverThreeBlock { get; set; }
public RelayCommand OverGoOn { get; set; } public RelayCommand OverGoOn { get; set; }
public RelayCommand OverGoDown { get; set; } public RelayCommand OverGoDown { get; set; }
public RelayCommand ShreddCabbage { get; set; }
public RelayCommand FryPork { get; set; }
public RelayCommand XingBaoGu { get; set; }
public RelayCommand AutoModel { get; set; }
public RelayCommand ManualModel { get; set; }

public RelayCommand SecAddOil { get; set; }
public RelayCommand SecTempTurnOff { get; set; }
public RelayCommand SecOneBlock { get; set; }
public RelayCommand SecTwoBlock { get; set; }
public RelayCommand SecThreeBlock { get; set; }
public RelayCommand SecOverTurnOff { get; set; }
public RelayCommand SecOverOneBlock { get; set; }
public RelayCommand SecOverTwoBlock { get; set; }
public RelayCommand SecOverThreeBlock { get; set; }
public RelayCommand SecOverGoOn { get; set; }
public RelayCommand SecOverGoDown { get; set; }
public RelayCommand SecAutoModel { get; set; }
public RelayCommand SecManualModel { get; set; }
public DebugViewModel() public DebugViewModel()
{ {
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); }); PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
SimulateOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("SimultaorOrder"); }); SimulateOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("SimultaorOrder"); });
TakePot = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePot"); });
TakePotReset = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePotReset"); });
TempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff"); });
OneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OneBlock"); });
TwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("TwoBlock"); });
ThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("ThreeBlock"); });
OverTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTurnOff"); });
OverOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverOneBlock"); });
OverTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTwoBlock"); });
OverThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverThreeBlock"); });
OverGoOn = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoOn"); });
OverGoDown = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoDown"); });
MaterialOne= new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialOne"); });
MaterialTwo = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialTwo"); });
MaterialThree = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialThree"); });
MaterialFour = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialFour"); });
MaterialFive = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialFive"); });
OpenExhaust = new RelayCommand(() => { ActionManage.GetInstance.Send("OpenExhaust"); });
CloaseExhaust = new RelayCommand(() => { ActionManage.GetInstance.Send("CloseExhaust"); });
StartQXOne=new RelayCommand(() => { ActionManage.GetInstance.Send("StartQXOne",1); });
StartQXTwo = new RelayCommand(() => { ActionManage.GetInstance.Send("StartQXTwo",2); });

ShreddCabbage = new RelayCommand(() => { ActionManage.GetInstance.Send("ShreddCabbage"); }); ShreddCabbage = new RelayCommand(() => { ActionManage.GetInstance.Send("ShreddCabbage"); });
FryPork = new RelayCommand(() => { ActionManage.GetInstance.Send("FryPork"); }); FryPork = new RelayCommand(() => { ActionManage.GetInstance.Send("FryPork"); });
XingBaoGu = new RelayCommand(() => { ActionManage.GetInstance.Send("XingBaoGu"); }); XingBaoGu = new RelayCommand(() => { ActionManage.GetInstance.Send("XingBaoGu"); });
}


TakePot = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePot"); });
TakePotReset = new RelayCommand(() => { ActionManage.GetInstance.Send("TakePotReset"); });
TakeMaterial= new RelayCommand(() => { ActionManage.GetInstance.Send("TakeMaterial"); });
OutMeal = new RelayCommand(() => { ActionManage.GetInstance.Send("OutMeal"); });

AddOil = new RelayCommand(() => { ActionManage.GetInstance.Send("AddOil", 1); });
TempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff", 1); });
OneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OneBlock",1); });
TwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("TwoBlock",1); });
ThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("ThreeBlock",1); });
OverTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTurnOff",1); });
OverOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverOneBlock",1); });
OverTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTwoBlock",1); });
OverThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverThreeBlock",1); });
OverGoOn = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoOn",1); });
OverGoDown = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoDown",1); });
AutoModel = new RelayCommand(()=>{ActionManage.GetInstance.Send("AutoModel",1); });
ManualModel = new RelayCommand(() => { ActionManage.GetInstance.Send("ManualModel",1); });

SecAddOil = new RelayCommand(() => { ActionManage.GetInstance.Send("AddOil", 2); });
SecTempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff", 2); });
SecOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OneBlock", 2); });
SecTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("TwoBlock", 2); });
SecThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("ThreeBlock", 2); });
SecOverTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTurnOff", 2); });
SecOverOneBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverOneBlock", 2); });
SecOverTwoBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverTwoBlock", 2); });
SecOverThreeBlock = new RelayCommand(() => { ActionManage.GetInstance.Send("OverThreeBlock", 2); });
SecOverGoOn = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoOn", 2); });
SecOverGoDown = new RelayCommand(() => { ActionManage.GetInstance.Send("OverGoDown", 2); });
SecAutoModel = new RelayCommand(() => { ActionManage.GetInstance.Send("AutoModel", 2); });
SecManualModel = new RelayCommand(() => { ActionManage.GetInstance.Send("ManualModel", 2); });
}
} }
} }

+ 37
- 27
BPASmartClient.MorkM/View/DebugView.xaml View File

@@ -51,6 +51,10 @@
<TextBox <TextBox
Grid.Column="1" Grid.Column="1"
Margin="10,0" Margin="10,0"
Foreground="#9934F7f7"
Background="Transparent"
BorderBrush="#00c2f4"
CaretBrush="Aqua"
IsEnabled="{Binding IsEnable}" IsEnabled="{Binding IsEnable}"
Text="{Binding Loc}" /> Text="{Binding Loc}" />


@@ -89,64 +93,70 @@
</ScrollViewer> </ScrollViewer>


<UniformGrid Grid.Row="1" Columns="2"> <UniformGrid Grid.Row="1" Columns="2">
<Button
Margin="10,10,10,0"
Command="{Binding AddSimDataCommand}"
Content="新增模拟数据"
/>
<Button <Button
Margin="10,10,10,0" Margin="10,10,10,0"
Grid.Column="1" Grid.Column="1"
Command="{Binding SimOrderCommand}" Command="{Binding SimOrderCommand}"
Content="模拟订单" Cursor="Hand" Content="模拟订单" Cursor="Hand"
/> />
<Button
Margin="10,10,10,0"
Command="{Binding AddSimDataCommand}"
Content="新增模拟数据"
/>
</UniformGrid> </UniformGrid>
</StackPanel> </StackPanel>
</Grid> </Grid>


<Grid Grid.Column="1" Margin="20,0,0,0"> <Grid Grid.Column="1" Margin="20,0,0,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="80" />
<RowDefinition Height="80" />
<RowDefinition Height="80" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>


<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" >


<!--#region 控制按钮--> <!--#region 控制按钮-->
<Button <Button
Margin="10,10,10,0"
Margin="0,10,10,0"
Command="{Binding InitCommand}" Command="{Binding InitCommand}"
Content="初始化" Cursor="Hand"
Width="200"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Content="设备初始化" Cursor="Hand"
Grid.Row="0"
/> />

<Button
Margin="10,10,10,0"
<CheckBox
Margin="0,10,0,0"
Grid.Row="1"
Height="20"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Background="#FF2AB2E7"
Content="启用本地模拟程序"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding EnableLocalSimOrder}"
/>
<!--<Button
Margin="10,5,10,0"
Command="{Binding InitCommand}" Command="{Binding InitCommand}"
Content="停止" Content="停止"
/>
/>-->


<Button
<!--<Button
x:Name="button_loop" x:Name="button_loop"
Margin="10,10,10,0" Margin="10,10,10,0"
Command="{Binding LoopSimOrderCommand}" Command="{Binding LoopSimOrderCommand}"
Content="{Binding LoopOrderButtonContent}" Content="{Binding LoopOrderButtonContent}"
/>
/>-->
<!--#endregion--> <!--#endregion-->


</StackPanel> </StackPanel>


<CheckBox
Grid.Row="2"
Height="20"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="启用本地模拟程序"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding EnableLocalSimOrder}"
/>

</Grid> </Grid>


</Grid> </Grid>


+ 5
- 5
BPASmartClient/DeviceInfo.xml View File

@@ -73,19 +73,19 @@
</Peripherals> </Peripherals>
</Device>--> </Device>-->


<!--<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<Device Name="Morks" Module="BPASmartClient.MorkS.Control_Morks" DeviceId="100">
<Peripherals> <Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> <Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters> <Parameters>
<IpAddress>127.0.0.1</IpAddress> <IpAddress>127.0.0.1</IpAddress>
<Port>502</Port> <Port>502</Port>
<PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress> <PLCReadAddress>M,M230.0,24;M,M0.3,3;M,M100.0,16;M,M235.0,1;M,M102.0,7;M,M103.0,6;VW,VW372,1</PLCReadAddress>
--><!--<PLCReadAddress>M,M230.0,24</PLCReadAddress>--><!--
<PLCReadAddress>M,M230.0,24</PLCReadAddress>
</Parameters> </Parameters>
</Peripheral> </Peripheral>
</Peripherals> </Peripherals>
</Device>-->-->-->
<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
</Device>-->-->
<!--<Device Name="MorkM" Module="BPASmartClient.MorkM.Control_MorkM" DeviceId="100">
<Peripherals> <Peripherals>
<Peripheral Module="BPASmartClient.PLC.PLCMachine"> <Peripheral Module="BPASmartClient.PLC.PLCMachine">
<Parameters> <Parameters>
@@ -96,6 +96,6 @@
</Parameters> </Parameters>
</Peripheral> </Peripheral>
</Peripherals> </Peripherals>
</Device>-->-->
</Device>-->-->-->


</BPADevices> </BPADevices>

+ 1
- 1
BPASmartClient/MainWindow.xaml View File

@@ -85,7 +85,7 @@
<MenuItem <MenuItem
Click="Debug_Click" Click="Debug_Click"
FontSize="12" FontSize="12"
Header="调试界面"
Header="调试"
Tag="DebugView" /> Tag="DebugView" />






+ 2
- 2
BPASmartClient/MainWindow.xaml.cs View File

@@ -252,8 +252,8 @@ namespace BPASmartClient
if (sender is MenuItem) if (sender is MenuItem)
{ {
// Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView"); // Type type = Assembly.Load("BPASmartClient.MorkT").GetType("BPASmartClient.MorkT.View.DebugView");
// Type type = Assembly.Load("BPASmartClient.MorkF").GetType("BPASmartClient.MorkF.View.DebugView");
Type type = Assembly.Load("BPASmartClient.MorkM").GetType("BPASmartClient.MorkM.View.DebugView");
Type type = Assembly.Load("BPASmartClient.MorkF").GetType("BPASmartClient.MorkF.View.DebugView");
//Type type = Assembly.Load("BPASmartClient.MorkM").GetType("BPASmartClient.MorkM.View.DebugView");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes); ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null); contentRegion.Content = (FrameworkElement)cti.Invoke(null);
Title.Text = (sender as MenuItem).Header?.ToString() + "界面"; Title.Text = (sender as MenuItem).Header?.ToString() + "界面";


Loading…
Cancel
Save