|
|
|
@ -798,6 +798,62 @@ public partial class SeaExportService : ISeaExportService
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (seaExport.CustomserId != 0)
|
|
|
|
|
{
|
|
|
|
|
var delCustomsers = contactLists.Where(x => x.BusinessType == BusinessType.OceanShippingExport && x.CustomerType == "custom" && x.CustomerId != seaExport.CustomserId).ToList();
|
|
|
|
|
if (delCustomsers.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
delList.AddRange(delCustomsers);
|
|
|
|
|
}
|
|
|
|
|
var defaultContact = sqlSugarScope.Queryable<InfoClientContact>().Where(x => x.ClientId == seaExport.CustomserId && x.IsDefault == true).First();
|
|
|
|
|
if (defaultContact.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
if (!contactLists.Where(x => x.BusinessType == BusinessType.OceanShippingExport && x.CustomerType == "custom" && x.Name == defaultContact.Name).Any())
|
|
|
|
|
{
|
|
|
|
|
addList.Add(new BusinessOrderContact()
|
|
|
|
|
{
|
|
|
|
|
BusinessId = seaExport.Id,
|
|
|
|
|
CustomerId = (long)seaExport.CustomserId,
|
|
|
|
|
CustomerName = seaExport.CustomerName,
|
|
|
|
|
CustomerType = "custom",
|
|
|
|
|
CustomerTypeName = "报关行",
|
|
|
|
|
Name = defaultContact.Name,
|
|
|
|
|
Mobile = defaultContact.Mobile,
|
|
|
|
|
Tel = defaultContact.Tel,
|
|
|
|
|
Email = defaultContact.Email,
|
|
|
|
|
CustomerContactId = defaultContact.Id
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (seaExport.AgentId != 0)
|
|
|
|
|
{
|
|
|
|
|
var delAgents = contactLists.Where(x => x.BusinessType == BusinessType.OceanShippingExport && x.CustomerType == "agent" && x.CustomerId != seaExport.CustomserId).ToList();
|
|
|
|
|
if (delAgents.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
delList.AddRange(delAgents);
|
|
|
|
|
}
|
|
|
|
|
var defaultContact = sqlSugarScope.Queryable<InfoClientContact>().Where(x => x.ClientId == seaExport.AgentId && x.IsDefault == true).First();
|
|
|
|
|
if (defaultContact.IsNotNull())
|
|
|
|
|
{
|
|
|
|
|
if (!contactLists.Where(x => x.BusinessType == BusinessType.OceanShippingExport && x.CustomerType == "agent" && x.Name == defaultContact.Name).Any())
|
|
|
|
|
{
|
|
|
|
|
addList.Add(new BusinessOrderContact()
|
|
|
|
|
{
|
|
|
|
|
BusinessId = seaExport.Id,
|
|
|
|
|
CustomerId = (long)seaExport.AgentId,
|
|
|
|
|
CustomerName = seaExport.Agent,
|
|
|
|
|
CustomerType = "agent",
|
|
|
|
|
CustomerTypeName = "国外代理",
|
|
|
|
|
Name = defaultContact.Name,
|
|
|
|
|
Mobile = defaultContact.Mobile,
|
|
|
|
|
Tel = defaultContact.Tel,
|
|
|
|
|
Email = defaultContact.Email,
|
|
|
|
|
CustomerContactId = defaultContact.Id
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (addList.Count > 0)
|
|
|
|
|
sqlSugarScope.Insertable(addList).ExecuteCommand();
|
|
|
|
|
if (delList.Count > 0)
|
|
|
|
|