INT63DC_2C/INT63DC_2C/DataStore.cs

3822 lines
115 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Runtime.InteropServices;
namespace INT63DC_2C
{
public class DataStore
{
#region Enum
public enum EquipmentStatus
{
Stop = 0,
Start = 1,
};
public enum FormStore
{
FormNone = 0,
FormMainDisplay,
FormMenu,
FormSystemSetting,
FormEquipmentSetting,
FormConfiguration,
FormCalibration,
FormEquipmentTest,
FormIOTest,
FormDataBackup,
FormTimeSetting,
FormInformation,
FormFactory,
FormProgramUpdate,
FormUserSetting,
FormDataStatistics,
FormOptionSetting,
FormMotorSetting,
FormUserGroupEditor,
};
public enum FormMainDisplayStore
{
FormMainDisplayBarGraph,
FormMainDisplayDotGraph,
FormMainDisplayTable,
};
public enum LanguageID
{
Korean = 0,
English,
Chinese,
Czech,
German,
Japanese,
};
public enum UserGroup
{
None = 0,
Level1Operator,
Level2Engineer,
Level3Manager,
Level4Developer,
LogOff,
NotLogin,
};
public enum JudgmentStatus
{
None,
Under,
Pass,
Over,
Double,
SensorError,
ExNG,
Empty,
UnderLimit,
OverLimit,
};
public enum WeightStatus
{
Empty,
WeightChange,
WeightZero,
CalNomal,
CalBalans,
CalStandby,
CalFinish,
CalError,
};
public enum ResponseData
{
NAK = 0,
ACK = 1,
};
public enum UserPassword
{
f0_Level1 = 0,
f1_Level2 = 1,
f2_Level3 = 2,
};
public enum EnumFileUserGroup
{
f0_Level1 = 0,
f1_Level2 = 1,
f2_Level3 = 2,
f3_NotLogin = 3,
}
#endregion
}
public class OptionPassword
{
// 기본
public static readonly string Default = "0810";
// 1. 데이터
// 데이터집계
public static readonly string DataStatistics = "1000";
// 2. 통신
// 피드백보드
public static readonly string FeedbackBoard = "2000";
}
#region CommunicationCommand
public class CommunicationCommand
{
// 운전데이터 Respone
public static readonly string StartDataCMD = "Sr0";
// 중량조정모드
public static readonly string ModeCalibration = "Csc00";
// 노멀모드
public static readonly string ModeNormal = "Csn00";
// 판정설정모드
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 ModeMenu = "Csm00";
// 중량조정 - 분동
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 MotorAlarmReset = "Cma00";
// 임펠러 모터 - 정회전
public static readonly string ImpellerMotorForward = "Cmc00";
// 임펠러 모터 - 역회전
public static readonly string ImpellerMotorReverse = "Cmr00";
// 모터 - 다운
public static readonly string MotorDown = "Cmd00";
// 모터 - Step
public static readonly string MotorStep = "Cms00";
// 모터 - Position 0
public static readonly string MotorPosition0 = "Cm000";
// 모터 - Position 1
public static readonly string MotorPosition1 = "Cm100";
// 모터 - Position 2
public static readonly string MotorPosition2 = "Cm200";
// 모터 - Origin
public static readonly string MotorOrigin = "Cmo00";
// 모터 - JOG CW OFF
public static readonly string MotorJogCwOff = "Cmg00";
// 모터 - JOG CW ON
public static readonly string MotorJogCwOn = "Cmg01";
// 모터 - JOG CCW OFF
public static readonly string MotorJogCcwOff = "Cmh00";
// 모터 - JOG CCW ON
public static readonly string MotorJogCcwOn = "Cmh01";
// 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";
// NG Signal
public static readonly string NgSignal = "Cbn00";
// Pass Signal
public static readonly string PassSignal = "Cbm00";
// Sampling Signal
public static readonly string SamplingSignal = "Cba00";
// Buzzer ON
public static readonly string BuzzerOn = "Cae00";
// Buzzer Off
public static readonly string BuzzerOff = "CAE00";
// 판정 - 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 static readonly string AlarmReset = "Car00";
}
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";
// ACK
public static readonly string ACK = "1";
// NAK
public static readonly string NAK = "0";
// Empty 중량 설정
public static readonly string _1021_EmptyWeight = "1021";
// Weight Limit 사용유무
public static readonly string _1023_WeightLimitEnable = "1023";
// Weight Limit 무시 수량
public static readonly string _1025_WeightLimitIgnoreCount = "1025";
// 바이패스
public static readonly string _1201_Bypass = "1201";
// 보드 버전 모두 읽기
public static readonly string _1500_ProgramVersion = "1500";
// 품목설정 - 품번
public static readonly string _2001_ProductNumber = "2001";
// 품목설정 - 하한 설정값
public static readonly string _2002_UnderRange = "2002";
// 품목설정 - 기준 설정값
public static readonly string _2003_PassRange = "2003";
// 품목설정 - 상한 설정값
public static readonly string _2004_OverRange = "2004";
// 품목설정 - 용기 설정값
public static readonly string _2005_TareRange = "2005";
// 품목설정 - 하한 Limit 설정값
public static readonly string _2201_UnderLimitRange = "2201";
// 품목설정 - 상한 Limit 설정값
public static readonly string _2202_OverLimitRange = "2202";
// 중량조정 - 최대중량 설정값
public static readonly string _3001_MaxWeight = "3001";
// 중량조정 - 분동중량 설정값
public static readonly string _3002_BalanceWeight = "3002";
// 중량조정 - 한눈의 값
public static readonly string _3003_Digit = "3003";
// 중량조정 - 파라미터 읽기
public static readonly string _3901_ParameterRead3901 = "3901";
// 자동영점 - 시간
public static readonly string _4001_ZeroTime = "4001";
// 자동영점 - 범위
public static readonly string _4002_ZeroRange = "4002";
// 자동영점 - 변량
public static readonly string _4003_ZeroVariate = "4003";
// 자동영점 - 모드
public static readonly string _4004_ZeroMode = "4004";
// 강제영점 지연시간
public static readonly string _4501_ForcedZeroDelayTime = "4501";
// 자동영점 - 파라미터 읽기
public static readonly string _4901_ParameterRead4901 = "4901";
// 판정설정 - 필터
public static readonly string _5001_Filter = "5001";
// 판정설정 - 판정지연
public static readonly string _5002_JudgmentDelayTime = "5002";
// 판정설정 - 이중지연
public static readonly string _5003_DoubleDelayTime = "5003";
// 판정설정 - 판정개수
public static readonly string _5004_JudgmentCount = "5004";
// 판정설정 - 이송속도
public static readonly string _5005_FeedSpeed = "5005";
// 판정설정 - 동보정
public static readonly string _5006_DynamicCorrection = "5006";
// 판정설정 - 턴지연시간
public static readonly string _5017_TurnDelayTime = "5017";
// 판정설정 - 원점옵셋
public static readonly string _5018_OriginOffset = "5018";
// 판정설정 - 원점속도
public static readonly string _5019_OriginSpeed = "5019";
// 판정설정 - 인버터토크
public static readonly string _5020_InverterTorque = "5020";
// 판정설정 - 진입게이트 지연시간
public static readonly string _5032_EntryGateDelayTime = "5032";
// 판정설정 - 진입게이트 동작시간
public static readonly string _5033_EntryGateRunTime = "5033";
// 판정설정 - 배출스토퍼 지연시간
public static readonly string _5034_DischargeStopperDelayTime = "5034";
// 판정설정 - 배출스토퍼 동작시간
public static readonly string _5034_DischargeStopperRunTime = "5035";
// 판정설정 - 선별기 모드 값
public static readonly string _5101_Sorter1Mode = "5101";
// 판정설정 - 선별기1 지연시간
public static readonly string _5102_Sorter1DelayTime = "5102";
// 판정설정 - 선별기1 동작시간
public static readonly string _5103_Sorter1RunTime = "5103";
// 판정설정 - 선별기2 지연시간
public static readonly string _5105_Sorter2DelayTime = "5105";
// 판정설정 - 선별기2 동작시간
public static readonly string _5106_Sorter2RunTime = "5106";
// 판정설정 - 선별기3 지연시간
public static readonly string _5108_Sorter3DelayTime = "5108";
// 판정설정 - 선별기3 동작시간
public static readonly string _5109_Sorter3RunTime = "5109";
// 판정설정 - 외부출력1 지연시간 (외부 신호 출력 턴지연시간)
public static readonly string _5202_EXT1DelayTime = "5202";
// 판정설정 - 외부출력1 동작시간 (외부 신호 출력 턴동작시간)
public static readonly string _5203_EXT1RunTime = "5203";
// 옵션 - 부저 ON시간
public static readonly string _6001_BuzzerOnTime = "6001";
// 옵션 - 릴레이 동작시간
public static readonly string _6002_RelayOperatingTime = "6002";
// 옵션 - 이중진입사용여부
public static readonly string _6005_DoubleEnter = "6005";
// 옵션 - 채터링감지 설정
public static readonly string _6006_Chattering = "6006";
// 옵션 - 파라미터 읽기
public static readonly string _6901_ParameterRead6901 = "6901";
// 통신,IO설정 - INPUT ALL
public static readonly string _7500_InputAll = "7500";
// 통신,IO설정 = OUTPUT1
public static readonly string _7701_Output1 = "7701";
// 통신,IO설정 = OUTPUT2
public static readonly string _7702_Output2 = "7702";
// 통신,IO설정 = OUTPUT3
public static readonly string _7703_Output3 = "7703";
// 통신,IO설정 = OUTPUT4
public static readonly string _7704_Output4 = "7704";
// 통신,IO설정 = OUTPUT5
public static readonly string _7705_Output5 = "7705";
// 통신,IO설정 = OUTPUT6
public static readonly string _7706_Output6 = "7706";
// 통신,IO설정 = OUTPUT7
public static readonly string _7707_Output7 = "7707";
// 통신,IO설정 = OUTPUT8
public static readonly string _7708_Output8 = "7708";
// 통신,IO설정 = OUTPUT9
public static readonly string _7709_Output9 = "7709";
// 통신,IO설정 = OUTPUT10
public static readonly string _7710_Output10 = "7710";
// 통신,IO설정 = OUTPUT11
public static readonly string _7711_Output11 = "7711";
// 통신,IO설정 = OUTPUT12
public static readonly string _7712_Output12 = "7712";
// 통신,IO설정 = OUTPUT13
public static readonly string _7713_Output13 = "7713";
// 통신,IO설정 = OUTPUT14
public static readonly string _7714_Output14 = "7714";
// 통신,IO설정 = OUTPUT15
public static readonly string _7715_Output15 = "7715";
// 통신,IO설정 = OUTPUT16
public static readonly string _7716_Output16 = "7716";
// 중량 설정값 쓰기
public static readonly string _9003_ParameterWeightRange = "9003";
// 시스템 설정 모두 쓰기
public static readonly string _9029_ParameterSystem = "9029";
// 품목 설정 모두 쓰기1
public static readonly string _9030_ParameterProduct1 = "9030";
// 개별 동보정값 쓰기
public static readonly string _9034_ParameterDynamicCorrection = "9034";
// 품목 설정 모두 쓰기2
public static readonly string _9040_ParameterProduct2 = "9040";
}
#endregion
#region ServoMotor(Panasonic)
public class ServoMotorParameterAddress
{
// SaveAllParameters - 0x1020
public static readonly int SaveAllParameters = 4128;
// EEPROM - 0x6173h
public static readonly int EEPROM = 24947;
// Speed 0 - 0x4600
public static readonly int Speed0 = 17920;
// Speed 1 - 0x4601
public static readonly int Speed1 = 17921;
// Acceleration1 - 0x4611
public static readonly int Acceleration1 = 17937;
// Deceleration1 - 0x4621
public static readonly int Deceleration1 = 17953;
// CMD 0 - 0x4802
public static readonly int CMD0 = 18434;
// CMD 1 - 0x4806
public static readonly int CMD1 = 18438;
// CMD 2 - 0x480A
public static readonly int CMD2 = 18442;
// CMD 5 - 0x4816
public static readonly int CMD5 = 18454;
// CMD 6 - 0x481A
public static readonly int CMD6 = 18458;
// CMD 7 - 0x481E
public static readonly int CMD7 = 18462;
// CMD 8 - 0x4822
public static readonly int CMD8 = 18466;
// CMD 10 - 0x482A
public static readonly int CMD10 = 18474;
// CMD 11 - 0x482E
public static readonly int CMD11 = 18478;
// CMD 16 - 0x4842
public static readonly int CMD16 = 18498;
// CMD 17 - 0x4846
public static readonly int CMD17 = 18502;
}
#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
#region UserGroup
public class UserPasswordType
{
#region Field
private string m_Level1Password;
private string m_Level2Password;
private string m_Level3Password;
private string m_Level4Password;
private string m_DefinedPassword;
private DataStore.UserGroup m_Group;
#endregion
#region Constructor
public UserPasswordType()
{
this.Initialization();
}
#endregion
#region Property
public string Level1Password
{
get { return this.m_Level1Password; }
private set { this.m_Level1Password = value; }
}
public string Level2Password
{
get { return this.m_Level2Password; }
private set { this.m_Level2Password = value; }
}
public string Level3Password
{
get { return this.m_Level3Password; }
private set { this.m_Level3Password = value; }
}
public string Level4Password
{
get { return this.m_Level4Password; }
private set { this.m_Level4Password = value; }
}
public string DefinedPassword
{
get { return this.m_DefinedPassword; }
private set { this.m_DefinedPassword = value; }
}
public DataStore.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.SetDefinedPassword("0810");
this.Group = DataStore.UserGroup.LogOff;
}
public void SetDefinedPassword(string pass)
{
this.DefinedPassword = string.Format("{0:MMdd}{1}", DateTime.Now, pass);
}
#endregion
}
#endregion
#region SystemConfiguration
public class SystemConfigurationItem
{
#region Field
private bool m_IsDataBackup;
private bool m_IsEachNG;
private bool m_IsWeightViewForward;
private bool m_IsBypassMode;
private bool m_IsLogin;
private bool m_IsBypassDirectionPass;
private bool m_IsBypassOnce;
private bool m_IsOptDataStatistics;
private bool m_IsCutView;
private bool m_IsAdcValueAdd;
private bool m_IsSamplingOnce;
private bool m_IsSamplingRun;
private bool m_IsWeightLimitEnable;
private int m_DecimalPlaces;
private int m_EquipmentColumns;
private int m_ProductNumber;
private int m_Serial3BaudRate;
private int m_Serial3Mode;
private int m_UsbID;
private int m_InverterTorque;
private int m_EXT1_DelayTime;
private int m_EXT1_RunTime;
private int m_Sorter1Location;
private int m_Sorter2Location;
private int m_Sorter3Location;
private int m_MotorSelect;
private int m_SamplingTime;
private int m_SamplingCount;
private int m_SamplingCurrentCount;
private int m_WeightLimitIgnoreCount;
private int m_ComRetryCNT;
private string m_Unit;
private string m_SerialNumber;
private string m_EmptyWeight;
private string m_ComPort;
private DataStore.LanguageID m_Language;
private DataStore.FormStore m_CurrentForm;
private User m_CurrentUser;
#endregion
#region Constructor
public SystemConfigurationItem()
{
this.Initialization();
}
#endregion
#region Property
public bool IsDataBackup
{
get { return this.m_IsDataBackup; }
set { this.m_IsDataBackup = value; }
}
public bool IsEachNG
{
get { return this.m_IsEachNG; }
set { this.m_IsEachNG = value; }
}
public bool IsWeightViewForward
{
get { return this.m_IsWeightViewForward; }
set { this.m_IsWeightViewForward = value; }
}
public bool IsBypassMode
{
get { return this.m_IsBypassMode; }
set { this.m_IsBypassMode = value; }
}
public bool IsLogin
{
get { return this.m_IsLogin; }
set { this.m_IsLogin = 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 IsOptDataStatistics
{
get { return this.m_IsOptDataStatistics; }
set { this.m_IsOptDataStatistics = value; }
}
public bool IsCutView
{
get { return this.m_IsCutView; }
set { this.m_IsCutView = value; }
}
public bool IsAdcValueAdd
{
get { return this.m_IsAdcValueAdd; }
set { this.m_IsAdcValueAdd = value; }
}
public bool IsSamplingOnce
{
get { return this.m_IsSamplingOnce; }
set { this.m_IsSamplingOnce = value; }
}
public bool IsSamplingRun
{
get { return this.m_IsSamplingRun; }
set { this.m_IsSamplingRun = value; }
}
public bool IsWeightLimitEnable
{
get { return this.m_IsWeightLimitEnable; }
set { this.m_IsWeightLimitEnable = value; }
}
public int DecimalPlaces
{
get { return this.m_DecimalPlaces; }
set { this.m_DecimalPlaces = value; }
}
public int EquipmentColumns
{
get { return this.m_EquipmentColumns; }
set { this.m_EquipmentColumns = value; }
}
public int ProductNumber
{
get { return this.m_ProductNumber; }
set { this.m_ProductNumber = value; }
}
public int Serial3BaudRate
{
get { return this.m_Serial3BaudRate; }
set { this.m_Serial3BaudRate = value; }
}
public int Serial3Mode
{
get { return this.m_Serial3Mode; }
set { this.m_Serial3Mode = value; }
}
public int UsbID
{
get { return this.m_UsbID; }
set { this.m_UsbID = value; }
}
public int InverterTorque
{
get { return this.m_InverterTorque; }
set { this.m_InverterTorque = value; }
}
public int EXT1_DelayTime
{
get { return this.m_EXT1_DelayTime; }
set { this.m_EXT1_DelayTime = value; }
}
public int EXT1_RunTime
{
get { return this.m_EXT1_RunTime; }
set { this.m_EXT1_RunTime = value; }
}
public int Sorter1Location
{
get { return this.m_Sorter1Location; }
set { this.m_Sorter1Location = value; }
}
public int Sorter2Location
{
get { return this.m_Sorter2Location; }
set { this.m_Sorter2Location = value; }
}
public int Sorter3Location
{
get { return this.m_Sorter3Location; }
set { this.m_Sorter3Location = value; }
}
public int MotorSelect
{
get { return this.m_MotorSelect; }
set { this.m_MotorSelect = value; }
}
public int SamplingTime
{
get { return this.m_SamplingTime; }
set { this.m_SamplingTime = value; }
}
public int SamplingCount
{
get { return this.m_SamplingCount; }
set { this.m_SamplingCount = value; }
}
public int SamplingCurrentCount
{
get { return this.m_SamplingCurrentCount; }
set { this.m_SamplingCurrentCount = value; }
}
public int WeightLimitIgnoreCount
{
get { return this.m_WeightLimitIgnoreCount; }
set { this.m_WeightLimitIgnoreCount = value; }
}
public int ComRetryCNT
{
get { return this.m_ComRetryCNT; }
set { this.m_ComRetryCNT = value; }
}
public string Unit
{
get { return this.m_Unit; }
set { this.m_Unit = value; }
}
public string SerialNumber
{
get { return this.m_SerialNumber; }
set { this.m_SerialNumber = value; }
}
public string EmptyWeight
{
get { return this.m_EmptyWeight; }
set { this.m_EmptyWeight = value; }
}
public string ComPort
{
get { return this.m_ComPort; }
set { this.m_ComPort = value; }
}
public DataStore.LanguageID Language
{
get { return this.m_Language; }
set { this.m_Language = value; }
}
public DataStore.FormStore CurrentForm
{
get { return this.m_CurrentForm; }
set { this.m_CurrentForm = value; }
}
public User CurrentUser
{
get { return this.m_CurrentUser; }
set { this.m_CurrentUser = value; }
}
#endregion
#region Method
public void Initialization()
{
this.IsDataBackup = false;
this.IsEachNG = true;
this.IsWeightViewForward = true;
this.IsBypassMode = false;
this.IsLogin = false;
this.IsBypassDirectionPass = true;
this.IsBypassOnce = true;
this.IsOptDataStatistics = false;
this.IsCutView = false;
this.IsAdcValueAdd = false;
this.IsSamplingOnce = true;
this.IsSamplingRun = false;
this.IsWeightLimitEnable = true;
this.DecimalPlaces = 1;
this.EquipmentColumns = 10;
this.ProductNumber = 1;
this.Serial3BaudRate = 0;
this.Serial3Mode = 0;
this.UsbID = 1;
this.InverterTorque = 100;
this.EXT1_DelayTime = 0;
this.EXT1_RunTime = 1000;
this.Sorter1Location = 1;
this.Sorter2Location = 2;
this.Sorter3Location = 3;
this.MotorSelect = 0;
this.SamplingTime = 1;
this.SamplingCount = 1;
this.SamplingCurrentCount = 0;
this.WeightLimitIgnoreCount = 3;
this.ComRetryCNT = 0;
this.Unit = "g";
this.SerialNumber = "21A0000";
this.EmptyWeight = "0";
this.ComPort = "COM2";
this.Language = DataStore.LanguageID.Korean;
this.CurrentForm = DataStore.FormStore.FormMainDisplay;
this.CurrentUser = new User();
this.CurrentUser.Group = DataStore.UserGroup.LogOff;
}
#endregion
}
#endregion
#region Struct SystemConfiguration1
[StructLayout(LayoutKind.Sequential)]
public struct StructSystemConfigurationItem1
{
public bool IsDataBackup;
public bool IsEachNG;
public bool IsLogin;
public bool IsWeightViewForward;
public bool IsOptDataStatistics;
public bool DummyBool5;
public bool DummyBool6;
public bool DummyBool7;
public int DecimalPlaces;
public int EquipmentColumns;
public int ProductNumber;
public int Serial3BaudRate;
public int Serial3Mode;
public int UsbID;
public int WeightLimitIgnoreCount;
public int MotorSelect;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string Unit;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)]
public string SerialNumber;
public DataStore.LanguageID Language;
public bool DummyBool1;
public bool DummyBool2;
public bool DummyBool3;
public bool DummyBool4;
public bool DummyBool8;
public int Sorter1Location;
public int Sorter2Location;
public int EXT1_DelayTime;
public int EXT1_RunTime;
public int InverterTorque;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string EmptyWeight;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string ComPort;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString5;
}
#endregion
#region Struct SystemConfiguration2
[StructLayout(LayoutKind.Sequential)]
public struct StructSystemConfigurationItem2
{
public double DummyDouble11;
public double DummyDouble12;
public double DummyDouble13;
public double DummyDouble14;
public double DummyDouble15;
public double DummyDouble16;
public double DummyDouble17;
public double DummyDouble18;
public double DummyDouble19;
public double DummyDouble20;
public double DummyDouble21;
public double DummyDouble22;
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 IsSamplingOnce;
public int DummyInt1;
public int DummyInt2;
public int DummyInt3;
public int DummyInt4;
public int DummyInt5;
public int DummyInt6;
public int ComRetryCNT;
public int SamplingCount;
public int SamplingTime;
public int Sorter3Location;
public double DummyDouble1;
public double DummyDouble2;
public double DummyDouble3;
public double DummyDouble4;
public double DummyDouble5;
public double DummyDouble6;
public double DummyDouble7;
public double DummyDouble8;
public double DummyDouble9;
public double DummyDouble10;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString5;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString6;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString7;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString8;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString9;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString10;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString11;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString12;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString13;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString14;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
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_UnderRangeLimit;
private string m_OverRangeLimit;
private int m_ProgressBarMaximum;
private int m_ProgressBarMinimum;
#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();
}
}
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;
this.ProgressBarLevelRescale();
}
}
public string TareRange
{
get { return this.m_TareRange; }
set { this.m_TareRange = value; }
}
public string UnderRangeLimit
{
get { return this.m_UnderRangeLimit; }
set { this.m_UnderRangeLimit = value; }
}
public string OverRangeLimit
{
get { return this.m_OverRangeLimit; }
set { this.m_OverRangeLimit = 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; }
}
#endregion
#region Method
public void Initialization()
{
this.Number = 1;
this.Name = "ProductName 1";
this.LotNo = "Lot 1";
this.UnderRange = "1000";
this.PassRange = "2000";
this.OverRange = "3000";
this.TareRange = "0";
this.UnderRange = "0";
this.OverRange = "99999";
}
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;
}
#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 OverRangeLimit;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string UnderRangeLimit;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string DummyString3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string DummyString4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string DummyString5;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString6;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString7;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString8;
}
#endregion
#region WeightData
public class WeightData
{
#region Field
private int m_UnderCount;
private int m_PassCount;
private int m_OverCount;
private int m_ExNGCount;
private double m_Weight;
private DataStore.JudgmentStatus m_JudgmentStatus;
private DataStore.WeightStatus m_Status;
private string m_ADCValue;
private int m_ProductionSpeed;
private int PreviousTimeTickCount;
private bool m_IsStart;
private string m_WeightString;
private bool m_IsADCError;
private bool m_IsBypassMode;
private bool m_IsOPT1;
private bool m_IsSamplingData;
#endregion
#region Constructor
public WeightData()
{
this.Initialization();
}
#endregion
#region Property
public int UnderCount
{
get { return this.m_UnderCount; }
set { this.m_UnderCount = 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 int PassCount
{
get { return this.m_PassCount; }
set { this.m_PassCount = 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 int OverCount
{
get { return this.m_OverCount; }
set { this.m_OverCount = 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 int ExNGCount
{
get { return this.m_ExNGCount; }
set { this.m_ExNGCount = value; }
}
public int TotalNGCount
{
get { return this.UnderCount + this.OverCount + this.ExNGCount; }
}
public int TotalCount
{
get { return this.UnderCount + this.PassCount + this.OverCount + this.ExNGCount; }
}
/// <summary>
/// 소수점 포함된 중량값
/// </summary>
public double Weight
{
get { return this.m_Weight; }
set { this.m_Weight = value; }
}
public string ADCValue
{
get { return this.m_ADCValue; }
set
{
int temp = 0;
this.m_ADCValue = value;
try
{
temp = int.Parse(value);
}
catch
{
temp = 0;
}
if (temp < 500 || temp > 60000)
{
if (this.IsADCError != true)
this.IsADCError = true;
}
else
{
if (this.IsADCError != false)
this.IsADCError = false;
}
}
}
public DataStore.JudgmentStatus JudgmentStatus
{
get { return this.m_JudgmentStatus; }
set
{
this.m_JudgmentStatus = value;
//this.ProductionSpeedCalculation();
if (value == DataStore.JudgmentStatus.Under)
{
if (this.UnderCount < 10000000)
this.UnderCount++;
else
this.UnderCount = 0;
}
else if (value == DataStore.JudgmentStatus.Pass)
{
if (this.PassCount < 10000000)
this.PassCount++;
else
this.PassCount = 0;
}
else if (value == DataStore.JudgmentStatus.Over)
{
if (this.OverCount < 10000000)
this.OverCount++;
else
this.OverCount = 0;
}
else if (value == DataStore.JudgmentStatus.Double || value == DataStore.JudgmentStatus.ExNG)
{
if (this.ExNGCount < 10000000)
this.ExNGCount++;
else
this.ExNGCount = 0;
}
}
}
public DataStore.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; }
}
/// <summary>
/// 소수점 없는 중량값
/// </summary>
public string WeightString
{
get { return this.m_WeightString; }
set { this.m_WeightString = value; }
}
public bool IsADCError
{
get { return this.m_IsADCError; }
private set { this.m_IsADCError = value; }
}
public bool IsBypassMode
{
get { return m_IsBypassMode; }
set { m_IsBypassMode = value; }
}
/// <summary>
/// 스틱2모드에서 데이터 전송이 되었으면 true, 안되었으면 false
/// </summary>
public bool IsOPT1
{
get { return this.m_IsOPT1; }
set { this.m_IsOPT1 = value; }
}
/// <summary>
/// 샘플링 기능 설정 후 판정데이터가 샘플링 데이터이면 true
/// </summary>
public bool IsSamplingData
{
get { return this.m_IsSamplingData; }
set { this.m_IsSamplingData = value; }
}
#endregion
#region Mehtod
public void ClearCount()
{
this.UnderCount = 0;
this.PassCount = 0;
this.OverCount = 0;
this.ExNGCount = 0;
}
public void Initialization()
{
this.UnderCount = 0;
this.PassCount = 0;
this.OverCount = 0;
this.ExNGCount = 0;
this.Weight = 0.0;
this.ADCValue = "12345";
this.JudgmentStatus = DataStore.JudgmentStatus.None;
this.ProductionSpeed = 0;
this.WeightString = "0";
this.IsADCError = false;
this.IsBypassMode = false;
this.IsOPT1 = false;
this.IsSamplingData = false;
}
private 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;
}
}
#endregion
}
#endregion
#region Struct Counter1
[StructLayout(LayoutKind.Sequential)]
public struct StructCounter1
{
public int OverCount1;
public int PassCount1;
public int UnderCount1;
public int ExNGCount1;
public int OverCount2;
public int PassCount2;
public int UnderCount2;
public int ExNGCount2;
public int OverCount3;
public int PassCount3;
public int UnderCount3;
public int ExNGCount3;
public int OverCount4;
public int PassCount4;
public int UnderCount4;
public int ExNGCount4;
public int OverCount5;
public int PassCount5;
public int UnderCount5;
public int ExNGCount5;
public int OverCount6;
public int PassCount6;
public int UnderCount6;
public int ExNGCount6;
public int OverCount7;
public int PassCount7;
public int UnderCount7;
public int ExNGCount7;
public int OverCount8;
public int PassCount8;
public int UnderCount8;
public int ExNGCount8;
public int OverCount9;
public int PassCount9;
public int UnderCount9;
public int ExNGCount9;
public int OverCount10;
public int PassCount10;
public int UnderCount10;
public int ExNGCount10;
public int OverCount11;
public int PassCount11;
public int UnderCount11;
public int ExNGCount11;
public int OverCount12;
public int PassCount12;
public int UnderCount12;
public int ExNGCount12;
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;
}
#endregion
#region Struct Counter2
[StructLayout(LayoutKind.Sequential)]
public struct StructCounter2
{
public int OverCount13;
public int PassCount13;
public int UnderCount13;
public int ExNGCount13;
public int OverCount14;
public int PassCount14;
public int UnderCount14;
public int ExNGCount14;
public int OverCount15;
public int PassCount15;
public int UnderCount15;
public int ExNGCount15;
public int OverCount16;
public int PassCount16;
public int UnderCount16;
public int ExNGCount16;
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 DummyInt25;
public int DummyInt26;
public int DummyInt27;
public int DummyInt28;
public int DummyInt29;
public int DummyInt30;
public int DummyInt31;
public int DummyInt32;
public int DummyInt33;
public int DummyInt34;
public int DummyInt35;
public int DummyInt36;
public int DummyInt37;
public int DummyInt38;
public int DummyInt39;
public int DummyInt40;
public int DummyInt41;
public int DummyInt42;
}
#endregion
#region JudgmentSetItem
public class JudgmentSetItem
{
#region Field
private int m_Filter;
private int m_JudgmentDelayTime;
private int m_JudgmentCount;
private int m_FeedSpeed;
private int m_TurnDelayTime;
private int m_Sorter1DelayTime;
private int m_Sorter1RunTime;
private int m_Sorter2DelayTime;
private int m_Sorter2RunTime;
private int m_ForcedZeroDelayTime;
private int m_OriginOffset;
private int m_EntryGateDelayTime;
private int m_EntryGateRunTime;
private int m_DischargeStopperDelayTime;
private int m_DischargeStopperRunTime;
private string m_Sorter3DelayTime;
private string m_Sorter3RunTime;
private double m_DynamicCorrection;
private double m_DynamicCorrection1;
private double m_DynamicCorrection2;
private double m_DynamicCorrection3;
private double m_DynamicCorrection4;
private double m_DynamicCorrection5;
private double m_DynamicCorrection6;
private double m_DynamicCorrection7;
private double m_DynamicCorrection8;
private double m_DynamicCorrection9;
private double m_DynamicCorrection10;
private double m_DynamicCorrection11;
private double m_DynamicCorrection12;
private double m_DynamicCorrection13;
private double m_DynamicCorrection14;
private double m_DynamicCorrection15;
private double m_DynamicCorrection16;
#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 JudgmentCount
{
get { return this.m_JudgmentCount; }
set { this.m_JudgmentCount = value; }
}
public int FeedSpeed
{
get { return this.m_FeedSpeed; }
set { this.m_FeedSpeed = value; }
}
public int TurnDelayTime
{
get { return this.m_TurnDelayTime; }
set { this.m_TurnDelayTime = 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 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 ForcedZeroDelayTime
{
get { return this.m_ForcedZeroDelayTime; }
set { this.m_ForcedZeroDelayTime = value; }
}
public int OriginOffset
{
get { return this.m_OriginOffset; }
set { this.m_OriginOffset = value; }
}
public int EntryGateDelayTime
{
get { return this.m_EntryGateDelayTime; }
set { this.m_EntryGateDelayTime = value; }
}
public int EntryGateRunTime
{
get { return this.m_EntryGateRunTime; }
set { this.m_EntryGateRunTime = value; }
}
public int DischargeStopperDelayTime
{
get { return this.m_DischargeStopperDelayTime; }
set { this.m_DischargeStopperDelayTime = value; }
}
public int DischargeStopperRunTime
{
get { return this.m_DischargeStopperRunTime; }
set { this.m_DischargeStopperRunTime = value; }
}
public string Sorter3DelayTime
{
get { return this.m_Sorter3DelayTime; }
set { this.m_Sorter3DelayTime = value; }
}
public string Sorter3RunTime
{
get { return this.m_Sorter3RunTime; }
set { this.m_Sorter3RunTime = value; }
}
public double DynamicCorrection
{
get { return this.m_DynamicCorrection; }
set { this.m_DynamicCorrection = value; }
}
public double DynamicCorrection1
{
get { return this.m_DynamicCorrection1; }
set { this.m_DynamicCorrection1 = value; }
}
public double DynamicCorrection2
{
get { return this.m_DynamicCorrection2; }
set { this.m_DynamicCorrection2 = value; }
}
public double DynamicCorrection3
{
get { return this.m_DynamicCorrection3; }
set { this.m_DynamicCorrection3 = value; }
}
public double DynamicCorrection4
{
get { return this.m_DynamicCorrection4; }
set { this.m_DynamicCorrection4 = value; }
}
public double DynamicCorrection5
{
get { return this.m_DynamicCorrection5; }
set { this.m_DynamicCorrection5 = value; }
}
public double DynamicCorrection6
{
get { return this.m_DynamicCorrection6; }
set { this.m_DynamicCorrection6 = value; }
}
public double DynamicCorrection7
{
get { return this.m_DynamicCorrection7; }
set { this.m_DynamicCorrection7 = value; }
}
public double DynamicCorrection8
{
get { return this.m_DynamicCorrection8; }
set { this.m_DynamicCorrection8 = value; }
}
public double DynamicCorrection9
{
get { return this.m_DynamicCorrection9; }
set { this.m_DynamicCorrection9 = value; }
}
public double DynamicCorrection10
{
get { return this.m_DynamicCorrection10; }
set { this.m_DynamicCorrection10 = value; }
}
public double DynamicCorrection11
{
get { return this.m_DynamicCorrection11; }
set { this.m_DynamicCorrection11 = value; }
}
public double DynamicCorrection12
{
get { return this.m_DynamicCorrection12; }
set { this.m_DynamicCorrection12 = value; }
}
public double DynamicCorrection13
{
get { return this.m_DynamicCorrection13; }
set { this.m_DynamicCorrection13 = value; }
}
public double DynamicCorrection14
{
get { return this.m_DynamicCorrection14; }
set { this.m_DynamicCorrection14 = value; }
}
public double DynamicCorrection15
{
get { return this.m_DynamicCorrection15; }
set { this.m_DynamicCorrection15 = value; }
}
public double DynamicCorrection16
{
get { return this.m_DynamicCorrection16; }
set { this.m_DynamicCorrection16 = value; }
}
#endregion
#region Method
public void Initialization()
{
this.Filter = 8;
this.JudgmentDelayTime = 1000;
this.JudgmentCount = 10;
this.FeedSpeed = 60;
this.TurnDelayTime = 0;
this.Sorter1DelayTime = 500;
this.Sorter1RunTime = 1000;
this.Sorter2DelayTime = 500;
this.Sorter2RunTime = 1000;
this.ForcedZeroDelayTime = 0;
this.OriginOffset = 0;
this.EntryGateDelayTime = 500;
this.EntryGateRunTime = 1000;
this.DischargeStopperDelayTime = 500;
this.DischargeStopperRunTime = 1000;
this.Sorter3DelayTime = "500";
this.Sorter3RunTime = "1000";
this.DynamicCorrection = 1.000000;
this.DynamicCorrection1 = 1.000000;
this.DynamicCorrection2 = 1.000000;
this.DynamicCorrection3 = 1.000000;
this.DynamicCorrection4 = 1.000000;
this.DynamicCorrection5 = 1.000000;
this.DynamicCorrection6 = 1.000000;
this.DynamicCorrection7 = 1.000000;
this.DynamicCorrection8 = 1.000000;
this.DynamicCorrection9 = 1.000000;
this.DynamicCorrection10 = 1.000000;
this.DynamicCorrection11 = 1.000000;
this.DynamicCorrection12 = 1.000000;
this.DynamicCorrection13 = 1.000000;
this.DynamicCorrection14 = 1.000000;
this.DynamicCorrection15 = 1.000000;
this.DynamicCorrection16 = 1.000000;
}
#endregion
}
#endregion
#region Struct JudgmentSetItem
[StructLayout(LayoutKind.Sequential)]
public struct StructJudgmentSetItem
{
public int Filter;
public int JudgmentDelayTime;
public int JudgmentCount;
public int FeedSpeed;
public int TurnDelayTime;
public int Sorter1RunTime;
public double DynamicCorrection;
public int OriginOffset;
public int ForcedZeroDelayTime;
public int Sorter1DelayTime;
public int Sorter2DelayTime;
public int Sorter2RunTime;
[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 Sorter3DelayTime;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Sorter3RunTime;
}
#endregion
#region StructDynamicCorrectionItem
[StructLayout(LayoutKind.Sequential)]
public struct StructDynamicCorrectionItem
{
public double DynamicCorrection1;
public double DynamicCorrection2;
public double DynamicCorrection3;
public double DynamicCorrection4;
public double DynamicCorrection5;
public double DynamicCorrection6;
public double DynamicCorrection7;
public double DynamicCorrection8;
public double DynamicCorrection9;
public double DynamicCorrection10;
public double DynamicCorrection11;
public double DynamicCorrection12;
public double DummyDouble1;
public double DummyDouble2;
public double DummyDouble3;
public double DummyDouble4;
public double DummyDouble5;
public double DummyDouble6;
public double DynamicCorrection13;
public double DynamicCorrection14;
public double DynamicCorrection15;
public double DynamicCorrection16;
public int DummyInt1;
public int DummyInt2;
public int DummyInt3;
public int DummyInt4;
public int DummyInt5;
public int DummyInt6;
public int EntryGateDelayTime;
public int EntryGateRunTime;
public int DischargeStopperDelayTime;
public int DischargeStopperRunTime;
}
#endregion
#region User
public class CollectionUser
{
#region Field
private Collection<User> m_Level1Users;
private Collection<User> m_Level2Users;
private Collection<User> m_Level3Users;
private User m_DeveloperUser;
#endregion
#region Constructor
public CollectionUser()
{
this.Initialize();
}
#endregion
#region Property
public Collection<User> Level1Users
{
get { return this.m_Level1Users; }
set { this.m_Level1Users = value; }
}
public Collection<User> Level2Users
{
get { return this.m_Level2Users; }
set { this.m_Level2Users = value; }
}
public Collection<User> Level3Users
{
get { return this.m_Level3Users; }
set { this.m_Level3Users = value; }
}
public User DeveloperUser
{
get { return this.m_DeveloperUser; }
private set { this.m_DeveloperUser = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Level1Users = new Collection<User>();
this.Level2Users = new Collection<User>();
this.Level3Users = new Collection<User>();
this.Level1Users.Clear();
this.Level2Users.Clear();
this.Level3Users.Clear();
for (int i = 0; i < 5; i++)
{
this.Level1Users.Add(new User());
this.Level2Users.Add(new User());
this.Level3Users.Add(new User());
}
this.DeveloperUser = new User();
this.DeveloperUser.ID = "Intech";
this.DeveloperUser.Password = "20090810";
this.DeveloperUser.Group = DataStore.UserGroup.Level4Developer;
}
public User FindUser(string id)
{
User user = null;
// 개발자 유저 검색
if (id == this.DeveloperUser.ID)
{
user = new User();
user.ID = this.DeveloperUser.ID;
user.Password = this.DeveloperUser.Password;
user.Group = this.DeveloperUser.Group;
return user;
}
// 일반 유저 검색
for (int i = 0; i < this.Level1Users.Count; i++)
{
if (this.Level1Users[i].Group != DataStore.UserGroup.None)
{
if (this.Level1Users[i].ID.Trim() == id.Trim())
{
user = new User();
user.ID = this.Level1Users[i].ID.Trim();
user.Password = this.Level1Users[i].Password;
user.Group = this.Level1Users[i].Group;
return user;
}
}
if (this.Level2Users[i].Group != DataStore.UserGroup.None)
{
if (this.Level2Users[i].ID.Trim() == id.Trim())
{
user = new User();
user.ID = this.Level2Users[i].ID.Trim();
user.Password = this.Level2Users[i].Password;
user.Group = this.Level2Users[i].Group;
return user;
}
}
if (this.Level3Users[i].Group != DataStore.UserGroup.None)
{
if (this.Level3Users[i].ID.Trim() == id.Trim())
{
user = new User();
user.ID = this.Level3Users[i].ID.Trim();
user.Password = this.Level3Users[i].Password;
user.Group = this.Level3Users[i].Group;
return user;
}
}
}
return user;
}
public User FindDeveloperUser(string id)
{
User user = null;
// 개발자 유저 검색
if (id == this.DeveloperUser.ID)
{
user = new User();
user.ID = this.DeveloperUser.ID;
user.Password = this.DeveloperUser.Password;
user.Group = this.DeveloperUser.Group;
return user;
}
return user;
}
public bool SearchID(string id)
{
bool ret = false;
for (int i = 0; i < this.Level1Users.Count; i++)
{
if (this.Level1Users[i].ID.Trim() == id.Trim())
return ret = true;
}
for (int i = 0; i < this.Level2Users.Count; i++)
{
if (this.Level2Users[i].ID.Trim() == id.Trim())
return ret = true;
}
for (int i = 0; i < this.Level3Users.Count; i++)
{
if (this.Level3Users[i].ID.Trim() == id.Trim())
return ret = true;
}
return ret;
}
#endregion
}
#endregion
#region UserItem
public class User
{
#region Field
private string m_ID;
private string m_Password;
private DataStore.UserGroup m_Group;
#endregion
#region Constructor
public User()
{
this.Initialize();
}
#endregion
#region Property
public string ID
{
get { return this.m_ID; }
set { this.m_ID = value; }
}
public string Password
{
get { return this.m_Password; }
set { this.m_Password = value; }
}
public DataStore.UserGroup Group
{
get { return this.m_Group; }
set { this.m_Group = value; }
}
#endregion
#region Method
private void Initialize()
{
this.ID = "-";
this.Password = "-";
this.Group = DataStore.UserGroup.None;
}
#endregion
}
#endregion
#region StructUserItem
[StructLayout(LayoutKind.Sequential)]
public struct StructUserItem
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string ID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Password;
public DataStore.UserGroup Group;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Dummy1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Dummy2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Dummy3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Dummy4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string Dummy5;
}
#endregion
#region UserGroup
public class UserGroup
{
#region Field
private UserGroupItem m_Level1;
private UserGroupItem m_Level2;
private UserGroupItem m_Level3;
private UserGroupItem m_NotLogin;
#endregion
#region Constructor
public UserGroup()
{
this.Initialize();
}
#endregion
#region Property
public UserGroupItem Level1
{
get { return this.m_Level1; }
set { this.m_Level1 = value; }
}
public UserGroupItem Level2
{
get { return this.m_Level2; }
set { this.m_Level2 = value; }
}
public UserGroupItem Level3
{
get { return this.m_Level3; }
set { this.m_Level3 = value; }
}
public UserGroupItem NotLogin
{
get { return this.m_NotLogin; }
set { this.m_NotLogin = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Level1 = new UserGroupItem();
this.Level2 = new UserGroupItem();
this.Level3 = new UserGroupItem();
this.NotLogin = new UserGroupItem();
}
public bool GetLevel1AccessRight(DataStore.FormStore display)
{
bool ret = false;
return ret;
}
public bool GetLevel2AccessRight(DataStore.FormStore display)
{
bool ret = false;
return ret;
}
public bool GetLevel3AccessRight(DataStore.FormStore display)
{
bool ret = false;
return ret;
}
#endregion
}
#endregion
#region UserGroupItem
public class UserGroupItem
{
#region Field
private bool m_IsMainDisplayProductNo;
private bool m_IsMainDisplayWeightSetting;
private bool m_IsMainDisplayClear;
private bool m_IsMainDisplaySubMenu;
private bool m_IsMenuTimeSetting;
private bool m_IsMenuInformation;
private bool m_IsMenuDataBackup;
private bool m_IsMenuConfiguration;
private bool m_IsMenuCalibration;
private bool m_IsMenuSystemSetting;
private bool m_IsMenuMotorSetting;
private bool m_IsMenuIOTest;
private bool m_IsMenuUpdate;
private bool m_IsMenuFactoryReset;
private bool m_IsMenuUserSetting;
private bool m_IsMenuUserGroupSetting;
private bool m_IsMenuEquipmentSetting;
private bool m_IsMenuDataStatistics;
#endregion
#region Constructor
public UserGroupItem()
{
this.Initialize();
}
#endregion
#region Property
public bool IsMainDisplayProductNo
{
get { return this.m_IsMainDisplayProductNo; }
set { this.m_IsMainDisplayProductNo = value; }
}
public bool IsMainDisplayWeightSetting
{
get { return this.m_IsMainDisplayWeightSetting; }
set { this.m_IsMainDisplayWeightSetting = value; }
}
public bool IsMainDisplayClear
{
get { return this.m_IsMainDisplayClear; }
set { this.m_IsMainDisplayClear = value; }
}
public bool IsMainDisplaySubMenu
{
get { return this.m_IsMainDisplaySubMenu; }
set { this.m_IsMainDisplaySubMenu = value; }
}
public bool IsMenuTimeSetting
{
get { return this.m_IsMenuTimeSetting; }
set { this.m_IsMenuTimeSetting = value; }
}
public bool IsMenuInformation
{
get { return this.m_IsMenuInformation; }
set { this.m_IsMenuInformation = value; }
}
public bool IsMenuDataBackup
{
get { return this.m_IsMenuDataBackup; }
set { this.m_IsMenuDataBackup = value; }
}
public bool IsMenuConfiguration
{
get { return this.m_IsMenuConfiguration; }
set { this.m_IsMenuConfiguration = value; }
}
public bool IsMenuCalibration
{
get { return this.m_IsMenuCalibration; }
set { this.m_IsMenuCalibration = value; }
}
public bool IsMenuSystemSetting
{
get { return this.m_IsMenuSystemSetting; }
set { this.m_IsMenuSystemSetting = value; }
}
public bool IsMenuMotorSetting
{
get { return this.m_IsMenuMotorSetting; }
set { this.m_IsMenuMotorSetting = value; }
}
public bool IsMenuIOTest
{
get { return this.m_IsMenuIOTest; }
set { this.m_IsMenuIOTest = value; }
}
public bool IsMenuUpdate
{
get { return this.m_IsMenuUpdate; }
set { this.m_IsMenuUpdate = value; }
}
public bool IsMenuFactoryReset
{
get { return this.m_IsMenuFactoryReset; }
set { this.m_IsMenuFactoryReset = value; }
}
public bool IsMenuUserSetting
{
get { return this.m_IsMenuUserSetting; }
set { this.m_IsMenuUserSetting = value; }
}
public bool IsMenuUserGroupSetting
{
get { return this.m_IsMenuUserGroupSetting; }
set { this.m_IsMenuUserGroupSetting = value; }
}
public bool IsMenuEquipmentSetting
{
get { return this.m_IsMenuEquipmentSetting; }
set { this.m_IsMenuEquipmentSetting = value; }
}
public bool IsMenuDataStatistics
{
get { return this.m_IsMenuDataStatistics; }
set { this.m_IsMenuDataStatistics = value; }
}
#endregion
#region Method
private void Initialize()
{
this.IsMainDisplayProductNo = false;
this.IsMainDisplayWeightSetting = false;
this.IsMainDisplayClear = false;
this.IsMainDisplaySubMenu = false;
this.IsMenuTimeSetting = false;
this.IsMenuInformation = false;
this.IsMenuDataBackup = false;
this.IsMenuConfiguration = false;
this.IsMenuCalibration = false;
this.IsMenuSystemSetting = false;
this.IsMenuMotorSetting = false;
this.IsMenuIOTest = false;
this.IsMenuUpdate = false;
this.IsMenuFactoryReset = false;
this.IsMenuUserSetting = false;
this.IsMenuUserGroupSetting = false;
this.IsMenuEquipmentSetting = false;
this.IsMenuDataStatistics = false;
}
#endregion
}
#endregion
#region StructUserGroupItem
[StructLayout(LayoutKind.Sequential)]
public struct StructUserGroupItem
{
public bool IsMainDisplayProductNo;
public bool IsMainDisplayWeightSetting;
public bool IsMainDisplayClear;
public bool IsMainDisplaySubMenu;
public bool IsMenuTimeSetting;
public bool IsMenuInformation;
public bool IsMenuDataBackup;
public bool IsMenuConfiguration;
public bool IsMenuCalibration;
public bool IsMenuSystemSetting;
public bool IsMenuMotorSetting;
public bool IsMenuIOTest;
public bool IsMenuUpdate;
public bool IsMenuFactoryReset;
public bool IsMenuUserSetting;
public bool IsMenuUserGroupSetting;
public bool IsMenuEquipmentSetting;
public bool IsMenuDataStatistics;
public bool Dummy1;
public bool Dummy2;
public bool Dummy3;
public bool Dummy4;
public bool Dummy5;
public bool Dummy6;
public bool Dummy7;
public bool Dummy8;
public bool Dummy9;
public bool Dummy10;
public bool Dummy11;
public bool Dummy12;
public bool Dummy13;
public bool Dummy14;
public bool Dummy15;
public bool Dummy16;
public bool Dummy17;
public bool Dummy18;
public bool Dummy19;
public bool Dummy20;
}
#endregion
#region CalibraqtionItem
public class CalibrationItem
{
#region Field
private string m_BalanceWeight;
private string m_MaxWeight;
private string m_Digit;
private string m_Constant1;
private string m_Constant2;
private string m_Constant3;
private string m_Constant4;
private string m_Constant5;
private string m_Constant6;
private string m_Constant7;
private string m_Constant8;
private string m_Constant9;
private string m_Constant10;
private string m_Constant11;
private string m_Constant12;
private string m_Constant13;
private string m_Constant14;
private string m_Constant15;
private string m_Constant16;
#endregion
#region Constructor
public CalibrationItem()
{
this.BalanceWeight = "5000";
this.MaxWeight = "9999";
this.Digit = "1";
this.Constant1 = "1.000000";
this.Constant2 = "1.000000";
this.Constant3 = "1.000000";
this.Constant4 = "1.000000";
this.Constant5 = "1.000000";
this.Constant6 = "1.000000";
this.Constant7 = "1.000000";
this.Constant8 = "1.000000";
this.Constant9 = "1.000000";
this.Constant10 = "1.000000";
this.Constant11 = "1.000000";
this.Constant12 = "1.000000";
}
#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 Digit
{
get { return this.m_Digit; }
set { this.m_Digit = value; }
}
public string Constant1
{
get { return this.m_Constant1; }
set { this.m_Constant1 = value; }
}
public string Constant2
{
get { return this.m_Constant2; }
set { this.m_Constant2 = value; }
}
public string Constant3
{
get { return this.m_Constant3; }
set { this.m_Constant3 = value; }
}
public string Constant4
{
get { return this.m_Constant4; }
set { this.m_Constant4 = value; }
}
public string Constant5
{
get { return this.m_Constant5; }
set { this.m_Constant5 = value; }
}
public string Constant6
{
get { return this.m_Constant6; }
set { this.m_Constant6 = value; }
}
public string Constant7
{
get { return this.m_Constant7; }
set { this.m_Constant7 = value; }
}
public string Constant8
{
get { return this.m_Constant8; }
set { this.m_Constant8 = value; }
}
public string Constant9
{
get { return this.m_Constant9; }
set { this.m_Constant9 = value; }
}
public string Constant10
{
get { return this.m_Constant10; }
set { this.m_Constant10 = value; }
}
public string Constant11
{
get { return this.m_Constant11; }
set { this.m_Constant11 = value; }
}
public string Constant12
{
get { return this.m_Constant12; }
set { this.m_Constant12 = value; }
}
public string Constant13
{
get { return this.m_Constant13; }
set { this.m_Constant13 = value; }
}
public string Constant14
{
get { return this.m_Constant14; }
set { this.m_Constant14 = value; }
}
public string Constant15
{
get { return this.m_Constant15; }
set { this.m_Constant15 = value; }
}
public string Constant16
{
get { return this.m_Constant16; }
set { this.m_Constant16 = value; }
}
#endregion
}
#endregion
#region ZeroParameterItem
public class ZeroParameterItem
{
#region Field
private string m_Range;
private string m_Time;
private string m_Variate;
private string m_Mode;
#endregion
#region Constructor
public ZeroParameterItem()
{
this.Range = "20";
this.Time = "100";
this.Variate = "2";
this.Mode = "0";
}
#endregion
#region Property
public string Range
{
get { return this.m_Range; }
set { this.m_Range = value; }
}
public string Time
{
get { return this.m_Time; }
set { this.m_Time = value; }
}
public string Variate
{
get { return this.m_Variate; }
set { this.m_Variate = value; }
}
public string Mode
{
get { return this.m_Mode; }
set { this.m_Mode = value; }
}
#endregion
}
#endregion
#region OptionParameterItem
public class OptionParameterItem
{
#region Field
private string m_BuzzerOnTime;
private string m_RelayOnTime;
private string m_Chattering;
private string m_PassAlarm;
private string m_PassAlarmCount;
#endregion
#region Constructor
public OptionParameterItem()
{
this.BuzzerOnTime = "1000";
this.RelayOnTime = "500";
this.Chattering = "100";
this.PassAlarm = "0";
this.PassAlarmCount = "0";
}
#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 Chattering
{
get { return this.m_Chattering; }
set { this.m_Chattering = value; }
}
public string PassAlarm
{
get { return this.m_PassAlarm; }
set { this.m_PassAlarm = value; }
}
public string PassAlarmCount
{
get { return this.m_PassAlarmCount; }
set { this.m_PassAlarmCount = value; }
}
#endregion
}
#endregion
#region CommunicationStatus
public class CommunicationStatusItem
{
#region Field
private bool m_IsReceivedData;
private bool m_IsErrorReceivedData;
private bool m_IsErrorSettingStatus;
private bool m_IsErrorID;
#endregion
#region Constructor
public CommunicationStatusItem()
{
this.IsReceivedData = false;
this.IsErrorReceivedData = false;
this.IsErrorSettingStatus = false;
this.IsErrorID = false;
}
#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 IsErrorID
{
get { return this.m_IsErrorID; }
set { this.m_IsErrorID = value; }
}
#endregion
}
#endregion
#region AlarmList
public class AlarmList
{
#region Field
private bool m_IsEntrySensorError;
private bool m_IsLoadcellError;
private bool m_IsPressureError;
private bool m_IsEmergencyStop;
private bool m_IsServoAlarm;
private bool m_IsServoAlarmTorque;
private bool m_IsServoOff;
private bool m_IsInverterAlarm;
private bool m_IsAlignError;
private bool m_IsPinchPoint;
private bool m_IsBuzzerStatus;
#endregion
#region Constructor
public AlarmList()
{
this.Initialize();
}
#endregion
#region Property
public bool IsEntrySensorError
{
get { return this.m_IsEntrySensorError; }
set { this.m_IsEntrySensorError = value; }
}
public bool IsLoadcellError
{
get { return this.m_IsLoadcellError; }
set { this.m_IsLoadcellError = value; }
}
public bool IsPressureError
{
get { return this.m_IsPressureError; }
set { this.m_IsPressureError = value; }
}
public bool IsEmergencyStop
{
get { return this.m_IsEmergencyStop; }
set { this.m_IsEmergencyStop = value; }
}
public bool IsServoAlarm
{
get { return this.m_IsServoAlarm; }
set { this.m_IsServoAlarm = value; }
}
public bool IsServoAlarmTorque
{
get { return this.m_IsServoAlarmTorque; }
set { this.m_IsServoAlarmTorque = value; }
}
public bool IsServoOff
{
get { return this.m_IsServoOff; }
set { this.m_IsServoOff = value; }
}
public bool IsInverterAlarm
{
get { return this.m_IsInverterAlarm; }
set { this.m_IsInverterAlarm = value; }
}
public bool IsAlignError
{
get { return this.m_IsAlignError; }
set { this.m_IsAlignError = value; }
}
public bool IsPinchPoint
{
get { return this.m_IsPinchPoint; }
set { this.m_IsPinchPoint = value; }
}
public bool IsBuzzerStatus
{
get { return this.m_IsBuzzerStatus; }
set { this.m_IsBuzzerStatus = value; }
}
#endregion
#region Method
private void Initialize()
{
this.IsEntrySensorError = false;
this.IsLoadcellError = false;
this.IsPressureError = false;
this.IsEmergencyStop = false;
this.IsServoAlarm = false;
this.IsServoAlarmTorque = false;
this.IsServoOff = false;
this.IsInverterAlarm = false;
this.IsAlignError = false;
this.IsPinchPoint = false;
this.IsBuzzerStatus = false;
}
public void SetAlarm(string alarm)
{
string sValue1 = "", sValue2 = "", sValue3 = "", sValue4 = "", sValue5 = "", sValue6 = "", sValue7 = "", sValue8 = "";
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');
#region 알람 16-제품 끼임 에러
if (sValue4[0] == '0')
{
this.IsPinchPoint = false;
this.IsBuzzerStatus = false;
}
else
this.IsPinchPoint = true;
#endregion
#region 알람 15-봉 정렬 에러(정렬기)
if (sValue4[1] == '0')
this.IsAlignError = false;
else
this.IsAlignError = true;
#endregion
#region 알람 14-
if (sValue4[2] == '0')
{ }
else
{ }
#endregion
#region 알람 13-
if (sValue4[3] == '0')
{ }
else
{ }
#endregion
#region 알람 12-서보알람토크
if (sValue3[0] == '0')
this.IsServoAlarmTorque = false;
else
this.IsServoAlarmTorque = true;
#endregion
#region 알람 11-
if (sValue3[1] == '0')
{ }
else
{ }
#endregion
#region 알람 10-서보알람
if (sValue3[2] == '0')
this.IsServoAlarm = false;
else
this.IsServoAlarm = true;
#endregion
#region 알람 9-인버터알람
if (sValue3[3] == '0')
this.IsInverterAlarm = false;
else
this.IsInverterAlarm = true;
#endregion
#region 알람 8-비상정지
if (sValue2[0] == '0')
this.IsEmergencyStop = false;
else
this.IsEmergencyStop = true;
#endregion
#region 알람 7-
if (sValue2[1] == '0')
{ }
else
{ }
#endregion
#region 알람 6-
if (sValue2[2] == '0')
{ }
else
{ }
#endregion
#region 알람 5-
if (sValue2[3] == '0')
{ }
else
{ }
#endregion
#region 알람 4-
if (sValue1[0] == '0')
{ }
else
{ }
#endregion
#region 알람 3-공압에러
if (sValue1[1] == '0')
this.IsPressureError = false;
else
this.IsPressureError = true;
#endregion
#region 알람 2-셀 에러
if (sValue1[2] == '0')
this.IsLoadcellError = false;
else
this.IsLoadcellError = true;
#endregion
#region 알람 1-입력센서 에러
if (sValue1[3] == '0')
this.IsEntrySensorError = false;
else
this.IsEntrySensorError = true;
#endregion
}
#endregion
}
#endregion
#region StorageItem
public class StorageItem
{
#region Field
private double m_Weight;
private bool m_IsSamplingData;
private bool m_IsEmptyData;
private DataStore.JudgmentStatus m_JudgmentStatus;
#endregion
#region Constructor
public StorageItem(double weight, bool sampling, bool empty, DataStore.JudgmentStatus stats)
{
this.Weight = weight;
this.IsSamplingData = sampling;
this.IsEmptyData = empty;
this.JudgmentStatus = stats;
}
#endregion
#region Property
public double Weight
{
get { return this.m_Weight; }
set { this.m_Weight = value; }
}
public bool IsSamplingData
{
get { return this.m_IsSamplingData; }
set { this.m_IsSamplingData = value; }
}
public bool IsEmptyData
{
get { return this.m_IsEmptyData; }
set { this.m_IsEmptyData = value; }
}
public DataStore.JudgmentStatus JudgmentStatus
{
get { return this.m_JudgmentStatus; }
set { this.m_JudgmentStatus = value; }
}
#endregion
#region Method
#endregion
}
#endregion
#region WeightStorageItem
public class WeightStorageItem
{
#region Field
private int m_TotalCount;
private double m_TotalSum;
private Queue<StorageItem> Q_Weights;
private Collection<StorageItem> m_C_StorageItem;
#endregion
#region Constructor
public WeightStorageItem()
{
this.TotalCount = 0;
this.TotalSum = 0.0;
this.Q_Weights = new Queue<StorageItem>();
this.C_StorageItem = new Collection<StorageItem>();
for (int i = 0; i < 10; i++)
this.C_StorageItem.Add(new StorageItem(0.0, false, false, DataStore.JudgmentStatus.None));
}
#endregion
#region Property
public int TotalCount
{
get { return this.m_TotalCount; }
private set { this.m_TotalCount = value; }
}
public double TotalSum
{
get { return this.m_TotalSum; }
private set { this.m_TotalSum = value; }
}
public Collection<StorageItem> C_StorageItem
{
get { return this.m_C_StorageItem; }
private set { this.m_C_StorageItem = value; }
}
#endregion
#region Method
public double WeightTenSum()
{
double sumValue = 0.0;
foreach (StorageItem item in this.Q_Weights)
{
if (item.IsEmptyData == false)
sumValue = sumValue + item.Weight;
}
return sumValue;
}
public double WeightTenAverage()
{
int cnt = 0;
double sumValue = 0.0;
if (this.Q_Weights.Count < 10)
return 0.0;
foreach (StorageItem item in this.Q_Weights)
{
if (item.IsEmptyData == false)
{
sumValue = sumValue + item.Weight;
cnt++;
}
}
if (cnt == 0)
return 0.0;
else
return sumValue / cnt;
}
public void SetQueueData()
{
int cnt = 0;
StorageItem[] items = new StorageItem[this.Q_Weights.Count];
cnt = this.Q_Weights.Count;
this.Q_Weights.CopyTo(items, 0);
for (int i = 0; i < items.Length; i++)
{
this.C_StorageItem[i].Weight = items[(items.Length - i) - 1].Weight;
this.C_StorageItem[i].IsSamplingData = items[(items.Length - i) - 1].IsSamplingData;
this.C_StorageItem[i].IsEmptyData = items[(items.Length - i) - 1].IsEmptyData;
this.C_StorageItem[i].JudgmentStatus = items[(items.Length - i) - 1].JudgmentStatus;
}
for (int i = items.Length; i < 10 - items.Length; i++)
{
this.C_StorageItem[i].Weight = 0.0;
this.C_StorageItem[i].IsSamplingData = false;
this.C_StorageItem[i].IsEmptyData = false;
this.C_StorageItem[i].JudgmentStatus = DataStore.JudgmentStatus.None;
}
}
public double WeightTotalAverage()
{
if (this.TotalCount == 0)
return 0.0;
return this.TotalSum / this.TotalCount;
}
public void SetValue(double value, bool sampling, bool empty, DataStore.JudgmentStatus status)
{
this.Q_Weights.Enqueue(new StorageItem(value, sampling, empty, status));
if (this.Q_Weights.Count > 10)
this.Q_Weights.Dequeue();
if (empty == false)
{
this.TotalCount++;
this.TotalSum = this.TotalSum + value;
}
}
public void SetValue(WeightData data)
{
bool empty = false;
if (data.JudgmentStatus == DataStore.JudgmentStatus.Empty)
empty = true;
this.Q_Weights.Enqueue(new StorageItem(data.Weight, data.IsSamplingData, empty, data.JudgmentStatus));
if (this.Q_Weights.Count > 10)
this.Q_Weights.Dequeue();
if (empty == false)
{
this.TotalCount++;
this.TotalSum = this.TotalSum + data.Weight;
}
}
public void AllClear()
{
this.TotalSum = 0.0;
this.TotalCount = 0;
this.Q_Weights.Clear();
for (int i = 0; i < 10; i++)
{
this.C_StorageItem[i].Weight = 0.0;
this.C_StorageItem[i].IsSamplingData = false;
this.C_StorageItem[i].IsEmptyData = false;
this.C_StorageItem[i].JudgmentStatus = DataStore.JudgmentStatus.None;
}
}
#endregion
}
#endregion
#region DataCollector
public class DataCollector
{
#region Field
private Collection<double> m_PassWeightData;
private Collection<double> m_OverWeightData;
private Collection<double> m_UnderWeightData;
private Collection<double> m_ExNgWeightData;
private double m_PassAverage;
private double m_PassVariance;
#endregion
#region Constructor
public DataCollector()
{
this.Initialize();
}
#endregion
#region Porperty
public Collection<double> PassWeightData
{
get { return this.m_PassWeightData; }
private set { this.m_PassWeightData = value; }
}
public Collection<double> OverWeightData
{
get { return this.m_OverWeightData; }
private set { this.m_OverWeightData = value; }
}
public Collection<double> UnderWeightData
{
get { return this.m_UnderWeightData; }
private set { this.m_UnderWeightData = value; }
}
public Collection<double> ExNgWeightData
{
get { return this.m_ExNgWeightData; }
private set { this.m_ExNgWeightData = value; }
}
public int TotalCount
{
get { return this.PassTotalCount + this.OverTotalCount + this.UnderTotalCount + this.ExNgTotalCount; }
}
public int TotalNGCount
{
get { return this.OverTotalCount + this.UnderTotalCount + this.ExNgTotalCount; }
}
public int PassTotalCount
{
get { return this.PassWeightData.Count; }
}
public double PassAverage
{
get { return this.m_PassAverage; }
private set { this.m_PassAverage = value; }
}
public double PassPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.PassTotalCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
//sValue = string.Format("{0:0.000}", ((double)this.PassTotalCount / (double)this.TotalCount) * 100.000);
//ret = double.Parse(sValue);
ret = 100 - (this.OverPercentage + this.UnderPercentage + this.ExNgPercentage);
}
return ret;
}
}
public double PassVariance
{
get { return this.m_PassVariance; }
private set { this.m_PassVariance = value; }
}
public double PassStandardDeviation
{
get
{
return Math.Sqrt(this.PassVariance);
}
}
public double PassSumWeight
{
get
{
double ret = 0.0;
for (int i = 0; i < this.PassWeightData.Count; i++)
ret += this.PassWeightData[i];
return ret;
}
}
public double PassMinWeight
{
get
{
bool isFirstData = false;
double ret = 0.0;
if (this.PassTotalCount == 0)
ret = 0.0;
else
{
for (int i = 0; i < this.PassTotalCount; i++)
{
if (isFirstData == false)
{
isFirstData = true;
ret = this.PassWeightData[i];
}
else
{
if (ret > this.PassWeightData[i])
ret = this.PassWeightData[i];
}
}
}
return ret;
}
}
public double PassMaxWeight
{
get
{
double ret = 0.0;
if (this.PassTotalCount == 0)
ret = 0.0;
else
{
for (int i = 0; i < this.PassTotalCount; i++)
{
if (ret < this.PassWeightData[i])
ret = this.PassWeightData[i];
}
}
return ret;
}
}
public int OverTotalCount
{
get { return this.OverWeightData.Count; }
}
public double OverSumWeight
{
get
{
double ret = 0.0;
for (int i = 0; i < this.OverWeightData.Count; i++)
ret += this.OverWeightData[i];
return ret;
}
}
public double OverAverage
{
get
{
double ret = 0.0;
if (this.OverWeightData.Count == 0)
ret = 0.0;
else
ret = this.OverSumWeight / this.OverWeightData.Count;
return ret;
}
}
public double OverPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.OverTotalCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.OverTotalCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
public int UnderTotalCount
{
get { return this.UnderWeightData.Count; }
}
public double UnderSumWeight
{
get
{
double ret = 0.0;
for (int i = 0; i < this.UnderWeightData.Count; i++)
ret += this.UnderWeightData[i];
return ret;
}
}
public double UnderAverage
{
get
{
double ret = 0.0;
if (this.UnderWeightData.Count == 0)
ret = 0.0;
else
ret = this.UnderSumWeight / this.UnderWeightData.Count;
return ret;
}
}
public double UnderPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.UnderTotalCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.UnderTotalCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
public int ExNgTotalCount
{
get { return this.ExNgWeightData.Count; }
}
public double ExNgPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.ExNgTotalCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.ExNgTotalCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
#endregion
#region Method
private void Initialize()
{
this.PassWeightData = new Collection<double>();
this.OverWeightData = new Collection<double>();
this.UnderWeightData = new Collection<double>();
this.ExNgWeightData = new Collection<double>();
this.ClearDatas();
}
public void ClearDatas()
{
this.PassWeightData.Clear();
this.OverWeightData.Clear();
this.UnderWeightData.Clear();
this.ExNgWeightData.Clear();
this.PassAverage = 0;
this.PassVariance = 0;
}
public void AddPassWeight(double data)
{
this.PassWeightData.Add(data);
}
public void AddOverWeight(double data)
{
this.OverWeightData.Add(data);
}
public void AddUnderWeight(double data)
{
if (data < 0)
this.UnderWeightData.Add(0);
else
this.UnderWeightData.Add(data);
}
public void AddExNgWeight(double data)
{
if (data < 0)
this.ExNgWeightData.Add(0);
else
this.ExNgWeightData.Add(data);
}
public void StatisticalAnalysis()
{
double value1 = 0.0, value2 = 0.0;
if (this.PassWeightData.Count == 0)
return;
#region Pass Average
for (int i = 0; i < this.PassWeightData.Count; i++)
{
value1 += this.PassWeightData[i];
}
value1 = value1 / this.PassWeightData.Count;
this.PassAverage = value1;
#endregion
#region PassVariance
for (int i = 0; i < this.PassTotalCount; i++)
{
value1 = this.PassAverage - this.PassWeightData[i];
value2 += value1 * value1;
}
this.PassVariance = value2 / this.PassTotalCount;
#endregion
}
#endregion
}
#endregion
#region DataCommonList
public class DataCommonList
{
#region Field
private string m_ProductName;
private string m_Lot;
private string m_StartTime;
private string m_EndTime;
private string m_OverRange;
private string m_PassRange;
private string m_UnderRange;
private string m_TareRange;
private int m_TotalPassCount;
private double m_TotalPassSumWeight;
private double m_TotalPassAverageWeight;
private double m_TotalPassVariance;
private int m_TotalOverCount;
private double m_TotalOverSumWeight;
private int m_TotalUnderCount;
private double m_TotalUnderSumWeight;
private int m_TotalExNgCount;
#endregion
#region Constructor
public DataCommonList()
{
this.Initialize();
}
#endregion
#region Property
public string ProductName
{
get { return this.m_ProductName; }
set { this.m_ProductName = value; }
}
public string Lot
{
get { return this.m_Lot; }
set { this.m_Lot = value; }
}
public string StartTime
{
get { return this.m_StartTime; }
set { this.m_StartTime = value; }
}
public string EndTime
{
get { return this.m_EndTime; }
set { this.m_EndTime = value; }
}
public string OverRange
{
get { return this.m_OverRange; }
set { this.m_OverRange = value; }
}
public string PassRange
{
get { return this.m_PassRange; }
set { this.m_PassRange = value; }
}
public string UnderRange
{
get { return this.m_UnderRange; }
set { this.m_UnderRange = value; }
}
public string TareRange
{
get { return this.m_TareRange; }
set { this.m_TareRange = value; }
}
public int TotalPassCount
{
get { return this.m_TotalPassCount; }
set { this.m_TotalPassCount = value; }
}
public double TotalPassSumWeight
{
get { return this.m_TotalPassSumWeight; }
set { this.m_TotalPassSumWeight = value; }
}
public double TotalPassAverageWeight
{
get { return this.m_TotalPassAverageWeight; }
set { this.m_TotalPassAverageWeight = value; }
}
public double TotalPassVariance
{
get { return this.m_TotalPassVariance; }
set { this.m_TotalPassVariance = value; }
}
public double TotalPassStandardDeviation
{
get
{
return Math.Sqrt(this.TotalPassVariance);
}
}
public double TotalPassPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.TotalPassCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
//sValue = string.Format("{0:0.00}", ((double)this.TotalPassCount / (double)this.TotalCount) * 100.0);
//ret = double.Parse(sValue);
ret = 100 - (this.TotalUnderPercentage + this.TotalOverPercentage + this.TotalExNgPercentage);
}
return ret;
}
}
public int TotalOverCount
{
get { return this.m_TotalOverCount; }
set { this.m_TotalOverCount = value; }
}
public double TotalOverSumWeight
{
get { return this.m_TotalOverSumWeight; }
set { this.m_TotalOverSumWeight = value; }
}
public double TotalOverPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.TotalOverCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.TotalOverCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
public int TotalUnderCount
{
get { return this.m_TotalUnderCount; }
set { this.m_TotalUnderCount = value; }
}
public double TotalUnderSumWeight
{
get { return this.m_TotalUnderSumWeight; }
set { this.m_TotalUnderSumWeight = value; }
}
public double TotalUnderPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.TotalUnderCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.TotalUnderCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
public int TotalExNgCount
{
get { return this.m_TotalExNgCount; }
set { this.m_TotalExNgCount = value; }
}
public double TotalExNgPercentage
{
get
{
double ret = 0.0;
string sValue = "";
if (this.TotalExNgCount == 0 || this.TotalCount == 0)
ret = 0.0;
else
{
sValue = string.Format("{0:0.00}", ((double)this.TotalExNgCount / (double)this.TotalCount) * 100.00);
ret = double.Parse(sValue);
}
return ret;
}
}
public int TotalCount
{
get
{
return this.TotalPassCount + this.TotalOverCount + this.TotalUnderCount + this.TotalExNgCount;
}
}
public int TotalNGCount
{
get
{
return this.TotalOverCount + this.TotalUnderCount + this.TotalExNgCount;
}
}
#endregion
#region Method
private void Initialize()
{
this.ProductName = "-";
this.Lot = "-";
this.StartTime = "-";
this.EndTime = "-";
this.OverRange = "-";
this.PassRange = "-";
this.UnderRange = "-";
this.TareRange = "-";
this.TotalPassCount = 0;
this.TotalOverCount = 0;
this.TotalUnderCount = 0;
this.TotalExNgCount = 0;
this.TotalPassSumWeight = 0.0;
this.TotalOverSumWeight = 0.0;
this.TotalUnderSumWeight = 0.0;
}
public void Clear()
{
this.Initialize();
}
#endregion
}
#endregion
}