diff --git a/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs index 586b46cb..8d1981a9 100644 --- a/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs +++ b/ds-wms-service/DS.WMS.Core/Info/Entity/InfoClient.cs @@ -457,7 +457,7 @@ public class InfoClient : SharedOrgModel /// /// 进账人民币账户ID /// - [SugarColumn(ColumnDescription = "人民币账户ID")] + [SugarColumn(ColumnDescription = "人民币账户ID", IsNullable = true)] public long? RMBAccountId { get; set; } /// @@ -473,7 +473,7 @@ public class InfoClient : SharedOrgModel /// /// 进账美金账户ID /// - [SugarColumn(ColumnDescription = "美金账户ID")] + [SugarColumn(ColumnDescription = "美金账户ID", IsNullable = true)] public long? USDAccountId { get; set; } /// /// 进账美金银行名称 diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs index 242d2d7d..11a4acd9 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs @@ -2460,7 +2460,7 @@ public class CommonService : ICommonService case "number": //计数,流水号 var prefix = sequenceNewNo;//前缀 businessSeq = await tenantDb.Queryable().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(); //更新当前序号, @@ -2501,7 +2501,7 @@ public class CommonService : ICommonService sequence.CurrentCode = sequenceNewNo; sequence.CurrentReset = DateTime.Now.ToString("yyyyMMdd"); 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(); @@ -2674,7 +2674,7 @@ public class CommonService : ICommonService /// /// /// - 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; @@ -2687,20 +2687,20 @@ public class CommonService : ICommonService newNo = 1; // Log4NetHelper.Error(ex.Message, ex); } - + var DataVar = date.HasValue ? date.Value : DateTime.Now; switch (seq.SequenceReset) { 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; } break; 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; } @@ -2712,9 +2712,9 @@ public class CommonService : ICommonService break; 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; }