From 4aed54aeeb95f2563daf515195782e24dd2b2e90 Mon Sep 17 00:00:00 2001 From: wanghaomei <86whm@163.com> Date: Fri, 19 Apr 2024 11:08:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E8=BF=9C=E8=AE=A2=E8=88=B1=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EDI/ZhongYuanSoApiHelper.cs | 208 ++++++++++++++++-- .../BookingSoTemplate/BookingSoTemplate.cs | 16 +- .../Entity/BookingStatusLog.cs | 4 + .../BookingCustomerOrderService.cs | 33 ++- .../Service/BookingCustomerOrder/Dto/Dtos.cs | 7 +- .../BookingSoTemplateService.cs | 19 +- .../Dto/BookingSoTemplateDto.cs | 10 + 7 files changed, 271 insertions(+), 26 deletions(-) diff --git a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs index 16744200..f9670d09 100644 --- a/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs +++ b/Myshipping.Application/EDI/ZhongYuanSoApiHelper.cs @@ -1,4 +1,6 @@ using Furion; +using Furion.Logging; +using Furion.RemoteRequest.Extensions; using Myshipping.Application.Entity; using Myshipping.Core; using Myshipping.Core.Entity; @@ -8,6 +10,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Myshipping.Application.EDI @@ -42,16 +45,35 @@ namespace Myshipping.Application.EDI } var sysConfigList = await cache.GetAllSysConfig(); + var sCfgSpiderUrl = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderUrl" && x.GroupCode == "DJY_CONST"); + if (sCfgSpiderUrl == null) + { + return new KeyValuePair(false, "中远订舱API的爬虫URL地址未配置,请联系管理员"); + } + var sCfgUserKey = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderKey" && x.GroupCode == "DJY_CONST"); var sCfgUserSecret = sysConfigList.FirstOrDefault(x => x.Code == "ZhongYuanApiSpiderSecret" && x.GroupCode == "DJY_CONST"); if (sCfgUserKey == null || sCfgUserSecret == null) { - return new KeyValuePair(false, "中远订舱API的KEY和密钥为配置,请联系管理员"); + return new KeyValuePair(false, "中远订舱API的KEY和密钥未配置,请联系管理员"); } BookingSoTemplate template = null; DjyCustomerContact custContact = null; + var postModel = new ZhongYuanSoApiModel(); + + if (!string.IsNullOrEmpty(custOrder.ExtendData)) + { + var extObj = JObject.Parse(custOrder.ExtendData); + postModel.webAccount = extObj.GetStringValue("Account"); + postModel.webPassword = extObj.GetStringValue("Password"); + } + else + { + return new KeyValuePair(false, "未找到订舱账号信息"); + } + //查找模板: //1.根据客户订舱信息中的BookingUserId和BookingTenantId,去客户信息中根据CustSysId查找客户(公司)及联系人(员工)信息 //2.根据找到的客户及联系人信息,查找中远订舱模板 @@ -67,32 +89,26 @@ namespace Myshipping.Application.EDI return new KeyValuePair(false, "未找到客户及联系人信息"); } - template = await repTemplate.AsQueryable().FirstAsync(x => x.CarrierId == custOrder.CARRIERID && x.UserId == custContact.Id && x.IsEnable); + //根据:用户+船司+船司账号+约号,找到启用的模板 + template = await repTemplate.AsQueryable().FirstAsync(x => x.CarrierId == custOrder.CARRIERID && x.UserId == custContact.Id && x.ContractNO == custOrder.CONTRACTNO && x.BookingAccount == postModel.webAccount && x.IsEnable); if (template == null) { return new KeyValuePair(false, "未找到订舱模板"); } } + else + { + return new KeyValuePair(false, "未找到客户端公司和用户ID"); + } var mappingCtn = await cache.GetAllMappingCtn(); var mappingFrt = await cache.GetAllMappingFrt(); var mappingPortLoad = await cache.GetAllMappingPortLoad(); var mappingPort = await cache.GetAllMappingPort(); - var postModel = new ZhongYuanSoApiModel(); postModel.userKey = sCfgUserKey.Value; postModel.userSecret = sCfgUserSecret.Value; - if (!string.IsNullOrEmpty(custOrder.ExtendData)) - { - var extObj = JObject.Parse(custOrder.ExtendData); - postModel.webAccount = extObj.GetStringValue("Account"); - postModel.webPassword = extObj.GetStringValue("Password"); - } - else - { - return new KeyValuePair(false, "未找到订舱账号信息"); - } postModel.uploadType = template.Category; //DRAFT, TEMPLATE, BOOKING分别对应:草稿, 模板, 订舱 postModel.saveName = template.TemplateName; @@ -109,6 +125,21 @@ namespace Myshipping.Application.EDI return new KeyValuePair(false, $"未找到目的港映射信息:{custOrder.PORTDISCHARGECODE}"); } + //运输条款 + var mappingService = await cacheService.GetAllMappingService(); + var mappService = mappingService.FirstOrDefault(x => x.Module == "DjyCustBooking" && x.CarrierCode == "COSCO" && x.Code == custOrder.SERVICE); + if (mappService == null) + { + return new KeyValuePair(false, $"未找到运输条款映射信息:{custOrder.SERVICE}"); + } + + if (!Regex.IsMatch(mappService.MapCode, "^[A-Za-z]+-[A-Za-z]+$")) + { + return new KeyValuePair(false, $"映射配置不正确:{mappService.MapCode}"); + } + + var mapServArr = mappService.MapCode.Split('-'); + postModel.routes = new ZhongYuanSoApiRoute() { originCity = mapPortLoad.MapCode, @@ -117,9 +148,37 @@ namespace Myshipping.Application.EDI voyageNumber = custOrder.VOYNO, serviceCode = custOrder.LANECODE, sailSchedulePriority = template.Priority.Split(',').ToList(), + outboundHaulage = mapServArr[0], + inboundHaulage = mapServArr[1], }; #region 收发通及货代 + //发货人 + ZhongYuanSoApiPhone shipperPhone = null; + if (string.IsNullOrEmpty(template.ShipperName)) + { + shipperPhone = new ZhongYuanSoApiPhone() + { + countryCode = custOrder.ShipperPhoneCountryCode, + areaCode = custOrder.ShipperPhoneCode, + number = custOrder.ShipperPhone + }; + } + else + { + shipperPhone = new ZhongYuanSoApiPhone() + { + countryCode = template.ShipperPhoneCountryCode, + areaCode = template.ShipperPhoneCode, + number = template.ShipperPhone + }; + } + + shipperPhone.countryCode = shipperPhone.countryCode == null ? "" : shipperPhone.countryCode; + shipperPhone.areaCode = shipperPhone.areaCode == null ? "" : shipperPhone.areaCode; + shipperPhone.number = shipperPhone.number == null ? "" : shipperPhone.number; + + postModel.shipperInfo = new ZhongYuanSoApiSFT() { firstName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperFirstName : template.ShipperFirstName, @@ -129,10 +188,35 @@ namespace Myshipping.Application.EDI city = string.IsNullOrEmpty(template.ShipperCity) ? custOrder.ShipperCity : template.ShipperCity, partyName = string.IsNullOrEmpty(template.ShipperName) ? custOrder.ShipperName : template.ShipperName, addressDes = string.IsNullOrEmpty(template.ShipperAddress) ? custOrder.ShipperAddress : template.ShipperAddress, - phone = string.IsNullOrEmpty(template.ShipperName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.ShipperPhoneCountryCode, areaCode = custOrder.ShipperPhoneCode, number = custOrder.ShipperPhone } : new ZhongYuanSoApiPhone() { countryCode = template.ShipperPhoneCountryCode, areaCode = template.ShipperPhoneCode, number = template.ShipperPhone }, + phone = shipperPhone, postalCode = string.IsNullOrEmpty(template.ShipperPostCode) ? custOrder.ShipperPostCode : template.ShipperPostCode }; + //收货人 + ZhongYuanSoApiPhone consigneePhone = null; + if (string.IsNullOrEmpty(template.ConsigneeName)) + { + consigneePhone = new ZhongYuanSoApiPhone() + { + countryCode = custOrder.ConsigneePhoneCountryCode, + areaCode = custOrder.ConsigneePhoneCode, + number = custOrder.ConsigneePhone + }; + } + else + { + consigneePhone = new ZhongYuanSoApiPhone() + { + countryCode = template.ConsigneePhoneCountryCode, + areaCode = template.ConsigneePhoneCode, + number = template.ConsigneePhone + }; + } + + consigneePhone.countryCode = consigneePhone.countryCode == null ? "" : consigneePhone.countryCode; + consigneePhone.areaCode = consigneePhone.areaCode == null ? "" : consigneePhone.areaCode; + consigneePhone.number = consigneePhone.number == null ? "" : consigneePhone.number; + postModel.consigneeInfo = new ZhongYuanSoApiSFT() { firstName = string.IsNullOrEmpty(template.ConsigneeFirstName) ? custOrder.ConsigneeFirstName : template.ConsigneeFirstName, @@ -142,10 +226,35 @@ namespace Myshipping.Application.EDI city = string.IsNullOrEmpty(template.ConsigneeCity) ? custOrder.ConsigneeCity : template.ConsigneeCity, partyName = string.IsNullOrEmpty(template.ConsigneeName) ? custOrder.ConsigneeName : template.ConsigneeName, addressDes = string.IsNullOrEmpty(template.ConsigneeAddress) ? custOrder.ConsigneeAddress : template.ConsigneeAddress, - phone = string.IsNullOrEmpty(template.ConsigneeName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.ConsigneePhoneCountryCode, areaCode = custOrder.ConsigneePhoneCode, number = custOrder.ConsigneePhone } : new ZhongYuanSoApiPhone() { countryCode = template.ConsigneePhoneCountryCode, areaCode = template.ConsigneePhoneCode, number = template.ConsigneePhone }, + phone = consigneePhone, postalCode = string.IsNullOrEmpty(template.ConsigneePostCode) ? custOrder.ConsigneePostCode : template.ConsigneePostCode }; + //通知人 + ZhongYuanSoApiPhone notifyPhone = null; + if (string.IsNullOrEmpty(template.NotifypartName)) + { + notifyPhone = new ZhongYuanSoApiPhone() + { + countryCode = custOrder.NotifypartPhoneCountryCode, + areaCode = custOrder.NotifypartPhoneCode, + number = custOrder.NotifypartPhone + }; + } + else + { + notifyPhone = new ZhongYuanSoApiPhone() + { + countryCode = template.NotifypartPhoneCountryCode, + areaCode = template.NotifypartPhoneCode, + number = template.NotifypartPhone + }; + } + + notifyPhone.countryCode = notifyPhone.countryCode == null ? "" : notifyPhone.countryCode; + notifyPhone.areaCode = notifyPhone.areaCode == null ? "" : notifyPhone.areaCode; + notifyPhone.number = notifyPhone.number == null ? "" : notifyPhone.number; + postModel.notifyInfo = new ZhongYuanSoApiSFT() { firstName = string.IsNullOrEmpty(template.NotifypartFirstName) ? custOrder.NotifypartFirstName : template.NotifypartFirstName, @@ -155,10 +264,36 @@ namespace Myshipping.Application.EDI city = string.IsNullOrEmpty(template.NotifypartCity) ? custOrder.NotifypartCity : template.NotifypartCity, partyName = string.IsNullOrEmpty(template.NotifypartName) ? custOrder.NotifypartName : template.NotifypartName, addressDes = string.IsNullOrEmpty(template.NotifypartAddress) ? custOrder.NotifypartAddress : template.NotifypartAddress, - phone = string.IsNullOrEmpty(template.NotifypartName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.NotifypartPhoneCountryCode, areaCode = custOrder.NotifypartPhoneCode, number = custOrder.NotifypartPhone } : new ZhongYuanSoApiPhone() { countryCode = template.NotifypartPhoneCountryCode, areaCode = template.NotifypartPhoneCode, number = template.NotifypartPhone }, + phone = notifyPhone, postalCode = string.IsNullOrEmpty(template.NotifypartPostCode) ? custOrder.NotifypartPostCode : template.NotifypartPostCode }; + //货代 + ZhongYuanSoApiPhone forwarderPhone = null; + if (string.IsNullOrEmpty(template.BookingName)) + { + forwarderPhone = new ZhongYuanSoApiPhone() + { + countryCode = custOrder.BookingPhoneCountryCode, + areaCode = custOrder.BookingPhoneCode, + number = custOrder.BookingPhone + }; + } + else + { + forwarderPhone = new ZhongYuanSoApiPhone() + { + countryCode = template.BookingPhoneCountryCode, + areaCode = template.BookingPhoneCode, + number = template.BookingPhone + }; + } + + forwarderPhone.countryCode = forwarderPhone.countryCode == null ? "" : forwarderPhone.countryCode; + forwarderPhone.areaCode = forwarderPhone.areaCode == null ? "" : forwarderPhone.areaCode; + forwarderPhone.number = forwarderPhone.number == null ? "" : forwarderPhone.number; + + postModel.forwarderInfo = new ZhongYuanSoApiSFT() { firstName = string.IsNullOrEmpty(template.BookingFirstName) ? custOrder.BookingFirstName : template.BookingFirstName, @@ -168,7 +303,7 @@ namespace Myshipping.Application.EDI city = string.IsNullOrEmpty(template.BookingCity) ? custOrder.BookingCity : template.BookingCity, partyName = string.IsNullOrEmpty(template.BookingName) ? custOrder.BookingName : template.BookingName, addressDes = string.IsNullOrEmpty(template.BookingAddress) ? custOrder.BookingAddress : template.BookingAddress, - phone = string.IsNullOrEmpty(template.BookingName) ? new ZhongYuanSoApiPhone() { countryCode = custOrder.BookingPhoneCountryCode, areaCode = custOrder.BookingPhoneCode, number = custOrder.BookingPhone } : new ZhongYuanSoApiPhone() { countryCode = template.BookingPhoneCountryCode, areaCode = template.BookingPhoneCode, number = template.BookingPhone }, + phone = forwarderPhone, postalCode = string.IsNullOrEmpty(template.BookingPostCode) ? custOrder.BookingPostCode : template.BookingPostCode }; #endregion @@ -218,13 +353,38 @@ namespace Myshipping.Application.EDI paymentMethod = mapFrt.MapCode }; + + //大简云客户订舱接收BC邮箱 + var djyBookMail = sysConfigList.FirstOrDefault(x => x.Code == "DjyCustomerBookReceiveBcMail"); + var bcMail = custContact.Email; + if (djyBookMail != null) + { + bcMail += djyBookMail.Value; + } + postModel.special = new ZhongYuanSoApiSpecial() { - emailAddresses = custContact.Email, + emailAddresses = bcMail, remarksForEntireBooking = custOrder.SOREMARK }; - return new KeyValuePair(); + Log.Information($"发送API数据给爬虫({sCfgSpiderUrl.Value}):{postModel.ToJsonString()}"); + var rtn = await sCfgSpiderUrl.Value.SetBody(postModel) + .PostAsStringAsync(); + + Log.Information($"爬虫返回:{rtn}"); + var jobjRtn = JObject.Parse(rtn); + if (jobjRtn.GetIntValue("code") == 200) + { + return new KeyValuePair(true, "发送成功"); + } + else + { + return new KeyValuePair(false, jobjRtn.GetStringValue("msg")); + } + + + } /// @@ -372,6 +532,16 @@ namespace Myshipping.Application.EDI /// 船期选择优先级 /// public List sailSchedulePriority { get; set; } + + /// + /// 出发地运输条款 + /// + public string outboundHaulage { get; set; } + + /// + /// 目的地运输条款 + /// + public string inboundHaulage { get; set; } } /// diff --git a/Myshipping.Application/Entity/BookingSoTemplate/BookingSoTemplate.cs b/Myshipping.Application/Entity/BookingSoTemplate/BookingSoTemplate.cs index d6e9f7c1..253ff398 100644 --- a/Myshipping.Application/Entity/BookingSoTemplate/BookingSoTemplate.cs +++ b/Myshipping.Application/Entity/BookingSoTemplate/BookingSoTemplate.cs @@ -500,6 +500,20 @@ namespace Myshipping.Application.Entity [SugarColumn(ColumnName = "TenantName")] [Description("租户名称")] public string TenantName{ get; set; } - + + /// + /// 合约号 + /// + [SugarColumn(ColumnName = "ContractNO")] + [Description("合约号")] + public string ContractNO { get; set; } + + /// + /// 订舱账号 + /// + [SugarColumn(ColumnName = "BookingAccount")] + [Description("订舱账号")] + public string BookingAccount { get; set; } + } } \ No newline at end of file diff --git a/Myshipping.Application/Entity/BookingStatusLog.cs b/Myshipping.Application/Entity/BookingStatusLog.cs index 3e283447..2d7bd8f3 100644 --- a/Myshipping.Application/Entity/BookingStatusLog.cs +++ b/Myshipping.Application/Entity/BookingStatusLog.cs @@ -35,5 +35,9 @@ namespace Myshipping.Application.Entity /// 提单号 /// public string MBLNO { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } } } \ No newline at end of file diff --git a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs index 7cd441d1..8272ab61 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/BookingCustomerOrderService.cs @@ -928,6 +928,7 @@ namespace Myshipping.Application bkOrder.Id = YitIdHelper.NextId(); bkOrder.BSSTATUS = "已录入"; bkOrder.ParentId = 0; + bkOrder.LANENAME = bkOrder.LANECODE; await _repOrder.InsertAsync(bkOrder); model.BookingId = bkOrder.Id; //客户订舱数据与订舱台账数据关联 @@ -1547,6 +1548,7 @@ namespace Myshipping.Application bkOrder.BSSTATUS = "已录入"; bkOrder.CUSTOMERNAME = model.BookingTenantName; bkOrder.ParentId = 0; + bkOrder.LANENAME = bkOrder.LANECODE; await _repOrder.InsertAsync(bkOrder); var bkEdiExt = new BookingEDIExt(); @@ -1723,7 +1725,7 @@ namespace Myshipping.Application /// /// 保存审核的日志动态(使用当前登录人信息) /// - private void SaveAuditLog(string status, long bookId) + private void SaveAuditLog(string status, long bookId, string remark = null) { var staLog = new BookingStatusLog(); staLog.Status = status; @@ -1733,6 +1735,7 @@ namespace Myshipping.Application staLog.OpTime = DateTime.Now; staLog.BookingId = bookId; staLog.Category = StaLogCateAudit; + staLog.Remark = remark; _repStatuslog.Insert(staLog); } @@ -1980,6 +1983,31 @@ namespace Myshipping.Application custOrder.SERVICE = service.Name; custOrder.BLFRT = frt.EnName; + //2024年4月19日,将分拆的收发通拼接到大文本的收发通中 + if (string.IsNullOrEmpty(custOrder.SHIPPER) && !string.IsNullOrEmpty(custOrder.ShipperName)) + { + custOrder.SHIPPER = @$"{custOrder.ShipperName} +{custOrder.ShipperAddress} +{custOrder.ShipperCountry} {custOrder.ShipperProvince} {custOrder.ShipperCity} {custOrder.ShipperCounty} {custOrder.ShipperPostCode} +{custOrder.ShipperLastName} {custOrder.ShipperFirstName} {custOrder.ShipperPhoneCountryCode} {custOrder.ShipperPhoneCode} {custOrder.ShipperPhone}".ToUpper(); + } + + if (string.IsNullOrEmpty(custOrder.CONSIGNEE) && !string.IsNullOrEmpty(custOrder.ConsigneeName)) + { + custOrder.SHIPPER = @$"{custOrder.ConsigneeName} +{custOrder.ConsigneeAddress} +{custOrder.ConsigneeCountry} {custOrder.ConsigneeProvince} {custOrder.ConsigneeCity} {custOrder.ConsigneeCounty} {custOrder.ConsigneePostCode} +{custOrder.ConsigneeLastName} {custOrder.ConsigneeFirstName} {custOrder.ConsigneePhoneCountryCode} {custOrder.ConsigneePhoneCode} {custOrder.ConsigneePhone}".ToUpper(); + } + + if (string.IsNullOrEmpty(custOrder.NOTIFYPARTY) && !string.IsNullOrEmpty(custOrder.NotifypartName)) + { + custOrder.SHIPPER = @$"{custOrder.NotifypartName} +{custOrder.NotifypartAddress} +{custOrder.NotifypartCountry} {custOrder.NotifypartProvince} {custOrder.NotifypartCity} {custOrder.NotifypartCounty} {custOrder.NotifypartPostCode} +{custOrder.NotifypartLastName} {custOrder.NotifypartFirstName} {custOrder.NotifypartPhoneCountryCode} {custOrder.NotifypartPhoneCode} {custOrder.NotifypartPhone}".ToUpper(); + } + //订舱账号、密码 var jobj = new JObject(); if (!string.IsNullOrEmpty(custOrder.ExtendData)) @@ -2079,8 +2107,11 @@ namespace Myshipping.Application var rtn = await ZhongYuanSoApiHelper.DoPost(id); if (!rtn.Key) { + SaveAuditLog("发送订舱", id, remark: rtn.Value); throw Oops.Bah(rtn.Value); } + + SaveAuditLog("发送订舱", id, remark: rtn.Value); } #endregion } diff --git a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs index 5c6a26c8..08b2c1a3 100644 --- a/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs +++ b/Myshipping.Application/Service/BookingCustomerOrder/Dto/Dtos.cs @@ -766,7 +766,12 @@ namespace Myshipping.Application /// /// 创建者名称 /// - public virtual string CreatedUserName { get; set; } + public string CreatedUserName { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } } diff --git a/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs b/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs index 7506d700..9a6a4b83 100644 --- a/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs +++ b/Myshipping.Application/Service/BookingSoTemplate/BookingSoTemplateService.cs @@ -83,10 +83,16 @@ namespace Myshipping.Application.Service //同一用户,同一船公司,只允许生效一个模板。 if (input.IsEnable) { - var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable && x.Id != input.Id); + var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false + && x.UserId == input.UserId + && x.CarrierId == input.CarrierId + && x.IsEnable + && x.ContractNO == input.ContractNO + && x.BookingAccount == input.BookingAccount + && x.Id != input.Id); if (c > 0) { - throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); + throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier},合约号:{input.ContractNO},订舱账号:{input.BookingAccount} 已存在启用的模板"); } } @@ -101,10 +107,15 @@ namespace Myshipping.Application.Service //同一用户,同一船公司,只允许生效一个模板。 if (input.IsEnable) { - var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false && x.UserId == input.UserId && x.CarrierId == input.CarrierId && x.IsEnable); + var c = _rep.AsQueryable().Filter(null, true).Count(x => x.IsDeleted == false + && x.UserId == input.UserId + && x.CarrierId == input.CarrierId + && x.IsEnable + && x.ContractNO == input.ContractNO + && x.BookingAccount == input.BookingAccount); if (c > 0) { - throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier} 已存在启用的模板"); + throw Oops.Bah($"客户:{input.CustName},用户:{input.UserName},船司:{input.Carrier},合约号:{input.ContractNO},订舱账号:{input.BookingAccount} 已存在启用的模板"); } } diff --git a/Myshipping.Application/Service/BookingSoTemplate/Dto/BookingSoTemplateDto.cs b/Myshipping.Application/Service/BookingSoTemplate/Dto/BookingSoTemplateDto.cs index 7395cfa5..43642c37 100644 --- a/Myshipping.Application/Service/BookingSoTemplate/Dto/BookingSoTemplateDto.cs +++ b/Myshipping.Application/Service/BookingSoTemplate/Dto/BookingSoTemplateDto.cs @@ -357,6 +357,16 @@ namespace Myshipping.Application /// public string BcReceiveEmail { get; set; } + /// + /// 合约号 + /// + public string ContractNO { get; set; } + + /// + /// 订舱账号 + /// + public string BookingAccount { get; set; } + } ///