Пример #1
0
        private static bool itacLogin(string stationNumber, string stationPassword, string user, string password, string client, string registrationType, string systemIdentifier)
        {
            Logger.Log.Info((object)string.Format("itacLogin(): method called called."));
            IMSApiSessionValidationStruct validationStruct     = new IMSApiSessionValidationStruct();
            IMSApiSessionContextStruct    sessionContextStruct = (IMSApiSessionContextStruct)null;

            validationStruct.stationNumber    = stationNumber;
            validationStruct.stationPassword  = stationPassword;
            validationStruct.user             = user;
            validationStruct.password         = password;
            validationStruct.client           = client;
            validationStruct.registrationType = registrationType;
            validationStruct.systemIdentifier = systemIdentifier;
            int  resultValue = ItacFunctions._imsapi.regLogin(validationStruct, out sessionContextStruct);
            bool flag;

            if (resultValue != 0)
            {
                Logger.Log.Error((object)"itacLogin(): _imsapi.regLogin failed.");
                ItacFunctions.printErrorText(resultValue);
                flag = false;
            }
            else
            {
                ItacFunctions._sessionContext = sessionContextStruct;
                flag = true;
            }
            Logger.Log.Info((object)string.Format("itacLogin(): return with {0}", (object)flag));
            return(flag);
        }
Пример #2
0
        public SessionContextHeandler(ApplicationConfiguration config, LoginForm mainView)
        {
            this.mainView           = mainView;
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = config.StationNumber;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = "";
            sessionValidationStruct.password         = "";
            sessionValidationStruct.client           = config.Client;
            sessionValidationStruct.registrationType = config.RegistrationType;
            sessionValidationStruct.systemIdentifier = config.StationNumber;

            initResult = imsapi.imsapiInit();

            if (initResult != 0)
            {
                mainView.SetStatusLabelText("Conncection to DMS failed", 1);
                mainView.isCanLogin = false;
                LogHelper.Info("Conncection to DMS failed");
            }
            else
            {
                mainView.SetStatusLabelText("Conncection to DMS established", 0);
                mainView.isCanLogin = true;
                LogHelper.Info("Conncection to DMS established");
            }
        }
Пример #3
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //添加你初始化的代码
            res = new LanguageResources();
            CommonModel commonModel = ReadIhasFileData.getInstance();

            if (!isCanLogin)
            {
                sessionContextHandler = new SessionContextHeandler(null, this);
            }
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = commonModel.Station;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = this.txtUserName.Text.Trim();
            sessionValidationStruct.password         = this.txtPassword.Text.Trim();
            sessionValidationStruct.client           = commonModel.Client;
            sessionValidationStruct.registrationType = commonModel.RegisterType;
            sessionValidationStruct.systemIdentifier = commonModel.Station;
            UserName = this.txtUserName.Text.Trim();

            LoginResult = imsapi.regLogin(sessionValidationStruct, out sessionContext);
            if (LoginResult == 0)
            {
                LogHelper.Info("api regLogin.(error code=" + LoginResult + ")");
            }
            else
            {
                LogHelper.Error("api regLogin.(error code=" + LoginResult + ")");
            }
            LogHelper.Info("Login end...");
            if (LoginResult != IMSApiDotNetConstants.RES_OK)
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    SetStatusLabelText("api regLogin error.(error code=" + LoginResult + ")", 1);
                    SetControlStatus(true);
                }));
                return;
            }
            else
            {
                //add by qy 160614
                if (!VerifyUserTeam())
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        SetControlStatus(true);
                    }));
                    return;
                }
                this.Invoke(new MethodInvoker(delegate
                {
                    this.Hide();
                    CloseSP();                                                                                //add by qy
                    MainView view = new MainView(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext); //edit by qy
                    view.ShowDialog();
                }));
            }
        }
Пример #4
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //添加你初始化的代码
            config = new ApplicationConfiguration();
            if (!isCanLogin)
            {
                sessionContextHandler = new SessionContextHeandler(config, this);
            }
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = config.StationNumber;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = this.txtUserName.Text.Trim();
            sessionValidationStruct.password         = this.txtPassword.Text.Trim();
            sessionValidationStruct.client           = config.Client;
            sessionValidationStruct.registrationType = config.RegistrationType;
            sessionValidationStruct.systemIdentifier = config.StationNumber;
            UserName = this.txtUserName.Text.Trim();

            LoginResult = imsapi.regLogin(sessionValidationStruct, out sessionContext);

            if (LoginResult != IMSApiDotNetConstants.RES_OK)
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    SetStatusLabelText("api regLogin error.(result code=" + LoginResult + ")", 1);
                    SetControlStatus(true);
                }));
                return;
            }
            else
            {
                LogHelper.Info("api regLogin success.(result code=" + LoginResult + ")");
                if (!VerifyTeamNumber())
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        SetStatusLabelText("验证Team number失败", 1);
                        SetControlStatus(true);
                    }));
                    return;
                }
                this.Invoke(new MethodInvoker(delegate
                {
                    this.Hide();
                    //指定要跳转的窗体
                    //FinishPorductionForm view = new FinishPorductionForm(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext, config);
                    //UIDRelationUserReport view = new UIDRelationUserReport();
                    //IQCForm view = new IQCForm(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext, config);
                    //ProductionForm view = new ProductionForm(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext, config);
                    //CreateLocator view = new CreateLocator(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext, config);
                    TransFujiZfile view = new TransFujiZfile(sessionContext);

                    view.ShowDialog();
                }));
            }
            LogHelper.Info("Login end...");
        }
Пример #5
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //添加你初始化的代码
            res = new LanguageResources();
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = config.StationNumber;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = this.txtUserName.Text.Trim();
            sessionValidationStruct.password         = this.txtPassword.Text.Trim();
            sessionValidationStruct.client           = config.Client;
            sessionValidationStruct.registrationType = config.RegistrationType;
            sessionValidationStruct.systemIdentifier = config.StationNumber;
            UserName = this.txtUserName.Text.Trim();

            LoginResult = imsapi.regLogin(sessionValidationStruct, out sessionContext);
            if (LoginResult == 0)
            {
                LogHelper.Info("api regLogin.(error code=" + LoginResult + ")");
            }
            else
            {
                LogHelper.Error("api regLogin.(error code=" + LoginResult + ")");
            }
            LogHelper.Info("Login end...");
            if (LoginResult != IMSApiDotNetConstants.RES_OK)
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    SetStatusLabelText("Api regLogin error(error code=" + LoginResult + ")", 1);
                    SetControlStatus(true);
                }));
                return;
            }
            else
            {
                if (!VerifyTeamNumber())
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        SetStatusLabelText("User not belong to the userteam.[" + config.AUTH_TEAM + "]", 1);
                        SetControlStatus(true);
                    }));
                    return;
                }
                this.Invoke(new MethodInvoker(delegate
                {
                    if (config.LogInType == "COM" && serialPort.IsOpen)
                    {
                        serialPort.Close();
                    }
                    this.DialogResult   = DialogResult.OK;
                    view.isFormOutPoump = false;
                    this.Close();
                }));
            }
        }
Пример #6
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //添加你初始化的代码
            res    = new LanguageResources();
            config = new ApplicationConfiguration();
            if (!isCanLogin)
            {
                sessionContextHandler = new SessionContextHeandler(config, this);
            }
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = config.StationNumber;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = this.txtUserName.Text.Trim();
            sessionValidationStruct.password         = this.txtPassword.Text.Trim();
            sessionValidationStruct.client           = config.Client;
            sessionValidationStruct.registrationType = config.RegistrationType;
            sessionValidationStruct.systemIdentifier = config.StationNumber;
            UserName = this.txtUserName.Text.Trim();

            LoginResult = imsapi.regLogin(sessionValidationStruct, out sessionContext);

            if (LoginResult != IMSApiDotNetConstants.RES_OK)
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    SetStatusLabelText("api regLogin error.(result code=" + LoginResult + ")", 1);
                    SetControlStatus(true);
                }));
                return;
            }
            else
            {
                LogHelper.Info("api regLogin success.(result code=" + LoginResult + ")");
                if (!VerifyTeamNumber())
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        SetStatusLabelText("验证Team number失败", 1);
                        SetControlStatus(true);
                    }));
                    return;
                }
                this.Invoke(new MethodInvoker(delegate
                {
                    this.Hide();
                    MainView view = new MainView(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext, config);
                    view.ShowDialog();
                }));
            }
            LogHelper.Info("Login end...");
        }
Пример #7
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //添加你初始化的代码
            res = new LanguageResources();
            CommonModel commonModel = ReadIhasFileData.getInstance();

            if (!isCanLogin)
            {
                if (logintype == 0)
                {
                    sessionContextHandler = new SessionContextHeandler(null, this);
                }
            }
            sessionValidationStruct = new IMSApiSessionValidationStruct();
            sessionValidationStruct.stationNumber    = commonModel.Station;
            sessionValidationStruct.stationPassword  = "";
            sessionValidationStruct.user             = this.txtUserName.Text.Trim();
            sessionValidationStruct.password         = this.txtPassword.Text.Trim();
            sessionValidationStruct.client           = commonModel.Client;
            sessionValidationStruct.registrationType = commonModel.RegisterType;
            sessionValidationStruct.systemIdentifier = commonModel.Station;
            UserName = this.txtUserName.Text.Trim();

            LoginResult = imsapi.regLogin(sessionValidationStruct, out sessionContext);
            if (LoginResult == 0)
            {
                LogHelper.Info("api regLogin.(error code=" + LoginResult + ")");
            }
            else
            {
                LogHelper.Error("api regLogin.(error code=" + LoginResult + ")");
            }
            LogHelper.Info("Login end...");
            if (LoginResult != IMSApiDotNetConstants.RES_OK)
            {
                this.Invoke(new MethodInvoker(delegate
                {
                    SetStatusLabelText("api regLogin error.(error code=" + LoginResult + ")", 1);
                    SetControlStatus(true);
                }));
                return;
            }
            else
            {
                if (logintype == 0)
                {
                    //add by qy 160614
                    if (!VerifyUserTeam())
                    {
                        this.Invoke(new MethodInvoker(delegate
                        {
                            SetControlStatus(true);
                        }));
                        return;
                    }
                    this.Invoke(new MethodInvoker(delegate
                    {
                        this.Hide();
                        if (config.LogInType == "COM" && serialPort.IsOpen)
                        {
                            serialPort.Close();
                        }
                        MainView view = new MainView(this.txtUserName.Text.Trim(), DateTime.Now, sessionContext);
                        view.ShowDialog();
                    }));
                }
                else
                {
                    if (!VerifyUserTeam())
                    {
                        this.Invoke(new MethodInvoker(delegate
                        {
                            SetControlStatus(true);
                        }));
                        return;
                    }
                    this.Invoke(new MethodInvoker(delegate
                    {
                        this.Hide();
                        if (logintype == 1)
                        {
                            if (!form.AddTransWO())
                            {
                                return;
                            }
                            form.errorHandler(0, form.Message("msg_add trans wo success"), "");
                        }
                        else if (logintype == 2)
                        {
                            if (!form.RemoveTransWO(RemoveWO))
                            {
                                return;
                            }
                            form.InitGetHasTransWO();
                            form.errorHandler(0, form.Message("msg_remove trans wo success"), "");
                        }
                        else if (logintype == 3)
                        {
                            form.ResetIPIStatus();
                        }
                        else if (logintype == 4) //班长确认
                        {
                            form.SupervisorConfirm(this.txtUserName.Text.Trim());
                        }
                        else if (logintype == 5) //IPQC确认
                        {
                            form.IPQCConfirm(this.txtUserName.Text.Trim());
                        }
                        if (config.LogInType == "COM" && serialPort.IsOpen)
                        {
                            serialPort.Close();
                            form.OpenScanPort();
                        }
                    }));
                }
            }
        }