|
@@ -15,6 +15,7 @@ using System.Collections.Concurrent; |
|
|
using System.Windows.Documents; |
|
|
using System.Windows.Documents; |
|
|
using BPASmartClient.Business; |
|
|
using BPASmartClient.Business; |
|
|
using Microsoft.CodeAnalysis; |
|
|
using Microsoft.CodeAnalysis; |
|
|
|
|
|
using BPASmartClient.MorkF.ViewModel; |
|
|
|
|
|
|
|
|
namespace BPASmartClient.MorkF |
|
|
namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
@@ -95,6 +96,16 @@ namespace BPASmartClient.MorkF |
|
|
public AutoResetEvent minorReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent minorReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent mainReset = new AutoResetEvent(false); |
|
|
public AutoResetEvent mainReset = new AutoResetEvent(false); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 等待炒制数量 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private int StagingFryCount { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 正在炒制数量 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private int FryingCount { get; set; } |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 炒锅编号与炒锅实例 |
|
|
/// 炒锅编号与炒锅实例 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -141,6 +152,17 @@ namespace BPASmartClient.MorkF |
|
|
/// |
|
|
/// |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
private List<StatsModel> statsModels = new List<StatsModel>(); |
|
|
private List<StatsModel> statsModels = new List<StatsModel>(); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 暂存使用菜品量 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private List<GoodBatchings> stagingGoodBatchings = new List<GoodBatchings>(); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 是否为本地炒菜模式,默认为联网的 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private bool isLocalFryingMode { get; set; } = false; |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 入口 |
|
|
/// 入口 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -162,6 +184,9 @@ namespace BPASmartClient.MorkF |
|
|
Task2ReadMaterialData(); |
|
|
Task2ReadMaterialData(); |
|
|
|
|
|
|
|
|
ScreenDataServer(); |
|
|
ScreenDataServer(); |
|
|
|
|
|
Json<MaterialAndFryingTime>.Read(); |
|
|
|
|
|
//更新菜品余量 |
|
|
|
|
|
UpdateMaterialSurplus(); |
|
|
|
|
|
|
|
|
//读取坐标系 |
|
|
//读取坐标系 |
|
|
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); |
|
|
MaterialCoordinate materialCoordinate = ReadMaterialCoordinate(); |
|
@@ -194,6 +219,7 @@ namespace BPASmartClient.MorkF |
|
|
MainProcessMaterial(); |
|
|
MainProcessMaterial(); |
|
|
//MinorProcessExcute(); |
|
|
//MinorProcessExcute(); |
|
|
//SingleProcess(); |
|
|
//SingleProcess(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static object saveMaterialLock = new object(); |
|
|
private static object saveMaterialLock = new object(); |
|
@@ -256,12 +282,12 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
if (isInitialArrive == false) |
|
|
if (isInitialArrive == false) |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.Show("到达上升沿为true,isInitialArrive is false"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("到达上升沿为true,isInitialArrive is false"); |
|
|
isInitialArrive = true; |
|
|
isInitialArrive = true; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.Show("到达上升沿为true"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("到达上升沿为true"); |
|
|
ml_morkf.ArriveComplete = true; |
|
|
ml_morkf.ArriveComplete = true; |
|
|
isInitialArrive = true; |
|
|
isInitialArrive = true; |
|
|
} |
|
|
} |
|
@@ -361,6 +387,13 @@ namespace BPASmartClient.MorkF |
|
|
ActionManage.GetInstance.Register(StartOrderMain, "开始下单"); |
|
|
ActionManage.GetInstance.Register(StartOrderMain, "开始下单"); |
|
|
ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder"); |
|
|
ActionManage.GetInstance.Register(StartLocalOrder, "StartLocalOrder"); |
|
|
ActionManage.GetInstance.Register(StopLocalOrder, "StopLocalOrder"); |
|
|
ActionManage.GetInstance.Register(StopLocalOrder, "StopLocalOrder"); |
|
|
|
|
|
ActionManage.GetInstance.Register(new Action<object>((o) => |
|
|
|
|
|
{ |
|
|
|
|
|
if (o is string materialName) |
|
|
|
|
|
{ |
|
|
|
|
|
NewStartLocalOrder(materialName); |
|
|
|
|
|
} |
|
|
|
|
|
}), "NewStartLocalOrder"); |
|
|
#endregion |
|
|
#endregion |
|
|
|
|
|
|
|
|
#region 菜品库 |
|
|
#region 菜品库 |
|
@@ -372,6 +405,10 @@ namespace BPASmartClient.MorkF |
|
|
}), "FoodLibInit"); |
|
|
}), "FoodLibInit"); |
|
|
}), "FoodLibInit"); |
|
|
}), "FoodLibInit"); |
|
|
ActionManage.GetInstance.Register(new Action(() => |
|
|
ActionManage.GetInstance.Register(new Action(() => |
|
|
|
|
|
{ |
|
|
|
|
|
isLocalFryingMode = !isLocalFryingMode; |
|
|
|
|
|
}), "ModeChange"); |
|
|
|
|
|
ActionManage.GetInstance.Register(new Action(() => |
|
|
{ |
|
|
{ |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
{ |
|
|
{ |
|
@@ -705,7 +742,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
private void StartLocalOrder() |
|
|
private void StartLocalOrder() |
|
|
{ |
|
|
{ |
|
|
if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做 |
|
|
|
|
|
|
|
|
if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做 |
|
|
if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0) |
|
|
if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0) |
|
|
{ |
|
|
{ |
|
|
StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
|
StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
@@ -718,6 +755,43 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void NewStartLocalOrder(string materialName) |
|
|
|
|
|
{ |
|
|
|
|
|
//if (StirFryGoodsQuenes.Count > 0) return;//只能一个一个做 |
|
|
|
|
|
//if (Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0) |
|
|
|
|
|
//{ |
|
|
|
|
|
// StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
|
|
|
|
// { |
|
|
|
|
|
// SuborderId = Guid.NewGuid().ToString(), |
|
|
|
|
|
// StirPotActions = Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions, |
|
|
|
|
|
// GoodName = "本地菜品" |
|
|
|
|
|
// }); |
|
|
|
|
|
// MessageLog.GetInstance.Show($"添加本地模拟的订单{Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey}"); |
|
|
|
|
|
//} |
|
|
|
|
|
if (Json<MaterialAndFryingTime>.Data.materials.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (!Json<MaterialAndFryingTime>.Data.materials.ContainsKey(materialName)) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<PotActions> potActions = new List<PotActions>(); |
|
|
|
|
|
|
|
|
|
|
|
foreach(var item in Json<MaterialAndFryingTime>.Data.materials[materialName]) |
|
|
|
|
|
{ |
|
|
|
|
|
potActions.Add(item); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
|
|
|
|
{ |
|
|
|
|
|
SuborderId = Guid.NewGuid().ToString(), |
|
|
|
|
|
StirPotActions = potActions, |
|
|
|
|
|
GoodName = materialName |
|
|
|
|
|
}); |
|
|
|
|
|
MessageLog.GetInstance.Show($"添加本地模拟的订单{Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey}"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 停止本地菜单炒制 |
|
|
/// 停止本地菜单炒制 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -938,7 +1012,7 @@ namespace BPASmartClient.MorkF |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到1号位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到1号位"); |
|
|
MaterailLibrary_Write("M1.0", true); |
|
|
MaterailLibrary_Write("M1.0", true); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
@@ -955,7 +1029,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
Thread.Sleep(300); |
|
|
Thread.Sleep(300); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到1号位完成"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到1号位完成"); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -967,7 +1041,7 @@ namespace BPASmartClient.MorkF |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到2号位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到2号位"); |
|
|
MaterailLibrary_Write("M1.1", true); |
|
|
MaterailLibrary_Write("M1.1", true); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
@@ -984,7 +1058,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
Thread.Sleep(300); |
|
|
Thread.Sleep(300); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到2号位完成"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到2号位完成"); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -996,7 +1070,7 @@ namespace BPASmartClient.MorkF |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到3号位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到3号位"); |
|
|
MaterailLibrary_Write("M1.2", true); |
|
|
MaterailLibrary_Write("M1.2", true); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
@@ -1013,7 +1087,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
Thread.Sleep(300); |
|
|
Thread.Sleep(300); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("爪子去到3号位完成"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("爪子去到3号位完成"); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -1029,8 +1103,8 @@ namespace BPASmartClient.MorkF |
|
|
MaterailLibrary_Write("M0.3", false); |
|
|
MaterailLibrary_Write("M0.3", false); |
|
|
Thread.Sleep(3000); |
|
|
Thread.Sleep(3000); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("1号测距开启完成"); |
|
|
|
|
|
MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("1号测距开启完成"); |
|
|
|
|
|
//MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "1",ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "1",ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
|
|
|
|
|
@@ -1048,8 +1122,8 @@ namespace BPASmartClient.MorkF |
|
|
MaterailLibrary_Write("M0.4", false); |
|
|
MaterailLibrary_Write("M0.4", false); |
|
|
Thread.Sleep(3000); |
|
|
Thread.Sleep(3000); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("2号测距开启完成"); |
|
|
|
|
|
MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("2号测距开启完成"); |
|
|
|
|
|
//MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "2", ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "2", ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
|
|
|
|
|
@@ -1067,14 +1141,24 @@ namespace BPASmartClient.MorkF |
|
|
MaterailLibrary_Write("M0.5", false); |
|
|
MaterailLibrary_Write("M0.5", false); |
|
|
Thread.Sleep(3000); |
|
|
Thread.Sleep(3000); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("3号测距开启完成"); |
|
|
|
|
|
MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("3号测距开启完成"); |
|
|
|
|
|
//MessageLog.GetInstance.Show($"传感器的距离{ml_morkf.LaserDistance}"); |
|
|
|
|
|
|
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "3", ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
ActionManage.GetInstance.Send("GetDistanceCallBack", new List<string> { "3", ml_morkf.LaserDistance.ToString() });//通知获取测距界面 |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 写入传感器距离 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
/// <param name="speed"></param> |
|
|
|
|
|
public void WriteSpeed(int speed) |
|
|
|
|
|
{ |
|
|
|
|
|
MaterailLibrary_Write("VD808", speed); |
|
|
|
|
|
Thread.Sleep(400); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 写入传感器距离 |
|
|
/// 写入传感器距离 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -1100,7 +1184,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
Thread.Sleep(400); |
|
|
Thread.Sleep(400); |
|
|
|
|
|
|
|
|
//获取传感器1的距离 |
|
|
|
|
|
|
|
|
////获取传感器1的距离 |
|
|
ret &= GetDistance_1(); |
|
|
ret &= GetDistance_1(); |
|
|
} |
|
|
} |
|
|
//是否在第二层菜品库 |
|
|
//是否在第二层菜品库 |
|
@@ -1157,7 +1241,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"机械臂移动到[{x},{y}]"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show($"机械臂移动到[{x},{y}]"); |
|
|
|
|
|
|
|
|
//到达置为false |
|
|
//到达置为false |
|
|
ml_morkf.ArriveComplete = false; |
|
|
ml_morkf.ArriveComplete = false; |
|
@@ -1183,7 +1267,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show("机械臂移动操作完成"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("机械臂移动操作完成"); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
|
|
|
|
|
|
@@ -1200,7 +1284,7 @@ namespace BPASmartClient.MorkF |
|
|
//取反 |
|
|
//取反 |
|
|
x -= 2 * x; |
|
|
x -= 2 * x; |
|
|
y -= 2 * y; |
|
|
y -= 2 * y; |
|
|
MessageLog.GetInstance.Show($"设置机械臂当前坐标为[{x},{y}]"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show($"设置机械臂当前坐标为[{x},{y}]"); |
|
|
MaterailLibrary_Write("VD828", x); |
|
|
MaterailLibrary_Write("VD828", x); |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
MaterailLibrary_Write("VD832", y); |
|
|
MaterailLibrary_Write("VD832", y); |
|
@@ -1300,6 +1384,8 @@ namespace BPASmartClient.MorkF |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
WriteSpeed(10000); |
|
|
|
|
|
|
|
|
//关闭电磁阀 |
|
|
//关闭电磁阀 |
|
|
Electromagnetism(new List<bool> { true }); |
|
|
Electromagnetism(new List<bool> { true }); |
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
@@ -1357,8 +1443,13 @@ namespace BPASmartClient.MorkF |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//收缩爪子 |
|
|
|
|
|
PawShrink(); |
|
|
|
|
|
|
|
|
WriteSpeed(50000); |
|
|
|
|
|
|
|
|
|
|
|
ThreadManage.GetInstance().Start(new Action(() => |
|
|
|
|
|
{ |
|
|
|
|
|
//收缩爪子 |
|
|
|
|
|
PawShrink(); |
|
|
|
|
|
}), "GetMaterialPawShrink"); |
|
|
|
|
|
|
|
|
//判断炒锅是否可以放盒 |
|
|
//判断炒锅是否可以放盒 |
|
|
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++) |
|
|
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++) |
|
@@ -1366,7 +1457,7 @@ namespace BPASmartClient.MorkF |
|
|
Thread.Sleep(materialSleepTime); |
|
|
Thread.Sleep(materialSleepTime); |
|
|
if (i >= materialSleepCount - 1) |
|
|
if (i >= materialSleepCount - 1) |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.Show("等待炒锅允许放盒超时"); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.ShowEx("等待炒锅允许放盒超时"); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -1616,11 +1707,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//盒子高度为45,但是需要考虑到误差,不足35,则认为为空 |
|
|
//盒子高度为45,但是需要考虑到误差,不足35,则认为为空 |
|
|
int boxCount = heightDifferent / 35; |
|
|
|
|
|
|
|
|
int boxCount = (heightDifferent + 5) / 35; |
|
|
count = boxCount; |
|
|
count = boxCount; |
|
|
if (count == 0) |
|
|
if (count == 0) |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.Show("菜品库为空"); |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.ShowEx("菜品库为空"); |
|
|
return Laser2CoordinateState.MaterialEmpty; |
|
|
return Laser2CoordinateState.MaterialEmpty; |
|
|
} |
|
|
} |
|
|
else if(count > 6) |
|
|
else if(count > 6) |
|
@@ -1632,47 +1723,6 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
return Laser2CoordinateState.MaterialNormal; |
|
|
return Laser2CoordinateState.MaterialNormal; |
|
|
} |
|
|
} |
|
|
//if (heightDifferent <= 20) |
|
|
|
|
|
//{ |
|
|
|
|
|
// MessageLog.GetInstance.ShowEx("错误:菜品量为空"); |
|
|
|
|
|
// return Laser2CoordinateState.MaterialEmpty; |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
|
|
|
////菜盒放多了 |
|
|
|
|
|
//if (distance < 6) |
|
|
|
|
|
//{ |
|
|
|
|
|
// return Laser2CoordinateState.MaterialOverdo; |
|
|
|
|
|
//} |
|
|
|
|
|
//else if (distance >= 6 && distance < 10) |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 5; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialNormal; |
|
|
|
|
|
//} |
|
|
|
|
|
//else if (distance >= 10 && distance < 14) |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 4; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialNormal; |
|
|
|
|
|
//} |
|
|
|
|
|
//else if (distance >= 14 && distance < 19) |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 3; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialNormal; |
|
|
|
|
|
//} |
|
|
|
|
|
//else if (distance >= 19 && distance < 23) |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 2; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialNormal; |
|
|
|
|
|
//} |
|
|
|
|
|
//else if (distance >= 23 && distance < 28) |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 1; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialNormal; |
|
|
|
|
|
//} |
|
|
|
|
|
//else |
|
|
|
|
|
//{ |
|
|
|
|
|
// count = 0; |
|
|
|
|
|
// return Laser2CoordinateState.MaterialEmpty; |
|
|
|
|
|
//} |
|
|
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@@ -1697,10 +1747,6 @@ namespace BPASmartClient.MorkF |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{materialOperation.fryNum}获取菜品[{materialOperation.materialInfo.Name}]失败,找不到对应位置"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{materialOperation.fryNum}获取菜品[{materialOperation.materialInfo.Name}]失败,找不到对应位置"); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
lock (lock_Materail) |
|
|
|
|
|
{ |
|
|
|
|
|
ml_morkf.MaterailIsWorking = true; |
|
|
|
|
|
} |
|
|
|
|
|
//取菜操作 |
|
|
//取菜操作 |
|
|
ret = GetMaterail(myCoordinate.X, myCoordinate.Y, materialOperation.fryNum); |
|
|
ret = GetMaterail(myCoordinate.X, myCoordinate.Y, materialOperation.fryNum); |
|
|
} |
|
|
} |
|
@@ -1710,16 +1756,32 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
finally |
|
|
finally |
|
|
{ |
|
|
{ |
|
|
lock (lock_Materail) |
|
|
|
|
|
|
|
|
//本地炒制不进行菜品数量检查 |
|
|
|
|
|
if(!isLocalFryingMode) |
|
|
{ |
|
|
{ |
|
|
ml_morkf.MaterailIsWorking = false; |
|
|
|
|
|
} |
|
|
|
|
|
if (ret == true) |
|
|
|
|
|
{ |
|
|
|
|
|
//指定位置菜品减一 |
|
|
|
|
|
MaterialSurplusOperation.GetInstance().ReduceSurplus(materialOperation.materialInfo.Loc); |
|
|
|
|
|
SaveMaterialData(); |
|
|
|
|
|
|
|
|
GoodBatchings goodBatchings = stagingGoodBatchings.Find(o => o.BatchingId == materialOperation.materialInfo.Key); |
|
|
|
|
|
if (ret == true) |
|
|
|
|
|
{ |
|
|
|
|
|
if (true) |
|
|
|
|
|
{ |
|
|
|
|
|
if (goodBatchings != null) |
|
|
|
|
|
{ |
|
|
|
|
|
//指定位置菜品减一 |
|
|
|
|
|
MaterialSurplusOperation.GetInstance().ReduceSurplus(materialOperation.materialInfo.Loc, goodBatchings.BatchingCount); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//指定位置菜品减一 |
|
|
|
|
|
MaterialSurplusOperation.GetInstance().ReduceSurplus(materialOperation.materialInfo.Loc); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SaveMaterialData(); |
|
|
|
|
|
} |
|
|
|
|
|
//移出占用菜品 |
|
|
|
|
|
stagingGoodBatchings.Remove(goodBatchings); |
|
|
} |
|
|
} |
|
|
|
|
|
ml_morkf.MaterailIsWorking = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}), $"菜品库操作"); |
|
|
}), $"菜品库操作"); |
|
@@ -1877,6 +1939,7 @@ namespace BPASmartClient.MorkF |
|
|
public bool OutFood(int num,out string error,bool isMaterial = false) |
|
|
public bool OutFood(int num,out string error,bool isMaterial = false) |
|
|
{ |
|
|
{ |
|
|
bool ret = true; |
|
|
bool ret = true; |
|
|
|
|
|
error = string.Empty; |
|
|
|
|
|
|
|
|
if (!morkFs.ContainsKey(num)) |
|
|
if (!morkFs.ContainsKey(num)) |
|
|
{ |
|
|
{ |
|
@@ -1890,17 +1953,19 @@ namespace BPASmartClient.MorkF |
|
|
if (isMaterial) |
|
|
if (isMaterial) |
|
|
{ |
|
|
{ |
|
|
//判断是否完成取菜 |
|
|
//判断是否完成取菜 |
|
|
for (i = 0; i < materialSleepCount && !morkFs[num].GetMaterialComplete; i++) |
|
|
|
|
|
|
|
|
for (i = 0; i < materialSleepCount*2 && !morkFs[num].GetMaterialComplete; i++) |
|
|
{ |
|
|
{ |
|
|
if (i == 10) |
|
|
if (i == 10) |
|
|
{ |
|
|
{ |
|
|
//停止搅拌 |
|
|
//停止搅拌 |
|
|
StopStir(num); |
|
|
|
|
|
|
|
|
//StopStir(num); |
|
|
|
|
|
//搅拌设置为1档 |
|
|
|
|
|
SetStir(new List<int> { 1 }, i); |
|
|
//火力设置为2档 |
|
|
//火力设置为2档 |
|
|
SetFire(new List<int> { 2 }, num); |
|
|
|
|
|
|
|
|
SetFire(new List<int> { 1 }, num); |
|
|
} |
|
|
} |
|
|
Thread.Sleep(materialSleepTime); |
|
|
Thread.Sleep(materialSleepTime); |
|
|
if (i >= materialSleepCount - 1) |
|
|
|
|
|
|
|
|
if (i >= materialSleepCount * 2 - 1) |
|
|
{ |
|
|
{ |
|
|
error = $"炒锅{num}倒菜超时:未能等到取菜完成,请检查菜品库是否正常运行"; |
|
|
error = $"炒锅{num}倒菜超时:未能等到取菜完成,请检查菜品库是否正常运行"; |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成"); |
|
|
MessageLog.GetInstance.ShowEx($"炒锅{num}倒菜超时:未能等到取菜完成"); |
|
@@ -1911,14 +1976,21 @@ namespace BPASmartClient.MorkF |
|
|
if (i > 9) |
|
|
if (i > 9) |
|
|
{ |
|
|
{ |
|
|
//开启搅拌 |
|
|
//开启搅拌 |
|
|
StartStir(num); |
|
|
|
|
|
|
|
|
//StartStir(num); |
|
|
|
|
|
//搅拌设置为原本搅拌档位 |
|
|
|
|
|
SetStir(new List<int> { morkFs[num].Stir }, i); |
|
|
//火力设置回原本火力 |
|
|
//火力设置回原本火力 |
|
|
SetFire(new List<int> { morkFs[num].Fire }, num); |
|
|
SetFire(new List<int> { morkFs[num].Fire }, num); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!ret) |
|
|
|
|
|
{ |
|
|
|
|
|
return ret; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
FirePot_Write("LB3", true, num); |
|
|
FirePot_Write("LB3", true, num); |
|
|
MessageLog.GetInstance.Show("倒菜启动"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("倒菜启动"); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
Thread.Sleep(500); |
|
|
|
|
|
|
|
@@ -1935,9 +2007,8 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
FirePot_Write("LB3", false, num); |
|
|
FirePot_Write("LB3", false, num); |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
MessageLog.GetInstance.Show("倒菜完成"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("倒菜完成"); |
|
|
morkFs[num].GetMaterialComplete = false; |
|
|
morkFs[num].GetMaterialComplete = false; |
|
|
error = string.Empty; |
|
|
|
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
//搅拌臂去原点位 |
|
|
//搅拌臂去原点位 |
|
@@ -1949,7 +2020,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
FirePot_Write("LB5", true, num); |
|
|
FirePot_Write("LB5", true, num); |
|
|
MessageLog.GetInstance.Show("搅拌臂去原点位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("搅拌臂去原点位"); |
|
|
|
|
|
|
|
|
for (int i = 0; i < sleepCount && !morkFs[num].ArmOnOrigin; i++) |
|
|
for (int i = 0; i < sleepCount && !morkFs[num].ArmOnOrigin; i++) |
|
|
{ |
|
|
{ |
|
@@ -1962,7 +2033,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
FirePot_Write("LB5", false, num); |
|
|
FirePot_Write("LB5", false, num); |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
MessageLog.GetInstance.Show("搅拌臂到达原点位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("搅拌臂到达原点位"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//搅拌臂去炒制位 |
|
|
//搅拌臂去炒制位 |
|
@@ -1979,7 +2050,7 @@ namespace BPASmartClient.MorkF |
|
|
if (!morkFs[num].ArmOnWorking/* && morkFs[num].PotOnOrigin*/) |
|
|
if (!morkFs[num].ArmOnWorking/* && morkFs[num].PotOnOrigin*/) |
|
|
{ |
|
|
{ |
|
|
FirePot_Write("LB6", true, num); |
|
|
FirePot_Write("LB6", true, num); |
|
|
MessageLog.GetInstance.Show("搅拌臂去工作位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("搅拌臂去工作位"); |
|
|
|
|
|
|
|
|
for (int i = 0; i < sleepCount && !morkFs[num].ArmOnWorking; i++) |
|
|
for (int i = 0; i < sleepCount && !morkFs[num].ArmOnWorking; i++) |
|
|
{ |
|
|
{ |
|
@@ -1999,7 +2070,7 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
FirePot_Write("LB6", false, num); |
|
|
FirePot_Write("LB6", false, num); |
|
|
Thread.Sleep(200); |
|
|
Thread.Sleep(200); |
|
|
MessageLog.GetInstance.Show("搅拌臂到达工作位"); |
|
|
|
|
|
|
|
|
//MessageLog.GetInstance.Show("搅拌臂到达工作位"); |
|
|
return ret; |
|
|
return ret; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@@ -2022,7 +2093,7 @@ namespace BPASmartClient.MorkF |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
FirePot_Write("LB4", true, num); |
|
|
FirePot_Write("LB4", true, num); |
|
|
Thread.Sleep(200); |
|
|
|
|
|
|
|
|
Thread.Sleep(500); |
|
|
FirePot_Write("LB4", false, num); |
|
|
FirePot_Write("LB4", false, num); |
|
|
} |
|
|
} |
|
|
//加热挡位设定 |
|
|
//加热挡位设定 |
|
@@ -2274,7 +2345,7 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 数据解析 |
|
|
|
|
|
|
|
|
/// 订单数据解析 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|
private void DataParse() |
|
|
private void DataParse() |
|
|
{ |
|
|
{ |
|
@@ -2293,24 +2364,65 @@ namespace BPASmartClient.MorkF |
|
|
DeviceProcessLogShow($"接收到{OrderCount}次订单"); |
|
|
DeviceProcessLogShow($"接收到{OrderCount}次订单"); |
|
|
Enum.GetNames(typeof(StirFryPotActionEnum)); |
|
|
Enum.GetNames(typeof(StirFryPotActionEnum)); |
|
|
|
|
|
|
|
|
|
|
|
if(true) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);//匹配订单对应制作流程 |
|
|
var res = LocalstirFryGoods?.FirstOrDefault(p => p.GoodsKey == order.MorkOrder.GoodsKey);//匹配订单对应制作流程 |
|
|
if(order.MorkOrder.GoodBatchings.Count <= 0) |
|
|
if(order.MorkOrder.GoodBatchings.Count <= 0) |
|
|
{ |
|
|
{ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(order.MorkOrder.DeviceId != DeviceId) |
|
|
|
|
|
|
|
|
MaterialSurplus materialSurplus = MaterialSurplusOperation.GetInstance().materialSurplus; |
|
|
|
|
|
|
|
|
|
|
|
if (order.MorkOrder.DeviceId != DeviceId) |
|
|
{ |
|
|
{ |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///遍历并增加到待用菜品库 |
|
|
|
|
|
foreach(var goodBatching in order.MorkOrder.GoodBatchings) |
|
|
|
|
|
{ |
|
|
|
|
|
MaterialInfo materialInfo = MaterialSurplusOperation.GetInstance().materialSurplus.dicSurplus.Find( o => o.Key == goodBatching.BatchingId); |
|
|
|
|
|
if (materialInfo != null) |
|
|
|
|
|
{ |
|
|
|
|
|
//if |
|
|
|
|
|
if(Convert.ToInt32(materialInfo.Qty) - goodBatching.BatchingCount < 0) |
|
|
|
|
|
{ |
|
|
|
|
|
MessageLog.GetInstance.ShowEx($"{materialInfo.Name}不够,请更新菜品库,并点击检测"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//查找是否有该菜品 |
|
|
|
|
|
GoodBatchings existingGoodBatchings = stagingGoodBatchings.Find( o => o.BatchingId== goodBatching.BatchingId ); |
|
|
|
|
|
//判断是否存在 |
|
|
|
|
|
if (existingGoodBatchings != null) |
|
|
|
|
|
{ |
|
|
|
|
|
existingGoodBatchings.BatchingCount += goodBatching.BatchingCount; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
stagingGoodBatchings.Add(goodBatching); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
MessageLog.GetInstance.ShowEx($"ID为{goodBatching.BatchingId}的菜品无法找到,请联系售后人员"); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//var res = LocalstirFryGoods[0]; |
|
|
//var res = LocalstirFryGoods[0]; |
|
|
if (res != null) |
|
|
if (res != null) |
|
|
{ |
|
|
{ |
|
|
/* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程 |
|
|
/* morkF.listStirBom.Add(res.StirFryBomInfo);*///添加订单制作流程 |
|
|
//添加到带炒小炒队列 |
|
|
|
|
|
|
|
|
//添加到带炒小炒队列 |
|
|
if (StirFryGoodsQuenes.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
if (StirFryGoodsQuenes.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
//待炒数量+1 |
|
|
|
|
|
StagingFryCount++; |
|
|
lock (lock_MainProcessExcute) |
|
|
lock (lock_MainProcessExcute) |
|
|
{ |
|
|
{ |
|
|
StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
|
StirFryGoodsQuenes.Enqueue(new OrderLocInfo() |
|
@@ -2323,6 +2435,11 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
NewStartLocalOrder("莲白回锅"); |
|
|
|
|
|
} |
|
|
////暂时使用本地菜单 |
|
|
////暂时使用本地菜单 |
|
|
//StartLocalOrder(); |
|
|
//StartLocalOrder(); |
|
|
} |
|
|
} |
|
@@ -2333,6 +2450,11 @@ namespace BPASmartClient.MorkF |
|
|
|
|
|
|
|
|
private object lock_MainProcessExcute = new object(); |
|
|
private object lock_MainProcessExcute = new object(); |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 倒菜锁 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private object lock_OutMeal = new object(); |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 炒锅主流程 |
|
|
/// 炒锅主流程 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -2344,7 +2466,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 && ml_morkf.InitialComplete &&*/ |
|
|
|
|
|
|
|
|
if (morkFs[i].AutoMode && morkFs[i].FryPot1_InitialComplete && ml_morkf.InitialComplete && |
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中 |
|
|
!morkFs[i].FryWorking)//炒锅在自动状态&&初始化完成&&菜品库初始化&&是否在炒菜中 |
|
|
{ |
|
|
{ |
|
|
Thread.Sleep(5000); |
|
|
Thread.Sleep(5000); |
|
@@ -2367,6 +2489,10 @@ namespace BPASmartClient.MorkF |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
|
|
|
//待炒数量-1 |
|
|
|
|
|
StagingFryCount--; |
|
|
|
|
|
//正在炒制数量+1 |
|
|
|
|
|
FryingCount++; |
|
|
int testi = 0; |
|
|
int testi = 0; |
|
|
string error = string.Empty; |
|
|
string error = string.Empty; |
|
|
//初始化大屏 |
|
|
//初始化大屏 |
|
@@ -2390,7 +2516,7 @@ namespace BPASmartClient.MorkF |
|
|
if(ret == false) |
|
|
if(ret == false) |
|
|
{ |
|
|
{ |
|
|
MessageLog.GetInstance.ShowEx("上一步操作未成功"); |
|
|
MessageLog.GetInstance.ShowEx("上一步操作未成功"); |
|
|
//break; |
|
|
|
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
////调试大屏用代码 |
|
|
////调试大屏用代码 |
|
@@ -2467,28 +2593,14 @@ namespace BPASmartClient.MorkF |
|
|
//炒锅取菜状态置为未取到 |
|
|
//炒锅取菜状态置为未取到 |
|
|
morkFs[i].GetMaterialComplete = false; |
|
|
morkFs[i].GetMaterialComplete = false; |
|
|
|
|
|
|
|
|
if (true) |
|
|
|
|
|
|
|
|
if (isLocalFryingMode) |
|
|
{ |
|
|
{ |
|
|
///测试用代码 |
|
|
|
|
|
if (testi % 2 == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
MaterialInfo materialInfo = new MaterialInfo(); |
|
|
|
|
|
materialInfo.Loc = "5"; |
|
|
|
|
|
materialInfo.Qty = 10; |
|
|
|
|
|
materialInfo.Name = "肉片"; |
|
|
|
|
|
materialInfo.Id = "1232131"; |
|
|
|
|
|
materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i }); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
MaterialInfo materialInfo = new MaterialInfo(); |
|
|
|
|
|
materialInfo.Loc = "24"; |
|
|
|
|
|
materialInfo.Qty = 10; |
|
|
|
|
|
materialInfo.Name = "青椒"; |
|
|
|
|
|
materialInfo.Id = "1232131"; |
|
|
|
|
|
materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i }); |
|
|
|
|
|
} |
|
|
|
|
|
testi++; |
|
|
|
|
|
|
|
|
MaterialInfo materialInfo = new MaterialInfo(); |
|
|
|
|
|
materialInfo.Loc = potActions.SeasoningLists[0].Loc.ToString(); |
|
|
|
|
|
materialInfo.Id = "1232131"; |
|
|
|
|
|
materialInfo.Name = "本地炒制未知菜品"; |
|
|
|
|
|
materialOperationQuenes.Enqueue(new MaterialOperation { materialInfo = materialInfo, fryNum = i }); |
|
|
|
|
|
//testi++; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@@ -2536,6 +2648,12 @@ namespace BPASmartClient.MorkF |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
case nameof(StirFryPotActionEnum.出餐启动): |
|
|
|
|
|
//停止搅拌 |
|
|
|
|
|
StopStir(i); |
|
|
|
|
|
//回原点位 |
|
|
|
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
//出餐启动 |
|
|
|
|
|
OutMeal(i); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
|
case nameof(StirFryPotActionEnum.道菜启动): |
|
@@ -2553,7 +2671,11 @@ namespace BPASmartClient.MorkF |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
MessageLog.GetInstance.Show(potActions.Actions); |
|
|
break; |
|
|
break; |
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
case nameof(StirFryPotActionEnum.搅拌臂炒制位): |
|
|
ret = StirArmGoWork(i,out error); |
|
|
|
|
|
|
|
|
//出餐时,不允许搅拌臂去炒制位 |
|
|
|
|
|
lock (lock_OutMeal) |
|
|
|
|
|
{ |
|
|
|
|
|
ret = StirArmGoWork(i, out error); |
|
|
|
|
|
} |
|
|
if (ret == false) |
|
|
if (ret == false) |
|
|
{ |
|
|
{ |
|
|
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error }); |
|
|
alarmModel.Add(new AlarmModel() { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = error }); |
|
@@ -2574,6 +2696,16 @@ namespace BPASmartClient.MorkF |
|
|
//回原点位 |
|
|
//回原点位 |
|
|
StirArmGoOrigin(i); |
|
|
StirArmGoOrigin(i); |
|
|
|
|
|
|
|
|
|
|
|
//同时只能允许有一个出餐 |
|
|
|
|
|
lock(lock_OutMeal) |
|
|
|
|
|
{ |
|
|
|
|
|
//出餐启动 |
|
|
|
|
|
OutMeal(i); |
|
|
|
|
|
//等待25s出餐完毕 |
|
|
|
|
|
Thread.Sleep(25000); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"菜品{res.GoodName}完成"); |
|
|
MessageLog.GetInstance.Show($"菜品{res.GoodName}完成"); |
|
|
|
|
|
|
|
|
//菜品统计数量+1 |
|
|
//菜品统计数量+1 |
|
@@ -2604,6 +2736,8 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
finally |
|
|
finally |
|
|
{ |
|
|
{ |
|
|
|
|
|
//正在炒制数量-1 |
|
|
|
|
|
FryingCount--; |
|
|
nowStirFryGood[i] = null; |
|
|
nowStirFryGood[i] = null; |
|
|
//炒完后出队列 |
|
|
//炒完后出队列 |
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
|
morkFs[i].StirFryGoodsQuenes.TryDequeue(out var orderQueue); |
|
@@ -2620,6 +2754,51 @@ namespace BPASmartClient.MorkF |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
/// 更新菜品库的余量 |
|
|
|
|
|
/// </summary> |
|
|
|
|
|
private void UpdateMaterialSurplus() |
|
|
|
|
|
{ |
|
|
|
|
|
ThreadManage.GetInstance().StartLong(new Action(() => { |
|
|
|
|
|
|
|
|
|
|
|
List<MaterialInfo> listSurplus = MaterialSurplusOperation.GetInstance().materialSurplus.dicSurplus; |
|
|
|
|
|
|
|
|
|
|
|
if (listSurplus == null) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (var surplus in listSurplus) |
|
|
|
|
|
{ |
|
|
|
|
|
//找到已有的余量表 |
|
|
|
|
|
var batchingInfo = BatchingInfos.Find(o => o.BatchingId == surplus.Key); |
|
|
|
|
|
//从当前下单 |
|
|
|
|
|
var stagingGoodBatching = stagingGoodBatchings.Find(o => o.BatchingId == surplus.Key); |
|
|
|
|
|
|
|
|
|
|
|
//暂存的数量 |
|
|
|
|
|
int stagingCount = 0; |
|
|
|
|
|
|
|
|
|
|
|
if(stagingGoodBatching != null) |
|
|
|
|
|
{ |
|
|
|
|
|
stagingCount = stagingGoodBatching.BatchingCount; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (batchingInfo == null) |
|
|
|
|
|
{ |
|
|
|
|
|
//为空就新增 |
|
|
|
|
|
BatchingInfos.Add(new BatchingInfo() { BatchingCount = Convert.ToInt32(surplus.Qty) - stagingCount, BatchingLoc = surplus.Loc, BatchingId = surplus.Key }); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
batchingInfo.BatchingLoc = surplus.Loc; |
|
|
|
|
|
batchingInfo.BatchingCount = Convert.ToInt32(surplus.Qty) - stagingCount; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Thread.Sleep(1000); |
|
|
|
|
|
return; |
|
|
|
|
|
}), "UpdateMaterialSurplus", true); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 菜品库主流程 |
|
|
/// 菜品库主流程 |
|
|
/// </summary> |
|
|
/// </summary> |
|
@@ -2633,6 +2812,7 @@ namespace BPASmartClient.MorkF |
|
|
//待菜品库操作列出队列 |
|
|
//待菜品库操作列出队列 |
|
|
if (materialOperationQuenes.TryDequeue(out var res)) |
|
|
if (materialOperationQuenes.TryDequeue(out var res)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
Thread.Sleep(1000); |
|
|
|
|
|
|
|
|
ml_morkf.MaterailIsWorking = true; |
|
|
ml_morkf.MaterailIsWorking = true; |
|
|
MessageLog.GetInstance.Show("开始操作菜品库"); |
|
|
MessageLog.GetInstance.Show("开始操作菜品库"); |
|
@@ -2691,7 +2871,7 @@ namespace BPASmartClient.MorkF |
|
|
LocalMqtt.GetInstance.Publish(maxWok); |
|
|
LocalMqtt.GetInstance.Publish(maxWok); |
|
|
Thread.Sleep(1000); |
|
|
Thread.Sleep(1000); |
|
|
|
|
|
|
|
|
}), "大屏数据上报"); |
|
|
|
|
|
|
|
|
}), "大屏数据上报",true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|