|
@ -54,8 +54,8 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase<Mater |
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<IActionResult> ImportAsync([FromForm] MaterialRelationshipImportRequestDto materialRelationshipImportRequestDto) |
|
|
public async Task<IActionResult> ImportAsync([FromForm] MaterialRelationshipImportRequestDto materialRelationshipImportRequestDto) |
|
|
{ |
|
|
{ |
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
var _exportImporter = new ExportImporter(); |
|
|
var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(materialRelationshipImportRequestDto.Files, _excelImportService); |
|
|
var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(materialRelationshipImportRequestDto.Files, _excelImportService).ConfigureAwait(false); |
|
|
var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result); |
|
|
var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result); |
|
|
List<string> _errorList = new List<string>(); |
|
|
List<string> _errorList = new List<string>(); |
|
|
var checkList = new List<ErrorExportDto>(); |
|
|
var checkList = new List<ErrorExportDto>(); |
|
@ -74,7 +74,7 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase<Mater |
|
|
} |
|
|
} |
|
|
if (checkList.Count > 0) |
|
|
if (checkList.Count > 0) |
|
|
{ |
|
|
{ |
|
|
string fileName = await ExportErrorReportAsync(checkList); |
|
|
string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); |
|
|
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); |
|
|
} |
|
|
} |
|
|
foreach (var itm in _ls) |
|
|
foreach (var itm in _ls) |
|
@ -83,12 +83,12 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase<Mater |
|
|
if (_first != null) |
|
|
if (_first != null) |
|
|
{ |
|
|
{ |
|
|
_first.Update(itm.MaterialDesc, itm.SettleMaterialCode); |
|
|
_first.Update(itm.MaterialDesc, itm.SettleMaterialCode); |
|
|
await _repository.UpdateAsync(_first); |
|
|
await _repository.UpdateAsync(_first).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
itm.BusinessType = EnumBusinessType.BeiJian; |
|
|
itm.BusinessType = EnumBusinessType.BeiJian; |
|
|
await _repository.InsertAsync(itm); |
|
|
await _repository.InsertAsync(itm).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return new JsonResult(new { Code = 200, Message = "导入成功" }); |
|
|
return new JsonResult(new { Code = 200, Message = "导入成功" }); |
|
@ -120,8 +120,8 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase<Mater |
|
|
[HttpPost] |
|
|
[HttpPost] |
|
|
public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(RequestDto input) |
|
|
public async Task<PagedResultDto<MaterialRelationshipDto>> GetListAsync(RequestDto input) |
|
|
{ |
|
|
{ |
|
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true); |
|
|
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false); |
|
|
var totalCount = await _repository.GetCountByFilterAsync(input.Filters); |
|
|
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false); |
|
|
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities); |
|
|
var dtos = ObjectMapper.Map<List<MaterialRelationship>, List<MaterialRelationshipDto>>(entities); |
|
|
return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos); |
|
|
return new PagedResultDto<MaterialRelationshipDto>(totalCount, dtos); |
|
|
} |
|
|
} |
|
|