生成按序的編號

2021-06-05 08:35:55 字數 1090 閱讀 5347

public static string makexfjbh(string jtr, string djrq, string xftj,

string yhbm, ibasezrardao dao) throws exception else if (businesscanstant.xf_ywdj_xftj_xx.equals(xftj)) else if (businesscanstant.xf_ywdj_xftj_dx.equals(xftj)) else if(businesscanstant.xf_ywdj_xftj_sp.equals(xftj))

len = len + tjnamelen;

djrq = djrq.substring(0, 4) + djrq.substring(5, 7)

+ djrq.substring(8, 10);

string sqlgetmaxid = "select max(cast(substr(xfjbh," + (len - 3)

+ ",4) as int)) from txfywdj where djrq>=to_date('" + djrq

+ " 00:00:00','yyyy-mm-dd hh24:mi:ss') and  djrq<=to_date('"

+ djrq + " 23:59:59','yyyy-mm-dd hh24:mi:ss') and jtr='" + jtr

+ "' and xftj='" + xftj + "'";

list list = dao.find(sqlgetmaxid);

int i;

if (list == null || list.size() == 0) else else else }}

stridtail = string.valueof(++i);

int lenoftail = stridtail.length();

for (int j = 0; j < 4 - lenoftail; j++)

strid = xftjname + yhbm + djrq + stridtail;

return strid.trim();

}

編號的生成

1.在日常工作中,編號用處有很多地方,以下是乙個編號的生成 標號規則 1 按照年份排序 2 刪除不影響編號順序 思路 1 需要借助乙個外表去統計編號,此處用到的是 km ot number 字段至少需要id numbertype 區分編號類別,方便其他模組復用 year count 統計編號 2 根...

獨立編號表,生成編號

create table tb no name char 2 primary key 編號種類的名稱 head nvarchar 10 not null default 編號的字首 currentno int not null default 0,當前的編號 bhlen int not null d...

單據編號的生成

1.單據編號的構成 為了避免重複及保持有序性,單據編號通常格式為 關鍵字 yymmdd n位流水號,當然具體規則會根據業務需 要變化,包括 年月日的顯示變化和流水號的位數變化 及編號公升序 例如 ys0812250001,ys200812250001,ys2008120001,ys081225001...