Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce UTILMDG and UTILMDS for FV2310 #112

Merged
merged 10 commits into from
Jul 28, 2023
9 changes: 7 additions & 2 deletions EDILibrary/EDIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
return null;
}

edi = RemoveBOM(edi); // todo: check why RemoveBOM is still used and RemoveByteOrderMark does not work

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (6.0.201)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (7.0.100)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (6.0.201)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (7.0.100)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / coverage

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / coverage

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / build

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 251 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / build

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'
var specialChars = GetSpecialChars(edi);
var message = GetActualMessage(edi, specialChars);
if (specialChars.EscapeChar != DefaultEscapeChar)
Expand Down Expand Up @@ -286,7 +286,7 @@

try
{
edi = RemoveBOM(edi); // todo: check why RemoveBOM is still used and RemoveByteOrderMark does not work

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (6.0.201)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (7.0.100)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (6.0.201)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / unittest (7.0.100)

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / coverage

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / coverage

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / build

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'

Check warning on line 289 in EDILibrary/EDIHelper.cs

View workflow job for this annotation

GitHub Actions / build

'EDIHelper.RemoveBOM(string)' is obsolete: 'Use 'RemoveByteOrderMark' instead'
var specialChars = GetSpecialChars(edi);
var message = GetActualMessage(edi, specialChars);
var segments = message.LowMemSplit(specialChars.SegmentDelimiter).Take(2).ToArray();
Expand Down Expand Up @@ -317,13 +317,18 @@
unbParts[3].Split(specialChars.ElementDelimiter.ToCharArray()).Length > 1 ? unbParts[3].Split(specialChars.ElementDelimiter.ToCharArray())[1] : "500",
ID = unbParts[3].Split(specialChars.ElementDelimiter.ToCharArray())[0]
};
var version = unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[4];
var format = Enum.Parse<EdifactFormat>(unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[0]);
if (format == EdifactFormat.UTILMD){
format = version.StartsWith("G") ? EdifactFormat.UTILMDG: version.StartsWith("S") ? EdifactFormat.UTILMDS : format;
}
var file = new EDIFileInfo
{
Empfänger = receiver,
Sender = sender,
ID = unbParts[5].Split(specialChars.ElementDelimiter.ToCharArray())[0],
Format = Enum.Parse<EdifactFormat>(unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[0]),
Version = unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[4],
Format = format,
Version = version,
Freigabenummer = unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[2],
Nachrichtenversion = unhParts[2].Split(specialChars.ElementDelimiter.ToCharArray())[1]
};
Expand Down
25 changes: 23 additions & 2 deletions EDILibrary/EdifactFormatVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ public enum EdifactFormat
/// </summary>
UTILMD = 11,

/// <summary>
/// master data gas
/// </summary>
UTILMDG = 44,

/// <summary>
/// master data electricity/ strom
/// </summary>
UTILMDS = 55,

/// <summary>
/// Netznutzungszeiten-Nachricht
/// </summary>
Expand Down Expand Up @@ -175,7 +185,7 @@ public enum EdifactFormatVersion
/// </summary>
FV2304,
/// <summary>
/// Format Version October 2023 (ako MaKo2023)
/// Format Version October 2023 (aka MaKo2023)
/// </summary>
FV2310
}
Expand Down Expand Up @@ -335,7 +345,7 @@ public class EdifactFormatVersionHelper : IEdifactFormatVersionProvider
/// <summary>
/// validity date of <see cref="EdifactFormatVersion.FV2310"/>
/// </summary>
private static readonly DateTime KeyDate2310 = new(2023, 09, 30, 22, 0, 0, DateTimeKind.Utc);
private static readonly DateTime KeyDate2310 = new(2023, 09, 30, 23, 0, 0, DateTimeKind.Utc);
hf-fvesely marked this conversation as resolved.
Show resolved Hide resolved


public EdifactFormatVersion GetFormatVersion(DateTimeOffset keydate)
Expand Down Expand Up @@ -406,6 +416,16 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
"5.2c" => EdifactFormatVersion.FV2110,
_ => GetCurrent()
},
EdifactFormat.UTILMDG => version switch
{
"G1.0a" => EdifactFormatVersion.FV2310,
_ => GetCurrent()
},
EdifactFormat.UTILMDS => version switch
{
"S1.1" => EdifactFormatVersion.FV2310,
_ => GetCurrent()
},
EdifactFormat.MSCONS => version switch
{
"2.4a" => EdifactFormatVersion.FV2210,
Expand Down Expand Up @@ -511,3 +531,4 @@ public EdifactFormatVersion GetFormatVersion(EdifactFormat format, string versio
}
}
}

Loading