public IActionResult getF340PpdPic(string isStanHandsome) { _logger.LogInformation(String.Format(@"****** DKSController getF340PpdPic fired!! ******")); var decodeStr = CSharpLab.Atob(isStanHandsome); var dksSignature = _config.GetSection("AppSettings:encodeStr").Value; decodeStr = decodeStr.Replace(dksSignature, ""); List <string> nastFileName = decodeStr.Split("$").ToList(); var factory = nastFileName[nastFileName.Count - 2]; nastFileName.RemoveAt(nastFileName.Count - 2); var loginUser = nastFileName[nastFileName.Count - 1]; nastFileName.RemoveAt(nastFileName.Count - 1); var pathList = _fileService.GetLocalPath("F340PpdPic", nastFileName); var result = _fileService.GetByteArrayByLocalUrlAddWaterMask(pathList[1], loginUser); return(File(result, "image/jpeg"));//"image/jpeg" "application/pdf" }
public async Task <IActionResult> ExportF340_ProcessPpd(SF340PPDSchedule sF340PPDSchedule) { _logger.LogInformation(String.Format(@"****** DKSController ExportF340_ProcessPpd fired!! ******")); var dksSignature = _config.GetSection("AppSettings:encodeStr").Value; if (sF340PPDSchedule.cwaDateS == "" || sF340PPDSchedule.cwaDateS == null) { sF340PPDSchedule.cwaDateS = _config.GetSection("LogicSettings:MinDate").Value; } if (sF340PPDSchedule.cwaDateE == "" || sF340PPDSchedule.cwaDateE == null) { sF340PPDSchedule.cwaDateE = _config.GetSection("LogicSettings:MaxDate").Value; } sF340PPDSchedule.cwaDateS = sF340PPDSchedule.cwaDateS.Replace("-", "/"); sF340PPDSchedule.cwaDateE = sF340PPDSchedule.cwaDateE.Replace("-", "/"); // query data from database var data = await _dksDao.GetF340PPDView(sF340PPDSchedule); // data.ForEach(x => { if (x.Photo.Length > 1) { var factoryApi = ""; var apiUrl = _config.GetSection("AppSettings:ApiUrl").Value; switch (sF340PPDSchedule.factory) { case "C": //SHC factoryApi = apiUrl + "dks/getF340PpdPic?isStanHandsome="; break; case "E": //CB factoryApi = "http://10.9.0.35/material/WatermarkAPI/GetF340PpdPic?param="; break; case "D": //SPC factoryApi = "http://10.10.0.21/material/WatermarkAPI/GetF340PpdPic?param="; break; case "U": //TSH factoryApi = "http://10.11.0.22/material/WatermarkAPI/GetF340PpdPic?param="; break; default: { factoryApi = apiUrl + "dks/getF340PpdPic?isStanHandsome="; break; } } var param = dksSignature + x.DevSeason + "$" + x.Article + "$" + x.Photo + "$" + sF340PPDSchedule.factory + "$" + sF340PPDSchedule.loginUser; var encodeStr = CSharpLab.Btoa(param); var dataUrl = string.Format(@"{0}{1}", factoryApi, encodeStr); //let dataUrl = environment.apiUrl + "dks/getF340PpdPdf?isStanHandsome=" + window.btoa(param); //x.Photo = "=HYPERLINK(\"" + dataUrl + "\",\"jpg\")"; x.Photo = dataUrl; //x.Photo = "http://" + serverIp + "/assets/F340PpdPic/" + x.DevSeason + "/" + x.Article + "/" + x.Photo; } if (x.Pdf.Length > 1) { //encoding version var factoryApi = ""; var apiUrl = _config.GetSection("AppSettings:ApiUrl").Value; switch (sF340PPDSchedule.factory) { case "C": //SHC factoryApi = apiUrl + "dks/getF340PpdPdf?isStanHandsome="; break; case "E": //CB factoryApi = "http://10.9.0.35/material/WatermarkAPI/GetF340PpdPdf?param="; break; case "D": //SPC factoryApi = "http://10.10.0.21/material/WatermarkAPI/GetF340PpdPdf?param="; break; case "U": //TSH factoryApi = "http://10.11.0.22/material/WatermarkAPI/GetF340PpdPdf?param="; break; default: { factoryApi = apiUrl + "dks/getF340PpdPdf?isStanHandsome="; break; } } var param = dksSignature + x.DevSeason + "$" + x.Article + "$" + x.Pdf + "$" + sF340PPDSchedule.factory + "$" + sF340PPDSchedule.loginUser; var encodeStr = CSharpLab.Btoa(param); var dataUrl = string.Format(@"{0}{1}", factoryApi, encodeStr); // no encoding version //var dataUrl = string.Format(@"{0}:{1}{2}{3}/{4}/{5}",ip,spaPort,"/assets/F340PpdPic/",x.DevSeason,x.Article,x.Pdf); x.Pdf = dataUrl; } if (x.FgtFileName.Length > 1) { var factoryApi = ""; switch (sF340PPDSchedule.factory) { case "C": //SHC factoryApi = "http://10.4.0.39:6970/assets/F340PpdPic/QCTestResult/"; break; case "E": //CB factoryApi = "http://10.9.0.35/material/Upload/F340CmptMatPic/QCTestResult/"; break; case "D": //SPC factoryApi = "http://10.10.0.21/material/Upload/F340CmptMatPic/QCTestResult/"; break; case "U": //TSH factoryApi = "http://10.11.0.22/material/Upload/F340CmptMatPic/QCTestResult/"; break; default: factoryApi = "http://10.4.0.39:6970/assets/F340PpdPic/QCTestResult/"; break; } var dataUrl = string.Format(@"{0}{1}/{2}", factoryApi, x.Article, x.FgtFileName); x.FgtFileName = dataUrl; } }); var upper = data.Where(x => x.HpPartNo != "2016").ToList(); var bottom = data.Where(x => x.HpPartNo == "2016").ToList(); List <List <F340_PpdDto> > dataList = new List <List <F340_PpdDto> >() { upper, bottom }; byte[] result = _excelService.CommonExportReportTabs4F340PPD(dataList, "TempF340PPDProcessTabs.xlsx"); return(File(result, "application/xlsx")); }