Browse Source

morkBF

样式分支
NXX 2 years ago
parent
commit
22227d32e2
11 changed files with 348 additions and 126 deletions
  1. +2
    -1
      BPASmartClient.Helper/ActionManage.cs
  2. +1
    -0
      BPASmartClient.Model/大炒/FryPotMessages.cs
  3. +135
    -74
      BPASmartClient.MorkBF/Control_MorkBF.cs
  4. +9
    -0
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  5. +11
    -13
      BPASmartClient.MorkBF/VIew/DebugView.xaml
  6. +7
    -0
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml
  7. +68
    -0
      BPASmartClient.MorkBF/VIew/MenuView.xaml
  8. +36
    -0
      BPASmartClient.MorkBF/VIew/MenuView.xaml.cs
  9. +13
    -35
      BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs
  10. +4
    -3
      BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs
  11. +62
    -0
      BPASmartClient.MorkBF/ViewModel/MenuViewModel.cs

+ 2
- 1
BPASmartClient.Helper/ActionManage.cs View File

@@ -44,7 +44,8 @@ namespace BPASmartClient.Helper
public void Send(string key, object par, Action Callback = null) public void Send(string key, object par, Action Callback = null)
{ {
lock (SendLock) lock (SendLock)
if (actions.ContainsKey(key)) actions[key].ActionPar.Invoke(par, Callback);
if (actions.ContainsKey(key))
actions[key].ActionPar.Invoke(par, Callback);
} }


public async void SendAsync(string key, object par, Action Callback = null) public async void SendAsync(string key, object par, Action Callback = null)


+ 1
- 0
BPASmartClient.Model/大炒/FryPotMessages.cs View File

@@ -11,6 +11,7 @@ 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;//关火翻炒时间;
} }


public class FryPotProcess public class FryPotProcess


+ 135
- 74
BPASmartClient.MorkBF/Control_MorkBF.cs View File

@@ -1,10 +1,10 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message;
using BPA.Message.Enum; using BPA.Message.Enum;
using BPASmartClient.Business; using BPASmartClient.Business;
using BPASmartClient.Device; using BPASmartClient.Device;
using BPASmartClient.EventBus; using BPASmartClient.EventBus;
using BPASmartClient.Helper; using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model; using BPASmartClient.Model;
using BPASmartClient.Model.大炒; using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model; using BPASmartClient.MorkBF.Model;
@@ -17,8 +17,6 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus; using static BPASmartClient.EventBus.EventBus;
using static BPASmartClient.Model.大炒.FryPotMessages; using static BPASmartClient.Model.大炒.FryPotMessages;
using ActionManage = BPA.Helper.ActionManage;
using ThreadManage = BPA.Helper.ThreadManage;


namespace BPASmartClient.MorkBF namespace BPASmartClient.MorkBF
{ {
@@ -28,15 +26,30 @@ namespace BPASmartClient.MorkBF


public override DeviceClientType DeviceType => DeviceClientType.MORKCS; public override DeviceClientType DeviceType => DeviceClientType.MORKCS;


int RobotLeadTime = 5;//机器人提前动作时间 s

public override void DoMain() public override void DoMain()
{ {
IsHealth = true; IsHealth = true;
BPASmartClient.Helper.Json<LocalFryPotMessage>.Read(); BPASmartClient.Helper.Json<LocalFryPotMessage>.Read();
MonitorViewModel.DeviceId = DeviceId; MonitorViewModel.DeviceId = DeviceId;
ActionManage.GetInstance.Register(new Action(() =>
{
GlobalFoodMenu.LocalFoodMenus.Clear();
if(BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage.Count>0)
{
foreach (var item in BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage)
{
GlobalFoodMenu.LocalFoodMenus.Add(new FoodMenuModel { GoodKey = item.GoodKey, GoodName = item.GoodName });
}
}
}), "更新菜单");
CommandRegist();//调试 CommandRegist();//调试
ServerInit(); ServerInit();
DataParse();//数据解析 DataParse();//数据解析
ScreenDataServer();//大屏数据上报 ScreenDataServer();//大屏数据上报
ActionManage.GetInstance.Send("更新菜单");
DeviceProcessLogShow("MORKF 设备初始化完成"); DeviceProcessLogShow("MORKF 设备初始化完成");
} }


@@ -109,7 +122,7 @@ namespace BPASmartClient.MorkBF
ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2 ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2
ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3 ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3
ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4 ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4
ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPositiong, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
//ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPosition, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置 ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动 ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗 ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
@@ -156,27 +169,33 @@ namespace BPASmartClient.MorkBF
if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result)) if(morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
{ {

morkBF.FirePan1_Busy = true; morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses) foreach (var item in result.fryPotProcesses)
{ {
switch (item.fryActions) switch (item.fryActions)
{ {
case FryAction.冷锅加热: case FryAction.冷锅加热:
FirePot_PotPerHeat(item, 1); FirePot_PotPerHeat(item, 1);
MessageLog.GetInstance.Show("炒锅1---冷锅加热完成");
break; break;


case FryAction.热油: case FryAction.热油:
FirePot_HeatOil(item,1); FirePot_HeatOil(item,1);
MessageLog.GetInstance.Show("炒锅1---热油完成");
break; break;

case FryAction.加调料: case FryAction.加调料:
FirePot_AddSeasoning(item, 1); FirePot_AddSeasoning(item, 1);
MessageLog.GetInstance.Show("炒锅1---加调料完成");
break; break;
case FryAction.加辅料: case FryAction.加辅料:
FirePot_AddAccessories(item,1);
MessageLog.GetInstance.Show("炒锅1---加辅料完成");
break; break;
case FryAction.炒制菜品: case FryAction.炒制菜品:
FirePot_FryFood(item,1); FirePot_FryFood(item,1);
MessageLog.GetInstance.Show("炒锅1---炒制菜品完成");
break; break;


default: default:
@@ -194,24 +213,45 @@ namespace BPASmartClient.MorkBF




#region 炒锅流程功能 #region 炒锅流程功能

private bool IsRobotNextWork(List<FryPotProcess> currentProcess, int currentFryTime)
{
bool res = false;
if(currentProcess.Count> currentFryTime)
{
if (currentProcess[currentFryTime + 1].fryActions == FryAction.加调料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.加辅料 ||
currentProcess[currentFryTime + 1].fryActions == FryAction.炒制菜品)
{
res = true;
}
}
return res;
}

/// <summary> /// <summary>
/// 冷锅预热 /// 冷锅预热
/// </summary> /// </summary>
private void FirePot_PotPerHeat(FryPotProcess item,int i) private void FirePot_PotPerHeat(FryPotProcess item,int i)
{ {
bool isRobotWork = false;
if(i == 1)//炒锅1 if(i == 1)//炒锅1
{ {
FirePot1_SetFireGear(item.FryGear); FirePot1_SetFireGear(item.FryGear);
Thread.Sleep(200);
FirePot1_StartFire(true); FirePot1_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess,item.FryTime);
} }
else if(i == 2)//炒锅2 else if(i == 2)//炒锅2
{ {
FirePot2_SetFireGear(item.FryGear); FirePot2_SetFireGear(item.FryGear);
FirePot2_StartFire(true); FirePot2_StartFire(true);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
} }
Thread.Sleep(item.FryDuration);
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);


} }


/// <summary> /// <summary>
@@ -219,17 +259,21 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void FirePot_HeatOil(FryPotProcess item, int i) private void FirePot_HeatOil(FryPotProcess item, int i)
{ {
bool isRobotWork = false;
if (item.FryGear != 0) if (item.FryGear != 0)
{ {
FirePot1_SetFireGear(item.FryGear);//设定加热挡位 FirePot1_SetFireGear(item.FryGear);//设定加热挡位
FirePot1_StartFire(true);//开启加热 FirePot1_StartFire(true);//开启加热
isRobotWork = IsRobotNextWork(morkBF.FryPot1_CurrentProcess, item.FryTime);
} }
if (item.StirGear != 0) if (item.StirGear != 0)
{ {
FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位 FirePot1_SetStirGear(item.StirGear);//设定搅拌挡位
FirePot1_StartFire(true);//开启搅拌 FirePot1_StartFire(true);//开启搅拌
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
} }
Thread.Sleep(item.FryDuration);//加热时间;
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
} }


/// <summary> /// <summary>
@@ -237,6 +281,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void FirePot_AddSeasoning(FryPotProcess item,int i) private void FirePot_AddSeasoning(FryPotProcess item,int i)
{ {

if(i == 1) if(i == 1)
{ {
@@ -260,7 +305,7 @@ namespace BPASmartClient.MorkBF
{ {
if (i == 1) if (i == 1)
{ {
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 }); morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = RobotActionModel.取1号炒锅辅料盆1倒入1号炒锅 });
Thread.Sleep(item.FryDuration); Thread.Sleep(item.FryDuration);


@@ -279,6 +324,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void FirePot_FryFood(FryPotProcess item, int i) private void FirePot_FryFood(FryPotProcess item, int i)
{ {
bool isRobotWork = false;
if (i == 1) if (i == 1)
{ {
morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc }); morkBF.RobotActinQueue.Enqueue(new RobotAction_Pot { Pot = 1, robotActionModel = (RobotActionModel)item.accessories[0].Loc });
@@ -286,7 +332,8 @@ namespace BPASmartClient.MorkBF
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
Thread.Sleep(item.FryDuration);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);


} }


@@ -297,8 +344,11 @@ namespace BPASmartClient.MorkBF
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
Thread.Sleep(item.FryDuration);
isRobotWork = IsRobotNextWork(morkBF.FryPot2_CurrentProcess, item.FryTime);
} }
if (isRobotWork && item.FryDuration > RobotLeadTime) Thread.Sleep((item.FryDuration - RobotLeadTime) * 1000);//提前10秒机器人去取物料
else Thread.Sleep(item.FryDuration * 1000);//加热时间;
} }
#endregion #endregion


@@ -317,27 +367,28 @@ namespace BPASmartClient.MorkBF
{ {
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
{ {
Robot_Write("GM521", true);//炒锅去投料位置
Robot_Write("GM520", true);//机器人去出餐倒料减速位置
while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜 while(!morkBF.Robot_ArriveFirePot1)//机器人到位,请求1#炒锅倒菜
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
FirePot_Write("M11.6", true);//炒锅去出餐倒料位置
FirePot_StartOutFood(1);//炒锅出餐;
while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 while (!morkBF.FirePot1_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
} }
Thread.Sleep(20 * 1000);//等待20s出餐
Thread.Sleep(6 * 1000);//等待6s出餐
Robot_Write("GM521", true);//机器人出餐到料完成


} }
else else
{ {
FirePot_Write("M11.7", true);//炒锅去投料位置
FirePot_Write("M11.6", true);//炒锅去投料位置
while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料 while (!morkBF.FirePot1_PotOnIntoFoodPosition)//等待炒锅允许倒料
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
Robot_Write("GM520", true);//机器人投料
Robot_Write("GM531", true);//机器人投料
} }
} }
@@ -345,17 +396,18 @@ namespace BPASmartClient.MorkBF
{ {
if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐) if (robotAction.robotActionModel == RobotActionModel.取1号空盆出餐)
{ {
Robot_Write("GM531", true);//炒锅去投料位置
Robot_Write("GM522", true);//炒锅去出餐倒料减速位置
while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜 while (!morkBF.Robot_ArriveFirePot2)//机器人到位,请求1#炒锅倒菜
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
FirePot_Write("M16.6", true);//炒锅去出餐倒料位置
FirePot_StartOutFood(2);//炒锅去出餐倒料位置
while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈 while (!morkBF.FirePot2_PotOnOutFoodPosition)//炒锅在出餐倒料位置反馈
{ {
Thread.Sleep(1000); Thread.Sleep(1000);
} }
Thread.Sleep(20 * 1000);//等待20s出餐
Thread.Sleep(6 * 1000);//等待20s出餐
Robot_Write("GM523", true);//机器人出餐倒料完成


} }
else else
@@ -365,7 +417,7 @@ namespace BPASmartClient.MorkBF
{ {
Thread.Sleep(100); Thread.Sleep(100);
} }
Robot_Write("GM530", true);
Robot_Write("GM531", true);
} }
} }
@@ -550,9 +602,9 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetFireGear(object o) private void FirePot1_SetFireGear(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{ {
FirePot_Write("VW100", value);
FirePot_Write("VW100", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
} }
@@ -563,11 +615,12 @@ namespace BPASmartClient.MorkBF
private void FirePot1_StartFire(object o) private void FirePot1_StartFire(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is bool value)
if (bool.TryParse(o.ToString(), out bool value))
{ {
FirePot_Write("M10.0", value); FirePot_Write("M10.0", value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M10.2", true);
} }
/// <summary> /// <summary>
/// 炒锅1设置搅拌挡位 /// 炒锅1设置搅拌挡位
@@ -576,11 +629,12 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetStirGear(object o) private void FirePot1_SetStirGear(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{ {
FirePot_Write("VW102", value);
FirePot_Write("VW102", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M10.3", true);
} }
/// <summary> /// <summary>
/// 炒锅1搅拌启停 /// 炒锅1搅拌启停
@@ -589,7 +643,7 @@ namespace BPASmartClient.MorkBF
private void FirePot1_StartStir(object o) private void FirePot1_StartStir(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is bool value)
if (bool.TryParse(o.ToString(), out bool value))
{ {
FirePot_Write("M10.1", value); FirePot_Write("M10.1", value);
} }
@@ -602,11 +656,13 @@ namespace BPASmartClient.MorkBF
private void FirePot1_SetTurnSpeed(object o) private void FirePot1_SetTurnSpeed(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{ {
FirePot_Write("VW104", value);
FirePot_Write("VW104", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M10.4", true);
Thread.Sleep(200);
} }
#endregion #endregion


@@ -618,11 +674,12 @@ namespace BPASmartClient.MorkBF
private void FirePot2_SetFireGear(object o) private void FirePot2_SetFireGear(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int value)
if (int.TryParse(o.ToString(), out int value))
{ {
FirePot_Write("VW130", value);
FirePot_Write("VW130", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M15.2", true);
} }
/// <summary> /// <summary>
/// 炒锅2加热启停 /// 炒锅2加热启停
@@ -646,9 +703,11 @@ namespace BPASmartClient.MorkBF
if (o == null) return; if (o == null) return;
if (o is int value) if (o is int value)
{ {
FirePot_Write("VW132", value);
FirePot_Write("VW132", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M15.3", true);
Thread.Sleep(200);
} }
/// <summary> /// <summary>
/// 炒锅2搅拌启停 /// 炒锅2搅拌启停
@@ -672,9 +731,11 @@ namespace BPASmartClient.MorkBF
if (o == null) return; if (o == null) return;
if (o is int value) if (o is int value)
{ {
FirePot_Write("VW134", value);
FirePot_Write("VW134", (ushort)value);
} }
Thread.Sleep(200); Thread.Sleep(200);
FirePot_Write("M15.4", true);
Thread.Sleep(200);
} }


#endregion #endregion
@@ -687,7 +748,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_Reset(object o) private void FirePot_Reset(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -708,7 +769,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoOrigin(object o) private void FirePot_PotGotoOrigin(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -728,7 +789,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP1(object o) private void FirePot_PotGotoP1(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -748,7 +809,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP2(object o) private void FirePot_PotGotoP2(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -768,7 +829,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP3(object o) private void FirePot_PotGotoP3(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -788,7 +849,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoP4(object o) private void FirePot_PotGotoP4(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -801,26 +862,26 @@ namespace BPASmartClient.MorkBF
} }
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary>
/// 炒锅去出餐位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOutFoodPositiong(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.6", true);
}
else if (i == 2)
{
FirePot_Write("M16.6", true);
}
}
Thread.Sleep(200);
}
///// <summary>
///// 炒锅去出餐位置
///// </summary>
///// <param name="o"></param>
//private void FirePot_PotGotoOutFoodPositiong(object o)
//{
// if (o == null) return;
// if (o is int i)
// {
// if (i == 1)
// {
// FirePot_Write("M11.6", true);
// }
// else if (i == 2)
// {
// FirePot_Write("M16.6", true);
// }
// }
// Thread.Sleep(200);
//}
/// <summary> /// <summary>
/// 炒锅去投料位置 /// 炒锅去投料位置
/// </summary> /// </summary>
@@ -828,15 +889,15 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotGotoInFoodPosition(object o) private void FirePot_PotGotoInFoodPosition(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString() ,out int i))
{ {
if (i == 1) if (i == 1)
{ {
FirePot_Write("M11.7", true);
FirePot_Write("M11.6", true);
} }
else if (i == 2) else if (i == 2)
{ {
FirePot_Write("M16.7", true);
FirePot_Write("M16.6", true);
} }
} }
Thread.Sleep(200); Thread.Sleep(200);
@@ -848,7 +909,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartOutFood(object o) private void FirePot_StartOutFood(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -869,7 +930,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_Clean(object o) private void FirePot_Clean(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -890,7 +951,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartPumpWater(object o) private void FirePot_StartPumpWater(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -910,7 +971,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_StartPumpOil(object o) private void FirePot_StartPumpOil(object o)
{ {
if (o == null) return; if (o == null) return;
if (o is int i)
if (int.TryParse(o.ToString(), out int i))
{ {
if (i == 1) if (i == 1)
{ {
@@ -963,7 +1024,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void Robot_Pot1AllowInMaterail() private void Robot_Pot1AllowInMaterail()
{ {
Robot_Write("GM520", true);
Robot_Write("GM531", true);
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary> /// <summary>
@@ -971,7 +1032,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void Robot_Pot1OutFoodInSlowDown() private void Robot_Pot1OutFoodInSlowDown()
{ {
Robot_Write("GM621", true);
Robot_Write("GM620", true);
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary> /// <summary>
@@ -979,7 +1040,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void Robot_Pot1OutFood() private void Robot_Pot1OutFood()
{ {
Robot_Write("GM522", true);
Robot_Write("GM521", true);
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary> /// <summary>
@@ -995,7 +1056,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void Robot_Pot2OutFoodInSlowDown() private void Robot_Pot2OutFoodInSlowDown()
{ {
Robot_Write("GM531", true);
Robot_Write("GM522", true);
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary> /// <summary>
@@ -1003,7 +1064,7 @@ namespace BPASmartClient.MorkBF
/// </summary> /// </summary>
private void Robot_Pot2OutFood() private void Robot_Pot2OutFood()
{ {
Robot_Write("GM532", true);
Robot_Write("GM523", true);
Thread.Sleep(200); Thread.Sleep(200);
} }
/// <summary> /// <summary>
@@ -1012,7 +1073,7 @@ namespace BPASmartClient.MorkBF
private void RobotActionStart(object o) private void RobotActionStart(object o)
{ {
if (o == null) return; if (o == null) return;
if(o is int value)
if(int.TryParse(o.ToString(), out int value))
{ {
Robot_Write("GI0",value); Robot_Write("GI0",value);
} }


+ 9
- 0
BPASmartClient.MorkBF/GVL_MorkBF.cs View File

@@ -32,6 +32,15 @@ namespace BPASmartClient.MorkBF
/// 炒锅2忙碌 /// 炒锅2忙碌
/// </summary> /// </summary>
public bool FirePan2_Busy = false; public bool FirePan2_Busy = false;
/// <summary>
/// 炒锅1当前流程
/// </summary>
public List<FryPotProcess> FryPot1_CurrentProcess;
/// <summary>
/// 炒锅2当前流程
/// </summary>
public List<FryPotProcess> FryPot2_CurrentProcess;



#region 炒锅1读取数据 #region 炒锅1读取数据
/// <summary> /// <summary>


+ 11
- 13
BPASmartClient.MorkBF/VIew/DebugView.xaml View File

@@ -21,13 +21,11 @@
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Button Content="添加新菜品" Width="200" Click="Button_Click"/>
<!--<Button Content="添加新菜品" Width="200" Click="Button_Click"/>
<ListBox Grid.Row="1" ItemsSource="{Binding fryPotMessages}"> <ListBox Grid.Row="1" ItemsSource="{Binding fryPotMessages}">
<ListBox.Template> <ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}"> <ControlTemplate TargetType="{x:Type ListBox}">
@@ -51,18 +49,18 @@
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox>
</ListBox>-->
<GroupBox Grid.Row="2" Header="炒锅1" FontSize="22">
<GroupBox Grid.Row="0" Header="炒锅1" FontSize="22">
<WrapPanel Orientation="Horizontal"> <WrapPanel Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/> <Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/> <TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetFireGearCommand}"/> <Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartFireCommand}"/> <Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopFireCommand}"/> <Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/> <TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetStirGearCommand}"/> <Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartStirCommand}"/> <Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopStirCommand}"/> <Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopStirCommand}"/>
@@ -83,16 +81,16 @@
</WrapPanel> </WrapPanel>


</GroupBox> </GroupBox>
<GroupBox Grid.Row="3" Header="炒锅2" FontSize="22">
<GroupBox Grid.Row="1" Header="炒锅2" FontSize="22">
<WrapPanel Grid.Row="1" Orientation="Horizontal"> <WrapPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/> <Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/> <TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}" SelectedIndex="0" />
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetFireGearCommand}"/> <Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartFireCommand}"/> <Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopFireCommand}"/> <Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/> <TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5" SelectedIndex="0" />
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetStirGearCommand}"/> <Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartStirCommand}"/> <Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopStirCommand}"/> <Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopStirCommand}"/>
@@ -112,14 +110,14 @@
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/> <Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/>
</WrapPanel> </WrapPanel>
</GroupBox> </GroupBox>
<GroupBox Grid.Row="4" Header="机器人" FontSize="22">
<GroupBox Grid.Row="2" Header="机器人" FontSize="22">
<WrapPanel Orientation="Horizontal"> <WrapPanel Orientation="Horizontal">
<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="机器人停止" Width="110" Margin="10,5" Command="{Binding RobotStopCommand}"/>
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}"/>
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}"/>
<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="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_Pot2AllowInMaterailCommand}"/>
<Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/> <Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/>


+ 7
- 0
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml View File

@@ -30,6 +30,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="50"/> <RowDefinition Height="50"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45">
<TextBlock Text="菜品名称:" Margin="10,0"/> <TextBlock Text="菜品名称:" Margin="10,0"/>
@@ -70,6 +71,12 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
</Grid> </Grid>
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="70,0" >
<TextBlock Text="关火搅拌时间" Margin="10,0"/>
<TextBox Text="{Binding FryOffStirTime}" Width="60"/>
<TextBlock Text="秒" Margin="10"/>
</StackPanel>
</Grid> </Grid>
</Border> </Border>
</Window> </Window>

+ 68
- 0
BPASmartClient.MorkBF/VIew/MenuView.xaml View File

@@ -0,0 +1,68 @@
<UserControl x:Class="BPASmartClient.MorkBF.VIew.MenuView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkBF.VIew"
xmlns:vm="clr-namespace:BPASmartClient.MorkBF.ViewModel"
x:Name="菜单"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:MenuViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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>
<Grid Margin="0,5,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<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>
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Grid.Row="1" Content="下单_炒锅1" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DataContext.FryPot1_StartOrderCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="5,5"/>
<Button Grid.Row="1" Content="下单_炒锅2" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center"
Command="{Binding DataContext.FryPot2_StartOrderCommand, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext , RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}" Margin="5,5"/>
</StackPanel>
</Grid>
</Border>

</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</UserControl>

+ 36
- 0
BPASmartClient.MorkBF/VIew/MenuView.xaml.cs View File

@@ -0,0 +1,36 @@
using BPASmartClient.MorkBF.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.MorkBF.VIew
{
/// <summary>
/// MenuView.xaml 的交互逻辑
/// </summary>
public partial class MenuView : UserControl
{
public MenuView()
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
Global.GLoFryMessage = null;
FoodManagerView foodManagerView = new FoodManagerView();
foodManagerView.ShowDialog();
}
}
}

+ 13
- 35
BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs View File

@@ -17,30 +17,7 @@ namespace BPASmartClient.MorkBF.ViewModel
partial class DebugViewModel 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();
}






@@ -55,13 +32,13 @@ namespace BPASmartClient.MorkBF.ViewModel
public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 }; public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };


[ObservableProperty] [ObservableProperty]
private int _firePot1_FireGear = 0;
private int _firePot1_FireGear = 1;
[ObservableProperty] [ObservableProperty]
private int _firePot2_FireGear = 0;
private int _firePot2_FireGear = 1;
[ObservableProperty] [ObservableProperty]
private int _firePot1_StirGear = 0;
private int _firePot1_StirGear = 1;
[ObservableProperty] [ObservableProperty]
private int _firePot2_StirGear = 0;
private int _firePot2_StirGear = 1;
[ObservableProperty] [ObservableProperty]
private int _firePot1_TurnSpeed; private int _firePot1_TurnSpeed;
[ObservableProperty] [ObservableProperty]
@@ -74,7 +51,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot1_SetFireGear() private void FirePot1_SetFireGear()
{ {
ActionManage.GetInstance.Send("FirePot1_SetFireGear",new List<int> { FirePot1_FireGear});
ActionManage.GetInstance.Send("FirePot1_SetFireGear", FirePot1_FireGear);
} }
/// <summary> /// <summary>
/// 加热启动 /// 加热启动
@@ -98,7 +75,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot1_SetStirGear() private void FirePot1_SetStirGear()
{ {
ActionManage.GetInstance.Send("FirePot1_SetStirGear",new List<int> { FirePot1_StirGear});
ActionManage.GetInstance.Send("FirePot1_SetStirGear", FirePot1_StirGear);
} }
/// <summary> /// <summary>
/// 搅拌启动 /// 搅拌启动
@@ -123,7 +100,7 @@ namespace BPASmartClient.MorkBF.ViewModel
private void FirePot1_SetTurnSpeed() private void FirePot1_SetTurnSpeed()
{ {
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800; if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed",new List<int> { FirePot1_TurnSpeed});
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed", FirePot1_TurnSpeed);
} }
#endregion #endregion


@@ -134,7 +111,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot2_SetFireGear() private void FirePot2_SetFireGear()
{ {
ActionManage.GetInstance.Send("FirePot2_SetFireGear", new List<int> { FirePot2_FireGear });
ActionManage.GetInstance.Send("FirePot2_SetFireGear", FirePot2_FireGear );
} }
/// <summary> /// <summary>
/// 加热启动 /// 加热启动
@@ -158,7 +135,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot2_SetStirGear() private void FirePot2_SetStirGear()
{ {
ActionManage.GetInstance.Send("FirePot2_SetStirGear", new List<int> { FirePot2_StirGear });
ActionManage.GetInstance.Send("FirePot2_SetStirGear", FirePot2_StirGear);
} }
/// <summary> /// <summary>
/// 搅拌启动 /// 搅拌启动
@@ -174,7 +151,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot2_StopStir() private void FirePot2_StopStir()
{ {
ActionManage.GetInstance.Send("FirePot1_StopStir", false);
ActionManage.GetInstance.Send("FirePot2_StopStir", false);
} }
/// <summary> /// <summary>
/// 翻转频率设定 /// 翻转频率设定
@@ -183,7 +160,7 @@ namespace BPASmartClient.MorkBF.ViewModel
private void FirePot2_SetTurnSpeed() private void FirePot2_SetTurnSpeed()
{ {
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800; if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", new List<int> { FirePot2_TurnSpeed });
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", FirePot2_TurnSpeed );
} }
#endregion #endregion


@@ -250,6 +227,7 @@ namespace BPASmartClient.MorkBF.ViewModel
[RelayCommand] [RelayCommand]
private void FirePot_PotGotoInFoodPosition(object o) private void FirePot_PotGotoInFoodPosition(object o)
{ {
ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o); ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o);
} }
/// <summary> /// <summary>


+ 4
- 3
BPASmartClient.MorkBF/ViewModel/FoodManagerViewModel.cs View File

@@ -16,7 +16,7 @@ namespace BPASmartClient.MorkBF.ViewModel
/// <summary> /// <summary>
/// 菜品步骤 /// 菜品步骤
/// </summary> /// </summary>
public ObservableCollection<FryPotProcess> FryPotProcesses { get; set; } =new ObservableCollection<FryPotProcess>();
public ObservableCollection<FryPotProcess> FryPotProcesses { get; set; } = new ObservableCollection<FryPotProcess>();


public ObservableCollection<FryAction> FryAction { get; set; } = new ObservableCollection<FryAction>(); public ObservableCollection<FryAction> FryAction { get; set; } = new ObservableCollection<FryAction>();


@@ -59,6 +59,7 @@ namespace BPASmartClient.MorkBF.ViewModel
}); });
} }
Json<LocalFryPotMessage>.Save(); Json<LocalFryPotMessage>.Save();
ActionManage.GetInstance.Send("更新菜单");
ActionManage.GetInstance.Send("FoodManagerViewClose"); ActionManage.GetInstance.Send("FoodManagerViewClose");
} }


@@ -70,7 +71,8 @@ namespace BPASmartClient.MorkBF.ViewModel
{ {
FryPotProcesses.Remove(value); FryPotProcesses.Remove(value);
} }
ActionManage.GetInstance.Send("更新菜单");

} }




@@ -87,7 +89,6 @@ namespace BPASmartClient.MorkBF.ViewModel
GoodName = Global.GLoFryMessage.GoodName; GoodName = Global.GLoFryMessage.GoodName;
FryPotProcesses = new ObservableCollection<FryPotProcess>(Global.GLoFryMessage.fryPotProcesses); FryPotProcesses = new ObservableCollection<FryPotProcess>(Global.GLoFryMessage.fryPotProcesses);
} }
} }
} }
} }

+ 62
- 0
BPASmartClient.MorkBF/ViewModel/MenuViewModel.cs View File

@@ -0,0 +1,62 @@
using BPASmartClient.Helper;
using BPASmartClient.Model.大炒;
using BPASmartClient.MorkBF.Model;
using BPASmartClient.MorkBF.VIew;
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 MenuViewModel
{
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();
}
[RelayCommand]
private void FryPot1_StartOrder(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
ActionManage.GetInstance.Send("FryPot1StartLocalOrder", value.fryPotProcesses);
}
}

[RelayCommand]
private void FryPot2_StartOrder(object o)
{
if (o == null) return;
if (o is FryPotMessages value)
{
ActionManage.GetInstance.Send("FryPot2StartLocalOrder", value.fryPotProcesses);
}
}
}
}

Loading…
Cancel
Save