Esempio n. 1
0
        private void txtWorkNo_KeyDown(object sender, KeyEventArgs e)
        {
            info();

            if (e.KeyCode == Keys.Enter)
            {
                string sendJson = txtWorkNo.Text.Trim();

                try
                {
                    string receiveJson = Data.HttpHelp.HttpGet(Model.Uti.Url + "/FaLiao.asmx/GetWorkNo?json=" + sendJson);

                    Model.Result result = (Model.Result)JsonConvert.DeserializeObject(receiveJson, typeof(Model.Result));
                    if (result.Sid == 0)
                    {
                        DAL.LED led = new DAL.LED();
                        led.SetLedStatus(DAL.LED.Status.ON, 500);//震动500毫秒
                        MessageBox.Show(result.Message);
                        return;
                    }

                    WorkNo = (Model.FaLiaoWorkNo)JsonConvert.DeserializeObject(result.Data.ToString(), typeof(Model.FaLiaoWorkNo));

                    #region "机种列表赋值"
                    DataTable dt = new DataTable();
                    dt.Columns.Add("f001");
                    dt.Columns.Add("f002");
                    foreach (Model.FaLiaoPartNo item in WorkNo.FaLiaoPartNoList)
                    {
                        DataRow dr = dt.NewRow();
                        dr["f001"] = item.Sid;
                        dr["f002"] = item.PartNo;
                        dt.Rows.Add(dr);
                    }
                    cobPartNo.SelectedIndexChanged -= cobPartNo_SelectedIndexChanged;
                    cobPartNo.DataSource            = dt;
                    cobPartNo.DisplayMember         = "f002";
                    cobPartNo.ValueMember           = "f001";
                    cobPartNo.SelectedIndex         = -1;
                    cobPartNo.SelectedIndexChanged += cobPartNo_SelectedIndexChanged;

                    cobPartNo.Focus();
                    #endregion

                    cobPartNo.Focus();
                }
                catch (Exception ex)
                {
                    DAL.LED led = new DAL.LED();
                    led.SetLedStatus(DAL.LED.Status.ON, 500);//震动500毫秒
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 2
0
        private void AccLogin()
        {
            DateTime beginDT = DateTime.Now;

            Model.User user = new Model.User();
            user.UserNo   = txtUser.Text;
            user.PassWord = txtPassWord.Text;

            string sendJson = JsonConvert.SerializeObject(user).ToString();     //序列号对象

            string receiveJson = Data.HttpHelp.HttpGet(Model.Uti.Url + "/Account.asmx/GetAccount?json=" + sendJson);

            Model.Result result = (Model.Result)JsonConvert.DeserializeObject(receiveJson, typeof(Model.Result));

            if (result == null)
            {
                DAL.LED led = new DAL.LED();
                led.SetLedStatus(DAL.LED.Status.ON, 500);//震动毫秒

                return;
            }
            else
            {
                user = (Model.User)JsonConvert.DeserializeObject(result.Data.ToString(), typeof(Model.User));
                //user = (Model.User)result.Data;
                if (result.Sid == 0)
                {
                    MessageBox.Show(result.Message);
                    DAL.LED led = new DAL.LED();
                    led.SetLedStatus(DAL.LED.Status.ON, 500);//震动500毫秒

                    return;
                }
            }


            Model.Uti.Name       = user.Name;
            Model.Uti.UserNo     = user.UserNo;
            Model.Uti.UserNoSid  = user.SFCSid;
            Model.Uti.SajetNoSid = user.SajetSid;

            if (main == null)
            {
                main = new UI.Main(this);
            }
            //DateTime endDT = DateTime.Now;
            //string k = (endDT - beginDT).ToString();
            //MessageBox.Show(k + "");
            this.Hide();
            main.Show();
        }