求助,顺丰快递单号生成规律?

gaoquanli 2010-02-20 03:03:46
021863378001
021863378010
021863378029
021863378038
021863378047
021863378056
021863378065
021863378074
021863378083
021863378092
021863378108
021863378117
021863378126
021863378135
021863378144
021863378153
021863378162
021863378171
021863378180
021863378199
上面是顺丰连续的单号,我是这样想,根据单号的最后2位来进行判定:
geBit==0 &&shiBit!=9 +19
geBit==0 &&shiBit==9 +16
shiBit!=9 &&geBit!=0 +9
shiBit==9 个位就有从(1-9)
把个位就有从(1-9)情况,对应下一个单号的 后一位 预留存下,进行判断。

可是当 shiBit==9 个位就有从(1-9)情况下
021863378693
021863378708

021862801193
021862801209

021862801493
021862801509

021862802391
021862802406

021862802691
021862802706

021862802991
021862803004

021974739491
021974739507

发现 相同 个位数,但是有时 生成不同 的个位数。在网上找条形码生成算法,我套用算法对应不上,费我好一段时间都没搞定。
麻烦哪位高手,帮忙给一个生成算法,小弟急用,不胜感激!期待高手的算法。
...全文
6792 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
winntxp 2012-08-03
  • 打赏
  • 举报
回复
计算规则,在信息系统里批量打印运单自动关联运单和系统单据的时候有用。
sharpstart 2011-12-30
  • 打赏
  • 举报
回复
兄弟有没有找到,我也要
jtrwl 2011-03-24
  • 打赏
  • 举报
回复
我这里有Delphi的源码,你可以下载来看一下
shome888 2011-03-24
  • 打赏
  • 举报
回复
根据一个顺丰快递单号,可以知道下一个连续的单号

gaoquanli 2010-10-12
  • 打赏
  • 举报
回复
没人来回答,我自己回答,贴上代码,顺丰单号目前12位,主要看倒数第二和第三位,我总结一下规律:
如果倒数第二位为9是,看第三位进行相应的跳转(下面代码有注释),倒数第二位不为9,倒数第一位倒退一位,具体看下面代码(C#):

private string MakeSFNextNo(string currentNo)
{

if (currentNo.Length == 12)
{
string newBehindFirstBit = string.Empty;
string frontElevenBits = currentNo.Substring(0, 11);
string behindFirstBit = currentNo.Substring(11, 1);
string behindSecondBit = currentNo.Substring(10, 1);
string behindThirdBit = currentNo.Substring(9, 1);
if (behindSecondBit == "9")
{
switch (behindThirdBit)
{
/*倒数第三位0,1,2,4,5,7,8 跳转 4 */
case "0":
case "1":
case "2":
case "4":
case "5":
case "7":
case "8":
newBehindFirstBit = MakeLastBit(behindFirstBit, 4);
break;
/*倒数第三位 3,6 跳转 5 */
case "3":
case "6":
newBehindFirstBit = MakeLastBit(behindFirstBit, 5);
break;
/*倒数第三位 9 跳转 7 */
case "9":
newBehindFirstBit = MakeLastBit(behindFirstBit, 7);
break;

}

}
else
{
newBehindFirstBit = MakeLastBit(behindFirstBit, 1);

}
int tempLength = frontElevenBits.Length;
long temp = Convert.ToInt64(frontElevenBits) + 1;
return ((temp.ToString().Length<tempLength)?"0"+temp.ToString():temp.ToString()) +newBehindFirstBit;

}
else
{
return string.Empty;
}

}

private string MakeLastBit(string lastBit, int step)
{
int temp = Convert.ToInt16(lastBit);
if((temp-step)>=0)
{
return (temp - step).ToString();
}
else
{
return (10 + (temp - step)).ToString();
}

}
jnwz159 2010-08-26
  • 打赏
  • 举报
回复
有规律!
gaoquanli 2010-02-20
  • 打赏
  • 举报
回复
我这里每天的包裹数有几十个,需要把顺丰快递单号保存下次,大侠们,指点一下呀。小弟真急用呀!
街头小贩 2010-02-20
  • 打赏
  • 举报
回复
你看看拿单子的大哥手上拿的一堆单子!都是顺号的!估计每个人每天都是顺便拿的!算法有用么
gaoquanli 2010-02-20
  • 打赏
  • 举报
回复
我就是需要下一个单号,很有用的。哪位大侠,给一个自动生成算法,小弟急用。
街头小贩 2010-02-20
  • 打赏
  • 举报
回复
你知道了下一单号又可以干什么呢?
gaoquanli 2010-02-20
  • 打赏
  • 举报
回复
根据一个顺丰快递单号,可以知道下一个连续的单号
抱抱我的小猫 2010-02-20
  • 打赏
  • 举报
回复
问题是 你想干嘛。。。
gaoquanli 2010-02-20
  • 打赏
  • 举报
回复
怎么没有大侠来指点一下呀,小弟愁死啦。。。

10,612

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧