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(); })); } }
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..."); }
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..."); }
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(); } })); } } }