INT99DC_7C/INT99DC_7C/DataStore.cs

3828 lines
109 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Runtime.InteropServices;
using INT99DC_7C.Part11_UserManager;
namespace INT99DC_7C
{
public class DataStore
{
public delegate void EventHandlerAlarmStateChange(DataStore.Trackingalarm alarm, string status);
#region Enum
public enum EquipmentStatus
{
Stop = 0,
Start = 1,
};
public enum FormStore
{
FormNone = 0,
FormMainDisplay,
FormMenu,
FormDataViewer,
FormEquipmentSetting,
FormSystemSetting,
FormConfiguration,
FormMotorSetting,
FormCalibration,
FormEquipmentTest,
FormIOTest,
FormTimeSetting,
FormInformation,
FormFactory,
FormProgramUpdate,
FormDataStatistics,
FormOptionSetting,
FormCommunication,
FormUserGroupEditor,
FormUserEditor,
FormDataBackup,
};
public enum FormMainDisplayStore
{
FormMainDisplayBarGraph,
FormMainDisplayDotGraph,
FormMainDisplayTable,
};
public enum LanguageID
{
Korean = 0,
English,
Chinese,
Czech,
German,
Japanese,
};
public enum UserGroup
{
None = 0,
Level1 = 1,
Level2 = 2,
Level3 = 3,
Admin = 4,
Developer = 5,
NotLogin = 6,
LogOut = 7,
};
public enum JudgmentStatus
{
None,
Empty,
Under,
Pass,
Over,
Double,
SensorError,
ExNG,
};
public enum WeightStatus
{
Empty,
WeightChange,
WeightZero,
CalNomal,
CalBalans,
CalStandby,
CalFinish,
CalError,
};
public enum ResponseData
{
NAK = 0,
ACK = 1,
};
public enum ABFoodDataStatus
{
Normal = 0,
ReceivedDataError = 1,
SettingError = 2,
ProductNumberError = 3,
IDError = 4,
};
public enum ABFoodDataCommand
{
Normal,
ModifySetting,
ProductNumberChange,
}
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,
}
public enum Level3
{
Level1,
Level2,
Level3,
}
public enum TrackingOperation
{
None,
PowerOn,
BootingComplete,
EquipmentStart,
EquipmentStop,
Login,
Logout,
Calibration,
Zero,
Clear,
UserEditor,
GroupEditor,
Bypass,
Update,
DataBackup,
ATPC_Reset, // 정량 알람 카운터 리셋
Initialization,
BP_PassOnce,
BP_NgOnce,
BP_PassON,
BP_PassOFF,
BP_NgON,
BP_NgOFF,
ProductCopy,
ProductPaste,
ProductAllPaste,
MotorOrigin,
MotorAlarmReset,
MotorStep,
MotorPosition0,
MotorPosition1,
MotorPosition2,
TryEthernetStart,
TryEthernetStop,
EthernetConnect,
EthernetDisconnect,
}
public enum TrackingParameter
{
ProductNumber,
WeightOverRange,
WeightPassRange,
WeightUnderRange,
WeightTareRange,
ChangeTime,
ChangeName,
ChangeLOT,
BP_Individual,
BP_All,
BP_Direction,
BP_Mode,
ACNC_Count,
ACNC_Activate,
ATPC_Count,
ATPC_Activate,
JudgmentFilter,
JudgmentDelayTime,
JudgmentDamperDelayTime,
JudgmentCount,
SorterDelayTime,
SorterRunTime,
RejectCVDelayTime,
RejectCVRunTime,
FeedingCVDelayTime,
FeedingCVRunTime,
AutoZeroTime,
AutoZeroRange,
AutoZeroVariance,
Com3Baudrate,
Com3Mode,
TCPOpMode,
TCPComMode,
TCPLocalPort,
TCPLocalIPConfig,
TCPLocalIPAddress,
TCPLocalSubnetMask,
TCPLocalGateway,
TCPServerIPAddress,
TCPServerPort,
Mod_StartAddr,
CalMaxWeight,
CalBalWeight,
CalDigit,
EtcDoubleEntry,
EtcChattering,
EtcBuzzerRunTime,
EtcRelayRunTime,
EtcDecimalpoint,
MotorOriginOffset,
MotorOriginSpeed,
MotorSpeed,
MotorPosition0,
MotorPosition1,
MotorPosition2,
MotorSorvoLimit,
Level1Name,
Level2Name,
Level3Name,
AutoLogout,
}
public enum Trackingalarm
{
None,
a1_PressureError,
a2_LoadcellError,
a3_EntrySensorError,
a4_ServoTorqueAlarm,
a5_ServoAlarm,
a6_ServoOff,
}
public enum TrackingType
{
Operation,
Parameter,
Alarm,
}
public enum E_User_Group
{
Is_Main_ProductNo,
Is_Main_WeightSetting,
Is_Main_Clear,
Is_Main_SubMenu,
Is_Menu_TimeSetting,
Is_Menu_Information,
Is_Menu_DataBackup,
Is_Menu_Configuration,
Is_Menu_Calibration,
Is_Menu_SystemSetting,
Is_Menu_MotorSetting,
Is_Menu_IOTest,
Is_Menu_Update,
Is_Menu_FactoryReset,
Is_Menu_UserEditor,
Is_Menu_EquipmentSetting,
Is_Menu_DataStatistics,
}
public enum E_UserItemCheck
{
None = 0,
OK = 1,
ERROR_LENGTH,
ERROR_FORMAT,
ERROR_CONTINUOUS,
ERROR_SAME,
ERROR_PREVIOUS,
ERROR_SAME_ID,
}
public enum E_FileHeaderItem
{
LoginId,
SerialNumber,
EquipmentColumns,
TimeStamp,
EquipmentType,
}
public enum MessageBoxIcon
{
None,
Hand,
Question,
Exclamation,
Asterisk,
}
public enum E_DataType
{
None,
History,
Inspection,
Others,
}
public enum E_UserGroup_FileIndex
{
f0_Level1 = 0,
f1_Level2 = 1,
f2_Level3 = 2,
f3_NotLogin = 3,
}
public enum E_ModbusDisplay
{
Common,
Display1,
Display2,
Display3,
}
#endregion
}
public class OptionPassword
{
// 기본
public static readonly string Default = "0810";
// 1. 데이터
// 데이터집계
public static readonly string DataStatistics = "1000";
// Part11
public static readonly string Part11 = "1001";
// 2. 통신
// 피드백보드
public static readonly string FeedbackBoard = "2000";
// Modbus
public static readonly string Modbus = "2001";
}
#region CommunicationCommand
public class CommunicationCommand
{
// 중량조정모드
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 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";
// 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";
// 알람 - 불량알람(펄스)
public static readonly string AlarmPulseNG = "Cac00";
// 판정 - 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 SubBoardAll = "Z";
}
public class CommunicationAddress
{
// Address None
public static readonly string None = "0000";
// 임펠러 모터 - 회전각도
public static readonly string ImpellerMotorAngle = "1101";
// 임펠러 모터 - 통신속도
public static readonly string ImpellerMotorBaudrate = "1102";
// 임펠러 모터 - 회전방향
public static readonly string ImpellerMotorDirection = "1103";
// 임펠러 모터 - 개별 회전방향
public static readonly string ImpellerMotorIndividualDirection = "1104";
// 바이패스
public static readonly string Bypass = "1201";
// 보드 버전 모두 읽기
public static readonly string ProgramVersion = "1500";
// 품목설정 - 품번
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 ParameterRead3901 = "3901";
// 자동영점 - 시간
public static readonly string ZeroTime = "4001";
// 자동영점 - 범위
public static readonly string ZeroRange = "4002";
// 자동영점 - 변량
public static readonly string ZeroVariate = "4003";
// 자동영점 - 모드
public static readonly string ZeroMode = "4004";
// 자동영점 - 파라미터 읽기
public static readonly string ParameterRead4901 = "4901";
// 판정설정 - 필터
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 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 ImpellerDelayTime = "5013";
// 판정설정 - 댐퍼지연시간
public static readonly string DamperDelayTime = "5014";
// 판정설정 - 선별기 모드 값
public static readonly string Sorter1Mode = "5101";
// 판정설정 - 선별기 지연시간
public static readonly string Sorter1DelayTime = "5102";
// 판정설정 - 선별기 동작시간
public static readonly string Sorter1RunTime = "5103";
// 옵션 - 부저 ON시간
public static readonly string BuzzerOnTime = "6001";
// 옵션 - 릴레이 동작시간
public static readonly string RelayOperatingTime = "6002";
// 옵션 - 이중진입사용여부
public static readonly string DoubleEnter = "6005";
// 옵션 - 채터링감지 설정
public static readonly string Chattering = "6006";
// 옵션 - 파라미터 읽기
public static readonly string ParameterRead6901 = "6901";
// 통신,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";
// 품목 설정 모두 쓰기
public static readonly string ParameterProduct = "9015";
// 시스템 설정 모두 쓰기
public static readonly string ParameterSystem = "9008";
// 중량 설정값 쓰기
public static readonly string ParameterWeightRange = "9003";
}
#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;
// 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 17 - 0x4846
public static readonly int CMD17 = 18502;
}
#endregion
#region ABFoodCommunicationCommand
public class ABFoodCommunicationCommand
{
// 설정값 변경
public static readonly string ModifySetting = "M0";
// 품번 변경
public static readonly string ProductNumberChange = "P0";
// 현재 상태
public static readonly string CurrentStatus = "R0";
// 중량 데이터
public static readonly string WeightData = "W0";
}
#endregion
#region SystemConfiguration
public class SystemConfigurationItem
{
#region Field
private bool m_IsDataBackup;
private bool m_IsFeedingConveyor;
private bool m_IsEachNG;
private bool m_IsDischargeConveyor;
private bool m_IsDischargeConveyorDirectionCW;
private bool m_IsWeightViewForward;
private bool m_IsBypassMode;
private bool m_IsFeedingConveyorRunPass;
private bool m_IsSorterMode;
private bool m_IsLogin;
private bool m_IsEmergencyStopEntrySensorError;
private bool m_IsBypassDirectionPass;
private bool m_IsBypassOnce;
private bool m_IsOptDataStatistics;
private bool m_IsCutView;
private bool m_IsPart11;
private int m_DecimalPlaces;
private int m_EquipmentColumns;
private int m_EquipmentID;
private int m_EquipmentMode;
private int m_ProductNumber;
private int m_Serial3BaudRate;
private int m_Serial3Mode;
private int m_ABFoodTimeoutInterval;
private int m_InputSensorSelect;
private int m_ServoLimit;
private int m_AutomaticLogout;
private int m_DataStoragePeriod;
private string m_Unit;
private string m_SerialNumber;
private string m_User_Level1_Name;
private string m_User_Level2_Name;
private string m_User_Level3_Name;
private DataStore.LanguageID m_Language;
private DataStore.FormStore m_CurrentForm;
private UserItem m_CurrentUser;
private bool m_IsAlarmContinuousNGEnable;
private bool m_IsAlarmTotalPassCntEnable;
private int m_AlarmContinuousNG;
private int m_AlarmTotalPassCnt;
// TCP
private int m_EthernetServerPort;
private int m_EthernetMode;
private int m_EthernetOperationMode;
private int m_EthernetLocalPort;
private int m_ModbusRtuSlaveID;
private int m_ModbusTcpAddress1;
private int m_ModbusTcpAddress2;
private int m_ModbusTcpStartAddress;
private string m_EthernetServerAddress;
#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 IsFeedingConveyor
{
get { return this.m_IsFeedingConveyor; }
set { this.m_IsFeedingConveyor = value; }
}
public bool IsEachNG
{
get { return this.m_IsEachNG; }
set { this.m_IsEachNG = value; }
}
public bool IsDischargeConveyor
{
get { return this.m_IsDischargeConveyor; }
set { this.m_IsDischargeConveyor = value; }
}
public bool IsDischargeConveyorDirectionCW
{
get { return this.m_IsDischargeConveyorDirectionCW; }
set { this.m_IsDischargeConveyorDirectionCW = 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 IsFeedingConveyorRunPass
{
get { return this.m_IsFeedingConveyorRunPass; }
set { this.m_IsFeedingConveyorRunPass = value; }
}
public bool IsSorterMode
{
get { return this.m_IsSorterMode; }
set { this.m_IsSorterMode = value; }
}
public bool IsLogin
{
get { return this.m_IsLogin; }
set { this.m_IsLogin = value; }
}
public bool IsEmergencyStopEntrySensorError
{
get { return this.m_IsEmergencyStopEntrySensorError; }
set { this.m_IsEmergencyStopEntrySensorError = 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 IsPart11
{
get { return this.m_IsPart11; }
set { this.m_IsPart11 = value; }
}
public bool IsModbusEnable
{
get
{
if (this.Serial3Mode == 3 || this.EthernetMode == 2)
return true;
else
return false;
}
}
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 EquipmentID
{
get { return this.m_EquipmentID; }
set { this.m_EquipmentID = value; }
}
public int EquipmentMode
{
get { return this.m_EquipmentMode; }
set { this.m_EquipmentMode = 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 ABFoodTimeoutInterval
{
get { return this.m_ABFoodTimeoutInterval; }
set { this.m_ABFoodTimeoutInterval = value; }
}
public int InputSensorSelect
{
get { return this.m_InputSensorSelect; }
set { this.m_InputSensorSelect = value; }
}
public int ServoLimit
{
get { return this.m_ServoLimit; }
set { this.m_ServoLimit = value; }
}
public int AutomaticLogout
{
get { return this.m_AutomaticLogout; }
set { this.m_AutomaticLogout = value; }
}
public int DataStoragePeriod
{
get { return this.m_DataStoragePeriod; }
set { this.m_DataStoragePeriod = 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 User_Level1_Name
{
get { return this.m_User_Level1_Name; }
set { this.m_User_Level1_Name = value; }
}
public string User_Level2_Name
{
get { return this.m_User_Level2_Name; }
set { this.m_User_Level2_Name = value; }
}
public string User_Level3_Name
{
get { return this.m_User_Level3_Name; }
set { this.m_User_Level3_Name = 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 UserItem CurrentUser
{
get { return this.m_CurrentUser; }
set { this.m_CurrentUser = value; }
}
public bool IsAlarmContinuousNGEnable
{
get { return this.m_IsAlarmContinuousNGEnable; }
set { this.m_IsAlarmContinuousNGEnable = value; }
}
public bool IsAlarmTotalPassCntEnable
{
get { return this.m_IsAlarmTotalPassCntEnable; }
set { this.m_IsAlarmTotalPassCntEnable = value; }
}
public int AlarmContinuousNG
{
get { return this.m_AlarmContinuousNG; }
set { this.m_AlarmContinuousNG = value; }
}
public int AlarmTotalPassCnt
{
get { return this.m_AlarmTotalPassCnt; }
set { this.m_AlarmTotalPassCnt = value; }
}
// TCP
public bool IsEthernetEnable
{
get
{
if (this.EthernetOperationMode == 0)
return false;
else
return true;
}
}
public int EthernetServerPort
{
get { return this.m_EthernetServerPort; }
set { this.m_EthernetServerPort = value; }
}
public int EthernetMode
{
get { return this.m_EthernetMode; }
set { this.m_EthernetMode = value; }
}
public int EthernetOperationMode
{
get { return this.m_EthernetOperationMode; }
set { this.m_EthernetOperationMode = value; }
}
public int EthernetLocalPort
{
get { return this.m_EthernetLocalPort; }
set { this.m_EthernetLocalPort = value; }
}
public int ModbusRtuSlaveID
{
get { return this.m_ModbusRtuSlaveID; }
set { this.m_ModbusRtuSlaveID = value; }
}
public int ModbusTcpAddress1
{
get { return this.m_ModbusTcpAddress1; }
set { this.m_ModbusTcpAddress1 = value; }
}
public int ModbusTcpAddress2
{
get { return this.m_ModbusTcpAddress2; }
set { this.m_ModbusTcpAddress2 = value; }
}
public int ModbusTcpStartAddress
{
get { return this.m_ModbusTcpStartAddress; }
set { this.m_ModbusTcpStartAddress = value; }
}
public string EthernetServerAddress
{
get { return this.m_EthernetServerAddress; }
set { this.m_EthernetServerAddress = value; }
}
#endregion
#region Method
public void Initialization()
{
this.IsDataBackup = false;
this.IsFeedingConveyor = false;
this.IsEachNG = false;
this.IsDischargeConveyor = false;
this.IsDischargeConveyorDirectionCW = false;
this.IsWeightViewForward = true;
this.IsBypassMode = false;
this.IsFeedingConveyorRunPass = true;
this.IsSorterMode = true;
this.IsLogin = false;
this.IsEmergencyStopEntrySensorError = false;
this.IsBypassDirectionPass = true;
this.IsBypassOnce = true;
this.IsOptDataStatistics = false;
this.IsCutView = false;
this.IsPart11 = false;
this.DecimalPlaces = 1;
this.EquipmentColumns = 10;
this.EquipmentID = 1;
this.EquipmentMode = 5;
this.ProductNumber = 1;
this.Serial3BaudRate = 0;
this.Serial3Mode = 0;
this.ABFoodTimeoutInterval = 800;
this.InputSensorSelect = 5;
this.ServoLimit = 9999;
this.AutomaticLogout = 30;
this.DataStoragePeriod = 36;
this.Unit = "g";
this.SerialNumber = "25E0000";
this.User_Level1_Name = "Level 1";
this.User_Level2_Name = "Level 2";
this.User_Level3_Name = "Level 3";
this.Language = DataStore.LanguageID.Korean;
this.CurrentForm = DataStore.FormStore.FormMainDisplay;
this.CurrentUser = new UserItem();
this.CurrentUser.Group = DataStore.UserGroup.NotLogin;
this.IsAlarmContinuousNGEnable = false;
this.IsAlarmTotalPassCntEnable = false;
this.AlarmContinuousNG = 5;
this.AlarmTotalPassCnt = 100;
// TCP
this.EthernetServerPort = 5002;
this.EthernetMode = 0;
this.EthernetOperationMode = 0;
this.EthernetLocalPort = 5001;
this.ModbusRtuSlaveID = 1;
this.ModbusTcpAddress1 = 1000;
this.ModbusTcpAddress2 = 1100;
this.ModbusTcpStartAddress = 1010;
this.EthernetServerAddress = "0.0.0.0";
}
#endregion
}
#endregion
#region Struct SystemConfiguration
[StructLayout(LayoutKind.Sequential)]
public struct StructSystemConfigurationItem
{
public bool IsDataBackup;
public bool IsEmergencyStopEntrySensorError;
public bool IsFeedingConveyor;
public bool IsEachNG;
public bool IsDischargeConveyor;
public bool IsLogin;
public bool IsDischargeConveyorDirectionCW;
public bool IsWeightViewForward;
public int DecimalPlaces;
public int DummyInt7;
public int EquipmentColumns;
public int EquipmentID;
public int EquipmentMode;
public int ProductNumber;
public int DummyInt5;
public int DummyInt6;
public int Serial3BaudRate;
public int Serial3Mode;
public int AutomaticLogout;
public int DummyInt3;
public int DummyInt4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 48)]
public string DummyString6;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string Unit;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 15)]
public string SerialNumber;
public DataStore.LanguageID Language;
public bool IsPart11;
public bool IsOptDataStatistics;
public bool IsSorterMode;
public bool IsFeedingConveyorRunPass;
public int DummyInt1;
public int DataStoragePeriod;
public int ServoLimit;
public int InputSensorSelect;
public int ABFoodTimeoutInterval;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string User_Level1_Name;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string User_Level2_Name;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string User_Level3_Name;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString5;
}
#endregion
#region Struct SystemConfiguration1
[StructLayout(LayoutKind.Sequential)]
public struct StructSystemConfigurationItem1
{
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 IsAlarmContinuousNGEnable;
public bool IsAlarmTotalPassCntEnable;
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 ModbusTcpStartAddress;
public int ModbusRtuSlaveID;
public int ModbusTcpAddress1;
public int ModbusTcpAddress2;
public int EthernetLocalPort;
public int EthernetOperationMode;
public int EthernetMode;
public int EthernetServerPort;
public int AlarmContinuousNG;
public int AlarmTotalPassCnt;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string DummyString1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string DummyString2;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string DummyString3;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string DummyString4;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string DummyString5;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string EthernetServerAddress;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString7;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
public string DummyString8;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString9;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)]
public string DummyString10;
}
#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 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 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";
}
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 DummyString1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string DummyString2;
[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_IsUpdate;
private int m_ContinuousNG;
private bool m_IsContinuousNG;
private ushort m_UpdateCount;
#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;
if (this.IsContinuousNG != true)
this.IsContinuousNG = true;
}
else if (value == DataStore.JudgmentStatus.Pass)
{
if (this.PassCount < 10000000)
this.PassCount++;
else
this.PassCount = 0;
if (this.IsContinuousNG != false)
{
this.IsContinuousNG = false;
this.ContinuousNG = 0;
}
}
else if (value == DataStore.JudgmentStatus.Over)
{
if (this.OverCount < 10000000)
this.OverCount++;
else
this.OverCount = 0;
if (this.IsContinuousNG != true)
this.IsContinuousNG = true;
}
else if (value == DataStore.JudgmentStatus.Double || value == DataStore.JudgmentStatus.ExNG)
{
if (this.ExNGCount < 10000000)
this.ExNGCount++;
else
this.ExNGCount = 0;
if (this.IsContinuousNG != true)
this.IsContinuousNG = true;
}
}
}
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 IsUpdate
{
get { return this.m_IsUpdate; }
set { this.m_IsUpdate = value; }
}
/// <summary>
/// 연속NG 카운팅
/// </summary>
public int ContinuousNG
{
get { return this.m_ContinuousNG; }
set { this.m_ContinuousNG = value; }
}
public bool IsContinuousNG
{
get { return this.m_IsContinuousNG; }
set { this.m_IsContinuousNG = value; }
}
public ushort UpdateCount
{
get { return this.m_UpdateCount; }
set { this.m_UpdateCount = value; }
}
#endregion
#region Mehtod
public void ClearCount()
{
this.UnderCount = 0;
this.PassCount = 0;
this.OverCount = 0;
this.ExNGCount = 0;
this.UpdateCount = 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.IsUpdate = false;
this.IsContinuousNG = false;
this.ContinuousNG = 0;
this.UpdateCount = 0;
}
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 Counter
[StructLayout(LayoutKind.Sequential)]
public struct StructCounter
{
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 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 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 JudgmentSetItem
public class JudgmentSetItem
{
#region Field
private int m_Filter;
private int m_JudgmentDelayTime;
private int m_DamperDelayTime;
private int m_JudgmentCount;
private int m_FeedSpeed;
private double m_DynamicCorrection;
private int m_RejectConveyorDelayTime;
private int m_RejectConveyorRunTime;
private int m_FeedingConveyorDelayTime;
private int m_FeedingConveyorRunTime;
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_Sorter3Mode;
private int m_Sorter3DelayTime;
private int m_Sorter3RunTime;
private int m_Sorter4Mode;
private int m_Sorter4DelayTime;
private int m_Sorter4RunTime;
#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 DamperDelayTime
{
get { return this.m_DamperDelayTime; }
set { this.m_DamperDelayTime = 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 double DynamicCorrection
{
get { return this.m_DynamicCorrection; }
set { this.m_DynamicCorrection = value; }
}
public int RejectConveyorDelayTime
{
get { return this.m_RejectConveyorDelayTime; }
set { this.m_RejectConveyorDelayTime = value; }
}
public int RejectConveyorRunTime
{
get { return this.m_RejectConveyorRunTime; }
set { this.m_RejectConveyorRunTime = value; }
}
public int FeedingConveyorDelayTime
{
get { return this.m_FeedingConveyorDelayTime; }
set { this.m_FeedingConveyorDelayTime = value; }
}
public int FeedingConveyorRunTime
{
get { return this.m_FeedingConveyorRunTime; }
set { this.m_FeedingConveyorRunTime = 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 Sorter3Mode
{
get { return this.m_Sorter3Mode; }
set { this.m_Sorter3Mode = value; }
}
public int Sorter3DelayTime
{
get { return this.m_Sorter3DelayTime; }
set { this.m_Sorter3DelayTime = value; }
}
public int Sorter3RunTime
{
get { return this.m_Sorter3RunTime; }
set { this.m_Sorter3RunTime = value; }
}
public int Sorter4Mode
{
get { return this.m_Sorter4Mode; }
set { this.m_Sorter4Mode = value; }
}
public int Sorter4DelayTime
{
get { return this.m_Sorter4DelayTime; }
set { this.m_Sorter4DelayTime = value; }
}
public int Sorter4RunTime
{
get { return this.m_Sorter4RunTime; }
set { this.m_Sorter4RunTime = value; }
}
#endregion
#region Method
public void Initialization()
{
this.Filter = 8;
this.JudgmentDelayTime = 1000;
this.DamperDelayTime = 600;
this.JudgmentCount = 10;
this.FeedSpeed = 60;
this.DynamicCorrection = 1.000000;
this.RejectConveyorDelayTime = 1;
this.RejectConveyorRunTime = 1000;
this.FeedingConveyorDelayTime = 1;
this.FeedingConveyorRunTime = 1000;
this.Sorter1Mode = 0;
this.Sorter1DelayTime = 1;
this.Sorter1RunTime = 1000;
this.Sorter2Mode = 0;
this.Sorter2DelayTime = 1;
this.Sorter2RunTime = 1000;
this.Sorter3Mode = 0;
this.Sorter3DelayTime = 1;
this.Sorter3RunTime = 1000;
this.Sorter4Mode = 0;
this.Sorter4DelayTime = 1;
this.Sorter4RunTime = 1000;
}
#endregion
}
#endregion
#region Struct JudgmentSetItem
[StructLayout(LayoutKind.Sequential)]
public struct StructJudgmentSetItem
{
public int Filter;
public int JudgmentDelayTime;
public int DamperDelayTime;
public int JudgmentCount;
public int FeedSpeed;
public double DynamicCorrection;
public int DischargeConveyorDelayTime;
public int DischargeConveyorOperatingTime;
public int FeedingConveyorDelayTime;
public int FeedingConveyorOperatingTime;
public int Sorter1Mode;
public int Sorter1DelayTime;
public int Sorter1OperatingTime;
public int Sorter2Mode;
public int Sorter2DelayTime;
public int Sorter2OperatingTime;
public int Sorter3Mode;
public int Sorter3DelayTime;
public int Sorter3OperatingTime;
public int Sorter4Mode;
public int Sorter4DelayTime;
public int Sorter4OperatingTime;
public int DummyInt1;
public int DummyInt2;
public int DummyInt3;
public int DummyInt4;
public int DummyInt5;
[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 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;
#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";
this.Constant13 = "1.000000";
this.Constant14 = "1.000000";
this.Constant15 = "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; }
}
#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_DoubleEnter;
private string m_PassAlarm;
private string m_PassAlarmCount;
#endregion
#region Constructor
public OptionParameterItem()
{
this.BuzzerOnTime = "1000";
this.RelayOnTime = "500";
this.Chattering = "100";
this.DoubleEnter = "0";
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 DoubleEnter
{
get { return this.m_DoubleEnter; }
set { this.m_DoubleEnter = 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 AlarmList
public class AlarmList
{
#region Field
private bool m_IsEntrySensorError;
private bool m_IsLoadcellError;
private bool m_IsPressureError;
private bool m_IsServoOff;
private bool m_IsServoAlarm;
private bool m_IsServoTorqueAlarm;
public event DataStore.EventHandlerAlarmStateChange EventAlarmStateChange;
#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 IsServoOff
{
get { return this.m_IsServoOff; }
set { this.m_IsServoOff = value; }
}
public bool IsServoAlarm
{
get { return this.m_IsServoAlarm; }
set { this.m_IsServoAlarm = value; }
}
public bool IsServoTorqueAlarmTorque
{
get { return this.m_IsServoTorqueAlarm; }
set { this.m_IsServoTorqueAlarm = value; }
}
#endregion
#region Method
private void Initialize()
{
this.IsEntrySensorError = false;
this.IsLoadcellError = false;
this.IsPressureError = false;
this.IsServoOff = false;
this.IsServoAlarm = false;
this.IsServoTorqueAlarmTorque = 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');
// 알람 12-
if (sValue3[0] == '0')
{ }
else
{ }
// 알람 11-서보알람토크
if (sValue3[1] == '0')
{
if (this.IsServoTorqueAlarmTorque != false)
{
this.IsServoTorqueAlarmTorque = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a4_ServoTorqueAlarm, "OFF");
}
}
else
{
if (this.IsServoTorqueAlarmTorque != true)
{
this.IsServoTorqueAlarmTorque = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a4_ServoTorqueAlarm, "ON");
}
}
// 알람 10-서보알람
if (sValue3[2] == '0')
{
if (this.IsServoAlarm != false)
{
this.IsServoAlarm = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a5_ServoAlarm, "OFF");
}
}
else
{
if (this.IsServoAlarm != true)
{
this.IsServoAlarm = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a5_ServoAlarm, "ON");
}
}
// 알람 9-서보OFF
if (sValue3[3] == '0')
{
if (this.IsServoOff != false)
{
this.IsServoOff = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a6_ServoOff, "OFF");
}
}
else
{
if (this.IsServoOff != true)
{
this.IsServoOff = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a6_ServoOff, "ON");
}
}
// 알람 8-
if (sValue2[0] == '0')
{ }
else
{ }
// 알람 7-
if (sValue2[1] == '0')
{ }
else
{ }
// 알람 6-
if (sValue2[2] == '0')
{ }
else
{ }
// 알람 5-
if (sValue2[3] == '0')
{ }
else
{ }
// 알람 4-
if (sValue1[0] == '0')
{ }
else
{ }
// 알람 3-공압에러
if (sValue1[1] == '0')
{
if (this.IsPressureError != false)
{
this.IsPressureError = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a1_PressureError, "OFF");
}
}
else
{
if (this.IsPressureError != true)
{
this.IsPressureError = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a1_PressureError, "ON");
}
}
// 알람 2-셀 에러
if (sValue1[2] == '0')
{
if (this.IsLoadcellError != false)
{
this.IsLoadcellError = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a2_LoadcellError, "OFF");
}
}
else
{
if (this.IsLoadcellError != true)
{
this.IsLoadcellError = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a2_LoadcellError, "ON");
}
}
// 알람 1-입력센서 에러
if (sValue1[3] == '0')
{
if (this.IsEntrySensorError != false)
{
this.IsEntrySensorError = false;
this.EventAlarmStateChange(DataStore.Trackingalarm.a3_EntrySensorError, "OFF");
}
}
else
{
if (this.IsEntrySensorError != true)
{
this.IsEntrySensorError = true;
this.EventAlarmStateChange(DataStore.Trackingalarm.a3_EntrySensorError, "ON");
}
}
}
#endregion
}
#endregion
#region AlarmBasic
public class AlarmBasic
{
#region Field
private bool m_IsAlarm;
private DataStore.Level3 m_Level;
#endregion
#region Constructor
public AlarmBasic()
{
}
#endregion
#region Property
public bool IsAlarm
{
get { return this.m_IsAlarm; }
set { this.m_IsAlarm = value; }
}
public DataStore.Level3 Level
{
get { return this.m_Level; }
set { this.m_Level = value; }
}
#endregion
#region Method
#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.00}", ((double)this.PassTotalCount / (double)this.TotalCount) * 100.0);
sValue = string.Format("{0:0.00}", 100 - (this.UnderPercentage + this.OverPercentage + this.ExNgPercentage));
ret = double.Parse(sValue);
}
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.0);
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.0);
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.0);
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);
}
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.0);
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.0);
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.0);
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
#region HistoryData
public class HistoryData
{
#region Field
private string m_Type;
private DateTime m_Time;
private string m_LoginID;
private Object m_Event;
private string m_Detail;
private string m_BeforeData;
private string m_AfterData;
#endregion
#region Constructor
public HistoryData()
{
}
#endregion
#region Property
public string Type
{
get { return this.m_Type; }
set { this.m_Type = value; }
}
public DateTime Time
{
get { return this.m_Time; }
set { this.m_Time = value; }
}
public string LoginID
{
get { return this.m_LoginID; }
set { this.m_LoginID = value; }
}
public Object Event
{
get { return this.m_Event; }
set { this.m_Event = value; }
}
public string Detail
{
get { return this.m_Detail; }
set { this.m_Detail = value; }
}
public string BeforeData
{
get { return this.m_BeforeData; }
set { this.m_BeforeData = value; }
}
public string AfterData
{
get { return this.m_AfterData; }
set { this.m_AfterData = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Type = "";
this.Time = new DateTime();
this.LoginID = "-";
this.Event = new object();
this.Detail = "";
this.AfterData = "";
this.BeforeData = "";
}
#endregion
}
#endregion
#region DataViewerFilter
public class DataViewerFilter
{
#region Field
private bool m_TypeAlarm;
private bool m_TypeOperation;
private bool m_TypeParameter;
#endregion
#region Constructor
public DataViewerFilter()
{
this.Initialize();
}
#endregion
#region Property
public bool TypeAlarm
{
get { return this.m_TypeAlarm; }
set { this.m_TypeAlarm = value; }
}
public bool TypeOperation
{
get { return this.m_TypeOperation; }
set { this.m_TypeOperation = value; }
}
public bool TypeParameter
{
get { return this.m_TypeParameter; }
set { this.m_TypeParameter = value; }
}
#endregion
#region Method
private void Initialize()
{
this.TypeAlarm = true;
this.TypeOperation = true;
this.TypeParameter = true;
}
#endregion
}
#endregion
#region DataBackupYear
public class DataBackupYear
{
#region Field
private string m_Year;
public List<DataBackupMonth> Months;
#endregion
#region Constructor
public DataBackupYear(string year)
{
this.Initialize();
this.Year = year;
}
#endregion
#region Property
public string Year
{
get { return this.m_Year; }
private set { this.m_Year = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Year = "";
this.Months = new List<DataBackupMonth>();
}
#endregion
}
#endregion
#region DataBackupMonth
public class DataBackupMonth
{
#region Field
private string m_Month;
public List<string> Days;
#endregion
#region Constructor
public DataBackupMonth(string month)
{
this.Initialize();
this.Month = month;
}
#endregion
#region Property
public string Month
{
get { return this.m_Month; }
private set { this.m_Month = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Month = "";
this.Days = new List<string>();
}
#endregion
}
#endregion
#region StructUserItem
[StructLayout(LayoutKind.Sequential)]
public struct StructFileHeader
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string ProjectName;
public int NumberOfRegistrations;
}
#endregion
#region FileHeaderItem
public class FileHeaderItem
{
#region Field
private int m_EquipmentColumns;
private int m_EquipmentType;
private string m_LoginId;
private string m_SerialNumber;
private DateTime m_TimeStamp;
#endregion
#region Constructor
public FileHeaderItem()
{
}
#endregion
#region Property
public int EquipmentColumns
{
get { return this.m_EquipmentColumns; }
set { this.m_EquipmentColumns = value; }
}
public int EquipmentType
{
get { return this.m_EquipmentType; }
set { this.m_EquipmentType = value; }
}
public string LoginId
{
get { return this.m_LoginId; }
set { this.m_LoginId = value; }
}
public string SerialNumber
{
get { return this.m_SerialNumber; }
set { this.m_SerialNumber = value; }
}
public DateTime TimeStamp
{
get { return this.m_TimeStamp; }
set { this.m_TimeStamp = value; }
}
#endregion
#region Method
#endregion
}
#endregion
#region Struct FileHeaderItem
[StructLayout(LayoutKind.Sequential)]
public struct StructFileHeaderItem
{
public int EquipmentColumns;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string LoginId;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
public string SerialNumber;
public DateTime TimeStamp;
}
#endregion
#region Counter
public class Counter
{
#region Field
private int m_EquipmentColumn;
private int m_SettingCount;
private int m_CurrentTotalPass;
private int m_BeforeTotalPass;
private int m_BeforeLackCNT;
#endregion
#region Constructor
public Counter(int column, int setCNT)
{
this.EquipmentColumn = column;
this.SettingCount = setCNT;
this.Initialize();
}
#endregion
#region Property
public int EquipmentColumn
{
get { return this.m_EquipmentColumn; }
private set { this.m_EquipmentColumn = value; }
}
public int SettingCount
{
get { return this.m_SettingCount; }
set { this.m_SettingCount = value; }
}
public int CurrentTotalPass
{
get { return this.m_CurrentTotalPass; }
set { this.m_CurrentTotalPass = value; }
}
public int CurrentLackCNT
{
get
{
return this.SettingCount - this.CurrentTotalPass;
}
}
public int BeforeTotalPass
{
get { return this.m_BeforeTotalPass; }
private set { this.m_BeforeTotalPass = value; }
}
public int BeforeLackCNT
{
get { return this.m_BeforeLackCNT; }
set { this.m_BeforeLackCNT = value; }
}
#endregion
#region Method
private void Initialize()
{
this.Clear();
}
public void Clear()
{
this.CurrentTotalPass = 0;
this.BeforeTotalPass = 0;
this.BeforeLackCNT = 0;
}
public bool SetCount(DataStore.JudgmentStatus status)
{
bool ret = false;
if (status == DataStore.JudgmentStatus.Pass)
this.CurrentTotalPass++;
if (this.CurrentLackCNT > this.SettingCount - this.EquipmentColumn - 1 || this.CurrentTotalPass == this.SettingCount)
{
ret = true;
}
else
ret = false;
return ret;
}
public bool SetCountStic1(Collection<WeightData> datas)
{
bool ret = false;
for (int i = 0; i < datas.Count; i++)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
this.CurrentTotalPass++;
}
if (this.CurrentLackCNT <= this.EquipmentColumn - 1 || this.CurrentTotalPass == this.SettingCount)
{
ret = true;
this.BeforeTotalPass = this.CurrentTotalPass;
this.BeforeLackCNT = this.SettingCount - this.CurrentTotalPass;
this.CurrentTotalPass = 0;
}
else
ret = false;
return ret;
}
public bool SetCountStic2(Collection<WeightData> datas)
{
bool ret = false;
for (int i = 0; i < datas.Count; i++)
{
if (datas[i].IsUpdate == true)
{
if (datas[i].JudgmentStatus == DataStore.JudgmentStatus.Pass)
this.CurrentTotalPass++;
}
}
if (this.CurrentLackCNT <= this.EquipmentColumn - 1 || this.CurrentTotalPass == this.SettingCount)
{
ret = true;
this.BeforeTotalPass = this.CurrentTotalPass;
this.BeforeLackCNT = this.SettingCount - this.CurrentTotalPass;
this.CurrentTotalPass = 0;
}
else
ret = false;
return ret;
}
#endregion
}
#endregion
#region CalibrationStatus
public class CalibrationStatus
{
#region Field
private bool m_IsFinish;
private bool m_IsError;
private bool m_IsCancel;
#endregion
#region Constructor
public CalibrationStatus()
{
this.Initialize();
}
#endregion
#region Property
public bool IsFinish
{
get { return this.m_IsFinish; }
set { this.m_IsFinish = value; }
}
public bool IsError
{
get { return this.m_IsError; }
set { this.m_IsError = value; }
}
public bool IsCancel
{
get { return this.m_IsCancel; }
set { this.m_IsCancel = value; }
}
#endregion
#region Method
public void Initialize()
{
this.IsFinish = false;
this.IsError = false;
this.IsCancel = false;
}
#endregion
}
#endregion
#region StorageItem
public class StorageItem
{
#region Field
private double m_Weight;
private bool m_IsEmptyData;
private DataStore.JudgmentStatus m_JudgmentStatus;
#endregion
#region Constructor
public StorageItem(double weight, bool empty, DataStore.JudgmentStatus stats)
{
this.Weight = weight;
this.IsEmptyData = empty;
this.JudgmentStatus = stats;
}
#endregion
#region Property
public double Weight
{
get { return this.m_Weight; }
set { this.m_Weight = 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, 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].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].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 empty, DataStore.JudgmentStatus status)
{
this.Q_Weights.Enqueue(new StorageItem(value, 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, 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].IsEmptyData = false;
this.C_StorageItem[i].JudgmentStatus = DataStore.JudgmentStatus.None;
}
}
#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
}