提交当前本机最新程序
This commit is contained in:
@@ -72,11 +72,14 @@ namespace Lskj.Business.Impl
|
||||
maxNum += "9";
|
||||
}
|
||||
|
||||
string sqlValue = string.Format("select max(cast({1} as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision);
|
||||
// SpeciesNo是层级编码,完整编码可能超过bigint范围,只对当前节点编号进行数值运算。
|
||||
string sqlValue = string.Format("select max(cast(right({1},{4}) as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision, firstNode.Length);
|
||||
string maxNo = GetResult(sqlValue) + "";
|
||||
|
||||
if (string.IsNullOrWhiteSpace(maxNo))
|
||||
maxNo = parentValue + PrefixNum+"1";
|
||||
else
|
||||
maxNo = parentValue + maxNo.PadLeft(firstNode.Length, '0');
|
||||
maxNo = maxNo.PadLeft(parentValue.Length + firstNode.Length, '0');
|
||||
|
||||
if ((PrefixNum + "0").Equals(maxNo.Substring(maxNo.Length - firstNode.Length)))
|
||||
@@ -87,11 +90,11 @@ namespace Lskj.Business.Impl
|
||||
return maxNum;
|
||||
|
||||
// 取未使用的编号
|
||||
sqlValue = string.Format("select cast({1} as bigint) as SpeciesNo from {0} where {1} like '{2}{3}' order by {1}", tableName, parentKey, parentValue,maxdivision);
|
||||
sqlValue = string.Format("select cast(right({1},{4}) as bigint) as SpeciesNo from {0} where {1} like '{2}{3}' order by SpeciesNo", tableName, parentKey, parentValue,maxdivision, firstNode.Length);
|
||||
DataTable table = GetDataTableResult(sqlValue);
|
||||
|
||||
Int64 speciesNo = table.Rows.Count > 0 ? Convert.ToInt64(table.Rows[0]["SpeciesNo"] + "") : 0;
|
||||
if (speciesNo != Int64.Parse(parentValue + PrefixNum+"1"))
|
||||
if (speciesNo != 1)
|
||||
return parentValue +PrefixNum+"1";;
|
||||
|
||||
foreach (DataRow item in table.Rows)
|
||||
@@ -101,8 +104,7 @@ namespace Lskj.Business.Impl
|
||||
|
||||
if (rowSpeciesNo != speciesNo + 1)
|
||||
{
|
||||
maxNo = (speciesNo + 1).ToString();
|
||||
maxNo = maxNo.PadLeft(parentValue.Length + firstNode.Length, '0');
|
||||
maxNo = parentValue + (speciesNo + 1).ToString().PadLeft(firstNode.Length, '0');
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user