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); } } }
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(); }
private void txtReel_KeyDown(object sender, KeyEventArgs e) { labReelNo.Visible = false; labOK.Visible = false; txtReelQty.Text = ""; if (e.KeyCode == Keys.Down) { if (cobPartNo.SelectedIndex >= cobPartNo.Items.Count - 1) { cobPartNo.SelectedIndex = 0; return; } cobPartNo.SelectedIndex += 1; return; } if (e.KeyCode == Keys.Up) { if (cobPartNo.SelectedIndex == 0) { return; } cobPartNo.SelectedIndex -= 1; return; } if (e.KeyCode == Keys.Enter) { Model.FaLiaoReelNo reelNo = new Tsmt.Model.FaLiaoReelNo(); reelNo.CustType = WorkNo.CustType; reelNo.ReelNo = txtReel.Text.Trim(); reelNo.PartNo = cobPartNo.Text; reelNo.IssueSid = Convert.ToInt32(cobPartNo.SelectedValue); reelNo.UpdateEmp = Model.Uti.SajetNoSid; reelNo.WorkNo = txtWorkNo.Text; reelNo.PartNoYingFaQty = Convert.ToInt32(labYingFaQty.Text); reelNo.DeCode = txtDecode.Text; reelNo.PartNoSid = PartNoSid; try { string sendJson = JsonConvert.SerializeObject(reelNo); string receiveJson = Data.HttpHelp.HttpGet(Model.Uti.Url + "/FaLiao.asmx/GetReelNo?json=" + sendJson); Model.Result result = (Model.Result)JsonConvert.DeserializeObject(receiveJson, typeof(Model.Result)); if (result.Sid == 0) { MessageBox.Show(result.Message); txtReel.SelectAll(); return; } Model.FaLiaoReelNo receiveReelNo = (Model.FaLiaoReelNo)JsonConvert.DeserializeObject(result.Data.ToString(), typeof(Model.FaLiaoReelNo)); labFaQty.Text = (Convert.ToInt32(labFaQty.Text) + receiveReelNo.Qty) + ""; labNoFaQty.Text = (Convert.ToInt32(labNoFaQty.Text) + receiveReelNo.Qty) + ""; labFaPanQty.Text = (Convert.ToInt32(labFaPanQty.Text) + 1) + ""; txtReelQty.Text = receiveReelNo.Qty + ""; labReelNo.Text = receiveReelNo.ReelNo; labOK.Visible = true; labReelNo.Visible = true; txtReel.Text = ""; Model.FaLiaoPartNo mPartNo = WorkNo.FaLiaoPartNoList.Find((Model.FaLiaoPartNo partNo) => partNo.Sid == reelNo.IssueSid); mPartNo.YingFaQty = Convert.ToInt32(labYingFaQty.Text); mPartNo.YiFaQty = Convert.ToInt32(labFaQty.Text); mPartNo.WeiFaQty = Convert.ToInt32(labNoFaQty.Text); mPartNo.YiFaPan = Convert.ToInt32(labFaPanQty.Text); if (chkPartNo) { txtPartNo.Text = ""; txtPartNo.Focus(); } else { txtReel.Focus(); } } catch (Exception ex) { DAL.LED led = new Tsmt.DAL.LED(); led.SetLedStatus(DAL.LED.Status.ON, 500); MessageBox.Show(ex.Message); txtReel.SelectAll(); } } }