using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
public static class ConstCommon
{
///
/// 订舱货物状态分类-单证补料
///
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;
}
}
}