using Rs.AutoDischarge.V3.Flow; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Rs.MotionPlat.Flow.Space { enum SpaceTestStep { load, waitLoad, unload, waitUnload } internal class SpaceTest:BaseFlow { bool bSingleTest = false; SpaceTestStep step= SpaceTestStep.load; TrayTest stock1 = new TrayTest(1); TrayTest stock2 = new TrayTest(2); TrayTest stock3 = new TrayTest(3); TrayTest stock4 = new TrayTest(4); TrayTest stock5 = new TrayTest(5); TrayTest stock6 = new TrayTest(6); private static SpaceTest instance; public static SpaceTest Instance { get { if (instance == null) instance = new SpaceTest(); return instance; } } public override void Start() { base.Start(); if(bSingleTest) { stock3.Start(); } else { stock1.Start(); stock2.Start(); stock3.Start(); stock4.Start(); stock5.Start(); stock6.Start(); } } public override void Run() { switch (step) { case SpaceTestStep.load: if(bSingleTest) { stock3.Load(true); } else { stock1.Load(true); stock2.Load(true); stock3.Load(true); stock4.Load(true); stock5.Load(true); stock6.Load(true); } step = SpaceTestStep.waitLoad; break; case SpaceTestStep.waitLoad: if(bSingleTest) { if (stock3.Finished()) { step = SpaceTestStep.unload; } } else { if (stock1.Finished()&& stock3.Finished() && stock2.Finished() && stock4.Finished() && stock5.Finished() && stock6.Finished()) { step = SpaceTestStep.unload; } } break; case SpaceTestStep.unload: if (bSingleTest) { stock3.Unload(); } else { stock1.Unload(); stock2.Unload(); stock3.Unload(); stock4.Unload(); stock5.Unload(); stock6.Unload(); } step = SpaceTestStep.waitUnload; break; case SpaceTestStep.waitUnload: if (bSingleTest) { if (stock3.Finished()) { step = SpaceTestStep.load; } } else { if (stock1.Finished() && stock3.Finished() && stock2.Finished() && stock4.Finished() && stock5.Finished() && stock6.Finished()) { step = SpaceTestStep.load; } } break; } } public override void Stop() { base.Stop(); stock1.Stop(); stock3.Stop(); stock2.Stop(); stock4.Stop(); stock5.Stop(); stock6.Stop(); } } }