using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using AR;
namespace Project
{
	public partial class FMain
	{
		void _BUTTON_STOP()
		{
			//매거진 투입모터 멈춤
			if (DIO.GetIOOutput(eDOName.PORTL_MOT_RUN)) DIO.SetPortMotor(0, eMotDir.CW, false, "Button Stop");
			if (DIO.GetIOOutput(eDOName.PORTC_MOT_RUN)) DIO.SetPortMotor(1, eMotDir.CW, false, "Button Stop");
			if (DIO.GetIOOutput(eDOName.PORTR_MOT_RUN)) DIO.SetPortMotor(2, eMotDir.CW, false, "Button Stop");

			//자재가 없고, 센서도 반응안하는데. 진공이 되어잇으면 off한다
			if (DIO.isVacOKL() == 0 && PUB.flag.get(eVarBool.FG_PK_ITEMON) == false && DIO.GetIOOutput(eDOName.PICK_VAC1) == true)
				DIO.SetPickerVac(false, true);

			//조명켜기
			if (AR.SETTING.Data.Disable_RoomLight == false)
				DIO.SetRoomLight(true);

            //컨베이어  멈춘다  230502
            DIO.SetOutput(eDOName.LEFT_CONV, false);
            DIO.SetOutput(eDOName.RIGHT_CONV, false);

			//모든 모터도 멈춘다
			if (PUB.mot.HasMoving) PUB.mot.MoveStop("Stop Button");

			if (PUB.sm.Step == eSMStep.RUN)
			{
				//일시중지상태로 전환한다
				PUB.Result.SetResultMessage(eResult.OPERATION, eECode.USER_STOP, eNextStep.PAUSE);
				PUB.log.Add("[User pause]");
			}
			else if (PUB.sm.Step == eSMStep.HOME_FULL)   //홈진행중에는 대기상태로 전환
			{
				PUB.sm.SetNewStep(eSMStep.IDLE);
			}

			//로그 기록
			PUB.LogFlush();
		}

	}
}
