|
|
@ -1,11 +1,11 @@ |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Shouldly; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Shouldly; |
|
|
|
using Volo.Abp.Application.Dtos; |
|
|
|
using Volo.Abp.Caching; |
|
|
|
using Win.Abp.Snowflakes; |
|
|
@ -16,11 +16,10 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|
|
|
using Win.Sfs.SettleAccount.ExcelImporter; |
|
|
|
using Win.Sfs.SettleAccount.ExportReports; |
|
|
|
using Win.Sfs.SettleAccount.MaterialRelationships; |
|
|
|
using Win.Sfs.Shared.DtoBase; |
|
|
|
using Win.Sfs.Shared.RepositoryBase; |
|
|
|
|
|
|
|
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|
|
|
{ |
|
|
|
namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 客户零件关系
|
|
|
|
/// </summary>
|
|
|
@ -52,10 +51,10 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|
|
|
/// 导入
|
|
|
|
/// </summary>
|
|
|
|
[HttpPost] |
|
|
|
public async Task<string> ImportAsync([FromForm] IFormFileCollection files) |
|
|
|
public async Task<string> ImportAsync(MaterialRelationshipImportRequestDto materialRelationshipImportRequestDto) |
|
|
|
{ |
|
|
|
ExportImporter _exportImporter = new ExportImporter(); |
|
|
|
var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(files, _excelImportService); |
|
|
|
var result = await _exportImporter.UploadExcelImport<MaterialRelationshipImportDto>(materialRelationshipImportRequestDto.Files, _excelImportService); |
|
|
|
var _ls = ObjectMapper.Map<List<MaterialRelationshipImportDto>, List<MaterialRelationship>>(result); |
|
|
|
List<string> _errorList = new List<string>(); |
|
|
|
var checkList = new List<ErrorExportDto>(); |
|
|
@ -66,7 +65,6 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|
|
|
group arc by new { arc.ErpMaterialCode } |
|
|
|
into g |
|
|
|
where g.Count() > 1 |
|
|
|
|
|
|
|
select g; |
|
|
|
foreach (var itm in query) |
|
|
|
{ |
|
|
@ -83,10 +81,12 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|
|
|
if (_first != null) |
|
|
|
{ |
|
|
|
_first.Update(itm.MaterialDesc, itm.MaterialProperty, itm.SettleMaterialCode, itm.ShipMaterailCode); |
|
|
|
_first.Remark = materialRelationshipImportRequestDto.IsBj ? "BJ" : ""; |
|
|
|
await _repository.UpdateAsync(_first); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
itm.Remark = materialRelationshipImportRequestDto.IsBj ? "BJ" : ""; |
|
|
|
await _repository.InsertAsync(itm); |
|
|
|
} |
|
|
|
} |
|
|
@ -471,4 +471,3 @@ namespace Win.Sfs.SettleAccount.Entities.MaterialRelationships |
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|