@@ -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<FryPotProcess> fryPotProcesses { get; set; } = new List<FryPotProcess>(); | |||
} | |||
public class FryPotProcess | |||
{ | |||
/// <summary> | |||
/// 步骤 | |||
/// </summary> | |||
public int FryTime { get; set; } | |||
/// <summary> | |||
/// 动作 | |||
/// </summary> | |||
public FryAction fryActions { get; set; } | |||
/// <summary> | |||
/// 加热时间 单位s | |||
/// </summary> | |||
public int FryDuration { get; set; } = 0; | |||
/// <summary> | |||
/// 加热挡位 1-5 | |||
/// </summary> | |||
public int FryGear { get; set; } = 0; | |||
/// <summary> | |||
/// 搅拌挡位 小炒1-10 大炒1-5 | |||
/// </summary> | |||
public int StirGear { get; set; } = 0; | |||
/// <summary> | |||
/// 翻转速度0到800 | |||
/// </summary> | |||
public int TurnSpeed { get; set; }= 0; | |||
/// <summary> | |||
/// 炒制位置1到4 | |||
/// </summary> | |||
public int FryPosition { get; set; } | |||
/// <summary> | |||
/// 辅料,调料,或者菜品集合 | |||
/// </summary> | |||
public List<Accessories> accessories { get; set; } = new List<Accessories>(); | |||
} | |||
public class Accessories | |||
{ | |||
/// <summary> | |||
/// 位置 | |||
/// </summary> | |||
public int Loc { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
/// </summary> | |||
public int Qry { get; set; } | |||
} | |||
public enum FryAction | |||
{ | |||
冷锅加热, | |||
热油, | |||
加调料, | |||
加辅料, | |||
炒制菜品, | |||
} | |||
public enum FryRepot | |||
{ | |||
开始, | |||
热锅, | |||
炒菜, | |||
出餐, | |||
完成, | |||
} | |||
} |
@@ -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<FryPotMessages> FryPotMessage { get; set; } = new ObservableCollection<FryPotMessages>(); | |||
} | |||
} |
@@ -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, | |||
} | |||
} |
@@ -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<LocalFryPotMessage>.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 炒锅流程功能 | |||
/// <summary> | |||
/// 冷锅预热 | |||
/// </summary> | |||
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); | |||
} | |||
/// <summary> | |||
/// 热油 | |||
/// </summary> | |||
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);//加热时间; | |||
} | |||
/// <summary> | |||
/// 加调料 | |||
/// </summary> | |||
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); | |||
} | |||
} | |||
/// <summary> | |||
/// 加辅料 | |||
/// </summary> | |||
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); | |||
} | |||
} | |||
/// <summary> | |||
/// 炒制菜品 | |||
/// </summary> | |||
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 | |||
/// <summary> | |||
/// 机器人进程 | |||
/// </summary> | |||
/// <param name="robotAction"></param> | |||
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<object>((o)=> | |||
@@ -228,9 +462,10 @@ namespace BPASmartClient.MorkBF | |||
if (o == null) return; | |||
if (o is bool[] values && values.Length == 7) | |||
{ | |||
morkBF.Robot_FirePot1OutMeal = values[0]; | |||
morkBF.Robot_FirePot1OutVegetables1 = values[1]; | |||
morkBF.Robot_FirePot1OutVegetables2 = values[2]; | |||
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]; | |||
@@ -243,9 +478,9 @@ namespace BPASmartClient.MorkBF | |||
if (o == null) return; | |||
if (o is bool[] values && values.Length == 7) | |||
{ | |||
morkBF.Robot_FirePot2OutMeal = values[0]; | |||
morkBF.Robot_FirePot2OutVegetables1 = values[1]; | |||
morkBF.Robot_FirePot2OutVegetables2 = values[2]; | |||
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]; | |||
@@ -319,7 +554,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW100", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅1加热启停 | |||
@@ -332,6 +567,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("M10.0", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅1设置搅拌挡位 | |||
@@ -344,6 +580,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW102", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅1搅拌启停 | |||
@@ -356,6 +593,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("M10.1", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 设置炒锅1翻转速度 | |||
@@ -368,6 +606,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW104", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
#endregion | |||
@@ -383,7 +622,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW130", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅2加热启停 | |||
@@ -396,6 +635,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("M15.0", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅2设置搅拌挡位 | |||
@@ -408,6 +648,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW132", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅2搅拌启停 | |||
@@ -420,6 +661,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("M15.1", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 设置炒锅2翻转速度 | |||
@@ -432,6 +674,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
FirePot_Write("VW134", value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
#endregion | |||
@@ -476,6 +719,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M15.5", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去位置1 | |||
@@ -495,6 +739,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.2", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去位置2 | |||
@@ -514,6 +759,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.3", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去位置3 | |||
@@ -533,6 +779,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.4", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去位置4 | |||
@@ -552,6 +799,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.5", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去出餐位置 | |||
@@ -571,6 +819,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.6", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 炒锅去投料位置 | |||
@@ -590,6 +839,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.7", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 出餐启动 | |||
@@ -610,6 +860,7 @@ namespace BPASmartClient.MorkBF | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 清洗 | |||
@@ -622,13 +873,15 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
if (i == 1) | |||
{ | |||
FirePot_Write("M10.7", true); | |||
if(morkBF.FirePot1_OnOrigin) FirePot_Write("M10.7", true); | |||
} | |||
else if (i == 2) | |||
{ | |||
FirePot_Write("M15.7", true); | |||
if (morkBF.FirePot2_OnOrigin) FirePot_Write("M15.7", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 抽水启动 | |||
@@ -648,6 +901,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.0", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 抽油启动 | |||
@@ -667,6 +921,7 @@ namespace BPASmartClient.MorkBF | |||
FirePot_Write("M16.1", true); | |||
} | |||
} | |||
Thread.Sleep(200); | |||
} | |||
#endregion | |||
@@ -677,6 +932,7 @@ namespace BPASmartClient.MorkBF | |||
private void RobotStart() | |||
{ | |||
Robot_Write("GM600",true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 机器人停止 | |||
@@ -684,6 +940,7 @@ namespace BPASmartClient.MorkBF | |||
private void RobotStop() | |||
{ | |||
Robot_Write("GM601", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 机器人复位 | |||
@@ -691,6 +948,7 @@ namespace BPASmartClient.MorkBF | |||
private void RobotReset() | |||
{ | |||
Robot_Write("GM602", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 机器人程序重启 | |||
@@ -698,6 +956,7 @@ namespace BPASmartClient.MorkBF | |||
private void RobotProgramStart() | |||
{ | |||
Robot_Write("GM603", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 1号炒锅允许机器人投料(炒锅在投料位给出) | |||
@@ -705,6 +964,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot1AllowInMaterail() | |||
{ | |||
Robot_Write("GM520", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 1号炒锅出餐倒料到减速位 | |||
@@ -712,6 +972,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot1OutFoodInSlowDown() | |||
{ | |||
Robot_Write("GM621", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 1号炒锅出餐倒料完成 | |||
@@ -719,6 +980,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot1OutFood() | |||
{ | |||
Robot_Write("GM522", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 2号炒锅允许机器人投料(炒锅在投料位给出) | |||
@@ -726,6 +988,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot2AllowInMaterail() | |||
{ | |||
Robot_Write("GM530", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 2号炒锅出餐倒料到减速位。开始倒菜 | |||
@@ -733,6 +996,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot2OutFoodInSlowDown() | |||
{ | |||
Robot_Write("GM531", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// 2号炒锅出餐倒料完成 | |||
@@ -740,6 +1004,7 @@ namespace BPASmartClient.MorkBF | |||
private void Robot_Pot2OutFood() | |||
{ | |||
Robot_Write("GM532", true); | |||
Thread.Sleep(200); | |||
} | |||
/// <summary> | |||
/// | |||
@@ -751,6 +1016,7 @@ namespace BPASmartClient.MorkBF | |||
{ | |||
Robot_Write("GI0",value); | |||
} | |||
Thread.Sleep(200); | |||
} | |||
#endregion | |||
@@ -0,0 +1,127 @@ | |||
using BPASmartClient.Model.大炒; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Globalization; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Data; | |||
namespace BPASmartClient.MorkBF.Convert | |||
{ | |||
public class StirToVisibilityConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
Visibility visibility = Visibility.Visible; | |||
if (value != null && value is FryAction fryAction) | |||
{ | |||
switch (fryAction) | |||
{ | |||
case FryAction.冷锅加热: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.热油: | |||
visibility = Visibility.Visible; | |||
break; | |||
case FryAction.加调料: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.加辅料: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.炒制菜品: | |||
visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
return visibility; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
public class FirePositionToVisibilityConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
Visibility visibility = Visibility.Visible; | |||
if (value != null && value is FryAction fryAction) | |||
{ | |||
switch (fryAction) | |||
{ | |||
case FryAction.冷锅加热: | |||
visibility = Visibility.Visible; | |||
break; | |||
case FryAction.热油: | |||
visibility = Visibility.Visible; | |||
break; | |||
case FryAction.加调料: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.加辅料: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.炒制菜品: | |||
visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
return visibility; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
public class AccessoriesToVisibilityConverter : IValueConverter | |||
{ | |||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
Visibility visibility = Visibility.Visible; | |||
if (value != null && value is FryAction fryAction) | |||
{ | |||
switch (fryAction) | |||
{ | |||
case FryAction.冷锅加热: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.热油: | |||
visibility = Visibility.Collapsed; | |||
break; | |||
case FryAction.加调料: | |||
visibility = Visibility.Visible; | |||
break; | |||
case FryAction.加辅料: | |||
visibility = Visibility.Visible; | |||
break; | |||
case FryAction.炒制菜品: | |||
visibility = Visibility.Visible; | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
return visibility; | |||
} | |||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | |||
{ | |||
throw new NotImplementedException(); | |||
} | |||
} | |||
} | |||
@@ -1,4 +1,5 @@ | |||
using BPASmartClient.Device; | |||
using BPASmartClient.Model.大炒; | |||
using BPASmartClient.MorkBF.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
@@ -14,11 +15,15 @@ namespace BPASmartClient.MorkBF | |||
/// <summary> | |||
/// 炒锅1订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<BF_Food> FirePan1_Order { get; set; } = new ConcurrentQueue<BF_Food>(); | |||
public ConcurrentQueue<FryPotMessages> FirePan1_Order { get; set; } = new ConcurrentQueue<FryPotMessages>(); | |||
/// <summary> | |||
/// 炒锅2订单队列 | |||
/// </summary> | |||
public ConcurrentQueue<BF_Food> FirePan2_Order { get; set; } = new ConcurrentQueue<BF_Food>(); | |||
public ConcurrentQueue<FryPotMessages> FirePan2_Order { get; set; } = new ConcurrentQueue<FryPotMessages>(); | |||
/// <summary> | |||
/// 机器人队列 | |||
/// </summary> | |||
public ConcurrentQueue<RobotAction_Pot> RobotActinQueue { get; set; } = new ConcurrentQueue<RobotAction_Pot>(); | |||
/// <summary> | |||
/// 炒锅1忙碌 | |||
/// </summary> | |||
@@ -247,30 +252,39 @@ namespace BPASmartClient.MorkBF | |||
#endregion | |||
#region 机器人数据读取 | |||
public bool Robot_IsBusy; | |||
/// <summary> | |||
/// 机器人在原点位 | |||
/// </summary> | |||
[VariableMonitor("机器人在原点位", "GM105", "4201")] | |||
public bool Robot_Origin { get; set; } | |||
/// <summary> | |||
/// 1号锅倒荤菜完成 | |||
/// </summary> | |||
[VariableMonitor("1号锅倒荤菜完成", "GM500", "4596")] | |||
[VariableMonitor("机器人#1号锅倒荤菜完成", "GM500", "4596")] | |||
public bool Robot_FirePot1OutMeal{ get; set; } | |||
/// <summary> | |||
/// 1号炒锅倒素菜1完成 | |||
/// </summary> | |||
[VariableMonitor("1号炒锅倒素菜1完成", "GM501", "4597")] | |||
[VariableMonitor("机器人#1号炒锅倒素菜1完成", "GM501", "4597")] | |||
public bool Robot_FirePot1OutVegetables1{ get; set; } | |||
/// <summary> | |||
/// 1号炒锅倒素菜2完成 | |||
/// </summary> | |||
[VariableMonitor("1号炒锅倒素菜2完成", "GM502", "4598")] | |||
[VariableMonitor("机器人#1号炒锅倒素菜2完成", "GM502", "4598")] | |||
public bool Robot_FirePot1OutVegetables2{ get; set; } | |||
/// <summary> | |||
/// 1号炒锅倒调料完成 | |||
/// </summary> | |||
[VariableMonitor("1号炒锅倒调料完成", "GM503", "4599")] | |||
[VariableMonitor("机器人#1号炒锅倒调料完成", "GM503", "4599")] | |||
public bool Robot_FirePot1OutSeasoning{ get; set; } | |||
/// <summary> | |||
/// 1号炒锅倒辅料完成 | |||
/// </summary> | |||
[VariableMonitor("1号炒锅倒辅料完成", "GM504", "4600")] | |||
[VariableMonitor("机器人#1号炒锅倒辅料完成", "GM504", "4600")] | |||
public bool Robot_FirePot1OutAccessories{ get; set; } | |||
/// <summary> | |||
/// 机器人到位,请求1#炒锅倒菜 | |||
@@ -280,7 +294,7 @@ namespace BPASmartClient.MorkBF | |||
/// <summary> | |||
/// 1号炒锅出餐完成 | |||
/// </summary> | |||
[VariableMonitor("1号炒锅出餐完成", "GM506", "4602")] | |||
[VariableMonitor("机器人#1号炒锅出餐完成", "GM506", "4602")] | |||
public bool Robot_FirePot1OutFoodComplete{ get; set; } | |||
@@ -290,12 +304,12 @@ namespace BPASmartClient.MorkBF | |||
/// <summary> | |||
/// 2号锅倒荤菜完成 | |||
/// </summary> | |||
[VariableMonitor("2号锅倒荤菜完成", "GM510", "4606")] | |||
[VariableMonitor("机器人#2号锅倒荤菜完成", "GM510", "4606")] | |||
public bool Robot_FirePot2OutMeal { get; set; } | |||
/// <summary> | |||
/// 2号炒锅倒素菜1完成 | |||
/// </summary> | |||
[VariableMonitor("2号炒锅倒素菜1完成", "GM511", "4607")] | |||
[VariableMonitor("机器人#2号炒锅倒素菜1完成", "GM511", "4607")] | |||
public bool Robot_FirePot2OutVegetables1{ get; set; } | |||
/// <summary> | |||
/// 2号炒锅倒素菜2完成 | |||
@@ -305,22 +319,22 @@ namespace BPASmartClient.MorkBF | |||
/// <summary> | |||
/// 2号炒锅倒调料完成 | |||
/// </summary> | |||
[VariableMonitor("2号炒锅倒调料完成", "GM513", "4609")] | |||
[VariableMonitor("机器人#2号炒锅倒调料完成", "GM513", "4609")] | |||
public bool Robot_FirePot2OutSeasoning{ get; set; } | |||
/// <summary> | |||
/// 2号炒锅倒辅料完成 | |||
/// </summary> | |||
[VariableMonitor("2号炒锅倒辅料完成", "GM514", "4610")] | |||
[VariableMonitor("机器人#2号炒锅倒辅料完成", "GM514", "4610")] | |||
public bool Robot_FirePot2OutAccessories{ get; set; } | |||
/// <summary> | |||
/// 机器人到位,请求1#炒锅倒菜 | |||
/// </summary> | |||
[VariableMonitor("机器人到位,请求1#炒锅倒菜", "GM515", "4611")] | |||
[VariableMonitor("机器人#机器人到位,请求1#炒锅倒菜", "GM515", "4611")] | |||
public bool Robot_ArriveFirePot2{ get; set; } | |||
/// <summary> | |||
/// 2号炒锅出餐完成 | |||
/// </summary> | |||
[VariableMonitor("2号炒锅出餐完成", "GM516", "4612")] | |||
[VariableMonitor("机器人#2号炒锅出餐完成", "GM516", "4612")] | |||
public bool Robot_FirePot2OutFoodComplete{ get; set; } | |||
/// <summary> | |||
/// 机器人动作反馈 | |||
@@ -330,7 +344,27 @@ namespace BPASmartClient.MorkBF | |||
#endregion | |||
public Dictionary<int, bool> FirePot1_CompleteSingle { get; set; } | |||
public Dictionary<int, bool> FirePot2_CompleteSingle { get; set; } | |||
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 }, | |||
}; | |||
} | |||
public DateTime FirePan1_Date; | |||
public DateTime FirePan2_Date; | |||
@@ -17,6 +17,8 @@ namespace BPASmartClient.MorkBF.Model | |||
/// </summary> | |||
public string FoodID { get; set; } | |||
public List<BF_PotAction> PotActions { get; set; } = new List<BF_PotAction>(); | |||
} | |||
public class BF_PotAction | |||
@@ -40,7 +42,7 @@ namespace BPASmartClient.MorkBF.Model | |||
/// <summary> | |||
/// 动作 | |||
/// </summary> | |||
public string Actions | |||
public PotAction Actions | |||
{ | |||
get; | |||
set; | |||
@@ -62,4 +64,32 @@ namespace BPASmartClient.MorkBF.Model | |||
set; | |||
} | |||
} | |||
public enum PotAction | |||
{ | |||
加热开启, | |||
加热关闭, | |||
搅拌开启, | |||
搅拌关闭, | |||
加调料, | |||
加菜品, | |||
加辅料, | |||
加热时间, | |||
抽油启动, | |||
抽水启动, | |||
出餐启动, | |||
炒锅回原点, | |||
炒制位置1, | |||
炒制位置2, | |||
炒制位置3, | |||
炒制位置4, | |||
炒锅去出餐倒料位置, | |||
炒锅去投料位置, | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using BPASmartClient.Model.大炒; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkBF.Model | |||
{ | |||
public class Global | |||
{ | |||
public static FryPotMessages GLoFryMessage { get; set; } = new FryPotMessages(); | |||
} | |||
} |
@@ -21,14 +21,40 @@ | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="40"/> | |||
<RowDefinition Height="2*"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<GroupBox Header="炒锅1" FontSize="22"> | |||
<WrapPanel Grid.Row="1" Orientation="Horizontal"> | |||
<Button Content="添加新菜品" Width="200" Click="Button_Click"/> | |||
<ListBox Grid.Row="1" ItemsSource="{Binding fryPotMessages}"> | |||
<ListBox.Template> | |||
<ControlTemplate TargetType="{x:Type ListBox}"> | |||
<WrapPanel Orientation="Horizontal" IsItemsHost="True"></WrapPanel> | |||
</ControlTemplate> | |||
</ListBox.Template> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Border Margin="5,10"> | |||
<Border.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/矩形.png"/> | |||
</Border.Background> | |||
<StackPanel Orientation="Horizontal" Margin="10"> | |||
<TextBlock Text="{Binding GoodName}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="10,0"/> | |||
<Button Content="编辑" Command="{Binding DataContext.MenuEditCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" | |||
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="10,0"/> | |||
<Button Content="删除 " Command="{Binding DataContext.MenuDeleteCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}" | |||
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="10,0"/> | |||
</StackPanel> | |||
</Border> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
<GroupBox Grid.Row="2" Header="炒锅1" FontSize="22"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/> | |||
<TextBlock Text="加热挡位" Margin="10,5"/> | |||
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}"/> | |||
@@ -57,7 +83,7 @@ | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Row="1" Header="炒锅2" FontSize="22"> | |||
<GroupBox Grid.Row="3" Header="炒锅2" FontSize="22"> | |||
<WrapPanel Grid.Row="1" Orientation="Horizontal"> | |||
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/> | |||
<TextBlock Text="加热挡位" Margin="10,5"/> | |||
@@ -86,7 +112,7 @@ | |||
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/> | |||
</WrapPanel> | |||
</GroupBox> | |||
<GroupBox Grid.Row="3" Header="机器人" FontSize="22"> | |||
<GroupBox Grid.Row="4" Header="机器人" FontSize="22"> | |||
<WrapPanel Orientation="Horizontal"> | |||
<Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/> | |||
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/> | |||
@@ -1,4 +1,5 @@ | |||
using System; | |||
using BPASmartClient.MorkBF.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -24,5 +25,12 @@ namespace BPASmartClient.MorkBF.VIew | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
Global.GLoFryMessage = null; | |||
FoodManagerView foodManagerView = new FoodManagerView(); | |||
foodManagerView.ShowDialog(); | |||
} | |||
} | |||
} |
@@ -4,47 +4,72 @@ | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.MorkBF.VIew" | |||
xmlns:con="clr-namespace:BPASmartClient.MorkBF.Convert" | |||
xmlns:vm ="clr-namespace:BPASmartClient.MorkBF.ViewModel" | |||
mc:Ignorable="d" | |||
Title="FoodManagerView" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> | |||
Title="FoodManagerView" Height="450" Width="1020" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent"> | |||
<Window.DataContext> | |||
<vm:FoodManagerViewModel/> | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
<con:StirToVisibilityConverter x:Key="StirToVisibilityConverter" /> | |||
<con:FirePositionToVisibilityConverter x:Key="FirePositionToVisibilityConverter" /> | |||
<con:AccessoriesToVisibilityConverter x:Key="AccessoriesToVisibilityConverter" /> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45"> | |||
<TextBlock Text="菜品名称:" Margin="10,0"/> | |||
<TextBox Text="{Binding FoodName}" Width="160" Margin="10,0" FontSize="16"/> | |||
<Button Content="添加新步骤" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" /> | |||
<Button Content="保存" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/> | |||
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/> | |||
</StackPanel> | |||
<Grid Grid.Row="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="2*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<ListBox > | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="*"/> | |||
<ColumnDefinition Width="*"/> | |||
</Grid.ColumnDefinitions> | |||
<ComboBox /> | |||
<Button Content="删除"/> | |||
</Grid> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
<Border CornerRadius="1,60,00,70" Background="#1E1E1E" > | |||
<Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown"> | |||
<Grid.Background> | |||
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/不规则矩形.png"/> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45"> | |||
<TextBlock Text="菜品名称:" Margin="10,0"/> | |||
<TextBox Text="{Binding GoodName}" Width="160" Margin="10,0" FontSize="16"/> | |||
<Button Content="添加新步骤" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Command="{Binding AddCommand}"/> | |||
<Button Content="保存" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80" Command="{Binding SaveCommand}"/> | |||
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80" Click="Button_Click"/> | |||
</StackPanel> | |||
<Grid Grid.Row="1"> | |||
<ListBox ItemsSource="{Binding FryPotProcesses}" FontSize="15"> | |||
<ListBox.ItemTemplate> | |||
<DataTemplate> | |||
<StackPanel Orientation="Horizontal" Margin="0,10"> | |||
<TextBlock Text="步骤--" Margin="10,0,2,0" VerticalAlignment="Center"/> | |||
<TextBlock Text="{Binding FryTime}" VerticalAlignment="Center"/> | |||
<TextBlock Text="加热时间--" Margin="10,0,2,0" VerticalAlignment="Center"/> | |||
<TextBox Text="{Binding FryDuration}" Margin="10,0" Width="40" VerticalAlignment="Center"/> | |||
<TextBlock Text="动作--" Margin="10,0,2,0" VerticalAlignment="Center"/> | |||
<ComboBox ItemsSource="{Binding DataContext.FryAction,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}" | |||
SelectedItem="{Binding fryActions}" Width="100" IsReadOnly="True" Margin="2,0,10,0"/> | |||
<TextBlock Text="加热挡位--" Margin="10,0,2,0" VerticalAlignment="Center"/> | |||
<ComboBox ItemsSource="{Binding DataContext.Gear,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}" | |||
SelectedItem="{Binding FryGear}" Width="50" Margin="2,0,10,0" /> | |||
<TextBlock Text="搅拌挡位--" Margin="10,0,2,0" VerticalAlignment="Center" | |||
Visibility="{Binding fryActions,Converter={StaticResource StirToVisibilityConverter}}"/> | |||
<ComboBox ItemsSource="{Binding DataContext.Gear,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}" SelectedItem="{Binding StirGear}" Width="50" Margin="2,0,10,0" | |||
Visibility="{Binding fryActions,Converter={StaticResource StirToVisibilityConverter}}"/> | |||
<TextBlock Text="炒制位置--" Margin="10,0,2,0" VerticalAlignment="Center" | |||
Visibility="{Binding fryActions,Converter={StaticResource FirePositionToVisibilityConverter}}"/> | |||
<ComboBox ItemsSource="{Binding DataContext.PotPostion,RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor} }" SelectedItem="{Binding FryPosition}" Width="50" Margin="2,0,10,0" | |||
Visibility="{Binding fryActions,Converter={StaticResource FirePositionToVisibilityConverter}}"/> | |||
<TextBlock Text="物料位置--" Margin="10,0,2,0" VerticalAlignment="Center" | |||
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | |||
<TextBox Text="{Binding accessories[0].Loc}" VerticalAlignment="Center" Width="50" | |||
Visibility="{Binding fryActions,Converter={StaticResource AccessoriesToVisibilityConverter}}"/> | |||
</StackPanel> | |||
</DataTemplate> | |||
</ListBox.ItemTemplate> | |||
</ListBox> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Border> | |||
</Window> |
@@ -1,4 +1,6 @@ | |||
using System; | |||
| |||
using BPASmartClient.Helper; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
@@ -22,6 +24,21 @@ namespace BPASmartClient.MorkBF.VIew | |||
public FoodManagerView() | |||
{ | |||
InitializeComponent(); | |||
ActionManage.GetInstance.CancelRegister("FoodManagerViewClose"); | |||
ActionManage.GetInstance.Register(new Action(()=> | |||
{ | |||
this.Close(); | |||
}), "FoodManagerViewClose"); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
ActionManage.GetInstance.Send("FoodManagerViewClose"); | |||
} | |||
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
this.DragMove(); | |||
} | |||
} | |||
} |
@@ -1,19 +1,50 @@ | |||
using System; | |||
global using CommunityToolkit.Mvvm.ComponentModel; | |||
global using CommunityToolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using CommunityToolkit.Mvvm.ComponentModel; | |||
using CommunityToolkit.Mvvm.Input; | |||
using BPASmartClient.Model.大炒; | |||
using BPASmartClient.MorkBF.Model; | |||
using BPASmartClient.MorkBF.VIew; | |||
namespace BPASmartClient.MorkBF.ViewModel | |||
{ | |||
[INotifyPropertyChanged] | |||
partial class DebugViewModel | |||
{ | |||
{ | |||
public ObservableCollection<FryPotMessages> fryPotMessages { get; set; } = Json<LocalFryPotMessage>.Data.FryPotMessage; | |||
[RelayCommand] | |||
private void MenuEdit(object o) | |||
{ | |||
if (o == null) return; | |||
if(o is FryPotMessages value) | |||
{ | |||
Global.GLoFryMessage = value; | |||
FoodManagerView foodManagerView = new FoodManagerView(); | |||
foodManagerView.ShowDialog(); | |||
} | |||
} | |||
[RelayCommand] | |||
private void MenuDelete(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is FryPotMessages value) | |||
{ | |||
fryPotMessages.Remove(value); | |||
} | |||
Json<LocalFryPotMessage>.Save(); | |||
} | |||
/// <summary> | |||
/// 加热挡位 | |||
/// </summary> | |||
@@ -369,5 +400,8 @@ namespace BPASmartClient.MorkBF.ViewModel | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Model.大炒; | |||
using BPASmartClient.MorkBF.Model; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.MorkBF.ViewModel | |||
{ | |||
[INotifyPropertyChanged] | |||
partial class FoodManagerViewModel | |||
{ | |||
/// <summary> | |||
/// 菜品步骤 | |||
/// </summary> | |||
public ObservableCollection<FryPotProcess> FryPotProcesses { get; set; } =new ObservableCollection<FryPotProcess>(); | |||
public ObservableCollection<FryAction> FryAction { get; set; } = new ObservableCollection<FryAction>(); | |||
public ObservableCollection<int> Gear { get; set; } = new ObservableCollection<int>() { 0,1, 2, 3, 4, 5 }; | |||
public ObservableCollection<int> PotPostion { get; set; } = new ObservableCollection<int>() { 1, 2,3, 4 }; | |||
[ObservableProperty] | |||
private string _goodName; | |||
[RelayCommand] | |||
private void Add() | |||
{ | |||
FryPotProcesses.Add(new FryPotProcess() { FryTime = FryPotProcesses.Count + 1 }); | |||
} | |||
[RelayCommand] | |||
private void Save() | |||
{ | |||
if (string.IsNullOrEmpty(GoodName)) return; | |||
if (Global.GLoFryMessage != null) | |||
{ | |||
var res = Json<LocalFryPotMessage>.Data.FryPotMessage.FirstOrDefault(p => p.GoodKey == Global.GLoFryMessage.GoodKey); | |||
if (res != null) | |||
{ | |||
res.GoodName = GoodName; | |||
res.fryPotProcesses = FryPotProcesses.ToList(); | |||
} | |||
} | |||
else | |||
{ | |||
if (Json<LocalFryPotMessage>.Data.FryPotMessage.FirstOrDefault(p => p.GoodName == _goodName) != null) return; | |||
Json<LocalFryPotMessage>.Data.FryPotMessage.Add(new FryPotMessages | |||
{ | |||
GoodName = GoodName, | |||
GoodKey = new Guid().ToString(), | |||
fryPotProcesses = FryPotProcesses.ToList() | |||
}); | |||
} | |||
Json<LocalFryPotMessage>.Save(); | |||
ActionManage.GetInstance.Send("FoodManagerViewClose"); | |||
} | |||
[RelayCommand] | |||
private void Delete(object o) | |||
{ | |||
if (o == null) return; | |||
if (o is FryPotProcess value) | |||
{ | |||
FryPotProcesses.Remove(value); | |||
} | |||
} | |||
public FoodManagerViewModel() | |||
{ | |||
foreach(var item in Enum.GetValues(typeof(FryAction))) | |||
{ | |||
FryAction.Add((FryAction)item); | |||
} | |||
if (Global.GLoFryMessage != null)//编辑 | |||
{ | |||
GoodName = Global.GLoFryMessage.GoodName; | |||
FryPotProcesses = new ObservableCollection<FryPotProcess>(Global.GLoFryMessage.fryPotProcesses); | |||
} | |||
} | |||
} | |||
} |
@@ -10,7 +10,7 @@ using System.Collections.ObjectModel; | |||
namespace BPASmartClient.MorkBF.ViewModel | |||
{ | |||
public class MonitorViewModel : ObservableObject | |||
public class MonitorViewModel | |||
{ | |||
public MonitorViewModel() | |||
{ | |||
@@ -17,6 +17,7 @@ namespace BPASmartClient.MorkF | |||
{ | |||
public class Control_MorkF : BaseDevice | |||
{ | |||
/// <summary> | |||
/// while循环最大sleep次数 | |||
/// </summary> | |||
@@ -70,7 +71,7 @@ namespace BPASmartClient.MorkF | |||
WriteControl("VD840", 0); | |||
Thread.Sleep(400); | |||
WriteControl("M0.0", true); | |||
IsHealth = true; | |||
for (int i = 0;i< count;i++) | |||
{ | |||
morkFs.Add(i, new GVL_MorkF()); | |||
@@ -936,7 +937,7 @@ namespace BPASmartClient.MorkF | |||
OrderCount++; | |||
DeviceProcessLogShow($"接收到{OrderCount}次订单"); | |||
Enum.GetNames(typeof(StirFryPotActionEnum)); | |||
var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.RecipeId);//匹配订单对应制作流程 | |||
if (res != null) | |||
{ | |||
@@ -12,14 +12,14 @@ | |||
<add key ="Namespaces" value="DEV.test1.Config"/>--> | |||
<!--开发环境--> | |||
<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/> | |||
<add key="AppId" value="HostComputer"/> | |||
<add key ="Namespaces" value="DEV.Config"/> | |||
<add key ="Namespaces" value="DEV.Config"/>--> | |||
<!--正式环境--> | |||
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="apollouri" value="http://47.108.65.220:28080/"/> | |||
<add key="appid" value="hostcomputer"/> | |||
<add key ="namespaces" value="test1.config"/>--> | |||
<add key ="namespaces" value="test1.config"/> | |||
<!--阿里云上报启动方式:API 或者 LOCAL--> | |||
<!--API :通过客户端ID,调用接口查询“设备连接信息”--> | |||