生成类似 LS14120002
private String GenNewOrder()
{
String newOrder;
var orders = LYOrder.Items;
String lastOrder = ((Order)orders[orders.Count - ]).OrderNum;
//int len = lastOrder.Length;
String dateOld = lastOrder.Substring(, );
int indexOld = Convert.ToInt32(lastOrder.Substring(, ));
String indexNew = (indexOld + ).ToString(); String dateNow = System.DateTime.Now.ToString("yyMM");//获取年月
if (dateOld.Equals(dateNow))//同一个月的单
{ switch (indexNew.Length)
{
case :
indexNew = "" + indexNew;
break;
case :
indexNew = "" + indexNew;
break;
case :
indexNew = "" + indexNew;
break;
}
newOrder = " LS" + dateNow + indexNew; }
else
{
newOrder = " LS" + dateNow + "";
} return newOrder; }