From 9f00f934f652f5d7c549d966efcd22ce01c46a67 Mon Sep 17 00:00:00 2001 From: taoye Date: Mon, 28 Mar 2022 16:24:20 +0800 Subject: [PATCH] GGG --- HBLConsole.MORKD/Control_MORKD.cs | 46 +++++++++++++++++++++++-------- HBLConsole.MORKD/GVL_MORKD.cs | 2 +- 2 files changed, 35 insertions(+), 13 deletions(-) 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); }