GassnerScale: Hot fix record parsing

This commit is contained in:
2024-07-22 09:48:18 +02:00
parent 5c31ad8851
commit 4c75dbe4aa

View File

@ -60,14 +60,13 @@ namespace Elwig.Helpers.Weighing {
throw new IOException("Invalid response from scale: Received record has invalid size"); throw new IOException("Invalid response from scale: Received record has invalid size");
var line = record[2..]; var line = record[2..];
var status = line[ 0.. 2]; var brutto = line[ 0.. 7].Trim();
var brutto = line[ 2.. 9].Trim(); var tara = line[ 7..14].Trim();
var tara = line[ 9..16].Trim(); var netto = line[14..21].Trim();
var netto = line[16..23].Trim(); var scaleNr = line[21..23].Trim();
var scaleNr = line[23..25].Trim(); var identNr = line[23..29].Trim();
var identNr = line[25..31].Trim(); var date = line[29..37];
var date = line[31..39]; var time = line[37..43];
var time = line[39..45];
identNr = identNr.Length > 0 && identNr != "0" ? identNr : null; identNr = identNr.Length > 0 && identNr != "0" ? identNr : null;
var parsedDate = DateOnly.ParseExact(date, "yyyyMMdd"); var parsedDate = DateOnly.ParseExact(date, "yyyyMMdd");