| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.BasicInfo; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | { |
| | | public class ProcessInfoService : ServiceBase<Dt_ProcessInfo, IRepository<Dt_ProcessInfo>>, IProcessInfoService |
| | | { |
| | | public ProcessInfoService(IRepository<Dt_ProcessInfo> BaseDal) : base(BaseDal) |
| | | |
| | | private readonly IFormulaService _formulaService; |
| | | private readonly IFormulaDetailService _formulaDetailService; |
| | | |
| | | public ProcessInfoService( |
| | | IRepository<Dt_ProcessInfo> BaseDal, |
| | | IFormulaService formulaService, |
| | | IFormulaDetailService formulaDetailService |
| | | ) : base(BaseDal) |
| | | { |
| | | _formulaService = formulaService; |
| | | _formulaDetailService = formulaDetailService; |
| | | } |
| | | |
| | | public IRepository<Dt_ProcessInfo> Repository => BaseDal; |
| | | |
| | | /// <summary> |
| | | /// ä¸è½½æµç¨å¡ |
| | | /// </summary> |
| | | /// <param name="dt_ProcessInfo"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ExportData(Dt_ProcessInfo dt_ProcessInfo) |
| | | { |
| | | |
| | | string fileName = $"{DateTime.Now.ToString("yyyyMMddHHssmm")}.xlsx"; |
| | | string templatePath = $"{AppDomain.CurrentDomain.BaseDirectory}ExprotTemplate\\åçµæºå¼¹æ§æ¯æä¿¡æ¯åæµç¨å¡.xlsx";//模æ¿è·¯å¾ |
| | | string savePath = $"{AppDomain.CurrentDomain.BaseDirectory}Download\\{fileName}";//ä¿åæä»¶è·¯å¾ |
| | | |
| | | using Stream templateStream = new FileStream(templatePath, FileMode.Open); |
| | | using Stream saveStream = new FileStream(savePath, FileMode.Create); |
| | | using ExcelPackage package = new ExcelPackage(saveStream, templateStream); |
| | | ExcelWorksheet worksheet = package.Workbook.Worksheets["æµç¨å¡"]; |
| | | worksheet.Cells[3, 5].Value = dt_ProcessInfo.ProductCode;//æåç¼å· |
| | | |
| | | package.Save(); |
| | | |
| | | string pdfFileName = $"{DateTime.Now.ToString("yyyyMMddHHssmm")}.pdf"; |
| | | string pdfPath = $"{AppDomain.CurrentDomain.BaseDirectory}Download\\{pdfFileName}"; |
| | | |
| | | Workbook workbook = new Workbook(); |
| | | workbook.LoadFromFile(savePath); |
| | | |
| | | // 转æ¢ç¬¬ä¸ä¸ªå·¥ä½è¡¨å°PDF |
| | | workbook.SaveToFile(pdfPath, FileFormat.PDF); |
| | | return WebResponseContent.Instance.OK(data: new { path = pdfPath, fileName = pdfFileName }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |