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

namespace Project
{

	public enum StepResult
	{
		Wait = 0,
		Complete,
		Error,
	}

	public enum eWorkPort
	{
		Left = 0,
		Right
	}

	public enum eNormalResult
	{
		True = 0,
		False,
		Error,
	}




	public enum eSMStep : byte
	{
		NOTSET = 0,
		INIT = 1,
		IDLE = 10,

		RUN = 50,
		RUN_ROOT_SEQUENCE_L,
		RUN_ROOT_SEQUENCE_R,
		RUN_KEYENCE_READ_L,
		RUN_KEYENCE_READ_R,
		RUN_PICKER_ON_L,
		RUN_PICKER_ON_R,
		RUN_PICKER_OFF_L,
		RUN_PICKER_OFF_R,
		RUN_PRINTER_F,
		RUN_PRINTER_R,
		RUN_PRINTER_ON_F,
		RUN_PRINTER_ON_R,
		RUN_PRINTER_OFF_F,
		RUN_PRINTER_OFF_R,
		RUN_QRVALID_F,
		RUN_QRVALID_R,

		RUN_COM_PT0,
		RUN_COM_PT1,
		RUN_COM_PT2,

		RUN_PICK_RETRY,

		//이후에 사용자 런 코드용 스텝을 추가한다.
		EMERGENCY = 200,
		HOME_FULL = 201,
		HOME_DELAY,
		HOME_CONFIRM,
		HOME_QUICK,

		CLOSING = 250,
		CLOSEWAIT = 251,
		CLOSED = 252,

		//사용자영역
		FINISH = 100,
		PAUSE,
		WAITSTART,
		ERROR,
		SAFTY,
		CLEAR,
	}


	public enum eWaitMessage
	{
		PX = 0,
		PZ,
		LMOVE,
		LUPDN,
		RMOVE,
		RUPDN,
		LPRINT,
		RPRINT,
		VIS0,
		VIS1,
		VIS2,
	}
	//public enum eJobResult
	//{
	//    None = 0,
	//    Error,
	//    ErrorOut,
	//    MaxCount,
	//    NotExistSID,
	//    DisableUnloader,
	//    MatchFail,
	//    NoBarcode
	//}
	public enum eCartSize
	{
		None = 0,
		Inch7 = 7,
		Inch13 = 13
	}

	public enum ePrintPutPos
	{
		None = 0,
		Top,
		Middle,
		Bottom,
	}

	public enum ePrintVac
	{
		inhalation = 0,
		exhaust,
		off,
	}





	public enum eJobType : byte
	{
		Sorter = 0,
		Dryrun,
	}

	public enum eHeaderHandler
	{
		Ping = 0,
		RequestData,
		RequstSeqNo,
		RequstInputReel,
		JobEnd,
		JobDelete,
	}
	public struct sVisionDMResult
	{
		public Boolean iSystemErr { get; set; }
		public Boolean isError { get; set; }
		public string DM { get; set; }
		public System.Drawing.Rectangle ROS { get; set; }

		public System.Drawing.PointF DMCenter { get; set; }
		public List<System.Drawing.PointF> DMCorner { get; set; }
		public string DMMessage { get; set; }
	}
	public struct sObjectDetectResult
	{
		public string Message { get; set; }
		public List<System.Drawing.Rectangle> Rect { get; set; }
		public List<uint> Areas { get; set; }
		public Boolean OK
		{
			get
			{
				if (Areas == null || Areas.Count < 1) return false;
				else return true;
			}
		}
	}



	public enum eGridValue
	{
		/// <summary>
		/// 아직 처리 전(기본 초기화된 상태)
		/// </summary>
		NotSet = 0,

		/// <summary>
		/// 원점검사에서 오류 발생
		/// </summary>
		OrientError,

		/// <summary>
		/// 아이템검출에서 실패됨
		/// </summary>
		NoItem,

		/// <summary>
		/// 아이템검출성공, 데이터매트릭스 검출 실패
		/// </summary>
		NewItem,

		/// <summary>
		/// 데이터매트릭스 읽기 실패
		/// </summary>
		DMReadError,

		/// <summary>
		/// 데이터매트릭스 관리 횟수가 기준횟수(10) 미만 (아직 정상)
		/// </summary>
		DMNotmalCount,

		/// <summary>
		/// 데이터매트릭스 관리 횟수가 기준횟수(10)를 초과한 경우
		/// </summary>
		DMOverCount,



	}

	public enum eRoiSeq
	{
		Area = 0,
		DataMatrix,
		Orient,
		DetectUnit,
		DetectDM
	}
	public enum eWaitType : byte
	{
		TryLock = 0,
		TryUnLock,
		AirBlowOn,
		AirBlowOff,
		AirBlowDustOn,
		AirBlowDustOff,
		PrintPickLOff,
		PrintPickLOn,
		PrintPickROff,
		PrintPickROn,
		PickOff,
		PickOn,
		AirBlowCoverDn,
		AirBlowCoverUp,
		UnloaderUp,
		UnloaderDn,
		LiftUp,
		LiftDn,
	}

	public enum eSensorState : byte
	{
		Off = 0,
		On = 1,
		InComplete = 2,
	}
	public enum eIOCheckResult
	{
		Wait = 0,
		Complete,
		Timeout
	}



	public enum ePort
	{
		Left = 0,
		Right,
	}


	enum eResultStringType
	{
		Nomal = 0,
		Attention,
		Error,
	}
	public enum eMotDir
	{
		Stop = 0,
		CW = 1,
		CCW = 2
	}

	/// <summary>
	/// RUN중일 때 사용되는 세부 시퀀스
	/// </summary>
	public enum eRunStep : byte
	{
		NOTSET = 0,

		/// <summary>
		/// 프로그램 체크
		/// </summary>
		STARTCHKSW,
		/// <summary>
		/// 하드웨어 체크
		/// </summary>
		STARTCHKHW,

		/// <summary>
		/// 기계장치를 작업 시작 전 상태로 이동합니다
		/// </summary>
		INITIALHW,

		/// <summary>
		/// 안전지대(비활성화된경우 발생)
		/// </summary>
		SAFTYZONE_GO,
		SAFTYZONE_RDY,

		BEGINLOAD,
		/// <summary>
		/// 트레이를 로딩하기 위한 로더 이동 및 트레이 추출
		/// </summary>
		PORTLOAD,


		/// <summary>
		/// 비젼촬영을위한 위치로 이동
		/// </summary>
		BEGINPICK,
		ENDPICK,

		OVERLOAD,
		SAVEDATA,

		/// <summary>
		/// 모션 원위치
		/// </summary>
		BARCODE,

		/// <summary>
		/// AIR/BLOW 위치 이동 및 작업
		/// </summary>
		AIRBLOW,
		REELOUT,
		TRAYOUT,

		/// <summary>
		/// 언로드위치로 셔틀을 이동
		/// </summary>
		BEGINUNLOADER,
		/// <summary>
		/// 트레이 언로드 작업
		/// </summary>
		TRAYUNLOAD,

		/// <summary>
		/// 언로딩하고 다시 로딩존으로 이동하는 시퀀스
		/// </summary>
		MOVE_TO_LOAD,

	}


	public enum ePLCIPin : byte
	{
		X00, X01, X02, X03, X04, X05, X06, X07, X08, X09, X0A,
		X10, X11, X12, X13, X14, X15, X16, X17, X18, X19, X1A
	}
	public enum ePLCOPin : byte
	{
		Y00, Y01, Y02, Y03, Y04, Y05, Y06, Y07, Y08, Y09, Y0A,
		Y10, Y11, Y12, Y13, Y14, Y15, Y16, Y17, Y18, Y19, Y1A
	}
	public enum ePLCITitle : byte
	{
		Run, Cart_Status_01, Cart_Status_02, Cart_Status_03, Cart_Status_04,
		Machine_Confirm = 19
	}
	public enum ePLCOTitle : byte
	{
		Cart_No_Setting = 0,
		Handler_Confirm = 19,
	}

	public enum eResult : byte
	{
		NOERROR,
		EMERGENCY,
		SAFTY,
		DEVELOP,
		SETUP,
		HARDWARE,
		SENSOR,
		MOTION,
		OPERATION,
		COMMUNICATION,
		TIMEOUT,
		UNLOADER,
	}


	public enum eECode : byte
	{

		NOTSET = 0,
		EMERGENCY = 1,
		NOMODELV = 2,//작업모델
		NOMODELM = 3,//모션모델
		DOORSAFTY = 6,
		AREASAFTY = 7,
		VIS_LICENSE = 8,
		HOME_TIMEOUT = 9,
		AIRNOOUT = 10,
		NOFUNCTION = 11,
		AIRNOTDETECT = 12,

		DOOFF = 27,//출력 off
		DOON = 28,//출력 on
		DIOFF = 29,//입력off
		DION = 30,//입력 on

		MESSAGE_INFO = 32,
		MESSAGE_ERROR = 33,

		VISION_NOTREADY = 34,
		VISION_NOCONN = 35,
		VISION_TRIGERROR = 36,
		VISION_COMMERROR = 37,
		VISION_NORECV = 38,

		AZJINIT = 39, //DIO 혹은 모션카드 초기화 X
		MOT_HSET = 41,
		MOT_SVOFF = 42,
		MOT_HSEARCH = 43,

		MOT_CMD = 71,
		USER_STOP = 72,
		USER_STEP = 73,
		POSITION_ERROR = 86,
		MOTIONMODEL_MISSMATCH = 96,


		//여기서부터는 전용코드로한다(소켓은 조금 섞여 있음)
		VISCONF = 100,
		NEED_AIROFF_L,
		NEED_AIROFF_R,
		PORTOVERLOAD,
		NOPRINTLDATA,
		NOPRINTRDATA,
		PRINTL,
		PRINTR,
		CAM_LEFT,
		CAM_RIGHT,
		INCOMPLETE_LOADERDATA,
        INCOMPLETE_INFOSELECT,
        NOPUTPOSITION,
		NOREELSIZE,
		PRINTER,
		QRDATAMISSMATCHL,
		QRDATAMISSMATCHR,
		MOTX_SAFETY,

		NO_PAPER_DETECT_L,
		NO_PAPER_DETECT_R,

		CART_SIZE_ERROR_L,
		CART_SIZE_ERROR_R,

		PRE_USE_REELID_L,
		PRE_USE_REELID_R,

		NEED_JOBCANCEL,
        
        LCONVER_REEL_DECTECT_ALL =150,
        RCONVER_REEL_DECTECT_ALL,
        LCONVER_REEL_DECTECT_IN,
        RCONVER_REEL_DECTECT_IN,
        LCONVER_MOVING,
        RCONVER_MOVING,
        NOREADY_KEYENCE,

        PRINTER_LPICKER_NOBW,
        PRINTER_RPICKER_NOBW,
		NOBYPASSSID,

        CONFIG_KEYENCE,
        PRINTER_LPRINTER_NOUP,
        PRINTER_RPRINTER_NOUP,
        NOECSDATA,
        PICKER_LCYL_NODOWN,
        PICKER_RCYL_NODOWN,
        PICKER_LCYL_NOUP,
        PICKER_RCYL_NOUP,

        NOSIDINFOFROMDB,
        INBOUNDWEBAPIERROR,
        SIDINFORDUP,
		NOECSDATAACTIVE,
        NOTSELECTMULTISID,
    }

	public enum eNextStep : byte
	{
		NOTHING = 0,
		PAUSE,
		PAUSENOMESAGE,
		ERROR
	}

	public enum eILock
	{
		EMG = 0,
		PAUSE,
		HOMESET,
		DOOR,
		SAFTYAREA,
		DISABLE,

		XMOVE,
		YMOVE,
		ZMOVE,

		X_POS,
		Y_POS,
		Z_POS,

		PY_POS,
		PZ_POS,
		CYL_FORWARD,
        MPrint,
    }


	//public enum eILockPKX
	//{
	//	EMG = 0,
	//	PAUSE,
	//	HOMESET,
	//	DOOR,
	//	Disable,
	//	ZL_POS,
	//	ZR_POS,
	//	ZMOVE,
	//	PKZPOS,
	//}

	//public enum eILockPKZ
	//{
	//	EMG = 0,
	//	PAUSE,
	//	HOMESET,
	//	DOOR,
	//	Disable,
	//	Y_POS,
	//	YMOVE,
	//	PORTRUN0,
	//	PORTRUN1,
	//	PORTRUN2
	//}

	//public enum eILockPKT
	//{
	//	EMG = 0,
	//	PAUSE,
	//	HOMESET,
	//	DOOR,
	//	Disable,
	//	Y_POS,
	//	Y_MOVE,
	//	PortRun
	//}


	///// <summary>
	///// PRINT MOVE AXIS (L+R)
	///// </summary>
	//public enum eILockPRM
	//{
	//	Emergency = 0,
	//	Pause,
	//	HomeSet,
	//	Safty,
	//	Disable,
	//	ZMOVE,
	//	FORWARD,
	//	ITEMON,
	//	PKXPOS,
	//	PRNZPOS,
	//}

	//public enum eILockPRZ
	//{
	//	EMG = 0,
	//	PAUSE,
	//	HOMESET,
	//	DOOR,
	//	Disable,
	//	YMOVE,
	//	ITEMON,
	//	PRNYPOS,
	//}

	public enum eILockPRL
	{
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,
        DISABLE,

        PRNYPOS,
		PRNZPOS,
	}
	public enum eILockPRR
	{
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,
        DISABLE,


        PRNYPOS,
		PRNZPOS,
	}
	public enum eILockVS0
	{
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,
        DISABLE,

        PORTRDY,
		PKXPOS,  //피커의 위치
		PRNYPOS,  //프린터Y축 위치
	}
	public enum eILockVS1
	{
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,
        DISABLE,

        PORTRDY,
		PKXPOS,
	}
	public enum eILockVS2
	{
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,
        DISABLE,

        PORTRDY,
		PKXPOS,  //피커의 위치
		PRNYPOS,  //프린터Y축 위치
	}
    public enum eILockCV
    {
        EMG = 0,
        PAUSE,
        HOMESET,
        DOOR,
        SAFTYAREA,

		/// <summary>
		/// 포트를 사용하지 않는경우
		/// </summary>
        DISABLE,

		/// <summary>
		/// 카트모드
		/// </summary>
		CARTMODE,

		/// <summary>
		/// 업체컨이어의 ready 신호
		/// </summary>
        EXTBUSY,

		/// <summary>
		/// 나의 작업 신호
		/// </summary>
        BUSY,

        VISION,
    }
}
