diff --git a/HBLConsole.MORKD/Control_MORKD.cs b/HBLConsole.MORKD/Control_MORKD.cs index b760cb2..290cef8 100644 --- a/HBLConsole.MORKD/Control_MORKD.cs +++ b/HBLConsole.MORKD/Control_MORKD.cs @@ -255,7 +255,7 @@ namespace HBLConsole.MORKD mORKD.DropBowlStart((ushort)(mORKD.AxisIdleIndex + 1), orderLocInfo.Loc); mORKD.AxisIdleLock[mORKD.AxisIdleLockIndex] = true; MessageLog.GetInstance.Show($"执行取碗控制,碗位置:[{orderLocInfo.Loc}],轴位置:[{mORKD.AxisIdleIndex + 1}]"); - MessageLog.GetInstance.Show($"{mORKD.AxisIdleIndex}号轴订单ID:[{orderLocInfo.SuborderId}]"); + MessageLog.GetInstance.Show($"{mORKD.AxisIdleIndex + 1}号轴订单ID:[{orderLocInfo.SuborderId}]"); } } } @@ -269,15 +269,18 @@ namespace HBLConsole.MORKD { if (mORKD.TurntableInPlace && mORKD.InitComplete && !mORKD.AllowTakeNoodle && mORKD.RBTakeNoodleTask.Count > 0) { + var result = Json.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKD.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); + if (mORKD.TurntableLowerLimit) { - if (mORKD.TurntableFeedbackloc == mORKD.RBTakeNoodleTask.ElementAt(0).Loc) + + if (mORKD.TurntableFeedbackloc == mORKD.RBTakeNoodleTask.ElementAt(0).Loc || (result?.Count > 0 && result?.Count == mORKD.TurntableLocLists.Count)) { mORKD.TurntableLocLists.Clear(); mORKD.AllowTakeNoodle = true; MessageLog.GetInstance.Show("转台位置OK,执行机器人取面"); } - else + else { if (!mORKD.TurntableInterlock) { @@ -290,20 +293,39 @@ namespace HBLConsole.MORKD { if (!mORKD.TurntableInterlock) { - var result = Json.Data.orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKD.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList(); - result?.ForEach(item => + + + if (result!= null) { - if (ushort.TryParse(item.BatchingLoc, out ushort loc)) + foreach (var item in result) { - if (mORKD.TurntableFeedbackloc != loc && !mORKD.TurntableLocLists.Contains(loc)) + if (ushort.TryParse(item.BatchingLoc, out ushort loc)) { - mORKD.TurntableStart(loc); - MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); - return; + if (mORKD.TurntableFeedbackloc != loc && !mORKD.TurntableLocLists.Contains(loc)) + { + mORKD.TurntableStart(loc); + MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); + break; + } + else if (mORKD.TurntableFeedbackloc == loc && !mORKD.TurntableLocLists.Contains(loc)) mORKD.TurntableLocLists.Add(loc); } - else if (mORKD.TurntableFeedbackloc == loc) mORKD.TurntableLocLists.Add(loc); } - }); + } + + + //result?.ForEach(item => + //{ + // if (ushort.TryParse(item.BatchingLoc, out ushort loc)) + // { + // if (mORKD.TurntableFeedbackloc != loc && !mORKD.TurntableLocLists.Contains(loc)) + // { + // mORKD.TurntableStart(loc); + // MessageLog.GetInstance.Show($"没有物料检测的启动转台控制,转台位置:[{loc}]"); + // return; + // } + // else if (mORKD.TurntableFeedbackloc == loc) mORKD.TurntableLocLists.Add(loc); + // } + //}); } } diff --git a/HBLConsole.MORKD/GVL_MORKD.cs b/HBLConsole.MORKD/GVL_MORKD.cs index e738d2a..6e5f7f9 100644 --- a/HBLConsole.MORKD/GVL_MORKD.cs +++ b/HBLConsole.MORKD/GVL_MORKD.cs @@ -85,7 +85,7 @@ namespace HBLConsole.MORKD { this.TurntableLoc = TurntableLoc; TurntableInterlock = true; - TurntableLocLists.Add(TurntableLoc); + if (!TurntableLocLists.Contains(TurntableLoc)) TurntableLocLists.Add(TurntableLoc); ModbusTcpHelper.GetInstance.Write(100, WriteType.HoldingRegisters, TurntableLoc); ModbusTcpHelper.GetInstance.Write(325, WriteType.Coils, true); }