Ejemplo n.º 1
0
        /// <summary>
        /// 根据仓库,存货编码获取批次信息
        /// </summary>
        /// <param name="cwhCode"></param>
        /// <param name="cInvCode"></param>
        private void GetBatchList(string cInvCode, string whCode, string cPosition)
        {
            //绑定之前先清空数据
            cmbBatch.DataSource = null;

            List <BatchInfo> list = DispatchListBusiness.GetBatchList(cInvCode, whCode, cPosition);

            cmbBatch.DataSource    = list;
            cmbBatch.DisplayMember = "DisPlayMember";
            cmbBatch.ValueMember   = "Batch";
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 输入销售订单后回车
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtSource_KeyPress(object sender, KeyPressEventArgs e)
        {
            //扫描销售订单号
            if (e.KeyChar == 13 && txtSource.Text.Length > 0)
            {
                string errMsg = null;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    if (DispatchListBusiness.VerifySO_SO(txtSource.Text, out dispatchlist, out errMsg))
                    {
                        btnSource.Enabled = true;
                        //txtLable.Enabled = true;
                        //txtLable.Focus();
                        //txtCPosition.Enabled = true;
                        //txtCPosition.Focus();
                        cmbWarehouse_SelectedIndexChanged(sender, e);

                        //销售订单文本框不再可用
                        txtSource.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("销售订单错误:" + errMsg);
                        btnSource.Enabled = false;
                        //txtLable.Enabled = false;
                        txtSource.SelectAll();
                        txtSource.Focus();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    btnSource.Enabled = false;
                    //txtLable.Enabled = false;
                    txtSource.SelectAll();
                    txtSource.Focus();
                }
                finally
                {
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 提交按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            ///首先判断销售订单中的数量是否扫描完全,如果没有扫描完全,提交时给出提示,
            ///让操作人员来判断是否继续提交。
            if (dispatchlist.OperateDetails == null || dispatchlist.OperateDetails.Count == 0)
            {
                return;
            }
            bool flag = true;

            //存货没有扫描完全
            if (dispatchlist.U8Details.Count > dispatchlist.OperateDetails.Count)
            {
                flag = false;
            }
            //存货的数量扫描不完全
            else
            {
                //循环遍历所有的订单存货
                foreach (DispatchDetail detail in dispatchlist.U8Details)
                {
                    decimal num = 0;//某存货已扫描数量
                    //在已操作数量中查询来源中的存货(同一存货的扫描数量累加)
                    foreach (DispatchDetail oDetail in dispatchlist.OperateDetails)
                    {
                        if (detail.cinvcode == oDetail.cinvcode)
                        {
                            num += oDetail.inewquantity;
                        }
                    }
                    if (num == 0 || detail.iquantity - detail.IFHQuantity > num)
                    {
                        flag = false;
                        break;//只要有一个存货没有扫描完成,即可跳出
                    }
                }
            }
            if (!flag)//没有扫描完全
            {
                DialogResult dr = MessageBox.Show("还有存货没有扫描完成,是否提交", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.No)//取消提交
                {
                    return;
                }
            }

            //添加监管码
            dispatchlist.cdefine10 = txtRegCode.Text.Trim();

            dispatchlist.cmaker = Common.CurrentUser.UserName;
            try
            {
                this.Enabled   = false;
                Cursor.Current = Cursors.WaitCursor;
                string errMsg = "";
                int    rt     = DispatchListBusiness.SaveDispatchList(dispatchlist, out errMsg);
                if (rt == 0)
                {
                    MessageBox.Show("提交成功!");
                    //默认为没有监管码
                    chkRegCode.Checked = false;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("提交失败!" + errMsg);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("提交失败!" + ex.Message);
            }
            finally
            {
                this.Enabled   = true;
                Cursor.Current = Cursors.Default;
            }
        }