public object GetCashflowDetailDataTable(string projectGuid, DateTime paymentDate) { var project = m_dbAdapter.Project.GetProjectByGuid(projectGuid); var projectLogicModel = new ProjectLogicModel(CurrentUserName, project); var datasetSchedule = projectLogicModel.DealSchedule.GetByPaymentDay(paymentDate); CommUtils.AssertNotNull(datasetSchedule.Dataset.Instance, "第{0}期模型未生成", Toolkit.DateToString(datasetSchedule.PaymentDate)); var dataset = m_dbAdapter.Dataset.GetDatasetByDurationPeriod(project.ProjectId, paymentDate); //同步数据库中参数到模型文件 var variableDateset = m_dbAdapter.CashflowVariable.GetByPaymentDay(project.ProjectId, paymentDate); UpdateVariablesFromCurrPeriodDBToModel(datasetSchedule.Dataset, variableDateset, project.ProjectId, paymentDate); var cashflowTableViewModel = new CashflowDetailTableViewModel(); cashflowTableViewModel.CurrentPaymentDate = Toolkit.DateToString(datasetSchedule.PaymentDate); //获取预测的资产池当期本金与利息 var acfTable = datasetSchedule.Dataset.DealModel.AssetCashflowDt; for (int i = acfTable.Columns.Count - 1; i >= 0; i--) { var c = acfTable.Columns[i]; DateTime date; if (DateTime.TryParse(c.ColumnName, out date)) { if (date < paymentDate) { acfTable.Columns.Remove(c); } } } var assetViewModel = Toolkit.GetAssetCashflow(acfTable, paymentDate); //判断本金与利息是否被覆盖 var assetCashflowVariable = m_dbAdapter.AssetCashflowVariable.GetByProjectIdPaymentDay(project.ProjectId, paymentDate); var cashflowViewModel = new CashflowViewModel(); cashflowViewModel.PredictInterestCollection = double.Parse(assetViewModel.TotalCurrentInterestCollection.ToString("n2")); cashflowViewModel.PredictPricipalCollection = double.Parse(assetViewModel.TotalCurrentPrinCollection.ToString("n2")); cashflowViewModel.OverridableVariables = SelectOverridableVariables(datasetSchedule.Dataset); var cashflowDt = ABSDealUtils.GetCashflowDt(datasetSchedule, assetCashflowVariable, cashflowViewModel.PredictInterestCollection, cashflowViewModel.PredictPricipalCollection, out double currInterest, out double currPrincipal); cashflowViewModel.CurrentInterestCollection = currInterest; cashflowViewModel.CurrentPricipalCollection = currPrincipal; cashflowDt = Toolkit.CleanCashflowTable(cashflowDt); var revertTable = cashflowDt.Transpose(); var notes = m_dbAdapter.Dataset.GetNotes(project.ProjectId); var noteDatas = m_dbAdapter.Dataset.GetNoteDatas(dataset.DatasetId); Toolkit.GetCashflowDetailData(cashflowTableViewModel, revertTable, notes, noteDatas); var result = new { ProjectCashflowHeader = cashflowTableViewModel.ProjectCashflowHeader, SecurityCashflowHeader = cashflowTableViewModel.SecurityCashflowHeader, AssetPoolHeader = cashflowTableViewModel.AssetPoolHeader, CostHeader = cashflowTableViewModel.CostHeader, AccountHeader = cashflowTableViewModel.AccountHeader, TriggerEventHeader = cashflowTableViewModel.TriggerEventHeader, HomePageHeader = cashflowTableViewModel.HomePageHeader, ProjectCashflowList = cashflowTableViewModel.ProjectCashflowList, SecurityCashflowList = cashflowTableViewModel.SecurityCashflowList.Keys.ToList().ConvertAll(x => new { TableName = x, DataList = cashflowTableViewModel.SecurityCashflowList[x] }), AssetPoolList = cashflowTableViewModel.AssetPoolList, CostList = cashflowTableViewModel.CostList, AccountList = cashflowTableViewModel.AccountList, TriggerEventList = cashflowTableViewModel.TriggerEventList, CurrPeriodCashflowInfoList = cashflowTableViewModel.CurrPeriodCashflowInfoList, CashflowEventList = cashflowTableViewModel.CashflowEventList, FeePayable = cashflowTableViewModel.FeePayable, CurrentPaymentDate = cashflowTableViewModel.CurrentPaymentDate, PredictInterestCollection = cashflowViewModel.PredictInterestCollection, PredictPricipalCollection = cashflowViewModel.PredictPricipalCollection, CurrentInterestCollection = cashflowViewModel.CurrentInterestCollection, CurrentPricipalCollection = cashflowViewModel.CurrentPricipalCollection, OverridableVariables = cashflowViewModel.OverridableVariables, TestFailRemind = cashflowTableViewModel.TestFailRemind }; return(result); }