/// 获取调整xxxx信息新编号 /// </summary> /// <param name="Year"></param> /// <returns></returns> public string GetNewModifyNo(int Year,string Stro) { string NewModifyNo=""; string Prefix = "TZ"; string CommandText = "SELECT count(*) FROM OverSystems_TosModifyInfo where ModifyNo like '" + Stro + "%'"; if (Convert.ToInt32(sqlAccess.ExecuteScalar(CommandText)) > 0) { string LastModifyNo; CommandText = "SELECT ModifyNo FROM OverSystems_TosModifyInfo where ModifyNo like '"+ Stro + "%'"; DataTable ModifyNo = new DataTable(); ModifyNo = sqlAccess.ExecuteTable(CommandText); //编号'-ZT'后的最大值 int[] num = new int[1000]; for (int i=0;i< ModifyNo.Rows.Count;i++) { string Str = Convert.ToString(ModifyNo.Rows[i].ItemArray[0]); if (Str.Contains("-")) { string SerialNum = Str.Remove(0, Str.Length - 3); num[i] = Convert.ToInt32(SerialNum); } } int max = num.Max(); NewModifyNo = Stro+"-"+ Prefix + (max + 1).ToString("000"); } else { NewModifyNo = Stro+"-"+ Prefix + "001"; } return NewModifyNo; }