Browse Source

备件相关测试调整

FoShanPG
44673626 3 years ago
parent
commit
15a9499cd0
  1. 2
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs
  2. 10
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs
  3. 54
      src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs
  4. 2
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs
  5. 19
      src/Modules/SettleAccount/src/SettleAccount.Domain/Settings/Helper.cs
  6. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

2
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePart90AppService.cs

@ -241,7 +241,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
var _list = _excelHelper.ExcelToList<WmsSharePart90OutPutDetial>();
var _list = _excelHelper.ExcelToListOne<WmsSharePart90OutPutDetial>();
//var _list_withbillNo = _list.Select(p => p.BillNum != string.Empty);
//var _list_withNoBillNo= _list.Select(p => p.BillNum == string.Empty);

10
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSSharePartAppService.cs

@ -244,7 +244,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\" + filename;
ExcelHelper _excelHelper = new ExcelHelper(fileSavePath);
var _listSummary = _excelHelper.ExcelToList<WmsSharePartOutPutDetial>();
var _listSummary = _excelHelper.ExcelToListOne<WmsSharePartOutPutDetial>();//导入模板有多页签,需要取第一个页签
var _list = _listSummary.Where(p => p.OrderBillNum == "").ToList();//过滤 采购订单号为空的集合
var _listBill = _listSummary.Where(p => p.OrderBillNum != "").ToList();//过滤 采购订单号不为空的集合
@ -316,7 +316,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
}
if (_lst != null)
if (_lst != null && _lst.Count>0)
{
//没有采购订单号
var outPutDetail = await _wmsRepository.Where(p => p.Version == input.Version && p.OrderBillNum == "").ToListAsync();
@ -397,7 +397,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
if (_lstBill != null)
if (_lstBill != null && _lstBill.Count>0)
{
//有采购订单号
var outPutDetailBill = await _wmsRepository.Where(p => p.Version == input.Version && p.OrderBillNum != "").ToListAsync();
@ -455,7 +455,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
}
foreach (var job in _joblist)
{
if (_lst != null)
if (_lst != null && _lst.Count > 0)
{
job.FileName = _billNum + "/" + _billNoNum;
}
@ -898,7 +898,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExtendExcelImport<WmsSharePartOutPutDetial>(files, _excelImportService);
var result = await _exportImporter.ExtendExcelOfSheetOneImport<WmsSharePartOutPutDetial>(files, _excelImportService);
if (result == null)
{

54
src/Modules/SettleAccount/src/SettleAccount.Application/ImportExcelCommon/ExportImporter.cs

@ -361,6 +361,60 @@ namespace Win.Sfs.SettleAccount.ExcelImporter
}
public virtual async Task<List<T>> ExtendExcelOfSheetOneImport<T>([FromForm] IFormFileCollection files, IExcelImportAppService _excelImportService, List<ImportColumnMap> p_list = null)
where T : class, new()
{
Type type = typeof(T);
var ImportList = new List<T>();
ExcelImportResult returnResult = new ExcelImportResult();
List<string> _errorList = new List<string>();
foreach (var file in files)
{
if (file == null)
{
throw new BusinessException("上传附件不能为空!");
}
string FileOriginName = file.FileName;
string getFileName = Path.GetFileName(FileOriginName);//获取附件名称
using (var memoryStream = new MemoryStream())
{
//保存成物理文件
await file.CopyToAsync(memoryStream);
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = Path.GetFileName(FileOriginName),
Content = memoryStream.ToArray()
}
);
}
//读取文件保存的根目录
string fileSaveRootDir = ConfigDirHelper.GetAppSetting("App", "FileRootPath");
//读取WMS文件保存的模块的根目录
string fileSaveDir = ConfigDirHelper.GetAppSetting("App", "WMSFiles");
//文件保存的相对文件夹(保存到wwwroot目录下)
string absoluteFileDir = fileSaveRootDir + @"\" + fileSaveDir;
//文件保存的路径(应用的工作目录+文件夹相对路径);
string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container" + absoluteFileDir;
var filePath = fileSavePath + getFileName;//获取到导入的excel
ExcelHelper _excelHelper = new ExcelHelper(filePath);
if (p_list != null && p_list.Count > 0)
{
ImportList = _excelHelper.ExcelToListByMap<T>(p_list);
}
else
{
ImportList = _excelHelper.ExcelToListOne<T>();
}
}
return ImportList;//返回客户端
}
}
}

2
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/WMS/TaskList.cs

@ -1,4 +1,5 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
@ -1527,6 +1528,7 @@ namespace Win.Sfs.SettleAccount.Entities.WMS
/// <summary>
/// 备件出库明细
/// </summary>
[ExcelImporter(SheetName = "大众备件数据输出")]
public class WmsSharePartOutPutDetial : FullAuditedAggregateRootBase<Guid>
{
public WmsSharePartOutPutDetial()

19
src/Modules/SettleAccount/src/SettleAccount.Domain/Settings/Helper.cs

@ -219,6 +219,25 @@ namespace Win.Sfs.SettleAccount
}
public List<T> ExcelToListOne<T>() where T : class, new()
{
List<T> _ls = new List<T>();
//foreach (var sheetName in SheetNames)
//{
// var sheet = sheetName != null ? _workbook.GetSheet(sheetName) : _workbook.GetSheetAt(0);
// var list = ExportToList<T>(sheet);
// _ls.AddRange(list);
//}
var sheet = _workbook.GetSheetAt(0);
var list = ExportToList<T>(sheet);
_ls.AddRange(list);
return _ls;
}
/// <summary>
/// 实体字段
/// </summary>

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/SettleSparePartDapperReportRepository.cs

@ -85,7 +85,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
" PurchaseOrderNoText,\n" +
" AmountNoTax \n" +
" FROM\n" +
" Set_SparePart WHERE Extend != 'is90' \n" +
" Set_SparePart WHERE Extend != 'is90' \n" +
" GROUP BY\n" +
" PurchaseOrderNo,\n" +
" MaterialCode,\n" +

Loading…
Cancel
Save