SVN r1189

SVN-Revision: r1189
This commit is contained in:
cyf
2026-06-01 01:42:40 +00:00
parent 29490ec187
commit 6245aa0768
6 changed files with 50 additions and 65 deletions
+2 -29
View File
@@ -72,7 +72,7 @@ namespace Lskj.Business.Impl
maxNum += "9";
}
string sqlValue = string.Format("select max(cast(SpeciesNo as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision);
string sqlValue = string.Format("select max(cast({1} as bigint))+1 from {0} where {1} like '{2}{3}'", tableName, parentKey, parentValue, maxdivision);
string maxNo = GetResult(sqlValue) + "";
if (string.IsNullOrWhiteSpace(maxNo))
@@ -87,31 +87,4 @@ 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);
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;
}
}
}
sqlValue = string.Format("select cast({1} as bigint) as SpeciesNo from {0} where {1} like '{2}{