|
|
@@ -373,7 +373,7 @@ namespace HBLConsole.MORKM |
|
|
|
mORKS.TakeBowlId = orderLocInfo.SuborderId; |
|
|
|
TakeBowlControl(orderLocInfo.Loc); |
|
|
|
SetRecipeNumber(orderLocInfo.RecipeNumber); |
|
|
|
SimpleFactory.GetInstance.OrderChanged(mORKS.TakeBowlId, ORDER_STATUS.COOKING); |
|
|
|
// SimpleFactory.GetInstance.OrderChanged(mORKS.TakeBowlId, ORDER_STATUS.COOKING); |
|
|
|
MessageLog.GetInstance.Show($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]"); |
|
|
|
} |
|
|
|
mORKS.TakeBowlInterlock = true; |
|
|
@@ -469,16 +469,20 @@ namespace HBLConsole.MORKM |
|
|
|
//取面控制 |
|
|
|
if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0) |
|
|
|
{ |
|
|
|
|
|
|
|
int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置 |
|
|
|
if (loc >= 0 && loc <= 5) |
|
|
|
{ |
|
|
|
|
|
|
|
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo)) |
|
|
|
{ |
|
|
|
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; |
|
|
|
|
|
|
|
// mORKS.CookNodelId[loc] = orderLocInfo.SuborderId; |
|
|
|
mORKS.orderLocInfos[loc] = orderLocInfo; |
|
|
|
SetFallNoodleLoc((ushort)(loc + 1)); |
|
|
|
//机器人开始取面 |
|
|
|
RobotTakeNoodle(); |
|
|
|
SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); |
|
|
|
// SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING); |
|
|
|
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏"); |
|
|
|
|
|
|
|
//写入煮面时间 |
|
|
@@ -490,6 +494,7 @@ namespace HBLConsole.MORKM |
|
|
|
mORKS.TakeNoodleInterlock = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -500,267 +505,446 @@ namespace HBLConsole.MORKM |
|
|
|
{ |
|
|
|
if (mORKS.AllowFallNoodle && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotIdle && !mORKS.TakeMealDetect) |
|
|
|
{ |
|
|
|
int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); |
|
|
|
|
|
|
|
int loc = 0; |
|
|
|
mORKS.exlusion = false; |
|
|
|
//int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); |
|
|
|
if (Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0) == -1) |
|
|
|
{ |
|
|
|
loc = -1; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (mORKS.orderLocInfos[Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)].Loc % 2 != 0 && mORKS.orderLocInfos[Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)].Loc % 2 != 0 && Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0) != Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0)) |
|
|
|
{ |
|
|
|
loc = Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); |
|
|
|
mORKS.AllMeat = true; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (mORKS.Count > 0) |
|
|
|
{ |
|
|
|
loc = Array.FindLastIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
loc = Array.FindIndex(mORKS.orderLocInfos, p => p != null && p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// int locLast= Array.FindLastIndex(mORKS.orderLocInfos, p => p.SuborderId == mORKS.IngredientsCompleteId && p.SuborderId.Length > 0); |
|
|
|
//string[] number = Array.FindAll(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0); |
|
|
|
|
|
|
|
//List<int> list = new List<int>();//存储位置信息 |
|
|
|
//for (int i = 0; i < mORKS.CookNodelId.Length; i++) |
|
|
|
//{ |
|
|
|
// if ((mORKS.CookNodelId[i] == mORKS.IngredientsCompleteId) && mORKS.CookNodelId[i].Length > 0) |
|
|
|
// { |
|
|
|
// list.Add(i); |
|
|
|
// } |
|
|
|
//} |
|
|
|
//for (int j = 0; j < list.Count; j++) |
|
|
|
//{ |
|
|
|
// if (list[j] >= 0 && list[j] <= 5) |
|
|
|
// { |
|
|
|
// if (mORKS.CookNoodlesComplete[list[j]]) |
|
|
|
// { |
|
|
|
// SetTakeNoodleLoc((ushort)(list[j] + 1)); |
|
|
|
// RobotOutMeal(); |
|
|
|
// CookNoodleStatusReset((ushort)(list[j] + 1)); |
|
|
|
// ResetAllowFallNoodle(); |
|
|
|
// mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
// mORKS.CookNodelId[list[j]] = string.Empty; |
|
|
|
// MessageLog.GetInstance.Show($"{list[j] + 1}号位置出餐控制"); |
|
|
|
// mORKS.OutNoodleing = true; |
|
|
|
// } |
|
|
|
// } |
|
|
|
//} |
|
|
|
|
|
|
|
//if (mORKS.CookNodelId.GetIndex(mORKS.OutMealId) < 0) |
|
|
|
//{ |
|
|
|
// mORKS.IngredientsCompleteId = string.Empty; |
|
|
|
// CookComplete();//告诉机器人冒菜已经煮完 |
|
|
|
//} |
|
|
|
//-----------------------------------------------------------------------// |
|
|
|
if (loc >= 0 && loc <= 5) |
|
|
|
{ |
|
|
|
if (mORKS.CookNoodlesComplete[loc]) |
|
|
|
{ |
|
|
|
SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
RobotOutMeal(); |
|
|
|
CookNoodleStatusReset((ushort)(loc + 1)); |
|
|
|
ResetAllowFallNoodle(); |
|
|
|
mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
mORKS.IngredientsCompleteId = string.Empty; |
|
|
|
mORKS.CookNodelId[loc] = string.Empty; |
|
|
|
|
|
|
|
if (mORKS.CookNodelId.GetIndex(mORKS.OutMealId) < 0) |
|
|
|
|
|
|
|
if (mORKS.orderLocInfos[loc].Loc % 2 == 0)//素 |
|
|
|
{ |
|
|
|
SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
RobotOutMeal(); |
|
|
|
CookNoodleStatusReset((ushort)(loc + 1)); |
|
|
|
// ResetAllowFallNoodle(); |
|
|
|
mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
// mORKS.CookNodelId[loc] = string.Empty; |
|
|
|
mORKS.orderLocInfos[loc] = null; |
|
|
|
mORKS.Count++; |
|
|
|
MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); |
|
|
|
mORKS.OutNoodleing = true; |
|
|
|
mORKS.Num = 0; |
|
|
|
foreach (var item in mORKS.orderLocInfos) |
|
|
|
{ |
|
|
|
if (item != null) |
|
|
|
{ |
|
|
|
if (item.SuborderId == mORKS.OutMealId) |
|
|
|
{ |
|
|
|
mORKS.Num++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (mORKS.Num != 0) |
|
|
|
Thread.Sleep(3000); |
|
|
|
} |
|
|
|
else if (mORKS.Count > 0&&mORKS.orderLocInfos[loc].Loc % 2 != 0)//荤 |
|
|
|
{ |
|
|
|
SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
RobotOutMeal(); |
|
|
|
CookNoodleStatusReset((ushort)(loc + 1)); |
|
|
|
// ResetAllowFallNoodle(); |
|
|
|
mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
// mORKS.CookNodelId[loc] = string.Empty; |
|
|
|
mORKS.orderLocInfos[loc] = null; |
|
|
|
mORKS.Count++; |
|
|
|
MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); |
|
|
|
mORKS.OutNoodleing = true; |
|
|
|
//Thread.Sleep(3000); |
|
|
|
//------------------------// |
|
|
|
mORKS.Num = 0; |
|
|
|
foreach (var item in mORKS.orderLocInfos) |
|
|
|
{ |
|
|
|
if (item != null) |
|
|
|
{ |
|
|
|
if (item.SuborderId == mORKS.OutMealId) |
|
|
|
{ |
|
|
|
mORKS.Num++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (mORKS.Num == 0) |
|
|
|
{ |
|
|
|
|
|
|
|
CookComplete(); //告诉机器人冒菜已经煮完 |
|
|
|
ResetAllowFallNoodle(); |
|
|
|
mORKS.exlusion = true; |
|
|
|
mORKS.Count = 0; |
|
|
|
mORKS.IngredientsCompleteId = string.Empty; |
|
|
|
mORKS.TakeBowlId = string.Empty; |
|
|
|
mORKS.TakeBowlInterlock = false; |
|
|
|
//IsAddSoup();//判断是否加汤 |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
if (mORKS.AllMeat) |
|
|
|
{ |
|
|
|
SetTakeNoodleLoc((ushort)(loc + 1)); |
|
|
|
RobotOutMeal(); |
|
|
|
CookNoodleStatusReset((ushort)(loc + 1)); |
|
|
|
// ResetAllowFallNoodle(); |
|
|
|
mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
// mORKS.CookNodelId[loc] = string.Empty; |
|
|
|
mORKS.orderLocInfos[loc] = null; |
|
|
|
// mORKS.Count++; |
|
|
|
MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); |
|
|
|
mORKS.OutNoodleing = true; |
|
|
|
|
|
|
|
mORKS.Num = 0; |
|
|
|
foreach (var item in mORKS.orderLocInfos) |
|
|
|
{ |
|
|
|
if (item != null) |
|
|
|
{ |
|
|
|
if (item.SuborderId == mORKS.OutMealId) |
|
|
|
{ |
|
|
|
mORKS.Num++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (mORKS.Num != 0) |
|
|
|
Thread.Sleep(3000); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
mORKS.Count++; |
|
|
|
mORKS.OutMealId = mORKS.IngredientsCompleteId; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
mORKS.Num = 0; |
|
|
|
foreach (var item in mORKS.orderLocInfos) |
|
|
|
{ |
|
|
|
if (item != null) |
|
|
|
{ |
|
|
|
if (item.SuborderId == mORKS.OutMealId) |
|
|
|
{ |
|
|
|
mORKS.Num++; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (mORKS.Num == 0&&mORKS.exlusion==false) |
|
|
|
{ |
|
|
|
|
|
|
|
CookComplete(); //告诉机器人冒菜已经煮完 |
|
|
|
ResetAllowFallNoodle(); |
|
|
|
mORKS.AllMeat = false; |
|
|
|
mORKS.Count = 0; |
|
|
|
mORKS.IngredientsCompleteId = string.Empty; |
|
|
|
mORKS.TakeBowlId = string.Empty; |
|
|
|
mORKS.TakeBowlInterlock = false; |
|
|
|
//IsAddSoup();//判断是否加汤 |
|
|
|
} |
|
|
|
|
|
|
|
MessageLog.GetInstance.Show($"{loc + 1}号位置出餐控制"); |
|
|
|
mORKS.OutNoodleing = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 信号检测 |
|
|
|
/// </summary> |
|
|
|
private void SingleDetect() |
|
|
|
{ |
|
|
|
//允许倒面信号检测 |
|
|
|
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) |
|
|
|
/// <summary> |
|
|
|
/// 信号检测 |
|
|
|
/// </summary> |
|
|
|
private void SingleDetect() |
|
|
|
{ |
|
|
|
mORKS.IngredientsCompleteId = mORKS.TakeBowlId; |
|
|
|
mORKS.TakeBowlId = string.Empty; |
|
|
|
MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); |
|
|
|
mORKS.TakeBowlInterlock = false; |
|
|
|
} |
|
|
|
//允许倒面信号检测 |
|
|
|
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle)) |
|
|
|
{ |
|
|
|
mORKS.IngredientsCompleteId = mORKS.TakeBowlId; |
|
|
|
// mORKS.TakeBowlId = string.Empty; |
|
|
|
MessageLog.GetInstance.Show("碗到位,允许到面"); |
|
|
|
//MessageLog.GetInstance.Show($"碗到位,允许到面,{mORKS.IngredientsCompleteId}"); |
|
|
|
// mORKS.TakeBowlInterlock = false; |
|
|
|
} |
|
|
|
|
|
|
|
//出餐完成信号检测 |
|
|
|
if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete)) |
|
|
|
{ |
|
|
|
SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成"); |
|
|
|
mORKS.OutNoodleing = false; |
|
|
|
} |
|
|
|
//出餐完成信号检测 |
|
|
|
if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete)) |
|
|
|
{ |
|
|
|
// SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK); |
|
|
|
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】制作完成"); |
|
|
|
mORKS.OutNoodleing = false; |
|
|
|
} |
|
|
|
|
|
|
|
//取餐完成逻辑处理 |
|
|
|
if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) |
|
|
|
{ |
|
|
|
SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); |
|
|
|
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】取餐完成"); |
|
|
|
ResetCookComplete(); |
|
|
|
mORKS.OutMealId = string.Empty; |
|
|
|
} |
|
|
|
//取餐完成逻辑处理 |
|
|
|
if (DelayRTrig.GetInstance("CompleteChange1").Start(mORKS.RbOutMealComplete && !mORKS.TakeMealDetect, 2)) |
|
|
|
{ |
|
|
|
// SimpleFactory.GetInstance.OrderChanged(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE); |
|
|
|
MessageLog.GetInstance.Show($"订单【{mORKS.OutMealId}】取餐完成"); |
|
|
|
ResetCookComplete(); |
|
|
|
mORKS.OutMealId = string.Empty; |
|
|
|
} |
|
|
|
|
|
|
|
//机器人取面完成信号检测 |
|
|
|
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete)) |
|
|
|
{ |
|
|
|
mORKS.TakeNoodleInterlock = false; |
|
|
|
mORKS.AllowTakeNoodle = false; |
|
|
|
mORKS.TurntableInterlock = false; |
|
|
|
MessageLog.GetInstance.Show("机器人取面完成信号检测"); |
|
|
|
TakeNoodleCompleteReset(); |
|
|
|
} |
|
|
|
//机器人取面完成信号检测 |
|
|
|
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete)) |
|
|
|
{ |
|
|
|
mORKS.TakeNoodleInterlock = false; |
|
|
|
mORKS.AllowTakeNoodle = false; |
|
|
|
mORKS.TurntableInterlock = false; |
|
|
|
MessageLog.GetInstance.Show("机器人取面完成信号检测"); |
|
|
|
TakeNoodleCompleteReset(); |
|
|
|
} |
|
|
|
|
|
|
|
//转台到位检测 |
|
|
|
//if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace)) |
|
|
|
//{ |
|
|
|
// mORKS.TurntableInterlock = false; |
|
|
|
//} |
|
|
|
//转台到位检测 |
|
|
|
//if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace)) |
|
|
|
//{ |
|
|
|
// mORKS.TurntableInterlock = false; |
|
|
|
//} |
|
|
|
|
|
|
|
int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count; |
|
|
|
int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count; |
|
|
|
mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0); |
|
|
|
} |
|
|
|
int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count; |
|
|
|
int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count; |
|
|
|
mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >=2 || mORKS.RBTakeNoodleTask.Count == 0); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region PLC 控制函数 |
|
|
|
#region PLC 控制函数 |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 写入配方数据到 PLC |
|
|
|
/// </summary> |
|
|
|
private void WriteRecipeBoms() |
|
|
|
{ |
|
|
|
List<ushort> recipeBoms = new List<ushort>(); |
|
|
|
if (Json<BatchingInfoPar>.Data.recipeBoms == null) return; |
|
|
|
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds) |
|
|
|
/// <summary> |
|
|
|
/// 写入配方数据到 PLC |
|
|
|
/// </summary> |
|
|
|
private void WriteRecipeBoms() |
|
|
|
{ |
|
|
|
foreach (var rec in item.Recipes) |
|
|
|
List<ushort> recipeBoms = new List<ushort>(); |
|
|
|
if (Json<BatchingInfoPar>.Data.recipeBoms == null) return; |
|
|
|
foreach (var item in Json<BatchingInfoPar>.Data.recipeBoms.RecipeIds) |
|
|
|
{ |
|
|
|
recipeBoms.Add((ushort)rec); |
|
|
|
foreach (var rec in item.Recipes) |
|
|
|
{ |
|
|
|
recipeBoms.Add((ushort)rec); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (recipeBoms.Count > 0) |
|
|
|
{ |
|
|
|
if (ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray())) |
|
|
|
if (recipeBoms.Count > 0) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show("成功写入配方数据"); |
|
|
|
if (ModbusTcpHelper.GetInstance.Write(1100, WriteType.HoldingRegisters, recipeBoms.ToArray())) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show("成功写入配方数据"); |
|
|
|
} |
|
|
|
} |
|
|
|
else { MessageLog.GetInstance.Show("配方数据为空"); } |
|
|
|
} |
|
|
|
else { MessageLog.GetInstance.Show("配方数据为空"); } |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 转台移动 |
|
|
|
/// </summary> |
|
|
|
//private void MoveTurntable() |
|
|
|
//{ |
|
|
|
// //ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); |
|
|
|
//} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 取面完成复位 |
|
|
|
/// </summary> |
|
|
|
private void TakeNoodleCompleteReset() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 转台移动 |
|
|
|
/// </summary> |
|
|
|
//private void MoveTurntable() |
|
|
|
//{ |
|
|
|
// //ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); |
|
|
|
//} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 指定煮面口状态复位 |
|
|
|
/// </summary> |
|
|
|
/// <param name="num"></param> |
|
|
|
private void CookNoodleStatusReset(int num) |
|
|
|
{ |
|
|
|
if (num >= 1 && num <= 6) |
|
|
|
/// <summary> |
|
|
|
/// 取面完成复位 |
|
|
|
/// </summary> |
|
|
|
private void TakeNoodleCompleteReset() |
|
|
|
{ |
|
|
|
ushort addRess = (ushort)(1136 + num - 1); |
|
|
|
ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false); |
|
|
|
MessageLog.GetInstance.Show($"{num}号煮面口占用复位"); |
|
|
|
ModbusTcpHelper.GetInstance.Write(1124, WriteType.Coils, false); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 写配方编号 |
|
|
|
/// </summary> |
|
|
|
/// <param name="num"></param> |
|
|
|
private void SetRecipeNumber(ushort num) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 启动转台 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void TurntableStart(ushort loc) |
|
|
|
{ |
|
|
|
mORKS.CurrentLoc = loc; |
|
|
|
mORKS.TurntableInterlock = true; |
|
|
|
mORKS.TurntableLocLists.Add(loc); |
|
|
|
ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc); |
|
|
|
ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 指定煮面口状态复位 |
|
|
|
/// </summary> |
|
|
|
/// <param name="num"></param> |
|
|
|
private void CookNoodleStatusReset(int num) |
|
|
|
{ |
|
|
|
if (num >= 1 && num <= 6) |
|
|
|
{ |
|
|
|
ushort addRess = (ushort)(1136 + num - 1); |
|
|
|
ModbusTcpHelper.GetInstance.Write(addRess, WriteType.Coils, false); |
|
|
|
MessageLog.GetInstance.Show($"{num}号煮面口占用复位"); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 设置倒面位置 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void SetFallNoodleLoc(ushort loc) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 设置取面位置 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void SetTakeNoodleLoc(ushort loc) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 写配方编号 |
|
|
|
/// </summary> |
|
|
|
/// <param name="num"></param> |
|
|
|
private void SetRecipeNumber(ushort num) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, num); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 取碗控制 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void TakeBowlControl(ushort loc) |
|
|
|
{ |
|
|
|
if (loc == 10)//小碗 |
|
|
|
/// <summary> |
|
|
|
/// 启动转台 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void TurntableStart(ushort loc) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true); |
|
|
|
mORKS.CurrentLoc = loc; |
|
|
|
mORKS.TurntableInterlock = true; |
|
|
|
mORKS.TurntableLocLists.Add(loc); |
|
|
|
ModbusTcpHelper.GetInstance.Write(101, WriteType.HoldingRegisters, loc); |
|
|
|
ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); |
|
|
|
} |
|
|
|
else if (loc == 11)//大碗 |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 设置倒面位置 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void SetFallNoodleLoc(ushort loc) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true); |
|
|
|
ModbusTcpHelper.GetInstance.Write(102, WriteType.HoldingRegisters, loc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 机器人取面 |
|
|
|
/// </summary> |
|
|
|
private void RobotTakeNoodle() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 设置取面位置 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void SetTakeNoodleLoc(ushort loc) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(103, WriteType.HoldingRegisters, loc); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 机器人取餐 |
|
|
|
/// </summary> |
|
|
|
private void RobotOutMeal() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); |
|
|
|
var result = ModbusTcpHelper.GetInstance.Read(324, ReadType.Coils); |
|
|
|
if (result is bool res) |
|
|
|
while (!res) |
|
|
|
/// <summary> |
|
|
|
/// 取碗控制 |
|
|
|
/// </summary> |
|
|
|
/// <param name="loc"></param> |
|
|
|
private void TakeBowlControl(ushort loc) |
|
|
|
{ |
|
|
|
if (loc == 10)//小碗 |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); |
|
|
|
ModbusTcpHelper.GetInstance.Write(321, WriteType.Coils, true); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (loc == 11)//大碗 |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(322, WriteType.Coils, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 制作完成信号复位 |
|
|
|
/// </summary> |
|
|
|
private void ResetCookComplete() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 机器人取面 |
|
|
|
/// </summary> |
|
|
|
private void RobotTakeNoodle() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(323, WriteType.Coils, true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 复位允许取面信号 |
|
|
|
/// </summary> |
|
|
|
private void ResetAllowFallNoodle() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 机器人取餐 |
|
|
|
/// </summary> |
|
|
|
private void RobotOutMeal() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); |
|
|
|
var result = ModbusTcpHelper.GetInstance.Read(324, ReadType.Coils); |
|
|
|
if (result is bool res) |
|
|
|
while (!res) |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(324, WriteType.Coils, true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 设备初始化 |
|
|
|
/// </summary> |
|
|
|
public async void DeviceInit() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true); |
|
|
|
await Task.Delay(1000); |
|
|
|
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false); |
|
|
|
/// <summary> |
|
|
|
/// 制作完成信号复位 |
|
|
|
/// </summary> |
|
|
|
private void ResetCookComplete() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(1126, WriteType.Coils, false); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 复位允许取面信号 |
|
|
|
/// </summary> |
|
|
|
private void ResetAllowFallNoodle() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(1123, WriteType.Coils, false); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 制作完成,允许机器人往外推碗 |
|
|
|
/// </summary> |
|
|
|
public void CookComplete() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 设备初始化 |
|
|
|
/// </summary> |
|
|
|
public async void DeviceInit() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, true); |
|
|
|
await Task.Delay(1000); |
|
|
|
ModbusTcpHelper.GetInstance.Write(320, WriteType.Coils, false); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 制作完成,允许机器人往外推碗 |
|
|
|
/// </summary> |
|
|
|
public void CookComplete() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.6"), WriteType.Coils, true); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 是否加汤 |
|
|
|
/// </summary> |
|
|
|
public void IsAddSoup() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 是否加汤 |
|
|
|
/// </summary> |
|
|
|
public void IsAddSoup() |
|
|
|
{ |
|
|
|
ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M0.7"), WriteType.Coils, true); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|