Korrektren für Maersk Dateiname, WAS Reihenfolge und Verbesseung der SFT Logausgaben

This commit is contained in:
Daniel Schick 2023-01-07 12:51:06 +01:00
parent 3dac392452
commit 8cca412079
3 changed files with 20 additions and 16 deletions

View File

@ -9,6 +9,7 @@
using log4net; using log4net;
using System.Diagnostics; using System.Diagnostics;
using bsmd.database;
namespace bsmd.dakosy namespace bsmd.dakosy
{ {
@ -55,6 +56,7 @@ namespace bsmd.dakosy
string output = winscp.StandardOutput.ReadToEnd(); string output = winscp.StandardOutput.ReadToEnd();
_log.Debug(output); _log.Debug(output);
output = winscp.StandardError.ReadToEnd(); output = winscp.StandardError.ReadToEnd();
if (!output.Trim().IsNullOrEmpty())
_log.Warn(output); _log.Warn(output);
// Wait until WinSCP finishes // Wait until WinSCP finishes
@ -128,6 +130,7 @@ namespace bsmd.dakosy
string output = winscp.StandardOutput.ReadToEnd(); string output = winscp.StandardOutput.ReadToEnd();
_log.Debug(output); _log.Debug(output);
output = winscp.StandardError.ReadToEnd(); output = winscp.StandardError.ReadToEnd();
if(!output.Trim().IsNullOrEmpty())
_log.Warn(output); _log.Warn(output);
// Wait until WinSCP finishes // Wait until WinSCP finishes
@ -167,6 +170,7 @@ namespace bsmd.dakosy
string output = winscp.StandardOutput.ReadToEnd(); string output = winscp.StandardOutput.ReadToEnd();
_log.Debug(output); _log.Debug(output);
output = winscp.StandardError.ReadToEnd(); output = winscp.StandardError.ReadToEnd();
if (!output.Trim().IsNullOrEmpty())
_log.Warn(output); _log.Warn(output);
// Wait until WinSCP finishes // Wait until WinSCP finishes

View File

@ -301,12 +301,12 @@ namespace bsmd.dbh
rootSEC.KielCanalPassage.KielCanalPassagePlanned = "Y"; rootSEC.KielCanalPassage.KielCanalPassagePlanned = "Y";
if (sec.KielCanalPassagePlannedIncomming.HasValue) if (sec.KielCanalPassagePlannedIncomming.HasValue)
{ {
rootSEC.KielCanalPassage.KielCanalPassagePlannedIncoming = sec.KielCanalPassagePlannedIncomming.Value; rootSEC.KielCanalPassage.KielCanalPassagePlannedIncoming = sec.KielCanalPassagePlannedIncomming.Value.ToUTCSerializableDateTime();
rootSEC.KielCanalPassage.KielCanalPassagePlannedIncomingSpecified = true; rootSEC.KielCanalPassage.KielCanalPassagePlannedIncomingSpecified = true;
} }
if (sec.KielCanalPassagePlannedOutgoing.HasValue) if (sec.KielCanalPassagePlannedOutgoing.HasValue)
{ {
rootSEC.KielCanalPassage.KielCanalPassagePlannedOutgoing = sec.KielCanalPassagePlannedOutgoing.Value; rootSEC.KielCanalPassage.KielCanalPassagePlannedOutgoing = sec.KielCanalPassagePlannedOutgoing.Value.ToUTCSerializableDateTime();
rootSEC.KielCanalPassage.KielCanalPassagePlannedOutgoingSpecified = true; rootSEC.KielCanalPassage.KielCanalPassagePlannedOutgoingSpecified = true;
} }
} }
@ -966,8 +966,8 @@ namespace bsmd.dbh
List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>(); List<ItemsChoiceType3> choiceType3s = new List<ItemsChoiceType3>();
List<object> wasteItems = new List<object>(); List<object> wasteItems = new List<object>();
choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency); choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N"); wasteItems.Add(was.LastWasteDisposalPort);
if (was.LastWasteDisposalDate.HasValue) if (was.LastWasteDisposalDate.HasValue)
{ {
@ -975,12 +975,6 @@ namespace bsmd.dbh
wasteItems.Add(was.LastWasteDisposalDate); wasteItems.Add(was.LastWasteDisposalDate);
} }
choiceType3s.Add(ItemsChoiceType3.LastWasteDisposalPort);
wasteItems.Add(was.LastWasteDisposalPort);
choiceType3s.Add(ItemsChoiceType3.NextWasteDisposalPort);
wasteItems.Add(was.NextWasteDisposalPort);
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++) for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
{ {
if ((was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName.Trim().IsNullOrEmpty()) continue; if ((was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName.Trim().IsNullOrEmpty()) continue;
@ -988,6 +982,9 @@ namespace bsmd.dbh
wasteItems.Add((was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName); wasteItems.Add((was.WasteDisposalServiceProvider[i]).WasteDisposalServiceProviderName);
} }
choiceType3s.Add(ItemsChoiceType3.NextWasteDisposalPort);
wasteItems.Add(was.NextWasteDisposalPort);
for (int j = 0; j < was.Waste.Count; j++) for (int j = 0; j < was.Waste.Count; j++)
{ {
choiceType3s.Add(ItemsChoiceType3.WasteItem); choiceType3s.Add(ItemsChoiceType3.WasteItem);
@ -1007,6 +1004,9 @@ namespace bsmd.dbh
wasteItems.Add(rww); wasteItems.Add(rww);
} }
choiceType3s.Add(ItemsChoiceType3.ConfirmationOfCorrectnessAndSufficiency);
wasteItems.Add(was.ConfirmationOfCorrectness ?? false ? "Y" : "N");
rootWAS.ItemsElementName = choiceType3s.ToArray(); rootWAS.ItemsElementName = choiceType3s.ToArray();
rootWAS.Items = wasteItems.ToArray(); rootWAS.Items = wasteItems.ToArray();
} }
@ -1689,7 +1689,7 @@ namespace bsmd.dbh
// serialize output structure to file // serialize output structure to file
string filename = string.Format("NSW.DBH.BSMD.{0}.xml", message.FileSequenceNumber); string filename = string.Format("NSW.DBH.BSMD.{0}.xml", message.FileSequenceNumber);
_log.InfoFormat("saving {0} to output directory", filename); _log.InfoFormat("{0}: saving {1} to output directory", message.MessageNotificationClassDisplay, filename);
string filePath = Path.Combine(Path.GetTempPath(), filename); string filePath = Path.Combine(Path.GetTempPath(), filename);
XmlSerializer serializer = new XmlSerializer(typeof(Root)); XmlSerializer serializer = new XmlSerializer(typeof(Root));

View File

@ -17,7 +17,7 @@ namespace bsmd.dbh
internal static class ResponseUtil internal static class ResponseUtil
{ {
private static readonly ILog _log = LogManager.GetLogger(typeof(ResponseUtil)); private static readonly ILog _log = LogManager.GetLogger(typeof(ResponseUtil));
private static readonly Regex _regexFilename = new Regex(@".*NSW\.DBH\.BSMD\.(.*)\.xml"); private static readonly Regex _regexFilename = new Regex(@".*NSW\.DBH\.BSMD(MAERSK)?\.(.*)\.xml");
internal static bool Read(string inputFile) internal static bool Read(string inputFile)
{ {
@ -30,7 +30,7 @@ namespace bsmd.dbh
Match m = _regexFilename.Match(inputFile); Match m = _regexFilename.Match(inputFile);
if(!m.Success) { if(!m.Success) {
_log.WarnFormat("returned file doesn't follow naming convention NSW.DBH.BSMD.*:{0}", inputFile); _log.WarnFormat("returned file doesn't follow naming convention NSW.DBH.BSMD(MAERSK)?.*:{0}", inputFile);
return result; return result;
} }