@@ -76,10 +76,10 @@ namespace HBLConsole.MORKS
{
ThreadManage.GetInstance.StopTask("ReadPLCData", new Action(() =>
{
//Json<KeepDataBase>.Data.orderLists.Clear();
mORKS = null;
mORKS = new GVL_MORKS();
ActionManage.GetInstance.Send("ResetProgram");
ActionManage.GetInstance.Send("ClearOrders");
ReadData();
Main();
}));
@@ -130,12 +130,13 @@ namespace HBLConsole.MORKS
var errorStatus = ModbusTcpHelper.GetInstance.Read((ushort)ModbusTcpHelper.GetInstance.GetBoolAddress("M235.0"), ReadType.Coils, 1);
if (errorStatus != null && errorStatus is bool error) mORKS.Error = error;
ModbusTcpHelper.GetInstance.Readbool(1136, 6 , new Action<bool[]>((bools) =>
ModbusTcpHelper.GetInstance.Readbool(1136, 7 , new Action<bool[]>((bools) =>
{
for (int i = 0; i < 6; i++)
{
mORKS.NoodleCookerStatus[i] = bools[i];
}
mORKS.Feeding = bools[6];
}));
ModbusTcpHelper.GetInstance.Readbool(1144, 6, new Action<bool[]>((bools) =>
@@ -339,7 +340,7 @@ namespace HBLConsole.MORKS
/// </summary>
private void TurntableControl()
{
if (mORKS.TurntableMoveInPlace && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
var result = Json<BatchingInfoPar>.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
if (result != null)
@@ -347,6 +348,7 @@ namespace HBLConsole.MORKS
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
if (mORKS.TurntableLowerLimit && res != null)
{
//if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc != mORKS.TurntableFeedbackloc)
TurntableStart(mORKS.TurntableFeedbackloc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
@@ -386,12 +388,18 @@ namespace HBLConsole.MORKS
//补料完成检测
if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
{
if (!mORKS.TurntableLowerLimit && mORKS.TurntableLocLists.Count > 0 && !mORKS.AllowTakeNoodle )
if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0 )
{
mORKS.TurntableLocLists.Clear();
mORKS.TurntableInterlock = false;
MessageLog.GetInstance.Show("补料完成检测");
}
//if (!mORKS.TurntableLowerLimit && mORKS.TurntableLocLists.Count > 0 && !mORKS.AllowTakeNoodle)
//{
// mORKS.TurntableLocLists.Clear();
// mORKS.TurntableInterlock = false;
// MessageLog.GetInstance.Show("补料完成检测");
//}
}
}
@@ -401,7 +409,7 @@ namespace HBLConsole.MORKS
private void TakeNoodleTask()
{
//取面控制
if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0)
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)
@@ -414,6 +422,12 @@ namespace HBLConsole.MORKS
RobotTakeNoodle();
SimpleFactory.GetInstance.OrderChanged(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
MessageLog.GetInstance.Show($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
//写入煮面时间
//List<ushort> values = new List<ushort>();
//values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Minute);
//values.Add(Json<KeepDataBase>.Data.parSets.ElementAt(loc).Second);
//ModbusTcpHelper.GetInstance.Write((ushort)ModbusTcpHelper.GetInstance.GetWordAddress($"VW{116 + (loc * 6)}"), WriteType.HoldingRegisters, values.ToArray());
mORKS.TakeNoodleInterlock = true;
}
}
@@ -457,7 +471,7 @@ namespace HBLConsole.MORKS
{
mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
mORKS.TakeBowlId = string.Empty;
MessageLog.GetInstance.Show($"允许到面,{mORKS.IngredientsCompleteId}");
MessageLog.GetInstance.Show($"碗到位, 允许到面,{mORKS.IngredientsCompleteId}");
mORKS.TakeBowlInterlock = false;
}