大闸蟹在线提货系统会要求支持很多家快递公司,来进行产品的发货。对于像圆通,中通这样的快递来说,他们家的单号是有规律的加一,我们只需要录入起始单号(在线提货系统源代码实现起来也非常的简单),后面的单号,只要连续加一就可以愉快的实现了。
提货系统源代码-顺丰快递模块
但是,顺丰快递的单号,却不是简单的加一了。看上去毫无规律,却又有规律的感觉,一会儿加9,一会儿加1,这个问题应该困扰了不少朋友。
下面我们公开在线提货系统源代码的顺丰快递单号生成部分的代码部分。
public static string Gen_Next_Sf_ExpressNumber(string SeedCode)
{
string currentNo = SeedCode;
if (currentNo.Length == 12)
{
string Recin_BFBit = “”;
string Recin_FEB = currentNo.Substring(0, 11);
string Recin_BFB = currentNo.Substring(11, 1);
string Recin_BSB = currentNo.Substring(10, 1);
string Recin_BTB = currentNo.Substring(9, 1);
if (Recin_BSB == “9”)
{
switch (Recin_BTB)
{
/*倒数第三位0,1,2,4,5,7,8 跳转 4 */
case “0”:
case “1”:
case “2”:
case “4”:
case “5”:
case “7”:
case “8”:
Recin_BFBit = MakeLastBit(Recin_BFB, 4);
break;
/*倒数第三位 3,6 跳转 5 */
case “3”:
case “6”:
Recin_BFBit = MakeLastBit(Recin_BFB, 5);
break;
/*倒数第三位 9 跳转 7 */
case “9”:
Recin_BFBit = MakeLastBit(Recin_BFB, 7);
break;
}
}
else
{
Recin_BFBit = MakeLastBit(Recin_BFB, 1);
}
int tempLength = Recin_FEB.Length;
double temp = double.Parse(Recin_FEB) + 1;
currentNo = ((temp.ToString().Length < tempLength) ? “0” + temp.ToString() : temp.ToString()) + Recin_BFBit;
return currentNo;
}
return “”;
}