学 赵 1 year ago
parent
commit
738220cb4a
  1. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs
  2. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs

22
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/MaterialRelationship/MaterialRelationshipDtoBase.cs

@ -91,6 +91,12 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
/// </summary>
[Display(Name = "客户物料号")]
public string SettleMaterialCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
}
/// <summary>
@ -115,6 +121,22 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
/// </summary>
[ExporterHeaderAttribute(DisplayName = "客户物料号")]
public string SettleMaterialCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
[ExporterHeaderAttribute(DisplayName = "业务类别")]
[ValueMapping("未定义", 0)]
[ValueMapping("JisBBAC", 1)]
[ValueMapping("JisHBPO", 2)]
[ValueMapping("直供件BBAC", 3)]
[ValueMapping("直供件HBPO", 4)]
[ValueMapping("买单件BBAC", 5)]
[ValueMapping("买单件HBPO", 6)]
[ValueMapping("备件", 7)]
[ValueMapping("印度件", 8)]
public EnumBusinessType BusinessType { get; set; }
}
/// <summary>

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs

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

Loading…
Cancel
Save