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;
                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;
                MaterialWarningQty      = GetDescendants("MaterialWarningQty", config);      // config.Descendants("MaterialWarningQty").First().Value;
                IPAdress                = GetDescendants("IPAdress", config);                // config.Descendants("IPAdress").First().Value;
                Port = GetDescendants("Port", config);                                       //config.Descendants("Port").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;
                CheckListFolder    = GetDescendants("CheckListFolder", config);              //config.Descendants("CheckListFolder").First().Value;
                MDAPath            = GetDescendants("MDAPath", config);                      //config.Descendants("MDAPath").First().Value;
                BJIPath            = GetDescendants("BJIPath", config);                      //config.Descendants("BJIPath").First().Value;
                BCIPath            = GetDescendants("BCIPath", config);                      //config.Descendants("BCIPath").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;
                WaitTime           = GetDescendants("WaitTime", config);                     //config.Descendants("WaitTime").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;
                BackupsOKFile      = GetDescendants("BackupsOKFile", config);                //config.Descendants("FileNamePattern").First().Value;

                PRINTER_MODE        = GetDescendants("OUTPUT_MODE", config);
                LABEL_TEMPLATE_PATH = GetDescendants("LABEL_TEMPLATE_PATH", config);
                LABEL_TEMPLATE_FILE = GetDescendants("LABEL_TEMPLATE_FILE", config);
                DEFAULT_LABLE       = GetDescendants("DEFAULT_LABLE", config);
                PrintSerialPort     = GetDescendants("PrintSerialPort", config);
                PrintBaudRate       = GetDescendants("PrintBaudRate", config);
                PrintParity         = GetDescendants("PrintParity", config);
                PrintStopBits       = GetDescendants("PrintStopBits", config);
                PrintDataBits       = GetDescendants("PrintDataBits", config);
                PrintNewLineSymbol  = GetDescendants("PrintNewLineSymbol", config);
                LABEL_QTY           = GetDescendants("LABEL_QTY", config);
                AutoNextMaterial    = GetDescendants("MATERIAL_SPLICING", config);
                LAYER_DISPLAY       = GetDescendants("LAYER_DISPLAY", 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);
                SHIFT_CHANGE_TIME       = GetDescendants("SHIFT_CHANGE_TIME", config);
                RESTORE_TIME            = GetDescendants("RESTORE_TIME", config);
                RESTORE_TREAD_TIMER     = GetDescendants("RESTORE_TREAD_TIMER", config);
                BAD_BOARD_AUTO_RESET    = GetDescendants("BAD_BOARD_AUTO_RESET", config);
                UPLOAD_NG_MODE          = GetDescendants("UPLOAD_NG_MODE", config);
            }
            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              = 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;
                    MBNExtractPattern       = GetDescendants("MBNExtractPattern", config);       //config.Descendants("MBNExtractPattern").First().Value;
                    OpacityValue            = GetDescendants("OpacityValue", config);            // config.Descendants("OpacityValue").First().Value;
                    LocationXY              = GetDescendants("LocationXY", config);              // config.Descendants("LocationXY").First().Value;
                    MaterialWarningQty      = GetDescendants("MaterialWarningQty", config);      //config.Descendants("MaterialWarningQty").First().Value;
                    EquipmentExtractPattern = GetDescendants("EquipmentExtractPattern", config); // config.Descendants("EquipmentExtractPattern").First().Value;
                    IPAdress                = GetDescendants("IPAdress", config);                //config.Descendants("IPAdress").First().Value;
                    Port = GetDescendants("Port", config);                                       // config.Descendants("Port").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;
                    CheckListFolder    = GetDescendants("CheckListFolder", config);              //config.Descendants("CheckListFolder").First().Value;
                    MDAPath            = GetDescendants("MDAPath", config);                      //config.Descendants("MDAPath").First().Value;
                    BJIPath            = GetDescendants("BJIPath", config);                      // config.Descendants("BJIPath").First().Value;
                    BCIPath            = GetDescendants("BCIPath", config);                      //config.Descendants("BCIPath").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;
                    WaitTime           = GetDescendants("WaitTime", config);                     //config.Descendants("WaitTime").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;
                    BackupsOKFile      = GetDescendants("BackupsOKFile", config);                //config.Descendants("FileNamePattern").First().Value;

                    PRINTER_MODE        = GetDescendants("OUTPUT_MODE", config);
                    LABEL_TEMPLATE_PATH = GetDescendants("LABEL_TEMPLATE_PATH", config);
                    LABEL_TEMPLATE_FILE = GetDescendants("LABEL_TEMPLATE_FILE", config);
                    DEFAULT_LABLE       = GetDescendants("DEFAULT_LABLE", config);
                    PrintSerialPort     = GetDescendants("PrintSerialPort", config);
                    PrintBaudRate       = GetDescendants("PrintBaudRate", config);
                    PrintParity         = GetDescendants("PrintParity", config);
                    PrintStopBits       = GetDescendants("PrintStopBits", config);
                    PrintDataBits       = GetDescendants("PrintDataBits", config);
                    PrintNewLineSymbol  = GetDescendants("PrintNewLineSymbol", config);
                    LABEL_QTY           = GetDescendants("LABEL_QTY", config);
                    AutoNextMaterial    = GetDescendants("MATERIAL_SPLICING", config);
                    LAYER_DISPLAY       = GetDescendants("LAYER_DISPLAY", 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);
                    SHIFT_CHANGE_TIME       = GetDescendants("SHIFT_CHANGE_TIME", config);
                    RESTORE_TIME            = GetDescendants("RESTORE_TIME", config);
                    RESTORE_TREAD_TIMER     = GetDescendants("RESTORE_TREAD_TIMER", config);
                    BAD_BOARD_AUTO_RESET    = GetDescendants("BAD_BOARD_AUTO_RESET", config);
                    UPLOAD_NG_MODE          = GetDescendants("UPLOAD_NG_MODE", config);
                }
                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);
                                LogHelper.Info(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");
                    MBNExtractPattern  = GetParameterValue("MBNExtractPattern");
                    OpacityValue       = GetParameterValue("OpacityValue");
                    LocationXY         = GetParameterValue("LocationXY");
                    MaterialWarningQty = GetParameterValue("MaterialWarningQty");
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex.Message, ex);
            }
        }
Пример #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);
            }
        }