|
@@ -12,6 +12,7 @@ using BPASmartClient.Model.小炒机; |
|
|
using BPASmartClient.MorkF.Model; |
|
|
using BPASmartClient.MorkF.Model; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
using System.Collections.Concurrent; |
|
|
using System.Collections.Concurrent; |
|
|
|
|
|
using System.Windows.Documents; |
|
|
|
|
|
|
|
|
namespace BPASmartClient.MorkF |
|
|
namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
@@ -80,6 +81,11 @@ namespace BPASmartClient.MorkF |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
private OrderLocInfo nowStirFryGood = null; |
|
|
private OrderLocInfo nowStirFryGood = null; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 待取菜队列 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private ConcurrentQueue<MaterialOperation> materialOperationQuenes = new ConcurrentQueue<MaterialOperation>(); |
|
|
|
|
|
|
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
List<int> resultorder = new List<int>();//调试变量 |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
@@ -102,6 +108,8 @@ namespace BPASmartClient.MorkF |
|
|
CommandRegist();//调试 |
|
|
CommandRegist();//调试 |
|
|
ServerInit(); |
|
|
ServerInit(); |
|
|
DeviceProcessLogShow("MORKF 设备初始化完成"); |
|
|
DeviceProcessLogShow("MORKF 设备初始化完成"); |
|
|
|
|
|
///初始化菜品库 |
|
|
|
|
|
FoodLibInit(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
@@ -681,9 +689,21 @@ namespace BPASmartClient.MorkF |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 菜品库初始化 |
|
|
/// 菜品库初始化 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
public void FoodLibInit() |
|
|
|
|
|
|
|
|
public bool FoodLibInit() |
|
|
{ |
|
|
{ |
|
|
MaterailLibrary_Write("M0.2", true); |
|
|
MaterailLibrary_Write("M0.2", true); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < sleepCount && !ml_morkf.InitialComplete; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
Thread.Sleep(sleepTime); |
|
|
|
|
|
if (i >= sleepCount - 1) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageLog.GetInstance.Show("菜品库初始化超时"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
} |
|
|
} |
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 电磁阀启停 |
|
|
/// 电磁阀启停 |
|
@@ -691,6 +711,11 @@ namespace BPASmartClient.MorkF |
|
|
/// <param name="o">电磁阀启停:true:启动。false:停止。</param> |
|
|
/// <param name="o">电磁阀启停:true:启动。false:停止。</param> |
|
|
public void Electromagnetism(object o) |
|
|
public void Electromagnetism(object o) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!ml_morkf.InitialComplete) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (o == null) return; |
|
|
if (o == null) return; |
|
|
if (o is List<bool> bs && bs.Count == 1) |
|
|
if (o is List<bool> bs && bs.Count == 1) |
|
|
{ |
|
|
{ |
|
@@ -699,6 +724,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
public bool GetDistance_1() |
|
|
public bool GetDistance_1() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!ml_morkf.InitialComplete) |
|
|
|
|
|
{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到1号位"); |
|
|
MessageLog.GetInstance.Show("爪子去到1号位"); |
|
|
MaterailLibrary_Write("M1.0", true); |
|
|
MaterailLibrary_Write("M1.0", true); |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortOne; i++) |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortOne; i++) |
|
@@ -718,6 +748,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
public bool GetDistance_2() |
|
|
public bool GetDistance_2() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!ml_morkf.InitialComplete) |
|
|
|
|
|
{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到2号位"); |
|
|
MessageLog.GetInstance.Show("爪子去到2号位"); |
|
|
MaterailLibrary_Write("M1.1", true); |
|
|
MaterailLibrary_Write("M1.1", true); |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortTwo; i++) |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortTwo; i++) |
|
@@ -737,6 +772,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
public bool GetDistance_3() |
|
|
public bool GetDistance_3() |
|
|
{ |
|
|
{ |
|
|
|
|
|
if (!ml_morkf.InitialComplete) |
|
|
|
|
|
{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到3号位"); |
|
|
MessageLog.GetInstance.Show("爪子去到3号位"); |
|
|
MaterailLibrary_Write("M1.2", true); |
|
|
MaterailLibrary_Write("M1.2", true); |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortThree; i++) |
|
|
for (int i = 0; i < sleepCount && !ml_morkf.PawArrivePortThree; i++) |
|
@@ -770,6 +810,11 @@ namespace BPASmartClient.MorkF |
|
|
/// <param name="y"></param> |
|
|
/// <param name="y"></param> |
|
|
public bool SetArmPosition(int x, int y) |
|
|
public bool SetArmPosition(int x, int y) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if(!ml_morkf.InitialComplete) |
|
|
|
|
|
{ |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//取反 |
|
|
//取反 |
|
|
x -= 2 * x; |
|
|
x -= 2 * x; |
|
|
y -= 2 * y; |
|
|
y -= 2 * y; |
|
@@ -936,6 +981,10 @@ namespace BPASmartClient.MorkF |
|
|
////关闭电磁阀 |
|
|
////关闭电磁阀 |
|
|
//Electromagnetism(new List<bool> { false }); |
|
|
//Electromagnetism(new List<bool> { false }); |
|
|
//Thread.Sleep(300); |
|
|
//Thread.Sleep(300); |
|
|
|
|
|
if(morkFs.ContainsKey(fryNum)) |
|
|
|
|
|
{ |
|
|
|
|
|
morkFs[fryNum].GetMaterialComplete = true; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
@@ -1169,13 +1218,39 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
int i = 0; |
|
|
|
|
|
//判断是否完成取菜 |
|
|
|
|
|
for (i = 0; i < sleepCount*2 && !morkFs[num].GetMaterialComplete; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
if(i == 3) |
|
|
|
|
|
{ |
|
|
|
|
|
//停止搅拌 |
|
|
|
|
|
StopStir(num); |
|
|
|
|
|
//火力设置为2档 |
|
|
|
|
|
SetFire(new List<int> { 2 }, num); |
|
|
|
|
|
} |
|
|
|
|
|
Thread.Sleep(sleepTime); |
|
|
|
|
|
if (i >= sleepCount * 2 - 1) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{num}倒菜超时:未能等到取菜完成"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (i > 3) |
|
|
|
|
|
{ |
|
|
|
|
|
//开启搅拌 |
|
|
|
|
|
StartStir(num); |
|
|
|
|
|
//火力设置回原本火力 |
|
|
|
|
|
SetFire(new List<int> { morkFs[num].Fire }, num); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
FirePot_Write("LB3", true, num); |
|
|
FirePot_Write("LB3", true, num); |
|
|
MessageLog.GetInstance.Show("倒菜启动"); |
|
|
MessageLog.GetInstance.Show("倒菜启动"); |
|
|
|
|
|
|
|
|
Thread.Sleep(400); |
|
|
|
|
|
|
|
|
Thread.Sleep(200); |
|
|
|
|
|
|
|
|
for (int i = 0; i < sleepCount && !morkFs[num].FryPot1_MaterialIntoPot; i++) |
|
|
|
|
|
|
|
|
for (i = 0; i < sleepCount && !morkFs[num].FryPot1_MaterialIntoPot; i++) |
|
|
{ |
|
|
{ |
|
|
Thread.Sleep(sleepTime); |
|
|
Thread.Sleep(sleepTime); |
|
|
if (i >= sleepCount - 1) |
|
|
if (i >= sleepCount - 1) |
|
@@ -1571,7 +1646,7 @@ namespace BPASmartClient.MorkF |
|
|
//遍历炒锅,找到合适、空闲的炒锅 |
|
|
//遍历炒锅,找到合适、空闲的炒锅 |
|
|
for(int i = 0;i<morkFs.Count;i++) |
|
|
for(int i = 0;i<morkFs.Count;i++) |
|
|
{ |
|
|
{ |
|
|
if (/*morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete &&*/ |
|
|
|
|
|
|
|
|
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && |
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中 |
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&是否在炒菜中 |
|
|
{ |
|
|
{ |
|
|
lock(lock_MainProcessExcute) |
|
|
lock(lock_MainProcessExcute) |
|
@@ -1579,161 +1654,175 @@ namespace BPASmartClient.MorkF |
|
|
//待炒小炒队列出队列 |
|
|
//待炒小炒队列出队列 |
|
|
if (StirFryGoodsQuenes.TryDequeue(out var res)) |
|
|
if (StirFryGoodsQuenes.TryDequeue(out var res)) |
|
|
{ |
|
|
{ |
|
|
//设置当前炒制菜品 |
|
|
|
|
|
nowStirFryGood = res; |
|
|
|
|
|
//炒锅工作状态置为正在工作中 |
|
|
|
|
|
morkFs[i].FryWorking = true; |
|
|
|
|
|
//空闲炒锅入队列 |
|
|
|
|
|
morkFs[i].StirFryGoodsQuenes.Enqueue(res); |
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}"); |
|
|
|
|
|
|
|
|
|
|
|
//开启线程进行炒制 |
|
|
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
|
|
|
|
|
|
//设置当前炒制菜品 |
|
|
|
|
|
nowStirFryGood = res; |
|
|
|
|
|
//炒锅工作状态置为正在工作中 |
|
|
|
|
|
morkFs[i].FryWorking = true; |
|
|
|
|
|
//空闲炒锅入队列 |
|
|
|
|
|
morkFs[i].StirFryGoodsQuenes.Enqueue(res); |
|
|
|
|
|
//炒锅取菜状态置为未取到 |
|
|
|
|
|
morkFs[i].GetMaterialComplete = false; |
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{i}开始炒制菜品{res.GoodName}"); |
|
|
|
|
|
|
|
|
|
|
|
//开启线程进行炒制 |
|
|
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
try |
|
|
|
|
|
|
|
|
int getMaterailNum = 0; |
|
|
|
|
|
foreach (var potActions in res.StirPotActions) |
|
|
{ |
|
|
{ |
|
|
int getMaterailNum = 0; |
|
|
|
|
|
foreach (var potActions in res.StirPotActions) |
|
|
|
|
|
|
|
|
if (ThreadManage.GetInstance().IsCanncel(String.Format(striConst, i.ToString(), nowStirFryGood.GoodName))) |
|
|
{ |
|
|
{ |
|
|
if (ThreadManage.GetInstance().IsCanncel(String.Format(striConst, i.ToString(), nowStirFryGood.GoodName))) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (potActions.Actions) |
|
|
|
|
|
{ |
|
|
|
|
|
case nameof(StirFryPotActionEnum.加热开启): |
|
|
|
|
|
StartFire(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位1): |
|
|
|
|
|
SetFire(new List<int> { 1 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位2): |
|
|
|
|
|
SetFire(new List<int> { 2 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位3): |
|
|
|
|
|
SetFire(new List<int> { 3 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位4): |
|
|
|
|
|
SetFire(new List<int> { 4 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位5): |
|
|
|
|
|
SetFire(new List<int> { 5 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位6): |
|
|
|
|
|
SetFire(new List<int> { 6 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位7): |
|
|
|
|
|
SetFire(new List<int> { 7 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位8): |
|
|
|
|
|
SetFire(new List<int> { 8 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位9): |
|
|
|
|
|
SetFire(new List<int> { 9 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位10): |
|
|
|
|
|
SetFire(new List<int> { 10 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.停止加热): |
|
|
|
|
|
StopFire(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.加调料): |
|
|
|
|
|
OutSeasonings(potActions.SeasoningLists, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.取原料): |
|
|
|
|
|
GetMaterailTest(getMaterailNum); |
|
|
|
|
|
getMaterailNum++; |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
|
|
|
|
StartStir(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位1): |
|
|
|
|
|
SetStir(new List<int> { 1 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位2): |
|
|
|
|
|
SetStir(new List<int> { 2 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位3): |
|
|
|
|
|
SetStir(new List<int> { 3 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.关闭搅拌): |
|
|
|
|
|
StopStir(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
|
|
|
OutFood(i); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
|
|
|
Thread.Sleep(potActions.During * 1000); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂原点位): |
|
|
|
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
|
|
|
StirArmGoWork(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (potActions.Actions) |
|
|
|
|
|
{ |
|
|
|
|
|
case nameof(StirFryPotActionEnum.加热开启): |
|
|
|
|
|
StartFire(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位1): |
|
|
|
|
|
morkFs[i].Fire = 1; |
|
|
|
|
|
SetFire(new List<int> { 1 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位2): |
|
|
|
|
|
morkFs[i].Fire = 2; |
|
|
|
|
|
SetFire(new List<int> { 2 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位3): |
|
|
|
|
|
morkFs[i].Fire = 3; |
|
|
|
|
|
SetFire(new List<int> { 3 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位4): |
|
|
|
|
|
morkFs[i].Fire = 4; |
|
|
|
|
|
SetFire(new List<int> { 4 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位5): |
|
|
|
|
|
morkFs[i].Fire = 5; |
|
|
|
|
|
SetFire(new List<int> { 5 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位6): |
|
|
|
|
|
morkFs[i].Fire = 6; |
|
|
|
|
|
SetFire(new List<int> { 6 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位7): |
|
|
|
|
|
morkFs[i].Fire = 7; |
|
|
|
|
|
SetFire(new List<int> { 7 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位8): |
|
|
|
|
|
morkFs[i].Fire = 8; |
|
|
|
|
|
SetFire(new List<int> { 8 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位9): |
|
|
|
|
|
morkFs[i].Fire = 9; |
|
|
|
|
|
SetFire(new List<int> { 9 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置加热挡位10): |
|
|
|
|
|
morkFs[i].Fire = 10; |
|
|
|
|
|
SetFire(new List<int> { 10 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.停止加热): |
|
|
|
|
|
StopFire(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.加调料): |
|
|
|
|
|
OutSeasonings(potActions.SeasoningLists, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.取原料): |
|
|
|
|
|
//炒锅取菜状态置为未取到 |
|
|
|
|
|
morkFs[i].GetMaterialComplete = false; |
|
|
|
|
|
materialOperationQuenes.Enqueue(new MaterialOperation() { fryNum = i, x = 0, y = 0 }); |
|
|
|
|
|
getMaterailNum++; |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.开启搅拌): |
|
|
|
|
|
StartStir(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位1): |
|
|
|
|
|
SetStir(new List<int> { 1 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位2): |
|
|
|
|
|
SetStir(new List<int> { 2 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.设置搅拌挡位3): |
|
|
|
|
|
SetStir(new List<int> { 3 }, i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.关闭搅拌): |
|
|
|
|
|
StopStir(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
|
|
|
OutFood(i); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.炒制菜品): |
|
|
|
|
|
Thread.Sleep(potActions.During * 1000); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂原点位): |
|
|
|
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
|
|
|
StirArmGoWork(i); |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
case nameof(StirFryPotActionEnum.洗锅): |
|
|
|
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
Plc1Reset(i);//复位 |
|
|
|
|
|
Thread.Sleep(3000); |
|
|
|
|
|
//回原点位 |
|
|
|
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//while (!morkFs[i].ArmOnOrigin) |
|
|
|
|
|
//{ |
|
|
|
|
|
// Thread.Sleep(100); |
|
|
|
|
|
//} |
|
|
|
|
|
//出餐 |
|
|
|
|
|
//OutMeal(i); |
|
|
|
|
|
MessageLog.GetInstance.Show($"菜品{res.GoodName}完成"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plc1Reset(i);//复位 |
|
|
|
|
|
Thread.Sleep(3000); |
|
|
|
|
|
//回原点位 |
|
|
|
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
ThreadManage.GetInstance().StopTask($"炒锅{i}{res.GoodName}炒制线程"); |
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{i}炒制菜品{res.GoodName}出错,错误信息:" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
|
|
|
nowStirFryGood = null; |
|
|
|
|
|
//炒完后出队列 |
|
|
|
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
|
|
|
|
morkFs[i].FryWorking = false; |
|
|
|
|
|
} |
|
|
|
|
|
}), String.Format(striConst, i.ToString(), nowStirFryGood.GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/); |
|
|
|
|
|
|
|
|
//while (!morkFs[i].ArmOnOrigin) |
|
|
|
|
|
//{ |
|
|
|
|
|
// Thread.Sleep(100); |
|
|
|
|
|
//} |
|
|
|
|
|
//出餐 |
|
|
|
|
|
//OutMeal(i); |
|
|
|
|
|
MessageLog.GetInstance.Show($"菜品{res.GoodName}完成"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
ThreadManage.GetInstance().StopTask($"炒锅{i}{res.GoodName}炒制线程"); |
|
|
|
|
|
MessageLog.GetInstance.Show($"炒锅{i}炒制菜品{res.GoodName}出错,错误信息:" + ex.Message); |
|
|
|
|
|
} |
|
|
|
|
|
finally |
|
|
|
|
|
{ |
|
|
|
|
|
nowStirFryGood = null; |
|
|
|
|
|
//炒完后出队列 |
|
|
|
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
|
|
|
|
morkFs[i].FryWorking = false; |
|
|
|
|
|
} |
|
|
|
|
|
}), String.Format(striConst, i.ToString(), nowStirFryGood.GoodName)/*$"炒锅{i}炒制{res.GoodName}线程"*/); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
@@ -1742,6 +1831,30 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 菜品库主流程 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private void MainProcessMaterial() |
|
|
|
|
|
{ |
|
|
|
|
|
if(materialOperationQuenes.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
//判断是否初始化与是否在工作中 |
|
|
|
|
|
if (ml_morkf.InitialComplete && !ml_morkf.MaterailIsWorking) |
|
|
|
|
|
{ |
|
|
|
|
|
//待菜品库操作列出队列 |
|
|
|
|
|
if (materialOperationQuenes.TryDequeue(out var res)) |
|
|
|
|
|
{ |
|
|
|
|
|
ml_morkf.MaterailIsWorking = true; |
|
|
|
|
|
MessageLog.GetInstance.Show("开始操作菜品库"); |
|
|
|
|
|
//ThreadManage.GetInstance().Start(new Action(()=>{ |
|
|
|
|
|
// GetMaterail(res.x, res.y, res.fryNum); |
|
|
|
|
|
//}),"菜品库操作"); |
|
|
|
|
|
GetMaterailTest(res.fryNum); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 信号处理 |
|
|
/// 信号处理 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|