Esempio n. 1
0
        public List <DictionaryVmodel> GetProReportInstance(string strMonthReportID, string strProType, string strSystemID, string strBusinessID)
        {
            ReportInstance rpt = null;

            if (string.IsNullOrEmpty(strProType))
            {
                rpt = new ReportInstance(strMonthReportID.ToGuid(), true);
            }
            else
            {
                B_SystemBatch _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(strBusinessID.ToGuid());

                if (_BatchModel != null)
                {
                    List <V_SubReport> rptList = JsonHelper.Deserialize <List <V_SubReport> >(_BatchModel.SubReport);

                    V_SubReport rptModel = rptList.Find(p => p.SystemID == strSystemID.ToGuid());

                    rpt = new ReportInstance(rptModel.ReportID, true);
                }
            }


            List <DictionaryVmodel> listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);

            return(listSRDS);
        }
        public void Update(V_SubReport p)
        {
            List <NavigatActivity1> lstna = GetProcessIntance(p.ReportID.ToString(), new UserInfo {
                UserCode = "$VirtualUserCode$" + CurrentUser
            });
            string Json = Newtonsoft.Json.JsonConvert.SerializeObject(lstna);

            B_MonthlyreportOperator.Instance.UpdateReportApprove(p.ReportID, Json); //??
        }
Esempio n. 3
0
        /// <summary>
        /// 添加月度报告数据
        /// </summary>
        public void AddMonthlyReport()
        {
            HidSystemID.Value = ddlSystem.SelectedValue;

            HideProcessCode.Value = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value;

            B_SystemBatch BatchModel = null; // 公用的批次 实体

            B_MonthlyReport bmr = null;      // 公用B_MonthlyReport 实体

            //首先判断系统, 是否是包含在批次里
            string Gtypt = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].GroupType;

            if (!string.IsNullOrEmpty(Gtypt))
            {
                #region 包含在批次里的数据的业务系统

                //判断当前URL是否存在BusinessID
                if (string.IsNullOrEmpty(Request["BusinessID"]))
                {
                    B_MonthlyReport _statreRpt = null; //-状态B_MonthlyReport -

                    BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch("ProSystem", FinYear, FinMonth);

                    //判断批次表中是否有数据
                    if (BatchModel == null)
                    {
                        BatchModel = AddSystemBatch();
                    }
                    else
                    {
                        //批次不为Null,且批次还是在审批中的。
                        //批次是草稿状态
                        List <V_SubReport> V_SubReportList = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport);

                        //获取上报月报的ID
                        var subRpt = V_SubReportList.Find(SR => SR.SystemID == HidSystemID.Value.ToGuid());

                        B_MonthlyReport monthRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(subRpt.ReportID);



                        #region  批次存在

                        //审批进行中,是要被跳转到审批页面的,但是审批完成就需要重新开启新的流程
                        if (BatchModel.WFBatchStatus == "Progress" || monthRpt.WFStatus == "Progress")
                        {
                            //批次是草稿状态
                            var model = V_SubReportList.Find(p => p.SystemID == HidSystemID.Value.ToGuid());

                            //---------------------------------------------------------------------------------------------------------------------------------------------
                            //这里批次需要控制,每次审批的状态只能是唯一的
                            // 暂时注销掉  BatchModel = AddSystemBatch();

                            var host = new LJTH.BusinessIndicators.Web.AjaxHander.ProProcessController();
                            host.BusinessID = model.ReportID.ToString();

                            if (BPF.Workflow.Client.WFClientSDK.Exist(host.BusinessID))
                            {
                                BPF.Workflow.Object.WorkflowContext wc = BPF.Workflow.Client.WFClientSDK.GetProcess(null, host.BusinessID);
                                if (!wc.CurrentUserHasTodoTask)
                                {
                                    Server.Transfer("~/BusinessReport/ProTargetApprove.aspx?BusinessID=" + host.BusinessID);
                                }
                                else
                                {
                                    bmr = monthRpt;
                                    hideMonthReportID.Value = monthRpt.ID.ToString();
                                }
                            }
                            //WfClientListener.Listen(host, null);
                            //if (WfClientContext.Current.ProcessResponse.FromReadOnly)
                            //{
                            //    HttpContext.Current.Response.Clear();
                            //    Server.Transfer("~/BusinessReport/ProTargetApprove.aspx?BusinessID=" + host.BusinessID);
                            //}

                            //---------------------------------------------------------------------------------------------------------------------------------------------
                        }
                        else if (BatchModel.WFBatchStatus == "Approved") //如果审批是完成状态,重新生产
                        {
                            BatchModel = AddSystemBatch();
                        }
                        else
                        {
                            //批次是草稿状态

                            V_SubReportList.ForEach(p =>
                            {     //选择的是那个系统?
                                if (p.SystemID == Guid.Parse(ddlSystem.SelectedValue))
                                { //根据选择的系统,将明细数据展示出来
                                    _statreRpt = B_MonthlyreportOperator.Instance.GetMonthlyreport(p.ReportID);

                                    if (_statreRpt.WFStatus == "Cancel")      //如果当前月报是作废的状态,则重新生产一个新的ID   ( 这里针对作废后,重新起一个流程)
                                    {
                                        _statreRpt.ID       = Guid.NewGuid(); //替换实体ID
                                        _statreRpt.WFStatus = "Draft";
                                        _statreRpt.Status   = 2;
                                        Guid _BRptID        = B_MonthlyreportOperator.Instance.AddMonthlyreport(_statreRpt);

                                        p.ReportID              = _BRptID;
                                        HiddenBatch.Value       = BatchModel.ID.ToString(); //批次ID不变
                                        hideMonthReportID.Value = p.ReportID.ToString();
                                    }
                                    else
                                    {
                                        //注意这里
                                        hideMonthReportID.Value = p.ReportID.ToString();
                                        HiddenBatch.Value       = p.ReportID.ToString();
                                    }

                                    AddBMRD(_statreRpt);
                                    bmr = _statreRpt;
                                    MutipleUpload.LoadByBusinessID(_statreRpt.ID.ToString());
                                }
                            });


                            //这里重新序列,将作废后,重新生成的新ID 序列化到批次里
                            BatchModel.SubReport = JsonConvert.SerializeObject(V_SubReportList);
                            B_SystemBatchOperator.Instance.UpdateSystemBatch(BatchModel);
                        }

                        #endregion
                    }
                }
                else
                {
                    //如果是传过来的BusinessID,就直接去查询,不做操作
                    //通过BusinessID,首先获取批次的实体,根据权限,然后在批次中寻找
                    HiddenBatch.Value = Request["BusinessID"];
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid());
                    ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null");

                    if (bmr.SystemBatchID != Guid.Empty)
                    {
                        BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(bmr.SystemBatchID);
                        List <V_SubReport> rptLsit  = JsonConvert.DeserializeObject <List <V_SubReport> >(BatchModel.SubReport);
                        V_SubReport        rptModel = rptLsit.Find(f => f.SystemID == ddlSystem.SelectedValue.ToGuid());
                        hideMonthReportID.Value = rptModel.ReportID.ToString();
                        bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(rptModel.ReportID);
                        ExceptionHelper.TrueThrow <ArgumentNullException>(bmr == null ? true : false, "Argument B_MonthlyReport is Null");
                        MutipleUpload.LoadByBusinessID(bmr.ID.ToString());
                        UserControl.SetButtonSpanStyle(bmr.Status);
                    }
                }

                #endregion
            }
            else
            {
                #region 没有包含在批次里系统
                if (string.IsNullOrEmpty(Request["BusinessID"])) //正常上报
                {
                    //添加月报说明
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyReportDraft(Guid.Parse(ddlSystem.SelectedValue), FinYear, FinMonth);
                    if (bmr == null)
                    {
                        bmr = AddMR();
                    }
                    else
                    {
                        if (bmr.WFStatus == "Progress" || bmr.WFStatus == "Approved")
                        {
                            bmr = AddMR();
                        }
                    }
                    //为当前月度经营报告(bmr),插入月度经营明细数据
                    AddBMRD(bmr);
                    hideMonthReportID.Value = bmr.ID.ToString();
                }
                else
                {
                    hideMonthReportID.Value = Request["BusinessID"];
                    bmr = B_MonthlyreportOperator.Instance.GetMonthlyreport(Request["BusinessID"].ToGuid());
                    ddlSystem.SelectedValue = bmr.SystemID.ToString();
                    FinYear      = bmr.FinYear;
                    FinMonth     = bmr.FinMonth;
                    lblName.Text = "";
                    lblName.Text = FinYear + "-" + FinMonth + "月度经营报告上报";
                }

                if (bmr != null)
                {
                    MutipleUpload.LoadByBusinessID(bmr.ID.ToString());
                    UserControl.SetButtonSpanStyle(bmr.Status);
                }

                #endregion
            }
            if (bmr != null)
            {
                List <BPF.Workflow.Object.ProcessLog> lstBatchProcessLog = new List <BPF.Workflow.Object.ProcessLog>();
                if (bmr.SystemBatchID != Guid.Empty)
                {
                    //if (BPF.Workflow.Client.WFClientSDK.Exist(bmr.SystemBatchID.ToString()))
                    //{
                    //    lstBatchProcessLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bmr.SystemBatchID.ToString());
                    //}
                }
                //List<BPF.Workflow.Object.ProcessLog> lstCurrentProcessLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(bmr.ID.ToString());

                //if (lstBatchProcessLog!=null)
                //{
                //    lstCurrentProcessLog.AddRange(lstBatchProcessLog);
                //}
                //HideOpinions.Value = JsonConvert.SerializeObject(lstCurrentProcessLog.OrderByDescending(p => p.FinishDateTime));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 通过批次获取月报的审批
        /// </summary>
        private void LoadBatchData(bool isFirst)
        {
            HiddBusinessID.Value = Request.QueryString["BusinessID"];
            HideProType.Value    = Request.QueryString["ProType"];

            #region  获取子流程和主流程的审批日志
            _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(Guid.Parse(Request.QueryString["BusinessID"]));
            List <ProcessLog>  listALLProLog = new List <ProcessLog>();
            List <ProcessLog>  listProLog    = new List <ProcessLog>(); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Opinions);
            List <V_SubReport> BatchRptList  = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport);
            for (int i = 0; i < BatchRptList.Count; i++)
            {
                if (BPF.Workflow.Client.WFClientSDK.Exist(BatchRptList[i].ReportID.ToString()))
                {
                    listProLog.AddRange(BPF.Workflow.Client.WFClientSDK.GetProcessLogList(BatchRptList[i].ReportID.ToString()));
                }
            }
            List <ProcessLog> listBatchProLog = null;
            if (BPF.Workflow.Client.WFClientSDK.Exist(_BatchModel.ID.ToString()))
            {
                listBatchProLog = BPF.Workflow.Client.WFClientSDK.GetProcessLogList(_BatchModel.ID.ToString()); //JsonConvert.DeserializeObject<List<ProcessLog>>(_BatchModel.Batch_Opinions);
            }
            if (listBatchProLog != null)
            {
                listALLProLog.AddRange(listBatchProLog);
            }
            if (listProLog != null)
            {
                listALLProLog.AddRange(listProLog);
            }
            if (listALLProLog != null)
            {
                //这里去掉汇总审批时的虚拟节点同意日志
                HideOpinions.Value = JsonConvert.SerializeObject(listALLProLog.Where(p => p.NodeType != 7).OrderByDescending(p => p.FinishDateTime));
            }
            #endregion

            List <C_System> sysList = null;

            if (isFirst)
            {
                //判断批次号
                if (_BatchModel != null)
                {
                    List <V_SubReport> rptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport);
                    if (sysList != null && sysList.Count == 1)
                    {
                        V_SubReport rptModel = rptList.Find(p => p.SystemID == sysList[0].ID);
                        //在当前批次中,的项目系统
                        hideMonthReportID.Value = rptModel.ReportID.ToString();
                    }
                    else
                    {
                        ddlSystem.DataSource     = rptList;
                        ddlSystem.DataTextField  = "SystemName";
                        ddlSystem.DataValueField = "SystemID";
                        ddlSystem.DataBind();

                        V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid());

                        lblName.Text = _BatchModel.FinYear + "-" + _BatchModel.FinMonth + "月度经营报告";

                        HiddenMonth.Value = _BatchModel.FinMonth.ToString();

                        //在当前批次中,的项目系统
                        hideMonthReportID.Value = rptModel.ReportID.ToString();
                        hideSystemID.Value      = ddlSystem.SelectedValue;
                        HideProcessCode.Value   = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value;
                    }
                }
            }
            else
            {
                //判断批次号
                if (_BatchModel != null)
                {
                    List <V_SubReport> rptList = JsonConvert.DeserializeObject <List <V_SubReport> >(_BatchModel.SubReport);

                    V_SubReport rptModel = rptList.Find(p => p.SystemID == ddlSystem.SelectedValue.ToGuid());
                    //在当前批次中,的项目系统
                    hideMonthReportID.Value = rptModel.ReportID.ToString();
                    hideSystemID.Value      = ddlSystem.SelectedValue;
                    HideProcessCode.Value   = StaticResource.Instance[ddlSystem.SelectedValue.ToGuid(), DateTime.Now].Configuration.Element("ProcessCode").Value;
                    lblName.Text            = _BatchModel.FinYear + "-" + _BatchModel.FinMonth + "月度经营报告";
                    HiddenMonth.Value       = _BatchModel.FinMonth.ToString();
                }
            }
        }