提交当前本机整理版本
This commit is contained in:
@@ -87,4 +87,31 @@ namespace Lskj.Business.Impl
|
||||
return maxNum;
|
||||
|
||||
// 取未使用的编号
|
||||
sqlValue = string.Format("select cast({1} as bigint) as SpeciesNo from {0} where {1} like '{2}{
|
||||
sqlValue = string.Format("select cast({1} as bigint) as SpeciesNo from {0} where {1} like '{2}{3}' order by {1}", tableName, parentKey, parentValue,maxdivision);
|
||||
DataTable table = GetDataTableResult(sqlValue);
|
||||
|
||||
Int64 speciesNo = table.Rows.Count > 0 ? Convert.ToInt64(table.Rows[0]["SpeciesNo"] + "") : 0;
|
||||
if (speciesNo != Int64.Parse(parentValue + PrefixNum+"1"))
|
||||
return parentValue +PrefixNum+"1";;
|
||||
|
||||
foreach (DataRow item in table.Rows)
|
||||
{
|
||||
Int64 rowSpeciesNo = Convert.ToInt64(item["SpeciesNo"] + "");
|
||||
if (speciesNo == rowSpeciesNo) continue;
|
||||
|
||||
if (rowSpeciesNo != speciesNo + 1)
|
||||
{
|
||||
maxNo = (speciesNo + 1).ToString();
|
||||
maxNo = maxNo.PadLeft(parentValue.Length + firstNode.Length, '0');
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
speciesNo = rowSpeciesNo;
|
||||
}
|
||||
}
|
||||
|
||||
return maxNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user