From 419b719b9390ba8e89541cbcc42b06d451d0f4d7 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Tue, 24 Oct 2023 11:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=B1=E5=8F=B7=E9=AA=8C=E8=AF=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=20=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Myshipping.Application/ConstCommon.cs | 17 +++++++++++++++++ .../BookingOrder/BookingOrderService.cs | 18 ++++++++++++++++++ .../DjyUserMailAccountService.cs | 6 ++++-- .../IDjyUserMailAccountService.cs | 4 ++-- Myshipping.Web.Core/Startup.cs | 8 ++++++-- 5 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Myshipping.Application/ConstCommon.cs b/Myshipping.Application/ConstCommon.cs index 456b897..b0ae360 100644 --- a/Myshipping.Application/ConstCommon.cs +++ b/Myshipping.Application/ConstCommon.cs @@ -12,5 +12,22 @@ namespace Myshipping.Application /// 订舱货物状态分类-单证补料 /// public const string BookingStatusLogCateDocSupplement = "doc_supplement"; + + + /// + /// 验证集装箱号是否符合规则 + /// + /// + /// + public static bool VerifyContainerCode(string code) + { + const string cc = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ"; + var num = code.ToUpper().ToCharArray().Take(10).Select((c, i) => new + { + idx = (int)(cc.IndexOf(c) * Math.Pow(2, i)) + }).Sum(p => p.idx); + return int.Parse(code.Substring(10, 1)) == num % 11 % 10; + } + } } diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs index cfe09da..9b73106 100644 --- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs +++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs @@ -8791,6 +8791,24 @@ HLCUTA12307DPXJ3 以这票为例 6个柜 } return true; } + + /// + /// 验证箱号 + /// + /// + /// + [HttpGet("/BookingOrder/CheckCtnCode")] + public async Task CheckCtnCode(string code) + { + if (code.Length != 11) + { + return false; + } + + return ConstCommon.VerifyContainerCode(code); + } + + #endregion #region 临时测试使用 diff --git a/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs b/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs index 243ed60..b3ee9b3 100644 --- a/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs +++ b/Myshipping.Core/Service/DjyUserMailAccount/DjyUserMailAccountService.cs @@ -55,7 +55,7 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyUserMailAccount/add")] - public async Task Add(AddDjyUserMailAccountInput input) + public async Task Add(AddDjyUserMailAccountInput input) { var cc = _rep.AsQueryable().Filter(null, true).Count(x => x.MailAccount == input.MailAccount); if (cc > 0) @@ -65,6 +65,7 @@ namespace Myshipping.Core.Service var entity = input.Adapt(); await _rep.InsertAsync(entity); + return entity.Id; } /// @@ -73,7 +74,7 @@ namespace Myshipping.Core.Service /// /// [HttpPost("/DjyUserMailAccount/edit")] - public async Task Update(UpdateDjyUserMailAccountInput input) + public async Task Update(UpdateDjyUserMailAccountInput input) { var cc = _rep.AsQueryable().Filter(null, true).Count(x => x.MailAccount == input.MailAccount && x.Id != input.Id); if (cc > 0) @@ -83,6 +84,7 @@ namespace Myshipping.Core.Service var entity = input.Adapt(); await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + return entity.Id; } /// diff --git a/Myshipping.Core/Service/DjyUserMailAccount/IDjyUserMailAccountService.cs b/Myshipping.Core/Service/DjyUserMailAccount/IDjyUserMailAccountService.cs index e1f183e..b6dad51 100644 --- a/Myshipping.Core/Service/DjyUserMailAccount/IDjyUserMailAccountService.cs +++ b/Myshipping.Core/Service/DjyUserMailAccount/IDjyUserMailAccountService.cs @@ -8,8 +8,8 @@ namespace Myshipping.Core.Service public interface IDjyUserMailAccountService { Task Page([FromQuery] QueryDjyUserMailAccountInput input); - Task Add(AddDjyUserMailAccountInput input); - Task Update(UpdateDjyUserMailAccountInput input); + Task Add(AddDjyUserMailAccountInput input); + Task Update(UpdateDjyUserMailAccountInput input); Task Delete(GetDjyUserMailAccountInput input); Task Get([FromQuery] GetDjyUserMailAccountInput input); //Task List([FromQuery] QueryDjyUserMailAccountInput input); diff --git a/Myshipping.Web.Core/Startup.cs b/Myshipping.Web.Core/Startup.cs index baf5ddf..cb3e603 100644 --- a/Myshipping.Web.Core/Startup.cs +++ b/Myshipping.Web.Core/Startup.cs @@ -125,8 +125,12 @@ public class Startup : AppStartup }); - //公司员工变动消息队列服务 - services.AddHostedService(); + var runType = App.GetConfig("RunType"); + if (runType == "CUST") //客户端订阅大简云公司用户信息同步 + { + //公司员工变动消息队列服务 + services.AddHostedService(); + } } public void Configure(IApplicationBuilder app, IWebHostEnvironment env)