private void txttraycode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txttraycode.Text = ""; this.txttraycode.Enabled = false; //this.txtSlId.Enabled = true; //this.txtSlId.Text = ""; //this.txtSlId.Focus(); mtrans = null; this.labmaterialname.Text = ""; this.labneedqty.Text = ""; this.labfromsIId.Text = ""; this.txtorderid.Enabled = true; this.txtorderid.Text = ""; this.txtorderid.Focus(); return; } if (e.KeyChar != 13) { return; } if (this.txttraycode.Text == "") { return; } //this.txttraycode.Text = this.txttraycode.Text.ToUpper(); //Model.MTrayByBox mm = null; //if (this.txttraycode.Text.Length < Comm.lcCode.Length || Comm.lcCode != this.txttraycode.Text.Substring(0, Comm.lcCode.Length)) //{ // try // { // string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txttraycode.Text + "&lcCode=" + Comm.lcCode + "&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); // mm = (Model.MTrayByBox)JsonConvert.DeserializeObject(x, typeof(Model.MTrayByBox)); // if (mm == null) // throw new Exception("错误信息捕捉失败"); // this.txttraycode.Text = mm.data; // } // catch (Exception ex) // { // this.txttraycode.SelectAll(); // MessageBox.Show(ex.Message); // return; // } //} //try //{ // //string x = HttpHelper.HttpPost("trayStock/findTrayStockByOrderType", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttraycode.Text + "&type=2" ); // string x = HttpHelper.HttpPost("trayStock/findTrayStockByOrderType", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttraycode.Text ); // msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); // if (msg == null) // throw new Exception("错误信息捕捉失败"); // if (!msg.success) // throw new Exception(msg.msg); // mt = (Model.MTrayStockByOrderType)JsonConvert.DeserializeObject(x, typeof(Model.MTrayStockByOrderType)); // if (mt == null) // { // throw new Exception("findTrayStockByOrderType捕捉失败"); // } // if (mt.data.materialCode != mtrans.data.materialCode) // { // throw new Exception("托盘物料和提示物料不同"); // } // if (mt.data.batchNo != mtrans.data.batchNo) // { // throw new Exception("托盘批次和提示批次不同"); // } // if (mt.data.slId != mtrans.data.fromSlId) // { // throw new Exception("托盘批次和提示批次不同"); // } // this.labtrayqty.Text = mt.data.quantity.ToString() + mtrans.data.commonUnitName + mt.data.minQuantity.ToString() + mtrans.data.minUnitName; // this.cmbmaterialCondition.SelectedValue = mt.data.materialStatus; //} //catch (Exception ex) //{ // MessageBox.Show(ex.Message); // return; //} try { Cursor.Current = Cursors.WaitCursor; string conn = @"orderItemId=" + mtrans.data.orderItemId.ToString() + "&lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode; if (this.txttraycode.Text.Length < Comm.lcCode.Length || Comm.lcCode != this.txttraycode.Text.Substring(0, Comm.lcCode.Length)) { conn += @"&boxCode=" + this.txttraycode.Text.Trim(); } else { conn += @"&trayCode=" + this.txttraycode.Text.Trim(); } string x = HttpHelper.HttpPost("judgeTrayTransfer", conn); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } _mt = (Model.Mtray)JsonConvert.DeserializeObject(x, typeof(Model.Mtray)); if (_mt == null) { throw new Exception("数据信息捕捉失败"); } this.txttraycode.Text = _mt.data.trayCode; int imax = _mt.data.quantity * _mt.data.spec + _mt.data.minQuantity; //if (maxminquantity < 0 || maxminquantity < 0) //{ maxquantity = _mt.data.quantity; maxminquantity = _mt.data.minQuantity; if (maxquantity < 0 || maxminquantity < 0) { maxquantity = imax / _mt.data.spec; maxminquantity = imax % _mt.data.spec; } this.labtrayqty.Text = maxquantity + mtrans.data.commonUnitName + maxminquantity + mtrans.data.minUnitName; int immax = mtrans.data.quantity * _mt.data.spec + mtrans.data.minQuantity; mmaxquantity = mtrans.data.quantity; mmaxminquantity = mtrans.data.minQuantity; if (mmaxquantity < 0 || mmaxminquantity < 0) { mmaxquantity = immax / mtrans.data.spec; mmaxminquantity = immax % mtrans.data.spec; } //if (mtrans.data.quantity > _mt.data.quantity) if (immax > imax) { this.txtcommonqty.Text = maxquantity.ToString(); this.txtminqty.Text = maxminquantity.ToString(); } else { this.txtcommonqty.Text = mmaxquantity.ToString(); this.txtminqty.Text = mmaxminquantity.ToString(); } //else //{ // this.txtcommonqty.Text = mtrans.data.quantity.ToString(); //} //if (mtrans.data.minQuantity > _mt.data.minQuantity) //{ // this.txtminqty.Text = _mt.data.minQuantity.ToString(); //} //else //{ // this.txtminqty.Text = mtrans.data.minQuantity.ToString(); //} Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } this.txttraycode.Enabled = false; this.txtcommonqty.Enabled = true; this.txtcommonqty.Focus(); }
private void txttraycode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txttraycode.Text = ""; this.txttraycode.Enabled = false; //this.txtSlId.Enabled = true; //this.txtSlId.Text = ""; //this.txtSlId.Focus(); mtrans = null; this.labmaterialname.Text = ""; this.labneedqty.Text = ""; this.labfromsIId.Text = ""; //this.txtSlId.Text = ""; //this.txtSlId.Enabled = false; this.txtorderid.Enabled = true; this.txtorderid.Text = ""; this.txtorderid.Focus(); return; } if (e.KeyChar != 13) { return; } if (this.txttraycode.Text == "") { return; } ////this.txttraycode.Text = this.txttraycode.Text.ToUpper(); try { Cursor.Current = Cursors.WaitCursor; string conn = @"orderItemId=" + mtrans.data.orderItemId.ToString() + "&lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode + "&recommendId=" + mtrans.data.recommendId; if (this.txttraycode.Text.Length < Comm.lcCode.Length) { MessageBox.Show("请扫描条码"); this.txttraycode.SelectAll(); return; } if (Comm.lcCode != this.txttraycode.Text.Substring(0, Comm.lcCode.Length)) { conn += @"&boxCode=" + this.txttraycode.Text; } else { conn += @"&trayCode=" + this.txttraycode.Text; } string x = HttpHelper.HttpPost("replenishOrder/judgeTrayForReplenishOrder", conn); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } _mt = (Model.Mtray)JsonConvert.DeserializeObject(x, typeof(Model.Mtray)); if (_mt == null) { throw new Exception("judgeTray数据信息捕捉失败"); } this.txttraycode.Text = _mt.data.trayCode; //this.labtrayqty.Text = _mt.data.quantity.ToString() + mtrans.data.commonUnitName + _mt.data.minQuantity.ToString() + mtrans.data.minUnitName; this.labtrayqty.Text = _mt.data.quantity.ToString() + mtrans.data.commonUnitName; Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } this.txttraycode.Enabled = false; this.txtcommonqty.Enabled = true; this.txtcommonqty.Focus(); }
private void txttraycode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { this.txttraycode.Text = ""; this.txttraycode.Enabled = false; //this.txtslid.Enabled = true; //this.txtslid.Text = ""; //this.txtslid.Focus(); //this.labmaterialname.Text = "物料描述"; //this.labneedqty.Text = ""; //this.labSlname.Text = ""; this.txtAssister.Text = ""; this.txtAssister.Enabled = true; this.txtAssister.Focus(); //this.cbxrr.Enabled = true; //this.cbxrr.Focus(); return; } if (e.KeyChar != 13) { return; } //this.txttraycode.Text = this.txttraycode.Text.ToUpper(); if (this.txttraycode.Text.Length < Comm.lcCode.Length) { MessageBox.Show("请扫描托盘条码"); this.txttraycode.SelectAll(); return; } try { Cursor.Current = Cursors.WaitCursor; string conn = @"orderItemId=" + ms.data[c].recommendSlId.ToString() + "&lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode; if (this.txttraycode.Text.Length < Comm.lcCode.Length || Comm.lcCode != this.txttraycode.Text.Substring(0, Comm.lcCode.Length)) { conn += @"&boxCode=" + this.txttraycode.Text; } else { conn += @"&trayCode=" + this.txttraycode.Text; } string x = HttpHelper.HttpPost("judgeTray", conn); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } _mt = (Model.Mtray)JsonConvert.DeserializeObject(x, typeof(Model.Mtray)); if (_mt == null) { throw new Exception("judgeTray数据信息捕捉失败"); } this.txttraycode.Text = _mt.data.trayCode; this.labtrayqty.Text = _mt.data.quantity.ToString() + ms.data[c].commonUnitName + _mt.data.minQuantity.ToString() + ms.data[c].minUnitName; if (ms.data[c].quantity > _mt.data.quantity) { this.txtcommonqty.Text = _mt.data.quantity.ToString(); commonqty = _mt.data.quantity; if (ms.data[c].minQuantity > _mt.data.minQuantity) { this.txtminqty.Text = _mt.data.minQuantity.ToString(); } else { this.txtminqty.Text = ms.data[c].minQuantity.ToString(); } } else { this.txtcommonqty.Text = ms.data[c].quantity.ToString(); commonqty = ms.data[c].quantity; if (ms.data[c].minQuantity > _mt.data.minQuantity) { int _spec = Convert.ToInt32(ms.data[c].spec); int g = (_mt.data.quantity - ms.data[c].quantity) * _spec + _mt.data.minQuantity; if (g < ms.data[c].minQuantity) { this.txtminqty.Text = g.ToString(); } else { this.txtminqty.Text = ms.data[c].minQuantity.ToString(); } } else { this.txtminqty.Text = ms.data[c].minQuantity.ToString(); } } //this.txtminqty.Text = ms.data[c].minQuantity.ToString(); Cursor.Current = Cursors.Default; } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message); return; } this.txttraycode.Enabled = false; this.txtminqty.Enabled = true; this.txtminqty.Focus(); //this.txtcommonqty.Enabled = true; //this.txtcommonqty.Focus(); }