Exemplo n.º 1
0
 void init()
 {
     ml = null;
     this.labmaterial.Text    = "";
     this.labpdate.Text       = "";
     this.labminunit.Text     = "";
     this.labcommonUnit.Text  = "";
     this.labshippername.Text = "";
     this.labbatchno.Text     = "";
     this.txtcommonqty.Text   = "";
     this.txtminqty.Text      = "";
     this.txttoslid.Text      = "";
     this.txttotraycode.Text  = "";
     this.labqty.Text         = "";
     //this.labcommonUnit.Text = "";
     //this.labminunit.Text = "";
 }
Exemplo n.º 2
0
        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();
        }