diff --git a/src/aspnet-core/ICS.Application/Business/Service/IcsCustomer/IcsCustomerAppService.cs b/src/aspnet-core/ICS.Application/Business/Service/IcsCustomer/IcsCustomerAppService.cs index 305ed82..910ee0e 100644 --- a/src/aspnet-core/ICS.Application/Business/Service/IcsCustomer/IcsCustomerAppService.cs +++ b/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", "客户档案")); } diff --git a/src/aspnet-core/ICS.Application/Business/Service/导入服务/ImportExportExtAppService.cs b/src/aspnet-core/ICS.Application/Business/Service/导入服务/ImportExportExtAppService.cs index 6155f55..90c2093 100644 --- a/src/aspnet-core/ICS.Application/Business/Service/导入服务/ImportExportExtAppService.cs +++ b/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(item); //调用领域服务