diff --git a/BPASmartClient.CustomResource/Image/弹窗.png b/BPASmartClient.CustomResource/Image/弹窗.png
index 7d4f8fdd..ce73a3c8 100644
Binary files a/BPASmartClient.CustomResource/Image/弹窗.png and b/BPASmartClient.CustomResource/Image/弹窗.png differ
diff --git a/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml b/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml
index 635e3b0e..43527aa4 100644
--- a/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml
+++ b/BPASmartClient.CustomResource/RecDictionarys/RecToggleButton.xaml
@@ -137,4 +137,83 @@
+
+
+
+
\ No newline at end of file
diff --git a/BPASmartClient.Model/大炒/FryPotMessages.cs b/BPASmartClient.Model/大炒/FryPotMessages.cs
new file mode 100644
index 00000000..9ab0da81
--- /dev/null
+++ b/BPASmartClient.Model/大炒/FryPotMessages.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.大炒
+{
+ public class FryPotMessages
+ {
+ public string GoodName { get; set; }
+ public string GoodKey { get; set; }
+ public List fryPotProcesses { get; set; } = new List();
+ }
+
+ public class FryPotProcess
+ {
+ ///
+ /// 步骤
+ ///
+ public int FryTime { get; set; }
+ ///
+ /// 动作
+ ///
+ public FryAction fryActions { get; set; }
+ ///
+ /// 加热时间 单位s
+ ///
+ public int FryDuration { get; set; } = 0;
+ ///
+ /// 加热挡位 1-5
+ ///
+ public int FryGear { get; set; } = 0;
+ ///
+ /// 搅拌挡位 小炒1-10 大炒1-5
+ ///
+ public int StirGear { get; set; } = 0;
+ ///
+ /// 翻转速度0到800
+ ///
+ public int TurnSpeed { get; set; }= 0;
+ ///
+ /// 炒制位置1到4
+ ///
+ public int FryPosition { get; set; }
+ ///
+ /// 辅料,调料,或者菜品集合
+ ///
+ public List accessories { get; set; } = new List();
+
+ }
+
+ public class Accessories
+ {
+ ///
+ /// 位置
+ ///
+ public int Loc { get; set; }
+ ///
+ /// 重量
+ ///
+ public int Qry { get; set; }
+ }
+
+ public enum FryAction
+ {
+ 冷锅加热,
+ 热油,
+ 加调料,
+ 加辅料,
+ 炒制菜品,
+
+ }
+
+ public enum FryRepot
+ {
+ 开始,
+ 热锅,
+ 炒菜,
+ 出餐,
+ 完成,
+ }
+}
diff --git a/BPASmartClient.Model/大炒/LocalFryPotMessage.cs b/BPASmartClient.Model/大炒/LocalFryPotMessage.cs
new file mode 100644
index 00000000..9f318553
--- /dev/null
+++ b/BPASmartClient.Model/大炒/LocalFryPotMessage.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.大炒
+{
+ public class LocalFryPotMessage
+ {
+ public ObservableCollection FryPotMessage { get; set; } = new ObservableCollection();
+ }
+}
diff --git a/BPASmartClient.Model/大炒/RobotActionModel.cs b/BPASmartClient.Model/大炒/RobotActionModel.cs
new file mode 100644
index 00000000..b614cd34
--- /dev/null
+++ b/BPASmartClient.Model/大炒/RobotActionModel.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.Model.大炒
+{
+ public class RobotAction_Pot
+ {
+ public int Pot { get; set; }
+ public RobotActionModel robotActionModel { get; set; }
+ }
+
+ public enum RobotActionModel
+ {
+ 无任务,
+ 取1号炒锅荤菜盆倒1号炒锅,
+ 取1号炒锅素菜盆1倒1号炒锅,
+ 取1号炒锅素菜盆2倒1号炒锅,
+ 取1号炒锅调料盆倒入1号炒锅,
+ 取1号炒锅辅料盆1倒入1号炒锅,
+ 取1号空盆出餐,
+
+ 取2号炒锅荤菜盆1倒2号炒锅 = 20,
+ 取2号炒锅素菜盆1倒2号炒锅 = 21,
+ 取2号炒锅素菜盆2倒2号炒锅 =22,
+ 取2号炒锅调料盆倒入2号炒锅 =23,
+ 取2号炒锅辅料盆1倒入2号炒锅 =24,
+ 取2号空盆出餐 =25,
+ }
+}
diff --git a/BPASmartClient.MorkBF/Control_MorkBF.cs b/BPASmartClient.MorkBF/Control_MorkBF.cs
index 76be2fdf..44c179f1 100644
--- a/BPASmartClient.MorkBF/Control_MorkBF.cs
+++ b/BPASmartClient.MorkBF/Control_MorkBF.cs
@@ -1,10 +1,13 @@
-using BPA.Message;
+using BPA.Helper;
+using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Model;
+using BPASmartClient.Model.大炒;
+using BPASmartClient.MorkBF.Model;
using BPASmartClient.MorkBF.ViewModel;
using System;
using System.Collections.Generic;
@@ -13,6 +16,9 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;
+using static BPASmartClient.Model.大炒.FryPotMessages;
+using ActionManage = BPA.Helper.ActionManage;
+using ThreadManage = BPA.Helper.ThreadManage;
namespace BPASmartClient.MorkBF
{
@@ -24,7 +30,8 @@ namespace BPASmartClient.MorkBF
public override void DoMain()
{
-
+ IsHealth = true;
+ BPASmartClient.Helper.Json.Read();
MonitorViewModel.DeviceId = DeviceId;
CommandRegist();//调试
ServerInit();
@@ -44,8 +51,6 @@ namespace BPASmartClient.MorkBF
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");
-
-
}
});
@@ -60,7 +65,6 @@ namespace BPASmartClient.MorkBF
if (@event is MaterialDeliveryEvent material)
{
orderMaterialDelivery = material.orderMaterialDelivery;
-
}
});
@@ -132,11 +136,55 @@ namespace BPASmartClient.MorkBF
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.TryDequeue(out RobotAction_Pot robotAction))
+ {
+ morkBF.Robot_IsBusy =true;
+ RobotProcess(robotAction);
+ }
+ }
}
private void FirePot1_Process()
{
+ if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
+ {
+ morkBF.FirePan1_Busy = true;
+ foreach (var item in result.fryPotProcesses)
+ {
+ switch (item.fryActions)
+ {
+ case FryAction.冷锅加热:
+ FirePot_PotPerHeat(item, 1);
+ break;
+
+ case FryAction.热油:
+ FirePot_HeatOil(item,1);
+ break;
+
+ case FryAction.加调料:
+ FirePot_AddSeasoning(item, 1);
+ break;
+ case FryAction.加辅料:
+
+ break;
+ case FryAction.炒制菜品:
+ FirePot_FryFood(item,1);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ }
}
private void FirePot2_Process()
@@ -144,6 +192,192 @@ namespace BPASmartClient.MorkBF
}
+
+ #region 炒锅流程功能
+ ///
+ /// 冷锅预热
+ ///
+ private void FirePot_PotPerHeat(FryPotProcess item,int i)
+ {
+ if(i == 1)//炒锅1
+ {
+ FirePot1_SetFireGear(item.FryGear);
+ FirePot1_StartFire(true);
+
+ }
+ else if(i == 2)//炒锅2
+ {
+ FirePot2_SetFireGear(item.FryGear);
+ FirePot2_StartFire(true);
+
+ }
+ Thread.Sleep(item.FryDuration);
+ }
+
+ ///
+ /// 热油
+ ///
+ private void FirePot_HeatOil(FryPotProcess item, int i)
+ {
+ if (item.FryGear != 0)
+ {
+ FirePot1_SetFireGear(item.FryGear);//设定加热挡位
+ FirePot1_StartFire(true);//开启加热
+ }
+ if (item.StirGear != 0)
+ {
+ FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
+ FirePot1_StartFire(true);//开启搅拌
+ }
+ Thread.Sleep(item.FryDuration);//加热时间;
+ }
+
+ ///
+ /// 加调料
+ ///
+ private void FirePot_AddSeasoning(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)
+ {
+ morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅调料盆倒入2号炒锅 });
+ Thread.Sleep(item.FryDuration);
+ }
+
+ }
+
+ ///
+ /// 加辅料
+ ///
+ private void FirePot_AddAccessories(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 { Pot = 2, robotActionModel = RobotActionModel.取2号炒锅辅料盆1倒入2号炒锅 });
+ Thread.Sleep(item.FryDuration);
+ }
+
+ }
+
+ ///
+ /// 炒制菜品
+ ///
+ private void FirePot_FryFood(FryPotProcess item, int i)
+ {
+ if (i == 1)
+ {
+ 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);
+ }
+ Thread.Sleep(item.FryDuration);
+
+ }
+
+ else if (i == 2)
+ {
+ 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);
+ }
+ Thread.Sleep(item.FryDuration);
+ }
+ }
+ #endregion
+
+ ///
+ /// 机器人进程
+ ///
+ ///
+ private void RobotProcess(RobotAction_Pot robotAction)
+ {
+ Robot_Write("GI0",(int)robotAction.robotActionModel);
+ while (morkBF.Robot_ActionCallback != (int)robotAction.robotActionModel)//机器人动作执行完动作反馈
+ {
+ Thread.Sleep(100);
+ }
+ if(robotAction.Pot == 1)//炒锅1
+ {
+ if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
+ {
+ Robot_Write("GM521", true);//炒锅去投料位置
+ while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜
+ {
+ Thread.Sleep(100);
+ }
+ FirePot_Write("M11.6", true);//炒锅去出餐倒料位置
+ while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
+ {
+ Thread.Sleep(1000);
+ }
+ Thread.Sleep(20 * 1000);//等待20s出餐
+
+ }
+ else
+ {
+ FirePot_Write("M11.7", true);//炒锅去投料位置
+ while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料
+ {
+ Thread.Sleep(100);
+ }
+ Robot_Write("GM520", true);//机器人投料
+ }
+
+ }
+ else if (robotAction.Pot == 2)
+ {
+ if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
+ {
+ Robot_Write("GM531", true);//炒锅去投料位置
+ while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜
+ {
+ Thread.Sleep(100);
+ }
+ FirePot_Write("M16.6", true);//炒锅去出餐倒料位置
+ while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
+ {
+ Thread.Sleep(1000);
+ }
+ Thread.Sleep(20 * 1000);//等待20s出餐
+
+ }
+ else
+ {
+ FirePot_Write("M16.7", true);
+ while (!morkBF.FirePot2_PotOnIntoFoodPosition)
+ {
+ Thread.Sleep(100);
+ }
+ Robot_Write("GM530", true);
+ }
+
+ }
+
+ while(!morkBF.Robot_Origin)
+ {
+ Thread.Sleep(1000);
+ }
+ morkBF.Robot_IsBusy = false;
+ MessageLog.GetInstance.Show($"机器人完成[{robotAction.robotActionModel.ToString()}]任务");
+ }
+
public override void ReadData()
{
GetStatus("M20.0",new Action