Beispiel #1
0
        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 (SaleBackGSPBusiness.GetSaleBack(txtSource.Text, out salebackgsp, out errMsg))
                    {
                        btnSource.Enabled = true;
                        txtLable.Enabled  = true;
                        txtLable.Focus();

                        ///判断当前仓库集合中是否有该单据的仓库,若没有则表明该用户无权操作。
                        string cwhcode = salebackgsp.U8Details[0].cwhcode;
                        bool   flag    = false;
                        foreach (Warehouse w in Common.s_Warehouse)
                        {
                            if (w.cwhcode == cwhcode)
                            {
                                cmbWarehouse.SelectedItem = w;
                                flag = true;
                                //退化单文本框不再可用
                                txtSource.Enabled = false;
                                break;
                            }
                        }
                        if (!flag)//如果没有找到对应的仓库
                        {
                            MessageBox.Show("该单据您无权操作!");
                            return;
                        }
                    }
                    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;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 点击提交按钮处理事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            //验证数量是否已扫描完
            if (salebackgsp.U8Details.Count == salebackgsp.OperateDetails.Count)
            {
                foreach (SaleBackGSPDetail detail in salebackgsp.U8Details)
                {
                    SaleBackGSPDetail ddtmp = salebackgsp.OperateDetails.Find(delegate(SaleBackGSPDetail tdd) { return(tdd.cinvcode.Equals(detail.cinvcode) && tdd.CBATCH.Equals(detail.CBATCH)); });
                    if (ddtmp == null)
                    {
                        MessageBox.Show("还有没扫描的货物:" + detail.cinvname);
                        return;
                    }
                    if (ddtmp.FQUANTITY != ddtmp.ScanCount)
                    {
                        MessageBox.Show("货物:" + detail.cinvname + "的数量与单据数量不符");
                        return;
                    }
                }
            }
            else
            {
                MessageBox.Show("还有没扫描的货物!");
                return;
            }

            salebackgsp.CMAKER = Common.CurrentUser.UserName;
            try
            {
                this.Enabled   = false;
                Cursor.Current = Cursors.WaitCursor;
                string errMsg = "";
                int    rt     = SaleBackGSPBusiness.SaveSaleBackGSP(salebackgsp, out errMsg);
                if (rt == 0)
                {
                    MessageBox.Show("提交成功!");
                }
                else
                {
                    MessageBox.Show("提交失败!" + errMsg);
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("提交失败!" + ex.Message);
            }
            finally
            {
                this.Enabled   = true;
                Cursor.Current = Cursors.Default;
            }
        }