diff --git a/Rs.SkyLine/Entitys/Trays/TestTrayManager.cs b/Rs.SkyLine/Entitys/Trays/TestTrayManager.cs index c59c996..e7daa31 100644 --- a/Rs.SkyLine/Entitys/Trays/TestTrayManager.cs +++ b/Rs.SkyLine/Entitys/Trays/TestTrayManager.cs @@ -173,5 +173,13 @@ namespace Rs.MotionPlat.Entitys.Trays SuckerNo = nozzle.NozzleIndex; } + /// + /// 通过真空判断穴位中是否有产品 + /// + /// + public bool HasProduct() + { + return Ops.IsOn($"测试{Index}号穴位真空吸检测"); + } } } diff --git a/Rs.SkyLine/Flow/SubFlow/TestFixtureVacSuctionCheckFlow.cs b/Rs.SkyLine/Flow/SubFlow/TestFixtureVacSuctionCheckFlow.cs new file mode 100644 index 0000000..c534bce --- /dev/null +++ b/Rs.SkyLine/Flow/SubFlow/TestFixtureVacSuctionCheckFlow.cs @@ -0,0 +1,66 @@ +using Rs.Framework; +using Rs.MotionPlat.Commom; +using Rs.MotionPlat.Entitys.Trays; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Rs.MotionPlat.Flow.SubFlow +{ + /// + /// 测试治具真空吸检测流程 + /// + public class TestFixtureVacSuctionCheckFlow + { + List hasProductSlots = new List(); + private TestFixtureVacSuctionCheckFlow() { } + private static TestFixtureVacSuctionCheckFlow instance; + public static TestFixtureVacSuctionCheckFlow Instance + { + get + { + if (instance == null) + { + instance = new TestFixtureVacSuctionCheckFlow(); + } + return instance; + } + } + + private ManualResetEvent checkFinishedSingle = new ManualResetEvent(true); + + public void Check() + { + Task.Run(() => { + hasProductSlots.Clear(); + checkFinishedSingle.Reset(); + MessageQueue.Instance.Insert("放料之前用检测测试治具穴位中是否有产品,检测开始"); + foreach (var item in TestTrayManager.Instance.GetAll()) + { + //先打开真空 + VacManager.TestTrayVacSuction(EVacOperator.Open, true, item.Index); + //检测是否真空有效 + if(item.HasProduct()) + { + hasProductSlots.Add(item); + } + VacManager.TestTrayVacSuction(EVacOperator.Close, true, item.Index); + } + checkFinishedSingle.Set(); + MessageQueue.Instance.Insert($"检测测试治具穴位中是否有产品结束 hasProductSlotNum={hasProductSlots.Count}"); + }); + } + /// + /// 等待检测结果 + /// + /// + public List WaitResult() + { + checkFinishedSingle.WaitOne(); + return hasProductSlots; + } + } +} diff --git a/Rs.SkyLine/Rs.SkyLine.csproj b/Rs.SkyLine/Rs.SkyLine.csproj index d84e8ff..5e4d6a7 100644 --- a/Rs.SkyLine/Rs.SkyLine.csproj +++ b/Rs.SkyLine/Rs.SkyLine.csproj @@ -191,6 +191,7 @@ +