修改往来单位同步,增加是否同步联系人租户参数

master
jianghaiqing 3 weeks ago
parent 744b7a4226
commit bec37bc6f6

@ -226,14 +226,36 @@ namespace Myshipping.Application
{
entity.Id = m.Id;
bool isNoSyncContact = false;
_logger.LogInformation($"外部同步大简云往来单位 {UserManager.TENANT_NAME} 同步往来单位{entity.FullName}");
var paraVal = _tenantParamValue.AsQueryable().Filter(null, true).First(x => x.TenantId == UserManager.TENANT_ID && x.ParaCode == "DataSyncCustomerNoContact");
_logger.LogInformation($"外部同步大简云往来单位 {UserManager.TENANT_NAME} 同步往来单位{entity.FullName} 取到租户参数 {JSON.Serialize(paraVal)}");
if (paraVal != null && !string.IsNullOrWhiteSpace(paraVal.ItemCode))
{
if (paraVal.ItemCode.Equals("ENABLE"))
{
isNoSyncContact = true;
_logger.LogInformation($"外部同步大简云往来单位 {UserManager.TENANT_NAME} 同步往来单位{entity.FullName} 判定不同步联系人");
}
}
await _djycustomer.AsUpdateable(entity).IgnoreColumns(it => new
{
it.TenantId,
it.TIDANINFO
}).ExecuteCommandAsync();
await _djycustomercontact.DeleteAsync(x => x.CustomerId == entity.Id);
if (!isNoSyncContact)
{
await _djycustomercontact.DeleteAsync(x => x.CustomerId == entity.Id);
}
if (entity.PropString.Contains("shipagency"))
{
@ -265,12 +287,16 @@ namespace Myshipping.Application
await _commonDBService.GetAllForwarder(false);
}
foreach (var item in model.ContactList)
if (!isNoSyncContact)
{
var contact = item.Adapt<DjyCustomerContact>();
contact.CustomerId = entity.Id;
contact.TenantId = UserManager.TENANT_ID;
await _djycustomercontact.InsertAsync(contact);
foreach (var item in model.ContactList)
{
var contact = item.Adapt<DjyCustomerContact>();
contact.CustomerId = entity.Id;
contact.TenantId = UserManager.TENANT_ID;
await _djycustomercontact.InsertAsync(contact);
}
}
}
return entity.Id;

Loading…
Cancel
Save