编码规则重置更新

dev
cjy 3 weeks ago
parent 2987ead5e5
commit 15d104a434

@ -457,7 +457,7 @@ public class InfoClient : SharedOrgModel<long>
/// <summary> /// <summary>
/// 进账人民币账户ID /// 进账人民币账户ID
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "人民币账户ID")] [SugarColumn(ColumnDescription = "人民币账户ID", IsNullable = true)]
public long? RMBAccountId { get; set; } public long? RMBAccountId { get; set; }
/// <summary> /// <summary>
@ -473,7 +473,7 @@ public class InfoClient : SharedOrgModel<long>
/// <summary> /// <summary>
/// 进账美金账户ID /// 进账美金账户ID
/// </summary> /// </summary>
[SugarColumn(ColumnDescription = "美金账户ID")] [SugarColumn(ColumnDescription = "美金账户ID", IsNullable = true)]
public long? USDAccountId { get; set; } public long? USDAccountId { get; set; }
/// <summary> /// <summary>
/// 进账美金银行名称 /// 进账美金银行名称

@ -2460,7 +2460,7 @@ public class CommonService : ICommonService
case "number": //计数,流水号 case "number": //计数,流水号
var prefix = sequenceNewNo;//前缀 var prefix = sequenceNewNo;//前缀
businessSeq = await tenantDb.Queryable<BusinessSequence>().Where(x => x.SequenceId == sequence.Id && x.Prefix == prefix).FirstAsync(); businessSeq = await tenantDb.Queryable<BusinessSequence>().Where(x => x.SequenceId == sequence.Id && x.Prefix == prefix).FirstAsync();
int num = CurrentReset(sequence, item, businessSeq, tenantDb); int num = CurrentReset(sequence, item, businessSeq, tenantDb,date);
//计数拼接 //计数拼接
sequenceNewNo += NumberingSeqRule(item, num).ToString(); sequenceNewNo += NumberingSeqRule(item, num).ToString();
//更新当前序号, //更新当前序号,
@ -2501,7 +2501,7 @@ public class CommonService : ICommonService
sequence.CurrentCode = sequenceNewNo; sequence.CurrentCode = sequenceNewNo;
sequence.CurrentReset = DateTime.Now.ToString("yyyyMMdd"); sequence.CurrentReset = DateTime.Now.ToString("yyyyMMdd");
businessSeq.CurrentCode = sequenceNewNo; businessSeq.CurrentCode = sequenceNewNo;
businessSeq.CurrentReset = DateTime.Now.ToString("yyyyMMdd"); businessSeq.CurrentReset = date.HasValue ? date.Value.ToString("yyyyMMdd") : DateTime.Now.ToString("yyyyMMdd");
await db.Updateable(sequence).ExecuteCommandAsync(); await db.Updateable(sequence).ExecuteCommandAsync();
@ -2674,7 +2674,7 @@ public class CommonService : ICommonService
/// <param name="seq"></param> /// <param name="seq"></param>
/// <param name="seqRule"></param> /// <param name="seqRule"></param>
/// <returns></returns> /// <returns></returns>
private static int CurrentReset(SysSequence seq, SysSequenceRule seqRule, BusinessSequence businessSeq, SqlSugarScopeProvider tenantDb) private static int CurrentReset(SysSequence seq, SysSequenceRule seqRule, BusinessSequence businessSeq, SqlSugarScopeProvider tenantDb, DateTime? date = null)
{ {
int newNo = 0, ruleNo = 0; int newNo = 0, ruleNo = 0;
@ -2687,20 +2687,20 @@ public class CommonService : ICommonService
newNo = 1; newNo = 1;
// Log4NetHelper.Error(ex.Message, ex); // Log4NetHelper.Error(ex.Message, ex);
} }
var DataVar = date.HasValue ? date.Value : DateTime.Now;
switch (seq.SequenceReset) switch (seq.SequenceReset)
{ {
case "D": //每天重置 case "D": //每天重置
if (!string.IsNullOrEmpty(seq.CurrentReset) && seq.CurrentReset != DateTime.Now.ToString("yyyyMMdd")) if (businessSeq.IsNotNull() && !string.IsNullOrEmpty(businessSeq.CurrentReset) && businessSeq.CurrentReset != DataVar.ToString("yyyyMMdd"))
{ {
newNo = 1; newNo = 1;
} }
break; break;
case "M": //每月重置 case "M": //每月重置
if (!string.IsNullOrWhiteSpace(seq.CurrentReset)) if (businessSeq.IsNotNull() && !string.IsNullOrWhiteSpace(businessSeq.CurrentReset))
{ {
if (!seq.CurrentReset.Contains(DateTime.Now.ToString("yyyyMM"))) if (!businessSeq.CurrentReset.Contains(DataVar.ToString("yyyyMM")))
{ {
newNo = ruleNo; newNo = ruleNo;
} }
@ -2712,9 +2712,9 @@ public class CommonService : ICommonService
break; break;
case "Y": //每年重置 case "Y": //每年重置
if (!string.IsNullOrWhiteSpace(seq.CurrentReset)) if (businessSeq.IsNotNull() && !string.IsNullOrWhiteSpace(businessSeq.CurrentReset))
{ {
if (!seq.CurrentReset.Contains(DateTime.Now.ToString("yyyy"))) if (!businessSeq.CurrentReset.Contains(DataVar.ToString("yyyy")))
{ {
newNo = ruleNo; newNo = ruleNo;
} }

Loading…
Cancel
Save