added some validation rules for 7.1

This commit is contained in:
Daniel Schick 2022-10-05 09:05:50 +02:00
parent 51efad579d
commit e3c09c6160
5 changed files with 9 additions and 8 deletions

View File

@ -649,7 +649,7 @@ namespace ENI2
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = ""; aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATA"); aMessage.StatusInfo = string.Format("Validation error 142: NOA_NOD must be sent before ATA");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
} }
} }
@ -660,7 +660,7 @@ namespace ENI2
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = ""; aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: NOA_NOD must be sent before ATD"); aMessage.StatusInfo = string.Format("Validation error 142: NOA_NOD must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
} }
@ -668,7 +668,7 @@ namespace ENI2
{ {
aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED; aMessage.InternalStatus = Message.BSMDStatus.SUSPENDED;
aMessage.ChangedBy = ""; aMessage.ChangedBy = "";
aMessage.StatusInfo = string.Format("Validation error: ATA must be sent before ATD"); aMessage.StatusInfo = string.Format("Validation error 143: ATA must be sent before ATD");
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage); DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(aMessage);
} }
} }

View File

@ -270,8 +270,8 @@ namespace bsmd.database
// NSW 7.1 ETDFromLastPort Pflichtfeld, wenn LastPort != ZZUKN // NSW 7.1 ETDFromLastPort Pflichtfeld, wenn LastPort != ZZUKN
if(!this.LastPort.IsNullOrEmpty() && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue) if(!this.LastPort.IsNullOrEmpty() && !this.LastPort.Equals("ZZUKN") && !this.ETDFromLastPort.HasValue)
{ {
errors.Add(RuleEngine.CreateError(ValidationCode.E125, "ETDFromLastPort missing", "", this.Title, null, this.Tablename)); errors.Add(RuleEngine.CreateError(ValidationCode.E125, "ETDFromLastPort must be provided for a given last port", "", this.Title, null, this.Tablename));
} }
if((this.ETDFromLastPort < DateTime.Now.AddDays(-14)) || (this.ETDFromLastPort.HasValue && this.ETDFromLastPort.Value.ToLocalTime().IsTimeEmpty())) if((this.ETDFromLastPort < DateTime.Now.AddDays(-14)) || (this.ETDFromLastPort.HasValue && this.ETDFromLastPort.Value.ToLocalTime().IsTimeEmpty()))
{ {
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check ETDFromLastPort: might be implausible", this.ETDFromLastPort.Value.ToLocalTime().ToString(), this.Title, null, this.Tablename)); violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Check ETDFromLastPort: might be implausible", this.ETDFromLastPort.Value.ToLocalTime().ToString(), this.Title, null, this.Tablename));

View File

@ -58,6 +58,7 @@ namespace bsmd.database
E123 = 123, E123 = 123,
E124 = 124, E124 = 124,
E125 = 125, E125 = 125,
E222 = 222,
V201 = 201, V201 = 201,
V202, V202,
V203, V203,
@ -82,7 +83,7 @@ namespace bsmd.database
V782 = 782, V782 = 782,
V783 = 783, V783 = 783,
V784 = 784, V784 = 784,
V786 = 786, V786 = 786, // not used any more (7.1)
V801 = 801, V801 = 801,
V802 = 802, V802 = 802,
V803 = 803, V803 = 803,

View File

@ -107,7 +107,7 @@ namespace bsmd.database
public bool? WasteDisposalValidExemption { get; set; } public bool? WasteDisposalValidExemption { get; set; }
[ShowReport] [ShowReport]
[Validation2(ValidationCode.LOCODE_SSN)] [Validation2(ValidationCode.LOCODE_SSN)]
[MaxLength(5)] [MaxLength(5)]
[ENI2Validation] [ENI2Validation]
public string LastWasteDisposalPort { get; set; } public string LastWasteDisposalPort { get; set; }

View File

@ -351,7 +351,7 @@ namespace bsmd.database
string missingType = ""; string missingType = "";
foreach (string wasteCodeString in WAS.WasteCodes) foreach (string wasteCodeString in WAS.WasteCodes)
{ {
bool codeFound = false; bool codeFound = false;
foreach (WasteReceived wr in this.WasteReceived) foreach (WasteReceived wr in this.WasteReceived)
{ {