Exemple #1
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();
        }
Exemple #2
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();
        }
Exemple #3
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 == "")
            {
                return;
            }
            if (this.txttotraycode.Text.Length < Comm.lcCode.Length)
            {
                MessageBox.Show("请扫描正确托盘码!");
                //this.txttraycode.SelectAll();
                this.txttotraycode.Text = "";
                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);
            //            Model.MTrayByBox 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();
            //            txttotraycode.SelectAll();
            //            MessageBox.Show(ex.Message);
            //            return;

            //        }
            //    }

            //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;

            //}
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                //string x = HttpHelper.HttpPost("trayStock/findTrayStockByOrderType", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttotraycode.Text + "&whId=" + Comm.warehousecode+"&transferType=2");
                string x = HttpHelper.HttpPost("trayStock/verifyToTrayCodeNotZC", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttotraycode.Text + "&whId=" + Comm.warehousecode + "&transferType=2");
                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捕捉失败");
                }

                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                txttotraycode.SelectAll();
                MessageBox.Show(ex.Message);
                return;
            }
            //if (!string.IsNullOrEmpty(nmt.data.status))
            //{
            //    MessageBox.Show("该托盘是暂存区托盘");
            //    this.txttotraycode.SelectAll();
            //    return;
            //}

            if (nmt.data != null)//不是空托盘
            {
                //if (nmt.data.slId != mt.data.t)
                //{
                //    MessageBox.Show("该托盘不在目标库位上,请换一个托盘");
                //    this.txttotraycode.SelectAll();
                //    return;
                //}
                if (ml.data[row].materialCode != nmt.data.materialCode)
                {
                    MessageBox.Show("新托盘上的物料是" + nmt.data.materialName + ",不能合托,请换托盘");
                    this.txttotraycode.SelectAll();
                    return;
                }
                if (ml.data[row].inDateStr != nmt.data.inDate || ml.data[row].batchNo != nmt.data.batchNo || ml.data[row].pdateStr != nmt.data.pdate || ml.data[row].materialStatusCode != nmt.data.materialStatus)
                {
                    DialogResult dr = MessageBox.Show("移入托盘的批次、生产日期、物料状态、入库日期存在与待转入物料不一致的情况,确认是否合托?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
                    if (dr != DialogResult.Yes)
                    {
                        this.txttotraycode.SelectAll();
                        return;
                    }
                }
                if (!string.IsNullOrEmpty(nmt.data.trayCode))
                {
                    if (nmt.data.trayCode != this.txttotraycode.Text)
                    {
                        this.txttotraycode.Text = nmt.data.trayCode;
                    }
                }
            }
            this.txttotraycode.Enabled = false;
            this.txttoslid.Enabled     = true;
            this.txttoslid.Text        = "";
            this.txttoslid.Focus();
        }
Exemple #4
0
        private void txttraycode_KeyPress(object sender, KeyPressEventArgs e)
        {
            //if (e.KeyChar == 27)
            //{
            //    this.txttraycode.Text = "";
            //    this.txttraycode.Enabled = false;
            //    this.txtSlname.Enabled = true;
            //    this.txtSlname.Text = "";
            //    this.txtSlname.Focus();
            //    return;
            //}
            if (e.KeyChar != 13)
            {
                return;
            }
            if (this.txttraycode.Text == "")
            {
                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("trayStock/getTrayStockByBoxCode", @"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");
            //        //if (mm.data == null)
            //        //{
            //        //    throw new Exception("该托盘是空托盘");
            //        //}
            //        this.txttraycode.Text =mm.data.trayCode;


            //        Cursor.Current = Cursors.Default;

            //    }
            //    catch (Exception ex)
            //    {
            //        Cursor.Current = Cursors.Default;
            //        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/verifyFromTrayCodeNotZC", @"lcCode=" + Comm.lcCode + "&trayCode=" + this.txttraycode.Text + "&whId=" + Comm.warehousecode + "&transferType=1");
                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("verifyFromTrayCodeNotZC捕捉失败");
                }
                if (mt.data == null || string.IsNullOrEmpty(mt.data.materialCode))
                {
                    throw new Exception("该容器没有商品");
                }

                //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;
                if (!string.IsNullOrEmpty(mt.data.trayCode))
                {
                    if (mt.data.trayCode != this.txttraycode.Text)
                    {
                        this.txttraycode.Text = mt.data.trayCode;
                    }
                }
                Cursor.Current = Cursors.Default;
            }
            catch (Exception ex)
            {
                Cursor.Current = Cursors.Default;
                this.txttraycode.SelectAll();
                MessageBox.Show(ex.Message);
                return;
            }
            //if (mt.data==null || mt.data.slId != ms.data.slId)
            //{
            //    MessageBox.Show("该托盘不在该库位上");
            //    this.txttraycode.SelectAll();
            //    return;
            //}
            this.labmaterialStatusStr.Text = mt.data.materialStatusStr;
            this.labminunit.Text           = mt.data.minUnitName;
            this.labcommonUnit.Text        = mt.data.commonUnitName;
            this.labinfo.Text = mt.data.pdate;
            int imax = mt.data.quantity * mt.data.spec + mt.data.minQuantity;

            maxquantity    = mt.data.quantity;
            maxminquantity = mt.data.minQuantity;
            if (maxminquantity < 0 || maxminquantity < 0)
            {
                maxquantity    = imax / mt.data.spec;
                maxminquantity = imax % mt.data.spec;
            }
            this.labinfo.Text           += " " + maxquantity + mt.data.commonUnitName + maxminquantity + mt.data.minUnitName;
            this.cmbmaterialSurface.Text = mt.data.materialStatusStr;
            this.labmaterialname.Text    = mt.data.materialName;
            this.txttraycode.Enabled     = false;
            this.txtcommonqty.Enabled    = true;
            this.txtcommonqty.Focus();
        }