本文主要是介绍批量生成编号(A~Z+3位流水编号),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
/*** 批量生成编号* @param num* @param warehouseId* @return*/ public synchronized List<String> generatCodeList(int num,long warehouseId){MesRack rack = this.getCurrentRack(warehouseId);String oldRackCode;List<String> rackCodes = new ArrayList<String>();int alexIntNew;int lastCodeNum ;//库房没有架位if(rack==null){lastCodeNum = 0;for(int i=1; i<num+1; i++){lastCodeNum++;alexIntNew = 65+((lastCodeNum-1)/999);if(i%999==1){rackCodes.add((char)alexIntNew+"001");}else{//余数补零if(lastCodeNum%999==0){rackCodes.add((char)alexIntNew+"999");}else {rackCodes.add((char) alexIntNew + String.format("%03d", lastCodeNum % 999));}
这篇关于批量生成编号(A~Z+3位流水编号)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!