public static ReportViewModel BuildReportVieModelFromES(es_t_bp_item report) { var reportViewModel = report.ConvertTo <ReportViewModel>(); SetDateTimeToStr(reportViewModel, report); return(reportViewModel); }
private ESPkrReportNum BuildPkrReportNum(es_t_bp_item item) { var itemCode = GetTrueItemCode(item.ITEMNAME); return(new ESPkrReportNum() { NormalKey = "{0}{1}{2}".Fmt(item.CUSTOMID, itemCode, item.REPORTNUM), BSKey = "{0}{0}{1}{2}".Fmt(item.CUSTOMID, itemCode, item.REPORTNUM) }); }
public static void SetDateTimeToStr(ReportViewModel reportViewModel, es_t_bp_item report) { if (report == null) { return; } reportViewModel.ENTRUSTDATEStr = CommonUtils.GetDateTimeStr(report.ENTRUSTDATE); reportViewModel.CHECKDATEStr = CommonUtils.GetDateTimeStr(report.CHECKDATE); reportViewModel.AUDITINGDATEStr = CommonUtils.GetDateTimeStr(report.AUDITINGDATE); reportViewModel.APPROVEDATEStr = CommonUtils.GetDateTimeStr(report.APPROVEDATE); reportViewModel.PRINTDATEStr = CommonUtils.GetDateTimeStr(report.PRINTDATE); reportViewModel.COLLATEDATEStr = CommonUtils.GetDateTimeStr(report.COLLATEDATE); reportViewModel.VERIFYDATEStr = CommonUtils.GetDateTimeStr(report.VERIFYDATE); reportViewModel.EXTENDDATEStr = CommonUtils.GetDateTimeStr(report.EXTENDDATE); reportViewModel.ACSTIMEStr = CommonUtils.GetDateTimeStr(report.ACSTIME); }
public ActionResult Details(string id) { STReportDetailViewModel model = new Models.STReportDetailViewModel() { acsTimeModel = new List <TotalSearchAcsTimeModel>(), commonReprtModel = new List <TotalSearchCommonReportModel>(), modifyModel = new List <TotalSearchModifyModel>(), RawMaterialModel = new List <Models.TotalSearchRawMaterialModel>() }; var reportConclusion = sysDictService.GetDictsByKey("ReportConclusionCode"); var getResponse = rep.Get(new DocumentPath <es_t_bp_item>(id).Index("sh-tbpitem")); if (getResponse.IsValid && getResponse.Source != null) { model.MainItem = getResponse.Source; var CustomId = model.MainItem.CUSTOMID; var SysPrimaryKey = model.MainItem.SYSPRIMARYKEY; var ItemName = model.MainItem.ITEMNAME; var ReportNum = model.MainItem.REPORTNUM; model.CutomName = checkUnitService.GetSTCheckUnitById(CustomId); model.MainItem.CONCLUSIONCODE = SysDictUtility.GetKeyFromDic(reportConclusion, model.MainItem.CONCLUSIONCODE, "/"); es_t_bp_item item = getResponse.Source; if (model.MainItem.HAVEACS.HasValue && model.MainItem.HAVEACS.Value > 0) { model.acsTimeModel = GetAcsTimeDetails(SysPrimaryKey, model.MainItem.SAMPLENUM); } model.commonReprtModel = GetCommonReportDetails(CustomId, ReportNum, ItemName, SysPrimaryKey); if (model.MainItem.HAVELOG.HasValue && model.MainItem.HAVELOG.Value > 0) { model.modifyModel = GetModifyDetails(SysPrimaryKey); } model.RawMaterialModel = GetRawMaterials(SysPrimaryKey, ReportNum, ItemName, CustomId); } if (model.MainItem == null) { return(Redirect("/TBpItemCheck/NoReport")); } return(View(model)); }
public string GetCryptPkrReportNumFromDict(Dictionary <string, int> prkReports, es_t_bp_item item) { if (prkReports == null || prkReports.Count == 0 || item == null) { return(string.Empty); } var esPKRReporNum = BuildPkrReportNum(item); if (prkReports.ContainsKey(esPKRReporNum.NormalKey) && prkReports[esPKRReporNum.NormalKey] > 0) { return(SymCryptoUtility.Encrypt(esPKRReporNum.NormalKey)); } else if (prkReports.ContainsKey(esPKRReporNum.BSKey) && prkReports[esPKRReporNum.BSKey] > 0) { return(SymCryptoUtility.Encrypt(esPKRReporNum.BSKey)); } else { return(string.Empty); } }
public ReportViewModel(es_t_bp_item report) { XUtils.Assign(this, report); }
public ReportViewModel GetByReportNum(ReportCheck reportCheck) { Func <QueryContainerDescriptor <es_t_bp_item>, QueryContainer> numQuery = qz => { var initquery = qz.Term(qr => qr.Field(qrf => qrf.REPORTNUM).Value(reportCheck.reportnum)); if (!reportCheck.customid.IsNullOrEmpty()) { initquery = initquery && qz.Term(tt => tt.Field(ttt => ttt.CUSTOMID).Value(reportCheck.customid)); } return(initquery); }; ISearchResponse <es_t_bp_item> response = m_repReport.Search(s => s.From(0).Size(10).Query(numQuery).Sort(cs => cs.Descending(csd => csd.UPLOADTIME))); if (!response.IsValid || response.Documents == null || response.Documents.Count == 0) { return(null); } es_t_bp_item chooseTBpItem = new es_t_bp_item(); if (response.Documents.Count == 1) { chooseTBpItem = response.Documents.First(); } else { bool hasFound = false; var existDocs = response.Documents.ToList(); //查 工程名称 if (!reportCheck.projectname.IsNullOrEmpty()) { existDocs = existDocs.Where(e => e.PROJECTNAME.Contains(reportCheck.projectname.Trim())).ToList(); if (existDocs.IsNullOrEmpty()) { hasFound = true; chooseTBpItem = response.Documents.First(); } else if (existDocs.Count() == 1) { hasFound = true; chooseTBpItem = existDocs.First(); } } //查 结构部位 if (!hasFound && !reportCheck.structpart.IsNullOrEmpty()) { existDocs = existDocs.Where(e => e.STRUCTPART.Contains(reportCheck.structpart.Trim())).ToList(); if (existDocs.IsNullOrEmpty()) { hasFound = true; chooseTBpItem = response.Documents.First(); } else if (existDocs.Count() == 1) { hasFound = true; chooseTBpItem = existDocs.First(); } } if (!hasFound) { chooseTBpItem = response.Documents.First(); } } ReportViewModel rvm = ReportViewModel.BuildReportVieModelFromES(chooseTBpItem); FillInCheckItem(rvm); return(rvm); }