using System; using System.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; using System.Runtime.InteropServices; using InModbus; using INT69DC_7C.Part11_UserManager; namespace INT69DC_7C { public class DataStore { #region Enum public enum EquipmentStatus { Stop = 0, Start = 1, }; public enum FormStore { FormNone = 0, FormMainDisplay, FormMenu, FormInformation, FormCommunication, FormDataStatistics, FormMotorSetting, FormEquipmentSetting, FormOptionSetting, FormConfiguration, FormSystemSetting, FormEquipmentTest, FormCalibration, FormIOTest, FormTimeSetting, FormFactory, FormProgramUpdate, FormUserEditor, FormUserGroupEditor, FormDataViewer, FormDataBackup, }; public enum FormMainDisplayStore { FormMainDisplayBarGraph, FormMainDisplayDotGraph, FormMainDisplayTable, FormMainDisplayFeedback, }; public enum LanguageID { Korean = 0, English, Chinese, Czech, German, Russian, }; public enum UserGroup { None = 0, Level1Operator, Level2Engineer, Level3Manager, Level4Developer, LogOff, }; public enum JudgmentStatus { 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 DischargeConveyorDirection { CW = 0, CCW = 1, CW_CCW = 2, } public enum FeedbackStatus { None, Positive, Negative, } public enum FeedbackBoardDataTransfer { None, Step1_6203, Step2_6208, } public enum StepMotorType { MDrive, // 슈나이더 제품 EDB_ALL_P, // 이레텍 제품 Moons, // 문스제품 } public enum _30000_Modbus { UnderRange_High = 1010, UnderRange_Low = 1011, PassRange_High = 1012, PassRange_Low = 1013, OverRange_High = 1014, OverRange_Low = 1015, TareRange_High = 1016, TareRange_Low = 1017, HighLimit_High = 1018, HighLimit_Low = 1019, DeadZoneHighLimit_High = 1020, DeadZoneHighLimit_Low = 1021, DeadZoneLowLimit_High = 1022, DeadZoneLowLimit_Low = 1023, LowLimit_High = 1024, LowLimit_Low = 1025, SampleCount_High = 1026, SampleCount_Low = 1027, IgnoreCount_High = 1028, IgnoreCount_Low = 1029, _1_Update = 1200, _1_Grade = 1201, _1_Weight_High = 1202, _1_Weight_Low = 1203, _1_UnderCount_High = 1204, _1_UnderCount_Low = 1205, _1_PassCount_High = 1206, _1_PassCount_Low = 1207, _1_OverCount_High = 1208, _1_OverCount_Low = 1209, _1_NGCount_High = 1210, _1_NgCount_Low = 1211, _1_ExNGCount_High = 1212, _1_ExNgCount_Low = 1213, _1_TotalCount_High = 1214, _1_TotalCount_Low = 1215, _2_Update = 1250, _2_Grade = 1251, _2_Weight_High = 1252, _2_Weight_Low = 1253, _2_UnderCount_High = 1254, _2_UnderCount_Low = 1255, _2_PassCount_High = 1256, _2_PassCount_Low = 1257, _2_OverCount_High = 1258, _2_OverCount_Low = 1259, _2_NGCount_High = 1260, _2_NgCount_Low = 1261, _2_ExNGCount_High = 1262, _2_ExNgCount_Low = 1263, _2_TotalCount_High = 1264, _2_TotalCount_Low = 1265, _3_Update = 1300, _3_Grade = 1301, _3_Weight_High = 1302, _3_Weight_Low = 1303, _3_UnderCount_High = 1304, _3_UnderCount_Low = 1305, _3_PassCount_High = 1306, _3_PassCount_Low = 1307, _3_OverCount_High = 1308, _3_OverCount_Low = 1309, _3_NGCount_High = 1310, _3_NgCount_Low = 1311, _3_ExNGCount_High = 1312, _3_ExNgCount_Low = 1313, _3_TotalCount_High = 1314, _3_TotalCount_Low = 1315, _4_Update = 1350, _4_Grade = 1351, _4_Weight_High = 1352, _4_Weight_Low = 1353, _4_UnderCount_High = 1354, _4_UnderCount_Low = 1355, _4_PassCount_High = 1356, _4_PassCount_Low = 1357, _4_OverCount_High = 1358, _4_OverCount_Low = 1359, _4_NGCount_High = 1360, _4_NgCount_Low = 1361, _4_ExNGCount_High = 1362, _4_ExNgCount_Low = 1363, _4_TotalCount_High = 1364, _4_TotalCount_Low = 1365, _5_Update = 1400, _5_Grade = 1401, _5_Weight_High = 1402, _5_Weight_Low = 1403, _5_UnderCount_High = 1404, _5_UnderCount_Low = 1405, _5_PassCount_High = 1406, _5_PassCount_Low = 1407, _5_OverCount_High = 1408, _5_OverCount_Low = 1409, _5_NGCount_High = 1410, _5_NgCount_Low = 1411, _5_ExNGCount_High = 1412, _5_ExNgCount_Low = 1413, _5_TotalCount_High = 1414, _5_TotalCount_Low = 1415, _6_Update = 1450, _6_Grade = 1451, _6_Weight_High = 1452, _6_Weight_Low = 1453, _6_UnderCount_High = 1454, _6_UnderCount_Low = 1455, _6_PassCount_High = 1456, _6_PassCount_Low = 1457, _6_OverCount_High = 1458, _6_OverCount_Low = 1459, _6_NGCount_High = 1460, _6_NgCount_Low = 1461, _6_ExNGCount_High = 1462, _6_ExNgCount_Low = 1463, _6_TotalCount_High = 1464, _6_TotalCount_Low = 1465, _7_Update = 1500, _7_Grade = 1501, _7_Weight_High = 1502, _7_Weight_Low = 1503, _7_UnderCount_High = 1504, _7_UnderCount_Low = 1505, _7_PassCount_High = 1506, _7_PassCount_Low = 1507, _7_OverCount_High = 1508, _7_OverCount_Low = 1509, _7_NGCount_High = 1510, _7_NgCount_Low = 1511, _7_ExNGCount_High = 1512, _7_ExNgCount_Low = 1513, _7_TotalCount_High = 1514, _7_TotalCount_Low = 1515, _8_Update = 1550, _8_Grade = 1551, _8_Weight_High = 1552, _8_Weight_Low = 1553, _8_UnderCount_High = 1554, _8_UnderCount_Low = 1555, _8_PassCount_High = 1556, _8_PassCount_Low = 1557, _8_OverCount_High = 1558, _8_OverCount_Low = 1559, _8_NGCount_High = 1560, _8_NgCount_Low = 1561, _8_ExNGCount_High = 1562, _8_ExNgCount_Low = 1563, _8_TotalCount_High = 1564, _8_TotalCount_Low = 1565, _9_Update = 1600, _9_Grade = 1601, _9_Weight_High = 1602, _9_Weight_Low = 1603, _9_UnderCount_High = 1604, _9_UnderCount_Low = 1605, _9_PassCount_High = 1606, _9_PassCount_Low = 1607, _9_OverCount_High = 1608, _9_OverCount_Low = 1609, _9_NGCount_High = 1610, _9_NgCount_Low = 1611, _9_ExNGCount_High = 1612, _9_ExNgCount_Low = 1613, _9_TotalCount_High = 1614, _9_TotalCount_Low = 1615, _10_Update = 1650, _10_Grade = 1651, _10_Weight_High = 1652, _10_Weight_Low = 1653, _10_UnderCount_High = 1654, _10_UnderCount_Low = 1655, _10_PassCount_High = 1656, _10_PassCount_Low = 1657, _10_OverCount_High = 1658, _10_OverCount_Low = 1659, _10_NGCount_High = 1660, _10_NgCount_Low = 1661, _10_ExNGCount_High = 1662, _10_ExNgCount_Low = 1663, _10_TotalCount_High = 1664, _10_TotalCount_Low = 1665, _11_Update = 1700, _11_Grade = 1701, _11_Weight_High = 1702, _11_Weight_Low = 1703, _11_UnderCount_High = 1704, _11_UnderCount_Low = 1705, _11_PassCount_High = 1706, _11_PassCount_Low = 1707, _11_OverCount_High = 1708, _11_OverCount_Low = 1709, _11_NGCount_High = 1710, _11_NgCount_Low = 1711, _11_ExNGCount_High = 1712, _11_ExNgCount_Low = 1713, _11_TotalCount_High = 1714, _11_TotalCount_Low = 1715, _12_Update = 1750, _12_Grade = 1751, _12_Weight_High = 1752, _12_Weight_Low = 1753, _12_UnderCount_High = 1754, _12_UnderCount_Low = 1755, _12_PassCount_High = 1756, _12_PassCount_Low = 1757, _12_OverCount_High = 1758, _12_OverCount_Low = 1759, _12_NGCount_High = 1760, _12_NgCount_Low = 1761, _12_ExNGCount_High = 1762, _12_ExNgCount_Low = 1763, _12_TotalCount_High = 1764, _12_TotalCount_Low = 1765, } public enum SerialMode { f0_None = 0, f1_OPT1, f2_OPT2, f3_OPT3, f4_OPT4, f5_Printer, f6_OPT5, } public enum EthernetMode { f0_None = 0, f1_OPT2, f2_OPT3, f3_Modbus_TCP, f4_OPT5, } public enum ModbusFunction { _04_ReadInputRegister, _16_WriteMultipleRegister, _03_ReadHoldingRegister, } public enum UserStatus { None = 0, Level1, Level2, Level3, Admin, Developer, NotLogin, LogOff, }; public enum E_FileHeaderItem { LoginId, SerialNumber, EquipmentColumns, TimeStamp, } public enum MessageBoxIcon { None, Hand, Question, Exclamation, Asterisk, } public enum E_DataType { None, History, Inspection, Other, } public enum TrackingOperation { None, PowerOn, BootingComplete, EquipmentStart, EquipmentStop, Login, Logout, Calibration, Zero, Clear, UserEditor, Bypass, Update, Sampling, ATPC_Reset, // 정량 알람 카운터 리셋 Print, BP_PassOnce, BP_NgOnce, BP_PassON, BP_PassOFF, BP_NgON, BP_NgOFF, MainCut, ProductCopy, ProductPaste, ProductAllPaste, Initialization, } public enum TrackingParameter { ProductNumber, ProductName, ProductLot, WeightOverRange, WeightPassRange, WeightUnderRange, WeightTareRange, PrintActivate, BP_Individual, BP_All, BP_Direction, BP_Mode, ACNC_Count, ACNC_Activate, ATPC_Count, ATPC_Activate, FB_HightLimit, FB_LowLimit, FB_DeadZone, FB_SampleCNT, FB_IgnoreCNT, FB_CorrectionRate, FB_PulseWidth, JudgmentFilter, JudgmentDelayTime, JudgmentDoubleDelayTime, JudgmentCount, JudgmentCVSpeed, SorterDelayTime, SorterRunTime, RejectCVDelayTime, RejectCVRunTime, FeedingCVDelayTime, FeedingCVRunTime, ForcedZeroDelayTime, 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, } public enum Trackingalarm { None, a1_PressureError, a2_LoadcellError, a3_EntrySensorError, a4_ServoTorqueAlarm, a5_ServoAlarm, a6_ServoOff, } public enum E_UserGroup_FileIndex { f0_Level1 = 0, f1_Level2 = 1, f2_Level3 = 2, f3_NotLogin = 3, } #endregion } #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 ImpellerMotorForward = "Cmc00"; // 임펠러 모터 - 역회전 public static readonly string ImpellerMotorReverse = "Cmr00"; // Cut 신호 public static readonly string CutInput = "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"; // Sampling Signal public static readonly string SamplingSignal = "Cba00"; // 알람 - 불량알람(펄스) 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 SubBoardAll = "Z"; } public class CommunicationAddress { // Address None public static readonly string None = "0000"; // 임펠러 모터 - 회전각도(Pass) public static readonly string _1101_ImpellerMotorAnglePass = "1101"; // 임펠러 모터 - 통신속도 public static readonly string _1102_ImpellerMotorBaudrate = "1102"; // 임펠러 모터 - 회전방향 public static readonly string _1103_ImpellerMotorDirection = "1103"; // 임펠러 모터 - 개별 회전방향 public static readonly string _1104_ImpellerMotorIndividualDirection = "1104"; // 임펠러 모터 - 회전각도(NG) public static readonly string _1105_ImpellerMotorAngleNG = "1105"; // 임펠러 모터 - 테스트 회전각도 public static readonly string _1107_ImpellerMotorTextAngle1 = "1107"; // 임펠러 모터 - 테스트 회전각도 public static readonly string _1108_ImpellerMotorTextAngle2 = "1108"; // 바이패스 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"; // 중량조정 - 최대중량 설정값 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_ParameterRead = "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_ParameterRead = "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"; // 판정설정 - Feeding 컨베어 지연시간 public static readonly string _5007_FeedingConveyorDelayTime = "5007"; // 판정설정 - Feeding 컨베어 동작시간 public static readonly string _5008_FeedingConveyorRunTime = "5008"; // 판정설정 - 배출 컨베어 지연시간 public static readonly string _5009_DischargeConveyorDelayTime = "5009"; // 판정설정 - 배출 컨베어 동작시간 public static readonly string _5010_DischargeConveyorRunTime = "5010"; // 판정설정 - 임펠러 지연시간 public static readonly string _5013_ImpellerDelayTime = "5013"; // 판정설정 - 선별기 모드 값 public static readonly string _5101_Sorter1Mode = "5101"; // 판정설정 - 선별기 지연시간 public static readonly string _5102_Sorter1DelayTime = "5102"; // 판정설정 - 선별기 동작시간 public static readonly string _5103_Sorter1RunTime = "5103"; // 옵션 - 부저 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"; // 옵션 - OPT1 펄스폭 public static readonly string _6203_FeedbackPulseWidth = "6203"; // 옵션 - OPT1 Collection Rate public static readonly string _6208_FeedbackCollectionRate = "6208"; // 옵션 - 파라미터 읽기 public static readonly string _6901_ParameterRead = "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 _9016_ParameterProduct = "9016"; // 시스템 설정 모두 쓰기 public static readonly string _9032_ParameterSystem = "9032"; // 중량 설정값 쓰기 public static readonly string _9003_ParameterWeightRange = "9003"; } #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_IsIndividualNG; private bool m_IsDischargeConveyor; private bool m_IsImpellerMotorDirectionCW; private bool m_IsWeightViewForward; private bool m_IsBypassMode; private bool m_IsFeedingConveyorRunPass; private bool m_IsCutView; private bool m_IsEmergencyStopEntrySensorError; private bool m_IsIndividualTransmission; private bool m_IsLogin; private bool m_IsOptFeedbackBoardUse; private bool m_IsBypassDirectionPass; private bool m_IsBypassOnce; private bool m_IsOptDataStatistics; private bool m_IsPrintPerProductEnable; private bool m_IsAlarmContinuousNGEnable; private bool m_IsIntegratedTransmission; private bool m_IsSamplingView; private bool m_IsAlarmTotalPassCntEnable; 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_UsbID; private int m_ImpellerMotorBaudrate; private int m_ImpellerMotorAnglePass; private int m_ABFoodTimeoutInterval; private int m_InputSensorSelect; private int m_AlarmContinuousNG; private int m_FeedbackSampleCount; private int m_FeedbackIgnorePackages; private int m_FeedbackPulseWidth; private int m_FeedbackCorrectionRate; private int m_ImpellerMotorAngleNG; private int m_StepMotorType; 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 int m_AlarmTotalPassCnt; private int m_AutomaticLogout; private string m_Unit; private string m_SerialNumber; private string m_EthernetServerAddress; 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 DataStore.DischargeConveyorDirection m_DischargeConveyorDirectionCW; private UserItem 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 IsFeedingConveyor { get { return this.m_IsFeedingConveyor; } set { this.m_IsFeedingConveyor = value; } } public bool IsIndividualNG { get { return this.m_IsIndividualNG; } set { this.m_IsIndividualNG = value; } } public bool IsDischargeConveyor { get { return this.m_IsDischargeConveyor; } set { this.m_IsDischargeConveyor = value; } } public bool IsImpellerMotorDirectionCW { get { return this.m_IsImpellerMotorDirectionCW; } set { this.m_IsImpellerMotorDirectionCW = 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 IsCutView { get { return this.m_IsCutView; } set { this.m_IsCutView = value; } } public bool IsEmergencyStopEntrySensorError { get { return this.m_IsEmergencyStopEntrySensorError; } set { this.m_IsEmergencyStopEntrySensorError = value; } } public bool IsIndividualTransmission { get { return this.m_IsIndividualTransmission; } set { this.m_IsIndividualTransmission = value; } } public bool IsLogin { get { return this.m_IsLogin; } set { this.m_IsLogin = value; } } public bool IsOptFeedbackBoardUse { get { return this.m_IsOptFeedbackBoardUse; } set { this.m_IsOptFeedbackBoardUse = 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 IsPrintPerProductEnable { get { return this.m_IsPrintPerProductEnable; } set { this.m_IsPrintPerProductEnable = value; } } public bool IsEthernetEnable { get { if (this.EthernetOperationMode == 0) return false; else return true; } } public bool IsAlarmContinuousNGEnable { get { return this.m_IsAlarmContinuousNGEnable; } set { this.m_IsAlarmContinuousNGEnable = value; } } public bool IsIntegratedTransmission { get { return this.m_IsIntegratedTransmission; } set { this.m_IsIntegratedTransmission = value; } } public bool IsSamplingView { get { return this.m_IsSamplingView; } set { this.m_IsSamplingView = value; } } public bool IsAlarmTotalPassCntEnable { get { return this.m_IsAlarmTotalPassCntEnable; } set { this.m_IsAlarmTotalPassCntEnable = value; } } public bool IsPart11 { get { return this.m_IsPart11; } set { this.m_IsPart11 = 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 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 UsbID { get { return this.m_UsbID; } set { this.m_UsbID = value; } } public int ImpellerMotorBaudrate { get { return this.m_ImpellerMotorBaudrate; } set { this.m_ImpellerMotorBaudrate = value; } } public int ImpellerMotorAnglePass { get { return this.m_ImpellerMotorAnglePass; } set { this.m_ImpellerMotorAnglePass = 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 AlarmContinuousNG { get { return this.m_AlarmContinuousNG; } set { this.m_AlarmContinuousNG = value; } } public int FeedbackSampleCount { get { return this.m_FeedbackSampleCount; } set { this.m_FeedbackSampleCount = value; } } public int FeedbackIgnorePackages { get { return this.m_FeedbackIgnorePackages; } set { this.m_FeedbackIgnorePackages = value; } } public int FeedbackPulseWidth { get { return this.m_FeedbackPulseWidth; } set { this.m_FeedbackPulseWidth = value; } } public int FeedbackCorrectionRate { get { return this.m_FeedbackCorrectionRate; } set { this.m_FeedbackCorrectionRate = value; } } public int ImpellerMotorAngleNG { get { return this.m_ImpellerMotorAngleNG; } set { this.m_ImpellerMotorAngleNG = value; } } public int StepMotorType { get { return this.m_StepMotorType; } set { this.m_StepMotorType = value; } } 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 int AlarmTotalPassCnt { get { return this.m_AlarmTotalPassCnt; } set { this.m_AlarmTotalPassCnt = value; } } public int AutomaticLogout { get { return this.m_AutomaticLogout; } set { this.m_AutomaticLogout = 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 EthernetServerAddress { get { return this.m_EthernetServerAddress; } set { this.m_EthernetServerAddress = 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 DataStore.DischargeConveyorDirection DischargeConveyorDirectionCW { get { return this.m_DischargeConveyorDirectionCW; } set { this.m_DischargeConveyorDirectionCW = value; } } public UserItem CurrentUser { get { return this.m_CurrentUser; } set { this.m_CurrentUser = value; } } #endregion #region Method public void Initialization() { this.IsDataBackup = false; this.IsFeedingConveyor = false; this.IsIndividualNG = false; this.IsDischargeConveyor = false; this.IsImpellerMotorDirectionCW = false; this.IsWeightViewForward = true; this.IsBypassMode = false; this.IsFeedingConveyorRunPass = true; this.IsCutView = false; this.IsEmergencyStopEntrySensorError = false; this.IsIndividualTransmission = false; this.IsLogin = false; this.IsOptFeedbackBoardUse = false; this.IsBypassDirectionPass = true; this.IsBypassOnce = true; this.IsOptDataStatistics = false; this.IsPrintPerProductEnable = false; this.IsAlarmContinuousNGEnable = false; this.IsIntegratedTransmission = false; this.IsSamplingView = false; this.IsAlarmTotalPassCntEnable = false; this.IsPart11 = false; this.DecimalPlaces = 1; this.EquipmentColumns = 10; this.EquipmentID = 1; this.EquipmentMode = 1; this.ProductNumber = 1; this.Serial3BaudRate = 0; this.Serial3Mode = 0; this.UsbID = 1; this.ImpellerMotorBaudrate = 4; this.ImpellerMotorAnglePass = 3; this.ABFoodTimeoutInterval = 800; this.InputSensorSelect = 5; this.AlarmContinuousNG = 5; this.FeedbackSampleCount = 10; this.FeedbackIgnorePackages = 5; this.FeedbackPulseWidth = 1; this.FeedbackCorrectionRate = 1; this.ImpellerMotorAngleNG = 3; this.StepMotorType = 0; 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.AlarmTotalPassCnt = 100; this.AutomaticLogout = 30; this.Unit = "g"; this.SerialNumber = "23D0000"; this.EthernetServerAddress = "0.0.0.0"; 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.DischargeConveyorDirectionCW = DataStore.DischargeConveyorDirection.CW; this.CurrentUser = new UserItem(); this.CurrentUser.Status = DataStore.UserStatus.NotLogin; } #endregion } #endregion #region Struct SystemConfiguration [StructLayout(LayoutKind.Sequential)] public struct StructSystemConfigurationItem { public bool IsDataBackup; public bool IsOptFeedbackBoardUse; public bool IsFeedingConveyor; public bool IsIndividualNG; public bool IsDischargeConveyor; public bool IsImpellerMotorDirectionCW; public bool IsWeightViewForward; public int DecimalPlaces; public int FeedbackSampleCount; public int EquipmentColumns; public int EquipmentID; public int EquipmentMode; public int ProductNumber; public int FeedbackIgnorePackages; public int FeedbackPulseWidth; public int Serial3BaudRate; public int Serial3Mode; public int UsbID; public int ImpellerMotorBaudrate; public int ImpellerMotorAnglePass; [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 IsOptDataStatistics; public bool IsLogin; public bool IsIndividualTransmission; public bool IsEmergencyStopEntrySensorError; public bool IsFeedingConveyorRunPass; public int FeedbackCorrectionRate; public int DischargeConveyorDirectionCW; public int AlarmContinuousNG; 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 IsPart11; public bool IsAlarmTotalPassCntEnable; public bool IsIntegratedTransmission; public bool IsAlarmContinuousNGEnable; public int DummyInt1; public int DummyInt2; public int DummyInt3; public int DummyInt4; public int DummyInt5; public int DummyInt6; public int DummyInt7; public int AutomaticLogout; public int AlarmTotalPassCnt; 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 StepMotorType; public int ImpellerMotorAnglePass; public int ImpellerMotorAngleNG; [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_IsOPT1; private bool m_IsOPT2; 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; } } /// /// 소수점 포함된 중량값 /// 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 (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; } } /// /// 소수점 없는 중량값 /// 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; } } /// /// 스틱2모드에서 데이터 갱신이 되었으면 true, 안되었으면 false /// public bool IsOPT1 { get { return this.m_IsOPT1; } set { this.m_IsOPT1 = value; } } /// /// 스틱2모드에서 데이터 갱신이 되었으면 true, 안되었으면 false /// Alarm Total Pass Count 에서 사용 /// 추후에 IsOPT1과 통합하여 코드 정리 할것 (V 10.11.0) /// public bool IsOPT2 { get { return this.m_IsOPT2; } set { this.m_IsOPT2 = value; } } /// /// 연속NG 카운팅 /// 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.Empty; this.ProductionSpeed = 0; this.WeightString = "0"; this.IsADCError = false; this.IsBypassMode = false; this.IsOPT1 = false; this.IsOPT2 = 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 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_DoubleDelayTime; private int m_JudgmentCount; private int m_FeedSpeed; private double m_DynamicCorrection; private int m_ForcedZeroDelayTime; 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 DoubleDelayTime { get { return this.m_DoubleDelayTime; } set { this.m_DoubleDelayTime = value; } } public int JudgmentCount { get { return this.m_JudgmentCount; } set { this.m_JudgmentCount = value; } } public int 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 ForcedZeroDelayTime { get { return this.m_ForcedZeroDelayTime; } set { this.m_ForcedZeroDelayTime = 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.DoubleDelayTime = 900; this.JudgmentCount = 10; this.FeedSpeed = 1; this.DynamicCorrection = 1.000000; this.ForcedZeroDelayTime = 0; 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 DoubleDelayTime; 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 ForcedZeroDelayTime; [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 FeedbackItem public class FeedbackConfiguration { #region Field private bool m_IsBootingComplete; private int m_RetryCount; private DataStore.FeedbackBoardDataTransfer m_DataTransfer; private string m_HighLimit; private string m_LowLimit; private string m_DeadZone; #endregion #region Constructor public FeedbackConfiguration() { this.Initialization(); this.DefaultSetting(); } #endregion #region Property public bool IsBootingComplete { get { return this.m_IsBootingComplete; } set { this.m_IsBootingComplete = value; } } public int RetryCount { get { return this.m_RetryCount; } set { this.m_RetryCount = value; } } public DataStore.FeedbackBoardDataTransfer DataTransfer { get { return this.m_DataTransfer; } set { this.m_DataTransfer = value; } } public string HighLimit { get { return this.m_HighLimit; } set { this.m_HighLimit = value; } } public string LowLimit { get { return this.m_LowLimit; } set { this.m_LowLimit = value; } } public string DeadZone { get { return this.m_DeadZone; } set { this.m_DeadZone = value; } } #endregion #region Method public void Initialization() { this.HighLimit = "3000"; this.LowLimit = "1000"; this.DeadZone = "0"; } private void DefaultSetting() { this.IsBootingComplete = false; this.RetryCount = 0; this.DataTransfer = DataStore.FeedbackBoardDataTransfer.None; } #endregion } #endregion #region Struct FeedbackItem [StructLayout(LayoutKind.Sequential)] public struct StructFeedbackConfiguration { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string HightLimit; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string LowLimit; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string DeadZone; public bool DummyBool1; public bool DummyBool2; public bool DummyBool3; public int DummyInt1; public int DummyInt2; public int DummyInt3; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string DummyString1; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string DummyString2; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string DummyString3; } #endregion #region Modbus public class _30000_ModbusData { #region Field private double m_UnderValue; private double m_PassValue; private double m_OverValue; private double m_TareValue; private double m_HighLimit; private double m_DeadZoneHighLimit; private double m_DeadZoneLowLimit; private double m_LowLimit; private UInt32 m_SampleCount; private UInt32 m_IgnoreCount; private Collection<_30000_LaneModbusData> m_LaneModbusData; #endregion #region Constructor public _30000_ModbusData() { this.Initialization(); } #endregion #region Property public double UnderValue { get { return this.m_UnderValue; } set { this.m_UnderValue = value; } } public double PassValue { get { return this.m_PassValue; } set { this.m_PassValue = value; } } public double OverValue { get { return this.m_OverValue; } set { this.m_OverValue = value; } } public double TareValue { get { return this.m_TareValue; } set { this.m_TareValue = value; } } public double HighLimit { get { return this.m_HighLimit; } set { this.m_HighLimit = value; } } public double DeadZoneHighLimit { get { return this.m_DeadZoneHighLimit; } set { this.m_DeadZoneHighLimit = value; } } public double DeadZoneLowLimit { get { return this.m_DeadZoneLowLimit; } set { this.m_DeadZoneLowLimit = value; } } public double LowLimit { get { return this.m_LowLimit; } set { this.m_LowLimit = value; } } public UInt32 SampleCount { get { return this.m_SampleCount; } set { this.m_SampleCount = value; } } public UInt32 IgnoreCount { get { return this.m_IgnoreCount; } set { this.m_IgnoreCount = value; } } public Collection<_30000_LaneModbusData> LaneModbusData { get { return this.m_LaneModbusData; } set { this.m_LaneModbusData = value; } } #endregion #region Method public void Initialization() { this.UnderValue = 100.0; this.PassValue = 200.0; this.OverValue = 300.0; this.TareValue = 0.0; this.HighLimit = 300.0; this.DeadZoneHighLimit = 0.0; this.DeadZoneLowLimit = 0.0; this.LowLimit = 100.0; this.SampleCount = 0; this.IgnoreCount = 0; this.LaneModbusData = new Collection<_30000_LaneModbusData>(); this.LaneModbusData.Clear(); for (int i = 0; i < 12; i++) this.LaneModbusData.Add(new _30000_LaneModbusData()); } #endregion } public class _30000_LaneModbusData { #region Field private ushort m_Update; private ushort m_Grade; private double m_Weight; private UInt32 m_UnderCount; private UInt32 m_PassCount; private UInt32 m_OverCount; private UInt32 m_ExNGCount; #endregion #region Constructor public _30000_LaneModbusData() { this.Initialization(); } #endregion #region Property public ushort Update { get { return this.m_Update; } set { this.m_Update = value; } } public ushort Grade { get { return this.m_Grade; } set { this.m_Grade = value; } } public double Weight { get { return this.m_Weight; } set { this.m_Weight = value; } } public UInt32 UnderCount { get { return this.m_UnderCount; } set { this.m_UnderCount = value; } } public UInt32 PassCount { get { return this.m_PassCount; } set { this.m_PassCount = value; } } public UInt32 OverCount { get { return this.m_OverCount; } set { this.m_OverCount = value; } } public UInt32 ExNGCount { get { return this.m_ExNGCount; } set { this.m_ExNGCount = value; } } public UInt32 NGCount { get { return this.m_UnderCount + this.m_OverCount + this.m_ExNGCount; } } public UInt32 TotalCount { get { return this.m_UnderCount + this.m_PassCount + this.m_OverCount + this.m_ExNGCount; } } public string HexStringUpdate { get { string hexString = this.Update.ToString("X8"); return hexString; } } public string HexStringGrade { get { string hexString = this.Grade.ToString("X8"); return hexString; } } public string HexStringWeight { get { byte[] bytes = BitConverter.GetBytes((float)this.Weight); Array.Reverse(bytes); string hexString = BitConverter.ToString(bytes); hexString = hexString.Replace("-", ""); return hexString; } } public string HexStringPassCount { get { string hexString = this.PassCount.ToString("X8"); return hexString; } } public string HexStringNGCount { get { string hexString = this.NGCount.ToString("X8"); return hexString; } } #endregion #region Method public void Initialization() { this.Update = 0; this.Grade = 0; this.Weight = 0.0; this.UnderCount = 0; this.PassCount = 0; this.OverCount = 0; this.ExNGCount = 0; } #endregion } public class _40000_ModbusAddress { public const int _01_Clear = 10; public const int _02_ClearResult = 11; public const int _03_Operation = 12; public const int _04_OperationResult = 13; public const int _05_ProductChange_High = 14; public const int _06_ProductChange_Low = 15; public const int _07_ProductChangeResult = 16; public const int _08_UnderRange_High = 17; public const int _09_UnderRange_Low = 18; public const int _10_UnderRangeResult = 19; public const int _11_PassRange_High = 20; public const int _12_PassRange_Low = 21; public const int _13_PassRangeResult = 22; public const int _14_OverRange_High = 23; public const int _15_OverRange_Low = 24; public const int _16_OverRangeResult = 25; public const int _17_TareWeight_High = 26; public const int _18_TareWeight_Low = 27; public const int _19_TareWeightResult = 28; } public class _40000_ModbusData { #region Field private int m_40011_Clear; private int m_40012_ClearResult; private int m_40013_Operation; private int m_40014_OperationResult; private int m_40015_ProductChange; private int m_40017_ProductChangeResult; private int m_40018_UnderRange; private int m_40020_UnderRangeResult; private int m_40021_PassRange; private int m_40023_PassRangeResult; private int m_40024_OverRange; private int m_40026_OverRangeResult; private int m_40027_TareWeight; private int m_40029_TareWeightResult; #endregion #region Constructor public _40000_ModbusData() { this.Initialization(); } #endregion #region Property public int _40011_Clear { get { return this.m_40011_Clear; } set { this.m_40011_Clear = value; } } public int _40012_ClearResult { get { return this.m_40012_ClearResult; } set { this.m_40012_ClearResult = value; } } public int _40013_Operation { get { return this.m_40013_Operation; } set { this.m_40013_Operation = value; } } public int _40014_OperationResult { get { return this.m_40014_OperationResult; } set { this.m_40014_OperationResult = value; } } public int _40015_ProductChange { get { return this.m_40015_ProductChange; } set { this.m_40015_ProductChange = value; } } public int _40017_ProductChangeResult { get { return this.m_40017_ProductChangeResult; } set { this.m_40017_ProductChangeResult = value; } } public int _40018_UnderRange { get { return this.m_40018_UnderRange; } set { this.m_40018_UnderRange = value; } } public int _40020_UnderRangeResult { get { return this.m_40020_UnderRangeResult; } set { this.m_40020_UnderRangeResult = value; } } public int _40021_PassRange { get { return this.m_40021_PassRange; } set { this.m_40021_PassRange = value; } } public int _40023_PassRangeResult { get { return this.m_40023_PassRangeResult; } set { this.m_40023_PassRangeResult = value; } } public int _40024_OverRange { get { return this.m_40024_OverRange; } set { this.m_40024_OverRange = value; } } public int _40026_OverRangeResult { get { return this.m_40026_OverRangeResult; } set { this.m_40026_OverRangeResult = value; } } public int _40027_TareWeight { get { return this.m_40027_TareWeight; } set { this.m_40027_TareWeight = value; } } public int _40029_TareWeightResult { get { return this.m_40029_TareWeightResult; } set { this.m_40029_TareWeightResult = value; } } #endregion #region Method public void Initialization() { this._40011_Clear = 0; this._40012_ClearResult = 0; this._40013_Operation = 0; this._40014_OperationResult = 0; this._40015_ProductChange = 0; this._40017_ProductChangeResult = 0; this._40018_UnderRange = 0; this._40020_UnderRangeResult = 0; this._40021_PassRange = 0; this._40023_PassRangeResult = 0; this._40024_OverRange = 0; this._40026_OverRangeResult = 0; this._40027_TareWeight = 0; this._40029_TareWeightResult = 0; } #endregion } #endregion #region FeedBackStatus public class FeedBackSystem1 { #region Field private bool m_IsTransferData; private int m_IgnoreCount; private double m_FeedbackWeight; private DataStore.FeedbackStatus m_Status; private Collection m_WeightList; #endregion #region Constructor public FeedBackSystem1() { this.DefaultSetting(); } #endregion #region Property public bool IsTransferData { get { return this.m_IsTransferData; } set { this.m_IsTransferData = value; } } public int IgnoreCount { get { return this.m_IgnoreCount; } set { this.m_IgnoreCount = value; } } public int SumWeight { get { int sum = 0; foreach (int weignt in this.WeightList) sum += weignt; return sum; } } public double FeedbackWeight { get { return this.m_FeedbackWeight; } set { this.m_FeedbackWeight = value; } } public DataStore.FeedbackStatus Status { get { return this.m_Status; } private set { this.m_Status = value; } } public Collection WeightList { get { return this.m_WeightList; } private set { this.m_WeightList = value; } } #endregion #region Method private void DefaultSetting() { this.WeightList = new Collection(); this.WeightList.Clear(); this.IsTransferData = false; this.IgnoreCount = 0; this.FeedbackWeight = 0.0; this.Status = DataStore.FeedbackStatus.None; } public void SetWeight(int weight, DataStore.FeedbackStatus status) { if (status != this.Status) this.WeightList.Clear(); this.WeightList.Add(weight); this.Status = status; } public void ClearDataList() { this.WeightList.Clear(); } public void ClearData() { this.ClearDataList(); this.IgnoreCount = 0; this.IsTransferData = false; this.Status = DataStore.FeedbackStatus.None; } public void ClearDataAll() { this.ClearData(); this.FeedbackWeight = 0.0; } #endregion } #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; #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; } } #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 WeightStorageItem public class WeightStorageItem { #region Field private double m_Weight1; private double m_Weight2; private double m_weight3; private double m_Weight4; private double m_Weight5; private double m_Weight6; private double m_Weight7; private double m_Weight8; private double m_Weight9; private double m_Weight10; private double m_TotalSum; private int m_TotalCount; private double m_TotalPassSum; private int m_TotalPassCount; #endregion #region Constructor public WeightStorageItem() { this.TotalCount = 0; this.TotalSum = 0.0; this.TotalPassCount = 0; this.TotalPassSum = 0.0; this.Weight1 = 0.0; this.Weight2 = 0.0; this.Weight3 = 0.0; this.Weight4 = 0.0; this.Weight5 = 0.0; this.Weight6 = 0.0; this.Weight7 = 0.0; this.Weight8 = 0.0; this.Weight9 = 0.0; this.Weight10 = 0.0; } #endregion #region Property public double Weight1 { get { return this.m_Weight1; } set { this.m_Weight1 = value; } } public double Weight2 { get { return this.m_Weight2; } set { this.m_Weight2 = value; } } public double Weight3 { get { return this.m_weight3; } set { this.m_weight3 = value; } } public double Weight4 { get { return this.m_Weight4; } set { this.m_Weight4 = value; } } public double Weight5 { get { return this.m_Weight5; } set { this.m_Weight5 = value; } } public double Weight6 { get { return this.m_Weight6; } set { this.m_Weight6 = value; } } public double Weight7 { get { return this.m_Weight7; } set { this.m_Weight7 = value; } } public double Weight8 { get { return this.m_Weight8; } set { this.m_Weight8 = value; } } public double Weight9 { get { return this.m_Weight9; } set { this.m_Weight9 = value; } } public double Weight10 { get { return this.m_Weight10; } set { this.m_Weight10 = value; } } public double TotalSum { get { return this.m_TotalSum; } private set { this.m_TotalSum = value; } } public int TotalCount { get { return this.m_TotalCount; } private set { this.m_TotalCount = value; } } public double TotalPassSum { get { return this.m_TotalPassSum; } set { this.m_TotalPassSum = value; } } public int TotalPassCount { get { return this.m_TotalPassCount; } set { this.m_TotalPassCount = value; } } #endregion #region Method public double GetWeightTenSum() { if (this.TotalCount < 10) return 0.0; else return this.Weight1 + this.Weight2 + this.Weight3 + this.Weight4 + this.Weight5 + this.Weight6 + this.Weight7 + this.Weight8 + this.Weight9 + this.Weight10; } public double GetWeightTenAverage() { return this.GetWeightTenSum() / 10; } public double GetWeightTotalAverage() { if (this.TotalCount == 0) return 0.0; return this.TotalSum / this.TotalCount; } public double GetWeightTotalPassAverage() { if (this.TotalPassSum == 0) return 0.0; return this.TotalPassSum / this.TotalPassCount; } public void SetValue(double value,DataStore.JudgmentStatus status) { this.Weight10 = this.Weight9; this.Weight9 = this.Weight8; this.Weight8 = this.Weight7; this.Weight7 = this.Weight6; this.Weight6 = this.Weight5; this.Weight5 = this.Weight4; this.Weight4 = this.Weight3; this.Weight3 = this.Weight2; this.Weight2 = this.Weight1; this.Weight1 = value; this.TotalCount++; this.TotalSum = this.TotalSum + value; if (status == DataStore.JudgmentStatus.Pass) { this.TotalPassCount++; this.TotalPassSum = this.TotalPassSum + value; } } public void AllClear() { this.Weight1 = 0.0; this.Weight2 = 0.0; this.Weight3 = 0.0; this.Weight4 = 0.0; this.Weight5 = 0.0; this.Weight6 = 0.0; this.Weight7 = 0.0; this.Weight8 = 0.0; this.Weight9 = 0.0; this.Weight10 = 0.0; this.TotalSum = 0.0; this.TotalCount = 0; this.TotalPassSum = 0.0; this.TotalPassCount = 0; } #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 ImpellerMotorItem public class ImpellerMotorItem { #region Field private string m_Rc; private string m_Hc; private string m_Ms; private string m_Vi; private string m_Vm; private string m_A; private string m_CC; private string m_PI; private string m_EG; private string m_VE; private string m_AC; private string m_DE; #endregion #region Constructor public ImpellerMotorItem() { this.Initialization(); } #endregion #region Property public string Rc { get { return this.m_Rc; } set { this.m_Rc = value; } } public string Hc { get { return this.m_Hc; } set { this.m_Hc = value; } } public string Ms { get { return this.m_Ms; } set { this.m_Ms = value; } } public string Vi { get { return this.m_Vi; } set { this.m_Vi = value; } } public string Vm { get { return this.m_Vm; } set { this.m_Vm = value; } } public string A { get { return this.m_A; } set { this.m_A = value; } } public string DE { get { return this.m_DE; } set { this.m_DE = value; } } public string AC { get { return this.m_AC; } set { this.m_AC = value; } } public string VE { get { return this.m_VE; } set { this.m_VE = value; } } public string EG { get { return this.m_EG; } set { this.m_EG = value; } } public string PI { get { return this.m_PI; } set { this.m_PI = value; } } public string CC { get { return this.m_CC; } set { this.m_CC = value; } } #endregion #region Method public void Initialization() { this.Rc = "65"; this.Hc = "30"; this.Ms = "180"; this.Vi = "1000"; this.Vm = "180000"; this.A = "900000"; this.CC = "0.4"; this.PI = "0.35"; this.EG = "36000"; this.VE = "10"; this.AC = "55"; this.DE = "55"; } #endregion } #endregion #region DataCollector public class DataCollector { #region Field private Collection m_PassWeightData; private Collection m_OverWeightData; private Collection m_UnderWeightData; private Collection m_ExNgWeightData; private double m_PassAverage; private double m_PassVariance; #endregion #region Constructor public DataCollector() { this.Initialize(); } #endregion #region Porperty public Collection PassWeightData { get { return this.m_PassWeightData; } private set { this.m_PassWeightData = value; } } public Collection OverWeightData { get { return this.m_OverWeightData; } private set { this.m_OverWeightData = value; } } public Collection UnderWeightData { get { return this.m_UnderWeightData; } private set { this.m_UnderWeightData = value; } } public Collection 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); 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.0}", ((double)this.ExNgTotalCount / (double)this.TotalCount) * 100); ret = double.Parse(sValue); } return ret; } } #endregion #region Method private void Initialize() { this.PassWeightData = new Collection(); this.OverWeightData = new Collection(); this.UnderWeightData = new Collection(); this.ExNgWeightData = new Collection(); 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.0}", ((double)this.TotalExNgCount / (double)this.TotalCount) * 100); 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 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 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 datas) { bool ret = false; for (int i = 0; i < datas.Count; i++) { if (datas[i].IsOPT2 == 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 DataViewerFilter public class DataViewerFilter { #region Field private bool m_TpyeAlarm; private bool m_TypeOperation; private bool m_TypeParameter; #endregion #region Constructor public DataViewerFilter() { this.Initialize(); } #endregion #region Property public bool TpyeAlarm { get { return this.m_TpyeAlarm; } set { this.m_TpyeAlarm = 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.TpyeAlarm = true; this.TypeOperation = true; this.TypeParameter = true; } #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 DataBackupYear public class DataBackupYear { #region Field private string m_Year; public List 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(); } #endregion } #endregion #region DataBackupMonth public class DataBackupMonth { #region Field private string m_Month; public List 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(); } #endregion } #endregion #region FileHeaderItem public class FileHeaderItem { #region Field private int m_EquipmentColumns; 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 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 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 }