using System;
using System.Linq;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

using InModbus;
using ITC81DB_2H.Datastore;
using ITC81DB_2H.Part11_UserManager;

namespace ITC81DB_2H
{
    #region SerialData
    public class SerialData
    {
        public static readonly char STX = Convert.ToChar(0x02);
        public static readonly char ETX = Convert.ToChar(0x03);
        public static readonly char ETXs1 = Convert.ToChar(0x0D);
        public static readonly char ETXs2 = Convert.ToChar(0x0A);
        public static readonly char[] CharSaperate = { (char)0x0D, (char)0x0A };
    } 
    #endregion

    #region CommunicationCommand
    public class CommunicationCommand
    {
        // 운전데이터 Respone
        public static readonly string StartDataCMD = "Sr0";

        // 불량알람(레벨)
        public static readonly string AlarmNgLevel = "Caa00";
        // 불량알람 해지
        public static readonly string AlarmNgClear = "CAA00";
        // 불량알람(펄스)
        public static readonly string AlarmPulse = "Cac00";
        // 부저ON(부저ON시간과 연동)
        public static readonly string BuzzerOn = "Cad00";
        // 부저ON(연속)
        public static readonly string BuzzerOnContinuousEnable = "Cae01";
        // 부저해지
        public static readonly string BuzzerOnContinuousDisable = "Cae00";
        // 선별기알람해지
        public static readonly string AlarmNgClearSorter = "CA700";
        // 카운팅출력1(펄스)
        public static readonly string CountingOutput1Pulse = "Caf00";
        // 카운팅출력2(펄스)
        public static readonly string CountingOutput2Pulse = "Cag00";
        // 램프ON(연속, 적색/황색 점등)
        public static readonly string LampOnContinuousEnable = "Cah01";
        // 램프해지
        public static readonly string LampOnContinuousDisable = "Cah00";

        // 중량조정모드
        public static readonly string ModeCalibration = "Csc00";
        // 노멀모드
        public static readonly string ModeNormal = "Csn00";
        // 메뉴 모드
        public static readonly string ModeMenu = "Csm00";
        // 판정설정모드
        public static readonly string ModeJudgment = "Csg00";
        // IO 테스트모드
        public static readonly string ModeIOTest = "Cst00";
        // 바이패스
        public static readonly string ModeBypass = "Csb00";
        // 장비 테스트모드
        public static readonly string ModeEquipmentTest = "Csy00";
        // 선별기 테스트모드
        public static readonly string ModeRejectorTest = "Csr00";

        // 중량조정 - 분동
        public static readonly string CalibrationBalance = "Ccb00";
        // 중량조정 - 시작
        public static readonly string CalibrationStart = "Ccs00";
        // 중량조정 - 취소
        public static readonly string CalibrationCancel = "Ccx00";
        // 중량보정 - 한자리올림
        public static readonly string CalibrationUp = "Ccu00";
        // 중량보정 - 한자리내림
        public static readonly string CalibrationDown = "Ccd00";

        // 파라미터 쓰기
        public static readonly string Write = "Pw000";
        // 파라미터 읽기
        public static readonly string Read = "Pr000";
        // Bypass To Motor
        public static readonly string BypassToMotor = "Pb000";
        // IO테스트 - OUT
        public static readonly string IOTest = "Pt000";

        // 임펠러 모터 - 정회전
        public static readonly string ImpellerMotorForward = "Cmc00";
        // 임펠러 모터 - 역회전
        public static readonly string ImpellerMotorReverse = "Cmr00";
        // 모터 - 원점초기화
        public static readonly string MotorOrigin = "Cmo00";
        // 모터 - Step
        public static readonly string MotorStep = "Cms00";
        // 업다운 - 다운
        public static readonly string MotorDown = "Cmd00";
        // 업다운 - 업
        public static readonly string MotorUp = "Cmu00";
        // 모터 - 업2
        public static readonly string MotorUp2 = "Cmp00";
        // BLDC 모터 - Default set
        public static readonly string BLDCDefaultSet = "Cmf00";
        // BLDC 모터 - MCU reboot
        public static readonly string BLDCMCUReboot = "Cmb00";

        // Cut 신호
        public static readonly string CutInpupt = "Cbc00";
        // 공장초기화
        public static readonly string Initialization = "Cbi00";
        // 운전
        public static readonly string Start = "Cbs00";
        // 정지
        public static readonly string Stop = "Cbt00";
        // 영점
        public static readonly string Zero = "Cbz00";
        // 소거
        public static readonly string Clear = "Cbe00";
        // Output 제어
        public static readonly string Output = "Cbd00";

        // ACK
        public static readonly string ACK = "ACK";
        // NAK
        public static readonly string NAK = "NAK";
        // 운전중 중량
        public static readonly string RunWeightData = "Sr";

        // 카운팅출력 - 통신에러
        public static readonly string CountingOutputClearCommunicationError = "Cra00";

        // 기타NG
        public static readonly string JudgmentExternalNG = "Cja00";

        // 판정 - bypass 1회
        public static readonly string BypassOnce = "Cjb00";
        // 판정 - byNG 1회
        public static readonly string ByNGOnce = "Cjc00";
        // 판정 - bypass 연속 OFF
        public static readonly string BypassOFF = "Cjd00";
        // 판정 - bypass 연속 ON
        public static readonly string BypassON = "Cjd01";
        // 판정 - byNG 연속 OFF
        public static readonly string ByNGOFF = "Cje00";
        // 판정 - byNG 연속 ON
        public static readonly string ByNGON = "Cje01";
    }
    public class CommunicationID
    {
        public static readonly string MainBoard = "0";
        public static readonly string SubBoard1 = "A";
        public static readonly string SubBoard2 = "B";
        public static readonly string SubBoard3 = "C";
        public static readonly string SubBoard4 = "D";
        public static readonly string SubBoard5 = "E";
        public static readonly string SubBoard6 = "F";
        public static readonly string SubBoard7 = "G";
        public static readonly string SubBoard8 = "H";
        public static readonly string SubBoard9 = "I";
        public static readonly string SubBoard10 = "J";
        public static readonly string SubBoard11 = "K";
        public static readonly string SubBoard12 = "L";
        public static readonly string SubBoard13 = "M";
        public static readonly string SubBoard14 = "N";
        public static readonly string SubBoard15 = "O";
        public static readonly string SubBoard16 = "P";
        public static readonly string SubBoardAll = "Z";
    }
    public class CommunicationAddress
    {
        // Address None
        public static readonly string None = "0000";

        // 장비타입
        public static readonly string EquipmentType = "1002";
        // BLDC 모터 개수
        public static readonly string BLDCTotalMotorNum = "1024";

        // 임펠러 모터 - 회전각도
        public static readonly string ImpellerMotorAngle = "1101";
        // 임펠러 모터 - 통신속도
        public static readonly string ImpellerMotorBaudrate = "1102";
        // 임펠러 모터 - 회전방향
        public static readonly string ImpellerMotorDirection = "1103";
        // 바이패스
        public static readonly string Bypass = "1201";
        // 정지계량 사용 여부
        public static readonly string IsStopWeighing = "1401";
        // OPT(옵션보드) 사용
        public static readonly string OptionBoard = "1402";
        // 외부운전 사용 여부
        public static readonly string IsExternalOperation = "1403";
        // 초기구동 사용 여부
        public static readonly string IsInitialDrive = "1404";
        // 공기압감지 사용 여부
        public static readonly string IsPressureSensing = "1405";
        // 적체센서 사용 여부
        public static readonly string IsStackSensing = "1406";
        // 선별부 동작감지 사용 여부
        public static readonly string IsSorterDetecting = "1407";
        // 진입 스토퍼 사용 여부
        public static readonly string IsEntryStopper = "1408";
        // PI2 - 0:미사용, 1:NG, 2:외부운전, 3:공압센서, 4:문열림감지, 5:배출확인
        public static readonly string PI2 = "1421";
        // PI3 - 0:미사용, 1:STOP, 2:외부운전, 3:공압센서, 4:문열림감지, 5:배출확인
        public static readonly string PI3 = "1422";
        // PI4 - 0:미사용, 1:START, 2:외부운전, 3:공압센서, 4:문열림감지, 5:배출확인
        public static readonly string PI4 = "1423";
        // PI5 - 0:미사용, 1:외부운전, 2:공압센서, 3:문열림감지, 4:배출확인
        public static readonly string PI5 = "1424";
        // PI6 - 0:미사용, 1:외부운전, 2:공압센서, 3:문열림감지, 4:배출확인
        public static readonly string PI6 = "1425";
        // PI7 - 
        public static readonly string PI7 = "1426";
        // PI8 - 
        public static readonly string PI8 = "1427";
        // 메인보드1 버전 읽기
        public static readonly string ProgramVersion = "1502";
        // 시스템설정 - 업데이트
        public static readonly string _1651_UpdateForMain = "1651";

        // 품목설정 - 품번
        public static readonly string ProductNumber = "2001";
        // 품목설정 - 하한 설정값
        public static readonly string UnderRange = "2002";
        // 품목설정 - 기준 설정값
        public static readonly string PassRange = "2003";
        // 품목설정 - 상한 설정값
        public static readonly string OverRange = "2004";
        // 품목설정 - 용기 설정값
        public static readonly string TareRange = "2005";

        // 중량조정 - 최대중량 설정값
        public static readonly string MaxWeight = "3001";
        // 중량조정 - 분동중량 설정값
        public static readonly string BalanceWeight = "3002";
        // 중량조정 - 한눈의 값
        public static readonly string Digit = "3003";
        // 중량조정 - 소수점
        public static readonly string DecimalPlaces = "3016";
        // 중량조정 - 상수값 읽기
        public static readonly string ReadConstant = "3601";
        // 중량조정 - 파라미터 읽기
        public static readonly string ParameterRead3901 = "3901";

        // 자동영점 - 사용여부
        public static readonly string AutoZeroIsUsing = "4041";
        // 자동영점 - +범위
        public static readonly string AutoZeroPlusRange = "4042";
        // 자동영점 - -범위
        public static readonly string AutoZeroMinusRange = "4043";
        // 자동영점 - 변량
        public static readonly string AutoZeroVariate = "4044";

        // 자동영점 - 파라미터 읽기
        public static readonly string ParameterRead4907 = "4907";

        // 판정설정 - 필터
        public static readonly string Filter = "5001";
        // 판정설정 - 판정지연
        public static readonly string JudgmentDelayTime = "5002";
        // 판정설정 - 이중지연
        public static readonly string DoubleDelayTime = "5003";
        // 판정설정 - 판정개수
        public static readonly string JudgmentCount = "5004";
        // 판정설정 - 이송속도
        public static readonly string FeedSpeed = "5005";
        // 판정설정 - 동보정
        public static readonly string DynamicCorrection = "5006";
        // 판정설정 - Feeding 컨베어 지연시간
        public static readonly string FeedingConveyorDelayTime = "5007";
        // 판정설정 - Feeding 컨베어 동작시간
        public static readonly string FeedingConveyorRunTime = "5008";
        // 판정설정 - 배출 컨베어 지연시간
        public static readonly string DischargeConveyorDelayTime = "5009";
        // 판정설정 - 배출 컨베어 동작시간
        public static readonly string DischargeConveyorRunTime = "5010";
        // 판정설정 - 이동평균
        public static readonly string MovingAverage = "5031";
        // 판정설정 - 자동판정 - 센서 검출 시간 읽기
        public static readonly string ReadSensingTime = "5057";
        // 판정설정 - 자동판정 - 필터갭
        public static readonly string FilterGap = "5058";
        // 판정설정 - 상승 지연시간
        public static readonly string AscendDelayTime = "5011";
        // 판정설정 - 하강 지연시간
        public static readonly string DescendDelayTime = "5012";
        // 판정설정 - 선별기 테스트
        public static readonly string SorterTest = "5100";
        // 판정설정 - 선별기1 모드 값
        public static readonly string Sorter1Mode = "5101";
        // 판정설정 - 선별기1 지연시간
        public static readonly string Sorter1DelayTime = "5102";
        // 판정설정 - 선별기1 동작시간
        public static readonly string Sorter1RunTime = "5103";
        // 판정설정 - 선별기2 모드 값
        public static readonly string Sorter2Mode = "5104";
        // 판정설정 - 선별기2 지연시간
        public static readonly string Sorter2DelayTime = "5105";
        // 판정설정 - 선별기2 동작시간
        public static readonly string Sorter2RunTime = "5106";
        // 판정설정 - 외부출력1 모드
        public static readonly string ExternalOut1Mode = "5201";
        // 판정설정 - 외부출력1 지연시간
        public static readonly string ExternalOut1DelayTime = "5202";
        // 판정설정 - 외부출력1 동작시간
        public static readonly string ExternalOut1RunTime = "5203";
        // 판정설정 - 외부출력2 모드
        public static readonly string ExternalOut2Mode = "5204";
        // 판정설정 - 외부출력2 지연시간
        public static readonly string ExternalOut2DelayTime = "5205";
        // 판정설정 - 외부출력2 동작시간
        public static readonly string ExternalOut2RunTime = "5206";
        // 판정설정 - 외부출력3 모드
        public static readonly string ExternalOut3Mode = "5207";
        // 판정설정 - 외부출력3 지연시간
        public static readonly string ExternalOut3DelayTime = "5208";
        // 판정설정 - 외부출력3 동작시간
        public static readonly string ExternalOut3RunTime = "5209";
        // 판정설정 - 외부출력4 모드
        public static readonly string ExternalOut4Mode = "5210";
        // 판정설정 - 외부출력4 지연시간
        public static readonly string ExternalOut4DelayTime = "5211";
        // 판정설정 - 외부출력4 동작시간
        public static readonly string ExternalOut4RunTime = "5212";
        // 판정설정 - 외부출력5 모드
        public static readonly string ExternalOut5Mode = "5213";
        // 판정설정 - 외부출력5 지연시간
        public static readonly string ExternalOut5DelayTime = "5214";
        // 판정설정 - 외부출력5 동작시간
        public static readonly string ExternalOut5RunTime = "5215";
        // 판정설정 - 외부출력6 모드
        public static readonly string ExternalOut6Mode = "5216";
        // 판정설정 - 외부출력6 지연시간
        public static readonly string ExternalOut6DelayTime = "5217";
        // 판정설정 - 외부출력6 동작시간
        public static readonly string ExternalOut6RunTime = "5218";
        // 판정설정 - 외부출력9 모드
        public static readonly string ExternalOut9Mode = "5225";
        // 판정설정 - 외부출력9 지연시간
        public static readonly string ExternalOut9DelayTime = "5226";
        // 판정설정 - 외부출력9 동작시간
        public static readonly string ExternalOut9RunTime = "5227";
        // 판정설정 - 외부출력10 모드
        public static readonly string ExternalOut10Mode = "5228";
        // 판정설정 - 외부출력10 지연시간
        public static readonly string ExternalOut10DelayTime = "5229";
        // 판정설정 - 외부출력10 동작시간
        public static readonly string ExternalOut10RunTime = "5230";
        // 판정설정 - 파라미터 읽기
        public static readonly string ParameterRead5901 = "5901";
        // 판정설정 - 스타휠 회전주기
        public static readonly string WheelCycleTime = "5301";
        // 판정설정 - 스타휠 슬롯개수
        public static readonly string WheelSlotCount = "5302";
        // 판정설정 - 스타휠 슬롯배출지연개수
        public static readonly string WheelSlotOutCount = "5303";
        // 판정설정 - 진입센서 지연시간
        public static readonly string EntrySensorDelayTime = "5304";
        // 판정설정 - 서보드라이버 토크제한
        public static readonly string ServoTorque = "5351";
        // 판정설정 - 서보드라이버 회전속도
        public static readonly string ServoSpeed = "5352";
        // 판정설정 - 원점옵셋
        public static readonly string ServoOffset = "5353";
        // 판정설정 - 사용자정의1(선별기1모드,지연,동작,선별기2모드,지연,동작)
        public static readonly string UserDefined1 = "5901";

        // 옵션 - 부저 ON시간
        public static readonly string BuzzerOnTime = "6001";
        // 옵션 - 릴레이 동작시간
        public static readonly string RelayRunTime = "6002";
        // 옵션 - 이중진입사용여부
        public static readonly string DoubleEnter = "6005";
        // 옵션 - 채터링감지 설정
        public static readonly string Chattering = "6006";
        // 옵션 - 외부 NG 입력 사용
        public static readonly string ExternalInput = "6007";
        // 옵션 - 기타 NG 사용
        public static readonly string ExternalNG = "6008";
        // 옵션 - 스위치채터링 설정
        public static readonly string SwitchChattering = "6012";
        // 옵션 - OPT1_샘플링개수
        public static readonly string OPT1SamplingCount = "6201";
        // 옵션 - OPT1_지연개수
        public static readonly string OPT1DelayCount = "6202";
        // 옵션 - OPT1_펄스폭
        public static readonly string OPT1PulseWidth = "6203";
        // 옵션 - OPT1_범위설정사용여부
        public static readonly string OPT1RangeSetting = "6204";
        // 옵션 - OPT1_상한범위
        public static readonly string OPT1OverRange = "6205";
        // 옵션 - OPT1_하한범위
        public static readonly string OPT1UnderRange = "6206";
        // 옵션 - OPT1_포트
        public static readonly string OPT1Port = "6207";
        // 옵션 - OPT2_포트
        public static readonly string OPT2Port = "6231";
        // 옵션 - OPT2_지연시간1
        public static readonly string OPT2DelayTime1 = "6232";
        // 옵션 - OPT2_지연시간2
        public static readonly string OPT2DelayTime2 = "6233";
        // 옵션 - OPT2_영점실행주기
        public static readonly string OPT2ZeroZoneCycle = "6234";
        // 옵션 - OPT2_영점실행개수
        public static readonly string OPT2ZeroZoneCount = "6235";
        // 옵션 - 메인보드와의 통신 Baudrate
        public static readonly string BLDCCommBaudrate = "6700";
        // 옵션 - 메인보드와의 통신 Parity bit
        public static readonly string BLDCCommParityBit = "6701";
        // 옵션 - PWM 변화 속도
        public static readonly string BLDCPWMDelay = "6702";
        // 옵션 - Feedback 구동을 위한 변화 편차
        public static readonly string BLDCFeedbackDeviation = "6703";
        // 옵션 - Motor 속도
        public static readonly string BLDCMotorSpeed = "6704";
        // 옵션 - BLDC 모터 Pole 수
        public static readonly string BLDCPoleNum = "6705";
        // 옵션 - 감속기 비율
        public static readonly string BLDCAttenuatorRatio = "6706";
        // 옵션 - Version : Major(버전 맨 앞 두자리)
        public static readonly string BLDCVersionMajor = "6730";
        // 옵션 - Version : Minor(버전 두번째 두자리)
        public static readonly string BLDCVersionMinor = "6731";
        // 옵션 - Version : Build(버전 맨 뒤 두자리)
        public static readonly string BLDCVersionBuild = "6732";
        // 옵션 - 구동중인 모터의 주파수
        public static readonly string BLDCFrequency = "6733";
        // 옵션 - 구동중인 모터의 RPM
        public static readonly string BLDCMotorRPM = "6734";
        // 옵션 - 구동중인 모터의 방향
        public static readonly string BLDCMotorDirection = "6735";
        // 옵션 - 감속기 RPM
        public static readonly string BLDCAttenuatorRPM = "6736";
        // 옵션 - 부팅 시 자동 구동 여부
        public static readonly string BLDCBootingStart = "6760";
        // 옵션 - 타 Port 모터 사용 여부
        public static readonly string BLDCPortUse = "6761";
        // 옵션 - 모터 구동 중 피드벡 제어 여부
        public static readonly string BLDCFeedback = "6762";
        // 옵션 - 초기 모터 방향
        public static readonly string BLDCInitDirection = "6763";
        // 옵션 - 구동 중 모터 방향
        public static readonly string BLDCOperDirection = "6764";
        // 옵션 - 구동 모드
        public static readonly string BLDCSelectOperMode = "6765";
        // 옵션 - 파라미터 읽기
        public static readonly string ParameterRead6901 = "6901";

        // RS232 통신1 속도
        public static readonly string Serial1_BaudRate = "7001";
        // RS232 통신1 모드
        public static readonly string Serial1_Mode = "7002";
        // RS232 통신 1 속도, 모드
        public static readonly string Serial1 = "7003";

        // 통신,IO설정 - INPUT ALL
        public static readonly string InputAll = "7500";
        // 통신,IO설정 = OUTPUT1
        public static readonly string Output1 = "7701";
        // 통신,IO설정 = OUTPUT2
        public static readonly string Output2 = "7702";
        // 통신,IO설정 = OUTPUT3
        public static readonly string Output3 = "7703";
        // 통신,IO설정 = OUTPUT4
        public static readonly string Output4 = "7704";
        // 통신,IO설정 = OUTPUT5
        public static readonly string Output5 = "7705";
        // 통신,IO설정 = OUTPUT6
        public static readonly string Output6 = "7706";
        // 통신,IO설정 = OUTPUT7
        public static readonly string Output7 = "7707";
        // 통신,IO설정 = OUTPUT8
        public static readonly string Output8 = "7708";
        // 통신,IO설정 = OUTPUT9
        public static readonly string Output9 = "7709";
        // 통신,IO설정 = OUTPUT10
        public static readonly string Output10 = "7710";
        // 통신,IO설정 = OUTPUT11
        public static readonly string Output11 = "7711";
        // 통신,IO설정 = OUTPUT12
        public static readonly string Output12 = "7712";
        // 통신,IO설정 = OUTPUT13
        public static readonly string Output13 = "7713";
        // 통신,IO설정 = OUTPUT14
        public static readonly string Output14 = "7714";
        // 통신,IO설정 = OUTPUT15
        public static readonly string Output15 = "7715";
        // 통신,IO설정 = OUTPUT16
        public static readonly string Output16 = "7716";

        // 전체파라미터 쓰기 1
        public static readonly string SystemParameterWrite1 = "9018";
        // 전체파라미터 쓰기 2
        public static readonly string SystemParameterWrite2 = "9019";
        // 전체파라미터 쓰기 3
        public static readonly string SystemParameterWrite3 = "9020";
        // 전체파라미터 쓰기 4
        public static readonly string SystemParameterWrite4 = "9044";
        // 랜덤모드 쓰기
        public static readonly string RandomModeWrite = "9023";
        // 중량설정값 쓰기
        public static readonly string ParameterWeightSetting = "9024";
        // 전체파라미터 쓰기
        public static readonly string SystemParameterWriteAll = "9033";
        // BLDC 모터 설정값 쓰기
        public static readonly string BLDCMotorSetting = "9041";
        // 전체 카운트 읽기/쓰기
        public static readonly string ParameterCount = "9031";
        //// 시스템파라미터 읽기1
        //public static readonly string SystemParameterRead1 = "9501";
        //// 시스템파라미터 읽기2
        //public static readonly string SystemParameterRead2 = "9502";
        //// 시스템파라미터 읽기3
        //public static readonly string SystemParameterRead3 = "9503";
        //// 시스템파라미터 읽기4
        //public static readonly string SystemParameterRead4 = "9504";


        // 시스템정보 파라미터 읽기1
        public static readonly string SystemInformationRead1 = "9518";
        // 시스템정보 파라미터 읽기2
        public static readonly string SystemInformationRead2 = "9519";
        // 시스템정보 파라미터 읽기3
        public static readonly string SystemInformationRead3 = "9520";
        // BLDC 모터 파라미터 읽기
        public static readonly string BLDCMotorParameterRead = "9516";
        // BLDC 모터 알람 읽기
        public static readonly string BLDCMotorAlarmRead = "9517";
    }
    #endregion

    #region CommunicationServo
    public class ServoMotorParameterAddress
    {
        // Alarm Reset - 0x0049
        public static readonly int AlarmReset = 73;

        // CCW TRQ LMT - 0x00C8
        public static readonly int CCWTorqueLimit = 200;
        // CW TRQ LMT - 0x00C9
        public static readonly int CWTorqueLimit = 201;

        // Grop Speed 0 - 0x0131
        public static readonly int GropSpeed0 = 305;

        // Position CMD 0 - 0x01F4
        public static readonly int PositionCMD0 = 500;
        // Position CMD 1 - 0x01F5
        public static readonly int PositionCMD1 = 501;
        // Position CMD 2 - 0x01F6
        public static readonly int PositionCMD2 = 502;
        // Position CMD 3 - 0x01F7
        public static readonly int PositionCMD3 = 503;

        // ORG Speed 0 - 0x0258
        public static readonly int ORGSpeed0 = 600;
        // ORG Speed 1 - 0x0259
        public static readonly int ORGSpeed1 = 601;
        // Origin Offset - 0x025B
        public static readonly int OriginOffset = 603;
        // Jog Speed 0 - 0x025D
        public static readonly int JogSpeed0 = 605;

        // Angle Division - 0x02C2
        public static readonly int AngleDivision = 706;
    } 
    #endregion

    #region Modbus
    public class _39000_ModbusAddressAlarm
    {
        public const short _9001_Alarm1 = 9000;
        public const short _9002_Alarm2 = 9001;
        public const short _9003_Alarm3 = 9002;
        public const short _9004_Alarm4 = 9003;
        public const short _9005_Alarm5 = 9004;
        public const short _9006_Alarm6 = 9005;
        public const short _9007_Alarm7 = 9006;
        public const short _9008_Alarm8 = 9007;
        public const short _9009_Alarm9 = 9008;
        public const short _9010_Alarm10 = 9009;
        public const short _9011_Alarm11 = 9010;
        public const short _9012_Alarm12 = 9011;
        public const short _9013_Alarm13 = 9012;
        public const short _9014_Alarm14 = 9013;
        public const short _9015_Alarm15 = 9014;
        public const short _9016_Alarm16 = 9015;
        public const short _9017_Alarm17 = 9016;
        public const short _9018_Alarm18 = 9017;
    }
    public class _30000_ModbusAddress
    {
        public const int _01_DecimalPoint = 0;
        public const int _01_IsUpdate_High = 10;
        public const int _02_IsUpdate_Low = 11;
        public const int _03_EquipmentID_High = 12;
        public const int _04_EquipmentID_Low = 13;
        public const int _05_ProductNo_High = 14;
        public const int _06_ProductNo_Low = 15;
        public const int _07_UnderValueFloat_High = 16;
        public const int _08_UnderValueFloat_Low = 17;
        public const int _09_PassValueFloat_High = 18;
        public const int _10_PassValueFloat_Low = 19;
        public const int _11_OverValueFloat_High = 20;
        public const int _12_OverValueFloat_Low = 21;
        public const int _13_TareValueFloat_High = 22;
        public const int _14_TareValueFloat_Low = 23;
        public const int _15_UnderCount_High = 24;
        public const int _16_UnderCount_Low = 25;
        public const int _17_PassCount_High = 26;
        public const int _18_PassCount_Low = 27;
        public const int _19_OverCount_High = 28;
        public const int _20_OverCount_Low = 29;
        public const int _21_NGCount_High = 30;
        public const int _22_NGCount_Low = 31;
        public const int _23_ExNGCount_High = 32;
        public const int _24_ExNGCount_Low = 33;
        public const int _25_TotalCount_High = 34;
        public const int _26_TotalCount_Low = 35;
        public const int _27_Grade_High = 36;
        public const int _28_Grade_Low = 37;
        public const int _29_WeightFloat_High = 38;
        public const int _30_WeightFloat_Low = 39;
        public const int _31_OperationStatus_High = 40;
        public const int _32_OperationStatus_Low = 41;
        public const int _33_AlarmStatus_High = 42;
        public const int _34_AlarmStatus_Low = 43;
        public const int _35_Speed_High = 44;
        public const int _36_Speed_Low = 45;
        public const int _37_MetalDetectionCount_High = 46;
        public const int _38_MetalDetectionCount_Low = 47;
        public const int _39_DoubleEntryCount_High = 48;
        public const int _40_DoubleEntryCount_Low = 49;
        public const int _41_ProductName = 50; // 41~50
        public const int _51_UnderValueInt_High = 60;
        public const int _52_UnderValueInt_Low = 61;
        public const int _53_PassValueInt_High = 62;
        public const int _54_PassValueInt_Low = 63;
        public const int _55_OverValueInt_High = 64;
        public const int _56_OverValueInt_Low = 65;
        public const int _57_TareValueInt_High = 66;
        public const int _58_TareValueInt_Low = 67;
        public const int _59_WeightInt_High = 68;
        public const int _60_WeightInt_Low = 69;

        #region V7
        //public const int _01_EquipmentID = 10;
        //public const int _02_ProductNo = 11;
        //public const int _03_UnderValue_High = 12;
        //public const int _04_UnderValue_Low = 13;
        //public const int _05_PassValue_High = 14;
        //public const int _06_PassValue_Low = 15;
        //public const int _07_OverValue_High = 16;
        //public const int _08_OverValue_Low = 17;
        //public const int _09_UnderCount_High = 18;
        //public const int _10_UnderCount_Low = 19;
        //public const int _11_PassCount_High = 20;
        //public const int _12_PassCount_Low = 21;
        //public const int _13_OverCount_High = 22;
        //public const int _14_OverCount_Low = 23;
        //public const int _15_NGCount_High = 24;
        //public const int _16_NGCount_Low = 25;
        //public const int _17_ExNGCount_High = 26;
        //public const int _18_ExNGCount_Low = 27;
        //public const int _19_TotalCount_High = 28;
        //public const int _20_TotalCount_Low = 29;
        //public const int _21_Grade = 30;
        //public const int _22_Weight_High = 31;
        //public const int _23_Weight_Low = 32;
        //public const int _24_OperationStatus = 33;
        #endregion
    }
    public class _30000_ModbusData
    {
        #region Field
        private int m_IsUpdate;
        private int m_EquipmentID;
        private int m_ProductNo;
        private int m_UnderValueInt;
        private int m_PassValueInt;
        private int m_OverValueInt;
        private int m_TareValueInt;
        private double m_UnderValueFloat;
        private double m_PassValueFloat;
        private double m_OverValueFloat;
        private double m_TareValueFloat;
        private UInt32 m_UnderCount;
        private UInt32 m_PassCount;
        private UInt32 m_OverCount;
        private UInt32 m_NGCount;
        private UInt32 m_ExNGCount;
        private UInt32 m_TotalCount;
        private int m_Grade;
        private double m_WeightFloat;
        private int m_WeightInt;
        private int m_OperationStatus;
        private int m_AlarmStatus;
        private int m_Speed;
        private UInt32 m_MetalDetectionCount;
        private UInt32 m_DoubleEntryCount;
        private byte[] m_ProductName;

        private short[] m_Alarm;
        #endregion

        #region Constructor
        public _30000_ModbusData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int IsUpdate
        {
            get { return this.m_IsUpdate; }
            set { this.m_IsUpdate = value; }
        }
        public int EquipmentID
        {
            get { return this.m_EquipmentID; }
            set { this.m_EquipmentID = value; }
        }
        public int ProductNo
        {
            get { return this.m_ProductNo; }
            set { this.m_ProductNo = value; }
        }

        public int UnderValueInt
        {
            get { return this.m_UnderValueInt; }
            set { this.m_UnderValueInt = value; }
        }
        public int PassValueInt
        {
            get { return this.m_PassValueInt; }
            set { this.m_PassValueInt = value; }
        }
        public int OverValueInt
        {
            get { return this.m_OverValueInt; }
            set { this.m_OverValueInt = value; }
        }
        public int TareValueInt
        {
            get { return this.m_TareValueInt; }
            set { this.m_TareValueInt = value; }
        }

        public double UnderValueFloat
        {
            get { return this.m_UnderValueFloat; }
            set { this.m_UnderValueFloat = value; }
        }
        public double PassValueFloat
        {
            get { return this.m_PassValueFloat; }
            set { this.m_PassValueFloat = value; }
        }
        public double OverValueFloat
        {
            get { return this.m_OverValueFloat; }
            set { this.m_OverValueFloat = value; }
        }
        public double TareValueFloat
        {
            get { return this.m_TareValueFloat; }
            set { this.m_TareValueFloat = value; }
        }

        public UInt32 UnderCount
        {
            get { return this.m_UnderCount; }
            set { this.m_UnderCount = value; }
        }
        public UInt32 PassCount
        {
            get { return this.m_PassCount; }
            set { this.m_PassCount = value; }
        }
        public UInt32 OverCount
        {
            get { return this.m_OverCount; }
            set { this.m_OverCount = value; }
        }
        public UInt32 NGCount
        {
            get { return this.m_NGCount; }
            set { this.m_NGCount = value; }
        }
        public UInt32 ExNGCount
        {
            get { return this.m_ExNGCount; }
            set { this.m_ExNGCount = value; }
        }
        public UInt32 TotalCount
        {
            get { return this.m_TotalCount; }
            set { this.m_TotalCount = value; }
        }

        public int Grade
        {
            get { return this.m_Grade; }
            set { this.m_Grade = value; }
        }
        public double WeightFloat
        {
            get { return this.m_WeightFloat; }
            set { this.m_WeightFloat = value; }
        }
        public int WeightInt
        {
            get { return this.m_WeightInt; }
            set { this.m_WeightInt = value; }
        }
        public int OperationStatus
        {
            get { return this.m_OperationStatus; }
            set { this.m_OperationStatus = value; }
        }
        public int AlarmStatus
        {
            get { return this.m_AlarmStatus; }
            set { this.m_AlarmStatus = value; }
        }
        public int Speed
        {
            get { return this.m_Speed; }
            set { this.m_Speed = value; }
        }
        public UInt32 MetalDetectionCount
        {
            get { return this.m_MetalDetectionCount; }
            set { this.m_MetalDetectionCount = value; }
        }
        public UInt32 DoubleEntryCount
        {
            get { return this.m_DoubleEntryCount; }
            set { this.m_DoubleEntryCount = value; }
        }
        public byte[] ProductName
        {
            get { return this.m_ProductName; }
            set { this.m_ProductName = value; }
        }

        public short[] Alarm
        {
            get { return this.m_Alarm; }
            set { this.m_Alarm = value; }
        }

        public string HexStringIsUpdate
        {
            get
            {
                string hexString = this.IsUpdate.ToString("X8");
                return hexString;
            }
        }
        public string HexStringEquipmentID
        {
            get
            {
                string hexString = this.EquipmentID.ToString("X8");
                return hexString;
            }
        }
        public string HexStringProductNo
        {
            get
            {
                string hexString = this.ProductNo.ToString("X8");
                return hexString;
            }
        }
        public string HexStringUnderValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.UnderValueFloat);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringPassValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.PassValueFloat);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringOverValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.OverValueFloat);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringTareValue
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.TareValueFloat);
                Array.Reverse(bytes);
                string hexString = BitConverter.ToString(bytes);
                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringUnderCount
        {
            get
            {
                string hexString = this.UnderCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringPassCount
        {
            get
            {
                string hexString = this.PassCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringOverCount
        {
            get
            {
                string hexString = this.OverCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringNGCount
        {
            get
            {
                string hexString = this.NGCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringExNGCount
        {
            get
            {
                string hexString = this.ExNGCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringTotalCount
        {
            get
            {
                string hexString = this.TotalCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringGrade
        {
            get
            {
                string hexString = this.Grade.ToString("X8");
                return hexString;
            }
        }
        public string HexStringWeight
        {
            get
            {
                byte[] bytes = BitConverter.GetBytes((float)this.WeightFloat);
                byte[] reverseBytes = new byte[bytes.Length];
                for (int i = 0; i < bytes.Length; i++)
                    reverseBytes[bytes.Length - 1 - i] = bytes[i];
                string hexString = BitConverter.ToString(reverseBytes);

                hexString = hexString.Replace("-", "");

                return hexString;
            }
        }
        public string HexStringOperationStatus
        {
            get
            {
                string hexString = this.OperationStatus.ToString("X8");
                return hexString;
            }
        }
        public string HexStringAlarmStatus
        {
            get
            {
                string hexString = this.AlarmStatus.ToString("X8");
                return hexString;
            }
        }
        public string HexStringSpeed
        {
            get
            {
                string hexString = this.Speed.ToString("X8");
                return hexString;
            }
        }
        public string HexStringMetalDetectionCount
        {
            get
            {
                string hexString = this.MetalDetectionCount.ToString("X8");
                return hexString;
            }
        }
        public string HexStringDoubleEntryCount
        {
            get
            {
                string hexString = this.DoubleEntryCount.ToString("X8");
                return hexString;
            }
        }
        public string[] HexStringAlarm
        {
            get
            {
                string[] hexString = new string[this.Alarm.Count()];

                for (int i = 0; i < this.Alarm.Count(); i++)
                    hexString[i] = this.Alarm[i].ToString("X8");

                return hexString;
            }
        }

        public byte[] _01_IsUpdate_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.IsUpdate);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _02_IsUpdate_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.IsUpdate);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _03_EquipmentID_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.EquipmentID);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _04_EquipmentID_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.EquipmentID);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _05_ProductNo_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ProductNo);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _06_ProductNo_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ProductNo);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _07_UnderValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.UnderValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _08_UnderValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.UnderValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _09_PassValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.PassValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _10_PassValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.PassValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _11_OverValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.OverValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _12_OverValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.OverValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _13_TareValue_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.TareValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _14_TareValue_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.TareValueFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _15_UnderCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.UnderCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _16_UnderCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.UnderCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _17_PassCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.PassCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _18_PassCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.PassCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _19_OverCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OverCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _20_OverCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OverCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _21_NGCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.NGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _22_NGCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.NGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _23_ETCExNGCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ExNGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _24_ETCExNGCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.ExNGCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _25_TotalCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.TotalCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _26_TotalCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.TotalCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _27_Grade_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Grade);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _28_Grade_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Grade);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _29_Weight_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.WeightFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _30_Weight_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes((Single)this.WeightFloat);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _31_OperationStatus_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OperationStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _32_OperationStatus_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.OperationStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _33_AlarmStatus_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.AlarmStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _34_AlarmStatus_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.AlarmStatus);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _35_Speed_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Speed);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _36_Speed_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.Speed);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _37_MetalDetectionCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.MetalDetectionCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _38_MetalDetectionCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.MetalDetectionCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        public byte[] _39_DoubleEntryCount_High
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.DoubleEntryCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[3 - i];

                return madeData;
            }
        }
        public byte[] _40_DoubleEntryCount_Low
        {
            get
            {
                byte[] madeData = new byte[2];
                byte[] Length4Value = new byte[4];

                Length4Value = Modbus.GetBytes(this.DoubleEntryCount);
                for (int i = 0; i < 2; i++)
                    madeData[i] = Length4Value[1 - i];

                return madeData;
            }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsUpdate = 0;
            this.EquipmentID = 1;
            this.ProductNo = 1;
            this.UnderValueFloat = 100.0;
            this.PassValueFloat = 200.0;
            this.OverValueFloat = 300.0;
            this.TareValueFloat = 0.0;
            this.UnderValueInt = 1000;
            this.PassValueInt = 2000;
            this.OverValueInt = 3000;
            this.TareValueInt = 0;
            this.UnderCount = 0;
            this.PassCount = 0;
            this.OverCount = 0;
            this.NGCount = 0;
            this.ExNGCount = 0;
            this.TotalCount = 0;
            this.Grade = 5;
            this.WeightFloat = 0.0;
            this.WeightInt = 0;
            this.OperationStatus = 0;
            this.AlarmStatus = 0;
            this.Speed = 0;
            this.MetalDetectionCount = 0;
            this.DoubleEntryCount = 0;
            this.ProductName = new byte[20];
            this.Alarm = new short[6];
        }
        #endregion
    }

    public class _40000_ModbusAddress
    {
        public const int _01_Clear = 10;
        public const int _02_ClearResult = 11;
        public const int _03_Operation = 12;
        public const int _04_OperationResult = 13;
        public const int _05_ProductChange_High = 14;
        public const int _06_ProductChange_Low = 15;
        public const int _07_ProductChangeResult = 16;
        public const int _08_UnderRange_High = 17;
        public const int _09_UnderRange_Low = 18;
        public const int _10_UnderRangeResult = 19;
        public const int _11_PassRange_High = 20;
        public const int _12_PassRange_Low = 21;
        public const int _13_PassRangeResult = 22;
        public const int _14_OverRange_High = 23;
        public const int _15_OverRange_Low = 24;
        public const int _16_OverRangeResult = 25;
        public const int _17_TareWeight_High = 26;
        public const int _18_TareWeight_Low = 27;
        public const int _19_TareWeightResult = 28;
    }
    public class _40000_ModbusData
    {
        #region Field
        private int m_40011_Clear;
        private int m_40012_ClearResult;
        private int m_40013_Operation;
        private int m_40014_OperationResult;
        private int m_40015_ProductChange;
        private int m_40017_ProductChangeResult;
        private int m_40018_UnderRange;
        private int m_40020_UnderRangeResult;
        private int m_40021_PassRange;
        private int m_40023_PassRangeResult;
        private int m_40024_OverRange;
        private int m_40026_OverRangeResult;
        private int m_40027_TareWeight;
        private int m_40029_TareWeightResult;
        #endregion

        #region Constructor
        public _40000_ModbusData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int _40011_Clear
        {
            get { return this.m_40011_Clear; }
            set { this.m_40011_Clear = value; }
        }
        public int _40012_ClearResult
        {
            get { return this.m_40012_ClearResult; }
            set { this.m_40012_ClearResult = value; }
        }
        public int _40013_Operation
        {
            get { return this.m_40013_Operation; }
            set { this.m_40013_Operation = value; }
        }
        public int _40014_OperationResult
        {
            get { return this.m_40014_OperationResult; }
            set { this.m_40014_OperationResult = value; }
        }
        public int _40015_ProductChange
        {
            get { return this.m_40015_ProductChange; }
            set { this.m_40015_ProductChange = value; }
        }
        public int _40017_ProductChangeResult
        {
            get { return this.m_40017_ProductChangeResult; }
            set { this.m_40017_ProductChangeResult = value; }
        }
        public int _40018_UnderRange
        {
            get { return this.m_40018_UnderRange; }
            set { this.m_40018_UnderRange = value; }
        }
        public int _40020_UnderRangeResult
        {
            get { return this.m_40020_UnderRangeResult; }
            set { this.m_40020_UnderRangeResult = value; }
        }
        public int _40021_PassRange
        {
            get { return this.m_40021_PassRange; }
            set { this.m_40021_PassRange = value; }
        }
        public int _40023_PassRangeResult
        {
            get { return this.m_40023_PassRangeResult; }
            set { this.m_40023_PassRangeResult = value; }
        }
        public int _40024_OverRange
        {
            get { return this.m_40024_OverRange; }
            set { this.m_40024_OverRange = value; }
        }
        public int _40026_OverRangeResult
        {
            get { return this.m_40026_OverRangeResult; }
            set { this.m_40026_OverRangeResult = value; }
        }
        public int _40027_TareWeight
        {
            get { return this.m_40027_TareWeight; }
            set { this.m_40027_TareWeight = value; }
        }
        public int _40029_TareWeightResult
        {
            get { return this.m_40029_TareWeightResult; }
            set { this.m_40029_TareWeightResult = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this._40011_Clear = 0;
            this._40012_ClearResult = 0;
            this._40013_Operation = 0;
            this._40014_OperationResult = 0;
            this._40015_ProductChange = 0;
            this._40017_ProductChangeResult = 0;
            this._40018_UnderRange = 0;
            this._40020_UnderRangeResult = 0;
            this._40021_PassRange = 0;
            this._40023_PassRangeResult = 0;
            this._40024_OverRange = 0;
            this._40026_OverRangeResult = 0;
            this._40027_TareWeight = 0;
            this._40029_TareWeightResult = 0;
        }
        #endregion
    }
    #endregion

    #region CommunicationRespone
    public class CommunicationRespone
    {
        #region Field
        private bool m_IsFirst;

        private string m_TransactionID;
        private string m_TransferCount;
        #endregion

        #region Constructor
        public CommunicationRespone()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsFirst
        {
            get { return this.m_IsFirst; }
            set { this.m_IsFirst = value; }
        }

        /// <summary>
        /// Data ID (0~9)
        /// </summary>
        public string TransactionID
        {
            get { return this.m_TransactionID; }
            set { this.m_TransactionID = value; }
        }
        /// <summary>
        /// 재전송 CNT (0~9)
        /// </summary>
        public string TransferCount
        {
            get { return this.m_TransferCount; }
            set { this.m_TransferCount = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsFirst = false;

            this.TransactionID = "a";
            this.TransferCount = "a";
        }
        #endregion
    }
    #endregion

    public class AlarmList
    {
        #region Field
        private bool m_Flag;

        private bool m_IsLoadCellError;
        private bool m_IsEntrySensorError;
        private bool m_IsInverterError;
        private bool m_IsPressureSensingError;
        private bool m_IsEmergencyStop;
        private bool m_IsDoorInterlock;
        private bool m_IsSorterError;
        private bool m_IsStackUpSensorError;
        private bool m_IsEntryNotDetected;

        public event Define.EventHandlerAlarmStateChange EventAlarmStateChange;
        #endregion

        #region Constructor
        public AlarmList()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public bool Flag
        {
            get { return this.m_Flag; }
            set { this.m_Flag = value; }
        }

        public bool IsLoadCellError
        {
            get { return this.m_IsLoadCellError; }
            set { this.m_IsLoadCellError = value; }
        }
        public bool IsEntrySensorError
        {
            get { return this.m_IsEntrySensorError; }
            set { this.m_IsEntrySensorError = value; }
        }
        public bool IsInverterError
        {
            get { return this.m_IsInverterError; }
            set { this.m_IsInverterError = value; }
        }
        public bool IsPressureSensingError
        {
            get { return this.m_IsPressureSensingError; }
            set { this.m_IsPressureSensingError = value; }
        }
        public bool IsEmergencyStop
        {
            get { return this.m_IsEmergencyStop; }
            set { this.m_IsEmergencyStop = value; }
        }
        public bool IsDoorInterlock
        {
            get { return this.m_IsDoorInterlock; }
            set { this.m_IsDoorInterlock = value; }
        }
        public bool IsSorterError
        {
            get { return this.m_IsSorterError; }
            set { this.m_IsSorterError = value; }
        }
        public bool IsStackUpSensorError
        {
            get { return this.m_IsStackUpSensorError; }
            set { this.m_IsStackUpSensorError = value; }
        }
        public bool IsEntryNotDetected
        {
            get { return this.m_IsEntryNotDetected; }
            set { this.m_IsEntryNotDetected = value; }
        }
        #endregion

        #region Method
        private void Initialize()
        {
            this.Flag = false;

            this.IsLoadCellError = false;
            this.IsEntrySensorError = false;
            this.IsInverterError = false;
            this.IsPressureSensingError = false;
            this.IsEmergencyStop = false;
            this.IsDoorInterlock = false;
            this.IsSorterError = false;
            this.IsStackUpSensorError = false;
            this.IsEntryNotDetected = false;
        }

        public bool IsAlarmOccured(string alarm)
        {
            bool occur = false;

            if (alarm != "00000000")
                occur = true;

            return occur;
        }
        public void SetAlarm(string alarm)
        {
            string sValue1 = "", sValue2 = "", sValue3 = "", sValue4 = "", sValue5 = "", sValue6 = "", sValue7 = "", sValue8 = "";

            this.Flag = false;

            if (alarm.Length != 8)
                return;

            sValue1 = Convert.ToString(Convert.ToInt16(alarm.Substring(0, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue2 = Convert.ToString(Convert.ToInt16(alarm.Substring(1, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue3 = Convert.ToString(Convert.ToInt16(alarm.Substring(2, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue4 = Convert.ToString(Convert.ToInt16(alarm.Substring(3, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue5 = Convert.ToString(Convert.ToInt16(alarm.Substring(4, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue6 = Convert.ToString(Convert.ToInt16(alarm.Substring(5, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue7 = Convert.ToString(Convert.ToInt16(alarm.Substring(6, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');
            sValue8 = Convert.ToString(Convert.ToInt16(alarm.Substring(7, 1), 16), 2).PadLeft((4 <= 1) ? 1 : 4, '0');

            // 알람 20-
            if (sValue5[0] == '0')
            { }
            else
            { }
            // 알람 19-
            if (sValue5[1] == '0')
            { }
            else
            { }
            // 알람 18-제품진입 미감지
            if (sValue5[2] == '0')
            {
            }
            else
            {
            }
            // 알람 17-사용X
            if (sValue5[3] == '0')
            { }
            else
            { }

            // 알람 16-
            if (sValue4[0] == '0')
            { }
            else
            { }
            // 알람 15-
            if (sValue4[1] == '0')
            { }
            else
            { }
            // 알람 14-배출센서 B
            if (sValue4[2] == '0')
            {
            }
            else
            {
            }
            // 알람 13-방풍커버열림
            if (sValue4[3] == '0')
            {
            }
            else
            {
            }

            // 알람 12-서보알람토크
            if (sValue3[0] == '0')
            { }
            else
            { }
            // 알람 11-통신에러
            if (sValue3[1] == '0')
            { }
            else
            { }
            // 알람 10-서보알람
            if (sValue3[2] == '0')
            { }
            else
            { }
            // 알람 9-인버터알람
            if (sValue3[3] == '0')
            {
                if (this.IsInverterError != false)
                {
                    this.IsInverterError = false;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a9_InverterError, "OFF");
                }
            }
            else
            {
                if (this.IsInverterError != true)
                {
                    this.IsInverterError = true;
                    this.Flag = true;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a9_InverterError, "ON");
                }
            }

            // 알람 8-비상정지
            if (sValue2[0] == '0')
            {
                if (this.IsEmergencyStop != false)
                {
                    this.IsEmergencyStop = false;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a8_EmergencyStop, "OFF");
                }
            }
            else
            {
                if (this.IsEmergencyStop != true)
                {
                    this.IsEmergencyStop = true;
                    this.Flag = true;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a8_EmergencyStop, "ON");
                }
            }
            // 알람 7-리젝터알람(배출센서 A)
            if (sValue2[1] == '0')
            {
            }
            else
            {
            }
            // 알람 6-적체센서
            if (sValue2[2] == '0')
            {
                if (this.IsStackUpSensorError != false)
                {
                    this.IsStackUpSensorError = false;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a6_StackUpSensorError, "OFF");
                }
            }
            else
            {
                if (this.IsStackUpSensorError != true)
                {
                    this.IsStackUpSensorError = true;
                    this.Flag = true;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a6_StackUpSensorError, "ON");
                }
            }
            // 알람 5-입력센서2(넘어짐)
            if (sValue2[3] == '0')
            { }
            else
            { }

            // 알람 4-도어알람
            if (sValue1[0] == '0')
            {
            }
            else
            {
            }
            // 알람 3-공압에러
            if (sValue1[1] == '0')
            {
            }
            else
            {
            }
            // 알람 2-셀 에러
            if (sValue1[2] == '0')
            {
                if (this.IsLoadCellError != false)
                {
                    this.IsLoadCellError = false;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a2_LoadCellError, "OFF");
                }
            }
            else
            {
                if (this.IsLoadCellError != true)
                {
                    this.IsLoadCellError = true;
                    this.Flag = true;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a2_LoadCellError, "ON");
                }
            }

            // 알람 1-입력센서 에러
            if (sValue1[3] == '0')
            {
                if (this.IsEntrySensorError != false)
                {
                    this.IsEntrySensorError = false;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a1_EntrySensorError, "OFF");
                }
            }
            else
            {
                if (this.IsEntrySensorError != true)
                {
                    this.IsEntrySensorError = true;
                    this.Flag = true;
                    this.EventAlarmStateChange(Define.E_TrackingAlarm.a1_EntrySensorError, "ON");
                }
            }
        }
        #endregion
    }

    #region SystemConfigurationItem1
    public class SystemConfigurationItem1
    {
        #region Field
        private bool m_IsLogin;
        private bool m_IsBarcodeEnable;
        private bool m_IsPrintPerProductEnable;
        private bool m_IsExternalInputBuzzer;
        private bool m_IsExternalInputLamp;
        private bool m_IsBLDCON;

        private int m_EquipmentID;
        private int m_DecimalPlaces;
        private int m_ProductNumber;
        private int m_UsbID;
        private int m_SerialCOM1BaudRate;
        private int m_SerialCOM1Mode;
        private int m_SerialCOM3BaudRate;
        private int m_SerialCOM3Mode;
        private int m_SerialCOM4BaudRate;
        private int m_SerialCOM4Mode;
        private int m_DatabackupFormat;
        private int m_TransmissionDelayTimeCOM1;
        private int m_TransmissionDelayTimeCOM3;
        private int m_TransmissionDelayTimeCOM4;
        private int m_StatisticsPrintFormat;
       
        private string m_SerialNumber;
        private string m_MainBoardVersion;
        private string m_Unit;
        private string m_UserDefineCOM1;
        private string m_UserDefineCOM3;
        private string m_UserDefineCOM4;

        private Define.E_LanguageID m_Language;
        #endregion

        #region Constructor
        public SystemConfigurationItem1()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsLogin
        {
            get { return this.m_IsLogin; }
            set { this.m_IsLogin = value; }
        }
        public bool IsBarcodeEnable
        {
            get { return this.m_IsBarcodeEnable; }
            set { this.m_IsBarcodeEnable = value; }
        }
        public bool IsPrinterEnable
        {
            get
            {
                if (this.SerialCOM1Mode == 3 || this.SerialCOM3Mode == 3 || this.SerialCOM4Mode == 3)
                    return true;
                else
                    return false;
            }
        }
        public bool IsPrintPerProductEnable
        {
            get { return this.m_IsPrintPerProductEnable; }
            set { this.m_IsPrintPerProductEnable = value; }
        }
        public bool IsExternalInputLamp
        {
            get { return this.m_IsExternalInputLamp; }
            set { this.m_IsExternalInputLamp = value; }
        }
        public bool IsExternalInputBuzzer
        {
            get { return this.m_IsExternalInputBuzzer; }
            set { this.m_IsExternalInputBuzzer = value; }
        }
        public bool IsBLDCON
        {
            get { return this.m_IsBLDCON; }
            set { this.m_IsBLDCON = value; }
        }

        public int EquipmentID
        {
            get { return this.m_EquipmentID; }
            set { this.m_EquipmentID = value; }
        }
        public int DecimalPlaces
        {
            get { return this.m_DecimalPlaces; }
            set { this.m_DecimalPlaces = value; }
        }
        public int ProductNumber
        {
            get { return this.m_ProductNumber; }
            set { this.m_ProductNumber = value; }
        }
        public int UsbID
        {
            get { return this.m_UsbID; }
            set { this.m_UsbID = value; }
        }
        public int SerialCOM1BaudRate
        {
            get { return this.m_SerialCOM1BaudRate; }
            set { this.m_SerialCOM1BaudRate = value; }
        }
        public int SerialCOM1Mode
        {
            get { return this.m_SerialCOM1Mode; }
            set { this.m_SerialCOM1Mode = value; }
        }
        public int SerialCOM3BaudRate
        {
            get { return this.m_SerialCOM3BaudRate; }
            set { this.m_SerialCOM3BaudRate = value; }
        }
        public int SerialCOM3Mode
        {
            get { return this.m_SerialCOM3Mode; }
            set { this.m_SerialCOM3Mode = value; }
        }
        public int SerialCOM4BaudRate
        {
            get { return this.m_SerialCOM4BaudRate; }
            set { this.m_SerialCOM4BaudRate = value; }
        }
        public int SerialCOM4Mode
        {
            get { return this.m_SerialCOM4Mode; }
            set { this.m_SerialCOM4Mode = value; }
        }
        public int DatabackupFormat
        {
            get { return this.m_DatabackupFormat; }
            set { this.m_DatabackupFormat = value; }
        }
        public int ProductCount
        {
            get
            {
                return 1000;
            }
        }
        public int TransmissionDelayTimeCOM1
        {
            get { return this.m_TransmissionDelayTimeCOM1; }
            set { this.m_TransmissionDelayTimeCOM1 = value; }
        }
        public int TransmissionDelayTimeCOM3
        {
            get { return this.m_TransmissionDelayTimeCOM3; }
            set { this.m_TransmissionDelayTimeCOM3 = value; }
        }
        public int TransmissionDelayTimeCOM4
        {
            get { return this.m_TransmissionDelayTimeCOM4; }
            set { this.m_TransmissionDelayTimeCOM4 = value; }
        }
        public int StatisticsPrintFormat
        {
            get { return this.m_StatisticsPrintFormat; }
            set { this.m_StatisticsPrintFormat = value; }
        }
      
        public string SerialNumber
        {
            get { return this.m_SerialNumber; }
            set { this.m_SerialNumber = value; }
        }
        public string MainBoardVersion
        {
            get { return this.m_MainBoardVersion; }
            set { this.m_MainBoardVersion = value; }
        }
        public string Unit
        {
            get { return this.m_Unit; }
            set { this.m_Unit = value; }
        }
        public string UserDefineCOM1
        {
            get { return this.m_UserDefineCOM1; }
            set { this.m_UserDefineCOM1 = value; }
        }
        public string UserDefineCOM3
        {
            get { return this.m_UserDefineCOM3; }
            set { this.m_UserDefineCOM3 = value; }
        }
        public string UserDefineCOM4
        {
            get { return this.m_UserDefineCOM4; }
            set { this.m_UserDefineCOM4 = value; }
        }

        public Define.E_LanguageID Language
        {
            get { return this.m_Language; }
            set { this.m_Language = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsLogin = false;
            this.IsBarcodeEnable = false;
            this.IsPrintPerProductEnable = false;
            this.IsExternalInputBuzzer = false;
            this.IsExternalInputLamp = false;
            this.IsBLDCON = false;

            this.EquipmentID = 1;
            this.DecimalPlaces = 2;
            this.ProductNumber = 1;
            this.UsbID = 1;
            this.SerialCOM1BaudRate = 0;
            this.SerialCOM1Mode = 0;
            this.SerialCOM3BaudRate = 0;
            this.SerialCOM3Mode = 0;
            this.SerialCOM4BaudRate = 0;
            this.SerialCOM4Mode = 0;
            this.DatabackupFormat = 0;
            this.TransmissionDelayTimeCOM1 = 0;
            this.TransmissionDelayTimeCOM3 = 0;
            this.TransmissionDelayTimeCOM4 = 0;
            this.StatisticsPrintFormat = 0;

            this.SerialNumber = "23G0000";
            this.MainBoardVersion = "000";
            this.Unit = "g";
            this.UserDefineCOM1 = "";
            this.UserDefineCOM3 = "";
            this.UserDefineCOM4 = "";

            this.Language = Define.E_LanguageID.Korean;
        }
        #endregion
    }
    #endregion
    #region StructSystemConfigurationItem1
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem1
    {
        public bool DummyBool1;
        public bool IsLogin;

        public int EquipmentID;
        public int DecimalPlaces;
        public int ProductNumber;
        public int UsbID;
        public int Serial1BaudRate;
        public int Serial1Mode;
        public int Serial2BaudRate;
        public int Serial2Mode;
        public int Serial3BaudRate;
        public int Serial3Mode;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)]
        public string SerialNumber;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
        public string Unit;

        public Define.E_LanguageID Language;

        public bool IsBLDCON;
        public bool IsExternalInputLamp;
        public bool IsExternalInputBuzzer;
        public bool IsPrintPerProductEnable;
        public bool IsBarcodeEnable;

        public int StatisticsPrintFormat;
        public int TransmissionDelayTimeCOM1;
        public int TransmissionDelayTimeCOM3;
        public int TransmissionDelayTimeCOM4;
        public int DatabackupFormat;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string UserDefineCOM1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string UserDefineCOM3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string UserDefineCOM4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
        public string DummyString5;
    }
    #endregion

    #region SystemConfigurationItem2
    public class SystemConfigurationItem2
    {
        #region Field
        // 카운터출력 관련
        private int m_CountingOutput1Mode;
        private int m_CountingOutput1Number;
        private bool m_IsCountingOutput1ConveyorStop;
        private bool m_IsCountingOutput1BuzzerOn;
        private bool m_IsCountingOutput1Continuous;
        private bool m_IsCountingOutput1ExternalOutput;

        private int m_CountingOutput2Mode;
        private int m_CountingOutput2Number;
        private bool m_IsCountingOutput2Continuous;
        private bool m_IsCountingOutput2ConveyorStop;
        private bool m_IsCountingOutput2BuzzerOn;
        private bool m_IsCountingOutput2ExternalOutput;

        // 통신모드 관련
        private int m_HitachiRoomNumberCOM1;
        private int m_MarkoprintLineNumberCOM1;
        private bool m_IsHitachiBlankToNoneCOM1;
        private bool m_IsMarkoprintDatePrintCOM1;
        private bool m_IsMarkoprintTodaytDatePrintCOM1;
        private string m_MarkoprintDateSettingCOM1;

        private int m_HitachiRoomNumberCOM3;
        private int m_MarkoprintLineNumberCOM3;
        private bool m_IsHitachiBlankToNoneCOM3;
        private bool m_IsMarkoprintDatePrintCOM3;
        private bool m_IsMarkoprintTodaytDatePrintCOM3;
        private string m_MarkoprintDateSettingCOM3;

        private int m_HitachiRoomNumberCOM4;
        private int m_MarkoprintLineNumberCOM4;
        private bool m_IsHitachiBlankToNoneCOM4;
        private bool m_IsMarkoprintDatePrintCOM4;
        private bool m_IsMarkoprintTodaytDatePrintCOM4;
        private string m_MarkoprintDateSettingCOM4;

        // 랜덤모드 관련
        private bool m_IsGroup1UsingRandomMode;
        private bool m_IsGroup2UsingRandomMode;
        private bool m_IsGroup3UsingRandomMode;
        private bool m_IsGroup4UsingRandomMode;
        private bool m_IsGroup5UsingRandomMode;

        private int m_FileNameExtension;

        private int m_BLDCTotalMotorNum;

        private bool m_IsDisconnectDetection;

        private int m_HitachiRoomNumberEthernet;
        private int m_MarkoprintLineNumberEthernet;
        private bool m_IsMarkoprintDatePrintEthernet;
        private bool m_IsMarkoprintTodaytDatePrintEthernet;
        private string m_MarkoprintDateSettingEthernet;
        private int m_EthernetPort;
        private int m_EthernetCommMode;
        private int m_EthernetOperationMode;
        private string m_EthernetAddress;
        private int m_ConveyorLength;
        private int m_SortingPointLength;
        private int m_EthernetLocalPort;
        private int m_Barcode;

        private int m_ModbusTCPSelectFunction;

        private int m_ModbusRTUSelectFunction;
        private int m_ModbusSlaveIDCOM1;
        private int m_ModbusSlaveIDCOM3;
        private int m_ModbusSlaveIDCOM4;

        private bool m_IsBypassDirectionPass;
        private bool m_IsBypassOnce;
        private bool m_IsCommunicationOption;

        private int m_ModbusTCPStartAddress;
        private int m_ModbusRTUStartAddressCOM1;
        private int m_ModbusRTUStartAddressCOM3;
        private int m_ModbusRTUStartAddressCOM4;

        private string m_UserGroupLevel1Name;
        private string m_UserGroupLevel2Name;
        private string m_UserGroupLevel3Name;

        private int m_UserAutomaticLogout;
        #endregion

        #region Constructor
        public SystemConfigurationItem2()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int CountingOutput1Mode
        {
            get { return this.m_CountingOutput1Mode; }
            set { this.m_CountingOutput1Mode = value; }
        }
        public int CountingOutput1Number
        {
            get { return this.m_CountingOutput1Number; }
            set { this.m_CountingOutput1Number = value; }
        }
        public bool IsCountingOutput1Continuous
        {
            get { return this.m_IsCountingOutput1Continuous; }
            set { this.m_IsCountingOutput1Continuous = value; }
        }
        public bool IsCountingOutput1ConveyorStop
        {
            get { return this.m_IsCountingOutput1ConveyorStop; }
            set { this.m_IsCountingOutput1ConveyorStop = value; }
        }
        public bool IsCountingOutput1BuzzerOn
        {
            get { return this.m_IsCountingOutput1BuzzerOn; }
            set { this.m_IsCountingOutput1BuzzerOn = value; }
        }
        public bool IsCountingOutput1ExternalOutput
        {
            get { return this.m_IsCountingOutput1ExternalOutput; }
            set { this.m_IsCountingOutput1ExternalOutput = value; }
        }

        public int CountingOutput2Mode
        {
            get { return this.m_CountingOutput2Mode; }
            set { this.m_CountingOutput2Mode = value; }
        }
        public int CountingOutput2Number
        {
            get { return this.m_CountingOutput2Number; }
            set { this.m_CountingOutput2Number = value; }
        }
        public bool IsCountingOutput2Continuous
        {
            get { return this.m_IsCountingOutput2Continuous; }
            set { this.m_IsCountingOutput2Continuous = value; }
        }
        public bool IsCountingOutput2ConveyorStop
        {
            get { return this.m_IsCountingOutput2ConveyorStop; }
            set { this.m_IsCountingOutput2ConveyorStop = value; }
        }
        public bool IsCountingOutput2BuzzerOn
        {
            get { return this.m_IsCountingOutput2BuzzerOn; }
            set { this.m_IsCountingOutput2BuzzerOn = value; }
        }
        public bool IsCountingOutput2ExternalOutput
        {
            get { return this.m_IsCountingOutput2ExternalOutput; }
            set { this.m_IsCountingOutput2ExternalOutput = value; }
        }

        public int HitachiRoomNumberCOM1
        {
            get { return this.m_HitachiRoomNumberCOM1; }
            set { this.m_HitachiRoomNumberCOM1 = value; }
        }
        public bool IsHitachiBlankToNoneCOM1
        {
            get { return this.m_IsHitachiBlankToNoneCOM1; }
            set { this.m_IsHitachiBlankToNoneCOM1 = value; }
        }
        public int MarkoprintLineNumberCOM1
        {
            get { return this.m_MarkoprintLineNumberCOM1; }
            set { this.m_MarkoprintLineNumberCOM1 = value; }
        }
        public bool IsMarkoprintDatePrintCOM1
        {
            get { return this.m_IsMarkoprintDatePrintCOM1; }
            set { this.m_IsMarkoprintDatePrintCOM1 = value; }
        }
        public bool IsMarkoprintTodaytDatePrintCOM1
        {
            get { return this.m_IsMarkoprintTodaytDatePrintCOM1; }
            set { this.m_IsMarkoprintTodaytDatePrintCOM1 = value; }
        }
        public string MarkoprintDateSettingCOM1
        {
            get { return this.m_MarkoprintDateSettingCOM1; }
            set { this.m_MarkoprintDateSettingCOM1 = value; }
        }

        public int HitachiRoomNumberCOM3
        {
            get { return this.m_HitachiRoomNumberCOM3; }
            set { this.m_HitachiRoomNumberCOM3 = value; }
        }
        public bool IsHitachiBlankToNoneCOM3
        {
            get { return this.m_IsHitachiBlankToNoneCOM3; }
            set { this.m_IsHitachiBlankToNoneCOM3 = value; }
        }
        public int MarkoprintLineNumberCOM3
        {
            get { return this.m_MarkoprintLineNumberCOM3; }
            set { this.m_MarkoprintLineNumberCOM3 = value; }
        }
        public bool IsMarkoprintDatePrintCOM3
        {
            get { return this.m_IsMarkoprintDatePrintCOM3; }
            set { this.m_IsMarkoprintDatePrintCOM3 = value; }
        }
        public bool IsMarkoprintTodaytDatePrintCOM3
        {
            get { return this.m_IsMarkoprintTodaytDatePrintCOM3; }
            set { this.m_IsMarkoprintTodaytDatePrintCOM3 = value; }
        }
        public string MarkoprintDateSettingCOM3
        {
            get { return this.m_MarkoprintDateSettingCOM3; }
            set { this.m_MarkoprintDateSettingCOM3 = value; }
        }

        public int HitachiRoomNumberCOM4
        {
            get { return this.m_HitachiRoomNumberCOM4; }
            set { this.m_HitachiRoomNumberCOM4 = value; }
        }
        public bool IsHitachiBlankToNoneCOM4
        {
            get { return this.m_IsHitachiBlankToNoneCOM4; }
            set { this.m_IsHitachiBlankToNoneCOM4 = value; }
        }
        public int MarkoprintLineNumberCOM4
        {
            get { return this.m_MarkoprintLineNumberCOM4; }
            set { this.m_MarkoprintLineNumberCOM4 = value; }
        }
        public bool IsMarkoprintDatePrintCOM4
        {
            get { return this.m_IsMarkoprintDatePrintCOM4; }
            set { this.m_IsMarkoprintDatePrintCOM4 = value; }
        }
        public bool IsMarkoprintTodaytDatePrintCOM4
        {
            get { return this.m_IsMarkoprintTodaytDatePrintCOM4; }
            set { this.m_IsMarkoprintTodaytDatePrintCOM4 = value; }
        }
        public string MarkoprintDateSettingCOM4
        {
            get { return this.m_MarkoprintDateSettingCOM4; }
            set { this.m_MarkoprintDateSettingCOM4 = value; }
        }

        public bool IsGroup1UsingRandomMode
        {
            get { return this.m_IsGroup1UsingRandomMode; }
            set { this.m_IsGroup1UsingRandomMode = value; }
        }
        public bool IsGroup2UsingRandomMode
        {
            get { return this.m_IsGroup2UsingRandomMode; }
            set { this.m_IsGroup2UsingRandomMode = value; }
        }
        public bool IsGroup3UsingRandomMode
        {
            get { return this.m_IsGroup3UsingRandomMode; }
            set { this.m_IsGroup3UsingRandomMode = value; }
        }
        public bool IsGroup4UsingRandomMode
        {
            get { return this.m_IsGroup4UsingRandomMode; }
            set { this.m_IsGroup4UsingRandomMode = value; }
        }
        public bool IsGroup5UsingRandomMode
        {
            get { return this.m_IsGroup5UsingRandomMode; }
            set { this.m_IsGroup5UsingRandomMode = value; }
        }
        public bool IsUsingRandomMode
        {
            get
            {
                if (this.IsGroup1UsingRandomMode == true || this.IsGroup2UsingRandomMode == true ||
                    this.IsGroup3UsingRandomMode == true || this.IsGroup4UsingRandomMode == true ||
                    this.IsGroup5UsingRandomMode == true)
                    return true;
                else
                    return false;
            }
        }

        public int FileNameExtension
        {
            get { return this.m_FileNameExtension; }
            set { this.m_FileNameExtension = value; }
        }

        public bool IsDisconnectDetection
        {
            get { return this.m_IsDisconnectDetection; }
            set { this.m_IsDisconnectDetection = value; }
        }

        public int BLDCTotalMotorNum
        {
            get { return this.m_BLDCTotalMotorNum; }
            set { this.m_BLDCTotalMotorNum = value; }
        }
        public int HitachiRoomNumberEthernet
        {
            get { return this.m_HitachiRoomNumberEthernet; }
            set { this.m_HitachiRoomNumberEthernet = value; }
        }
        public int MarkoprintLineNumberEthernet
        {
            get { return this.m_MarkoprintLineNumberEthernet; }
            set { this.m_MarkoprintLineNumberEthernet = value; }
        }
        public bool IsMarkoprintDatePrintEthernet
        {
            get { return this.m_IsMarkoprintDatePrintEthernet; }
            set { this.m_IsMarkoprintDatePrintEthernet = value; }
        }
        public bool IsMarkoprintTodaytDatePrintEthernet
        {
            get { return this.m_IsMarkoprintTodaytDatePrintEthernet; }
            set { this.m_IsMarkoprintTodaytDatePrintEthernet = value; }
        }
        public string MarkoprintDateSettingEthernet
        {
            get { return this.m_MarkoprintDateSettingEthernet; }
            set { this.m_MarkoprintDateSettingEthernet = value; }
        }
        public bool IsEthernetEnable
        {
            get
            {
                if (this.EthernetOperationMode != 0)
                    return true;
                else
                    return false;
            }
        }
        public int EthernetPort
        {
            get { return this.m_EthernetPort; }
            set { this.m_EthernetPort = value; }
        }
        public int EthernetCommMode
        {
            get { return this.m_EthernetCommMode; }
            set { this.m_EthernetCommMode = value; }
        }
        public int EthernetOperationMode
        {
            get { return this.m_EthernetOperationMode; }
            set { this.m_EthernetOperationMode = value; }
        }
        public string EthernetAddress
        {
            get { return this.m_EthernetAddress; }
            set { this.m_EthernetAddress = value; }
        }
        public int ConveyorLength
        {
            get { return this.m_ConveyorLength; }
            set { this.m_ConveyorLength = value; }
        }
        public int SortingPointLength
        {
            get { return this.m_SortingPointLength; }
            set { this.m_SortingPointLength = value; }
        }
        public int EthernetLocalPort
        {
            get { return this.m_EthernetLocalPort; }
            set { this.m_EthernetLocalPort = value; }
        }
        public int Barcode
        {
            get { return this.m_Barcode; }
            set { this.m_Barcode = value; }
        }

        public int ModbusTCPSelectFunction
        {
            get { return this.m_ModbusTCPSelectFunction; }
            set { this.m_ModbusTCPSelectFunction = value; }
        }

        public int ModbusRTUSelectFunction
        {
            get { return this.m_ModbusRTUSelectFunction; }
            set { this.m_ModbusRTUSelectFunction = value; }
        }
        public int ModbusSlaveIDCOM1
        {
            get { return this.m_ModbusSlaveIDCOM1; }
            set { this.m_ModbusSlaveIDCOM1 = value; }
        }
        public int ModbusSlaveIDCOM3
        {
            get { return this.m_ModbusSlaveIDCOM3; }
            set { this.m_ModbusSlaveIDCOM3 = value; }
        }
        public int ModbusSlaveIDCOM4
        {
            get { return this.m_ModbusSlaveIDCOM4; }
            set { this.m_ModbusSlaveIDCOM4 = value; }
        }

        public bool IsBypassDirectionPass
        {
            get { return this.m_IsBypassDirectionPass; }
            set { this.m_IsBypassDirectionPass = value; }
        }
        public bool IsBypassOnce
        {
            get { return this.m_IsBypassOnce; }
            set { this.m_IsBypassOnce = value; }
        }
        public bool IsCommunicationOption
        {
            get { return this.m_IsCommunicationOption; }
            set { this.m_IsCommunicationOption = value; }
        }

        public int ModbusTCPStartAddress
        {
            get { return this.m_ModbusTCPStartAddress; }
            set { this.m_ModbusTCPStartAddress = value; }
        }
        public int ModbusRTUStartAddressCOM1
        {
            get { return this.m_ModbusRTUStartAddressCOM1; }
            set { this.m_ModbusRTUStartAddressCOM1 = value; }
        }
        public int ModbusRTUStartAddressCOM3
        {
            get { return this.m_ModbusRTUStartAddressCOM3; }
            set { this.m_ModbusRTUStartAddressCOM3 = value; }
        }
        public int ModbusRTUStartAddressCOM4
        {
            get { return this.m_ModbusRTUStartAddressCOM4; }
            set { this.m_ModbusRTUStartAddressCOM4 = value; }
        }

        public string UserGroupLevel1Name
        {
            get { return this.m_UserGroupLevel1Name; }
            set { this.m_UserGroupLevel1Name = value; }
        }
        public string UserGroupLevel2Name
        {
            get { return this.m_UserGroupLevel2Name; }
            set { this.m_UserGroupLevel2Name = value; }
        }
        public string UserGroupLevel3Name
        {
            get { return this.m_UserGroupLevel3Name; }
            set { this.m_UserGroupLevel3Name = value; }
        }

        public int UserAutomaticLogout
        {
            get { return this.m_UserAutomaticLogout; }
            set { this.m_UserAutomaticLogout = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.CountingOutput1Mode = 0;
            this.CountingOutput1Number = 0;
            this.IsCountingOutput1Continuous = false;
            this.IsCountingOutput1ConveyorStop = false;
            this.IsCountingOutput1BuzzerOn = false;
            this.IsCountingOutput1ExternalOutput = false;

            this.CountingOutput2Mode = 0;
            this.CountingOutput2Number = 0;
            this.IsCountingOutput2Continuous = false;
            this.IsCountingOutput2ConveyorStop = false;
            this.IsCountingOutput2BuzzerOn = false;
            this.IsCountingOutput2ExternalOutput = false;

            this.HitachiRoomNumberCOM1 = 1;
            this.MarkoprintLineNumberCOM1 = 0;
            this.IsHitachiBlankToNoneCOM1 = false;
            this.IsMarkoprintDatePrintCOM1 = false;
            this.IsMarkoprintTodaytDatePrintCOM1 = false;
            this.MarkoprintDateSettingCOM1 = "";

            this.HitachiRoomNumberCOM3 = 1;
            this.MarkoprintLineNumberCOM3 = 0;
            this.IsHitachiBlankToNoneCOM3 = false;
            this.IsMarkoprintDatePrintCOM3 = false;
            this.IsMarkoprintTodaytDatePrintCOM3 = false;
            this.MarkoprintDateSettingCOM3 = "";

            this.HitachiRoomNumberCOM4 = 1;
            this.MarkoprintLineNumberCOM4 = 0;
            this.IsHitachiBlankToNoneCOM4 = false;
            this.IsMarkoprintDatePrintCOM4 = false;
            this.IsMarkoprintTodaytDatePrintCOM4 = false;
            this.MarkoprintDateSettingCOM4 = "";

            this.IsGroup1UsingRandomMode = false;
            this.IsGroup2UsingRandomMode = false;
            this.IsGroup3UsingRandomMode = false;
            this.IsGroup4UsingRandomMode = false;
            this.IsGroup5UsingRandomMode = false;

            this.FileNameExtension = 0;
            this.BLDCTotalMotorNum = 3;

            this.HitachiRoomNumberEthernet = 1;
            this.MarkoprintLineNumberEthernet = 0;
            this.IsMarkoprintDatePrintEthernet = false;
            this.IsMarkoprintTodaytDatePrintEthernet = false;
            this.MarkoprintDateSettingEthernet = "";
            this.EthernetPort = 0;
            this.EthernetCommMode = 0;
            this.EthernetOperationMode = 0;
            this.EthernetAddress = "0.0.0.0";
            this.ConveyorLength = 450;
            this.SortingPointLength = 250;
            this.EthernetLocalPort = 0;
            this.Barcode = 0;

            this.ModbusTCPSelectFunction = 0;

            this.ModbusRTUSelectFunction = 0;
            this.ModbusSlaveIDCOM1 = 1;
            this.ModbusSlaveIDCOM3 = 1;
            this.ModbusSlaveIDCOM4 = 1;

            this.IsBypassDirectionPass = true;
            this.IsBypassOnce = true;
            this.IsCommunicationOption = false;

            this.IsDisconnectDetection = true;
            this.ModbusTCPStartAddress = 10;
            this.ModbusRTUStartAddressCOM1 = 10;
            this.ModbusRTUStartAddressCOM3 = 10;
            this.ModbusRTUStartAddressCOM4 = 10;

            this.UserGroupLevel1Name = "Level1";
            this.UserGroupLevel2Name = "Level2";
            this.UserGroupLevel3Name = "Level3";

            this.UserAutomaticLogout = 90;
        }
        #endregion
    }
    #endregion
    #region StructSystemConfigurationItem2
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem2
    {
        public bool IsAlarm1Continuous;
        public bool IsAlarm1ConveyorStop;
        public bool IsAlarm1BuzzerOn;
        public bool IsAlarm1ExternalOutput;
        public bool IsAlarm2Continuous;
        public bool IsAlarm2ConveyorStop;
        public bool IsAlarm2BuzzerOn;
        public bool IsAlarm2ExternalOutput;

        public bool IsDisconnectDetection;
        public bool IsCommunicationOption;
        public bool IsBypassOnce;
        public bool IsBypassDirectionPass;
        public bool IsHitachiBlankToNoneCOM4;
        public bool IsHitachiBlankToNoneCOM3;
        public bool IsHitachiBlankToNoneCOM1;
        public bool IsMarkoprintTodaytDatePrintEthernet;
        public bool IsMarkoprintDatePrintEthernet;
        public bool IsGroup1UsingRandomMode;
        public bool IsGroup2UsingRandomMode;
        public bool IsGroup3UsingRandomMode;
        public bool IsGroup4UsingRandomMode;
        public bool IsGroup5UsingRandomMode;
        public bool IsMarkoprintTodaytDatePrintCOM4;
        public bool IsMarkoprintDatePrintCOM4;
        public bool IsMarkoprintTodaytDatePrintCOM3;
        public bool IsMarkoprintDatePrintCOM3;
        public bool IsMarkoprintTodaytDatePrintCOM1;
        public bool IsMarkoprintDatePrintCOM1;

        public int Alarm1Mode;
        public int Alarm1Number;
        public int Alarm2Mode;
        public int Alarm2Number;

        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;
        public int UserAutomaticLogout;
        public int ModbusTCPStartAddress;
        public int ModbusRTUStartAddressCOM1;
        public int ModbusRTUStartAddressCOM3;
        public int ModbusRTUStartAddressCOM4;
        public int ModbusTCPSelectFunction;
        public int BLDCTotalMotorNum;
        public int ModbusRTUSelectFunction;
        public int ModbusRTUSlaveIDCOM1;
        public int ModbusRTUSlaveIDCOM3;
        public int ModbusRTUSlaveIDCOM4;
        public int Barcode;
        public int EthernetLocalPort;
        public int SortingPointLength;
        public int ConveyorLength;
        public int MarkoprintLineNumberEthernet;
        public int HitachiRoomNumberEthernet;
        public int EthernetPort;
        public int EthernetCommMode;
        public int EthernetOperationMode;
        public int FileNameExtension;
        public int MarkoprintLineNumberCOM4;
        public int HitachiRoomNumberCOM4;
        public int MarkoprintLineNumberCOM3;
        public int HitachiRoomNumberCOM3;
        public int MarkoprintLineNumberCOM1;
        public int HitachiRoomNumberCOM1;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString6;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString7;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel1Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel2Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string UserGroupLevel3Name;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string MarkoprintDateSettingEthernet;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string EthernetAddress;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string MarkoprintDateSettingCOM4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string MarkoprintDateSettingCOM3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string MarkoprintDateSettingCOM1;
    }
    #endregion

    #region SystemConfigurationItem3
    public class SystemConfigurationItem3
    {
        #region Field
        private bool m_IsModbus;
        private bool m_IsPart11;

        private int m_MULTiJETSlaveAddressCOM1;
        private int m_MULTiJETSlaveAddressCOM3;
        private int m_MULTiJETSlaveAddressCOM4;
        private int m_MULTiJETSlaveAddressEthernet;

        private int m_StoragePeriod;
        private int m_NumberOfLoginFailures;
        #endregion

        #region Constructor
        public SystemConfigurationItem3()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsModbus
        {
            get { return this.m_IsModbus; }
            set { this.m_IsModbus = value; }
        }
        public bool IsPart11
        {
            get { return this.m_IsPart11; }
            set { this.m_IsPart11 = value; }
        }

        public int MULTiJETSlaveAddressCOM1
        {
            get { return this.m_MULTiJETSlaveAddressCOM1; }
            set { this.m_MULTiJETSlaveAddressCOM1 = value; }
        }
        public int MULTiJETSlaveAddressCOM3
        {
            get { return this.m_MULTiJETSlaveAddressCOM3; }
            set { this.m_MULTiJETSlaveAddressCOM3 = value; }
        }
        public int MULTiJETSlaveAddressCOM4
        {
            get { return this.m_MULTiJETSlaveAddressCOM4; }
            set { this.m_MULTiJETSlaveAddressCOM4 = value; }
        }
        public int MULTiJETSlaveAddressEthernet
        {
            get { return this.m_MULTiJETSlaveAddressEthernet; }
            set { this.m_MULTiJETSlaveAddressEthernet = value; }
        }

        public int StoragePeriod
        {
            get { return this.m_StoragePeriod; }
            set { this.m_StoragePeriod = value; }
        }
        public int NumberOfLoginFailures
        {
            get { return this.m_NumberOfLoginFailures; }
            set { this.m_NumberOfLoginFailures = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsModbus = false;
            this.IsPart11 = false;

            this.MULTiJETSlaveAddressCOM1 = 58;
            this.MULTiJETSlaveAddressCOM3 = 58;
            this.MULTiJETSlaveAddressCOM4 = 58;
            this.MULTiJETSlaveAddressEthernet = 58;

            this.StoragePeriod = 12;
            this.NumberOfLoginFailures = 5;
        }
        #endregion
    }
    #endregion
    #region StructSystemConfigurationItem3
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemConfigurationItem3
    {
        public bool DummyBool1;
        public bool DummyBool2;
        public bool DummyBool3;
        public bool DummyBool4;
        public bool DummyBool5;
        public bool DummyBool6;
        public bool DummyBool7;
        public bool DummyBool8;
        public bool DummyBool9;
        public bool DummyBool10;
        public bool DummyBool11;
        public bool DummyBool12;
        public bool DummyBool13;
        public bool DummyBool14;
        public bool DummyBool15;
        public bool DummyBool16;
        public bool DummyBool17;
        public bool DummyBool18;
        public bool DummyBool19;
        public bool DummyBool20;
        public bool DummyBool21;
        public bool DummyBool22;
        public bool DummyBool23;
        public bool DummyBool24;
        public bool DummyBool25;
        public bool DummyBool26;
        public bool DummyBool27;
        public bool DummyBool28;
        public bool IsModbus;
        public bool IsPart11;

        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;
        public int DummyInt4;
        public int DummyInt5;
        public int DummyInt6;
        public int DummyInt7;
        public int DummyInt8;
        public int DummyInt9;
        public int DummyInt10;
        public int DummyInt11;
        public int DummyInt12;
        public int DummyInt13;
        public int DummyInt14;
        public int DummyInt15;
        public int DummyInt16;
        public int DummyInt17;
        public int DummyInt18;
        public int DummyInt19;
        public int DummyInt20;
        public int DummyInt21;
        public int DummyInt22;
        public int DummyInt23;
        public int DummyInt24;
        public int NumberOfLoginFailures;
        public int MULTiJETSlaveAddressCOM1;
        public int MULTiJETSlaveAddressCOM3;
        public int MULTiJETSlaveAddressCOM4;
        public int MULTiJETSlaveAddressEthernet;
        public int StoragePeriod;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString6;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString7;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString8;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString9;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString10;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString11;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString12;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString13;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString14;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString15;
    }
    #endregion

    #region ProductItem
    public class ProductItem
    {
        #region Field
        private int m_Number;

        private string m_Name;
        private string m_LotNo;
        private string m_UnderRange;
        private string m_PassRange;
        private string m_OverRange;
        private string m_TareRange;
        private string m_SensingTime;
        private string m_DispenserDelayTime1;
        private string m_DispenserDelayTime2;
        private string m_Sorting;

        private int m_ProgressBarMaximum;
        private int m_ProgressBarMinimum;

        private Collection<int> m_CollectionNormalDistributionRange;
        private Collection<int> m_CollectionNormalDistributionViewRange;
        #endregion

        #region Constructor
        public ProductItem()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int Number
        {
            get { return this.m_Number; }
            set { this.m_Number = value; }
        }

        public string Name
        {
            get { return this.m_Name; }
            set { this.m_Name = value; }
        }
        public string LotNo
        {
            get { return this.m_LotNo; }
            set { this.m_LotNo = value; }
        }
        public string UnderRange
        {
            get { return this.m_UnderRange; }
            set
            {
                this.m_UnderRange = value;

                this.ProgressBarLevelRescale();
                this.NormalDistributionRangeCalculation();
            }
        }
        public string PassRange
        {
            get { return this.m_PassRange; }
            set
            {
                this.m_PassRange = value;
             
                this.NormalDistributionRangeCalculation();
            }
        }
        public string OverRange
        {
            get { return this.m_OverRange; }
            set
            {
                this.m_OverRange = value;

                this.ProgressBarLevelRescale();
                this.NormalDistributionRangeCalculation();
            }
        }
        public string TareRange
        {
            get { return this.m_TareRange; }
            set { this.m_TareRange = value; }
        }
        public string DispenserDelayTime1
        {
            get { return this.m_DispenserDelayTime1; }
            set { this.m_DispenserDelayTime1 = value; }
        }
        public string DispenserDelayTime2
        {
            get { return this.m_DispenserDelayTime2; }
            set { this.m_DispenserDelayTime2 = value; }
        }
        public string Sorting
        {
            get { return this.m_Sorting; }
            set { this.m_Sorting = value; }
        }

        public int OverRangeDeviation
        {
            get { return this.OverRangeInt - this.PassRangeInt; }
            //set
            //{
            //    int iValue = 0;
                
            //    iValue = this.OverRangeInt - Math.Abs(value);
                
            //    this.m_OverRange = iValue.ToString();
            //    this.m_OverRangeDeviation = value;
            //}
        }
        public int UnderRangeDeviation
        {
            get { return this.UnderRangeInt - this.PassRangeInt; }
            //set
            //{
            //    int iValue = 0;

            //    iValue = this.UnderRangeInt - Math.Abs(value);

            //    this.m_UnderRange = iValue.ToString();
            //    this.m_UnderRangeDeviation = value; 
            //}
        } 

        public int UnderRangeInt
        {
            get
            {
                if (this.UnderRange == null)
                    return -1;
                else
                    return int.Parse(this.UnderRange);
            }
        }
        public int PassRangeInt
        {
            get
            {
                if (this.PassRange == null)
                    return -1;
                else
                    return int.Parse(this.PassRange);
            }
        }
        public int OverRangeInt
        {
            get
            {
                if (this.OverRange == null)
                    return -1;
                else
                    return int.Parse(this.OverRange);
            }
        }
        public int TareRangeInt
        {
            get { return int.Parse(this.TareRange); }
        }
        public string SensingTime
        {
            get { return this.m_SensingTime; }
            set { this.m_SensingTime = value; }
        }

        public int ProgressBarMaximum
        {
            get { return this.m_ProgressBarMaximum; }
            private set { this.m_ProgressBarMaximum = value; }
        }
        public int ProgressBarMinimum
        {
            get { return this.m_ProgressBarMinimum; }
            private set { this.m_ProgressBarMinimum = value; }
        }

        public Collection<int> CollectionNormalDistributionRange
        {
            get { return this.m_CollectionNormalDistributionRange; }
            private set { this.m_CollectionNormalDistributionRange = value; }
        }
        public Collection<int> CollectionNormalDistributionViewRange
        {
            get { return this.m_CollectionNormalDistributionViewRange; }
            private set { this.m_CollectionNormalDistributionViewRange = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.CollectionNormalDistributionRange = new Collection<int>();
            this.CollectionNormalDistributionRange.Clear();
            for (int i = 0; i < 8; i++)
                this.CollectionNormalDistributionRange.Add(0);

            this.CollectionNormalDistributionViewRange = new Collection<int>();
            this.CollectionNormalDistributionViewRange.Clear();
            for (int i = 0; i < 9; i++)
                this.CollectionNormalDistributionViewRange.Add(0);

            this.Number = 1;
            this.Name = "Product 1";
            this.LotNo = "Lot 1";
            this.PassRange = "2000";
            this.UnderRange = "1000";
            this.OverRange = "3000";
            this.TareRange = "0";
            this.SensingTime = "0";
            this.DispenserDelayTime1 = "200";
            this.DispenserDelayTime2 = "200";
            this.Sorting = "0";

            this.ProgressBarMinimum = 0;
            this.ProgressBarMaximum = 5000;
        }

        private void ProgressBarLevelRescale()
        {
            int minBar, maxBar, gap;
            int OverRange, UnderRange;

            if (this.OverRange == null || this.UnderRange == null)
                return;

            OverRange = int.Parse(this.OverRange);
            UnderRange = int.Parse(this.UnderRange);

            gap = OverRange - UnderRange;

            minBar = UnderRange - gap;
            maxBar = OverRange + gap;

            this.ProgressBarMaximum = maxBar;
            this.ProgressBarMinimum = minBar;
        }

        private void NormalDistributionRangeCalculation()
        {
            int overGap = 0, underGap = 0, gap = 0, gap1 = 0;

            if (this.OverRangeInt == -1 || this.PassRangeInt == -1 || this.UnderRangeInt == -1)
                return;

            overGap = this.OverRangeInt - this.PassRangeInt;
            underGap = this.PassRangeInt - this.UnderRangeInt;

            if (overGap > underGap)
                gap = overGap;
            else
                gap = underGap;

            gap1 = gap / 5;

            if (gap1 == 0)
                gap1 = gap;

            this.CollectionNormalDistributionViewRange[0] = gap1 * 12;
            this.CollectionNormalDistributionViewRange[1] = gap1 * 9;
            this.CollectionNormalDistributionViewRange[2] = gap1 * 6;
            this.CollectionNormalDistributionViewRange[3] = gap1 * 3;
            this.CollectionNormalDistributionViewRange[4] = 0;
            this.CollectionNormalDistributionViewRange[5] = gap1 * 3;
            this.CollectionNormalDistributionViewRange[6] = gap1 * 6;
            this.CollectionNormalDistributionViewRange[7] = gap1 * 9;
            this.CollectionNormalDistributionViewRange[8] = gap1 * 12;

            this.CollectionNormalDistributionRange[0] = this.PassRangeInt + (gap1 * 9) + 1;
            this.CollectionNormalDistributionRange[1] = this.PassRangeInt + (gap1 * 6) + 1;
            this.CollectionNormalDistributionRange[2] = this.PassRangeInt + (gap1 * 3) + 1;
            this.CollectionNormalDistributionRange[3] = this.PassRangeInt + gap1 + 1;
            this.CollectionNormalDistributionRange[4] = this.PassRangeInt - gap1 + 1;
            this.CollectionNormalDistributionRange[5] = this.PassRangeInt - (gap1 * 3) + 1;
            this.CollectionNormalDistributionRange[6] = this.PassRangeInt - (gap1 * 6) + 1;
            this.CollectionNormalDistributionRange[7] = this.PassRangeInt - (gap1 * 9) + 1;
        }
        #endregion
    }
    #endregion
    #region StructProductItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructProductItem
    {
        public int Number;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string Name;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string LotNo;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string OverRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string UnderRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string PassRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string TareRange;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string DispenserDelayTime1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
        public string DispenserDelayTime2;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
        public string DummyString4;
    }
    #endregion
    
    #region WeightData
    public class WeightData
    {
        #region Field
        private bool m_IsLoadCellError;
        private bool m_IsEntrySensorError;
        private bool m_IsInverterError;
        private bool m_IsPressureSensingError;
        private bool m_IsMetalError;
        private bool m_IsEmergencyStop;
        private bool m_IsDoorInterlock;
        private bool m_IsSorterError;
        private bool m_IsStackUpSensorError;

        private DateTime m_StartTime;
        private DateTime m_StopTime;

        private int m_UnderCount;
        private double m_UnderSumWeight;
        
        private int m_PassCount;
        private double m_PassSumWeight;
        
        private int m_OverCount;
        private double m_OverSumWeight;

        private int m_ETCExNGCount;
        private int m_ExNGCount;
        private int m_DoubleEntryCount;
        private int m_MetalDetectionCount;

        private double m_Weight;
        private Define.E_JudgmentStatus m_JudgmentStatus;
        private Define.E_WeightStatus m_Status;

        private string m_ADCValue;
        private int m_ProductionSpeed;

        private int PreviousTimeTickCount;
        private bool m_IsStart;

        private string m_WeightString;

        private Collection<int> m_CollectionNormalDistributionCount;

        private string m_ReceiveDataID;
        private string m_ReceiveTransferCount;

        private int m_BoardProductNumber;
        private int m_BoardUnderCount;
        private int m_BoardPassCount;
        private int m_BoardOverCount;
        private int m_BoardExNGCount;
        private int m_BoardNGCount;
        private int m_BoardTotalCount;
        private int m_BoardDoubleEntryCount;
        private int m_BoardMetalDetectionCount;
        #endregion

        #region Constructor
        public WeightData()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsLoadCellError
        {
            get { return this.m_IsLoadCellError; }
            set { this.m_IsLoadCellError = value; }
        }
        public bool IsEntrySensorError
        {
            get { return this.m_IsEntrySensorError; }
            set { this.m_IsEntrySensorError = value; }
        }
        public bool IsInverterError
        {
            get { return this.m_IsInverterError; }
            set { this.m_IsInverterError = value; }
        }
        public bool IsPressureSensingError
        {
            get { return this.m_IsPressureSensingError; }
            set { this.m_IsPressureSensingError = value; }
        }
        public bool IsMetalError
        {
            get { return this.m_IsMetalError; }
            set { this.m_IsMetalError = value; }
        }
        public bool IsEmergencyStop
        {
            get { return this.m_IsEmergencyStop; }
            set { this.m_IsEmergencyStop = value; }
        }
        public bool IsDoorInterlock
        {
            get { return this.m_IsDoorInterlock; }
            set { this.m_IsDoorInterlock = value; }
        }
        public bool IsSorterError
        {
            get { return this.m_IsSorterError; }
            set { this.m_IsSorterError = value; }
        }
        public bool IsStackUpSensorError
        {
            get { return this.m_IsStackUpSensorError; }
            set { this.m_IsStackUpSensorError = value; }
        }

        public DateTime StartTime
        {
            get { return this.m_StartTime; }
            set { this.m_StartTime = value; }
        }
        public DateTime StopTime
        {
            get { return this.m_StopTime; }
            set { this.m_StopTime = value; }
        } 

        public int UnderCount
        {
            get { return this.m_UnderCount; }
            set { this.m_UnderCount = value; }
        }
        public double UnderSumWeight
        {
            get { return this.m_UnderSumWeight; }
            set { this.m_UnderSumWeight = value; }
        } 
        public string UnderRatio
        {
            get
            {
                string ret = "";

                if (this.UnderCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.UnderCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double UnderAverage
        {
            get
            {
                double ret = 0.0;

                if (this.UnderCount == 0 || this.UnderSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.UnderSumWeight / this.UnderCount;

                return ret;
            }
        }
        public string UnderSumWeightKG
        {
            get 
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.UnderSumWeight);
                ret = string.Format("{0}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        public int PassCount
        {
            get { return this.m_PassCount; }
            set { this.m_PassCount = value; }
        }
        public double PassSumWeight
        {
            get { return this.m_PassSumWeight; }
            set { this.m_PassSumWeight = value; }
        } 
        public string PassRatio
        {
            get
            {
                string ret = "";

                if (this.PassCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.PassCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double PassAverage
        {
            get 
            {
                double ret = 0.0;

                if (this.PassCount == 0 || this.PassSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.PassSumWeight / this.PassCount;

                return ret;
            }
        }
        public string PassSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.PassSumWeight);
                ret = string.Format("{0}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        public int OverCount
        {
            get { return this.m_OverCount; }
            set { this.m_OverCount = value; }
        }
        public double OverSumWeight
        {
            get { return this.m_OverSumWeight; }
            set { this.m_OverSumWeight = value; }
        } 
        public string OverRatio
        {
            get
            {
                string ret = "";

                if (this.OverCount == 0 || this.TotalCount == 0)
                    ret = "0.00";
                else
                    ret = string.Format("{0:##0.00}", (float.Parse(this.OverCount.ToString()) * 100.0F) / this.TotalCount);

                return ret;
            }
        }
        public double OverAverage
        {
            get 
            {
                double ret = 0.0;

                if (this.OverCount == 0 || this.OverSumWeight == 0.0)
                    ret = 0.0;
                else
                    ret = this.OverSumWeight / this.OverCount;

                return ret;
            }
        }
        public string OverSumWeightKG
        {
            get
            {
                string temp = "", ret = "";

                temp = string.Format("{0:f0}", this.OverSumWeight);
                ret = string.Format("{0}", int.Parse(temp) / 1000);

                return ret;
            }
        }

        public int ETCExNGCount
        {
            get { return this.m_ETCExNGCount; }
            set { this.m_ETCExNGCount = value; }
        }
        public int DoubleEntryCount
        {
            get { return this.m_DoubleEntryCount; }
            set { this.m_DoubleEntryCount = value; }
        }
        public int MetalDetectionCount
        {
            get { return this.m_MetalDetectionCount; }
            set { this.m_MetalDetectionCount = value; }
        }

        public int ExNGCount
        {
            get { return this.MetalDetectionCount + this.DoubleEntryCount + this.ETCExNGCount; }
        }

        public int TotalUnderOverCount
        {
            get { return this.UnderCount + this.OverCount; }
        }
        public int TotalNGCount
        {
            get { return this.UnderCount + this.OverCount + this.ExNGCount; }
        }

        public int TotalCount
        {
            get { return this.UnderCount + this.PassCount + this.OverCount + this.ExNGCount; }
        }

        public double Weight
        {
            get { return this.m_Weight; }
            set { this.m_Weight = value; }
        }

        public string ADCValue
        {
            get { return this.m_ADCValue; }
            set { this.m_ADCValue = value; }
        }

        public Define.E_JudgmentStatus JudgmentStatus
        {
            get { return this.m_JudgmentStatus; }
            set
            {
                this.m_JudgmentStatus = value;

                switch (value)
                {
                    case Define.E_JudgmentStatus.Under:
                        if (this.UnderCount < 10000000)
                            this.UnderCount++;
                        else
                            this.UnderCount = 0;
                        break;
                    case Define.E_JudgmentStatus.Pass:
                        if (this.PassCount < 10000000)
                            this.PassCount++;
                        else
                            this.PassCount = 0;
                        break;
                    case Define.E_JudgmentStatus.Over:
                        if (this.OverCount < 10000000)
                            this.OverCount++;
                        else
                            this.OverCount = 0;
                        break;
                    case Define.E_JudgmentStatus.Double:
                        if (this.DoubleEntryCount < 10000000)
                            this.DoubleEntryCount++;
                        else
                            this.DoubleEntryCount = 0;
                        break;
                    case Define.E_JudgmentStatus.Metal:
                        if (this.MetalDetectionCount < 10000000)
                            this.MetalDetectionCount++;
                        else
                            this.MetalDetectionCount = 0;
                        break;
                    case Define.E_JudgmentStatus.ExNg:
                    case Define.E_JudgmentStatus.ExNg1:
                    case Define.E_JudgmentStatus.ExNg2:
                    case Define.E_JudgmentStatus.LengthError:
                        if (this.ETCExNGCount < 10000000)
                            this.ETCExNGCount++;
                        else
                            this.ETCExNGCount = 0;
                        break;
                    default:
                        break;
                }
            }
        }

        public Define.E_WeightStatus Status
        {
            get { return this.m_Status; }
            set { this.m_Status = value; }
        }

        public int ProductionSpeed
        {
            get { return this.m_ProductionSpeed; }
            set { this.m_ProductionSpeed = value; }
        }
        // 미사용
        public bool IsStart
        {
            get { return this.m_IsStart; }
            set { this.m_IsStart = value; }
        }

        public string WeightString
        {
            get { return this.m_WeightString; }
            set { this.m_WeightString = value; }
        }

        public Collection<int> CollectionNormalDistributionCount
        {
            get { return this.m_CollectionNormalDistributionCount; }
            set { this.m_CollectionNormalDistributionCount = value; }
        }

        public string ReceiveDataID
        {
            get { return this.m_ReceiveDataID; }
            private set { this.m_ReceiveDataID = value; }
        }
        public string ReceiveTransferCount
        {
            get { return this.m_ReceiveTransferCount; }
            private set { this.m_ReceiveTransferCount = value; }
        }

        public int BoardProductNumber
        {
            get { return this.m_BoardProductNumber; }
            set { this.m_BoardProductNumber = value; }
        }
        public int BoardUnderCount
        {
            get { return this.m_BoardUnderCount; }
            set { this.m_BoardUnderCount = value; }
        }
        public int BoardPassCount
        {
            get { return this.m_BoardPassCount; }
            set { this.m_BoardPassCount = value; }
        }
        public int BoardOverCount
        {
            get { return this.m_BoardOverCount; }
            set { this.m_BoardOverCount = value; }
        }
        public int BoardExNGCount
        {
            get { return this.m_BoardExNGCount; }
            set { this.m_BoardExNGCount = value; }
        }
        public int BoardNGCount
        {
            get { return this.BoardUnderCount + this.BoardOverCount; }
        }
        public int BoardTotalCount
        {
            get { return this.BoardUnderCount + this.BoardPassCount + this.BoardOverCount + this.BoardExNGCount; }
        }
        public int BoardDoubleEntryCount
        {
            get { return this.m_BoardDoubleEntryCount; }
            set { this.m_BoardDoubleEntryCount = value; }
        }
        public int BoardMetalDetectionCount
        {
            get { return this.m_BoardMetalDetectionCount; }
            set { this.m_BoardMetalDetectionCount = value; }
        }
        #endregion

        #region Mehtod
        public void ClearCount()
        {
            this.UnderCount = 0;
            this.UnderSumWeight = 0.0;
            this.PassCount = 0;
            this.PassSumWeight = 0.0;
            this.OverCount = 0;
            this.OverSumWeight = 0.0;
            this.ETCExNGCount = 0;
            this.DoubleEntryCount = 0;
            this.MetalDetectionCount = 0;

            this.StartTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.StopTime = new DateTime(1111, 11, 11, 11, 11, 11);

            for (int i = 0; i < this.CollectionNormalDistributionCount.Count; i++)
                this.CollectionNormalDistributionCount[i] = 0;
        }

        private void Initialization()
        {
            this.IsLoadCellError = false;
            this.IsEntrySensorError = false;
            this.IsInverterError = false;
            this.IsPressureSensingError = false;
            this.IsMetalError = false;
            this.IsDoorInterlock = false;
            this.IsSorterError = false;
            this.IsStackUpSensorError = false;

            this.StartTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.StopTime = new DateTime(1111, 11, 11, 11, 11, 11);
            this.UnderCount = 0;
            this.UnderSumWeight = 0.0;
            this.PassCount = 0;
            this.PassSumWeight = 0.0;
            this.OverCount = 0;
            this.OverSumWeight = 0.0;
            this.DoubleEntryCount = 0;
            this.MetalDetectionCount = 0;
            this.ETCExNGCount = 0;
            this.Weight = 0.0;
            this.ADCValue = "12345";
            this.JudgmentStatus = Define.E_JudgmentStatus.Empty;
            this.Status = Define.E_WeightStatus.Empty;
            this.ProductionSpeed = 0;
            this.WeightString = "0";

            this.CollectionNormalDistributionCount = new Collection<int>();
            this.CollectionNormalDistributionCount.Clear();
            for (int i = 0; i < 10; i++)
                this.CollectionNormalDistributionCount.Add(0);

            this.ReceiveDataID = "0";
            this.ReceiveTransferCount = "0";

            this.BoardProductNumber = 1;
            this.BoardOverCount = 0;
            this.BoardPassCount = 0;
            this.BoardUnderCount = 0;
            this.BoardExNGCount = 0;
            this.BoardDoubleEntryCount = 0;
            this.BoardMetalDetectionCount = 0;
        }

        public void ProductionSpeedCalculation()
        {
            int currentTimeTickCount = 0, gap = 0;
            double millisecond = 0.0, speed = 0.0;

            if (this.IsStart == false)
            {
                this.PreviousTimeTickCount = Environment.TickCount & Int32.MaxValue;
                this.IsStart = true;
            }
            else
            {
                currentTimeTickCount = Environment.TickCount & Int32.MaxValue;
                gap = Math.Abs(currentTimeTickCount - this.PreviousTimeTickCount);
                millisecond = gap / 1000.0;
                speed = 60 / millisecond;
                this.ProductionSpeed = int.Parse(string.Format("{0:f0}", speed));

                this.PreviousTimeTickCount = Environment.TickCount;
            }
        }

        public void WeightSum(Define.E_JudgmentStatus status)
        {
            if (status == Define.E_JudgmentStatus.Over)
                this.OverSumWeight += this.Weight;
            else if (status == Define.E_JudgmentStatus.Pass)
                this.PassSumWeight += this.Weight;
            else if (status == Define.E_JudgmentStatus.Under)
            {
                if(this.Weight > 0.0)
                    this.UnderSumWeight += this.Weight;
            }
        }

        public void SetNormalDistribution(Collection<int> collectionRange, string weight)
        {
            int value = 0;

            value = int.Parse(weight);

            for (int i = 0; i < this.CollectionNormalDistributionCount.Count; i++)
            {
                if (i == collectionRange.Count)
                {
                    this.CollectionNormalDistributionCount[i]++;
                    break;
                }

                if (collectionRange[i] < value)
                {
                    this.CollectionNormalDistributionCount[i]++;
                    break;
                }
            }
        }

        public void SetDataIDTransferCount(string dataId, string transferCount)
        {
            this.ReceiveDataID = dataId;
            this.ReceiveTransferCount = transferCount;
        }
        #endregion
    }
    #endregion
    #region StructCounter
    [StructLayout(LayoutKind.Sequential)]
    public struct StructCounterItem
    {
        public int OverCount;
        public int PassCount;
        public int UnderCount;
        public int ExNGCount;

        public int NormalDistribution1;
        public int NormalDistribution2;
        public int NormalDistribution3;
        public int NormalDistribution4;
        public int NormalDistribution5;
        public int NormalDistribution6;
        public int NormalDistribution7;
        public int NormalDistribution8;
        public int NormalDistribution9;
        public int NormalDistribution10;

        public double OverSumWeight;
        public double PassSumWeight;
        public double UnderSumWeight;

        public DateTime StartTime;
        public DateTime StopTime;

        public int DoubleEntryCount;
        public int MetalDetectionCount;
        public int ETCExNGCount;
        public int DummyInt1;
        public int DummyInt2;
    }
    #endregion

    #region JudgmentSetItem
    public class JudgmentSetItem
    {
        #region Field
        private int m_Filter;
        private int m_JudgmentDelayTime;
        private int m_DoubleDelayTime;
        private int m_JudgmentCount;
        private int m_FeedSpeed1;
        private int m_FeedSpeed2;
        private int m_FeedSpeed3;
        private double m_DynamicCorrection;
        private int m_MovingAverage;

        private int m_Sorter1Mode;
        private int m_Sorter1DelayTime;
        private int m_Sorter1RunTime;
        private int m_Sorter2Mode;
        private int m_Sorter2DelayTime;
        private int m_Sorter2RunTime;

        private int m_ProductLength;
        private int m_AutoJudgmentTime;
        private int m_AutoJudgment2;
        private int m_AutoJudgment3;

        private int m_AscendDelayTime;
        private int m_DescendDelayTime;
        #endregion

        #region Constructor
        public JudgmentSetItem()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int Filter
        {
            get { return this.m_Filter; }
            set { this.m_Filter = value; }
        }
        public int JudgmentDelayTime
        {
            get { return this.m_JudgmentDelayTime; }
            set { this.m_JudgmentDelayTime = value; }
        }
        public int DoubleDelayTime
        {
            get { return this.m_DoubleDelayTime; }
            set { this.m_DoubleDelayTime = value; }
        }
        public int JudgmentCount
        {
            get { return this.m_JudgmentCount; }
            set { this.m_JudgmentCount = value; }
        }
        public int FeedSpeed1
        {
            get { return this.m_FeedSpeed1; }
            set { this.m_FeedSpeed1 = value; }
        }
        public int FeedSpeed2
        {
            get { return this.m_FeedSpeed2; }
            set { this.m_FeedSpeed2 = value; }
        }
        public int FeedSpeed3
        {
            get { return this.m_FeedSpeed3; }
            set { this.m_FeedSpeed3 = value; }
        } 
        public double DynamicCorrection
        {
            get { return this.m_DynamicCorrection; }
            set { this.m_DynamicCorrection = value; }
        }
        public int MovingAverage
        {
            get { return this.m_MovingAverage; }
            set { this.m_MovingAverage = value; }
        }

        public int DescendDelayTime
        {
            get { return this.m_DescendDelayTime; }
            set { this.m_DescendDelayTime = value; }
        }
        public int AscendDelayTime
        {
            get { return this.m_AscendDelayTime; }
            set { this.m_AscendDelayTime = value; }
        }

        public int Sorter1Mode
        {
            get { return this.m_Sorter1Mode; }
            set { this.m_Sorter1Mode = value; }
        }
        public int Sorter1DelayTime
        {
            get { return this.m_Sorter1DelayTime; }
            set { this.m_Sorter1DelayTime = value; }
        }
        public int Sorter1RunTime
        {
            get { return this.m_Sorter1RunTime; }
            set { this.m_Sorter1RunTime = value; }
        }
        public int Sorter2Mode
        {
            get { return this.m_Sorter2Mode; }
            set { this.m_Sorter2Mode = value; }
        }
        public int Sorter2DelayTime
        {
            get { return this.m_Sorter2DelayTime; }
            set { this.m_Sorter2DelayTime = value; }
        }
        public int Sorter2RunTime
        {
            get { return this.m_Sorter2RunTime; }
            set { this.m_Sorter2RunTime = value; }
        }

        public int ProductLength
        {
            get { return this.m_ProductLength; }
            set { this.m_ProductLength = value; }
        }
        public int AutoJudgment1
        {
            get { return this.m_AutoJudgmentTime; }
            set { this.m_AutoJudgmentTime = value; }
        }
        public int AutoJudgment2
        {
            get { return this.m_AutoJudgment2; }
            set { this.m_AutoJudgment2 = value; }
        }
        public int AutoJudgment3
        {
            get { return this.m_AutoJudgment3; }
            set { this.m_AutoJudgment3 = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.Filter = 8;
            this.JudgmentDelayTime = 1000;
            this.DoubleDelayTime = 900;
            this.JudgmentCount = 10;
            this.FeedSpeed1 = 60;
            this.FeedSpeed2 = 60;
            this.FeedSpeed3 = 60;
            this.DynamicCorrection = 1.000000;
            this.MovingAverage = 100;
            this.AscendDelayTime = 1000;
            this.DescendDelayTime = 1000;

            this.Sorter1Mode = 0;
            this.Sorter1DelayTime = 1;
            this.Sorter1RunTime = 1000;
            this.Sorter2Mode = 0;
            this.Sorter2DelayTime = 1;
            this.Sorter2RunTime = 1000;

            this.ProductLength = 100;
            this.AutoJudgment1 = 100;
            this.AutoJudgment2 = 100;
            this.AutoJudgment3 = 100;
        }
        #endregion
    }
    #endregion
    #region Struct JudgmentSetItem
    [StructLayout(LayoutKind.Sequential)]
    public struct StructJudgmentSetItem
    {
        public int Filter;
        public int JudgmentDelayTime;
        public int DoubleDelayTime;
        public int JudgmentCount;
        public int FeedSpeed1;
        public int FeedSpeed2;
        public int FeedSpeed3;
        public double DynamicCorrection;

        public int Sorter1Mode;
        public int Sorter1DelayTime;
        public int Sorter1RunTime;
        public int Sorter2Mode;
        public int Sorter2DelayTime;
        public int Sorter2RunTime;

        public int ProductLength;
        public int AutoJudgment1;
        public int AutoJudgment2;
        public int AutoJudgment3;

        public int DescendDelayTime;
        public int AscendDelayTime;
        public int MovingAverage;
        public int DummyInt1;
        public int DummyInt2;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
        public string DummyString5;
    }
    #endregion

    #region BLDCMotorParameter
    public class BLDCMotorParameter
    {
        #region Field
        private int m_MotorID;

        private int m_6700_CommBaudrate;
        private int m_6701_CommParityBit;
        private int m_6702_PWMDelay;
        private int m_6703_FeedbackDeviation;
        private int m_6704_MotorSpeed;
        private int m_6705_PoleNum;
        private int m_6706_AttenuatorRatio;

        private int m_6760_BootingStart;
        private int m_6761_PortUse;
        private int m_6762_Feedback;
        private int m_6763_InitDirection;
        private int m_6764_OperDirection;
        private int m_6765_SelectOperMode;

        private string m_6730_VersionMajor;
        private string m_6731_VersionMinor;
        private string m_6732_VersionBuild;
        private string m_6733_Frequency;
        private string m_6734_MotorRPM;
        private int m_6735_MotorDirection;
        private string m_6736_AttenuatorRPM;

        private bool m_6790_Alarm_FaultSignal;
        private bool m_6791_Alarm_HallSensorError;
        private bool m_6792_Alarm_MotorStop;
        #endregion

        #region Constructor
        public BLDCMotorParameter()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public int MotorID
        {
            get { return this.m_MotorID; }
            set { this.m_MotorID = value; }
        }

        public int _6700_CommBaudrate
        {
            get { return this.m_6700_CommBaudrate; }
            set { this.m_6700_CommBaudrate = value; }
        }
        public int _6701_CommParityBit
        {
            get { return this.m_6701_CommParityBit; }
            set { this.m_6701_CommParityBit = value; }
        }
        public int _6702_PWMDelay
        {
            get { return this.m_6702_PWMDelay; }
            set { this.m_6702_PWMDelay = value; }
        }
        public int _6703_FeedbackDeviation
        {
            get { return this.m_6703_FeedbackDeviation; }
            set { this.m_6703_FeedbackDeviation = value; }
        }
        public int _6704_MotorSpeed
        {
            get { return this.m_6704_MotorSpeed; }
            set { this.m_6704_MotorSpeed = value; }
        }
        public int _6705_PoleNum
        {
            get { return this.m_6705_PoleNum; }
            set { this.m_6705_PoleNum = value; }
        }
        public int _6706_AttenuatorRatio
        {
            get { return this.m_6706_AttenuatorRatio; }
            set { this.m_6706_AttenuatorRatio = value; }
        }

        public int _6760_BootingStart
        {
            get { return this.m_6760_BootingStart; }
            set { this.m_6760_BootingStart = value; }
        }
        public int _6761_PortUse
        {
            get { return this.m_6761_PortUse; }
            set { this.m_6761_PortUse = value; }
        }
        public int _6762_Feedback
        {
            get { return this.m_6762_Feedback; }
            set { this.m_6762_Feedback = value; }
        }
        public int _6763_InitDirection
        {
            get { return this.m_6763_InitDirection; }
            set { this.m_6763_InitDirection = value; }
        }
        public int _6764_OperDirection
        {
            get { return this.m_6764_OperDirection; }
            set { this.m_6764_OperDirection = value; }
        }
        public int _6765_SelectOperMode
        {
            get { return this.m_6765_SelectOperMode; }
            set { this.m_6765_SelectOperMode = value; }
        }

        public string _6730_VersionMajor
        {
            get { return this.m_6730_VersionMajor; }
            set { this.m_6730_VersionMajor = value; }
        }
        public string _6731_VersionMinor
        {
            get { return this.m_6731_VersionMinor; }
            set { this.m_6731_VersionMinor = value; }
        }
        public string _6732_VersionBuild
        {
            get { return this.m_6732_VersionBuild; }
            set { this.m_6732_VersionBuild = value; }
        }
        public string _6733_Frequency
        {
            get { return this.m_6733_Frequency; }
            set { this.m_6733_Frequency = value; }
        }
        public string _6734_MotorRPM
        {
            get { return this.m_6734_MotorRPM; }
            set { this.m_6734_MotorRPM = value; }
        }
        public int _6735_MotorDirection
        {
            get { return this.m_6735_MotorDirection; }
            set { this.m_6735_MotorDirection = value; }
        }
        public string _6736_AttenuatorRPM
        {
            get { return this.m_6736_AttenuatorRPM; }
            set { this.m_6736_AttenuatorRPM = value; }
        }

        public bool _6790_Alarm_FaultSignal
        {
            get { return this.m_6790_Alarm_FaultSignal; }
            set { this.m_6790_Alarm_FaultSignal = value; }
        }
        public bool _6791_Alarm_HallSensorError
        {
            get { return this.m_6791_Alarm_HallSensorError; }
            set { this.m_6791_Alarm_HallSensorError = value; }
        }
        public bool _6792_Alarm_MotorStop
        {
            get { return this.m_6792_Alarm_MotorStop; }
            set { this.m_6792_Alarm_MotorStop = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.MotorID = 0;

            this._6700_CommBaudrate = 0;
            this._6701_CommParityBit = 0;
            this._6702_PWMDelay = 5;
            this._6703_FeedbackDeviation = 60;
            this._6704_MotorSpeed = 80;
            this._6705_PoleNum = 1;
            this._6706_AttenuatorRatio = 5;

            this._6760_BootingStart = 0;
            this._6761_PortUse = 1;
            this._6762_Feedback = 0;
            this._6763_InitDirection = 0;
            this._6764_OperDirection = 1;
            this._6765_SelectOperMode = 0;

            this._6730_VersionMajor = "01";
            this._6731_VersionMinor = "00";
            this._6732_VersionBuild = "00";
            this._6733_Frequency = "0";
            this._6734_MotorRPM = "0";
            this._6735_MotorDirection = 0;
            this._6736_AttenuatorRPM = "0";

            this._6790_Alarm_FaultSignal = false;
            this._6791_Alarm_HallSensorError = false;
            this._6792_Alarm_MotorStop = false;
        }
        #endregion
    }
    #endregion
    #region StructBLDCMotorParameter
    [StructLayout(LayoutKind.Sequential)]
    public struct StructBLDCMotorParameter
    {
        public int MotorID;

        public int CommBaudrate;
        public int CommParityBit;
        public int PWMDelay;
        public int FeedbackDeviation;
        public int MotorSpeed;
        public int PoleNum;
        public int AttenuatorRatio;

        public int DummyInt1;
        public int DummyInt2;
        public int DummyInt3;
        public int DummyInt4;
        public int DummyInt5;
        public int DummyInt6;
        public int DummyInt7;
        public int DummyInt8;
        public int DummyInt9;
        public int DummyInt10;
        public int DummyInt11;
        public int DummyInt12;
        public int DummyInt13;
        public int DummyInt14;
        public int DummyInt15;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString6;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString7;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString8;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString9;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString10;

        public int BootingStart;
        public int PortUse;
        public int Feedback;
        public int InitDirection;
        public int OperDirection;

        public int DummyInt16;
        public int DummyInt17;
        public int DummyInt18;
        public int DummyInt19;
        public int DummyInt20;
        public int DummyInt21;
        public int DummyInt22;
        public int DummyInt23;
        public int DummyInt24;
        public int DummyInt25;
        public int DummyInt26;
        public int DummyInt27;
        public int DummyInt28;
        public int DummyInt29;
        public int DummyInt30;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString11;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString12;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString13;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString14;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString15;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString16;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString17;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString18;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString19;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string DummyString20;
    }
    #endregion

    #region CalibrationItem
    public class CalibrationItem
    {
        #region Field
        private string m_BalanceWeight;
        private string m_MaxWeight;
        private string m_Digit;
        private string m_Constant;
        #endregion

        #region Constructor
        public CalibrationItem()
        {
            this.BalanceWeight = "5000";
            this.MaxWeight = "9999";
            this.Digit = "1";
            this.Constant = "1000000";
        }
        #endregion

        #region Property
        public string BalanceWeight
        {
            get { return this.m_BalanceWeight; }
            set { this.m_BalanceWeight = value; }
        }

        public string MaxWeight
        {
            get { return this.m_MaxWeight; }
            set { this.m_MaxWeight = value; }
        }
        public string OverloadWeightString
        {
            get { return string.Format("{0, 5}", Math.Floor(double.Parse(this.MaxWeight) * 1.1)); }
        }

        public string Digit
        {
            get { return this.m_Digit; }
            set { this.m_Digit = value; }
        }

        public string Constant
        {
            get { return this.m_Constant; }
            set { this.m_Constant = value; }
        }
        #endregion
    }
    #endregion

    #region FeedbackItem
    public class FeedbackItem
    {
        #region Field
        private bool m_IsUsingFeedback;

        private string m_SampleCount;
        private string m_DelayCount;
        private string m_Sign;
        private string m_FeedbackWeight;

        private string m_UnderRangeDeviation;
        private string m_OverRangeDeviation;
        #endregion

        #region Constructor
        public FeedbackItem()
        {
            this.IsUsingFeedback = false;

            this.SampleCount = "0";
            this.DelayCount = "0";
            this.Sign = "+";
            this.FeedbackWeight = "0";

            this.UnderRangeDeviation = "0";
            this.OverRangeDeviation = "0";
        }
        #endregion

        #region Property
        public bool IsUsingFeedback
        {
            get { return this.m_IsUsingFeedback; }
            set { this.m_IsUsingFeedback = value; }
        }

        public string SampleCount
        {
            get { return this.m_SampleCount; }
            set { this.m_SampleCount = value; }
        }
        public string DelayCount
        {
            get { return this.m_DelayCount; }
            set { this.m_DelayCount = value; }
        }
        public string Sign
        {
            get { return this.m_Sign; }
            set { this.m_Sign = value; }
        }
        public string FeedbackWeight
        {
            get { return this.m_FeedbackWeight; }
            set { this.m_FeedbackWeight = value; }
        }


        public string UnderRangeDeviation
        {
            get { return this.m_UnderRangeDeviation; }
            set { this.m_UnderRangeDeviation = value; }
        }
        public string OverRangeDeviation
        {
            get { return this.m_OverRangeDeviation; }
            set { this.m_OverRangeDeviation = value; }
        }
        public int OverRangeDeviationInt
        {
            get
            {
                if (this.OverRangeDeviation == null)
                    return -1;
                else
                    return int.Parse(this.OverRangeDeviation);
            }
        }
        public int UnderRangeDeviationInt
        {
            get
            {
                if (this.UnderRangeDeviation == null)
                    return -1;
                else
                    return int.Parse(this.UnderRangeDeviation);
            }
        }
        
        #endregion

        #region Method
        #endregion
    }
    #endregion

    #region SystemParameter1
    public class SystemParameter1
    {
        #region Field

        private string m_BuzzerOnTime;
        private string m_RelayOnTime;
        private string m_SorterDoubleEntry;
        private string m_Chattering;
        private string m_SorterExternalNgInput;
        private string m_SorterEtcNg;
        private string m_StopWeighing;
        private string m_OptionBoard;
        private string m_InitialDrive;

        private int m_PI2;
        private int m_PI3;
        private int m_PI4;
        private int m_PI5;
        private int m_PI6;
        private int m_PI7;
        private int m_PI8;

        private string m_SwitchChattering;
        private string m_Dummy1;
        private string m_Dummy2;
        private string m_EquipmentType;
        #endregion

        #region Constructor
        public SystemParameter1()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string BuzzerOnTime
        {
            get { return this.m_BuzzerOnTime; }
            set { this.m_BuzzerOnTime = value; }
        }
        public string RelayOnTime
        {
            get { return this.m_RelayOnTime; }
            set { this.m_RelayOnTime = value; }
        }
        public string SorterDoubleEntry
        {
            get { return this.m_SorterDoubleEntry; }
            set { this.m_SorterDoubleEntry = value; }
        }
        public string Chattering
        {
            get { return this.m_Chattering; }
            set { this.m_Chattering = value; }
        }
        public string SorterExternalNgInput
        {
            get { return this.m_SorterExternalNgInput; }
            set { this.m_SorterExternalNgInput = value; }
        }
        public string SorterEtcNg
        {
            get { return this.m_SorterEtcNg; }
            set { this.m_SorterEtcNg = value; }
        }
        public string StopWeighing
        {
            get { return this.m_StopWeighing; }
            set { this.m_StopWeighing = value; }
        }
        public string OptionBoard
        {
            get { return this.m_OptionBoard; }
            set { this.m_OptionBoard = value; }
        }
        public string InitialDrive
        {
            get { return this.m_InitialDrive; }
            set { this.m_InitialDrive = value; }
        }

        public int PI2
        {
            get { return this.m_PI2; }
            set { this.m_PI2 = value; }
        }
        public int PI3
        {
            get { return this.m_PI3; }
            set { this.m_PI3 = value; }
        }
        public int PI4
        {
            get { return this.m_PI4; }
            set { this.m_PI4 = value; }
        }
        public int PI5
        {
            get { return this.m_PI5; }
            set { this.m_PI5 = value; }
        }
        public int PI6
        {
            get { return this.m_PI6; }
            set { this.m_PI6 = value; }
        }
        public int PI7
        {
            get { return this.m_PI7; }
            set { this.m_PI7 = value; }
        }
        public int PI8
        {
            get { return this.m_PI8; }
            set { this.m_PI8 = value; }
        }

        public string SwitchChattering
        {
            get { return this.m_SwitchChattering; }
            set { this.m_SwitchChattering = value; }
        }
        public string EquipmentType
        {
            get { return this.m_EquipmentType; }
            set { this.m_EquipmentType = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.BuzzerOnTime = "500";
            this.RelayOnTime = "1000";
            this.Chattering = "150";
            this.SorterDoubleEntry = "0";
            this.SorterExternalNgInput = "0";
            this.SorterEtcNg = "0";
            this.StopWeighing = "0";
            this.OptionBoard = "0";
            this.InitialDrive = "0";

            this.PI2 = 1;
            this.PI3 = 3;
            this.PI4 = 2;
            this.PI5 = 0;
            this.PI6 = 0;
            this.PI7 = 0;
            this.PI8 = 0;

            this.EquipmentType = "0";
            this.SwitchChattering = "150";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter1
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter1
    {
        public int PI2;
        public int PI3;
        public int PI4;
        public int PI5;
        public int PI6;
        public int PI7;
        public int PI8;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string BuzzerOnTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string RelayOnTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterDoubleEntry;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Chattering;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterExternalNgInput;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SorterEtcNgInput;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string StopWeighing;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OptionBoard;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string InitialDrive;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string EquipmentType;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string SwitchChattering;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
    }
    #endregion
    #region SystemParameter2
    public class SystemParameter2
    {
        #region Field
        private string m_OPT1SamplingCount;
        private string m_OPT1DelayCount;
        private string m_OPT1PulseWidth;
        private string m_OPT1IsWeightSetting;
        private string m_OPT1OverRange;
        private string m_OPT1UnderRange;
        private string m_OPT1Port;

        private string m_OPT2Port;
        private string m_OPT2DelayTime1;
        private string m_OPT2DelayTime2;

        private string m_OPT2ZeroZoneCycle;
        private string m_OPT2ZeroZoneCount;

        private string m_Dummy1;
        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4; 
        private string m_Dummy5;
        #endregion

        #region Constructor
        public SystemParameter2()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string OPT1SamplingCount
        {
            get { return this.m_OPT1SamplingCount; }
            set { this.m_OPT1SamplingCount = value; }
        }
        public string OPT1DelayCount
        {
            get { return this.m_OPT1DelayCount; }
            set { this.m_OPT1DelayCount = value; }
        }
        public string OPT1PulseWidth
        {
            get { return this.m_OPT1PulseWidth; }
            set { this.m_OPT1PulseWidth = value; }
        }
        public string OPT1IsWeightSetting
        {
            get { return this.m_OPT1IsWeightSetting; }
            set { this.m_OPT1IsWeightSetting = value; }
        }
        public string OPT1OverRange
        {
            get { return this.m_OPT1OverRange; }
            set { this.m_OPT1OverRange = value; }
        }
        public string OPT1UnderRange
        {
            get { return this.m_OPT1UnderRange; }
            set { this.m_OPT1UnderRange = value; }
        } 
        public string OPT1Port
        {
            get { return this.m_OPT1Port; }
            set { this.m_OPT1Port = value; }
        }

        public int OPT1OverRangeInt
        {
            get
            {
                if (this.OPT1OverRange == null)
                    return -1;
                else
                    return int.Parse(this.OPT1OverRange);
            }
        }
        public int OPT1UnderRangeInt
        {
            get
            {
                if (this.OPT1UnderRange == null)
                    return -1;
                else
                    return int.Parse(this.OPT1UnderRange);
            }
        }

        public string OPT2Port
        {
            get { return this.m_OPT2Port; }
            set { this.m_OPT2Port = value; }
        }
        public string OPT2DelayTime1
        {
            get { return this.m_OPT2DelayTime1; }
            set { this.m_OPT2DelayTime1 = value; }
        }
        public string OPT2DelayTime2
        {
            get { return this.m_OPT2DelayTime2; }
            set { this.m_OPT2DelayTime2 = value; }
        }

        public string OPT2ZeroZoneCycle
        {
            get { return this.m_OPT2ZeroZoneCycle; }
            set { this.m_OPT2ZeroZoneCycle = value; }
        }
        public string OPT2ZeroZoneCount
        {
            get { return this.m_OPT2ZeroZoneCount; }
            set { this.m_OPT2ZeroZoneCount = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.OPT1SamplingCount = "0";
            this.OPT1DelayCount = "0";
            this.OPT1PulseWidth = "0";
            this.OPT1IsWeightSetting = "0";
            this.OPT1OverRange = "0";
            this.OPT1UnderRange = "0";
            this.OPT1Port = "0";

            this.OPT2Port = "0";
            this.OPT2DelayTime1 = "0";
            this.OPT2DelayTime2 = "0";

            this.OPT2ZeroZoneCycle = "0";
            this.OPT2ZeroZoneCount = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter2
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter2
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1SamplingCount;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1DelayCount;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1PulseWidth;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1IsWeightSetting;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1OverRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1UnderRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT1Port;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2Port;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2DelayTime1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2DelayTime2;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2ZeroZoneCycle;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string OPT2ZeroZoneCount;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
    }
    #endregion
    #region SystemParameter3
    public class SystemParameter3
    {
        #region Field
        private string m_ExternalOut1Mode;
        private string m_ExternalOut1DelayTime;
        private string m_ExternalOut1RunTime;

        private string m_ExternalOut2Mode;
        private string m_ExternalOut2DelayTime;
        private string m_ExternalOut2RunTime;

        private string m_ExternalOut3Mode;
        private string m_ExternalOut3DelayTime;
        private string m_ExternalOut3RunTime;

        private string m_ExternalOut4Mode;
        private string m_ExternalOut4DelayTime;
        private string m_ExternalOut4RunTime;

        private string m_ExternalOut5Mode;
        private string m_ExternalOut5DelayTime;
        private string m_ExternalOut5RunTime;

        private string m_ExternalOut6Mode;
        private string m_ExternalOut6DelayTime;
        private string m_ExternalOut6RunTime;

        private string m_Dummy1;
        private string m_Dummy2;
        #endregion

        #region Constructor
        public SystemParameter3()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string ExternalOut1Mode
        {
            get { return this.m_ExternalOut1Mode; }
            set { this.m_ExternalOut1Mode = value; }
        }
        public string ExternalOut1DelayTime
        {
            get { return this.m_ExternalOut1DelayTime; }
            set { this.m_ExternalOut1DelayTime = value; }
        }
        public string ExternalOut1RunTime
        {
            get { return this.m_ExternalOut1RunTime; }
            set { this.m_ExternalOut1RunTime = value; }
        }

        public string ExternalOut2Mode
        {
            get { return this.m_ExternalOut2Mode; }
            set { this.m_ExternalOut2Mode = value; }
        }
        public string ExternalOut2DelayTime
        {
            get { return this.m_ExternalOut2DelayTime; }
            set { this.m_ExternalOut2DelayTime = value; }
        }
        public string ExternalOut2RunTime
        {
            get { return this.m_ExternalOut2RunTime; }
            set { this.m_ExternalOut2RunTime = value; }
        }

        public string ExternalOut3Mode
        {
            get { return this.m_ExternalOut3Mode; }
            set { this.m_ExternalOut3Mode = value; }
        }
        public string ExternalOut3DelayTime
        {
            get { return this.m_ExternalOut3DelayTime; }
            set { this.m_ExternalOut3DelayTime = value; }
        }
        public string ExternalOut3RunTime
        {
            get { return this.m_ExternalOut3RunTime; }
            set { this.m_ExternalOut3RunTime = value; }
        }

        public string ExternalOut4Mode
        {
            get { return this.m_ExternalOut4Mode; }
            set { this.m_ExternalOut4Mode = value; }
        }
        public string ExternalOut4DelayTime
        {
            get { return this.m_ExternalOut4DelayTime; }
            set { this.m_ExternalOut4DelayTime = value; }
        }
        public string ExternalOut4RunTime
        {
            get { return this.m_ExternalOut4RunTime; }
            set { this.m_ExternalOut4RunTime = value; }
        }

        public string ExternalOut5Mode
        {
            get { return this.m_ExternalOut5Mode; }
            set { this.m_ExternalOut5Mode = value; }
        }
        public string ExternalOut5DelayTime
        {
            get { return this.m_ExternalOut5DelayTime; }
            set { this.m_ExternalOut5DelayTime = value; }
        }
        public string ExternalOut5RunTime
        {
            get { return this.m_ExternalOut5RunTime; }
            set { this.m_ExternalOut5RunTime = value; }
        }

        public string ExternalOut6Mode
        {
            get { return this.m_ExternalOut6Mode; }
            set { this.m_ExternalOut6Mode = value; }
        }
        public string ExternalOut6DelayTime
        {
            get { return this.m_ExternalOut6DelayTime; }
            set { this.m_ExternalOut6DelayTime = value; }
        }
        public string ExternalOut6RunTime
        {
            get { return this.m_ExternalOut6RunTime; }
            set { this.m_ExternalOut6RunTime = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.ExternalOut1Mode = "5";
            this.ExternalOut1DelayTime = "500";
            this.ExternalOut1RunTime = "1000";

            this.ExternalOut2Mode = "4";
            this.ExternalOut2DelayTime = "500";
            this.ExternalOut2RunTime = "1000";

            this.ExternalOut3Mode = "3";
            this.ExternalOut3DelayTime = "500";
            this.ExternalOut3RunTime = "1000";

            this.ExternalOut4Mode = "6";
            this.ExternalOut4DelayTime = "500";
            this.ExternalOut4RunTime = "1000";

            this.ExternalOut5Mode = "0";
            this.ExternalOut5DelayTime = "500";
            this.ExternalOut5RunTime = "1000";

            this.ExternalOut6Mode = "0";
            this.ExternalOut6DelayTime = "500";
            this.ExternalOut6RunTime = "1000";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter3
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter3
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut1RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut2RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut3RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut4RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut5Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut5DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut5RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut6Mode;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut6DelayTime;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string ExternalOut6RunTime;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
    }
    #endregion
    #region SystemParameter4
    public class SystemParameter4
    {
        #region Field
        // 메인보드 저장값
        private bool m_MainAutoZeroIsAutoZeroUsing;
        private string m_MainAutoZeroPlusRange;
        private string m_MainAutoZeroMinusRange;
        private string m_MainAutoZeroVariate;

        // LCD 저장값
        private bool m_LCDAutoZeroIsAutoZeroUsing;
        private string m_LCDAutoZeroPlusRange;
        private string m_LCDAutoZeroMinusRange;
        private string m_LCDAutoZeroVariate;

        private string m_Dummy1;
        private string m_Dummy2;
        private string m_Dummy3;
        private string m_Dummy4;
        private string m_Dummy5;
        private string m_Dummy6;
        private string m_Dummy7;
        private string m_Dummy8;
        private string m_Dummy9;
        private string m_Dummy10;
        #endregion

        #region Constructor
        public SystemParameter4()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool MainAutoZeroIsAutoZeroUsing
        {
            get { return this.m_MainAutoZeroIsAutoZeroUsing; }
            set { this.m_MainAutoZeroIsAutoZeroUsing = value; }
        }
        public string MainAutoZeroPlusRange
        {
            get { return this.m_MainAutoZeroPlusRange; }
            set { this.m_MainAutoZeroPlusRange = value; }
        }
        public string MainAutoZeroMinusRange
        {
            get { return this.m_MainAutoZeroMinusRange; }
            set { this.m_MainAutoZeroMinusRange = value; }
        }
        public string MainAutoZeroVariate
        {
            get { return this.m_MainAutoZeroVariate; }
            set { this.m_MainAutoZeroVariate = value; }
        }

        public bool LCDAutoZeroIsAutoZeroUsing
        {
            get { return this.m_LCDAutoZeroIsAutoZeroUsing; }
            set { this.m_LCDAutoZeroIsAutoZeroUsing = value; }
        }
        public string LCDAutoZeroPlusRange
        {
            get { return this.m_LCDAutoZeroPlusRange; }
            set { this.m_LCDAutoZeroPlusRange = value; }
        }
        public string LCDAutoZeroMinusRange
        {
            get { return this.m_LCDAutoZeroMinusRange; }
            set { this.m_LCDAutoZeroMinusRange = value; }
        }
        public string LCDAutoZeroVariate
        {
            get { return this.m_LCDAutoZeroVariate; }
            set { this.m_LCDAutoZeroVariate = value; }
        }

        public string Dummy1
        {
            get { return this.m_Dummy1; }
            set { this.m_Dummy1 = value; }
        }
        public string Dummy2
        {
            get { return this.m_Dummy2; }
            set { this.m_Dummy2 = value; }
        }
        public string Dummy3
        {
            get { return this.m_Dummy3; }
            set { this.m_Dummy3 = value; }
        }
        public string Dummy4
        {
            get { return this.m_Dummy4; }
            set { this.m_Dummy4 = value; }
        }
        public string Dummy5
        {
            get { return this.m_Dummy5; }
            set { this.m_Dummy5 = value; }
        }
        public string Dummy6
        {
            get { return this.m_Dummy6; }
            set { this.m_Dummy6 = value; }
        }
        public string Dummy7
        {
            get { return this.m_Dummy7; }
            set { this.m_Dummy7 = value; }
        }
        public string Dummy8
        {
            get { return this.m_Dummy8; }
            set { this.m_Dummy8 = value; }
        }
        public string Dummy9
        {
            get { return this.m_Dummy9; }
            set { this.m_Dummy9 = value; }
        }
        public string Dummy10
        {
            get { return this.m_Dummy10; }
            set { this.m_Dummy10 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.MainAutoZeroIsAutoZeroUsing = false;
            this.MainAutoZeroPlusRange = "100";
            this.MainAutoZeroMinusRange = "100";
            this.MainAutoZeroVariate = "0";

            this.LCDAutoZeroIsAutoZeroUsing = false;
            this.LCDAutoZeroPlusRange = "100";
            this.LCDAutoZeroMinusRange = "100";
            this.LCDAutoZeroVariate = "0";

            this.Dummy1 = "0";
            this.Dummy2 = "0";
            this.Dummy3 = "0";
            this.Dummy4 = "0";
            this.Dummy5 = "0";
            this.Dummy6 = "0";
            this.Dummy7 = "0";
            this.Dummy8 = "0";
            this.Dummy9 = "0";
            this.Dummy10 = "0";
        }
        #endregion
    } 
    #endregion
    #region StructSystemParameter4
    [StructLayout(LayoutKind.Sequential)]
    public struct StructSystemParameter4
    {
        // 각 모드별 시간/범위/변량 저장값은 UserSetting 값만
        public bool AutoZeroIsAutoZeroUsing;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZeroPlusRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZeroMinusRange;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string AutoZeroVariate;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy1;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy2;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy3;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy4;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy5;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy6;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy7;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy8;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy9;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Dummy10;
    }
    #endregion

    #region SystemStatus
    public class SystemStatus
    {
        #region Field
        private Define.E_EquipmentStatus m_Equipment;
        private Define.E_DisplayStore m_CurrentDisplay;
        private Define.E_DisplayMode m_CurrentMode;
        private Define.E_WeightInputMode m_CurrentWeightInputMode;

        private UserPasswordType m_CurrentUserPasswordType;
        private UserItem m_CurrentUser;
        #endregion

        #region Constructor
        public SystemStatus()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public Define.E_EquipmentStatus Equipment
        {
            get { return this.m_Equipment; }
            set { this.m_Equipment = value; }
        }
        public Define.E_DisplayStore CurrentDisplay
        {
            get { return this.m_CurrentDisplay; }
            set { this.m_CurrentDisplay = value; }
        }
        public Define.E_DisplayMode CurrentMode
        {
            get { return this.m_CurrentMode; }
            set { this.m_CurrentMode = value; }
        }
        public Define.E_WeightInputMode CurrentWeightInputMode
        {
            get { return this.m_CurrentWeightInputMode; }
            set { this.m_CurrentWeightInputMode = value; }
        }
       
        public UserPasswordType CurrentUserPasswordType
        {
            get { return this.m_CurrentUserPasswordType; }
            set { this.m_CurrentUserPasswordType = value; }
        }
        public UserItem CurrentUser
        {
            get { return this.m_CurrentUser; }
            set { this.m_CurrentUser = value; }
        } 
        #endregion

        #region Method
        public void Initialization()
        {
            this.Equipment = Define.E_EquipmentStatus.Stop;
            this.CurrentDisplay = Define.E_DisplayStore.MainDisplay;
            this.CurrentMode = Define.E_DisplayMode.Normal;
            this.CurrentWeightInputMode = Define.E_WeightInputMode.Weight;
            this.CurrentUserPasswordType = new UserPasswordType();
            
            this.CurrentUser = new UserItem();
            this.CurrentUser.ID = "";
            this.CurrentUser.Password = "";
            this.CurrentUser.Group = Define.E_UserGroup.LogOut;
        }
        #endregion
    }
    #endregion

    #region SystemInformation2
    public class SystemInformation2
    {
        #region Field
        private string m_BalanceWeight;

        private string m_Filter;
        private string m_JudgmentDelay;
        private string m_DoubleDelay;
        private string m_JudgmentNumber;
        private string m_Speed;
        private string m_Dynamic;

        private string m_UnderRange;
        private string m_PassRange;
        private string m_OverRange;
        private string m_TareRange;

        private string m_SorterAMode;
        private string m_SorterADelay;
        private string m_SorterAOperation;
        private string m_SorterBMode;
        private string m_SorterBDelay;
        private string m_SorterBOperation;
        private string m_DoubleEntry;
        private string m_ExternalInput;
        private string m_ETCNG;

        private string m_ExternalOutput1Mode;
        private string m_ExternalOutput1Delay;
        private string m_ExternalOutput1Operation;
        private string m_ExternalOutput2Mode;
        private string m_ExternalOutput2Delay;
        private string m_ExternalOutput2Operation;
        private string m_ExternalOutput3Mode;
        private string m_ExternalOutput3Delay;
        private string m_ExternalOutput3Operation;
        private string m_ExternalOutput4Mode;
        private string m_ExternalOutput4Delay;
        private string m_ExternalOutput4Operation;
        private string m_ExternalOutput5Mode;
        private string m_ExternalOutput5Delay;
        private string m_ExternalOutput5Operation;
        private string m_ExternalOutput6Mode;
        private string m_ExternalOutput6Delay;
        private string m_ExternalOutput6Operation;

        private string m_PI6;
        private string m_PI5;
        private string m_PI4;
        private string m_PI3;
        private string m_PhotoB;

        private string m_IsAutoZeroUsing;
        private string m_AutoZeroPlusRange;
        private string m_AutoZeroMinusRange;
        private string m_AutoZeroVariate;

        private string m_dummy1;
        private string m_dummy2;
        private string m_dummy3;
        private string m_dummy4;
        private string m_dummy5;
        private string m_dummy6;
        private string m_dummy7;
        private string m_dummy8;
        private string m_dummy9;
        private string m_dummy10;
        #endregion

        #region Constructor
        public SystemInformation2()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string BalanceWeight
        {
            get { return this.m_BalanceWeight; }
            set { this.m_BalanceWeight = value; }
        }

        public string Filter
        {
            get { return this.m_Filter; }
            set { this.m_Filter = value; }
        }
        public string JudgmentDelay
        {
            get { return this.m_JudgmentDelay; }
            set { this.m_JudgmentDelay = value; }
        }
        public string DoubleDelay
        {
            get { return this.m_DoubleDelay; }
            set { this.m_DoubleDelay = value; }
        }
        public string JudgmentNumber
        {
            get { return this.m_JudgmentNumber; }
            set { this.m_JudgmentNumber = value; }
        }
        public string Speed
        {
            get { return this.m_Speed; }
            set { this.m_Speed = value; }
        }
        public string Dynamic
        {
            get { return this.m_Dynamic; }
            set { this.m_Dynamic = value; }
        }

        public string UnderRange
        {
            get { return this.m_UnderRange; }
            set { this.m_UnderRange = value; }
        }
        public string PassRange
        {
            get { return this.m_PassRange; }
            set { this.m_PassRange = value; }
        }
        public string OverRange
        {
            get { return this.m_OverRange; }
            set { this.m_OverRange = value; }
        }
        public string TareRange
        {
            get { return this.m_TareRange; }
            set { this.m_TareRange = value; }
        }

        public string SorterAMode
        {
            get { return this.m_SorterAMode; }
            set { this.m_SorterAMode = value; }
        }
        public string SorterADelay
        {
            get { return this.m_SorterADelay; }
            set { this.m_SorterADelay = value; }
        }
        public string SorterAOperation
        {
            get { return this.m_SorterAOperation; }
            set { this.m_SorterAOperation = value; }
        }
        public string SorterBMode
        {
            get { return this.m_SorterBMode; }
            set { this.m_SorterBMode = value; }
        }
        public string SorterBDelay
        {
            get { return this.m_SorterBDelay; }
            set { this.m_SorterBDelay = value; }
        }
        public string SorterBOperation
        {
            get { return this.m_SorterBOperation; }
            set { this.m_SorterBOperation = value; }
        }
        public string DoubleEntry
        {
            get { return this.m_DoubleEntry; }
            set { this.m_DoubleEntry = value; }
        }
        public string ExternalInput
        {
            get { return this.m_ExternalInput; }
            set { this.m_ExternalInput = value; }
        }
        public string ETCNG
        {
            get { return this.m_ETCNG; }
            set { this.m_ETCNG = value; }
        }

        public string ExternalOutput1Mode
        {
            get { return this.m_ExternalOutput1Mode; }
            set { this.m_ExternalOutput1Mode = value; }
        }
        public string ExternalOutput1Delay
        {
            get { return this.m_ExternalOutput1Delay; }
            set { this.m_ExternalOutput1Delay = value; }
        }
        public string ExternalOutput1Operation
        {
            get { return this.m_ExternalOutput1Operation; }
            set { this.m_ExternalOutput1Operation = value; }
        }
        public string ExternalOutput2Mode
        {
            get { return this.m_ExternalOutput2Mode; }
            set { this.m_ExternalOutput2Mode = value; }
        }
        public string ExternalOutput2Delay
        {
            get { return this.m_ExternalOutput2Delay; }
            set { this.m_ExternalOutput2Delay = value; }
        }
        public string ExternalOutput2Operation
        {
            get { return this.m_ExternalOutput2Operation; }
            set { this.m_ExternalOutput2Operation = value; }
        }
        public string ExternalOutput3Mode
        {
            get { return this.m_ExternalOutput3Mode; }
            set { this.m_ExternalOutput3Mode = value; }
        }
        public string ExternalOutput3Delay
        {
            get { return this.m_ExternalOutput3Delay; }
            set { this.m_ExternalOutput3Delay = value; }
        }
        public string ExternalOutput3Operation
        {
            get { return this.m_ExternalOutput3Operation; }
            set { this.m_ExternalOutput3Operation = value; }
        }
        public string ExternalOutput4Mode
        {
            get { return this.m_ExternalOutput4Mode; }
            set { this.m_ExternalOutput4Mode = value; }
        }
        public string ExternalOutput4Delay
        {
            get { return this.m_ExternalOutput4Delay; }
            set { this.m_ExternalOutput4Delay = value; }
        }
        public string ExternalOutput4Operation
        {
            get { return this.m_ExternalOutput4Operation; }
            set { this.m_ExternalOutput4Operation = value; }
        }
        public string ExternalOutput5Mode
        {
            get { return this.m_ExternalOutput5Mode; }
            set { this.m_ExternalOutput5Mode = value; }
        }
        public string ExternalOutput5Delay
        {
            get { return this.m_ExternalOutput5Delay; }
            set { this.m_ExternalOutput5Delay = value; }
        }
        public string ExternalOutput5Operation
        {
            get { return this.m_ExternalOutput5Operation; }
            set { this.m_ExternalOutput5Operation = value; }
        }
        public string ExternalOutput6Mode
        {
            get { return this.m_ExternalOutput6Mode; }
            set { this.m_ExternalOutput6Mode = value; }
        }
        public string ExternalOutput6Delay
        {
            get { return this.m_ExternalOutput6Delay; }
            set { this.m_ExternalOutput6Delay = value; }
        }
        public string ExternalOutput6Operation
        {
            get { return this.m_ExternalOutput6Operation; }
            set { this.m_ExternalOutput6Operation = value; }
        }

        public string PhotoB
        {
            get { return this.m_PhotoB; }
            set { this.m_PhotoB = value; }
        }
        public string PI3
        {
            get { return this.m_PI3; }
            set { this.m_PI3 = value; }
        }
        public string PI4
        {
            get { return this.m_PI4; }
            set { this.m_PI4 = value; }
        }
        public string PI5
        {
            get { return this.m_PI5; }
            set { this.m_PI5 = value; }
        }
        public string PI6
        {
            get { return this.m_PI6; }
            set { this.m_PI6 = value; }
        }
        
        public string IsAutoZeroUsing
        {
            get { return this.m_IsAutoZeroUsing; }
            set { this.m_IsAutoZeroUsing = value; }
        }
        public string AutoZeroPlusRange
        {
            get { return this.m_AutoZeroPlusRange; }
            set { this.m_AutoZeroPlusRange = value; }
        }
        public string AutoZeroMinusRange
        {
            get { return this.m_AutoZeroMinusRange; }
            set { this.m_AutoZeroMinusRange = value; }
        }
        public string AutoZeroVariate
        {
            get { return this.m_AutoZeroVariate; }
            set { this.m_AutoZeroVariate = value; }
        }

        public string dummy1
        {
            get { return this.m_dummy1; }
            set { this.m_dummy1 = value; }
        }
        public string dummy2
        {
            get { return this.m_dummy2; }
            set { this.m_dummy2 = value; }
        }
        public string dummy3
        {
            get { return this.m_dummy3; }
            set { this.m_dummy3 = value; }
        }
        public string dummy4
        {
            get { return this.m_dummy4; }
            set { this.m_dummy4 = value; }
        }
        public string dummy5
        {
            get { return this.m_dummy5; }
            set { this.m_dummy5 = value; }
        }
        public string dummy6
        {
            get { return this.m_dummy6; }
            set { this.m_dummy6 = value; }
        }
        public string dummy7
        {
            get { return this.m_dummy7; }
            set { this.m_dummy7 = value; }
        }
        public string dummy8
        {
            get { return this.m_dummy8; }
            set { this.m_dummy8 = value; }
        }
        public string dummy9
        {
            get { return this.m_dummy9; }
            set { this.m_dummy9 = value; }
        }
        public string dummy10
        {
            get { return this.m_dummy10; }
            set { this.m_dummy10 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.BalanceWeight = "2000";

            this.Filter = "4";
            this.JudgmentDelay = "350";
            this.DoubleDelay = "200";
            this.JudgmentNumber = "10";
            this.Speed = "70";
            this.Dynamic = "1000000";

            this.SorterAMode = "0";
            this.SorterADelay = "100";
            this.SorterAOperation = "100";
            this.SorterBMode = "0";
            this.SorterBDelay = "100";
            this.SorterBOperation = "100";
            this.DoubleEntry = "0";
            this.ExternalInput = "0";
            this.ETCNG = "0";

            this.UnderRange = "0";
            this.PassRange = "0";
            this.OverRange = "0";
            this.TareRange = "0";

            this.ExternalOutput1Mode = "0";
            this.ExternalOutput1Delay = "100";
            this.ExternalOutput1Operation = "100";
            this.ExternalOutput2Mode = "0";
            this.ExternalOutput2Delay = "100";
            this.ExternalOutput2Operation = "100";
            this.ExternalOutput3Mode = "0";
            this.ExternalOutput3Delay = "100";
            this.ExternalOutput3Operation = "100";
            this.ExternalOutput4Mode = "0";
            this.ExternalOutput4Delay = "100";
            this.ExternalOutput4Operation = "100";
            this.ExternalOutput5Mode = "0";
            this.ExternalOutput5Delay = "100";
            this.ExternalOutput5Operation = "100";
            this.ExternalOutput6Mode = "0";
            this.ExternalOutput6Delay = "100";
            this.ExternalOutput6Operation = "100";

            this.PhotoB = "1";
            this.PI3 = "3";
            this.PI4 = "2";
            this.PI5 = "0";
            this.PI6 = "0";

            this.IsAutoZeroUsing = "0";
            this.AutoZeroPlusRange = "100";
            this.AutoZeroMinusRange = "100";
            this.AutoZeroVariate = "0";
            
            this.dummy1 = "0";
            this.dummy2 = "0";
            this.dummy3 = "0";
            this.dummy4 = "0";
            this.dummy5 = "0";
            this.dummy6 = "0";
            this.dummy7 = "0";
            this.dummy8 = "0";
            this.dummy9 = "0";
            this.dummy10 = "0";
        }
        #endregion
    } 
    #endregion
    #region SystemInformation3
    public class SystemInformation3
    {
        #region Field
        private string m_BuzzerONTime;
        private string m_Chattering;
        private string m_Relay;

        private string m_BLDCMotorSpeed1;
        private string m_BLDCMotorPole1;
        private string m_BLDCMotorReductionRatio1;
        private string m_BLDCMotorDirection1;
        private string m_BLDCMotorSpeed2;
        private string m_BLDCMotorPole2;
        private string m_BLDCMotorReductionRatio2;
        private string m_BLDCMotorDirection2;
        private string m_BLDCMotorSpeed3;
        private string m_BLDCMotorPole3;
        private string m_BLDCMotorReductionRatio3;
        private string m_BLDCMotorDirection3;
        private string m_BLDCMotorSpeed4;
        private string m_BLDCMotorPole4;
        private string m_BLDCMotorReductionRatio4;
        private string m_BLDCMotorDirection4;

        private string m_dummy1;
        private string m_dummy2;
        private string m_dummy3;
        private string m_dummy4;
        private string m_dummy5;
        private string m_dummy6;
        private string m_dummy7;
        private string m_dummy8;
        private string m_dummy9;
        private string m_dummy10;
        #endregion

        #region Constructor
        public SystemInformation3()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string BuzzerONTime
        {
            get { return this.m_BuzzerONTime; }
            set { this.m_BuzzerONTime = value; }
        }
        public string Chattering
        {
            get { return this.m_Chattering; }
            set { this.m_Chattering = value; }
        }
        public string Relay
        {
            get { return this.m_Relay; }
            set { this.m_Relay = value; }
        }

        public string BLDCMotorSpeed1
        {
            get { return this.m_BLDCMotorSpeed1; }
            set { this.m_BLDCMotorSpeed1 = value; }
        }
        public string BLDCMotorPole1
        {
            get { return this.m_BLDCMotorPole1; }
            set { this.m_BLDCMotorPole1 = value; }
        }
        public string BLDCMotorReductionRatio1
        {
            get { return this.m_BLDCMotorReductionRatio1; }
            set { this.m_BLDCMotorReductionRatio1 = value; }
        }
        public string BLDCMotorDirection1
        {
            get { return this.m_BLDCMotorDirection1; }
            set { this.m_BLDCMotorDirection1 = value; }
        }
        public string BLDCMotorSpeed2
        {
            get { return this.m_BLDCMotorSpeed2; }
            set { this.m_BLDCMotorSpeed2 = value; }
        }
        public string BLDCMotorPole2
        {
            get { return this.m_BLDCMotorPole2; }
            set { this.m_BLDCMotorPole2 = value; }
        }
        public string BLDCMotorReductionRatio2
        {
            get { return this.m_BLDCMotorReductionRatio2; }
            set { this.m_BLDCMotorReductionRatio2 = value; }
        }
        public string BLDCMotorDirection2
        {
            get { return this.m_BLDCMotorDirection2; }
            set { this.m_BLDCMotorDirection2 = value; }
        }
        public string BLDCMotorSpeed3
        {
            get { return this.m_BLDCMotorSpeed3; }
            set { this.m_BLDCMotorSpeed3 = value; }
        }
        public string BLDCMotorPole3
        {
            get { return this.m_BLDCMotorPole3; }
            set { this.m_BLDCMotorPole3 = value; }
        }
        public string BLDCMotorReductionRatio3
        {
            get { return this.m_BLDCMotorReductionRatio3; }
            set { this.m_BLDCMotorReductionRatio3 = value; }
        }
        public string BLDCMotorDirection3
        {
            get { return this.m_BLDCMotorDirection3; }
            set { this.m_BLDCMotorDirection3 = value; }
        }
        public string BLDCMotorSpeed4
        {
            get { return this.m_BLDCMotorSpeed4; }
            set { this.m_BLDCMotorSpeed4 = value; }
        }
        public string BLDCMotorPole4
        {
            get { return this.m_BLDCMotorPole4; }
            set { this.m_BLDCMotorPole4 = value; }
        }
        public string BLDCMotorReductionRatio4
        {
            get { return this.m_BLDCMotorReductionRatio4; }
            set { this.m_BLDCMotorReductionRatio4 = value; }
        }
        public string BLDCMotorDirection4
        {
            get { return this.m_BLDCMotorDirection4; }
            set { this.m_BLDCMotorDirection4 = value; }
        }

        public string dummy1
        {
            get { return this.m_dummy1; }
            set { this.m_dummy1 = value; }
        }
        public string dummy2
        {
            get { return this.m_dummy2; }
            set { this.m_dummy2 = value; }
        }
        public string dummy3
        {
            get { return this.m_dummy3; }
            set { this.m_dummy3 = value; }
        }
        public string dummy4
        {
            get { return this.m_dummy4; }
            set { this.m_dummy4 = value; }
        }
        public string dummy5
        {
            get { return this.m_dummy5; }
            set { this.m_dummy5 = value; }
        }
        public string dummy6
        {
            get { return this.m_dummy6; }
            set { this.m_dummy6 = value; }
        }
        public string dummy7
        {
            get { return this.m_dummy7; }
            set { this.m_dummy7 = value; }
        }
        public string dummy8
        {
            get { return this.m_dummy8; }
            set { this.m_dummy8 = value; }
        }
        public string dummy9
        {
            get { return this.m_dummy9; }
            set { this.m_dummy9 = value; }
        }
        public string dummy10
        {
            get { return this.m_dummy10; }
            set { this.m_dummy10 = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.BuzzerONTime = "1000";
            this.Chattering = "100";
            this.Relay = "1000";

            this.BLDCMotorSpeed1 = "80";
            this.BLDCMotorPole1 = "1";
            this.BLDCMotorReductionRatio1 = "5";
            this.BLDCMotorDirection1 = "1";
            this.BLDCMotorSpeed2 = "80";
            this.BLDCMotorPole2 = "1";
            this.BLDCMotorReductionRatio2 = "5";
            this.BLDCMotorDirection2 = "1";
            this.BLDCMotorSpeed3 = "80";
            this.BLDCMotorPole3 = "1";
            this.BLDCMotorReductionRatio3 = "5";
            this.BLDCMotorDirection3 = "1";
            this.BLDCMotorSpeed4 = "80";
            this.BLDCMotorPole4 = "1";
            this.BLDCMotorReductionRatio4 = "5";
            this.BLDCMotorDirection4 = "1";

            this.dummy1 = "0";
            this.dummy2 = "0";
            this.dummy3 = "0";
            this.dummy4 = "0";
            this.dummy5 = "0";
            this.dummy6 = "0";
            this.dummy7 = "0";
            this.dummy8 = "0";
            this.dummy9 = "0";
            this.dummy10 = "0";
        }
        #endregion
    } 
    #endregion

    #region UserPasswordType
    public class UserPasswordType
    {
        #region Field
        private string m_Level1Password;
        private string m_Level2Password;
        private string m_Level3Password;
        private string m_Level4Password;

        private Define.E_UserGroup m_Group;
        #endregion

        #region Constructor
        public UserPasswordType()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public string Level1Password
        {
            get { return this.m_Level1Password; }
            set { this.m_Level1Password = value; }
        }
        public string Level2Password
        {
            get { return this.m_Level2Password; }
            set { this.m_Level2Password = value; }
        }
        public string Level3Password
        {
            get { return this.m_Level3Password; }
            set { this.m_Level3Password = value; }
        }
        public string Level4Password
        {
            get { return this.m_Level4Password; }
            set { this.m_Level4Password = value; }
        }

        public Define.E_UserGroup Group
        {
            get { return this.m_Group; }
            set { this.m_Group = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.Level1Password = "1000";
            this.Level2Password = "2000";
            this.Level3Password = "3000";
            this.Level4Password = "0714";

            this.Group = Define.E_UserGroup.None;
        }
        #endregion
    }
    #endregion

    #region DataBackup OPT1
    public class DataBackupOPT1
    {
        #region Field
        private string m_DataID;
        private string m_Name;
        private string m_Lot;
        private string m_OverRange;
        private string m_UnderRange;
        private string m_Weight;
        private string m_Date;
        private string m_Time;
        private string m_PassCount;
        private string m_Grade;
        private string m_Status;
        #endregion

        #region Constructor
        public DataBackupOPT1()
        {
            this.Initialize();
        } 
        #endregion

        #region Property
        public string DataID
        {
            get { return this.m_DataID; }
            set { this.m_DataID = value; }
        } 
        public string Name
        {
            get { return this.m_Name; }
            private set { this.m_Name = value; }
        }
        public string Lot
        {
            get { return this.m_Lot; }
            private set { this.m_Lot = value; }
        }
        public string OverRange
        {
            get { return this.m_OverRange; }
            private set { this.m_OverRange = value; }
        }
        public string UnderRange
        {
            get { return this.m_UnderRange; }
            private set { this.m_UnderRange = value; }
        }
        public string Weight
        {
            get { return this.m_Weight; }
            private set { this.m_Weight = value; }
        }
        public string Date
        {
            get { return this.m_Date; }
            private set { this.m_Date = value; }
        }
        public string Time
        {
            get { return this.m_Time; }
            private set { this.m_Time = value; }
        }
        public string PassCount
        {
            get { return this.m_PassCount; }
            private set { this.m_PassCount = value; }
        }
        public string Grade
        {
            get { return this.m_Grade; }
            private set { this.m_Grade = value; }
        }
        public string Status
        {
            get { return this.m_Status; }
            set { this.m_Status = value; }
        } 
        #endregion

        #region Method
        private void Initialize()
        {
            this.DataID = "";
            this.Name = "";
            this.Lot = "";
            this.OverRange = "";
            this.UnderRange = "";
            this.Weight = "";
            this.Date = "";
            this.Time = "";
            this.PassCount = "";
            this.Grade = "";
            this.Status = "";
        }

        public void SetData(ProductItem item, WeightData data, SystemConfigurationItem1 system, DateTime time)
        {
            this.DataID = data.ReceiveDataID;
            this.Name = item.Name;
            this.Lot = item.LotNo;
            this.OverRange = Helper.StringToDecimalPlaces(item.OverRange, system.DecimalPlaces);
            this.UnderRange = Helper.StringToDecimalPlaces(item.UnderRange, system.DecimalPlaces);
            this.Weight = Helper.DoubleToString(data.Weight, system.DecimalPlaces);
            this.Date = string.Format("{0:yyyy-MM-dd}", time);
            this.Time = string.Format("{0:HH:mm:ss}", time);
            this.PassCount = data.PassCount.ToString();
            this.Grade = data.JudgmentStatus.ToString();
        }
        #endregion
    }
    #endregion

    #region JudgmentResult
    public class JudgmentResult
    {
        #region Field
        private Define.E_JudgmentResult m_Judgment1;
        private Define.E_JudgmentResult m_Judgment2;
        private Define.E_JudgmentResult m_Judgment3;
        private Define.E_JudgmentResult m_Judgment4;
        private Define.E_JudgmentResult m_Judgment5;
        private Define.E_JudgmentResult m_Judgment6;
        private Define.E_JudgmentResult m_Judgment7;
        private Define.E_JudgmentResult m_Judgment8;
        private Define.E_JudgmentResult m_PreviousRejectData;
        private Define.E_JudgmentResult m_Judgment10;
        private Define.E_JudgmentResult m_Judgment11;
        private Define.E_JudgmentResult m_Judgment12;
        private Define.E_JudgmentResult m_CurrentRejectData;
        private Define.E_JudgmentResult m_Judgment14;
        private Define.E_JudgmentResult m_Judgment15;
        private Define.E_JudgmentResult m_Judgment16;
        #endregion

        #region Constructor
        public JudgmentResult()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public Define.E_JudgmentResult Judgment1
        {
            get { return this.m_Judgment1; }
            set { this.m_Judgment1 = value; }
        }
        public Define.E_JudgmentResult Judgment2
        {
            get { return this.m_Judgment2; }
            set { this.m_Judgment2 = value; }
        }
        public Define.E_JudgmentResult Judgment3
        {
            get { return this.m_Judgment3; }
            set { this.m_Judgment3 = value; }
        }
        public Define.E_JudgmentResult Judgment4
        {
            get { return this.m_Judgment4; }
            set { this.m_Judgment4 = value; }
        }
        public Define.E_JudgmentResult Judgment5
        {
            get { return this.m_Judgment5; }
            set { this.m_Judgment5 = value; }
        }
        public Define.E_JudgmentResult Judgment6
        {
            get { return this.m_Judgment6; }
            set { this.m_Judgment6 = value; }
        }
        public Define.E_JudgmentResult Judgment7
        {
            get { return this.m_Judgment7; }
            set { this.m_Judgment7 = value; }
        }
        public Define.E_JudgmentResult Judgment8
        {
            get { return this.m_Judgment8; }
            set { this.m_Judgment8 = value; }
        }
        public Define.E_JudgmentResult PreviousRejectData
        {
            get { return this.m_PreviousRejectData; }
            set { this.m_PreviousRejectData = value; }
        }
        public Define.E_JudgmentResult Judgment10
        {
            get { return this.m_Judgment10; }
            set { this.m_Judgment10 = value; }
        }
        public Define.E_JudgmentResult Judgment11
        {
            get { return this.m_Judgment11; }
            set { this.m_Judgment11 = value; }
        }
        public Define.E_JudgmentResult Judgment12
        {
            get { return this.m_Judgment12; }
            set { this.m_Judgment12 = value; }
        }
        public Define.E_JudgmentResult CurrentRejectData
        {
            get { return this.m_CurrentRejectData; }
            set { this.m_CurrentRejectData = value; }
        }
        public Define.E_JudgmentResult Judgment14
        {
            get { return this.m_Judgment14; }
            set { this.m_Judgment14 = value; }
        }
        public Define.E_JudgmentResult Judgment15
        {
            get { return this.m_Judgment15; }
            set { this.m_Judgment15 = value; }
        }
        public Define.E_JudgmentResult Judgment16
        {
            get { return this.m_Judgment16; }
            set { this.m_Judgment16 = value; }
        }
        #endregion

        #region Method
        public void Initialize()
        {
            this.Judgment1 = Define.E_JudgmentResult.None;
            this.Judgment2 = Define.E_JudgmentResult.None;
            this.Judgment3 = Define.E_JudgmentResult.None;
            this.Judgment4 = Define.E_JudgmentResult.None;
            this.Judgment5 = Define.E_JudgmentResult.None;
            this.Judgment6 = Define.E_JudgmentResult.None;
            this.Judgment7 = Define.E_JudgmentResult.None;
            this.Judgment8 = Define.E_JudgmentResult.None;
            this.PreviousRejectData = Define.E_JudgmentResult.None;
            this.Judgment10 = Define.E_JudgmentResult.None;
            this.Judgment11 = Define.E_JudgmentResult.None;
            this.Judgment12 = Define.E_JudgmentResult.None;
            this.CurrentRejectData = Define.E_JudgmentResult.None;
            this.Judgment14 = Define.E_JudgmentResult.None;
            this.Judgment15 = Define.E_JudgmentResult.None;
            this.Judgment16 = Define.E_JudgmentResult.None;
        }
        #endregion
    }
    #endregion

    #region Serial Com - OPT2(나우시스템즈)
    public class SerialOPT2
    {
        #region Field
        private bool m_IsReceivedData;
        private bool m_IsErrorReceivedData;
        private bool m_IsErrorSettingStatus;
        private bool m_IsFailProductChange;
        #endregion

        #region Constructor
        public SerialOPT2()
        {
            this.Initialization();
        }
        #endregion

        #region Property
        public bool IsReceivedData
        {
            get { return this.m_IsReceivedData; }
            set { this.m_IsReceivedData = value; }
        }
        public bool IsErrorReceivedData
        {
            get { return this.m_IsErrorReceivedData; }
            set { this.m_IsErrorReceivedData = value; }
        }
        public bool IsErrorSettingStatus
        {
            get { return this.m_IsErrorSettingStatus; }
            set { this.m_IsErrorSettingStatus = value; }
        }
        public bool IsFailProductChange
        {
            get { return this.m_IsFailProductChange; }
            set { this.m_IsFailProductChange = value; }
        }
        #endregion

        #region Method
        public void Initialization()
        {
            this.IsReceivedData = false;
            this.IsErrorReceivedData = false;
            this.IsErrorSettingStatus = false;
            this.IsFailProductChange = false;
        }
        #endregion
    } 
    #endregion

    #region UpdateForMainBoard
    public class UpdateForMainBoard
    {
        #region Field
        private bool m_IsUpdateFinish;
        private bool m_IsAckResponse;
        private bool m_IsLastData;
        private byte[] m_ByteData;
        private byte[] m_SendData;
        private int m_Index;
        private int m_RetryCount;
        private int m_SendDataCount;
        private int m_ProgressBar1;
        private int m_ProgressBar2;
        private int m_ProgressBar3;
        private int m_ProgressBar4;
        private int m_ProgressBar5;
        private int m_ProgressBar6;
        private int m_ProgressBar7;
        private int m_ProgressBar8;
        #endregion

        #region Constructor
        public UpdateForMainBoard()
        {
            this.Initialize();
        }
        #endregion

        #region Property
        public bool IsUpdateFinish
        {
            get { return this.m_IsUpdateFinish; }
            set { this.m_IsUpdateFinish = value; }
        }
        public bool IsAckResponse
        {
            get { return this.m_IsAckResponse; }
            set { this.m_IsAckResponse = value; }
        }
        public bool IsLastData
        {
            get { return this.m_IsLastData; }
            set { this.m_IsLastData = value; }
        }
        public byte[] ByteData
        {
            get { return this.m_ByteData; }
            set { this.m_ByteData = value; }
        }
        public byte[] SendData
        {
            get { return this.m_SendData; }
            set { this.m_SendData = value; }
        }
        public int Index
        {
            get { return this.m_Index; }
            set { this.m_Index = value; }
        }
        public int RetryCount
        {
            get { return this.m_RetryCount; }
            set { this.m_RetryCount = value; }
        }
        public int SendDataCount
        {
            get { return this.m_SendDataCount; }
            set
            {
                int iValue = 0;

                this.m_SendDataCount = value;

                iValue = value / 8;

                this.ProgressBar1 = iValue;
                this.ProgressBar2 = iValue * 2;
                this.ProgressBar3 = iValue * 3;
                this.ProgressBar4 = iValue * 4;
                this.ProgressBar5 = iValue * 5;
                this.ProgressBar6 = iValue * 6;
                this.ProgressBar7 = iValue * 7;
                this.ProgressBar8 = iValue * 8;
            }
        }

        public int ProgressBar1
        {
            get { return this.m_ProgressBar1; }
            private set { this.m_ProgressBar1 = value; }
        }
        public int ProgressBar2
        {
            get { return this.m_ProgressBar2; }
            private set { this.m_ProgressBar2 = value; }
        }
        public int ProgressBar3
        {
            get { return this.m_ProgressBar3; }
            private set { this.m_ProgressBar3 = value; }
        }
        public int ProgressBar4
        {
            get { return this.m_ProgressBar4; }
            private set { this.m_ProgressBar4 = value; }
        }
        public int ProgressBar5
        {
            get { return this.m_ProgressBar5; }
            private set { this.m_ProgressBar5 = value; }
        }
        public int ProgressBar6
        {
            get { return this.m_ProgressBar6; }
            private set { this.m_ProgressBar6 = value; }
        }
        public int ProgressBar7
        {
            get { return this.m_ProgressBar7; }
            private set { this.m_ProgressBar7 = value; }
        }
        public int ProgressBar8
        {
            get { return this.m_ProgressBar8; }
            private set { this.m_ProgressBar8 = value; }
        }
        #endregion

        #region Method
        public void Initialize()
        {
            this.IsUpdateFinish = false;
            this.IsAckResponse = false;
            this.IsLastData = false;
            this.ByteData = new byte[100];
            this.SendData = new byte[100];
            this.Index = 1;
            this.RetryCount = 0;
            this.SendDataCount = 0;
            this.ProgressBar1 = 0;
            this.ProgressBar2 = 0;
            this.ProgressBar3 = 0;
            this.ProgressBar4 = 0;
            this.ProgressBar5 = 0;
            this.ProgressBar6 = 0;
            this.ProgressBar7 = 0;
            this.ProgressBar8 = 0;
        }
        #endregion
    }
    #endregion
}
