public override void LoadFormInfo()
        {
            try
            {
                m_billNoControl = new BillNumberControl(CE_BillTypeEnum.判定报告.ToString(), m_serviceJudgeReport);
                m_lnqBillInfo   = m_serviceJudgeReport.GetSingleBillInfo(this.FlowInfo_BillNo);
                SetInfo();

                switch (lbBillStatus.Text)
                {
                case "新建单据":
                    groupBox2.Enabled = false;
                    break;

                case "等待最终判定":
                    groupBox1.Enabled = false;
                    break;

                case "单据完成":
                    groupBox1.Enabled = false;
                    groupBox2.Enabled = false;
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowErrorMessage(ex.Message);
            }
        }
        void SetInfo()
        {
            if (m_lnqBillInfo != null)
            {
                lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo);

                SetRadioButton_Judge(m_lnqBillInfo.Judge);
                SetRadioButton_FinalJudge(m_lnqBillInfo.FinalJudge);

                txtBillNo.Text            = m_lnqBillInfo.BillNo;
                txtFinalJudgeExplain.Text = m_lnqBillInfo.FinalJudgeExplain;
                txtJudgeExplain.Text      = m_lnqBillInfo.JudgeExplain;
                txtJudgeReportNo.Text     = m_lnqBillInfo.JudgeReportNo;

                chbIsFinalJudge.Checked = m_lnqBillInfo.IsFinalJudge;
            }
            else
            {
                lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString();

                m_lnqBillInfo = new Business_InspectionJudge_JudgeReport();

                txtBillNo.Text       = this.FlowInfo_BillNo;
                m_lnqBillInfo.BillNo = txtBillNo.Text;
            }

            m_listViewDetail = m_serviceJudgeReport.GetListViewDetailInfo(m_lnqBillInfo.BillNo);
            m_listViewItem   = m_serviceJudgeReport.GetListViewItemInfo(m_lnqBillInfo.BillNo);
            RefreshDataGridView(m_listViewDetail, m_listViewItem);
        }
        private bool 判定报告_Form_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            IJudgeReport m_serviceJudgeReport = Service_Quality_QC.ServerModuleFactory.GetServerModule <IJudgeReport>();

            try
            {
                Business_InspectionJudge_JudgeReport lnqJudgeReport =
                    form.ResultList[0] as Business_InspectionJudge_JudgeReport;

                this.OperationType =
                    GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[1].ToString());

                List <View_Business_InspectionJudge_JudgeReportDetail> detailInfo =
                    form.ResultList[2] as List <View_Business_InspectionJudge_JudgeReportDetail>;

                List <View_Business_InspectionJudge_JudgeReport_Item> itemInfo =
                    form.ResultList[3] as List <View_Business_InspectionJudge_JudgeReport_Item>;

                this.BillNo = lnqJudgeReport.BillNo;

                switch (this.OperationType)
                {
                case CE_FlowOperationType.提交:
                    m_serviceJudgeReport.SaveInfo(lnqJudgeReport, itemInfo, detailInfo);
                    break;

                case CE_FlowOperationType.暂存:
                    m_serviceJudgeReport.SaveInfo(lnqJudgeReport, itemInfo, detailInfo);
                    break;

                case CE_FlowOperationType.回退:
                    break;

                case CE_FlowOperationType.未知:
                    break;

                default:
                    break;
                }

                if (!m_serviceJudgeReport.IsExist(lnqJudgeReport.BillNo))
                {
                    MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面");
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 保存业务信息
        /// </summary>
        /// <param name="billInfo">业务总单信息</param>
        /// <param name="detailInfo">业务明细信息</param>
        public void SaveInfo(Business_InspectionJudge_JudgeReport billInfo,
                             List <View_Business_InspectionJudge_JudgeReport_Item> itemInfo, List <View_Business_InspectionJudge_JudgeReportDetail> detailInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            ctx.Connection.Open();
            ctx.Transaction = ctx.Connection.BeginTransaction();

            try
            {
                var varData = from a in ctx.Business_InspectionJudge_JudgeReport
                              where a.BillNo == billInfo.BillNo
                              select a;

                if (varData.Count() == 1)
                {
                    Business_InspectionJudge_JudgeReport lnqBill = varData.Single();

                    lnqBill.BillNo            = billInfo.BillNo;
                    lnqBill.FinalJudge        = billInfo.FinalJudge;
                    lnqBill.FinalJudgeExplain = billInfo.FinalJudgeExplain;
                    lnqBill.IsFinalJudge      = billInfo.IsFinalJudge;
                    lnqBill.Judge             = billInfo.Judge;
                    lnqBill.JudgeExplain      = billInfo.JudgeExplain;
                    lnqBill.JudgeReportNo     = billInfo.JudgeReportNo;
                }
                else if (varData.Count() == 0)
                {
                    ctx.Business_InspectionJudge_JudgeReport.InsertOnSubmit(billInfo);
                }
                else
                {
                    throw new Exception("单据数据不唯一");
                }

                ctx.SubmitChanges();

                var varItem = from a in ctx.Business_InspectionJudge_JudgeReport_Item
                              where a.BillNo == billInfo.BillNo
                              select a;

                ctx.Business_InspectionJudge_JudgeReport_Item.DeleteAllOnSubmit(varItem);
                ctx.SubmitChanges();

                foreach (View_Business_InspectionJudge_JudgeReport_Item item in itemInfo)
                {
                    Business_InspectionJudge_JudgeReport_Item lnqItem = new Business_InspectionJudge_JudgeReport_Item();

                    lnqItem.BillNo      = billInfo.BillNo;
                    lnqItem.JudgeItem   = item.判定项目;
                    lnqItem.JudgeResult = item.判定结果;

                    ctx.Business_InspectionJudge_JudgeReport_Item.InsertOnSubmit(lnqItem);
                    ctx.SubmitChanges();
                }

                var varDetail = from a in ctx.Business_InspectionJudge_JudgeReportDetail
                                where a.BillNo == billInfo.BillNo
                                select a;

                ctx.Business_InspectionJudge_JudgeReportDetail.DeleteAllOnSubmit(varDetail);
                ctx.SubmitChanges();

                foreach (View_Business_InspectionJudge_JudgeReportDetail item in detailInfo)
                {
                    Business_InspectionJudge_JudgeReportDetail lnqDetail = new Business_InspectionJudge_JudgeReportDetail();

                    lnqDetail.BillNo     = billInfo.BillNo;
                    lnqDetail.BatchNo    = item.批次号;
                    lnqDetail.BillRelate = item.关联业务;
                    lnqDetail.GoodsCount = item.数量;
                    lnqDetail.GoodsID    = item.物品ID;
                    lnqDetail.Provider   = item.供应商;
                    lnqDetail.Remark     = item.备注;

                    ctx.Business_InspectionJudge_JudgeReportDetail.InsertOnSubmit(lnqDetail);
                    ctx.SubmitChanges();
                }

                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
        private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType)
        {
            try
            {
                m_lnqBillInfo            = new Business_InspectionJudge_JudgeReport();
                m_lnqBillInfo.Judge      = GetRadioButton_Judge();
                m_lnqBillInfo.FinalJudge = GetRadioButton_FinalJudge();

                if (!CheckData())
                {
                    return(false);
                }

                m_lnqBillInfo.BillNo            = txtBillNo.Text;
                m_lnqBillInfo.IsFinalJudge      = chbIsFinalJudge.Checked;
                m_lnqBillInfo.JudgeExplain      = txtJudgeExplain.Text;
                m_lnqBillInfo.JudgeReportNo     = txtJudgeReportNo.Text;
                m_lnqBillInfo.FinalJudgeExplain = txtFinalJudgeExplain.Text;

                List <View_Business_InspectionJudge_JudgeReport_Item> listItemTemp = new List <View_Business_InspectionJudge_JudgeReport_Item>();

                foreach (DataGridViewRow dgvr in customDataGridView2.Rows)
                {
                    View_Business_InspectionJudge_JudgeReport_Item itemTemp = new View_Business_InspectionJudge_JudgeReport_Item();

                    itemTemp.判定项目 = dgvr.Cells["判定项目"].Value == null ? "" : dgvr.Cells["判定项目"].Value.ToString();
                    itemTemp.判定结果 = dgvr.Cells["判定结果"].Value == null ? "" : dgvr.Cells["判定结果"].Value.ToString();
                    itemTemp.单据号  = txtBillNo.Text;

                    listItemTemp.Add(itemTemp);
                }

                List <View_Business_InspectionJudge_JudgeReportDetail> listDetailTemp = new List <View_Business_InspectionJudge_JudgeReportDetail>();

                foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                {
                    View_Business_InspectionJudge_JudgeReportDetail detailTemp = new View_Business_InspectionJudge_JudgeReportDetail();

                    detailTemp.备注   = dgvr.Cells["备注"].Value == null ? "" : dgvr.Cells["备注"].Value.ToString();
                    detailTemp.单位   = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString();
                    detailTemp.供应商  = dgvr.Cells["供应商"].Value == null ? "" : dgvr.Cells["供应商"].Value.ToString();
                    detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString();
                    detailTemp.规格   = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString();
                    detailTemp.批次号  = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString();
                    detailTemp.数量   = dgvr.Cells["数量"].Value == null ? 0 : Convert.ToDecimal(dgvr.Cells["数量"].Value);
                    detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString();
                    detailTemp.物品ID = dgvr.Cells["物品ID"].Value == null ? 0 : Convert.ToInt32(dgvr.Cells["物品ID"].Value);
                    detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString();
                    detailTemp.单据号  = txtBillNo.Text;

                    listDetailTemp.Add(detailTemp);
                }

                this.FlowInfo_BillNo = txtBillNo.Text;

                this.ResultList = new List <object>();

                this.ResultList.Add(m_lnqBillInfo);
                this.ResultList.Add(flowOperationType);
                this.ResultList.Add(listDetailTemp);
                this.ResultList.Add(listItemTemp);

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }