public ApplicationConfiguration()
        {
            try
            {
                CommonModel commonModel = ReadIhasFileData.getInstance();
                XDocument   config      = XDocument.Load("ApplicationConfig.xml");
                StationNumber    = commonModel.Station;
                Client           = commonModel.Client;
                RegistrationType = commonModel.RegisterType;
                SerialPort       = GetParameterValues(config, "SerialPort");
                BaudRate         = GetParameterValues(config, "BaudRate");
                Parity           = GetParameterValues(config, "Parity");
                StopBits         = GetParameterValues(config, "StopBits");
                DataBits         = GetParameterValues(config, "DataBits");
                NewLineSymbol    = GetParameterValues(config, "NewLineSymbol");
                High             = GetParameterValues(config, "High");
                Low                         = GetParameterValues(config, "Low");
                EndCommand                  = GetParameterValues(config, "EndCommand");
                DLExtractPattern            = GetParameterValues(config, "DLExtractPattern");
                MBNExtractPattern           = GetParameterValues(config, "MBNExtractPattern");
                EquipmentExtractPattern     = GetParameterValues(config, "EquipmentExtractPattern");
                OpacityValue                = GetParameterValues(config, "OpacityValue");
                LocationXY                  = GetParameterValues(config, "LocationXY");
                NoRead                      = GetParameterValues(config, "NoRead");
                LogFileFolder               = GetParameterValues(config, "LogFileFolder");
                LogTransOK                  = GetParameterValues(config, "LogTransOK");
                LogTransError               = GetParameterValues(config, "LogTransError");
                ChangeFileName              = GetParameterValues(config, "ChangeFileName");
                CheckListFolder             = GetParameterValues(config, "CheckListFolder");
                LoadExtractPattern          = GetParameterValues(config, "LoadExtractPattern");
                LogInType                   = GetParameterValues(config, "LogInType");
                Language                    = GetParameterValues(config, "Language");
                MDAPath                     = GetParameterValues(config, "MDAPath");
                IPAddress                   = GetParameterValues(config, "IPAddress");
                Port                        = GetParameterValues(config, "Port");
                FilterByFileName            = GetParameterValues(config, "FilterByFileName");
                FileNamePattern             = GetParameterValues(config, "FileNamePattern");
                RefreshWO                   = GetParameterValues(config, "RefreshWO");
                FILE_CLEANUP                = GetParameterValues(config, "FILE_CLEANUP");
                IPI_STATUS_CHECK            = GetParameterValues(config, "IPI_STATUS_CHECK");
                Production_Inspection_CHECK = GetParameterValues(config, "Production_Inspection_CHECK");
                //FILE_CLEANUP = GetParameterValues(config,"FILE_CLEANUP");
                FILE_CLEANUP_TREAD_TIMER = GetParameterValues(config, "FILE_CLEANUP_TREAD_TIMER");
                FILE_CLEANUP_FOLDER_TYPE = GetParameterValues(config, "FILE_CLEANUP_FOLDER_TYPE");
                LIGHT_CHANNEL_ON         = GetParameterValues(config, "LIGHT_CHANNEL_ON");
                LIGHT_CHANNEL_OFF        = GetParameterValues(config, "LIGHT_CHANNEL_OFF");
                IO_BOX_CONNECT           = GetParameterValues(config, "IO_BOX_CONNECT");
                ReduceEquType            = GetParameterValues(config, "ReduceEquType"); //config.Descendants("ReduceEquType").First().Value;
                StencilPrefix            = GetParameterValues(config, "StencilPrefix"); //config.Descendants("StencilPrefix").First().Value;
                if (IO_BOX_CONNECT != null && IO_BOX_CONNECT.Split(';').Length >= 6)
                {
                    string[] infos = IO_BOX_CONNECT.Split(';');
                    IOSerialPort = "COM" + infos[0];
                    IOBaudRate   = infos[1];
                    IOStopBits   = infos[4];
                    IODataBits   = infos[2];
                    IOParity     = infos[3];
                }
                OutputEnter         = GetParameterValues(config, "OutputEnter");
                DataOutputInterface = GetParameterValues(config, "DataOutputInterface");
                LAYER_DISPLAY       = GetParameterValues(config, "LAYER_DISPLAY");
                CHECKCONECTTIME     = GetParameterValues(config, "CHECKCONECTTIME");
                CEHCKTXTFILE        = GetParameterValues(config, "CEHCKTXTFILE");

                #region checklist
                CHECKLIST_IPAddress     = GetParameterValues(config, "CHECKLIST_IPAddress");
                CHECKLIST_Port          = GetParameterValues(config, "CHECKLIST_Port");
                CHECKLIST_SOURCE        = GetParameterValues(config, "CHECKLIST_SOURCE");
                AUTH_CHECKLIST_APP_TEAM = GetParameterValues(config, "AUTH_CHECKLIST_APP_TEAM");
                CHECKLIST_FREQ          = GetParameterValues(config, "CHECKLIST_FREQ");
                SHIFT_CHANGE_TIME       = GetParameterValues(config, "SHIFT_CHANGE_TIME");
                RESTORE_TIME            = GetParameterValues(config, "RESTORE_TIME");
                RESTORE_TREAD_TIMER     = GetParameterValues(config, "RESTORE_TREAD_TIMER");
                AUTH_TEAM = GetParameterValues(config, "AUTH_TEAM");
                #endregion
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }
        public ApplicationConfiguration(IMSApiSessionContextStruct sessionContext, MainView view)
        {
            try
            {
                dicConfig = new Dictionary <string, string>();
                ConfigManage configHandler = new ConfigManage(sessionContext, view);
                CommonModel  commonModel   = ReadIhasFileData.getInstance();
                if (commonModel.UpdateConfig == "L")
                {
                    XDocument config = XDocument.Load("ApplicationConfig.xml");
                    StationNumber    = commonModel.Station;
                    Client           = commonModel.Client;
                    RegistrationType = commonModel.RegisterType;
                    SerialPort       = GetParameterValues(config, "SerialPort");
                    BaudRate         = GetParameterValues(config, "BaudRate");
                    Parity           = GetParameterValues(config, "Parity");
                    StopBits         = GetParameterValues(config, "StopBits");
                    DataBits         = GetParameterValues(config, "DataBits");
                    NewLineSymbol    = GetParameterValues(config, "NewLineSymbol");
                    High             = GetParameterValues(config, "High");
                    Low                         = GetParameterValues(config, "Low");
                    EndCommand                  = GetParameterValues(config, "EndCommand");
                    DLExtractPattern            = GetParameterValues(config, "DLExtractPattern");
                    MBNExtractPattern           = GetParameterValues(config, "MBNExtractPattern");
                    EquipmentExtractPattern     = GetParameterValues(config, "EquipmentExtractPattern");
                    OpacityValue                = GetParameterValues(config, "OpacityValue");
                    LocationXY                  = GetParameterValues(config, "LocationXY");
                    NoRead                      = GetParameterValues(config, "NoRead");
                    LogFileFolder               = GetParameterValues(config, "LogFileFolder");
                    LogTransOK                  = GetParameterValues(config, "LogTransOK");
                    LogTransError               = GetParameterValues(config, "LogTransError");
                    ChangeFileName              = GetParameterValues(config, "ChangeFileName");
                    CheckListFolder             = GetParameterValues(config, "CheckListFolder");
                    LoadExtractPattern          = GetParameterValues(config, "LoadExtractPattern");
                    LogInType                   = GetParameterValues(config, "LogInType");
                    Language                    = GetParameterValues(config, "Language");
                    MDAPath                     = GetParameterValues(config, "MDAPath");
                    IPAddress                   = GetParameterValues(config, "IPAddress");
                    Port                        = GetParameterValues(config, "Port");
                    FileNamePattern             = GetParameterValues(config, "FileNamePattern");
                    FilterByFileName            = GetParameterValues(config, "FilterByFileName");
                    RefreshWO                   = GetParameterValues(config, "RefreshWO");
                    IPI_STATUS_CHECK            = GetParameterValues(config, "IPI_STATUS_CHECK");
                    Production_Inspection_CHECK = GetParameterValues(config, "Production_Inspection_CHECK");
                    FILE_CLEANUP                = GetParameterValues(config, "FILE_CLEANUP");
                    FILE_CLEANUP_TREAD_TIMER    = GetParameterValues(config, "FILE_CLEANUP_TREAD_TIMER");
                    FILE_CLEANUP_FOLDER_TYPE    = GetParameterValues(config, "FILE_CLEANUP_FOLDER_TYPE");
                    LIGHT_CHANNEL_ON            = GetParameterValues(config, "LIGHT_CHANNEL_ON");
                    LIGHT_CHANNEL_OFF           = GetParameterValues(config, "LIGHT_CHANNEL_OFF");
                    IO_BOX_CONNECT              = GetParameterValues(config, "IO_BOX_CONNECT");
                    ReduceEquType               = GetParameterValues(config, "ReduceEquType"); // config.Descendants("ReduceEquType").First().Value;
                    StencilPrefix               = GetParameterValues(config, "StencilPrefix"); //config.Descendants("StencilPrefix").First().Value;
                    if (IO_BOX_CONNECT != null && IO_BOX_CONNECT.Split(';').Length >= 6)
                    {
                        string[] infos = IO_BOX_CONNECT.Split(';');
                        IOSerialPort = "COM" + infos[0];
                        IOBaudRate   = infos[1];
                        IOStopBits   = infos[4];
                        IODataBits   = infos[2];
                        IOParity     = infos[3];
                    }
                    OutputEnter         = GetParameterValues(config, "OutputEnter");
                    DataOutputInterface = GetParameterValues(config, "DataOutputInterface");
                    LAYER_DISPLAY       = GetParameterValues(config, "LAYER_DISPLAY");
                    CHECKCONECTTIME     = GetParameterValues(config, "CHECKCONECTTIME");
                    CEHCKTXTFILE        = GetParameterValues(config, "CEHCKTXTFILE");

                    #region checklist
                    CHECKLIST_IPAddress     = GetParameterValues(config, "CHECKLIST_IPAddress");
                    CHECKLIST_Port          = GetParameterValues(config, "CHECKLIST_Port");
                    CHECKLIST_SOURCE        = GetParameterValues(config, "CHECKLIST_SOURCE");
                    AUTH_CHECKLIST_APP_TEAM = GetParameterValues(config, "AUTH_CHECKLIST_APP_TEAM");
                    CHECKLIST_FREQ          = GetParameterValues(config, "CHECKLIST_FREQ");
                    SHIFT_CHANGE_TIME       = GetParameterValues(config, "SHIFT_CHANGE_TIME");
                    RESTORE_TIME            = GetParameterValues(config, "RESTORE_TIME");
                    RESTORE_TREAD_TIMER     = GetParameterValues(config, "RESTORE_TREAD_TIMER");
                    AUTH_TEAM = GetParameterValues(config, "AUTH_TEAM");
                    #endregion
                }
                else
                {
                    if (commonModel.UpdateConfig == "Y")
                    {
                        //int error = configHandler.DeleteConfigParameters(commonModel.APPTYPE);
                        //if (error == 0 || error == -3303 || error == -3302)
                        //{
                        //    WriteParameterToiTac(configHandler);
                        //}
                        string[] parametersValue = configHandler.GetParametersForScope(commonModel.APPTYPE);
                        if (parametersValue != null && parametersValue.Length > 0)
                        {
                            foreach (var parameterID in parametersValue)
                            {
                                configHandler.DeleteConfigParametersExt(parameterID);
                            }
                        }
                        WriteParameterToiTac(configHandler);
                    }
                    List <ConfigEntity> getvalues = configHandler.GetConfigData(commonModel.APPID, commonModel.APPTYPE, commonModel.Cluster, commonModel.Station);
                    if (getvalues != null)
                    {
                        foreach (var item in getvalues)
                        {
                            if (item != null)
                            {
                                string[] strs = item.PARAMETER_NAME.Split(new char[] { '.' });
                                dicConfig.Add(strs[strs.Length - 1], item.CONFIG_VALUE);
                            }
                        }
                    }

                    StationNumber    = commonModel.Station;
                    Client           = commonModel.Client;
                    RegistrationType = commonModel.RegisterType;
                    SerialPort       = GetParameterValue("SerialPort");
                    BaudRate         = GetParameterValue("BaudRate");
                    Parity           = GetParameterValue("Parity");
                    StopBits         = GetParameterValue("StopBits");
                    DataBits         = GetParameterValue("DataBits");
                    NewLineSymbol    = GetParameterValue("NewLineSymbol");
                    High             = GetParameterValue("High");
                    Low                     = GetParameterValue("Low");
                    EndCommand              = GetParameterValue("EndCommand");
                    DLExtractPattern        = GetParameterValue("DLExtractPattern");
                    MBNExtractPattern       = GetParameterValue("MBNExtractPattern");
                    EquipmentExtractPattern = GetParameterValue("EquipmentExtractPattern");
                    OpacityValue            = GetParameterValue("OpacityValue");
                    LocationXY              = GetParameterValue("LocationXY");
                    ThawingDuration         = GetParameterValue("ThawingDuration");
                    ThawingCheck            = GetParameterValue("ThawingCheck");
                    LockTime                = GetParameterValue("LockOutTime");
                    UsageTime               = GetParameterValue("UsageDurationSetting");
                    GateKeeperTimer         = GetParameterValue("GateKeeperTimer");
                    SolderPasteValidity     = GetParameterValue("SolderPasteValidity");
                    OpenControlBox          = GetParameterValue("OpenControlBox");
                    StencilPrefix           = GetParameterValue("StencilPrefix");
                    TimerSpan               = GetParameterValue("TimerSpan");
                    StartTrigerStr          = GetParameterValue("StartTrigerStr");
                    EndTrigerStr            = GetParameterValue("EndTrigerStr");
                    NoRead                  = GetParameterValue("NoRead");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.Message, ex);
            }
        }
Exemple #3
0
        public ApplicationConfiguration()
        {
            try
            {
                CommonModel commonModel = ReadIhasFileData.getInstance();
                XDocument   config      = XDocument.Load("ApplicationConfig.xml");
                StationNumber    = commonModel.Station;
                Client           = commonModel.Client;
                RegistrationType = commonModel.RegisterType;
                SerialPort       = GetDescendants("SerialPort", config);                     //config.Descendants("SerialPort").First().Value;
                BaudRate         = GetDescendants("BaudRate", config);                       //config.Descendants("BaudRate").First().Value;
                Parity           = GetDescendants("Parity", config);                         //config.Descendants("Parity").First().Value;
                StopBits         = GetDescendants("StopBits", config);                       //config.Descendants("StopBits").First().Value;
                DataBits         = GetDescendants("DataBits", config);                       //config.Descendants("DataBits").First().Value;
                NewLineSymbol    = GetDescendants("NewLineSymbol", config);                  //config.Descendants("NewLineSymbol").First().Value;
                High             = GetDescendants("High", config);                           //config.Descendants("High").First().Value;
                Low                     = GetDescendants("Low", config);                     // config.Descendants("Low").First().Value;
                EndCommand              = GetDescendants("EndCommand", config);              //config.Descendants("EndCommand").First().Value;
                DLExtractPattern        = GetDescendants("DLExtractPattern", config);        //config.Descendants("DLExtractPattern").First().Value;
                MBNExtractPattern       = GetDescendants("MBNExtractPattern", config);       //config.Descendants("MBNExtractPattern").First().Value;
                EquipmentExtractPattern = GetDescendants("EquipmentExtractPattern", config); //config.Descendants("EquipmentExtractPattern").First().Value;
                OpacityValue            = GetDescendants("OpacityValue", config);            //config.Descendants("OpacityValue").First().Value;
                LocationXY              = GetDescendants("LocationXY", config);              //config.Descendants("LocationXY").First().Value;
                ThawingDuration         = GetDescendants("ThawingDuration", config);         //config.Descendants("ThawingDuration").First().Value;
                ThawingCheck            = GetDescendants("ThawingCheck", config);            //config.Descendants("ThawingCheck").First().Value;
                LockTime                = GetDescendants("LockOutTime", config);             // config.Descendants("LockOutTime").First().Value;
                UsageTime               = GetDescendants("UsageDurationSetting", config);    //config.Descendants("UsageDurationSetting").First().Value;
                GateKeeperTimer         = GetDescendants("GateKeeperTimer", config);         //config.Descendants("GateKeeperTimer").First().Value;
                SolderPasteValidity     = GetDescendants("SolderPasteValidity", config);     // config.Descendants("SolderPasteValidity").First().Value;
                OpenControlBox          = GetDescendants("OpenControlBox", config);          // config.Descendants("OpenControlBox").First().Value;
                StencilPrefix           = GetDescendants("StencilPrefix", config);           //config.Descendants("StencilPrefix").First().Value;
                TimerSpan               = GetDescendants("TimerSpan", config);               //config.Descendants("TimerSpan").First().Value;
                StartTrigerStr          = GetDescendants("StartTrigerStr", config);          //config.Descendants("StartTrigerStr").First().Value;
                EndTrigerStr            = GetDescendants("EndTrigerStr", config);            //config.Descendants("EndTrigerStr").First().Value;
                NoRead                  = GetDescendants("NoRead", config);                  //config.Descendants("NoRead").First().Value;
                LogFileFolder           = GetDescendants("LogFileFolder", config);           //config.Descendants("LogFileFolder").First().Value;
                LogTransOK              = GetDescendants("LogTransOK", config);              // config.Descendants("LogTransOK").First().Value;
                LogTransError           = GetDescendants("LogTransError", config);           // config.Descendants("LogTransError").First().Value;
                ChangeFileName          = GetDescendants("ChangeFileName", config);          //config.Descendants("ChangeFileName").First().Value;
                CheckListFolder         = GetDescendants("CheckListFolder", config);         //config.Descendants("CheckListFolder").First().Value;
                LoadExtractPattern      = GetDescendants("LoadExtractPattern", config);      // config.Descendants("LoadExtractPattern").First().Value;
                LogInType               = GetDescendants("LogInType", config);               //config.Descendants("LogInType").First().Value;
                Language                = GetDescendants("Language", config);                //config.Descendants("Language").First().Value;
                MDAPath                 = GetDescendants("MDAPath", config);                 //config.Descendants("MDAPath").First().Value;
                IPAddress               = GetDescendants("IPAddress", config);               //config.Descendants("IPAddress").First().Value;
                Port                    = GetDescendants("Port", config);                    //config.Descendants("Port").First().Value;
                ReduceEquType           = GetDescendants("ReduceEquType", config);           //config.Descendants("ReduceEquType").First().Value;
                UserTeam                = GetDescendants("AUTH_TEAM", config);               //config.Descendants("UserTeam").First().Value;

                FilterByFileName = GetDescendants("FilterByFileName", config);               //config.Descendants("FilterByFileName").First().Value;
                FileNamePattern  = GetDescendants("FileNamePattern", config);                //config.Descendants("FileNamePattern").First().Value;

                IPI_STATUS_CHECK          = GetDescendants("IPI_STATUS_CHECK", config);
                IPI_STATUS_CHECK_INTERVAL = GetDescendants("IPI_STATUS_CHECK_INTERVAL", config);
                WarningQty = GetDescendants("WarningQty", config);
                Authorized_Seria_Number_Transfer = GetDescendants("Authorized_Seria_Number_Transfer", config);
                Auto_Work_Order_Change           = GetDescendants("Auto_Work_Order_Change", config);
                IsNeedTransWO               = GetDescendants("IsNeedTransWO", config);
                SHIFT_CHANGE_TIME           = GetDescendants("SHIFT_CHANGE_TIME", config);
                Authorized_Allow_Production = GetDescendants("Authorized_Allow_Production", config);
                IsNeedProductionInspection  = GetDescendants("Production_Inspection_CHECK", config);

                RESTORE_TREAD_TIMER = GetDescendants("RESTORE_TREAD_TIMER", config);
                RESTORE_TIME        = GetDescendants("RESTORE_TIME", config);

                AutoNextMaterial = GetDescendants("MATERIAL_SPLICING", config);

                CHECKLIST_IPAddress     = GetDescendants("CHECKLIST_IPAddress", config);
                CHECKLIST_Port          = GetDescendants("CHECKLIST_Port", config);
                CHECKLIST_SOURCE        = GetDescendants("CHECKLIST_SOURCE", config);
                AUTH_CHECKLIST_APP_TEAM = GetDescendants("AUTH_CHECKLIST_APP_TEAM", config);
                CHECKLIST_FREQ          = GetDescendants("CHECKLIST_FREQ", config);

                LIGHT_CHANNEL_ON  = GetDescendants("LIGHT_CHANNEL_ON", config);
                LIGHT_CHANNEL_OFF = GetDescendants("LIGHT_CHANNEL_OFF", config);
                IO_BOX_CONNECT    = GetDescendants("IO_BOX_CONNECT", config);
                if (IO_BOX_CONNECT != null && IO_BOX_CONNECT.Split(';').Length >= 6)
                {
                    string[] infos = IO_BOX_CONNECT.Split(';');
                    IOSerialPort = "COM" + infos[0];
                    IOBaudRate   = infos[1];
                    IOStopBits   = infos[4];
                    IODataBits   = infos[2];
                    IOParity     = infos[3];
                }
                OutputEnter         = GetDescendants("OutputEnter", config);
                DataOutputInterface = GetDescendants("DataOutputInterface", config);
                LAYER_DISPLAY       = GetDescendants("DataOutputInterface", config);

                IPI_WORKORDERTYPE_CHECK = GetDescendants("IPI_WORKORDERTYPE_CHECK", config);
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }