Fix无损检测委托号前缀并统一录入明细显示
This commit is contained in:
@@ -434,7 +434,7 @@ namespace BLL
|
||||
Model.HJGL_Batch_BatchTrust newBatchTrust = new Model.HJGL_Batch_BatchTrust
|
||||
{
|
||||
TrustBatchId = trustBatchId,
|
||||
TrustBatchCode = batch.PointBatchCode.Replace("-DK-", "-WT-"),
|
||||
TrustBatchCode = BLL.Batch_BatchTrustService.BuildTrustBatchCode(batch.PointBatchCode, DateTime.Now),
|
||||
TrustDate = DateTime.Now,
|
||||
ProjectId = batch.ProjectId,
|
||||
PointBatchId = pointBatchId,
|
||||
@@ -534,7 +534,7 @@ namespace BLL
|
||||
var rate = BLL.Base_DetectionRateService.GetDetectionRateByDetectionRateId(trust.DetectionRateId);
|
||||
|
||||
string perfix = string.Empty;
|
||||
perfix = unit.UnitCode + "-" + ndt.DetectionTypeCode + "-" + rate.DetectionRateValue.ToString() + "%-";
|
||||
perfix = BLL.Batch_BatchTrustService.BuildTrustBatchCodePrefix(unit.UnitCode, ndt.DetectionTypeCode, rate.DetectionRateValue.ToString(), DateTime.Now);
|
||||
string trustBatchId = SQLHelper.GetNewID(typeof(Model.HJGL_Batch_BatchTrust));
|
||||
|
||||
// 生成委托条件对比
|
||||
|
||||
@@ -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