private void txtSlId_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 27) { 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; } //this.txtSlId.Text = this.txtSlId.Text.ToUpper(); if (this.txtSlId.Text != mtrans.data.fromSlName.ToString()) { MessageBox.Show("来源库位不正确"); this.txtSlId.SelectAll(); return; } this.txtSlId.Enabled = false; this.txttraycode.Enabled = true; this.txttraycode.Focus(); }
//int ci = 0; //int mi = 0; void GetTrans(bool benter) { string con = @"orderId=" + this.txtorderid.Text + "&lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode; if (mtrans != null && mtrans.data != null && !benter) { con += "&orderItemId=" + mtrans.data.orderItemId.ToString() + "&quantity=" + commonqty.ToString() + "&minQuantity=" + minqty.ToString() + "&fromTrayCode=" + this.txttraycode.Text + "&toTrayCode=" + this.txttotraycode.Text + "&materialStatus=" + this.cmbmaterialSurface.SelectedValue.ToString() + "&updater=" + Comm.usercode + "&qtStatus=" + _mt.data.qtStatus; } if (benter) { con += "&orderItemId=" + mtrans.data.orderItemId.ToString(); } string x = HttpHelper.HttpPost("submitTransOperate", con); msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg)); if (msg == null) { throw new Exception("错误信息捕捉失败"); } if (!msg.success) { throw new Exception(msg.msg); } mtrans = (Model.MTranMove)JsonConvert.DeserializeObject(x, typeof(Model.MTranMove)); if (mtrans == null) { throw new Exception("数据信息捕捉失败"); } Clear(); if (mtrans.data == null) { MessageBox.Show("该单据已经操作完成"); this.txtorderid.Enabled = true; this.txtorderid.Text = ""; this.txtorderid.Focus(); return; } //this.btnAssistance.Text = mtrans.data.assistance; this.btnAssistance.Text = mtrans.data.assistanceName; this.labfromsIId.Text = mtrans.data.fromSlName.ToString(); this.labtoslname.Text = mtrans.data.toSlName; this.labmaterialname.Text = mtrans.data.materialName; //ci = mtrans.data.quantity + (int)(((double)(mtrans.data.minQuantity) / mtrans.data.spec)); //mi = (mtrans.data.quantity * mtrans.data.spec + mtrans.data.minQuantity) % mtrans.data.spec; //this.labneedqty.Text = ci + mtrans.data.commonUnitName + mi + mtrans.data.minUnitName + " " + mtrans.data.batchNo; int imax = mtrans.data.quantity * mtrans.data.spec + mtrans.data.minQuantity; int maxquantity = mtrans.data.quantity; int maxminquantity = mtrans.data.minQuantity; if (maxminquantity < 0 || maxquantity < 0) { maxquantity = imax / mtrans.data.spec; maxminquantity = imax % mtrans.data.spec; } this.labneedqty.Text = maxquantity + mtrans.data.commonUnitName + maxminquantity + mtrans.data.minUnitName + " " + mtrans.data.batchNo; this.labmaterialStatusStr.Text = mtrans.data.materialStatusName; this.cmbmaterialSurface.Text = mtrans.data.materialStatusName; this.labcommonUnit.Text = mtrans.data.commonUnitName; this.labminunit.Text = mtrans.data.minUnitName; //this.txtSlId.Enabled = true; //this.txtSlId.Focus(); this.txttraycode.Enabled = true; this.txttraycode.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.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(); }