/// <summary> /// 获取经营报告明细指标数据 /// </summary> /// <param name="RptModel">ReportInstance:通用类型数据</param> /// <param name="strCompanyProperty">公司属性:在查询经营系统中用到,项目系统中暂时没用到, (这里占用该字段来标注,引擎的调用方式:当strCompanyProperty=“Reported”时,表示是在指标上报页面调用的,反之则是在查询的时候调用)</param> /// <param name="strOrderType">排序字段:在经营系统中用到,在项目系统中被当作IsPlan字段来用</param> /// <param name="IncludeHaveDetail">是否包含明细:在经营系统中用到,在项目系统中被当作IsLatestVersion用</param> /// <returns></returns> public List <DictionaryVmodel> GetManageDetailRptDataSource(ReportInstance RptModel, string strCompanyProperty, string strOrderType, bool IncludeHaveDetail) { //默认是走经营系统 string InterfaceName = "*"; C_System sys = RptModel._System; if (sys != null) { if (sys.Category == 2) { InterfaceName = "ProRptDetail"; return(this[InterfaceName].GetManageDetailRptDataSource(RptModel, strCompanyProperty, strOrderType, IncludeHaveDetail)); } else if (sys.Category == 3) { InterfaceName = "GroupRptDetail"; return(this[InterfaceName].GetManageDetailRptDataSource(RptModel, strCompanyProperty, strOrderType, IncludeHaveDetail)); } else if (sys.Category == 4) { InterfaceName = "DirectlyRptDetail"; return(this[InterfaceName].GetManageDetailRptDataSource(RptModel, strCompanyProperty, strOrderType, IncludeHaveDetail)); } } return(this[InterfaceName].GetManageDetailRptDataSource(RptModel, strCompanyProperty, strOrderType, IncludeHaveDetail)); }
/// <summary> /// 获取未完成数据 /// </summary> /// <param name="RptModel"></param> /// <param name="IsReported">是否是从上报页面调用</param> /// <returns></returns> public List <DictionaryVmodel> GetMissTargetRptDataSource(ReportInstance RptModel) { //默认是走经营系统 string InterfaceName = "*"; C_System sys; if (RptModel.ReportDetails != null && RptModel.ReportDetails.Count() > 0) { B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(RptModel.ReportDetails[0].MonthlyReportID); sys = StaticResource.Instance[RptModel._System.ID, bm.CreateTime]; } else { sys = RptModel._System; } if (sys != null) { if (sys.Category == 2) { } else if (sys.Category == 3) { } else if (sys.Category == 4) { InterfaceName = "Directly"; return(this[InterfaceName].GetMissTargetRptDataSource(RptModel, sys)); } } return(this[InterfaceName].GetMissTargetRptDataSource(RptModel, sys)); }
public List <DictionaryVmodel> GetSummaryRptDataSource(ReportInstance RptModel, bool IsTargetPlan) { _Target = RptModel._Target; Report = RptModel.Report; _System = RptModel._System; FinYear = RptModel.FinYear; FinMonth = RptModel.FinMonth; ReportDetails = RptModel.ReportDetails; string MonthlyReportIDs = ""; ReportDetails.GroupBy(x => x.MonthlyReportID).Select(x => x.Key).ToList().ForEach(x => MonthlyReportIDs += "," + x); MonthlyReportIDs = MonthlyReportIDs.Trim(','); if (ReportDetails != null && ReportDetails.Count() > 0) { _System = StaticResource.Instance[_System.ID, ReportDetails[0].CreateTime]; _Target = StaticResource.Instance.GetTargetList(_System.ID, ReportDetails[0].CreateTime).ToList(); } List <MonthReportSummaryViewModel> listMRSVM = GetMonthlyReportDetailSummaryList(); //List<B_Attachment> listAtt = GetListAtt(_System.ID); List <B_Attachment> listAtt = GetListAtt(MonthlyReportIDs); List <DictionaryVmodel> listMonthReportSummary = new List <DictionaryVmodel>(); string strReportDescription = ""; if (Report != null) { strReportDescription = Report.Description; } listMonthReportSummary.Add(new DictionaryVmodel("ReportInstance", RptModel)); listMonthReportSummary.Add(new DictionaryVmodel("月报说明", strReportDescription)); listMonthReportSummary.Add(new DictionaryVmodel("月度经营报告", listMRSVM, "", GetSummaryMonthlyReportHtmlTemplate(_System.Configuration))); listMonthReportSummary.Add(new DictionaryVmodel("附件", listAtt)); listMonthReportSummary.Add(new DictionaryVmodel("完成情况明细查询条件", SpliteCompanyPropertyXml("Search", _System.Configuration))); return(listMonthReportSummary); }
public List <DictionaryVmodel> GetSummaryRptDataSource(ReportInstance RptModel, bool IsTargetPlan) { _Target = RptModel._Target; Report = RptModel.Report; _System = RptModel._System; FinYear = RptModel.FinYear; FinMonth = RptModel.FinMonth; ReportDetails = RptModel.ReportDetails; string MonthlyReportIDs = ""; ReportDetails.GroupBy(x => x.MonthlyReportID).Select(x => x.Key).ToList().ForEach(x => MonthlyReportIDs += "," + x); MonthlyReportIDs = MonthlyReportIDs.Trim(','); //这里对系统和指标再次做一次验证 //if (ReportDetails != null && ReportDetails.Count() > 0) //{ // B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(RptModel.ReportDetails[0].MonthlyReportID); // _System = StaticResource.Instance[_System.ID, bm.CreateTime]; // _Target = StaticResource.Instance.GetTargetList(_System.ID, bm.CreateTime).ToList(); //} List <MonthReportSummaryViewModel> listMRSVM = GetMonthlyReportDetailSummaryList(IsTargetPlan); // List<B_Attachment> listAtt = GetListAtt(_System.ID); List <B_Attachment> listAtt = GetListAtt(MonthlyReportIDs); List <DictionaryVmodel> listMonthReportSummary = new List <DictionaryVmodel>(); string strReportDescription = ""; #region 月报说明 if (RptModel.ReportDetails.Any()) { XElement element = _System.Configuration; if (element.Elements("Report").Elements("Rgroup") != null) { strReportDescription = element.Element("Report").GetElementValue("Rgroup", ""); if (!string.IsNullOrEmpty(strReportDescription)) { System.Collections.Hashtable p = MonthDescriptionValueEngine.MonthDescriptionValueService.GetMonthDescriptionValue(RptModel.ReportDetails, _System.ID, RptModel.CurrentLoginName); foreach (string key in p.Keys) { strReportDescription = strReportDescription.Replace("【" + key + "】", p[key].ToString()); } } } } #endregion //if (Report != null) //{ // strReportDescription = Report.Description; //} listMonthReportSummary.Add(new DictionaryVmodel("ReportInstance", RptModel)); listMonthReportSummary.Add(new DictionaryVmodel("月报说明", strReportDescription)); listMonthReportSummary.Add(new DictionaryVmodel("月度经营报告", listMRSVM, "", GetSummaryMonthlyReportHtmlTemplate(_System.Configuration))); listMonthReportSummary.Add(new DictionaryVmodel("附件", listAtt)); listMonthReportSummary.Add(new DictionaryVmodel("完成情况明细查询条件", SpliteCompanyPropertyXml("Search", _System.Configuration))); listMonthReportSummary.Add(new DictionaryVmodel("是否包含区域", StaticResource.Instance.GetSystem_Regional(_System.ID))); return(listMonthReportSummary); }
public List <DictionaryVmodel> GetDetailRptDataSource(ReportInstance RptModel, string strCompanyProperty, string strOrderType, bool IncludeHaveDetail) { _System = RptModel._System; FinMonth = RptModel.FinMonth; FinYear = RptModel.FinYear; _Target = RptModel._Target; ReportDetails = RptModel.ReportDetails; _SystemID = _System.ID; IsLatestVersion = IncludeHaveDetail; IsPlanStr = strOrderType; currRptModel = RptModel; if (!string.IsNullOrEmpty(strCompanyProperty)) { if (strCompanyProperty == "Reported") { _System = StaticResource.Instance[_System.ID, DateTime.Now]; } else { strCompanyPropertys = strCompanyProperty; if (ReportDetails != null && ReportDetails.Count() > 0) { _System = StaticResource.Instance[_System.ID, ReportDetails[0].CreateTime]; _Target = StaticResource.Instance.GetTargetList(_System.ID, ReportDetails[0].CreateTime).ToList(); } } } else { strCompanyPropertys = ""; } List <ProjectCounter> ProjectList = new List <ProjectCounter>(); XElement element = null; //加载XML,系统配置信息 element = _System.Configuration; if (element.Elements("ProjectCompanyDetail").Elements("ProjectCounter") != null) { List <XElement> ProjectCompanys = element.Elements("ProjectCompanyDetail").Elements("ProjectCounter").ToList(); foreach (XElement ProCompany in ProjectCompanys) { ProjectList.Add(new ProjectCounter(ProCompany)); } } List <DictionaryVmodel> list = FormartProData(ProjectList); return(list); }
public List <DictionaryVmodel> GetManageDetailRptDataSource(ReportInstance RptModel, string strCompanyProperty, string strOrderType, bool IncludeHaveDetail) { _System = RptModel._System; FinMonth = RptModel.FinMonth; FinYear = RptModel.FinYear; _Target = RptModel._Target; ReportDetails = RptModel.ReportDetails; this.IncludeHaveDetail = IncludeHaveDetail; strMonthReportOrderType = strOrderType; CurrentLoginName = RptModel.CurrentLoginName; //这里strCompanyProperty参数,不仅是公司属性,同时也是判断:调用的来源(strCompanyProperty=="Reported"),表示是从上报页面调用,反之不是则是从查询页面调用的 if (!string.IsNullOrEmpty(strCompanyProperty)) { if (strCompanyProperty == "Reported") { _System = StaticResource.Instance[_System.ID, DateTime.Now]; } else { strCompanyPropertys = strCompanyProperty; if (ReportDetails != null && ReportDetails.Count() > 0) { _System = StaticResource.Instance[_System.ID, ReportDetails[0].CreateTime]; _Target = StaticResource.Instance.GetTargetList(_System.ID, ReportDetails[0].CreateTime).ToList(); } } } else { strCompanyPropertys = ""; if (ReportDetails != null && ReportDetails.Count() > 0) { _System = StaticResource.Instance[_System.ID, ReportDetails[0].CreateTime]; _Target = StaticResource.Instance.GetTargetList(_System.ID, ReportDetails[0].CreateTime).ToList(); } } List <VTarget> lstVTarget = SplitCompleteTargetDetailXml(_System.Configuration); List <VItemCompanyProperty> lstVItemCompanyProperty = null; if (SpliteCompanyPropertyXml("List", _System.Configuration).Count > 0) { lstVItemCompanyProperty = SpliteCompanyPropertyXml("List", _System.Configuration)[0].listCP.ToList(); } List <DictionaryVmodel> listvmodel = FromatData(lstVTarget, lstVItemCompanyProperty); if (lstVTarget.Where(m => m.IsBlendTarget == true).Any()) { listvmodel = GetMergeComplateMonthReportDetail(listvmodel); } return(listvmodel); }
public List <DictionaryVmodel> GetReturnRptDataSource(ReportInstance RptModel, C_System sys) { //默认是走经营系统 string InterfaceName = "*"; if (sys != null) { if (sys.Category == 2) { } else if (sys.Category == 3) { } else if (sys.Category == 4) { InterfaceName = "Directly"; return(this[InterfaceName].GetReturnRptDataSource(RptModel, sys)); } } return(this[InterfaceName].GetReturnRptDataSource(RptModel, sys)); }
/// <summary> /// 获取区域公司总计的实体(第一步) /// </summary> /// <param name="ProCounter"></param> /// <returns></returns> private List <V_ProjectCompany> GetProjectModel(ProjectCounter ProCounter) { Guid SysId = Guid.Empty; //从XML中获取的系统ID Guid _CompanyId = Guid.Empty; if (!string.IsNullOrEmpty(ProCounter.CompanyID)) { _CompanyId = Guid.Parse(ProCounter.CompanyID); } //公司,区域小计的ID,从XML中获取的 C_Company itemCompany = C_CompanyOperator.Instance.GetCompany(_CompanyId); SysId = itemCompany.SystemID; //指标List List <C_Target> targetList = StaticResource.Instance.TargetList[SysId].ToList(); //项目公司 List <V_ProjectCompany> ProCompanyList = new List <V_ProjectCompany>(); ReportInstance rpt = null; //获取批次ID,如果_MonthReportID 不是为Guid.Empty ,表示:是从上报页面过来的 //反之,则代表是从查询页面传递过来的 if (currRptModel._MonthReportID != Guid.Empty) { //上报页面 ExceptionHelper.TrueThrow(currRptModel.LastestMonthlyReport == null, "B_MonthlyReport表为Null"); if (currRptModel.LastestMonthlyReport.SystemBatchID != Guid.Empty) { B_SystemBatch _BatchModel = B_SystemBatchOperator.Instance.GetSystemBatch(currRptModel.LastestMonthlyReport.SystemBatchID); List <V_SubReport> subRptList = JsonHelper.Deserialize <List <V_SubReport> >(_BatchModel.SubReport); subRptList.ForEach(p => { if (p.SystemID == SysId) { rpt = new ReportInstance(p.ReportID, true);// 从B表中获取根据ReportID获取 } }); } else { rpt = currRptModel; } } else { //查询页面, 通过系统倒序查找相应的项目系统 rpt = new ReportInstance(SysId, FinYear, FinMonth, IsLatestVersion); } ProjectCompanyDetails = rpt.ReportDetails; //计划指标,包含了 区域小计的指标 List <A_TargetPlanDetail> TargetPlanList = new List <A_TargetPlanDetail>(); if (currRptModel._MonthReportID != Guid.Empty) { //上报的时候总是获取最新的指标。 TargetPlanList = StaticResource.Instance.GetTargetPlanList(SysId, FinYear, FinMonth); } else { //查询的时候按照版本查询,从B表中查出后转换成A表的数据 List <B_TargetPlanDetail> _bTargetPlanList = new List <B_TargetPlanDetail>(); _bTargetPlanList = B_TargetplandetailOperator.Instance.GetTargetplandetailList(rpt.ReportDetails[0].TargetPlanID).ToList(); //将B 表数据添加到 A表中 _bTargetPlanList.ForEach(tp => TargetPlanList.Add(tp.ToAModel())); } List <V_ProjectTarget> ProTargetList = new List <V_ProjectTarget>(); V_ProjectCompany tempProCompany = new V_ProjectCompany(); tempProCompany.ProCompanySequence = itemCompany.Sequence; tempProCompany.SystemID = itemCompany.SystemID; tempProCompany.ProCompayName = itemCompany.CompanyName; tempProCompany.ProCompayID = itemCompany.ID; tempProCompany.ProCompanyProperty1 = itemCompany.CompanyProperty1; tempProCompany.FinYear = FinYear; tempProCompany.FinMonth = FinMonth; tempProCompany.CompayModel = itemCompany; tempProCompany.ProRowSpan = 0; tempProCompany.ProCompanyNumber = 0; //获取批次ID,如果_MonthReportID 不是为Guid.Empty ,表示:是从上报页面过来的 //反之,则代表是从查询页面传递过来的 if (currRptModel._MonthReportID != Guid.Empty) { tempProCompany.ProjectTargets = SingleProTargetLists(targetList, rpt.ReportDetails, TargetPlanList, itemCompany, false); } else { tempProCompany.ProjectTargets = SingleProTargetLists(targetList, rpt.ReportDetails, TargetPlanList, itemCompany, true); } tempProCompany.ProDataType = "XML"; ProCompanyList.Add(tempProCompany); return(ProCompanyList); }
public List <DictionaryVmodel> GetReturnRptDataSource(ReportInstance RptModel, C_System sys) { VLastList = new List <MonthlyReportDetail>(); _System = sys; FinMonth = RptModel.FinMonth; FinYear = RptModel.FinYear; ReportDetails = RptModel.ReportDetails; List <VGroup> GroupList = new List <VGroup>(); XElement element = null; //加载XML,系统配置信息 element = _System.Configuration; if (element.Elements("MisstargetReturn").Elements("Group") != null) { List <XElement> Groups = element.Elements("MisstargetReturn").Elements("Group").ToList(); foreach (XElement group in Groups) { GroupList.Add(new VGroup(group)); } } //上个月A表单一指标 if (VLastList == null || VLastList.Count <= 0) { int lastFinMonth = 0; if (FinMonth == 1) { lastFinMonth = 0; } else { lastFinMonth = FinMonth - 1; } //上月A表的数据 //List<A_MonthlyReportDetail> Lastlist = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(_System.ID, FinYear, lastFinMonth).ToList(); List <A_MonthlyReportDetail> Lastlist = A_MonthlyreportdetailOperator.Instance.GetAMonthlyReportDetailListForTargetPlanID(_System.ID, FinYear, lastFinMonth, RptModel.TargetPlanID).ToList(); //当月A表数据 //List<A_MonthlyReportDetail> list_A = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(_System.ID, FinYear, FinMonth).ToList(); List <A_MonthlyReportDetail> list_A = A_MonthlyreportdetailOperator.Instance.GetAMonthlyReportDetailListForTargetPlanID(_System.ID, FinYear, FinMonth, RptModel.TargetPlanID).ToList(); //当月B表数据 List <B_MonthlyReportDetail> list_B = B_MonthlyreportdetailOperator.Instance.GetMonthlyreportdetailList(_System.ID, FinYear, FinMonth, RptModel._MonthReportID).ToList(); List <Guid> Companies = new List <Guid>(); //调用引擎 Companies = LastMonthCompaniesEngine.LastMonthCompaniesService.GetLastMonthCompaniesID(Lastlist, _System.ID); ReportDetails.RemoveAll(R => !Companies.Contains(R.CompanyID)); foreach (MonthlyReportDetail item in ReportDetails) //循环当月 { A_MonthlyReportDetail lastMRD = Lastlist.Find(p => p.CompanyID == item.CompanyID && p.TargetID == item.TargetID); if (lastMRD != null) { item.LastNAccumulativeActualAmmount = lastMRD.NAccumulativeActualAmmount; item.LastNAccumulativeDifference = lastMRD.NAccumulativeDifference; item.LastNAccumulativePlanAmmount = lastMRD.NAccumulativePlanAmmount; item.LastIsMissTarget = lastMRD.IsMissTarget; item.AddDifference = item.NAccumulativeDifference - item.LastNAccumulativeDifference; } VLastList.Add(item); } } List <DictionaryVmodel> ReturnList = new List <DictionaryVmodel>(); //补回情况,分组List foreach (var Group in GroupList.OrderBy(G => G.Senquence)) { DictionaryVmodel Vmodel = new DictionaryVmodel(); Vmodel.Name = Group.TargetName; Vmodel.ObjValue = FormartVData(Group, "TargetReturn", Group.TargetName); Vmodel.Mark = "Group"; Vmodel.GuoupID = Group.TargetName; Vmodel.SystemName = _System.SystemName; Vmodel.TargetGroupCount = Group.TargetIDs.Count(); Vmodel.HtmlTemplate = GetRetuenHtmlTemplate(element); ReturnList.Add(Vmodel); } return(ReturnList); }
bool IsSingleTarget = false; // Update 2015-5-13 是否单个指标 public List <DictionaryVmodel> GetMissTargetRptDataSource(ReportInstance RptModel, C_System sys) { #region 初始化 MissTargetList = new List <MonthlyReportDetail>(); MissTargetTextList = new List <MonthlyReportDetail>(); ReportDetails = new List <MonthlyReportDetail>(); targetList = new List <C_Target>(); #endregion _System = sys; FinMonth = RptModel.FinMonth; FinYear = RptModel.FinYear; targetList = RptModel._Target; List <VGroup> GroupList = new List <VGroup>(); XElement element = null; //加载XML,系统配置信息 element = _System.Configuration; //局部 if (element.Elements("Misstarget").Elements("Group") != null) { List <XElement> Groups = element.Elements("Misstarget").Elements("Group").ToList(); foreach (XElement group in Groups) { GroupList.Add(new VGroup(group)); } } //-------Update 2015 -5-13 区分未完成的时候是单个指标,还是组合指标 start if (element.Elements("Misstarget").ToList().Count > 0) { XElement subElement = element.Elements("Misstarget").ToList()[0]; IsSingleTarget = subElement.GetAttributeValue("IsSingleTarget", false); } //-------Update 2015 -5-13 区分未完成的时候是单个指标,还是组合指标 End ReportDetails = RptModel.ReportDetails; //当月未完成A或B表指标 if (ReportDetails != null && ReportDetails.Count > 0) { MissTargetList = ReportDetails; //当月的数据 int lastFinMonth = 0; if (FinMonth == 1) { lastFinMonth = 0; } else { lastFinMonth = FinMonth - 1; } //找到上个月的数据 , 上个月的数据只能在A表中 //List<A_MonthlyReportDetail> AList = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(RptModel._System.ID, FinYear, lastFinMonth).ToList(); List <A_MonthlyReportDetail> AList = A_MonthlyreportdetailOperator.Instance.GetAMonthlyReportDetailListForTargetPlanID(RptModel._System.ID, FinYear, lastFinMonth, RptModel.TargetPlanID).ToList(); // 获取各个公司全年的总指标数据 List <V_PlanTargetModel> VPlanTargeList = A_TargetplandetailOperator.Instance.GetAnnualPlanTarget(ReportDetails[0].TargetPlanID, FinYear); //上月的数据 LastMissTargetList = new List <MonthlyReportDetail>(); AList.ForEach(P => LastMissTargetList.Add(P.ToVModel())); foreach (MonthlyReportDetail item in MissTargetList) { MonthlyReportDetail LastTempDetai = LastMissTargetList.Find(p => p.CompanyID == item.CompanyID && p.TargetID == item.TargetID); V_PlanTargetModel PTM = VPlanTargeList.Find(Tp => Tp.CompanyID == item.CompanyID && Tp.TargetID == item.TargetID); //将全年指标总数加进去 if (PTM != null) { item.AnnualTargetPlanValue = PTM.Target; } //判断上个月是否有数据 if (LastTempDetai != null) { item.LastNAccumulativeActualAmmount = LastTempDetai.NAccumulativeActualAmmount; item.LastNAccumulativeDifference = LastTempDetai.NAccumulativeDifference; item.LastNAccumulativePlanAmmount = LastTempDetai.NAccumulativePlanAmmount; item.AddDifference = item.NAccumulativeDifference - item.LastNAccumulativeDifference; item.LastIsMissTarget = LastTempDetai.IsMissTarget; item.LastIsCommitDate = LastTempDetai.IsCommitDate; } else { item.AddDifference = item.NAccumulativeDifference - 0; } MissTargetTextList.Add(item); } } Dictionary <string, object> Alldata = new Dictionary <string, object>(); List <DictionaryVmodel> ReturnList = new List <DictionaryVmodel>(); //补回情况,分组List foreach (var Group in GroupList.OrderBy(G => G.Senquence)) { DictionaryVmodel Vmodel = new DictionaryVmodel(); Vmodel.Name = Group.TargetName; Vmodel.ObjValue = FormartVData(Group, "MissTarget", Group.TargetName); Vmodel.Mark = "Group"; Vmodel.GuoupID = Group.TargetName; Vmodel.TargetGroupCount = Group.TargetIDs.Count(); Vmodel.SystemName = _System.SystemName; ReturnList.Add(Vmodel); } return(ReturnList); }
public List <DictionaryVmodel> GetCurrentMissTargetRptDataSource(ReportInstance RptModel, C_System sys) { _System = sys; FinMonth = RptModel.FinMonth; FinYear = RptModel.FinYear; ReportDetails = RptModel.ReportDetails; List <MonthlyReportDetail> MissTargetList = new List <MonthlyReportDetail>(); List <MonthlyReportDetail> LastMissTargetList = new List <MonthlyReportDetail>(); List <MonthlyReportDetail> MissTargetTextList = new List <MonthlyReportDetail>(); //加载XML List <VGroup> lstVGroup = GetDirectlyMissTargetXml(_System.Configuration); //当月未完成A或B表指标 if (ReportDetails != null && ReportDetails.Count > 0) { MissTargetList = ReportDetails; //当月的数据 int lastFinMonth = 0; if (FinMonth == 1) { lastFinMonth = 0; } else { lastFinMonth = FinMonth - 1; } //找到上个月的数据 , 上个月的数据只能在A表中 //List<A_MonthlyReportDetail> AList = A_MonthlyreportdetailOperator.Instance.GetAMonthlyreportdetailList(RptModel._System.ID, FinYear, lastFinMonth).ToList(); List <A_MonthlyReportDetail> AList = A_MonthlyreportdetailOperator.Instance.GetAMonthlyReportDetailListForTargetPlanID(RptModel._System.ID, FinYear, lastFinMonth, RptModel.TargetPlanID).ToList(); // 获取各个公司全年的总指标数据 List <V_PlanTargetModel> VPlanTargeList = A_TargetplandetailOperator.Instance.GetAnnualPlanTarget(ReportDetails[0].TargetPlanID, FinYear); //上月的数据 LastMissTargetList = new List <MonthlyReportDetail>(); AList.ForEach(P => LastMissTargetList.Add(P.ToVModel())); foreach (MonthlyReportDetail item in MissTargetList) { V_PlanTargetModel PTM = VPlanTargeList.Find(Tp => Tp.CompanyID == item.CompanyID && Tp.TargetID == item.TargetID); //将全年指标总数加进去 if (PTM != null) { item.AnnualTargetPlanValue = PTM.Target; } //判断上个月是否有数据 MonthlyReportDetail LastMrd = LastMissTargetList.Find(p => p.CompanyID == item.CompanyID && p.TargetID == item.TargetID); if (LastMrd != null) { item.LastNAccumulativeActualAmmount = LastMrd.NAccumulativeActualAmmount; item.LastNAccumulativeDifference = LastMrd.NAccumulativeDifference; item.LastNAccumulativePlanAmmount = LastMrd.NAccumulativePlanAmmount; item.AddDifference = item.NAccumulativeDifference - item.LastNAccumulativeDifference; } else { item.AddDifference = item.NAccumulativeDifference - 0; } MissTargetTextList.Add(item); } } Dictionary <string, object> Alldata = new Dictionary <string, object>(); List <DictionaryVmodel> ReturnList = new List <DictionaryVmodel>(); List <MonthlyReportDetail> AllMissTargetDetail = new List <MonthlyReportDetail>(); List <MonthlyReportDetail> ListMonthReportDetailTemp = new List <MonthlyReportDetail>(); ListMonthReportDetailTemp.Clear(); AllMissTargetDetail.Clear(); foreach (VGroup vGroup in lstVGroup) { foreach (Guid guid in vGroup.TargetIDs) { ListMonthReportDetailTemp.AddRange(MissTargetTextList.Where(p => p.TargetID == guid)); } AllMissTargetDetail.AddRange(FormatData(ListMonthReportDetailTemp, vGroup)); ListMonthReportDetailTemp.Clear(); } ReturnList.Add(new DictionaryVmodel("", AllMissTargetDetail)); return(ReturnList); }