Beispiel #1
0
        private void txtbatch_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                //this.dtdate.Enabled = true;
                this.txtbatch.Enabled = false;
                this.txtbatch.Text    = "";
                //this.dtdate.Focus();
                if (mm == null || mm.data == null || string.IsNullOrEmpty(mm.data.boxcode))
                {
                    this.dtdate.Enabled = true;


                    this.dtdate.Focus();
                }
                else
                {
                    mm = null;
                    this.txtbarcode.Text = "";
                    //this.labmaterialcode.Text = "";
                    this.labmaterialname.Text = "";
                    this.labneedqty.Text      = "";
                    this.txttraycode.Enabled  = true;
                    this.txttraycode.Text     = "";
                    this.txttraycode.Focus();
                }
                return;
            }
            if (e.KeyChar != 13)
            {
                return;
            }
            this.txtbatch.Text = this.txtbatch.Text.ToUpper();
            if (this.txtbatch.Text.Length == 0)
            {
                MessageBox.Show("批次格式不对");
                this.txtbatch.SelectAll();
                return;
            }
            if (this.txtbatch.Text.Length > 30)
            {
                MessageBox.Show("批次过长");
                this.txtbatch.SelectAll();
                return;
            }
            this.txtbatch.Enabled = false;

            this.cmbmaterialCondition.Enabled = true;
            this.cmbmaterialCondition.Focus();
            //this.txtcommonqty.Enabled = true;
            //this.txtcommonqty.Focus();
        }
Beispiel #2
0
        private void txttraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.txttraycode.Text    = "";
                this.txttraycode.Enabled = false;
                this.txtbarcode.Enabled  = true;
                this.txtbarcode.Text     = "";
                this.txtbarcode.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
                {
                    Cursor.Current = Cursors.WaitCursor;
                    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.trayCode;
                    Cursor.Current        = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            Model.MTrayStockByOrderType nmt = null;
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string x = HttpHelper.HttpPost("trayStock/findTrayStockByOrderType", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttraycode.Text + "&whId=" + Comm.warehousecode);
                msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                if (msg == null)
                {
                    throw new Exception("trayStock/findTrayStockByOrderType错误信息捕捉失败");
                }
                if (!msg.success)
                {
                    throw new Exception(msg.msg);
                }
                nmt = (Model.MTrayStockByOrderType)JsonConvert.DeserializeObject(x, typeof(Model.MTrayStockByOrderType));
                if (nmt == null)
                {
                    throw new Exception("findTrayStockByOrderType捕捉失败");
                }
                //if (nmt.data == null)
                //{
                //    throw new Exception("findTrayStockByOrderType返回data信息为空");
                //}

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
                return;
            }
            if (nmt.data != null && !string.IsNullOrEmpty(nmt.data.materialCode))//不是空托盘
            {
                if (nmt.data.slId != mp.data.toSlId)
                {
                    MessageBox.Show("该托盘不在目标库位上,请换一个托盘");
                    this.txttraycode.SelectAll();
                    return;
                }

                if (mp.data.materialCode != nmt.data.materialCode)
                {
                    MessageBox.Show("新托盘上的物料是" + nmt.data.materialName + ",不能合托,请换托盘");
                    this.txttraycode.SelectAll();
                    return;
                }
                if (mp.data.batchNo != nmt.data.batchNo || mp.data.pdate != nmt.data.pdate)
                {
                    DialogResult dr = MessageBox.Show("批次 生产日期 状态 入库日期有和原来的不同的属性,是否合托?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (dr != DialogResult.Yes)
                    {
                        this.txttraycode.SelectAll();
                        return;
                    }
                }
            }
            this.txttraycode.Enabled = false;
            this.txtslname.Enabled   = true;
            this.txtslname.Focus();
        }
Beispiel #3
0
        private void txttraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.labcustomer.Text    = "";
                this.txttraycode.Text    = "";
                this.txttraycode.Enabled = false;
                this.txtorderid.Enabled  = true;
                this.txtorderid.Text     = "";
                this.txtorderid.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;
            }
            if (Comm.lcCode != this.txttraycode.Text.Substring(0, Comm.lcCode.Length))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    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("getTrayByBox错误信息捕捉失败");
                    }
                    if (!msg.success)
                    {
                        throw new Exception(msg.msg);
                    }
                    mm = (Model.MTrayByBox)JsonConvert.DeserializeObject(x, typeof(Model.MTrayByBox));
                    if (mm == null)
                    {
                        throw new Exception("getTrayByBox错误信息捕捉失败1");
                    }
                    mm.data.boxcode       = this.txttraycode.Text;
                    this.txttraycode.Text = mm.data.trayCode;
                    this.txtbarcode.Text  = mm.data.barCode;
                    this.dtdate.Value     = Convert.ToDateTime(mm.data.pdate);
                    this.txtbatch.Text    = mm.data.batchNo;
                    //this.cmbmaterialCondition.Text = mm.data.materialStatus;
                    //this.labmaterialcode.Text = mm.data.materialCode;
                    //this.labmaterialname.Text = mm.data.materialName;
                    Cursor.Current = Cursors.Default;
                    //materialbody = new Rf_Wms.Model.Mmaterialcodebody();
                    //materialbody.code = mm.data.materialCode;
                    //materialbody.spec = mm.data.spec;
                    //this.labcommonUnit.Text = mm.data.commonUnit;
                    //this.labminunit.Text = mm.data.minUnit;
                    //materialbody.commonUnit=mm.data.min
                    KeyPressEventArgs xx = new KeyPressEventArgs((char)Keys.Enter);
                    this.txtbarcode.Enabled  = true;
                    this.txttraycode.Enabled = false;
                    this.txtbarcode_KeyPress(null, xx);
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string x = HttpHelper.HttpPost("verifyTrayCode", @"trayCode=" + this.txttraycode.Text + "&lcCode=" + Comm.lcCode);
                    msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                    if (msg == null)
                    {
                        throw new Exception("verifyTrayCode错误信息捕捉失败");
                    }
                    if (!msg.success)
                    {
                        throw new Exception(msg.msg);
                    }
                    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))
            {
                this.txttraycode.Enabled = false;
                this.txtbarcode.Enabled  = true;
                this.txtbarcode.Focus();
            }
        }
Beispiel #4
0
        private void txttotraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.txtshelve.Text = "";
                //this.txtshelve.Enabled = false;
                this.txttotraycode.Text    = "";
                this.txttotraycode.Enabled = false;
                this.txtcarton.Enabled     = true;
                this.txtcarton.Text        = "";
                this.labmaterialname.Text  = "";
                this.labrecommendSlId.Text = "";
                this.labcode.Text          = "";
                this.labqty.Text           = "";
                this.txtcarton.Focus();
            }
            if (e.KeyChar != 13)
            {
                return;
            }
            if (string.IsNullOrEmpty(this.txttotraycode.Text.Trim()))
            {
                this.txttotraycode.Enabled = false;
                this.txtshelve.Enabled     = true;
                this.txtshelve.Focus();
                return;
            }
            if (this.txttotraycode.Text.Trim() == this.txtcarton.Text.Trim())
            {
                this.txttotraycode.Enabled = false;
                this.txtshelve.Enabled     = true;
                this.txtshelve.Focus();
                return;
            }
            Model.MTrayByBox mm = null;
            if (this.txttotraycode.Text.Length < Comm.lcCode.Length)
            {
                MessageBox.Show("请扫描条码");
                this.txttotraycode.SelectAll();
                return;
            }
            if (Comm.lcCode != this.txttotraycode.Text.Substring(0, Comm.lcCode.Length))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txttotraycode.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.txtcarton.Text = mm.data.trayCode;
                    Cursor.Current      = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    this.txtcarton.SelectAll();
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string x = HttpHelper.HttpPost("toTrayCodeRefundVerify", @"toTrayCode=" + this.txttotraycode.Text.Trim() + "&lcCode=" + Comm.lcCode + "&fromTrayCode=" + this.txtcarton.Text.Trim());

                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;
                Model.Mccode mcc = (Model.Mccode)JsonConvert.DeserializeObject(x, typeof(Model.Mccode));
                if (!string.IsNullOrEmpty(mcc.data))
                {
                    DialogResult dr = MessageBox.Show(mcc.data, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (dr != DialogResult.Yes)
                    {
                        this.txtshelve.SelectAll();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
                this.txtshelve.SelectAll();
                return;
            }
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                Save();
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
                this.txtshelve.SelectAll();
                return;
            }
            Init();
        }
Beispiel #5
0
 void GetValue()
 {
     this.txtcarton.Text = this.txtcarton.Text.ToUpper();
     Model.MTrayByBox mm = null;
     if (this.txtcarton.Text.Length < Comm.lcCode.Length)
     {
         MessageBox.Show("请扫描条码");
         this.txtcarton.SelectAll();
         return;
     }
     if (Comm.lcCode != this.txtcarton.Text.Substring(0, Comm.lcCode.Length))
     {
         try
         {
             Cursor.Current = Cursors.WaitCursor;
             string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txtcarton.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.txtcarton.Text = mm.data.trayCode;
             Cursor.Current      = Cursors.Default;
         }
         catch (Exception ex)
         {
             Cursor.Current = Cursors.Default;
             this.txtcarton.SelectAll();
             MessageBox.Show(ex.Message);
             return;
         }
     }
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         string x = HttpHelper.HttpPost("refundReceive", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txtcarton.Text + "&whId=" + Comm.warehousecode + "&updater=" + Comm.usercode);
         msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
         if (msg == null)
         {
             throw new Exception("refundReceive错误信息捕捉失败");
         }
         if (!msg.success)
         {
             throw new Exception(msg.msg);
         }
         mRec = (Model.MstockinReceive)JsonConvert.DeserializeObject(x, typeof(Model.MstockinReceive));
         if (mRec == null)
         {
             throw new Exception("refundReceive捕捉失败");
         }
         this.labmaterialname.Text = mRec.data.material.materialName;
         //this.labrecommendSlId.Text = mRec.data.recommendSlId.ToString();
         this.labrecommendSlId.Text = mRec.data.recommendSlName;
         this.labcode.Text          = mRec.data.material.materialCode;
         this.labqty.Text           = mRec.data.material.quantity.ToString() + mRec.data.material.commonUnit + mRec.data.material.minQuantity.ToString() + mRec.data.material.minUnit;
         //this.txttotraycode.Enabled = true;
         //this.txttotraycode.Focus();
         //this.txtcarton.Enabled = false;
         Cursor.Current = Cursors.Default;
     }
     catch (Exception ex)
     {
         Cursor.Current = Cursors.Default;
         MessageBox.Show(ex.Message);
         return;
     }
     this.txtcarton.Enabled     = false;
     this.txttotraycode.Enabled = true;
     this.txttotraycode.Focus();
 }
Beispiel #6
0
        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();
                return;
            }
            if (e.KeyChar != 13)
            {
                return;
            }
            //this.txttraycode.Text = this.txttraycode.Text.ToUpper();
            Model.MTrayByBox mm = null;
            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))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    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("getTrayByBox错误信息捕捉失败");
                    }
                    this.txttraycode.Text = mm.data.trayCode;
                    Cursor.Current        = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    this.txttraycode.SelectAll();
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            var q = from r in m.data.trayRepeats where r.trayCode == this.txttraycode.Text select r;

            if (q.Count() == 0)
            {
                MessageBox.Show("本次复盘数据中没有该托盘");
                this.txttraycode.SelectAll();
                return;
            }
            o = q.First();
            this.labinfo.Text         = "共有" + m.data.trayRepeats.Count.ToString() + "托,已盘" + checkcount.ToString() + "托 托盘库存:" + o.quantity + m.data.commonUnitName + o.minQuantity + m.data.minUnitName;
            this.txtcommonqty.Text    = o.quantity.ToString();
            this.txtminqty.Text       = o.minQuantity.ToString();
            this.txttraycode.Enabled  = false;
            this.txtcommonqty.Enabled = true;
            this.txtcommonqty.Focus();
            //this.txtbarcode.Enabled = true;
            //this.txtbarcode.Focus();
        }
Beispiel #7
0
        private void txttotraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.txttotraycode.Enabled = false;
                this.txttotraycode.Text    = "";
                if (txtminqty.Visible == true)
                {
                    this.txtminqty.Enabled = true;
                    this.txtminqty.Focus();
                    this.txtminqty.SelectAll();
                }
                else
                {
                    this.txtcommonqty.Enabled = true;
                    this.txtcommonqty.Focus();
                    this.txtcommonqty.SelectAll();
                }
                return;
            }
            if (e.KeyChar != 13)
            {
                return;
            }
            if (this.txttotraycode.Text.Length == 0)
            {
                return;
            }
            if (this.txttotraycode.Text.Length < Comm.lcCode.Length)
            {
                MessageBox.Show("请扫描条码");
                this.txttotraycode.SelectAll();
                return;
            }
            //this.txttotraycode.Text = this.txttotraycode.Text.ToUpper();
            if (Comm.lcCode != this.txttotraycode.Text.Substring(0, Comm.lcCode.Length))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txttotraycode.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.txttotraycode.Text = mm.data.trayCode;
                    Cursor.Current          = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    this.txttraycode.SelectAll();
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string x = HttpHelper.HttpPost("verifyTrayCode", @"trayCode=" + this.txttraycode.Text + "&lcCode=" + Comm.lcCode);
                    msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                    if (msg == null)
                    {
                        throw new Exception("verifyTrayCode错误信息捕捉失败");
                    }
                    if (!msg.success)
                    {
                        throw new Exception(msg.msg);
                    }
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show(ex.Message);
                    return;
                }
            }

            if (this.txttraycode.Text == this.txttotraycode.Text)
            {
                if (_mt.data.quantity != commonqty || _mt.data.minQuantity != minqty)
                {
                    MessageBox.Show("数量不同,不能整托补货");
                    this.txttotraycode.SelectAll();
                    return;
                }
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    string conn = @"orderItemId=" + mtrans.data.orderItemId.ToString() + "&lcCode=" + Comm.lcCode;


                    conn += @"&trayCode=" + this.txttotraycode.Text;

                    string x = HttpHelper.HttpPost("replenishOrder/judgeSourceTrayCode", conn);
                    msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                    if (msg == null)
                    {
                        throw new Exception("replenishOrder/judgeSourceTrayCode错误信息捕捉失败");
                    }
                    if (!msg.success)
                    {
                        throw new Exception(msg.msg);
                    }
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show(ex.Message);
                    this.txttotraycode.SelectAll();
                    return;
                }
            }

            //if (this.txttraycode.Text == this.txttotraycode.Text)
            //{
            //    this.txttraycode.SelectAll();
            //    MessageBox.Show("出入");
            //    return;
            //}
            this.txttotraycode.Enabled = false;
            this.txttoslid.Enabled     = true;
            this.txttoslid.Focus();
        }
Beispiel #8
0
        private void txttraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar != 13)
            {
                return;
            }
            this.laberror.Text = "";

            this.labbatchno.Text      = "";
            this.labpdate.Text        = "";
            this.labinfo.Text         = "";
            this.labindate.Text       = "";
            this.labmaterialname.Text = "";
            this.labstr.Text          = "";
            this.lblbarcode.Text      = "";
            //this.lblmaterialcode.Text = "";
            this.lblslId.Text = "";
            //this.txttraycode.Text = this.txttraycode.Text.ToUpper();
            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))
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    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("getTrayByBox错误信息捕捉失败");
                    }
                    if (!msg.success)
                    {
                        throw new Exception(msg.msg);
                    }
                    mm = (Model.MTrayByBox)JsonConvert.DeserializeObject(x, typeof(Model.MTrayByBox));
                    if (mm == null)
                    {
                        throw new Exception("getTrayByBox错误信息捕捉失败1");
                    }
                    this.txttraycode.Text = mm.data.trayCode;


                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    Cursor.Current = Cursors.Default;
                    this.txttraycode.SelectAll();
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                //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 + "&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);
                }
                mt = (Model.MTrayStockByOrderType)JsonConvert.DeserializeObject(x, typeof(Model.MTrayStockByOrderType));
                if (mt == null)
                {
                    throw new Exception("findTrayStockByOrderType捕捉失败");
                }


                Cursor.Current = Cursors.Default;
                if (mt.data == null || string.IsNullOrEmpty(mt.data.materialCode))
                {
                    //this.laberror.Text = "该托盘没有任何物品";
                    MessageBox.Show("托盘不存在!");
                    this.txttraycode.SelectAll();
                    return;
                }
                //this.txttraycode.Text = "";
                this.labbatchno.Text = mt.data.batchNo;
                this.labpdate.Text   = mt.data.pdate;
                this.labinfo.Text    = mt.data.quantity.ToString() + mt.data.commonUnitName + mt.data.minQuantity.ToString() + mt.data.minUnitName;
                //this.cmbmaterialSurface.Text = mt.data.materialStatusStr;
                this.labmaterialname.Text = "物料信息 " + mt.data.materialCode + " " + mt.data.materialName;
                this.labindate.Text       = mt.data.inDate;
                this.labstr.Text          = mt.data.materialStatusStr;
                this.lblslId.Text         = mt.data.slIdName;
                //this.lblmaterialcode.Text=mt.data.materialCode;
                this.lblbarcode.Text = mt.data.barCode;
                this.txttraycode.SelectAll();
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
            }
            this.txttraycode.SelectAll();
        }
Beispiel #9
0
        private void txttotraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.txtminqty.Enabled     = true;
                this.txttotraycode.Enabled = false;
                this.txttotraycode.Text    = "";
                this.txtminqty.Focus();
                this.txtminqty.SelectAll();
                return;
            }

            if (e.KeyChar != 13)
            {
                return;
            }
            //try
            //{
            //    Cursor.Current = Cursors.WaitCursor;
            //    string x = HttpHelper.HttpPost("getTrayCode", @"boxCode=" + this.txttotraycode.Text + "&lcCode=" + Comm.lcCode + "&whId=" + Comm.warehousecode);
            //    msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
            //    if (msg == null)
            //        throw new Exception("getTrayCode失败");
            //    if (!msg.success)
            //        throw new Exception(msg.msg);
            //    mm = (Model.MTrayByBox)JsonConvert.DeserializeObject(x, typeof(Model.MTrayByBox));
            //    if (mm == null)
            //        throw new Exception("错误信息捕捉失败");
            //    if (string.IsNullOrEmpty(mm.data))
            //    {
            //        throw new Exception("没有找到对应托盘");
            //    }
            //    this.txttotraycode.Text = mm.data;
            //    Cursor.Current = Cursors.Default;
            //}
            //catch (Exception ex)
            //{
            //    Cursor.Current = Cursors.Default;
            //    this.txttotraycode.SelectAll();
            //    MessageBox.Show(ex.Message);
            //    return;

            //}

            //this.txttotraycode.Text = this.txttotraycode.Text.ToUpper();
            Model.MTrayByBox mm = null;
            if (this.txttotraycode.Text.Length < Comm.lcCode.Length)
            {
                MessageBox.Show("请扫描移入托盘");
                this.txttraycode.SelectAll();
                return;
            }
            if (this.txttotraycode.Text == this.txttraycode.Text)
            {
                if (_mt.data.quantity != commonqty || _mt.data.minQuantity != minqty)
                {
                    MessageBox.Show("部分转储不允许使用同一托盘");
                    this.txttotraycode.SelectAll();
                    return;
                }
            }
            else
            {
                if (Comm.lcCode != this.txttotraycode.Text.Substring(0, Comm.lcCode.Length))
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txttotraycode.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.txttotraycode.Text = mm.data.trayCode;
                        Cursor.Current          = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        this.txttraycode.SelectAll();
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
                //else
                //{
                //    try
                //    {
                //        Cursor.Current = Cursors.WaitCursor;
                //        string x = HttpHelper.HttpPost("verifyTrayCode", @"trayCode=" + this.txttotraycode.Text + "&lcCode=" + Comm.lcCode);
                //        msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                //        if (msg == null)
                //            throw new Exception("verifyTrayCode错误信息捕捉失败");
                //        if (!msg.success)
                //            throw new Exception(msg.msg);
                //        Cursor.Current = Cursors.Default;

                //    }
                //    catch (Exception ex)
                //    {
                //        Cursor.Current = Cursors.Default;
                //        MessageBox.Show(ex.Message);
                //        return;

                //    }
                //}
            }
            Model.MTrayStockByOrderType nmt = null;
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                string x = HttpHelper.HttpPost("trayStock/verifyToTrayCodeNotZC", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttotraycode.Text + "&whId=" + Comm.warehousecode);
                msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                if (msg == null)
                {
                    throw new Exception("trayStock/verifyToTrayCodeNotZC错误信息捕捉失败");
                }
                if (!msg.success)
                {
                    throw new Exception(msg.msg);
                }
                nmt = (Model.MTrayStockByOrderType)JsonConvert.DeserializeObject(x, typeof(Model.MTrayStockByOrderType));
                if (nmt == null)
                {
                    throw new Exception("findTrayStockByOrderType捕捉失败");
                }
                if (!string.IsNullOrEmpty(nmt.data.trayCode))
                {
                    if (nmt.data.trayCode != this.txttotraycode.Text)
                    {
                        this.txttotraycode.Text = nmt.data.trayCode;
                    }
                }
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                MessageBox.Show(ex.Message);
                return;
            }
            if (nmt.data != null && !string.IsNullOrEmpty(nmt.data.materialCode))//不是空托盘
            {
                if (this.txttotraycode.Text != this.txttraycode.Text)
                {
                    if (nmt.data.slId != mtrans.data.toSlId)
                    {
                        MessageBox.Show("该托盘不在目标库位上,请换一个托盘");
                        this.txttotraycode.SelectAll();
                        return;
                    }
                }
                if (mtrans.data.materialCode != nmt.data.materialCode)
                {
                    MessageBox.Show("新托盘上的物料是" + nmt.data.materialName + ",不能合托,请换托盘");
                    this.txttotraycode.SelectAll();
                    return;
                }
                if (mtrans.data.batchNo != nmt.data.batchNo || nmt.data.inDate != mtrans.data.inDate || mtrans.data.pdate != nmt.data.pdate || mtrans.data.materialStatusCode != nmt.data.materialStatus)
                {
                    DialogResult dr = MessageBox.Show("移入托盘的批次、生产日期、物料状态、入库日期存在与待转入物料不一致的情况,确认是否合托?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (dr != DialogResult.Yes)
                    {
                        this.txttotraycode.SelectAll();
                        return;
                    }
                }
            }

            this.txttotraycode.Enabled = false;
            this.txttoslid.Enabled     = true;
            this.txttoslid.Focus();
        }
Beispiel #10
0
        private void txtToTraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 27)
            {
                this.txtminqty.Enabled     = true;
                this.txtToTraycode.Enabled = false;
                this.txtToTraycode.Text    = "";
                this.txtminqty.Focus();
                this.txtminqty.SelectAll();
                return;
            }
            if (e.KeyChar != 13)
            {
                return;
            }
            if (this.txtToTraycode.Text.Length < Comm.lcCode.Length)
            {
                MessageBox.Show("请扫描正确托盘码!");
                //this.txttraycode.SelectAll();
                this.txtToTraycode.Text = "";
                return;
            }
            //2017-04-11 add
            if (this.txtToTraycode.Text == this.txttraycode.Text)
            {
                //if (_mt.data.quantity != commonqty || _mt.data.minQuantity != minqty)
                if (_mt.data.quantity * ms.data[c].spec + _mt.data.minQuantity != commonqty * ms.data[c].spec + minqty)
                {
                    MessageBox.Show("非整托拣货,移入托盘不能使用原托盘");
                    //this.txtToTraycode.SelectAll();
                    this.txtToTraycode.Text = "";
                    return;
                }
            }
            else
            {
                if (Comm.lcCode != this.txtToTraycode.Text.Substring(0, Comm.lcCode.Length))
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        string x = HttpHelper.HttpPost("getTrayByBox", @"boxCode=" + this.txtToTraycode.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.txtToTraycode.Text = mm.data.trayCode;
                        Cursor.Current          = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        //this.txtToTraycode.SelectAll();
                        this.txtToTraycode.Text = "";
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
                else
                {
                    try
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        string x = HttpHelper.HttpPost("verifyTrayCode", @"trayCode=" + this.txtToTraycode.Text + "&lcCode=" + Comm.lcCode);
                        msg = (Model.Mmsg)JsonConvert.DeserializeObject(x, typeof(Model.Mmsg));
                        if (msg == null)
                        {
                            throw new Exception("verifyTrayCode错误信息捕捉失败");
                        }
                        if (!msg.success)
                        {
                            throw new Exception(msg.msg);
                        }
                        Cursor.Current = Cursors.Default;
                    }
                    catch (Exception ex)
                    {
                        Cursor.Current = Cursors.Default;
                        MessageBox.Show(ex.Message);
                        return;
                    }
                }
            }

            //if (this.txttraycode.Text == this.txttotraycode.Text)
            //{
            //    this.txttraycode.SelectAll();
            //    MessageBox.Show("出入");
            //    return;
            //}
            this.txtToTraycode.Enabled = false;
            this.txttoslname.Enabled   = true;
            this.txttoslname.Text      = "";
            this.txttoslname.Focus();
            this.cmbtoslname.Enabled = true;
            //this.cmbtoslname.Focus();
        }