From 83db340099e05923992c103c9f229a1cda5098a6 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 22 Jun 2022 09:22:39 +0200 Subject: [PATCH] =?UTF-8?q?verhindere=20das=20Versenden=20von=20WAS=20Meld?= =?UTF-8?q?ungen=20mit=20alten=20WasteCodes.=20F=C3=BChrt=20auch=20bei=20O?= =?UTF-8?q?K=20in=20der=20ENI=20Anzeige=20zu=20einer=20roten=20Karte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsmd.database/Extensions.cs | 5 ++++- bsmd.database/WAS.cs | 2 ++ bsmd.hisnord/Request.cs | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bsmd.database/Extensions.cs b/bsmd.database/Extensions.cs index e1ba2a3a..c66e68a0 100644 --- a/bsmd.database/Extensions.cs +++ b/bsmd.database/Extensions.cs @@ -207,6 +207,9 @@ namespace bsmd.database } } } - + public static bool find(this T[] array, T target) + { + return array.Contains(target); + } } } diff --git a/bsmd.database/WAS.cs b/bsmd.database/WAS.cs index 202b1e89..2debf224 100644 --- a/bsmd.database/WAS.cs +++ b/bsmd.database/WAS.cs @@ -54,6 +54,8 @@ namespace bsmd.database "101", "102", "103", "104", "105", "999", "201", "202", "203", "204", "401", "501", "502", "503", "504", "505", "506", "507", "508", "509", "510", "511", "601", "602", "991" }; + public static int[] WasteCodesInt { get; } = { 101, 102, 103, 104, 105, 999, 201, 202, 203, 204, 401, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 601, 602, 991 }; + /// /// NSW 7.0 Waste descriptions /// diff --git a/bsmd.hisnord/Request.cs b/bsmd.hisnord/Request.cs index 8940b5a4..8f2a0974 100644 --- a/bsmd.hisnord/Request.cs +++ b/bsmd.hisnord/Request.cs @@ -1219,9 +1219,13 @@ namespace bsmd.hisnord { for (int i = 0; i < was.Waste.Count; i++) { - waste hn_waste = new waste(); Waste waste = was.Waste[i]; + if (!waste.WasteType.HasValue) continue; + if (!WAS.WasteCodesInt.find(waste.WasteType.Value)) continue; + + waste hn_waste = new waste(); + if (waste.WasteDisposalAmount_MTQ.HasValue) hn_waste.WasteDisposalAmount_MTQ = Math.Round((decimal)waste.WasteDisposalAmount_MTQ.Value, 3);