示例#1
0
        private void txtStation_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar.ToString().Equals("\r"))
            {
                try
                {
                    if (txtStation.Text == "")
                    {
                        txtStation.Focus(); return;
                    }

                    string station = txtStation.Text.Trim().ToUpper();
                    switch (station)
                    {
                    case "QUIT":
                        Process.Start("shutdown.exe", "-s -t 10");
                        break;

                    case "EXIT":
                        this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                        this.Close();
                        break;

                    case "CANC":
                        txtBc.Focus();
                        txtBz.Text = "";
                        break;

                    default:
                        break;
                    }

                    DB.WriteConfigLocal("STATION_NAME", station);
                    LoginInfo.StationInfo   = StationFactory.GetBySTATIONNAME(station);
                    txtStation.Text         = "";
                    txtStation.PasswordChar = new char();
                    txtStation.Text         = LoginInfo.StationInfo.STATION_NAME;

                    if (txtBc.Text.Trim() == "" || txtBz.Text.Trim() == "" || txtUser.Text.Trim() == "" || txtStation.Text.Trim() == "")
                    {
                        return;
                    }
                    if (LoginInfo.StationInfo.STATION_TYPE != "ST05" && LoginInfo.TeamInfo.TEAM_NAME.Contains("修理班"))//非返修站点 但是返修班组 则认为顶岗扫描
                    {
                        CsGlobalClass.DGSM = true;
                    }
                    LoginInfo.ProductLineInfo = ProductLineFactory.GetByStationCode(LoginInfo.StationInfo.STATION_CODE);
                    string companycode  = LoginInfo.CompanyInfo.COMPANY_CODE;
                    string workshopcode = "";
                    string usercode     = LoginInfo.UserInfo.USER_CODE;
                    string plinecode    = LoginInfo.ProductLineInfo.RMES_ID;
                    string stationcode  = LoginInfo.StationInfo.STATION_CODE;
                    string shiftcode    = LoginInfo.ShiftInfo.SHIFT_CODE;
                    string groupcode    = LoginInfo.TeamInfo.TEAM_CODE;
                    string othercode    = "";
                    //string ip = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList.GetValue(0).ToString();
                    string ip      = GetLocalIP();
                    bool   logined = UserFactory.GetByFormAuth(usercode, "",
                                                               companycode, workshopcode, plinecode, stationcode, shiftcode, groupcode, othercode, ip, DB.GetServerTime().ToString());
                    if (logined)
                    {
                        this.DialogResult = System.Windows.Forms.DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(Rmes.Public.ErrorHandle.EH.LASTMSG, "验证失败!");
                    }
                }
                catch
                {
                    txtStation.Text            = "";
                    txtStation.SelectionStart  = 0;
                    txtStation.SelectionLength = txtBc.Text.Length;
                    txtStation.Focus();
                }
            }
        }