@@ -1,4 +1,5 @@ | |||||
using System; | |||||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
@@ -11,15 +12,23 @@ namespace BPASmartClient.Model.大炒 | |||||
public string GoodName { get; set; } | public string GoodName { get; set; } | ||||
public string GoodKey { get; set; } | public string GoodKey { get; set; } | ||||
public List<FryPotProcess> fryPotProcesses { get; set; } = new List<FryPotProcess>(); | public List<FryPotProcess> fryPotProcesses { get; set; } = new List<FryPotProcess>(); | ||||
public int FryOffStirTime;//关火翻炒时间; | |||||
/// <summary> | |||||
/// 翻转速度0到800 | |||||
/// </summary> | |||||
public int TurnSpeed { get; set; } = 0; | |||||
/// <summary> | |||||
/// 关火翻炒时间; | |||||
/// </summary> | |||||
public int FryOffStirTime; | |||||
} | } | ||||
public class FryPotProcess | |||||
public class FryPotProcess:ObservableObject | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// 步骤 | /// 步骤 | ||||
/// </summary> | /// </summary> | ||||
public int FryTime { get; set; } | |||||
public int FryTime { get { return _fryTime; } set { _fryTime = value; OnPropertyChanged(); } } | |||||
private int _fryTime; | |||||
/// <summary> | /// <summary> | ||||
/// 动作 | /// 动作 | ||||
/// </summary> | /// </summary> | ||||
@@ -36,10 +45,7 @@ namespace BPASmartClient.Model.大炒 | |||||
/// 搅拌挡位 小炒1-10 大炒1-5 | /// 搅拌挡位 小炒1-10 大炒1-5 | ||||
/// </summary> | /// </summary> | ||||
public int StirGear { get; set; } = 0; | public int StirGear { get; set; } = 0; | ||||
/// <summary> | |||||
/// 翻转速度0到800 | |||||
/// </summary> | |||||
public int TurnSpeed { get; set; }= 0; | |||||
/// <summary> | /// <summary> | ||||
/// 炒制位置1到4 | /// 炒制位置1到4 | ||||
/// </summary> | /// </summary> | ||||
@@ -67,8 +73,8 @@ namespace BPASmartClient.Model.大炒 | |||||
{ | { | ||||
冷锅加热, | 冷锅加热, | ||||
热油, | 热油, | ||||
加调料, | |||||
加辅料, | |||||
机器人加调料, | |||||
通道出调料, | |||||
炒制菜品, | 炒制菜品, | ||||
} | } | ||||
@@ -9,24 +9,67 @@ namespace BPASmartClient.Model.大炒 | |||||
public class RobotAction_Pot | public class RobotAction_Pot | ||||
{ | { | ||||
public int Pot { get; set; } | public int Pot { get; set; } | ||||
public RobotActionModel robotActionModel { get; set; } | |||||
public MainTask MainTask { get; set; } | |||||
public SubTask1 subTask1 { get; set; } = 0; | |||||
public SubTask2 subTask2 { get; set; } = 0; | |||||
public SubTask3 subTask3 { get; set; } = 0; | |||||
public SubTask4 subTask4 { get; set; } = 0; | |||||
} | } | ||||
public enum RobotActionModel | |||||
public enum MainTask | |||||
{ | |||||
无任务, | |||||
机器人炒制任务, | |||||
机器人补料任务, | |||||
} | |||||
public enum SubTask1 | |||||
{ | { | ||||
无任务, | 无任务, | ||||
取1号炒锅荤菜盆倒1号炒锅, | |||||
取1号炒锅素菜盆1倒1号炒锅, | |||||
取1号炒锅素菜盆2倒1号炒锅, | |||||
取1号炒锅调料盆倒入1号炒锅, | |||||
取1号炒锅辅料盆1倒入1号炒锅, | |||||
取1号空盆出餐, | |||||
机器人取1号菜盆, | |||||
机器人取2号菜盆, | |||||
机器人取3号菜盆, | |||||
机器人取4号菜盆, | |||||
机器人取5号菜盆, | |||||
机器人取6号菜盆, | |||||
机器人取7号菜盆, | |||||
机器人取8号菜盆, | |||||
机器人取9号菜盆, | |||||
机器人取1号调料, | |||||
机器人取2号调料, | |||||
机器人取3号调料, | |||||
机器人取4号调料, | |||||
机器人取5号调料, | |||||
机器人取6号调料, | |||||
机器人取1号空盆, | |||||
机器人取2号空盆, | |||||
机器人取3号空盆, | |||||
机器人取4号空盆, | |||||
取2号炒锅荤菜盆1倒2号炒锅 = 20, | |||||
取2号炒锅素菜盆1倒2号炒锅 = 21, | |||||
取2号炒锅素菜盆2倒2号炒锅 =22, | |||||
取2号炒锅调料盆倒入2号炒锅 =23, | |||||
取2号炒锅辅料盆1倒入2号炒锅 =24, | |||||
取2号空盆出餐 =25, | |||||
} | } | ||||
public enum SubTask2 | |||||
{ | |||||
无任务, | |||||
倒料至1号锅, | |||||
倒料至2号锅, | |||||
} | |||||
public enum SubTask3 | |||||
{ | |||||
无任务, | |||||
机器人上料口取料 | |||||
} | |||||
public enum SubTask4 | |||||
{ | |||||
无任务, | |||||
放盆至1号库位, | |||||
放盆至2号库位, | |||||
放盆至3号库位, | |||||
放盆至4号库位, | |||||
放盆至5号库位, | |||||
放盆至6号库位, | |||||
放盆至7号库位, | |||||
放盆至8号库位, | |||||
} | |||||
} | } |
@@ -51,6 +51,7 @@ namespace BPASmartClient.MorkBF | |||||
DataParse();//数据解析 | DataParse();//数据解析 | ||||
ScreenDataServer();//大屏数据上报 | ScreenDataServer();//大屏数据上报 | ||||
ActionManage.GetInstance.Send("更新菜单"); | ActionManage.GetInstance.Send("更新菜单"); | ||||
ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程"); | |||||
DeviceProcessLogShow("MORKF 设备初始化完成"); | DeviceProcessLogShow("MORKF 设备初始化完成"); | ||||
} | } | ||||
@@ -64,9 +65,7 @@ namespace BPASmartClient.MorkBF | |||||
if (order.MorkOrder.GoodBatchings == null) return; | if (order.MorkOrder.GoodBatchings == null) return; | ||||
OrderCount++; | OrderCount++; | ||||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | DeviceProcessLogShow($"接收到{OrderCount}次订单"); | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
@@ -122,17 +121,8 @@ namespace BPASmartClient.MorkBF | |||||
ActionManage.GetInstance.Register(FirePot_PotReversal, "FirePot_PotReversal");//翻转反转 | ActionManage.GetInstance.Register(FirePot_PotReversal, "FirePot_PotReversal");//翻转反转 | ||||
#endregion | #endregion | ||||
#region 机器人 | #region 机器人 | ||||
ActionManage.GetInstance.Register(RobotStart, "RobotStart");//机器人启动 | |||||
ActionManage.GetInstance.Register(RobotStop, "RobotStop");//机器人停止 | |||||
ActionManage.GetInstance.Register(RobotReset, "RobotReset");//复位 | |||||
ActionManage.GetInstance.Register(RobotProgramStart, "RobotProgramStart");//程序启动 | |||||
ActionManage.GetInstance.Register(Robot_Pot1AllowInMaterail, "Robot_Pot1AllowInMaterail");//1号炒锅允许机器人投料 | |||||
ActionManage.GetInstance.Register(Robot_Pot1OutFoodInSlowDown, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料到减速位 | |||||
ActionManage.GetInstance.Register(Robot_Pot1OutFood, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料完成 | |||||
ActionManage.GetInstance.Register(Robot_Pot2AllowInMaterail, "Robot_Pot2AllowInMaterail");//2号炒锅允许机器人投料 | |||||
ActionManage.GetInstance.Register(Robot_Pot2OutFoodInSlowDown, "Robot_Pot2OutFoodInSlowDown");//2号炒锅出餐倒料到减速位 | |||||
ActionManage.GetInstance.Register(Robot_Pot2OutFood, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成 | |||||
ActionManage.GetInstance.Register(RobotActionStart, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成 | |||||
ActionManage.GetInstance.Register(RobotAction, "RobotAction");//上使能 | |||||
#endregion | #endregion | ||||
@@ -141,12 +131,8 @@ namespace BPASmartClient.MorkBF | |||||
public override void MainTask() | public override void MainTask() | ||||
{ | { | ||||
if(morkBF.FirePan1_Order.Count>0&& morkBF.FirePot1_InitCompleted&&morkBF.FirePot2_IsAuto&&!morkBF.FirePan1_Busy) | |||||
{ | |||||
ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程"); | |||||
} | |||||
if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Origin)//机器人在原点为 | |||||
if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Start)//机器人启动 | |||||
{ | { | ||||
if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction)) | if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction)) | ||||
{ | { | ||||
@@ -158,44 +144,48 @@ namespace BPASmartClient.MorkBF | |||||
private void FirePot1_Process() | private void FirePot1_Process() | ||||
{ | { | ||||
if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result)) | |||||
if (morkBF.FirePan1_Order.Count > 0 && morkBF.FirePot1_InitCompleted && morkBF.FirePot2_IsAuto && !morkBF.FirePan1_Busy) | |||||
{ | { | ||||
morkBF.FirePan1_Busy = true; | |||||
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses; | |||||
foreach (var item in result.fryPotProcesses) | |||||
if (morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result)) | |||||
{ | { | ||||
switch (item.fryActions) | |||||
morkBF.FirePan1_Busy = true; | |||||
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses; | |||||
foreach (var item in result.fryPotProcesses) | |||||
{ | { | ||||
case FryAction.冷锅加热: | |||||
FirePot_PotPerHeat(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成"); | |||||
break; | |||||
case FryAction.热油: | |||||
FirePot_HeatOil(item,1); | |||||
MessageLog.GetInstance.Show("炒锅1---热油完成"); | |||||
break; | |||||
case FryAction.加调料: | |||||
FirePot_AddSeasoning(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---加调料完成"); | |||||
break; | |||||
case FryAction.加辅料: | |||||
FirePot_AddAccessories(item,1); | |||||
MessageLog.GetInstance.Show("炒锅1---加辅料完成"); | |||||
break; | |||||
case FryAction.炒制菜品: | |||||
FirePot_FryFood(item,1); | |||||
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成"); | |||||
break; | |||||
default: | |||||
break; | |||||
switch (item.fryActions) | |||||
{ | |||||
case FryAction.冷锅加热: | |||||
FirePot_PotPerHeat(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成"); | |||||
break; | |||||
case FryAction.热油: | |||||
FirePot_HeatOil(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---热油完成"); | |||||
break; | |||||
case FryAction.机器人加调料: | |||||
FirePot_RobotGetSeasoning(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---机器人加调料完成"); | |||||
break; | |||||
case FryAction.通道出调料: | |||||
FirePot_PasswayOutSeasoning(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---通道出调料完成"); | |||||
break; | |||||
case FryAction.炒制菜品: | |||||
FirePot_FryFood(item, 1); | |||||
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成"); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | } | ||||
FirePot_StartFire(new object[] { 1, false });//关火 | |||||
Thread.Sleep(result.FryOffStirTime*1000);//关火翻炒时间 | |||||
FirePot_StartStir(new object[] { 1, false });//关闭搅拌 | |||||
Message.MessageLog.GetInstance.Show($"炒锅1炒制{result.GoodName}完成"); | |||||
} | } | ||||
} | |||||
} | |||||
} | } | ||||
private void FirePot2_Process() | private void FirePot2_Process() | ||||
@@ -206,13 +196,21 @@ namespace BPASmartClient.MorkBF | |||||
#region 炒锅流程功能 | #region 炒锅流程功能 | ||||
private bool IsRobotNextWork(List<FryPotProcess> currentProcess, int currentFryTime) | |||||
/// <summary> | |||||
/// 判断下个动作是否需要机器人 | |||||
/// </summary> | |||||
/// <param name="i"></param> | |||||
/// <param name="currentFryTime"></param> | |||||
/// <returns></returns> | |||||
private bool IsRobotNextWork(int i, int currentFryTime) | |||||
{ | { | ||||
bool res = false; | bool res = false; | ||||
if(currentProcess.Count> currentFryTime) | |||||
List<FryPotProcess> currentProcess = new List<FryPotProcess>(); | |||||
currentProcess = i == 1 ? morkBF.FryPot1_CurrentProcess: morkBF.FryPot2_CurrentProcess; | |||||
if (currentProcess.Count> currentFryTime) | |||||
{ | { | ||||
if (currentProcess[currentFryTime + 1].fryActions == FryAction.加调料 || | |||||
currentProcess[currentFryTime + 1].fryActions == FryAction.加辅料 || | |||||
if (currentProcess[currentFryTime + 1].fryActions == FryAction.机器人加调料 || | |||||
currentProcess[currentFryTime + 1].fryActions == FryAction.炒制菜品) | currentProcess[currentFryTime + 1].fryActions == FryAction.炒制菜品) | ||||
{ | { | ||||
res = true; | res = true; | ||||
@@ -227,19 +225,11 @@ namespace BPASmartClient.MorkBF | |||||
private void FirePot_PotPerHeat(FryPotProcess item,int i) | private void FirePot_PotPerHeat(FryPotProcess item,int i) | ||||
{ | { | ||||
bool isRobotWork = false; | bool isRobotWork = false; | ||||
if(i == 1)//炒锅1 | |||||
{ | |||||
//FirePot1_SetFireGear(item.FryGear); | |||||
Thread.Sleep(200); | |||||
//FirePot1_StartFire(true); | |||||
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess,item.FryTime); | |||||
} | |||||
else if(i == 2)//炒锅2 | |||||
{ | |||||
//FirePot2_SetFireGear(item.FryGear); | |||||
//FirePot2_StartFire(true); | |||||
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime); | |||||
} | |||||
FirePot_SetFireGear(new object[]{ i, item.FryGear});//设定加热挡位 | |||||
FirePot_StartFire(new object[] { i, true }); | |||||
isRobotWork = IsRobotNextWork(i,item.FryTime);//下个流程动作是否需要机器人 | |||||
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | ||||
else Thread.Sleep(item.FryDuration * 1000); | else Thread.Sleep(item.FryDuration * 1000); | ||||
@@ -254,91 +244,66 @@ namespace BPASmartClient.MorkBF | |||||
bool isRobotWork = false; | bool isRobotWork = false; | ||||
if (item.FryGear != 0) | if (item.FryGear != 0) | ||||
{ | { | ||||
/* FirePot1_SetFireGear(item.FryGear);*///设定加热挡位 | |||||
//FirePot1_StartFire(true);//开启加热 | |||||
//isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime); | |||||
FirePot_SetFireGear(new object[] { i, item.FryGear });//设定加热挡位 | |||||
FirePot_StartFire(new object[] { i, true }); | |||||
} | } | ||||
if (item.StirGear != 0) | if (item.StirGear != 0) | ||||
{ | { | ||||
//FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位 | |||||
//FirePot1_StartFire(true);//开启搅拌 | |||||
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime); | |||||
FirePot_SetStirGear(new object[] { i, item.StirGear });//设定搅拌挡位 | |||||
FirePot_StartStir(new object[] { i, true }); | |||||
} | } | ||||
isRobotWork = IsRobotNextWork(i, item.FryTime); | |||||
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | ||||
else Thread.Sleep(item.FryDuration * 1000);//加热时间; | else Thread.Sleep(item.FryDuration * 1000);//加热时间; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 加调料 | |||||
/// 通道出调料 | |||||
/// </summary> | /// </summary> | ||||
private void FirePot_AddSeasoning(FryPotProcess item,int i) | |||||
private void FirePot_PasswayOutSeasoning(FryPotProcess item,int i) | |||||
{ | { | ||||
if(i == 1) | |||||
{ | |||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot =1,robotActionModel = RobotActionModel.取1号炒锅调料盆倒入1号炒锅}); | |||||
Thread.Sleep(item.FryDuration); | |||||
} | |||||
else if(i == 2) | |||||
foreach(var acc in item.accessories) | |||||
{ | { | ||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅调料盆倒入2号炒锅 }); | |||||
Thread.Sleep(item.FryDuration); | |||||
FirePot_StartPassWay(new object[] { i, acc.Loc, acc.Qry }); | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 加辅料 | |||||
/// 机器人取调料 | |||||
/// </summary> | /// </summary> | ||||
private void FirePot_AddAccessories(FryPotProcess item, int i) | |||||
private void FirePot_RobotGetSeasoning(FryPotProcess item, int i) | |||||
{ | { | ||||
if (i == 1) | |||||
{ | |||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 }); | |||||
Thread.Sleep(item.FryDuration); | |||||
} | |||||
else if (i == 2) | |||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot | |||||
{ | { | ||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅辅料盆1倒入2号炒锅 }); | |||||
Thread.Sleep(item.FryDuration); | |||||
} | |||||
Pot = i, | |||||
MainTask = BPASmartClient.Model.大炒.MainTask.机器人炒制任务, | |||||
subTask1 = (SubTask1)item.accessories[0].Loc + 9, | |||||
subTask2 = (SubTask2)i | |||||
}); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 炒制菜品 | /// 炒制菜品 | ||||
/// </summary> | /// </summary> | ||||
private void FirePot_FryFood(FryPotProcess item, int i) | private void FirePot_FryFood(FryPotProcess item, int i) | ||||
{ | { | ||||
bool isRobotWork = false; | bool isRobotWork = false; | ||||
if (i == 1) | |||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot | |||||
{ | { | ||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc }); | |||||
while (!morkBF.FirePot1_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成 | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime); | |||||
} | |||||
else if (i == 2) | |||||
Pot = i, | |||||
MainTask = BPASmartClient.Model.大炒.MainTask.机器人炒制任务, | |||||
subTask1 = (SubTask1)item.accessories[1].Loc, | |||||
subTask2 =(SubTask2)i | |||||
}); | |||||
while (!morkBF.FirePot1_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成 | |||||
{ | { | ||||
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = (RobotActionModel)(item.accessories[0].Loc+19) });//炒制菜品位置 | |||||
while (!morkBF.FirePot2_CompleteSingle[item.accessories[0].Loc])//取菜信号是否完成 | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime); | |||||
Thread.Sleep(100); | |||||
} | } | ||||
isRobotWork = IsRobotNextWork(i, item.FryTime); | |||||
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料 | ||||
else Thread.Sleep(item.FryDuration * 1000);//加热时间; | else Thread.Sleep(item.FryDuration * 1000);//加热时间; | ||||
} | } | ||||
@@ -350,76 +315,50 @@ namespace BPASmartClient.MorkBF | |||||
/// <param name="robotAction"></param> | /// <param name="robotAction"></param> | ||||
private void RobotProcess(RobotAction_Pot robotAction) | private void RobotProcess(RobotAction_Pot robotAction) | ||||
{ | { | ||||
Robot_Write("GI0",(int)robotAction.robotActionModel); | |||||
while (morkBF.Robot_ActionCallback != (int)robotAction.robotActionModel)//机器人动作执行完动作反馈 | |||||
Robot_Write("GI0", (int)robotAction.MainTask);//设定机器人主要任务 | |||||
while(morkBF.Robot_GI0ActionCallback != (int)robotAction.MainTask)//等待主程序完成反馈 | |||||
{ | { | ||||
Thread.Sleep(100); | |||||
Thread.Sleep(300); | |||||
} | } | ||||
if(robotAction.Pot == 1)//炒锅1 | |||||
if((int)robotAction.subTask1>0)//任务1 | |||||
{ | { | ||||
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) | |||||
{ | |||||
Robot_Write("GM520", true);//机器人去出餐倒料减速位置 | |||||
while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜 | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
FirePot_StartOutFood(1);//炒锅出餐; | |||||
while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 | |||||
{ | |||||
Thread.Sleep(1000); | |||||
} | |||||
Thread.Sleep(6 * 1000);//等待6s出餐 | |||||
Robot_Write("GM521", true);//机器人出餐到料完成 | |||||
} | |||||
else | |||||
Robot_Write("GI1", (int)robotAction.subTask1); | |||||
Thread.Sleep(1000); | |||||
while (morkBF.Robot_GI1ActionCallback != (int)robotAction.subTask1)//等待子程序1完成反馈 | |||||
{ | { | ||||
//FirePot_Write("M11.6", true);//炒锅去投料位置 | |||||
while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料 | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
Robot_Write("GM531", true);//机器人投料 | |||||
Thread.Sleep(300); | |||||
} | } | ||||
} | } | ||||
else if (robotAction.Pot == 2) | |||||
if ((int)robotAction.subTask2 > 0)//任务2 | |||||
{ | { | ||||
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) | |||||
Robot_Write("GI2", (int)robotAction.subTask2); | |||||
Thread.Sleep(1000); | |||||
while (morkBF.Robot_GI2ActionCallback != (int)robotAction.subTask2)//等待子程序2完成反馈 | |||||
{ | { | ||||
Robot_Write("GM522", true);//炒锅去出餐倒料减速位置 | |||||
while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜 | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
FirePot_StartOutFood(2);//炒锅去出餐倒料位置 | |||||
while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 | |||||
{ | |||||
Thread.Sleep(1000); | |||||
} | |||||
Thread.Sleep(6 * 1000);//等待20s出餐 | |||||
Robot_Write("GM523", true);//机器人出餐倒料完成 | |||||
Thread.Sleep(300); | |||||
} | } | ||||
else | |||||
} | |||||
if ((int)robotAction.subTask3 > 0)//任务3 | |||||
{ | |||||
Robot_Write("GI3", (int)robotAction.subTask3); | |||||
Thread.Sleep(1000); | |||||
while (morkBF.Robot_GI3ActionCallback != (int)robotAction.subTask3)//等待子程序3完成反馈 | |||||
{ | { | ||||
//FirePot_Write("M16.7", true); | |||||
while (!morkBF.FirePot2_PotOnIntoFoodPosition) | |||||
{ | |||||
Thread.Sleep(100); | |||||
} | |||||
Robot_Write("GM531", true); | |||||
Thread.Sleep(300); | |||||
} | } | ||||
} | } | ||||
while(!morkBF.Robot_Origin) | |||||
if ((int)robotAction.subTask4 > 0)//任务4 | |||||
{ | { | ||||
Robot_Write("GI4", (int)robotAction.subTask4); | |||||
Thread.Sleep(1000); | Thread.Sleep(1000); | ||||
while (morkBF.Robot_GI4ActionCallback != (int)robotAction.subTask4)//等待主程序4完成反馈 | |||||
{ | |||||
Thread.Sleep(300); | |||||
} | |||||
} | } | ||||
morkBF.Robot_IsBusy = false; | |||||
MessageLog.GetInstance.Show($"机器人完成[{robotAction.robotActionModel.ToString()}]任务"); | |||||
MessageLog.GetInstance.Show($"机器人完成[{robotAction.MainTask.ToString()}]任务"); | |||||
} | } | ||||
public override void ReadData() | public override void ReadData() | ||||
@@ -501,45 +440,7 @@ namespace BPASmartClient.MorkBF | |||||
} | } | ||||
}), 0); | }), 0); | ||||
GetStatus("GM500", new Action<object>((o) => | |||||
{ | |||||
if (o == null) return; | |||||
if (o is bool[] values && values.Length == 7) | |||||
{ | |||||
morkBF.FirePot1_CompleteSingle[0] = values[0]; | |||||
morkBF.FirePot1_CompleteSingle[1] = values[1]; | |||||
morkBF.FirePot1_CompleteSingle[2] = values[2]; | |||||
morkBF.Robot_FirePot1OutSeasoning = values[3]; | |||||
morkBF.Robot_FirePot1OutAccessories = values[4]; | |||||
morkBF.Robot_ArriveFirePot1 = values[5]; | |||||
morkBF.Robot_FirePot1OutFoodComplete = values[6]; | |||||
} | |||||
}), 1); | |||||
GetStatus("GM510", new Action<object>((o) => | |||||
{ | |||||
if (o == null) return; | |||||
if (o is bool[] values && values.Length == 7) | |||||
{ | |||||
morkBF.FirePot2_CompleteSingle[0] = values[0]; | |||||
morkBF.FirePot2_CompleteSingle[1] = values[1]; | |||||
morkBF.FirePot2_CompleteSingle[2] = values[2]; | |||||
morkBF.Robot_FirePot2OutSeasoning = values[3]; | |||||
morkBF.Robot_FirePot2OutAccessories = values[4]; | |||||
morkBF.Robot_ArriveFirePot2 = values[5]; | |||||
morkBF.Robot_FirePot2OutFoodComplete = values[6]; | |||||
} | |||||
}), 1); | |||||
GetStatus("GI5", new Action<object>((o) => | |||||
{ | |||||
if (o == null) return; | |||||
if (o is int[] values && values.Length == 1) | |||||
{ | |||||
morkBF.Robot_ActionCallback = values[0]; | |||||
} | |||||
}), 1); | |||||
GetStatus("VW2250", new Action<object>((o) => | GetStatus("VW2250", new Action<object>((o) => | ||||
{ | { | ||||
@@ -836,7 +737,6 @@ namespace BPASmartClient.MorkBF | |||||
{ | { | ||||
FirePot2_Write("M10.6", true); | FirePot2_Write("M10.6", true); | ||||
} | } | ||||
} | } | ||||
Thread.Sleep(200); | Thread.Sleep(200); | ||||
} | } | ||||
@@ -971,98 +871,33 @@ namespace BPASmartClient.MorkBF | |||||
#endregion | #endregion | ||||
#region 机器人 | #region 机器人 | ||||
/// <summary> | |||||
/// 机器人启动 | |||||
/// </summary> | |||||
private void RobotStart() | |||||
{ | |||||
Robot_Write("GM600",true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 机器人停止 | |||||
/// </summary> | |||||
private void RobotStop() | |||||
private void RobotAction(object[] o) | |||||
{ | { | ||||
Robot_Write("GM601", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 机器人复位 | |||||
/// </summary> | |||||
private void RobotReset() | |||||
{ | |||||
Robot_Write("GM602", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 机器人程序重启 | |||||
/// </summary> | |||||
private void RobotProgramStart() | |||||
{ | |||||
Robot_Write("GM603", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅允许机器人投料(炒锅在投料位给出) | |||||
/// </summary> | |||||
private void Robot_Pot1AllowInMaterail() | |||||
{ | |||||
Robot_Write("GM531", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅出餐倒料到减速位 | |||||
/// </summary> | |||||
private void Robot_Pot1OutFoodInSlowDown() | |||||
{ | |||||
Robot_Write("GM620", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅出餐倒料完成 | |||||
/// </summary> | |||||
private void Robot_Pot1OutFood() | |||||
{ | |||||
Robot_Write("GM521", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅允许机器人投料(炒锅在投料位给出) | |||||
/// </summary> | |||||
private void Robot_Pot2AllowInMaterail() | |||||
{ | |||||
Robot_Write("GM530", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅出餐倒料到减速位。开始倒菜 | |||||
/// </summary> | |||||
private void Robot_Pot2OutFoodInSlowDown() | |||||
{ | |||||
Robot_Write("GM522", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅出餐倒料完成 | |||||
/// </summary> | |||||
private void Robot_Pot2OutFood() | |||||
{ | |||||
Robot_Write("GM523", true); | |||||
Thread.Sleep(200); | |||||
} | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
private void RobotActionStart(object o) | |||||
{ | |||||
if (o == null) return; | |||||
if(int.TryParse(o.ToString(), out int value)) | |||||
if (o[0] is int value) | |||||
{ | { | ||||
Robot_Write("GI0",value); | |||||
switch (value) | |||||
{ | |||||
case 0: | |||||
Robot_Write("GI0", (ushort)(MainTask)o[1]); | |||||
break; | |||||
case 1: | |||||
Robot_Write("GI1", (ushort)(SubTask1)o[1]); | |||||
break; | |||||
case 2: | |||||
Robot_Write("GI2", (ushort)(SubTask2)o[1]); | |||||
break; | |||||
case 3: | |||||
Robot_Write("GI3", (ushort)(SubTask3)o[1]); | |||||
break; | |||||
case 4: | |||||
Robot_Write("GI4", (ushort)(SubTask4)o[1]); | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
} | } | ||||
Thread.Sleep(200); | |||||
} | } | ||||
#endregion | #endregion | ||||
@@ -1082,7 +917,7 @@ namespace BPASmartClient.MorkBF | |||||
IsRun = IsHealth ? IsRun.运行 : IsRun.停止, | IsRun = IsHealth ? IsRun.运行 : IsRun.停止, | ||||
WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机, | WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机, | ||||
WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机, | WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机, | ||||
RobotStatu = morkBF.Robot_ActionCallback == 0? WorkStatus.待机 : WorkStatus.工作, | |||||
RobotStatu = WorkStatus.工作, | |||||
Alarm = new List<AlarmModel>(), | Alarm = new List<AlarmModel>(), | ||||
FailuresCount = 0, | FailuresCount = 0, | ||||
StatsCount = statsModels, | StatsCount = statsModels, | ||||
@@ -25,10 +25,10 @@ namespace BPASmartClient.MorkBF.Convert | |||||
case FryAction.热油: | case FryAction.热油: | ||||
visibility = Visibility.Visible; | visibility = Visibility.Visible; | ||||
break; | break; | ||||
case FryAction.加调料: | |||||
case FryAction.机器人加调料: | |||||
visibility = Visibility.Collapsed; | visibility = Visibility.Collapsed; | ||||
break; | break; | ||||
case FryAction.加辅料: | |||||
case FryAction.通道出调料: | |||||
visibility = Visibility.Collapsed; | visibility = Visibility.Collapsed; | ||||
break; | break; | ||||
case FryAction.炒制菜品: | case FryAction.炒制菜品: | ||||
@@ -63,10 +63,10 @@ namespace BPASmartClient.MorkBF.Convert | |||||
case FryAction.热油: | case FryAction.热油: | ||||
visibility = Visibility.Visible; | visibility = Visibility.Visible; | ||||
break; | break; | ||||
case FryAction.加调料: | |||||
case FryAction.机器人加调料: | |||||
visibility = Visibility.Collapsed; | visibility = Visibility.Collapsed; | ||||
break; | break; | ||||
case FryAction.加辅料: | |||||
case FryAction.通道出调料: | |||||
visibility = Visibility.Collapsed; | visibility = Visibility.Collapsed; | ||||
break; | break; | ||||
case FryAction.炒制菜品: | case FryAction.炒制菜品: | ||||
@@ -101,10 +101,10 @@ namespace BPASmartClient.MorkBF.Convert | |||||
case FryAction.热油: | case FryAction.热油: | ||||
visibility = Visibility.Collapsed; | visibility = Visibility.Collapsed; | ||||
break; | break; | ||||
case FryAction.加调料: | |||||
case FryAction.机器人加调料: | |||||
visibility = Visibility.Visible; | visibility = Visibility.Visible; | ||||
break; | break; | ||||
case FryAction.加辅料: | |||||
case FryAction.通道出调料: | |||||
visibility = Visibility.Visible; | visibility = Visibility.Visible; | ||||
break; | break; | ||||
case FryAction.炒制菜品: | case FryAction.炒制菜品: | ||||
@@ -284,22 +284,22 @@ namespace BPASmartClient.MorkBF | |||||
/// 机器人上使能 | /// 机器人上使能 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人上使能", "GM600.0", "4596")] | [VariableMonitor("机器人上使能", "GM600.0", "4596")] | ||||
public bool Robot_FirePot1OutMeal { get; set; } | |||||
public bool Robot_Enable { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人复位 | /// 机器人复位 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人复位", "GM600.1", "4597")] | [VariableMonitor("机器人复位", "GM600.1", "4597")] | ||||
public bool Robot_FirePot1OutVegetables1 { get; set; } | |||||
public bool Robot_Reset { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人启动 | /// 机器人启动 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人启动", "GM600.2", "4598")] | [VariableMonitor("机器人启动", "GM600.2", "4598")] | ||||
public bool Robot_FirePot1OutVegetables2 { get; set; } | |||||
public bool Robot_Start { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人停止 | /// 机器人停止 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人停止", "GM600.3", "4599")] | [VariableMonitor("机器人停止", "GM600.3", "4599")] | ||||
public bool Robot_FirePot1OutSeasoning { get; set; } | |||||
public bool Robot_Stop { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI0 | /// 机器人动作反馈GI0 | ||||
/// </summary> | /// </summary> | ||||
@@ -309,22 +309,22 @@ namespace BPASmartClient.MorkBF | |||||
/// 机器人动作反馈GI1 | /// 机器人动作反馈GI1 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI1", "GI1", "1")] | [VariableMonitor("机器人动作反馈GI1", "GI1", "1")] | ||||
public int Robot_GI1ActionCallback0 { get; set; } | |||||
public int Robot_GI1ActionCallback { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI2 | /// 机器人动作反馈GI2 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI2", "GI2", "2")] | [VariableMonitor("机器人动作反馈GI2", "GI2", "2")] | ||||
public int Robot_GI2ActionCallback0 { get; set; } | |||||
public int Robot_GI2ActionCallback { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI3 | /// 机器人动作反馈GI3 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI3", "GI3", "3")] | [VariableMonitor("机器人动作反馈GI3", "GI3", "3")] | ||||
public int Robot_GI3ActionCallback0 { get; set; } | |||||
public int Robot_GI3ActionCallback { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 机器人动作反馈GI4 | /// 机器人动作反馈GI4 | ||||
/// </summary> | /// </summary> | ||||
[VariableMonitor("机器人动作反馈GI4", "GI4", "4")] | [VariableMonitor("机器人动作反馈GI4", "GI4", "4")] | ||||
public int Robot_GI4ActionCallback0 { get; set; } | |||||
public int Robot_GI4ActionCallback { get; set; } | |||||
#endregion | #endregion | ||||
@@ -336,18 +336,13 @@ namespace BPASmartClient.MorkBF | |||||
public GVL_MorkBF() | public GVL_MorkBF() | ||||
{ | { | ||||
FirePot1_CompleteSingle = new Dictionary<int, bool> | |||||
{ | |||||
{1,Robot_FirePot1OutMeal }, | |||||
{2,Robot_FirePot1OutVegetables1 }, | |||||
{3,Robot_FirePot1OutVegetables2 }, | |||||
}; | |||||
FirePot2_CompleteSingle = new Dictionary<int, bool> | |||||
{ | |||||
{1,Robot_FirePot2OutMeal }, | |||||
{2,Robot_FirePot2OutVegetables1 }, | |||||
{3,Robot_FirePot2OutVegetables2 }, | |||||
}; | |||||
//FirePot1_CompleteSingle = new Dictionary<int, bool> | |||||
//{ | |||||
// {1,Robot_FirePot1OutMeal }, | |||||
// {2,Robot_FirePot1OutVegetables1 }, | |||||
// {3,Robot_FirePot1OutVegetables2 }, | |||||
//}; | |||||
//炒锅1通道完成信号 | //炒锅1通道完成信号 | ||||
Fire1_PasswayCompleteSingle = new Dictionary<int, bool> | Fire1_PasswayCompleteSingle = new Dictionary<int, bool> | ||||
@@ -129,16 +129,23 @@ | |||||
<Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/> | <Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/> | ||||
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/> | <Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/> | ||||
<Button Content="程序启动" Width="110" Margin="10,5" Command="{Binding RobotProgramStartCommand}"/> | <Button Content="程序启动" Width="110" Margin="10,5" Command="{Binding RobotProgramStartCommand}"/> | ||||
<Button Content="机器人停止" Width="110" Margin="10,5" Command="{Binding RobotStopCommand}"/> | |||||
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}" Cursor="Hand"/> | |||||
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}" Cursor="Hand"/> | |||||
<Button Content="1号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodCommand}"/> | |||||
<Button Content="2号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot2AllowInMaterailCommand}"/> | |||||
<Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/> | |||||
<Button Content="2号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodCommand}"/> | |||||
<TextBlock Text="机器人取菜出餐动作" Margin="10,5"/> | |||||
<ComboBox ItemsSource="{Binding RobotActions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding RobotAction}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="动作启动" Width="100" Margin="10,5" Command="{Binding RobotActionStartCommand}"/> | |||||
<Button Content="机器人上使能" Width="110" Margin="10,5" Command="{Binding RobotEnableCommand}"/> | |||||
<TextBlock Text="主程序任务" Margin="10,5"/> | |||||
<ComboBox ItemsSource="{Binding RobotMainTask}" SelectedValue="{Binding MainTask}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="0"/> | |||||
<TextBlock Text="主程序炒制任务1" Margin="30,5,10,0"/> | |||||
<ComboBox ItemsSource="{Binding RobotSubTask1}" SelectedValue="{Binding SubTask1}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="1"/> | |||||
<TextBlock Text="主程序炒制任务2" Margin="30,5,10,0"/> | |||||
<ComboBox ItemsSource="{Binding RobotSubTask2}" SelectedValue="{Binding SubTask2}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="2"/> | |||||
<TextBlock Text="子程序补料任务1" Margin="30,5,10,0"/> | |||||
<ComboBox ItemsSource="{Binding RobotSubTask3}" SelectedValue="{Binding SubTask3}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="3"/> | |||||
<TextBlock Text="子程序补料任务2" Margin="30,5,10,0"/> | |||||
<ComboBox ItemsSource="{Binding RobotSubTask4}" SelectedValue="{Binding SubTask4}" Height="30" Width="200" Margin="10,0"/> | |||||
<Button Content="任务设定" Width="100" Margin="10,5" Command="{Binding RobotActionCommand}" CommandParameter="4"/> | |||||
</WrapPanel> | </WrapPanel> | ||||
</GroupBox> | </GroupBox> | ||||
</Grid> | </Grid> | ||||
@@ -23,7 +23,7 @@ | |||||
</ResourceDictionary> | </ResourceDictionary> | ||||
</Window.Resources> | </Window.Resources> | ||||
<Border CornerRadius="1,60,00,70" Background="#1E1E1E" > | <Border CornerRadius="1,60,00,70" Background="#1E1E1E" > | ||||
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> | |||||
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown" Margin="0,-4,0,4"> | |||||
<Grid.Background> | <Grid.Background> | ||||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不规则矩形.png"/> | <ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不规则矩形.png"/> | ||||
</Grid.Background> | </Grid.Background> | ||||
@@ -40,12 +40,12 @@ | |||||
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80" Click="Button_Click"/> | <Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80" Click="Button_Click"/> | ||||
</StackPanel> | </StackPanel> | ||||
<Grid Grid.Row="1"> | <Grid Grid.Row="1"> | ||||
<ListBox ItemsSource="{Binding FryPotProcesses}" FontSize="15"> | |||||
<ListBox ItemsSource="{Binding FryPotProcesses}" FontSize="15" x:Name="mylist"> | |||||
<ListBox.ItemTemplate> | <ListBox.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
<StackPanel Orientation="Horizontal" Margin="0,10"> | <StackPanel Orientation="Horizontal" Margin="0,10"> | ||||
<TextBlock Text="步骤--" Margin="10,0,2,0" VerticalAlignment="Center"/> | <TextBlock Text="步骤--" Margin="10,0,2,0" VerticalAlignment="Center"/> | ||||
<TextBlock Text="{Binding FryTime}" VerticalAlignment="Center"/> | |||||
<TextBlock Text="{Binding FryTime,Mode=TwoWay}" VerticalAlignment="Center"/> | |||||
<TextBlock Text="加热时间--" Margin="10,0,2,0" VerticalAlignment="Center"/> | <TextBlock Text="加热时间--" Margin="10,0,2,0" VerticalAlignment="Center"/> | ||||
<TextBox Text="{Binding FryDuration}" Margin="10,0" Width="40" VerticalAlignment="Center"/> | <TextBox Text="{Binding FryDuration}" Margin="10,0" Width="40" VerticalAlignment="Center"/> | ||||
<TextBlock Text="动作--" Margin="10,0,2,0" VerticalAlignment="Center"/> | <TextBlock Text="动作--" Margin="10,0,2,0" VerticalAlignment="Center"/> | ||||
@@ -66,6 +66,8 @@ | |||||
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | ||||
<TextBox Text="{Binding accessories[0].Loc}" VerticalAlignment="Center" Width="50" | <TextBox Text="{Binding accessories[0].Loc}" VerticalAlignment="Center" Width="50" | ||||
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | ||||
<Button Content="删除" Margin="10,0" Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}" | |||||
CommandParameter="{Binding DataContext,RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}"/> | |||||
</StackPanel> | </StackPanel> | ||||
</DataTemplate> | </DataTemplate> | ||||
</ListBox.ItemTemplate> | </ListBox.ItemTemplate> | ||||
@@ -29,6 +29,7 @@ namespace BPASmartClient.MorkBF.VIew | |||||
{ | { | ||||
this.Close(); | this.Close(); | ||||
}), "FoodManagerViewClose"); | }), "FoodManagerViewClose"); | ||||
} | } | ||||
private void Button_Click(object sender, RoutedEventArgs e) | private void Button_Click(object sender, RoutedEventArgs e) | ||||
@@ -322,25 +322,23 @@ namespace BPASmartClient.MorkBF.ViewModel | |||||
#region 机器人 | #region 机器人 | ||||
public Dictionary<int,string> RobotActions { get; set; } = new Dictionary<int, string>() | |||||
{ | |||||
{0, "无任务"}, | |||||
{1, "取1号炒锅荤菜盆倒1号炒锅"}, | |||||
{2, "取1号炒锅素菜盆1倒1号炒锅"}, | |||||
{3, "取1号炒锅素菜盆2倒1号炒锅"}, | |||||
{4, "取1号炒锅调料盆倒入1号炒锅"}, | |||||
{5, "取1号炒锅辅料盆1倒入1号炒锅"}, | |||||
{6, "取1号空盆出餐"}, | |||||
{20, "取2号炒锅荤菜盆1倒1号炒锅"}, | |||||
{21, "取2号炒锅素菜盆1倒1号炒锅"}, | |||||
{22, "取2号炒锅素菜盆2倒1号炒锅"}, | |||||
{23, "取2号炒锅调料盆倒入1号炒锅"}, | |||||
{24, "取2号炒锅辅料盆1倒入1号炒锅"}, | |||||
{25, "取2号空盆出餐"}, | |||||
}; | |||||
public ObservableCollection<MainTask> RobotMainTask { get; set; } = new ObservableCollection<MainTask>(Enum.GetValues<MainTask>()); | |||||
public ObservableCollection<SubTask1> RobotSubTask1 { get; set; } = new ObservableCollection<SubTask1>(Enum.GetValues<SubTask1>()); | |||||
public ObservableCollection<SubTask2> RobotSubTask2 { get; set; } = new ObservableCollection<SubTask2>(Enum.GetValues<SubTask2>()); | |||||
public ObservableCollection<SubTask3> RobotSubTask3 { get; set; } = new ObservableCollection<SubTask3>(Enum.GetValues<SubTask3>()); | |||||
public ObservableCollection<SubTask4> RobotSubTask4 { get; set; } = new ObservableCollection<SubTask4>(Enum.GetValues<SubTask4>()); | |||||
[ObservableProperty] | [ObservableProperty] | ||||
private int _robotAction; | |||||
private MainTask _mainTask; | |||||
[ObservableProperty] | |||||
private SubTask1 _subTask1; | |||||
[ObservableProperty] | |||||
private SubTask2 _subTask2; | |||||
[ObservableProperty] | |||||
private SubTask3 _subTask3; | |||||
[ObservableProperty] | |||||
private SubTask4 _subTask4; | |||||
/// <summary> | /// <summary> | ||||
/// 机器人启动 | /// 机器人启动 | ||||
/// </summary> | /// </summary> | ||||
@@ -366,74 +364,52 @@ namespace BPASmartClient.MorkBF.ViewModel | |||||
ActionManage.GetInstance.Send("RobotReset"); | ActionManage.GetInstance.Send("RobotReset"); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 程序启动 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void RobotProgramStart() | |||||
{ | |||||
ActionManage.GetInstance.Send("RobotProgramStart"); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅允许机器人投料 | |||||
/// 机器人上使能 | |||||
/// </summary> | /// </summary> | ||||
[RelayCommand] | [RelayCommand] | ||||
private void Robot_Pot1AllowInMaterail() | |||||
private void RobotEnable() | |||||
{ | { | ||||
ActionManage.GetInstance.Send("Robot_Pot1AllowInMaterail"); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅出餐倒料到减速位 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void Robot_Pot1OutFoodInSlowDown() | |||||
{ | |||||
ActionManage.GetInstance.Send("Robot_Pot1OutFoodInSlowDown"); | |||||
} | |||||
/// <summary> | |||||
/// 1号炒锅出餐倒料完成 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void Robot_Pot1OutFood() | |||||
{ | |||||
ActionManage.GetInstance.Send("Robot_Pot1OutFood"); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅允许机器人投料 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void Robot_Pot2AllowInMaterail() | |||||
{ | |||||
ActionManage.GetInstance.Send("Robot_Pot2AllowInMaterail"); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅出餐倒料到减速位 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void Robot_Pot2OutFoodInSlowDown() | |||||
{ | |||||
ActionManage.GetInstance.Send("Robot_Pot2OutFoodInSlowDown"); | |||||
} | |||||
/// <summary> | |||||
/// 2号炒锅出餐倒料完成 | |||||
/// </summary> | |||||
[RelayCommand] | |||||
private void Robot_Pot2OutFood() | |||||
{ | |||||
ActionManage.GetInstance.Send("Robot_Pot2OutFood"); | |||||
ActionManage.GetInstance.Send("RobotEnable"); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 机器人动作启动 | |||||
/// 机器人动作 | |||||
/// </summary> | /// </summary> | ||||
[RelayCommand] | [RelayCommand] | ||||
private void RobotActionStart() | |||||
private void RobotAction(object o) | |||||
{ | { | ||||
ActionManage.GetInstance.Send("RobotProgramStart",RobotAction ); | |||||
if(int.TryParse(o.ToString(), out int value)) | |||||
{ | |||||
object item = new object(); | |||||
switch (value) | |||||
{ | |||||
case 0: | |||||
item = MainTask; | |||||
break; | |||||
case 1: | |||||
item = SubTask1; | |||||
break; | |||||
case 2: | |||||
item = SubTask2; | |||||
break; | |||||
case 3: | |||||
item = SubTask3; | |||||
break; | |||||
case 4: | |||||
item = SubTask4; | |||||
break; | |||||
default: | |||||
break; | |||||
} | |||||
ActionManage.GetInstance.Send("RobotAction", new object[] { value, item }); | |||||
} | |||||
} | } | ||||
#endregion | #endregion | ||||
} | } | ||||
} | } |
@@ -7,6 +7,7 @@ using System.Collections.ObjectModel; | |||||
using System.Linq; | using System.Linq; | ||||
using System.Text; | using System.Text; | ||||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||||
using System.Windows; | |||||
namespace BPASmartClient.MorkBF.ViewModel | namespace BPASmartClient.MorkBF.ViewModel | ||||
{ | { | ||||
@@ -69,10 +70,19 @@ namespace BPASmartClient.MorkBF.ViewModel | |||||
if (o == null) return; | if (o == null) return; | ||||
if (o is FryPotProcess value) | if (o is FryPotProcess value) | ||||
{ | { | ||||
foreach (var item in FryPotProcesses) | |||||
{ | |||||
if (item.FryTime > value.FryTime) | |||||
{ | |||||
Application.Current?.Dispatcher.Invoke(new Action(() => | |||||
{ | |||||
item.FryTime -= 1; | |||||
})); | |||||
} | |||||
} | |||||
FryPotProcesses.Remove(value); | FryPotProcesses.Remove(value); | ||||
} | } | ||||
ActionManage.GetInstance.Send("更新菜单"); | |||||
} | } | ||||