private void btnOK_Click(object sender, EventArgs e) { int _int; _int = dataGrid1.CurrentCell.RowNumber; if (_int < 0) { return; } if (m != null) { if (_int > m.data.Count) { return; } mbody = m.data[_int]; } this.Close(); }
private void txtbarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txtbarcode.Text = ""; this.txtbarcode.Enabled = false; this.txtorderid.Enabled = true; this.txtorderid.Text = ""; this.txtorderid.Focus(); } Model.Mmaterialcode m = null; if (e.KeyChar != 13) { return; } try { Cursor.Current = Cursors.WaitCursor; string x = HttpHelper.HttpPost("getMaterialCode", @"barCode=" + this.txtbarcode.Text + "&lcCode=" + Comm.lcCode); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } m = (Model.Mmaterialcode)JsonConvert.DeserializeObject(x, typeof(Model.Mmaterialcode)); if (m == null) { throw new Exception("数据信息捕捉失败"); } if (m.data.Count == 0 || m.data[0].code == null) { throw new Exception("没有该商品码对应的数据"); } Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); this.txtbarcode.SelectAll(); return; } for (int i = m.data.Count - 1; i >= 0; i--) { if (m.data[i].code != mp.data.materialCode) { m.data.RemoveAt(i); } } if (m.data.Count > 1) { Ot.frmMaterial frm = new Rf_Wms.Ot.frmMaterial(); frm.m = m; frm.ShowDialog(); if (frm.mbody != null) { materialbody = frm.mbody; } } else if (m.data.Count == 0) { MessageBox.Show("单据中不存在该商品码的信息"); this.txtbarcode.SelectAll(); return; } else { materialbody = m.data[0]; } if (materialbody != null) { //this.labmaterialname.Text = materialbody.name; //this.labcommonUnit.Text = materialbody.commonUnit; //this.labminunit.Text = materialbody.minUnit; } else { this.txtbarcode.SelectAll(); return; } try { Convert.ToInt32(materialbody.spec); } catch (Exception) { MessageBox.Show("请检查规则字段是不是int"); this.txtbarcode.SelectAll(); return; } this.txtbarcode.Enabled = false; this.txttraycode.Enabled = true; this.txttraycode.Focus(); }
private void txtbarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txtbarcode.Text = ""; this.txtbarcode.Enabled = false; this.txttraycode.Enabled = true; this.txttraycode.Text = ""; this.txttraycode.Focus(); } Model.Mmaterialcode m = null; if (e.KeyChar != 13) { return; } try { Cursor.Current = Cursors.WaitCursor; string x = HttpHelper.HttpPost("getMaterialCode", @"barCode=" + this.txtbarcode.Text + "&lcCode=" + Comm.lcCode + "&shipperCode=" + stockin.data.shipperInfo.shipperCode + "&whId=" + Comm.warehousecode); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } m = (Model.Mmaterialcode)JsonConvert.DeserializeObject(x, typeof(Model.Mmaterialcode)); if (m == null) { throw new Exception("数据信息捕捉失败"); } if (m.data.Count == 0 || m.data[0].code == null) { throw new Exception("没有该条码对应的数据"); } Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; this.txtbarcode.Text = ""; MessageBox.Show(ex.Message); return; } for (int i = m.data.Count - 1; i >= 0; i--) { bool ih = false; foreach (Model.material x in stockin.data.materialList) { if (x.materialCode == m.data[i].code) { ih = true; break; } } if (!ih) { m.data.RemoveAt(i); } } if (m.data.Count > 1) { Ot.frmMaterial frm = new Rf_Wms.Ot.frmMaterial(); frm.m = m; frm.ShowDialog(); if (frm.mbody != null) { materialbody = frm.mbody; } } else if (m.data.Count == 0) { MessageBox.Show("单据中不存在该条码的信息"); return; } else { materialbody = m.data[0]; } if (materialbody != null) { this.labmaterialcode.Text = materialbody.code; this.labmaterialname.Text = materialbody.name; this.labcommonUnit.Text = materialbody.commonUnit; this.labminunit.Text = materialbody.minUnit; } else { this.txtbarcode.SelectAll(); return; } //var b = from x in stockin.data.materialList where x.materialCode == materialbody.code select x; //if (b.Count() != 0) //{ // batchno = b.First().batchNo; //} //else //{ // batchno = null; //} //17-02-16 try { Convert.ToInt32(materialbody.spec); } catch (Exception) { MessageBox.Show("请检查规则字段是不是int"); this.txtbarcode.SelectAll(); return; } try { Cursor.Current = Cursors.WaitCursor; GetMaterialStockInOrder(); Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } if (mm == null || mm.data == null || string.IsNullOrEmpty(mm.data.boxcode)) { if (!isNew) { this.txtbarcode.Enabled = false; this.dtdate.Enabled = true; this.dtdate.Focus(); } else { //this.cbisqt.Enabled = true; //this.cbisqt.Focus(); this.txtbarcode.Enabled = false; dtdate.Enabled = true; dtdate.Focus(); } } else { this.txtbarcode.Enabled = false; this.txtbatch.Enabled = true; this.txtbatch.Focus(); //this.cmbmaterialCondition.Enabled = true; //this.cmbmaterialCondition.Focus(); //this.txtcommonqty.Enabled = true; //this.txtcommonqty.Focus(); } }
private void txtbarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txtbarcode.Text = ""; this.txtbarcode.Enabled = false; this.cmbtoslname.Enabled = true; this.txttoslname.Enabled = true; this.txttoslname.Text = ""; this.txttoslname.Focus(); } Model.Mmaterialcode m = null; if (e.KeyChar != 13) { return; } if (this.txtbarcode.Text == "") { return; } try { Cursor.Current = Cursors.WaitCursor; string x = HttpHelper.HttpPost("getMaterialCode", @"barCode=" + this.txtbarcode.Text + "&lcCode=" + Comm.lcCode); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } m = (Model.Mmaterialcode)JsonConvert.DeserializeObject(x, typeof(Model.Mmaterialcode)); if (m == null) { throw new Exception("数据信息捕捉失败"); } if (m.data.Count == 0 || m.data[0].code == null) { throw new Exception("没有该条码对应的数据"); } Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); this.txtbarcode.SelectAll(); return; } Model.Mmaterialcodebody materialbody = null; if (m.data.Count > 1) { Ot.frmMaterial frm = new Rf_Wms.Ot.frmMaterial(); frm.m = m; frm.ShowDialog(); if (frm.mbody != null) { materialbody = frm.mbody; } } else { materialbody = m.data[0]; } if (materialbody != null) { try { Cursor.Current = Cursors.WaitCursor; string x = HttpHelper.HttpPost("getlocationStockList", @"&whId=" + Comm.warehousecode + "&lcCode=" + Comm.lcCode + "&materialCode=" + materialbody.code + "&slId=" + this.cmbtoslname.SelectedValue.ToString()); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } ml = (Model.locationStockList)JsonConvert.DeserializeObject(x, typeof(Model.locationStockList)); if (ml == null) { throw new Exception("数据信息捕捉失败"); } if (ml.data.Count == 0) { throw new Exception("未找到待转储库存"); } row = 0; Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; this.txtbarcode.SelectAll(); MessageBox.Show(ex.Message); return; } } else { this.txtbarcode.SelectAll(); return; } showTxt(); this.txtbarcode.Enabled = false; this.txtminqty.Enabled = true; this.txtminqty.Focus(); //this.txtcommonqty.Enabled = true; //this.txtcommonqty.Focus(); }
private void txtbarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar != 13) { return; } if (string.IsNullOrEmpty(this.txtbarcode.Text)) { return; } try { Cursor.Current = Cursors.WaitCursor; string x = HttpHelper.HttpPost("getMaterialCode", @"barCode=" + this.txtbarcode.Text + "&lcCode=" + Comm.lcCode); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } m = (Model.Mmaterialcode)JsonConvert.DeserializeObject(x, typeof(Model.Mmaterialcode)); if (m == null) { throw new Exception("数据信息捕捉失败"); } if (m.data.Count == 0 || m.data[0].code == null) { throw new Exception("没有该条码对应的数据"); } Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; this.txtbarcode.SelectAll(); MessageBox.Show(ex.Message); return; } for (int i = m.data.Count - 1; i >= 0; i--) { bool ih = false; foreach (Model.pickOperateSecondarySortingRFDTOSs v in mss.data.pickOperateSecondarySortingRFDTOS) { if (v.materialCode == m.data[i].code) { ih = true; break; } } if (!ih) { m.data.RemoveAt(i); } } if (m.data.Count > 1) { Ot.frmMaterial frm = new Rf_Wms.Ot.frmMaterial(); frm.m = m; frm.ShowDialog(); if (frm.mbody != null) { materialbody = frm.mbody; } else { //MessageBox.Show("请选择商品"); this.txtbarcode.Focus(); this.txtbarcode.SelectAll(); return; } } else if (m.data.Count == 0) { MessageBox.Show("单据中不存在该条码的信息"); this.txtbarcode.Text = ""; return; } else { materialbody = m.data[0]; } foreach (Model.pickOperateSecondarySortingRFDTOSs v in mss.data.pickOperateSecondarySortingRFDTOS) { if (v.materialCode == materialbody.code) { pickdetails = v; break; } } ShowTxt(); this.txtcommonqty.Enabled = true; this.txtbarcode.Enabled = false; this.txtcommonqty.Focus(); }
private void txtbarcode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txtbarcode.Text = ""; this.txtbarcode.Enabled = false; this.txtSlId.Enabled = true; this.txtSlId.Text = ""; this.txtSlId.Focus(); } Model.Mmaterialcode m = null; if (e.KeyChar != 13) { return; } try { string x = HttpHelper.HttpPost("getMaterialCode", @"barCode=" + this.txtbarcode.Text + "&lcCode=" + Comm.lcCode); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } m = (Model.Mmaterialcode)JsonConvert.DeserializeObject(x, typeof(Model.Mmaterialcode)); if (m == null) { throw new Exception("数据信息捕捉失败"); } if (m.data.Count == 0 || m.data[0].code == null) { throw new Exception("没有该条码对应的数据"); } } catch (Exception ex) { MessageBox.Show(ex.Message); this.txtbarcode.SelectAll(); return; } for (int i = m.data.Count - 1; i >= 0; i--) { if (m.data[i].code != mc.data.materialCode) { m.data.RemoveAt(i); } } if (m.data.Count == 0) { MessageBox.Show("该库位没有该条码物料"); this.txtbarcode.SelectAll(); return; } else { materialbody = m.data[0]; } if (materialbody != null) { //this.labmaterialname.Text = materialbody.name; //this.labcommonUnit.Text = materialbody.commonUnit; //this.labminunit.Text = materialbody.minUnit; } else { this.txtbarcode.SelectAll(); return; } this.txtbarcode.Enabled = false; this.txtcommonqty.Enabled = true; this.txtcommonqty.Focus(); }