private void 查看领料清单ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMaterialListRejectBill form =
                new FormMaterialListRejectBill(CE_BusinessOperateMode.查看, txtProvider.Text, txtBill_ID.Text);

            form.ShowDialog();
        }
        private void 核实退货清单ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }

            if (lblBillStatus.Text != MaterialRejectBillBillStatus.等待仓管退货.ToString())
            {
                MessageDialog.ShowPromptMessage("请选择要仓管退货的记录后再进行此操作");
                return;
            }

            FormMaterialListRejectBill form =
                new FormMaterialListRejectBill(CE_BusinessOperateMode.仓库核实, txtProvider.Text, txtBill_ID.Text);

            form.ShowDialog();
        }
        private void 设置退货清单ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string billNo = txtBill_ID.Text;

            try
            {
                this.dataGridView1.CellEnter -= new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter);

                if (lblBillStatus.Text != MaterialRejectBillBillStatus.新建单据.ToString())
                {
                    MessageDialog.ShowPromptMessage("您现在不是处于新建单据状态,无法进行此操作");
                    return;
                }

                if (!CheckDataItem())
                {
                    return;
                }

                // 如果此单据存在则检查选择行
                if (m_billServer.IsExist(txtBill_ID.Text))
                {
                    if (!CheckSelectedRow())
                    {
                        return;
                    }

                    if (!CheckUserOperation(dataGridView1.SelectedRows[0]))
                    {
                        return;
                    }
                }
                else
                {
                    BASE_MaterialRequisitionPurpose purpose = txtProvider.Tag as BASE_MaterialRequisitionPurpose;

                    // 如果此单据还不存在则创建
                    S_MaterialRejectBill bill = new S_MaterialRejectBill();

                    bill.Bill_ID             = txtBill_ID.Text;
                    bill.Bill_Time           = ServerModule.ServerTime.Time;
                    bill.BillStatus          = MaterialRejectBillBillStatus.新建单据.ToString();
                    bill.Department          = BasicInfo.DeptCode;
                    bill.FillInPersonnel     = BasicInfo.LoginName;
                    bill.FillInPersonnelCode = BasicInfo.LoginID;
                    bill.Provider            = txtProvider.Text;
                    bill.Reason    = txtReason.Text;
                    bill.Remark    = txtRemark.Text;
                    bill.BillType  = cmbBillType.Text;
                    bill.StorageID = UniversalFunction.GetStorageID(cmbStorage.Text);

                    if (!m_billServer.AddBill(bill, out m_queryResult, out m_error))
                    {
                        MessageDialog.ShowErrorMessage(m_error);
                        return;
                    }
                }

                FormMaterialListRejectBill form =
                    new FormMaterialListRejectBill(CE_BusinessOperateMode.修改, txtProvider.Text, txtBill_ID.Text);
                form.ShowDialog();
            }
            finally
            {
                this.dataGridView1.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEnter);
            }

            RefreshDataGridView(m_queryResult);
            PositioningRecord(billNo);
        }