|
@@ -122,6 +122,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
//公司信息
|
|
|
var clientCompanySql = string.Format(@"Select Id,CompanyFullName From Crm_CustomerCompany Where IsDel = 0");
|
|
|
var clientCompanyData = await _sqlSugar.SqlQueryable<CustomerCompanyCiew>(clientCompanySql).ToListAsync();
|
|
|
+ clientCompanyData = clientCompanyData.DistinctBy(it => it.CompanyFullName).ToList();
|
|
|
|
|
|
var _view = new {
|
|
|
ShippingSpaceTypeData = _ShippingSpaceTypeData,
|
|
@@ -294,14 +295,27 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var companyAdd = await _sqlSugar.Insertable(_CustomerCompany).ExecuteReturnIdentityAsync();
|
|
|
- if (companyAdd < 0)
|
|
|
+
|
|
|
+ var companyInfo1 = await _sqlSugar.Queryable<Crm_CustomerCompany>().Where(it => it.IsDel == 0 &&
|
|
|
+ it.CompanyFullName.Equals(dto.CompanyFullName)
|
|
|
+ ).FirstAsync();
|
|
|
+
|
|
|
+ if (companyInfo1 != null)
|
|
|
{
|
|
|
- _result.Msg = "客户公司信息添加失败!";
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
- return _result;
|
|
|
+ crmCompanyId = companyInfo1.Id;
|
|
|
}
|
|
|
- crmCompanyId = companyAdd;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var companyAdd = await _sqlSugar.Insertable(_CustomerCompany).ExecuteReturnIdentityAsync();
|
|
|
+ if (companyAdd < 0)
|
|
|
+ {
|
|
|
+ _result.Msg = "客户公司信息添加失败!";
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return _result;
|
|
|
+ }
|
|
|
+ crmCompanyId = companyAdd;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|