xusc 3 months ago
parent
commit
32a1fff24c
  1. 6
      src/aspnet-core/ICS.Application/Business/Service/IcsCustomer/IcsCustomerAppService.cs
  2. 11
      src/aspnet-core/ICS.Application/Business/Service/导入服务/ImportExportExtAppService.cs

6
src/aspnet-core/ICS.Application/Business/Service/IcsCustomer/IcsCustomerAppService.cs

@ -249,6 +249,12 @@ namespace ICS.Application.Business.Service
var count = _repository.Count(x => x.CusCode == input.CusCode);
if (count > 0)
{
throw new UserFriendlyException(L("HasExistsCurrentCode", "客户档案"));
}
count = _repository.Count(x => x.CusName == input.CusName);
if (count > 0)
{
throw new UserFriendlyException(L("HasExistsCurrentCode", "客户档案"));
}

11
src/aspnet-core/ICS.Application/Business/Service/导入服务/ImportExportExtAppService.cs

@ -40,6 +40,7 @@ using Microsoft.AspNetCore.Components.Routing;
using System.Globalization;
using FastReport;
using Microsoft.Extensions.Logging;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
namespace ICS.Application.Business.Service
@ -460,9 +461,17 @@ namespace ICS.Application.Business.Service
{
var item = data[i];
var entity = _customerRepository.FirstOrDefault(x => x.CusCode == item.CusCode);
var entity = _customerRepository.FirstOrDefault(x => x.CusCode == item.CusCode|| x.CusName == item.CusName);
if (entity == null)
{
//var count = _customerRepository.Count(x => x.CusName == item.CusName);
// if (count > 0)
// {
// throw new UserFriendlyException(L("HasExistsCurrentCode", "客户档案"));
// }
entity = new IcsCustomer();
entity = ObjectMapper.Map<IcsCustomer>(item);
//调用领域服务

Loading…
Cancel
Save