using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using AR;

namespace Project
{
	public partial class FMain
	{

		public void _STEP_FINISH_START(eSMStep step)
		{
			//포트1번을 아래로 이동한다(모든포트를 내린다)
			DIO.SetPortMotor(1, eMotDir.CCW, true, "FINISH"); //210326

            var cvMODE = VAR.BOOL[eVarBool.Use_Conveyor];
            if(cvMODE==false)
            {
                if (AR.SETTING.Data.Disable_Left == false) DIO.SetPortMotor(0, eMotDir.CCW, true, "FINISH"); //210326
                if (AR.SETTING.Data.Disable_Right == false) DIO.SetPortMotor(2, eMotDir.CCW, true, "FINISH"); //210326
            }

            //picker move to center
            if (DIO.GetIOInput(eDIName.PICKER_SAFE) == false)
			{
				var PosX = MOT.GetPXPos(ePXLoc.PICKON);
				MOT.Move(PosX);
			}

			PUB.Result.JobEndTime = DateTime.Now;

            //컨베어OFF
            DIO.SetOutput(eDOName.LEFT_CONV, false);
            DIO.SetOutput(eDOName.RIGHT_CONV, false);

			DIO.SetBuzzer(true, AR.SETTING.Data.Force_JobEndBuzzer);
			PUB.log.AddI("Work has been completed");
			needShowSummary = true;
		}

		public StepResult _STEP_FINISH(eSMStep step, TimeSpan stepTime, TimeSpan seqTime)
		{
			return StepResult.Wait;
		}

	}
}
