From 5485b839c5189691c252e3eb961441fd95783800 Mon Sep 17 00:00:00 2001 From: cjy Date: Mon, 21 Oct 2024 16:02:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=85=B3=E8=A1=8C/=E8=BD=A6=E9=98=9F/?= =?UTF-8?q?=E5=9B=BD=E5=A4=96=E4=BB=A3=E7=90=86=E6=9C=89=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=88=96=E8=80=85=E6=9C=89=E5=80=BC=E6=97=B6=EF=BC=8C=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=AF=B9=E5=BA=94=E8=81=94=E7=B3=BB=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Op/Method/SeaExportService.cs | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index b2630910..b6e8f2a6 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -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().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().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)