箱号验证接口

用户信息同步订阅
master
wanghaomei 1 year ago
parent 4b4c6ac1af
commit 419b719b93

@ -12,5 +12,22 @@ namespace Myshipping.Application
/// 订舱货物状态分类-单证补料
/// </summary>
public const string BookingStatusLogCateDocSupplement = "doc_supplement";
/// <summary>
/// 验证集装箱号是否符合规则
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
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;
}
}
}

@ -8791,6 +8791,24 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
}
return true;
}
/// <summary>
/// 验证箱号
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
[HttpGet("/BookingOrder/CheckCtnCode")]
public async Task<bool> CheckCtnCode(string code)
{
if (code.Length != 11)
{
return false;
}
return ConstCommon.VerifyContainerCode(code);
}
#endregion
#region 临时测试使用

@ -55,7 +55,7 @@ namespace Myshipping.Core.Service
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/DjyUserMailAccount/add")]
public async Task Add(AddDjyUserMailAccountInput input)
public async Task<long> 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<DjyUserMailAccount>();
await _rep.InsertAsync(entity);
return entity.Id;
}
/// <summary>
@ -73,7 +74,7 @@ namespace Myshipping.Core.Service
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/DjyUserMailAccount/edit")]
public async Task Update(UpdateDjyUserMailAccountInput input)
public async Task<long> 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<DjyUserMailAccount>();
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return entity.Id;
}
/// <summary>

@ -8,8 +8,8 @@ namespace Myshipping.Core.Service
public interface IDjyUserMailAccountService
{
Task<dynamic> Page([FromQuery] QueryDjyUserMailAccountInput input);
Task Add(AddDjyUserMailAccountInput input);
Task Update(UpdateDjyUserMailAccountInput input);
Task<long> Add(AddDjyUserMailAccountInput input);
Task<long> Update(UpdateDjyUserMailAccountInput input);
Task Delete(GetDjyUserMailAccountInput input);
Task<DjyUserMailAccount> Get([FromQuery] GetDjyUserMailAccountInput input);
//Task<dynamic> List([FromQuery] QueryDjyUserMailAccountInput input);

@ -125,8 +125,12 @@ public class Startup : AppStartup
});
//公司员工变动消息队列服务
services.AddHostedService<RecCompanyUserChangeService>();
var runType = App.GetConfig<string>("RunType");
if (runType == "CUST") //客户端订阅大简云公司用户信息同步
{
//公司员工变动消息队列服务
services.AddHostedService<RecCompanyUserChangeService>();
}
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

Loading…
Cancel
Save