예제 #1
0
 private void txtshelve_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 27)
     {
         this.txtshelve.Text    = "";
         this.txtshelve.Enabled = false;
         //this.txtcarton.Enabled = true;
         //this.txtcarton.Text = "";
         //this.labmaterialname.Text = "";
         //this.labrecommendSlId.Text = "";
         //this.labcode.Text ="";
         //this.labqty.Text = "";
         //this.txtcarton.Focus();
         this.txttotraycode.Enabled = true;
         this.txttotraycode.Focus();
         this.txttotraycode.SelectAll();
         return;
     }
     if (e.KeyChar != 13)
     {
         return;
     }
     if (string.IsNullOrEmpty(this.txtshelve.Text.Trim()))
     {
         this.txtshelve.Enabled     = false;
         this.txttotraycode.Enabled = true;
         this.txttotraycode.Focus();
         return;
     }
     //this.txtshelve.Text = this.txtshelve.Text.ToUpper();
     slid = mRec.data.recommendSlId;
     if (this.labrecommendSlId.Text == "")
     {
         try
         {
             Cursor.Current = Cursors.WaitCursor;
             string x = HttpHelper.HttpPost("trayStock/findSlIdBySlName", @"lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode + "&slName=" + this.txtshelve.Text);
             msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
             if (msg == null)
             {
                 throw new Exception("findSlIdBySlName错误信息捕捉失败");
             }
             if (!msg.success)
             {
                 throw new Exception(msg.msg);
             }
             ms             = (Model.MSlIdBySlName)JsonConvert.DeserializeObject(x, typeof(Model.MSlIdBySlName));
             Cursor.Current = Cursors.Default;
         }
         catch (Exception ex)
         {
             Cursor.Current = Cursors.Default;
             MessageBox.Show(ex.Message);
             this.txtshelve.SelectAll();
             return;
         }
         slid = ms.data.slId;
     }
     else if (this.txtshelve.Text != this.labrecommendSlId.Text)
     {
         DialogResult dr = MessageBox.Show("移入库位不是指定库位,是否继续?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
         if (dr != DialogResult.Yes)
         {
             this.txtshelve.SelectAll();
             return;
         }
         try
         {
             Cursor.Current = Cursors.WaitCursor;
             string x = HttpHelper.HttpPost("trayStock/findSlIdBySlName", @"lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode + "&slName=" + this.txtshelve.Text);
             msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
             if (msg == null)
             {
                 throw new Exception("findSlIdBySlName错误信息捕捉失败");
             }
             if (!msg.success)
             {
                 throw new Exception(msg.msg);
             }
             ms             = (Model.MSlIdBySlName)JsonConvert.DeserializeObject(x, typeof(Model.MSlIdBySlName));
             Cursor.Current = Cursors.Default;
         }
         catch (Exception ex)
         {
             Cursor.Current = Cursors.Default;
             MessageBox.Show(ex.Message);
             this.txtshelve.SelectAll();
             return;
         }
         slid = ms.data.slId;
     }
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         Save();
         //getmaterial = (Model.MgetMaterial)JsonConvert.DeserializeObject(x, typeof(Model.MgetMaterial));
         //if (m == null)
         //{
         //    throw new Exception("getMaterial捕捉失败");
         //}
         //this.labneedqty.Text = getmaterial.data.quantity.ToString() + materialbody.commonUnit + getmaterial.data.minQuantity.ToString() + materialbody.minUnit;
         Cursor.Current = Cursors.Default;
     }
     catch (Exception ex)
     {
         Cursor.Current = Cursors.Default;
         MessageBox.Show(ex.Message);
         this.txtshelve.SelectAll();
         return;
     }
     //MessageBox.Show("上架完成");
     Init();
 }
예제 #2
0
 private void txttoslid_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == 27)
     {
         this.txttotraycode.Enabled = true;
         this.txttoslid.Enabled     = false;
         this.txttoslid.Text        = "";
         this.txttotraycode.Focus();
         this.txttotraycode.SelectAll();
         return;
     }
     if (e.KeyChar != 13)
     {
         return;
     }
     //if (this.txttoslid.Text != this.labtoslidname.Text)
     //{
     //    MessageBox.Show("目的库位有问题");
     //    this.txttoslid.SelectAll();
     //    return;
     //}
     //this.txttoslid.Text = this.txttoslid.Text.ToUpper();
     ms1 = null;
     if (this.txttoslid.Text != "")
     {
         try
         {
             Cursor.Current = Cursors.WaitCursor;
             string x = HttpHelper.HttpPost("trayStock/findSlIdBySlNameNoZC", @"lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode + "&slName=" + this.txttoslid.Text);
             msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
             if (msg == null)
             {
                 throw new Exception("findSlIdBySlName错误信息捕捉失败");
             }
             if (!msg.success)
             {
                 throw new Exception(msg.msg);
             }
             ms1            = (Model.MSlIdBySlName)JsonConvert.DeserializeObject(x, typeof(Model.MSlIdBySlName));
             Cursor.Current = Cursors.Default;
             if (this.txttraycode.Text != this.txttotraycode.Text)
             {
                 if (nmt.data != null)
                 {
                     if (nmt.data.slId != ms1.data.slId)
                     {
                         throw new Exception("该托盘不属于该库位,请换托盘或库位");
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             Cursor.Current = Cursors.Default;
             MessageBox.Show(ex.Message);
             this.txttoslid.SelectAll();
             return;
         }
     }
     else
     {
         if (this.txttotraycode.Text == this.txttraycode.Text)
         {
             if (nmt == null || nmt.data == null)
             {
                 MessageBox.Show("整托转储移入库位不能为空");
                 this.txttoslid.SelectAll();
                 return;
             }
         }
         else if (nmt == null || nmt.data == null)
         {
             MessageBox.Show("新托盘移入库位不能为空");
             this.txttoslid.SelectAll();
             return;
         }
     }
     //slid = ms.data.slId;
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         string conn = @"lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode + "&orderId=" + this.laborderid.Text;
         conn += "&quantity=" + commonqty.ToString() + "&minQuantity=" + minqty.ToString() + "&fromTrayCode=" + this.txttraycode.Text + "&toTrayCode=" + this.txttotraycode.Text + "&updater=" + Comm.usercode + "&fromSlId=" + mt.data.slId + "&materialCode=" + mt.data.materialCode + "&pdate=" + mt.data.pdate + "&batchNo=" + mt.data.batchNo + "&oldMaterialStatus=" + mt.data.materialStatus + "&newMaterialStatus=" + this.cmbmaterialSurface.SelectedValue.ToString() + "&inDate=" + mt.data.inDate + "&shipperCode=" + mt.data.shipperCode + "&qtStatus=" + mt.data.qtStatus;
         if (ms1 != null)
         {
             conn += "&toSlId=" + ms1.data.slId;
         }
         string x = HttpHelper.HttpPost("submitNoOrderTransfer", conn);
         msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
         if (msg == null)
         {
             throw new Exception("错误信息捕捉失败");
         }
         if (!msg.success)
         {
             throw new Exception(msg.msg);
         }
         Cursor.Current = Cursors.Default;
     }
     catch (Exception ex)
     {
         Cursor.Current = Cursors.Default;
         MessageBox.Show(ex.Message);
         return;
     }
     this.labmaterialStatusStr.Text = "";
     this.labminunit.Text           = "";
     this.labcommonUnit.Text        = "";
     this.labinfo.Text         = "";
     this.labmaterialname.Text = "";
     this.txtcommonqty.Text    = "";
     this.txtminqty.Text       = "";
     //this.txtSlname.Text = "";
     this.txttoslid.Text     = "";
     this.txttotraycode.Text = "";
     this.txttraycode.Text   = "";
     //this.txtSlname.Enabled = true;
     this.txttoslid.Enabled = false;
     //this.txtSlname.Focus();
     this.txttraycode.Enabled = true;
     this.txttraycode.Focus();
 }