Fix无损检测委托号前缀并统一录入明细显示
This commit is contained in:
@@ -7,6 +7,47 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static class Batch_BatchTrustService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据点口批编号生成委托单号,在流水号前追加日期段。
|
||||
/// </summary>
|
||||
public static string BuildTrustBatchCode(string pointBatchCode, System.DateTime trustDate)
|
||||
{
|
||||
string trustBatchCode = (pointBatchCode ?? string.Empty).Replace("-DK-", "-WT-");
|
||||
return InsertDateBeforeSerial(trustBatchCode, trustDate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成委托单号前缀,在流水号前追加日期段。
|
||||
/// </summary>
|
||||
public static string BuildTrustBatchCodePrefix(string unitCode, string detectionTypeCode, string detectionRateValue, System.DateTime trustDate)
|
||||
{
|
||||
return unitCode + "-" + detectionTypeCode + "-" + detectionRateValue + "%-" + trustDate.ToString("yyyyMMdd") + "-";
|
||||
}
|
||||
|
||||
private static string InsertDateBeforeSerial(string code, System.DateTime date)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code))
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
string dateText = date.ToString("yyyyMMdd");
|
||||
int lastIndex = code.LastIndexOf('-');
|
||||
if (lastIndex < 0)
|
||||
{
|
||||
return code + "-" + dateText;
|
||||
}
|
||||
|
||||
string prefix = code.Substring(0, lastIndex);
|
||||
string serial = code.Substring(lastIndex + 1);
|
||||
if (prefix.EndsWith("-" + dateText, System.StringComparison.Ordinal))
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
return prefix + "-" + dateText + "-" + serial;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取无损委托
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user