wanggang 2 years ago
parent
commit
1081db363e
  1. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

37
code/src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

@ -85,24 +85,25 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
{ {
//保存成物理文件 //保存成物理文件
await file.CopyToAsync(memoryStream); await file.CopyToAsync(memoryStream);
await _excelImportService.SaveBlobAsync( //await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto // new SaveExcelImportInputDto
{ // {
Name = Path.GetFileName(FileOriginName), // Name = Path.GetFileName(FileOriginName),
Content = memoryStream.ToArray() // Content = memoryStream.ToArray()
} // }
); // );
} await fc.SaveAsync(FileOriginName, memoryStream.ToArray()).ConfigureAwait(false);
//读取文件保存的根目录 }
string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath"); ////读取文件保存的根目录
//读取WMS文件保存的模块的根目录 //string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath");
string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles"); ////读取WMS文件保存的模块的根目录
//文件保存的相对文件夹(保存到wwwroot目录下) //string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles");
string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir; ////文件保存的相对文件夹(保存到wwwroot目录下)
//文件保存的路径(应用的工作目录+文件夹相对路径); //string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir;
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir; ////文件保存的路径(应用的工作目录+文件夹相对路径);
var filePath = fileSavePath + getFileName;//获取到导入的excel //string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir;
var import = await _importer.Import<T>(filePath); //var filePath = fileSavePath + getFileName;//获取到导入的excel
var import = await _importer.Import<T>((await fc.GetAsync(FileOriginName).ConfigureAwait(false)));
if (import.Exception != null) if (import.Exception != null)
{ {
if (import.Exception.Message.ToString() == "导入文件不存在!") if (import.Exception.Message.ToString() == "导入文件不存在!")

Loading…
Cancel
Save