Ejemplo n.º 1
0
        public List <DictionaryVmodel> GetMissTargetList(string rpts)
        {
            ReportInstance          rpt            = JsonHelper.Deserialize <ReportInstance>(rpts);
            List <DictionaryVmodel> MissTargetData = new List <DictionaryVmodel>();

            if (rpt._MonthReportID != Guid.Empty)
            {
                B_MonthlyReportJsonData B_JsonData = new B_MonthlyReportJsonData();
                try
                {
                    B_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(rpt._MonthReportID);
                }
                catch (Exception)
                {
                    B_JsonData = null;
                }

                //获取 表中的JSon数据
                if (B_JsonData != null && !string.IsNullOrEmpty(B_JsonData.QuerryMissJsonData))
                {
                    MissTargetData = JsonHelper.Deserialize <List <DictionaryVmodel> >(B_JsonData.QuerryMissJsonData);
                }
                else
                {
                    MissTargetData = ReportInstanceMissTargetEngine.ReportInstanceMissTargetService.GetMissTargetRptDataSource(rpt);
                }
            }
            return(MissTargetData);
        }
Ejemplo n.º 2
0
        //修改明细数据   End  ********************************************************************************************


        /// <summary>
        /// 保存,修改后明细的数据JSon需要更新
        /// </summary>
        /// <param name="MonthReportID">月报ID</param>
        /// <param name="CurrentRpt"></param>
        /// <param name="ListObj"></param>
        private void SaveJsonData(Guid MonthReportID, ReportInstance CurrentRpt, List <DictionaryVmodel> ListObj)
        {
            B_MonthlyReportJsonData Update_JsonData;

            try
            {
                Update_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(MonthReportID);
            }
            catch (Exception ex)//去Json 表中查看下数据
            {
                Update_JsonData = null;
            }

            if (Update_JsonData != null)
            {
                Update_JsonData.SystemID   = CurrentRpt._SystemID;
                Update_JsonData.PlanType   = "M";
                Update_JsonData.FinMonth   = CurrentRpt.FinMonth;
                Update_JsonData.FinYear    = CurrentRpt.FinYear;
                Update_JsonData.ModifyTime = DateTime.Now;

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                Update_JsonData.ReportJsonData = sb.ToString();

                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.UpdateMonthlyReportJsonData(Update_JsonData);
            }
            else
            {
                //新增数据
                B_MonthlyReportJsonData JsonData = new B_MonthlyReportJsonData();
                JsonData.ID         = MonthReportID;
                JsonData.SystemID   = CurrentRpt._SystemID;
                JsonData.PlanType   = "M";
                JsonData.FinMonth   = CurrentRpt.FinMonth;
                JsonData.FinYear    = CurrentRpt.FinYear;
                JsonData.CreateTime = DateTime.Now;

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                JsonData.ReportJsonData = sb.ToString();

                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.AddMonthlyReportJsonData(JsonData);
            }
        }
Ejemplo n.º 3
0
        public List <DictionaryVmodel> GetTargetReturnList(string rpts)
        {
            ReportInstance rpt = JsonHelper.Deserialize <ReportInstance>(rpts);

            List <DictionaryVmodel> ReturnData = new List <DictionaryVmodel>();

            if (rpt._MonthReportID != Guid.Empty)
            {
                B_MonthlyReportJsonData B_JsonData = new B_MonthlyReportJsonData();
                try
                {
                    B_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(rpt._MonthReportID);
                }
                catch (Exception)
                {
                    B_JsonData = null;
                }

                //获取 表中的JSon数据
                if (B_JsonData != null && !string.IsNullOrEmpty(B_JsonData.QuerryReturnJsonData))
                {
                    ReturnData = JsonHelper.Deserialize <List <DictionaryVmodel> >(B_JsonData.QuerryReturnJsonData);
                }
                else
                {
                    C_System sys;
                    if (rpt.ReportDetails != null && rpt.ReportDetails.Count() > 0)
                    {
                        sys = StaticResource.Instance[rpt._System.ID, rpt.ReportDetails[0].CreateTime];
                    }
                    else
                    {
                        sys = StaticResource.Instance[rpt._System.ID, DateTime.Now];
                    }

                    ReturnData = ReportInstanceReturnEngine.ReportInstanceReturnService.GetReturnRptDataSource(rpt, sys); //rpt.GetReturnRptDataSource();
                }
            }
            return(ReturnData);
        }
Ejemplo n.º 4
0
        private List <DictionaryVmodel> GetJsonData(Guid MonthlyReportID)
        {
            List <DictionaryVmodel> listSRDS = null;

            B_MonthlyReportJsonData B_JsonData = new B_MonthlyReportJsonData();

            try
            {
                B_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(MonthlyReportID);
            }
            catch (Exception)
            {
                B_JsonData = null;
            }

            //获取 表中的JSon数据
            if (B_JsonData != null && !string.IsNullOrEmpty(B_JsonData.QuerrySumJsonData))
            {
                listSRDS = JsonHelper.Deserialize <List <DictionaryVmodel> >(B_JsonData.QuerrySumJsonData);
            }

            return(listSRDS);
        }
        /// <summary>
        /// 保存,上报的时候序列化后的Json数据
        /// </summary>
        /// <param name="MonthReportID"></param>
        private void SaveJsonData(Guid MonthReportID, Guid SysId, int FinYear, int FinMonth, ReportInstance CurrentRpt)
        {
            B_MonthlyReportJsonData Update_JsonData;

            try
            {
                Update_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(MonthReportID);
            }
            catch (Exception) //去Json 表中查看下数据
            {
                Update_JsonData = null;
            }
            if (Update_JsonData != null)
            {
                //如果修改的话,顺便修改下B_MonthlyReport的字段,便于服务重构Json
                var BMR = B_MonthlyreportOperator.Instance.GetMonthlyreport(MonthReportID);


                Update_JsonData.SystemID   = SysId;
                Update_JsonData.PlanType   = "M";
                Update_JsonData.FinMonth   = FinMonth;
                Update_JsonData.FinYear    = FinYear;
                Update_JsonData.ModifyTime = DateTime.Now;

                List <DictionaryVmodel> ListObj = new List <DictionaryVmodel>();
                //这是上报页面的Json 数据
                TargetReportedControll trc = new TargetReportedControll();

                ReportInstance rpt = new ReportInstance(MonthReportID, true);
                ListObj.Add(new DictionaryVmodel("ReportInstance", rpt));                                       //
                ListObj.Add(new DictionaryVmodel("MonthDetail", trc.GetTargetDetailList(rpt, "Detail", true))); //

                ReportInstance rpt2 = new ReportInstance(MonthReportID, true);

                ListObj.Add(new DictionaryVmodel("Misstarget", trc.GetMissTargetList(rpt2, MonthReportID.ToString(), true)));
                ListObj.Add(new DictionaryVmodel("MonthReportDescription", trc.GetMonthTRptDescription(rpt2)));

                ReportInstance rpt3 = new ReportInstance(MonthReportID, true);
                ListObj.Add(new DictionaryVmodel("CurrentMisstarget", trc.GetCurrentMissTargetList(rpt3, MonthReportID.ToString(), true)));

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                Update_JsonData.ReportJsonData = sb.ToString();

                //修改的话,将查询的数据赋值为Null
                Update_JsonData.QuerryCurrentMissJsonData = string.Empty;
                Update_JsonData.QuerryDetaileJsonData     = string.Empty;
                Update_JsonData.QuerryMissJsonData        = string.Empty;
                Update_JsonData.QuerryReturnJsonData      = string.Empty;
                Update_JsonData.QuerrySumJsonData         = string.Empty;
                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.UpdateMonthlyReportJsonData(Update_JsonData);

                //让服务重新计算。
                BMR.DataOptimizationJson = string.Empty;
                B_MonthlyreportOperator.Instance.UpdateMonthlyreport(BMR);
            }
            else
            {
                //新增数据
                B_MonthlyReportJsonData JsonData = new B_MonthlyReportJsonData();
                JsonData.ID         = MonthReportID;
                JsonData.SystemID   = SysId;
                JsonData.PlanType   = "M";
                JsonData.FinMonth   = FinMonth;
                JsonData.FinYear    = FinYear;
                JsonData.CreateTime = DateTime.Now;

                List <DictionaryVmodel> ListObj = new List <DictionaryVmodel>();

                //这是上报页面的Json 数据
                TargetReportedControll trc = new TargetReportedControll();

                ReportInstance rpt = new ReportInstance(MonthReportID, true);
                ListObj.Add(new DictionaryVmodel("ReportInstance", rpt));                                       //
                ListObj.Add(new DictionaryVmodel("MonthDetail", trc.GetTargetDetailList(rpt, "Detail", true))); //

                ReportInstance rpt2 = new ReportInstance(MonthReportID, true);
                ListObj.Add(new DictionaryVmodel("Misstarget", trc.GetMissTargetList(rpt2, MonthReportID.ToString(), true)));
                ListObj.Add(new DictionaryVmodel("MonthReportDescription", trc.GetMonthTRptDescription(rpt2)));

                ReportInstance rpt3 = new ReportInstance(MonthReportID, true);
                ListObj.Add(new DictionaryVmodel("CurrentMisstarget", trc.GetCurrentMissTargetList(rpt3, MonthReportID.ToString(), true)));

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                JsonData.ReportJsonData = sb.ToString();

                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.AddMonthlyReportJsonData(JsonData);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 保存,上报的时候序列化后的Json数据
        /// </summary>
        /// <param name="MonthReportID"></param>
        private void SaveJsonData(Guid MonthReportID)
        {
            B_MonthlyReportJsonData Update_JsonData;
            ReportInstance          CurrentRpt = new ReportInstance(MonthReportID, true);

            try
            {
                Update_JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(MonthReportID);
            }
            catch (Exception ex)//去Json 表中查看下数据
            {
                Update_JsonData = null;
            }

            if (Update_JsonData != null)
            {
                Update_JsonData.SystemID   = SysId;
                Update_JsonData.PlanType   = "M";
                Update_JsonData.FinMonth   = FinMonth;
                Update_JsonData.FinYear    = FinYear;
                Update_JsonData.ModifyTime = DateTime.Now;

                List <DictionaryVmodel> ListObj = new List <DictionaryVmodel>();

                TargetReportedControll trc = new TargetReportedControll();

                //这是上报页面的Json 数据

                if (!string.IsNullOrEmpty(Update_JsonData.ReportJsonData))
                {
                    ListObj = JsonHelper.Deserialize <List <DictionaryVmodel> >(Update_JsonData.ReportJsonData);

                    ListObj.ForEach(L =>
                    {
                        if (L.Name == "Misstarget")
                        {
                            L.ObjValue = trc.GetMissTargetList(CurrentRpt, MonthReportID.ToString(), true);
                        }

                        if (L.Name == "CurrentMisstarget")
                        {
                            L.ObjValue = trc.GetCurrentMissTargetList(CurrentRpt, MonthReportID.ToString(), true);
                        }
                    });
                }
                else
                {
                    ListObj.Add(new DictionaryVmodel("ReportInstance", CurrentRpt));                                       //
                    ListObj.Add(new DictionaryVmodel("MonthDetail", trc.GetTargetDetailList(CurrentRpt, "Detail", true))); //
                    ListObj.Add(new DictionaryVmodel("Misstarget", trc.GetMissTargetList(CurrentRpt, MonthReportID.ToString(), true)));
                    ListObj.Add(new DictionaryVmodel("MonthReportDescription", trc.GetMonthTRptDescription(CurrentRpt)));
                    ListObj.Add(new DictionaryVmodel("CurrentMisstarget", trc.GetCurrentMissTargetList(CurrentRpt, MonthReportID.ToString(), true)));
                }

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                Update_JsonData.ReportJsonData = sb.ToString();

                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.UpdateMonthlyReportJsonData(Update_JsonData);
            }
            else
            {
                //新增数据
                B_MonthlyReportJsonData JsonData = new B_MonthlyReportJsonData();
                JsonData.ID         = MonthReportID;
                JsonData.SystemID   = SysId;
                JsonData.PlanType   = "M";
                JsonData.FinMonth   = FinMonth;
                JsonData.FinYear    = FinYear;
                JsonData.CreateTime = DateTime.Now;

                List <DictionaryVmodel> ListObj = new List <DictionaryVmodel>();

                //这是上报页面的Json 数据
                TargetReportedControll trc = new TargetReportedControll();
                ListObj.Add(new DictionaryVmodel("ReportInstance", CurrentRpt));                                       //
                ListObj.Add(new DictionaryVmodel("MonthDetail", trc.GetTargetDetailList(CurrentRpt, "Detail", true))); //
                ListObj.Add(new DictionaryVmodel("Misstarget", trc.GetMissTargetList(CurrentRpt, MonthReportID.ToString(), true)));
                ListObj.Add(new DictionaryVmodel("MonthReportDescription", trc.GetMonthTRptDescription(CurrentRpt)));
                ListObj.Add(new DictionaryVmodel("CurrentMisstarget", trc.GetCurrentMissTargetList(CurrentRpt, MonthReportID.ToString(), true)));

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据
                JsonData.ReportJsonData = sb.ToString();

                //这里记录 上传后的Json数据
                B_MonthlyReportJsonDataOperator.Instance.AddMonthlyReportJsonData(JsonData);
            }
        }
Ejemplo n.º 7
0
        public void Execute(IJobExecutionContext context)
        {
            Common.ScheduleService.Log.Instance.Info("Service GenerateQuerryJsonData  开始 execute");
            C_ReportTime RptTime = C_ReportTimeOperator.Instance.GetReportTime();

            try
            {
                bool JsonDataSwitch = false;
                bool.TryParse(AppSettingConfig.GetSetting("JsonDataSwitch", ""), out JsonDataSwitch);
                List <B_MonthlyReport> MList = new List <B_MonthlyReport>();

                //开关:true=按照当前上报月 ,查询, 关闭:false=查询所有的数据执行
                if (JsonDataSwitch)
                {
                    MList = B_MonthlyreportOperator.Instance.GetMonthlyReportByApproveList(RptTime.ReportTime.Value.Year, RptTime.ReportTime.Value.Month);
                }
                else
                {
                    MList = B_MonthlyreportOperator.Instance.GetMonthlyreportList().ToList();
                }


                //获取,需要执行的JSon数据 && p.ID == Guid.Parse("114B9692-BC9E-47F0-A6EB-C14450E25C4E")
                var GList = MList.Where(p => string.IsNullOrEmpty(p.DataOptimizationJson)).ToList();

                if (GList != null && GList.Count > 0)
                {
                    GList.ForEach(G =>
                    {
                        try
                        {
                            // 基础信息, 月度报告汇总表
                            ReportInstance rpt = new ReportInstance(G.ID, true, "");

                            List <DictionaryVmodel> listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                            StringBuilder SumStr             = new StringBuilder();
                            SumStr.Append(JsonHelper.Serialize(listSRDS)); // 追加所有的出来的数据

                            string strProp = string.Empty;

                            //判断下,直管公司里是没有属性的
                            if (rpt._System.Category != 4)
                            {
                                //公司的属性List
                                var VpropList = (List <VCompanyProperty>)listSRDS[4].ObjValue;
                                VpropList.ForEach(vp =>
                                {
                                    strProp = strProp + vp.ColumnName + ":";
                                    if (vp.listCP != null && vp.listCP.Count > 0)
                                    {
                                        vp.listCP.ForEach(v =>
                                        {
                                            strProp = strProp + v.ItemCompanyPropertyValue + ",";
                                        });
                                    }
                                    strProp = strProp + ";";
                                });
                            }

                            //月度明细数据
                            ReportInstance rpt_Detail = new ReportInstance(G.ID, true, "");

                            List <DictionaryVmodel> DetailData = ReportInstanceDetailEngine.ReportInstanceDetailService.GetDetailRptDataSource(rpt_Detail, strProp, "Detail", false);
                            StringBuilder DetailStr            = new StringBuilder();
                            DetailStr.Append(JsonHelper.Serialize(DetailData)); // 追加所有的出来的数据

                            //累计未完成
                            ReportInstance rpt_MIss          = new ReportInstance(G.ID, true, "");
                            List <DictionaryVmodel> MIssData = ReportInstanceMissTargetEngine.ReportInstanceMissTargetService.GetMissTargetRptDataSource(rpt_MIss);
                            StringBuilder MIssStr            = new StringBuilder();
                            MIssStr.Append(JsonHelper.Serialize(MIssData)); // 追加所有的出来的数据


                            //当月未完成
                            ReportInstance rpt_CurrenMIss           = new ReportInstance(G.ID, true, "");
                            List <DictionaryVmodel> CurrentMIssData = ReportInstanceCurrentMissTargetEngine.ReportInstanceMissTargetService.GetCurrentMissTargetRptDataSource(rpt_CurrenMIss);
                            StringBuilder CurrentMIssStr            = new StringBuilder();
                            CurrentMIssStr.Append(JsonHelper.Serialize(CurrentMIssData)); // 追加所有的出来的数据


                            //补回情况
                            C_System sys;
                            if (rpt.ReportDetails != null && rpt.ReportDetails.Count() > 0)
                            {
                                sys = StaticResource.Instance[rpt._System.ID, rpt.ReportDetails[0].CreateTime];
                            }
                            else
                            {
                                sys = StaticResource.Instance[rpt._System.ID, DateTime.Now];
                            }
                            ReportInstance rpt_Return          = new ReportInstance(G.ID, true, "");
                            List <DictionaryVmodel> ReturnData = ReportInstanceReturnEngine.ReportInstanceReturnService.GetReturnRptDataSource(rpt_Return, sys); //rpt.GetReturnRptDataSource();
                            StringBuilder ReturnStr            = new StringBuilder();
                            ReturnStr.Append(JsonHelper.Serialize(ReturnData));                                                                                  // 追加所有的出来的数据

                            // 序列化的Json数据保存
                            B_MonthlyReportJsonData JsonData = new B_MonthlyReportJsonData();
                            try
                            {// 获取Json数据
                                JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(G.ID);
                            }
                            catch (Exception)
                            {
                                JsonData = null;
                            }

                            if (JsonData != null)
                            {
                                JsonData.ModifierName              = "SysService";
                                JsonData.ModifyTime                = DateTime.Now;
                                JsonData.QuerrySumJsonData         = SumStr.ToString();
                                JsonData.QuerryDetaileJsonData     = DetailStr.ToString();
                                JsonData.QuerryMissJsonData        = MIssStr.ToString();
                                JsonData.QuerryReturnJsonData      = ReturnStr.ToString();
                                JsonData.QuerryCurrentMissJsonData = CurrentMIssStr.ToString();
                                B_MonthlyReportJsonDataOperator.Instance.UpdateMonthlyReportJsonData(JsonData);

                                G.DataOptimizationJson = "100";
                                B_MonthlyreportOperator.Instance.UpdateMonthlyreport(G);
                            }
                            else
                            {
                                JsonData                           = new B_MonthlyReportJsonData();
                                JsonData.ID                        = G.ID;
                                JsonData.FinMonth                  = rpt.FinMonth;
                                JsonData.FinYear                   = rpt.FinYear;
                                JsonData.PlanType                  = "M";
                                JsonData.SystemID                  = rpt._SystemID;
                                JsonData.ModifierName              = "SysService";
                                JsonData.ModifyTime                = DateTime.Now;
                                JsonData.QuerrySumJsonData         = SumStr.ToString();
                                JsonData.QuerryDetaileJsonData     = DetailStr.ToString();
                                JsonData.QuerryMissJsonData        = MIssStr.ToString();
                                JsonData.QuerryReturnJsonData      = ReturnStr.ToString();
                                JsonData.QuerryCurrentMissJsonData = CurrentMIssStr.ToString();
                                B_MonthlyReportJsonDataOperator.Instance.AddMonthlyReportJsonData(JsonData);

                                G.DataOptimizationJson = "100";
                                B_MonthlyreportOperator.Instance.UpdateMonthlyreport(G);
                            }
                        }
                        catch (Exception ep)
                        {
                            G.DataOptimizationJson = "-100";
                            B_MonthlyreportOperator.Instance.UpdateMonthlyreport(G);


                            Common.ScheduleService.Log.Instance.Error("Service GenerateQueryAttachments  错误:" + ep.ToString());
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                Common.ScheduleService.Log.Instance.Error("Service GenerateQueryAttachments  错误:" + ex.ToString());
            }

            Common.ScheduleService.Log.Instance.Info("Service GenerateQuerryJsonData  结束 execute");
        }
Ejemplo n.º 8
0
        public List <DictionaryVmodel> GetReportInstance(string SystemID, int Year, int Month, string TargetPlanID, bool IsLatestVersion = false, string DataSource = "Draft", bool IsAll = false)
        {
            ReportInstance rpt = null;

            List <DictionaryVmodel> listSRDS = null;

            if (string.IsNullOrEmpty(TargetPlanID))
            {
                TargetPlanID = Guid.Empty.ToString();
            }
            if (!IsLatestVersion) // 是否从A表中获取数据
            {
                //获取A表的数据

                B_MonthlyReportJsonData B_JsonData = new B_MonthlyReportJsonData();

                var A_Rpt = A_MonthlyreportOperator.Instance.GetAMonthlyReport(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid());

                if (A_Rpt != null)
                {
                    listSRDS = GetJsonData(A_Rpt.ID);

                    if (listSRDS != null)
                    {
                        return(listSRDS);
                    }
                    else
                    {
                        rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                        listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                        return(listSRDS);
                    }
                }
                else
                {
                    rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                    listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                    return(listSRDS);
                }
            }
            else
            {// 从B中获取数据
                if (DataSource == "Progress")
                {
                    //Progress 这里只有审批中的数据
                    var B_Rpt = B_MonthlyreportOperator.Instance.GetMonthlyReporNew(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid());

                    if (B_Rpt != null)
                    {
                        listSRDS = GetJsonData(B_Rpt.ID);

                        if (listSRDS != null)
                        {
                            return(listSRDS);
                        }
                        else
                        {
                            rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                            listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                            return(listSRDS);
                        }
                    }
                    else
                    {
                        rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                        listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                        return(listSRDS);
                    }
                }
                else
                {
                    //Draft  包含有草稿,但是不一定都是草稿的数据
                    var B_Rpt = B_MonthlyreportOperator.Instance.GetLastMonthlyReportList(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid());

                    if (B_Rpt != null)
                    {
                        listSRDS = GetJsonData(B_Rpt.ID);

                        if (listSRDS != null)
                        {
                            return(listSRDS);
                        }
                        else
                        {
                            rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                            listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                            return(listSRDS);
                        }
                    }
                    else
                    {
                        rpt      = new ReportInstance(SystemID.ToGuid(), Year, Month, TargetPlanID.ToGuid(), IsLatestVersion, DataSource, IsAll);
                        listSRDS = ReportInstanceSummaryEngine.ReportInstanceSummaryService.GetSummaryRptDataSource(rpt, false);
                        return(listSRDS);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public List <DictionaryVmodel> GetReportInstance(string strSystemID, string strMonthReportID, string strMonthReportOrderType, bool IncludeHaveDetail, bool UploadStr)
        {
            List <DictionaryVmodel> ListObj = new List <DictionaryVmodel>();

            if (string.IsNullOrEmpty(strMonthReportID) || Guid.Parse(strMonthReportID) == Guid.Empty)
            {
                return(ListObj);
            }


            B_MonthlyReportJsonData JsonData;

            try
            {
                JsonData = B_MonthlyReportJsonDataOperator.Instance.GetMonthlyReportJsonData(strMonthReportID.ToGuid());
            }
            catch (Exception ex)//去Json 表中查看下数据
            {
                JsonData = null;
            }

            if (JsonData != null)
            {
                if (!string.IsNullOrEmpty(JsonData.ReportJsonData))
                {
                    // 这里直接去拿Json
                    ListObj = JsonHelper.Deserialize <List <DictionaryVmodel> >(JsonData.ReportJsonData);
                }
                else
                {
                    // 修改
                    ReportInstance rpt = new ReportInstance(strMonthReportID.ToGuid(), true);
                    ListObj.Add(new DictionaryVmodel("ReportInstance", rpt));
                    ListObj.Add(new DictionaryVmodel("MonthDetail", GetTargetDetailList(rpt, strMonthReportOrderType, IncludeHaveDetail)));
                    ListObj.Add(new DictionaryVmodel("Misstarget", GetMissTargetList(rpt, strMonthReportID, UploadStr)));
                    ListObj.Add(new DictionaryVmodel("MonthReportDescription", GetMonthTRptDescription(rpt)));
                    ListObj.Add(new DictionaryVmodel("CurrentMisstarget", GetCurrentMissTargetList(rpt, strMonthReportID, UploadStr)));

                    StringBuilder sb = new StringBuilder();
                    sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据

                    JsonData.SystemID       = rpt._SystemID;
                    JsonData.PlanType       = "M";
                    JsonData.FinMonth       = rpt.FinMonth;
                    JsonData.FinYear        = rpt.FinYear;
                    JsonData.ModifyTime     = DateTime.Now;
                    JsonData.ReportJsonData = sb.ToString();
                    B_MonthlyReportJsonDataOperator.Instance.UpdateMonthlyReportJsonData(JsonData);
                }
            }
            else
            {
                ReportInstance rpt = new ReportInstance(strMonthReportID.ToGuid(), true);
                ListObj.Add(new DictionaryVmodel("ReportInstance", rpt));
                ListObj.Add(new DictionaryVmodel("MonthDetail", GetTargetDetailList(rpt, strMonthReportOrderType, IncludeHaveDetail)));
                ListObj.Add(new DictionaryVmodel("Misstarget", GetMissTargetList(rpt, strMonthReportID, UploadStr)));
                ListObj.Add(new DictionaryVmodel("MonthReportDescription", GetMonthTRptDescription(rpt)));
                ListObj.Add(new DictionaryVmodel("CurrentMisstarget", GetCurrentMissTargetList(rpt, strMonthReportID, UploadStr)));

                StringBuilder sb = new StringBuilder();
                sb.Append(JsonHelper.Serialize(ListObj)); // 追加所有的出来的数据

                JsonData            = new B_MonthlyReportJsonData();
                JsonData.ID         = strMonthReportID.ToGuid();
                JsonData.SystemID   = rpt._SystemID;
                JsonData.PlanType   = "M";
                JsonData.FinMonth   = rpt.FinMonth;
                JsonData.FinYear    = rpt.FinYear;
                JsonData.CreateTime = DateTime.Now;

                JsonData.ReportJsonData = sb.ToString();
                B_MonthlyReportJsonDataOperator.Instance.AddMonthlyReportJsonData(JsonData);
            }

            return(ListObj);
        }