Browse Source

客户零件关系

master
mahao 1 year ago
parent
commit
e660b83f53
  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> /// </summary>
[Display(Name = "客户物料号")] [Display(Name = "客户物料号")]
public string SettleMaterialCode { get; set; } public string SettleMaterialCode { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
} }
/// <summary> /// <summary>
@ -115,6 +121,22 @@ namespace Win.Sfs.SettleAccount.MaterialRelationships
/// </summary> /// </summary>
[ExporterHeaderAttribute(DisplayName = "客户物料号")] [ExporterHeaderAttribute(DisplayName = "客户物料号")]
public string SettleMaterialCode { get; set; } 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> /// <summary>

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

@ -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);
} }

Loading…
Cancel
Save