|
|
@@ -23,6 +23,7 @@ using BPA.Models; |
|
|
|
using System.Windows.Forms; |
|
|
|
using System.Media; |
|
|
|
using BPASmartClient.CustomResource; |
|
|
|
using Microsoft.EntityFrameworkCore.Metadata.Internal; |
|
|
|
//using BPA.Helper; |
|
|
|
|
|
|
|
namespace BPASmartClient.MorkMV1 |
|
|
@@ -69,10 +70,10 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
|
|
|
|
string guid = new Guid().ToString(); |
|
|
|
|
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); |
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new MOrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid }); |
|
|
|
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】"); |
|
|
|
|
|
|
|
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); |
|
|
|
mORKM.TakeBowlTask.Enqueue(new MOrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid }); |
|
|
|
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】"); |
|
|
|
Thread.Sleep(60000); |
|
|
|
}), "ForOrder"); |
|
|
@@ -255,11 +256,12 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
|
GetStatus("M16.7", new Action<object>((obj) => |
|
|
|
GetStatus("M16.6", new Action<object>((obj) => |
|
|
|
{ |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1) |
|
|
|
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 2) |
|
|
|
{ |
|
|
|
mORKM.RobotTakeNoodleCom = bools[0]; |
|
|
|
mORKM.RobotInvertedSurfaceCom = bools[0]; |
|
|
|
mORKM.RobotTakeNoodleCom = bools[1]; |
|
|
|
} |
|
|
|
})); |
|
|
|
|
|
|
@@ -348,6 +350,7 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT); |
|
|
|
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}"); |
|
|
|
mORKM.HistorySuborderId.Add(order.MorkOrder.SuborderId); |
|
|
|
List<MOrderLocInfo> oli = new List<MOrderLocInfo>(); |
|
|
|
foreach (var item in order.MorkOrder.GoodBatchings) |
|
|
|
{ |
|
|
|
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); |
|
|
@@ -357,38 +360,104 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
{ |
|
|
|
if (loc >= 1 && loc <= 5) |
|
|
|
{ |
|
|
|
if (mORKM.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() |
|
|
|
{ |
|
|
|
GoodName = order.MorkOrder.GoodsName, |
|
|
|
Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
SortNum = order.MorkOrder.SortNum, |
|
|
|
BatchingId = res.BatchingId |
|
|
|
}); |
|
|
|
} |
|
|
|
else if (loc >= 10 && loc <= 11) |
|
|
|
{ |
|
|
|
int index = 0; |
|
|
|
if (recipeBoms != null) |
|
|
|
var x = Json<MorksPar>.Data.DishLibraryParSets.FirstOrDefault(p => p.TextBlockContext == loc.ToString()); |
|
|
|
if (x != null) |
|
|
|
{ |
|
|
|
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); |
|
|
|
index++; |
|
|
|
} |
|
|
|
if (mORKM.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() |
|
|
|
oli.Add(new MOrderLocInfo() |
|
|
|
{ |
|
|
|
BatchingId = res.BatchingId, |
|
|
|
GoodName = order.MorkOrder.GoodsName, |
|
|
|
Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
SortNum = order.MorkOrder.SortNum, |
|
|
|
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 |
|
|
|
BatchingId = res.BatchingId, |
|
|
|
Minute = x.Minute, |
|
|
|
Second = x.Second, |
|
|
|
LocDishType = x.LocDishType |
|
|
|
}); |
|
|
|
} |
|
|
|
//if (mORKM.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
// mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() |
|
|
|
// { |
|
|
|
// GoodName = order.MorkOrder.GoodsName, |
|
|
|
// Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
// SuborderId = order.MorkOrder.SuborderId, |
|
|
|
// SortNum = order.MorkOrder.SortNum, |
|
|
|
// BatchingId = res.BatchingId |
|
|
|
// }); |
|
|
|
} |
|
|
|
//else if (loc >= 10 && loc <= 11) |
|
|
|
//{ |
|
|
|
// int index = 0; |
|
|
|
// if (recipeBoms != null) |
|
|
|
// { |
|
|
|
// index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId); |
|
|
|
// index++; |
|
|
|
// } |
|
|
|
// if (mORKM.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
// mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() |
|
|
|
// { |
|
|
|
// BatchingId = res.BatchingId, |
|
|
|
// GoodName = order.MorkOrder.GoodsName, |
|
|
|
// Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
// SuborderId = order.MorkOrder.SuborderId, |
|
|
|
// SortNum = order.MorkOrder.SortNum, |
|
|
|
// RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0 |
|
|
|
// }); |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; i <= 1; i++) |
|
|
|
{ |
|
|
|
oli.Where(p => p.LocDishType == i).ToList()?.ForEach(y => |
|
|
|
{ |
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new MOrderLocInfo() |
|
|
|
{ |
|
|
|
GoodName = y.GoodName, |
|
|
|
Loc = y.Loc, |
|
|
|
SuborderId = y.SuborderId, |
|
|
|
SortNum = y.SortNum, |
|
|
|
BatchingId = y.BatchingId, |
|
|
|
LocDishType = y.LocDishType, |
|
|
|
Minute = y.Minute, |
|
|
|
RecipeId = y.RecipeId, |
|
|
|
RecipeNumber = y.RecipeNumber, |
|
|
|
Recipes = y.Recipes, |
|
|
|
Second = y.Second |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
if (mORKM.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
mORKM.TakeBowlTask.Enqueue(new OrderLocInfo() |
|
|
|
{ |
|
|
|
GoodName = order.MorkOrder.GoodsName, |
|
|
|
Loc = 11, |
|
|
|
SuborderId = order.MorkOrder.SuborderId, |
|
|
|
SortNum = order.MorkOrder.SortNum, |
|
|
|
}); |
|
|
|
|
|
|
|
if (!mORKM.SuborderCount.ContainsKey(order.MorkOrder.SuborderId)) |
|
|
|
{ |
|
|
|
mORKM.SuborderCount.TryAdd(order.MorkOrder.SuborderId, new SuborderInfo() |
|
|
|
{ |
|
|
|
ActualCount = oli.Count, |
|
|
|
AcMeatDishesCount = oli.Where(p => p.LocDishType == 0).ToList().Count, |
|
|
|
AcVegetableCount = oli.Where(p => p.LocDishType == 1).ToList().Count, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
//if (mORKM.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null) |
|
|
|
// mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() |
|
|
|
// { |
|
|
|
// GoodName = order.MorkOrder.GoodsName, |
|
|
|
// Loc = ushort.Parse(res.BatchingLoc), |
|
|
|
// SuborderId = order.MorkOrder.SuborderId, |
|
|
|
// SortNum = order.MorkOrder.SortNum, |
|
|
|
// BatchingId = res.BatchingId |
|
|
|
// }); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@@ -575,18 +644,15 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
{ |
|
|
|
if (mORKM.CurrentLoc == mORKM.CurrentFeedbackLoc) |
|
|
|
{ |
|
|
|
//int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置 |
|
|
|
int loc = mORKM.nsm.ToList().FindIndex(p => p.NoodleCookerStatus == false && p.IsShield == false);//查找煮面炉空闲位置 |
|
|
|
if (loc >= 0 && loc <= 5) |
|
|
|
{ |
|
|
|
//if (!Json<MorksPar>.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽 |
|
|
|
//{ |
|
|
|
if (mORKM.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) |
|
|
|
if (mORKM.RBTakeNoodleTask.TryDequeue(out MOrderLocInfo orderLocInfo)) |
|
|
|
{ |
|
|
|
//写入煮面时间 |
|
|
|
List<ushort> values = new List<ushort>(); |
|
|
|
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute); |
|
|
|
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second); |
|
|
|
values.Add(orderLocInfo.Minute); |
|
|
|
values.Add(orderLocInfo.Second); |
|
|
|
WriteData($"VW{324 + (loc * 4)}", values.ToArray()); |
|
|
|
|
|
|
|
mORKM.CurrentLoc = 0; |
|
|
@@ -597,6 +663,14 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); |
|
|
|
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); |
|
|
|
|
|
|
|
if (mORKM.SuborderCount.ContainsKey(orderLocInfo.SuborderId)) |
|
|
|
{ |
|
|
|
if (orderLocInfo.LocDishType == 0) |
|
|
|
mORKM.SuborderCount[orderLocInfo.SuborderId].MeatDishesLoc.Add(loc + 1); |
|
|
|
else if (orderLocInfo.LocDishType == 1) |
|
|
|
mORKM.SuborderCount[orderLocInfo.SuborderId].VegetableLoc.Add(loc + 1); |
|
|
|
} |
|
|
|
|
|
|
|
mORKM.TakeNoodleInterlock = true; |
|
|
|
} |
|
|
|
} |
|
|
@@ -609,28 +683,89 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
/// </summary> |
|
|
|
private void OutNoodleTask() |
|
|
|
{ |
|
|
|
if (mORKM.AllowInvertedFace && mORKM.RobotTaskInterlock && !mORKM.TakeNoodleInterlock && mORKM.RobotStatus) |
|
|
|
if (mORKM.AllowInvertedFace && !mORKM.RobotOutDinnigLock && mORKM.RobotTaskInterlock && !mORKM.TakeNoodleInterlock && mORKM.RobotStatus) |
|
|
|
{ |
|
|
|
int loc = Array.FindIndex(mORKM.CookNodelId, p => p == mORKM.IngredientsCompleteId && p.Length > 0); |
|
|
|
if (loc >= 0 && loc <= 5) |
|
|
|
for (int i = 0; i < mORKM.CookNodelId.Length; i++) |
|
|
|
{ |
|
|
|
if (mORKM.CookNoodleCom[loc]) |
|
|
|
if (mORKM.CookNodelId[i] == mORKM.IngredientsCompleteId && !string.IsNullOrEmpty(mORKM.CookNodelId[i])) |
|
|
|
{ |
|
|
|
SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
mORKM.NoodleCookerStatus[loc] = false; |
|
|
|
WriteData($"VW260", (ushort)0);//设置出汤时间 |
|
|
|
OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成"); |
|
|
|
mORKM.CookCompleteFlatBit = true; |
|
|
|
mORKM.OutMealId = mORKM.IngredientsCompleteId; |
|
|
|
mORKM.OutMealName = mORKM.IngredientsCompleteName; |
|
|
|
mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum; |
|
|
|
mORKM.IngredientsCompleteId = string.Empty; |
|
|
|
mORKM.CookNodelId[loc] = string.Empty; |
|
|
|
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKM.OutMealId}"); |
|
|
|
mORKM.CookNoodleCom[loc] = false; |
|
|
|
if (mORKM.CookNoodleCom[i] && mORKM.SuborderCount.ContainsKey(mORKM.CookNodelId[i])) |
|
|
|
{ |
|
|
|
var x = mORKM.SuborderCount[mORKM.CookNodelId[i]]; |
|
|
|
|
|
|
|
//执行取素菜操作 |
|
|
|
if (x.AcVegetableCount != x.CuVegetableCount) |
|
|
|
{ |
|
|
|
int index = x.VegetableLoc.FindIndex(p => p == i + 1); |
|
|
|
if (index >= 0) |
|
|
|
{ |
|
|
|
//SetTakeNoodleLoc((ushort)(index + 1)); |
|
|
|
SetTakeNoodleLoc((ushort)(x.VegetableLoc.ElementAt(index))); |
|
|
|
mORKM.NoodleCookerStatus[i] = false; |
|
|
|
WriteData($"VW260", (ushort)0);//设置出汤时间 |
|
|
|
DeviceProcessLogShow($"{x.VegetableLoc.ElementAt(index)} 号位置-[素菜]-出餐控制,订单ID:{mORKM.CookNodelId[i]}"); |
|
|
|
mORKM.CookNodelId[i] = string.Empty; |
|
|
|
mORKM.CookNoodleCom[i] = false; |
|
|
|
x.VegetableLoc.RemoveAt(index); |
|
|
|
x.CuVegetableCount++; |
|
|
|
mORKM.RobotOutDinnigLock = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//执行取荤菜 |
|
|
|
if (x.AcVegetableCount == x.CuVegetableCount && x.AcMeatDishesCount != x.CuMeatDishesCount) |
|
|
|
{ |
|
|
|
int index = x.MeatDishesLoc.FindIndex(p => p == i + 1); |
|
|
|
if (index >= 0) |
|
|
|
{ |
|
|
|
//SetTakeNoodleLoc((ushort)(index + 1)); |
|
|
|
SetTakeNoodleLoc((ushort)(x.VegetableLoc.ElementAt(index))); |
|
|
|
mORKM.NoodleCookerStatus[i] = false; |
|
|
|
WriteData($"VW260", (ushort)0);//设置出汤时间 |
|
|
|
DeviceProcessLogShow($"{x.VegetableLoc.ElementAt(index)} 号位置-[荤菜]-出餐控制,订单ID:{mORKM.CookNodelId[i]}"); |
|
|
|
mORKM.CookNodelId[i] = string.Empty; |
|
|
|
mORKM.CookNoodleCom[i] = false; |
|
|
|
x.MeatDishesLoc.RemoveAt(index); |
|
|
|
x.CuMeatDishesCount++; |
|
|
|
mORKM.RobotOutDinnigLock = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//if (x.CuMeatDishesCount + x.CuVegetableCount == x.ActualCount) |
|
|
|
//{ |
|
|
|
// OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
// DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成"); |
|
|
|
// mORKM.CookCompleteFlatBit = true; |
|
|
|
// mORKM.OutMealId = mORKM.IngredientsCompleteId; |
|
|
|
// mORKM.OutMealName = mORKM.IngredientsCompleteName; |
|
|
|
// mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum; |
|
|
|
// mORKM.IngredientsCompleteId = string.Empty; |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//int loc = Array.FindIndex(mORKM.CookNodelId, p => p == mORKM.IngredientsCompleteId && p.Length > 0); |
|
|
|
//if (loc >= 0 && loc <= 5) |
|
|
|
//{ |
|
|
|
// if (mORKM.CookNoodleCom[loc]) |
|
|
|
// { |
|
|
|
// SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
// mORKM.NoodleCookerStatus[loc] = false; |
|
|
|
// WriteData($"VW260", (ushort)0);//设置出汤时间 |
|
|
|
// OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
// DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成"); |
|
|
|
// mORKM.CookCompleteFlatBit = true; |
|
|
|
// mORKM.OutMealId = mORKM.IngredientsCompleteId; |
|
|
|
// mORKM.OutMealName = mORKM.IngredientsCompleteName; |
|
|
|
// mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum; |
|
|
|
// mORKM.IngredientsCompleteId = string.Empty; |
|
|
|
// mORKM.CookNodelId[loc] = string.Empty; |
|
|
|
// DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKM.OutMealId}"); |
|
|
|
// mORKM.CookNoodleCom[loc] = false; |
|
|
|
// } |
|
|
|
//} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -677,6 +812,27 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
DeviceProcessLogShow("机器人取面完成信号检测"); |
|
|
|
} |
|
|
|
|
|
|
|
if (RTrig.GetInstance("RobotInvertedSurfaceCom").Start(mORKM.RobotInvertedSurfaceCom)) |
|
|
|
{ |
|
|
|
if (mORKM.SuborderCount.ContainsKey(mORKM.IngredientsCompleteId)) |
|
|
|
{ |
|
|
|
var x = mORKM.SuborderCount[mORKM.IngredientsCompleteId]; |
|
|
|
if (x.CuMeatDishesCount + x.CuVegetableCount == x.ActualCount) |
|
|
|
{ |
|
|
|
OrderChange(mORKM.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
DeviceProcessLogShow($"订单【{mORKM.IngredientsCompleteId}】制作完成"); |
|
|
|
mORKM.CookCompleteFlatBit = true; |
|
|
|
mORKM.OutMealId = mORKM.IngredientsCompleteId; |
|
|
|
mORKM.OutMealName = mORKM.IngredientsCompleteName; |
|
|
|
mORKM.OutMealSortNum = mORKM.IngredientsCompleteSortNum; |
|
|
|
mORKM.IngredientsCompleteId = string.Empty; |
|
|
|
CookComplete(); |
|
|
|
DeviceProcessLogShow($"倒面完成"); |
|
|
|
} |
|
|
|
} |
|
|
|
mORKM.RobotOutDinnigLock = false; |
|
|
|
} |
|
|
|
|
|
|
|
int OutMealRequstCount = mORKM.CookNoodleCom.Where(p => p == true).ToList().Count; |
|
|
|
//int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count - Json<MorksPar>.Data.parSets.Where(x => x.IsShield == true).ToList().Count; |
|
|
|
int mlCount = mORKM.nsm.Where(p => p.NoodleCookerStatus == true && p.IsShield == false).ToList().Count; |
|
|
@@ -770,6 +926,14 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
WriteData($"M15.{loc - 1}", true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 上位机单订单执行完成 |
|
|
|
/// </summary> |
|
|
|
private void CookComplete() |
|
|
|
{ |
|
|
|
WriteData("M11.0", true); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void SimOrder() |
|
|
@@ -781,7 +945,7 @@ namespace BPASmartClient.MorkMV1 |
|
|
|
string guid = Guid.NewGuid().ToString(); |
|
|
|
if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5) |
|
|
|
{ |
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }); |
|
|
|
mORKM.RBTakeNoodleTask.Enqueue(new MOrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid }); |
|
|
|
MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】"); |
|
|
|
} |
|
|
|
|
|
|
|