private void 提交验证信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }

            OrdinaryInDepotBillStatus status = (OrdinaryInDepotBillStatus)Enum.Parse(
                typeof(OrdinaryInDepotBillStatus), dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString());

            if (status != OrdinaryInDepotBillStatus.等待工装验证)
            {
                MessageDialog.ShowPromptMessage("请选择等待工装验证的记录后再进行此操作");
                return;
            }

            if (txtMachineValidationID.Text.Trim() == "")
            {
                txtMachineValidationID.Focus();
                MessageDialog.ShowPromptMessage("请输入工装验证报告编号后再进行此操作");
                return;
            }

            string billNo = txtBill_ID.Text;

            S_OrdinaryInDepotBill bill = new S_OrdinaryInDepotBill();

            bill.Bill_ID             = billNo;
            bill.MachineValidationID = txtMachineValidationID.Text;
            bill.MachineManager      = BasicInfo.LoginID;
            bill.AllowInDepot        = chkAllowInDepot.Checked;
            bill.BillStatus          = OrdinaryInDepotBillStatus.等待入库.ToString();

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

            MessageDialog.ShowPromptMessage("成功提交,等待仓管入库!");

            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【仓管员】处理",
                            txtOrderFormNumber.Text, txtProposer.Text);

            PassFlowMessage(sb.ToString(),
                            m_billMessageServer.GetRoleStringForStorage(cmbStorage.Text));
            RefreshDataGridView(m_queryResult);
            PositioningRecord(billNo);
        }
        /// <summary>
        /// 采购员提交单据
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="status">提交后的单据状态</param>
        /// <param name="returnInfo">返回更新后重新查询的领料单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加领料单</returns>
        public bool SubmitNewBill(string billNo, OrdinaryInDepotBillStatus status, out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_OrdinaryInDepotBill
                             where r.Bill_ID == billNo
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("没有找到单据号为 {0} 的普通入库单信息,无法进行此操作", billNo);
                    return(false);
                }

                result.Single().BillStatus = status.ToString();
                result.Single().Bill_Time  = ServerModule.ServerTime.Time;

                if (!m_serverFrockStandingBook.DeleteFrockOrdinaryInDepotBill(dataContxt, billNo, out error))
                {
                    return(false);
                }

                //插入工装信息
                IDepotTypeForPersonnel serverDepot = ServerModuleFactory.GetServerModule <IDepotTypeForPersonnel>();

                if (serverDepot.GetDepotInfo(result.Single().Depot).DepotName == GlobalObject.CE_GoodsType.工装.ToString() &&
                    !CreateNewFrockMessage(result.Single(), out error))
                {
                    return(false);
                }

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        private void  除单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }

            if (txtBill_ID.Text.Trim() == "")
            {
                MessageDialog.ShowPromptMessage("请选择需要删除的记录");
                return;
            }

            OrdinaryInDepotBillStatus status = (OrdinaryInDepotBillStatus)Enum.Parse(typeof(OrdinaryInDepotBillStatus),
                                                                                     UniversalFunction.GetBillStatus("S_OrdinaryInDepotBill", "BillStatus", "Bill_ID", txtBill_ID.Text));

            if (status == OrdinaryInDepotBillStatus.已入库 || status == OrdinaryInDepotBillStatus.已报废)
            {
                MessageDialog.ShowPromptMessage("请选择未完成的记录后再进行此操作");
                return;
            }

            if (!CheckUserOperation(dataGridView1.SelectedRows[0]))
            {
                return;
            }

            string info = string.Format("您是否要删除 {0} 入库单时, 删除时同时也会删除此单据下的所有物品清单, 是否继续?", txtBill_ID.Text);

            if (MessageDialog.ShowEnquiryMessage(info) == DialogResult.No)
            {
                return;
            }

            if (!m_billServer.DeleteBill(txtBill_ID.Text, out m_queryResult, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            m_billNoControl.CancelBill(txtBill_ID.Text);
            DestroyMessage(txtBill_ID.Text);
            RefreshDataGridView(m_queryResult);
        }
        private void 质量验收ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!CheckSelectedRow())
            {
                return;
            }

            OrdinaryInDepotBillStatus status = (OrdinaryInDepotBillStatus)Enum.Parse(
                typeof(OrdinaryInDepotBillStatus), dataGridView1.SelectedRows[0].Cells["单据状态"].Value.ToString());

            if (status != OrdinaryInDepotBillStatus.等待质检)
            {
                MessageDialog.ShowPromptMessage("请选择等待质检的记录后再进行此操作");
                return;
            }

            if (!radYes.Checked && !radNo.Checked)
            {
                MessageDialog.ShowPromptMessage("请选择质量是否合格后再进行此操作");
                return;
            }

            string billNo = txtBill_ID.Text;

            S_OrdinaryInDepotBill bill = new S_OrdinaryInDepotBill();

            bill.Bill_ID = billNo;
            bill.QualityEligibilityFlag = radYes.Checked;
            bill.Checker       = BasicInfo.LoginID;
            bill.MassCheckDate = ServerTime.Time;

            if (chkNeedMachineManager.Checked)
            {
                bill.BillStatus = OrdinaryInDepotBillStatus.等待工装验证.ToString();
            }
            else
            {
                bill.BillStatus = OrdinaryInDepotBillStatus.等待入库.ToString();
            }

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

            StringBuilder sb = new StringBuilder();

            if (chkNeedMachineManager.Checked)
            {
                sb.AppendFormat("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【工装管理员】处理",
                                txtOrderFormNumber.Text, txtProposer.Text);
                PassFlowMessage(sb.ToString(), CE_RoleEnum.工装管理员);

                MessageDialog.ShowPromptMessage("成功提交,等待工装验证!");
            }
            else
            {
                sb.AppendFormat("【订单号】:{0} 【物品申请人】:{1}   ※※※ 等待【仓管员】处理",
                                txtOrderFormNumber.Text, txtProposer.Text);
                PassFlowMessage(sb.ToString(),
                                m_billMessageServer.GetRoleStringForStorage(cmbStorage.Text));

                MessageDialog.ShowPromptMessage("成功提交,等待仓管入库!");
            }

            RefreshDataGridView(m_queryResult);
            PositioningRecord(billNo);
        }