8.3.5: weitere Korrekturen und ganz kleine Schritte bei der Validierung
This commit is contained in:
parent
24f52940ba
commit
5c2892e1eb
@ -26,12 +26,12 @@
|
||||
<value>1000</value>
|
||||
</setting>
|
||||
<setting name="LockingServerAddress" serializeAs="String">
|
||||
<!--value>http://192.168.2.4/LockingService/LockingService.svc</value-->
|
||||
<value>http://heupferd/bsmd.LockingService/LockingService.svc</value>
|
||||
<value>http://192.168.2.4/LockingService/LockingService.svc</value>
|
||||
<!--value>http://heupferd/bsmd.LockingService/LockingService.svc</value-->
|
||||
</setting>
|
||||
<setting name="ConnectionString" serializeAs="String">
|
||||
<!--value>Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value-->
|
||||
<value>Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
|
||||
<value>Data Source=192.168.2.12;Initial Catalog=nsw;Uid=dfuser;Pwd=dfpasswd;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value>
|
||||
<!--value>Data Source=(localdb)\Projects;Initial Catalog=nsw;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False</value-->
|
||||
</setting>
|
||||
</ENI2.Properties.Settings>
|
||||
</applicationSettings>
|
||||
|
||||
@ -39,6 +39,11 @@ namespace ENI2
|
||||
|
||||
public static ServiceClient LockingServiceClient { get { return _lockingServiceClient; } }
|
||||
|
||||
public static void RestartLockingService()
|
||||
{
|
||||
_lockingServiceClient = new ServiceClient("BasicHttpBinding_IService", ENI2.Properties.Settings.Default.LockingServerAddress);
|
||||
}
|
||||
|
||||
public static SplashScreenWindow SplashScreen { get { return _splashScreenWindow; } }
|
||||
|
||||
public static Guid? UserId { get { return _userId; } set { _userId = value; } }
|
||||
@ -93,6 +98,7 @@ namespace ENI2
|
||||
{
|
||||
string errorMessage = string.Format("An unhandled exception occurred: {0}\r\n{1}", e.Exception.Message, e.Exception.StackTrace);
|
||||
MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
// TODO: Dieser Fehler muss irgendwohin gesendet / gespeichert werden
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ namespace ENI2
|
||||
|
||||
protected void RegisterDateTimePickerChange(Xceed.Wpf.Toolkit.DateTimePicker dateTimePicker, Message.NotificationClass notificationClass)
|
||||
{
|
||||
this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
|
||||
this._dpDateTimePicker.AddValueChanged(dateTimePicker, this.controlContentChanged);
|
||||
this._controlClassDict[dateTimePicker] = notificationClass;
|
||||
}
|
||||
|
||||
|
||||
@ -200,6 +200,9 @@ namespace ENI2
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
|
||||
Util.UIHelper.SetBusyState();
|
||||
|
||||
DetailBaseControl currentControl = this.detailView.Children[0] as DetailBaseControl;
|
||||
if (currentControl != null)
|
||||
{
|
||||
@ -222,7 +225,7 @@ namespace ENI2
|
||||
|
||||
private void SaveMessage(Message message)
|
||||
{
|
||||
if (message.IsDirty)
|
||||
if (message.IsDirty || message.IsNew)
|
||||
{
|
||||
if ((message.Status == Message.MessageStatus.ACCEPTED) &&
|
||||
((message.InternalStatus == Message.BSMDStatus.CONFIRMED) || (message.InternalStatus == Message.BSMDStatus.VIOLATION)))
|
||||
@ -234,7 +237,24 @@ namespace ENI2
|
||||
}
|
||||
message.ChangedBy = string.Format("{0} at {1}", userName, DateTime.Now);
|
||||
DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(message);
|
||||
message.SaveElements();
|
||||
if (message.MessageNotificationClass == Message.NotificationClass.CREW)
|
||||
{
|
||||
foreach(CREW crew in message.Elements)
|
||||
{
|
||||
if (crew.IsNew || crew.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(crew);
|
||||
}
|
||||
}
|
||||
else if (message.MessageNotificationClass == Message.NotificationClass.PAS)
|
||||
{
|
||||
foreach(PAS pas in message.Elements)
|
||||
{
|
||||
if(pas.IsNew || pas.IsDirty) DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).Save(pas);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message.SaveElements();
|
||||
}
|
||||
message.IsDirty = false;
|
||||
}
|
||||
}
|
||||
@ -245,7 +265,10 @@ namespace ENI2
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
foreach(Message message in this._messages)
|
||||
|
||||
Util.UIHelper.SetBusyState();
|
||||
|
||||
foreach (Message message in this._messages)
|
||||
{
|
||||
this.SaveMessage(message);
|
||||
}
|
||||
@ -323,6 +346,8 @@ namespace ENI2
|
||||
this._vViolations.Clear();
|
||||
// TODO: clear highlighting
|
||||
|
||||
Util.UIHelper.SetBusyState();
|
||||
|
||||
RuleEngine ruleEngine = new RuleEngine();
|
||||
foreach (Message aMessage in _messages)
|
||||
{
|
||||
|
||||
@ -214,7 +214,7 @@ namespace ENI2.DetailViewControls
|
||||
if(!this._pasMessage.Elements.Contains(epd.PAS))
|
||||
this._pasMessage.Elements.Add(epd.PAS);
|
||||
this.dataGridPassengerList.Items.Refresh();
|
||||
epd.PAS = new PAS();
|
||||
epd.PAS = new PAS();
|
||||
epd.PAS.MessageHeader = this._pasMessage;
|
||||
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
|
||||
this.SublistElementChanged(Message.NotificationClass.PAS);
|
||||
@ -223,7 +223,7 @@ namespace ENI2.DetailViewControls
|
||||
if (epd.ShowDialog() ?? false)
|
||||
{
|
||||
if(!this._pasMessage.Elements.Contains(epd.PAS))
|
||||
_pasMessage.Elements.Add(epd.PAS);
|
||||
_pasMessage.Elements.Add(epd.PAS);
|
||||
this.dataGridPassengerList.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.PAS);
|
||||
}
|
||||
@ -258,7 +258,7 @@ namespace ENI2.DetailViewControls
|
||||
if(!_pasMessage.Elements.Contains(epd.PAS))
|
||||
_pasMessage.Elements.Add(epd.PAS);
|
||||
this.dataGridPassengerList.Items.Refresh();
|
||||
epd.PAS = new PAS();
|
||||
epd.PAS = new PAS();
|
||||
epd.PAS.Identifier = PAS.GetNewIdentifier(_pasMessage.Elements);
|
||||
epd.PAS.MessageHeader = _pasMessage;
|
||||
this.SublistElementChanged(Message.NotificationClass.PAS);
|
||||
@ -268,6 +268,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
if (!_pasMessage.Elements.Contains(epd.PAS))
|
||||
_pasMessage.Elements.Add(epd.PAS);
|
||||
epd.PAS.IsDirty = true;
|
||||
this.dataGridPassengerList.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.PAS);
|
||||
}
|
||||
@ -349,6 +350,7 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
if (!_crewMessage.Elements.Contains(ecd.CREW))
|
||||
_crewMessage.Elements.Add(ecd.CREW);
|
||||
ecd.CREW.IsDirty = true;
|
||||
this.dataGridCrewList.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.CREW);
|
||||
}
|
||||
@ -422,6 +424,7 @@ namespace ENI2.DetailViewControls
|
||||
if (!reader.IsDBNull(9)) crew.CrewMemberVisaNumber = this.getValueAsString(reader, 9);
|
||||
|
||||
crew.MessageHeader = this._crewMessage;
|
||||
crew.IsDirty = true;
|
||||
crew.Identifier = CREW.GetNewIdentifier(this._crewMessage.Elements);
|
||||
this._crewMessage.Elements.Add(crew);
|
||||
importCrew.Add(crew);
|
||||
@ -500,6 +503,7 @@ namespace ENI2.DetailViewControls
|
||||
if (!reader.IsDBNull(11)) pas.PassengerVisaNumber = this.getValueAsString(reader, 11);
|
||||
|
||||
pas.MessageHeader = this._pasMessage;
|
||||
pas.IsDirty = true;
|
||||
pas.Identifier = PAS.GetNewIdentifier(this._pasMessage.Elements);
|
||||
this._pasMessage.Elements.Add(pas);
|
||||
importPassenger.Add(pas);
|
||||
|
||||
@ -79,7 +79,7 @@ namespace ENI2.DetailViewControls
|
||||
this.comboBoxInitialHis.ItemsSource = Util.EnumHelper.GetAllValuesAndDescription(typeof(Message.NSWProvider));
|
||||
this.comboBoxInitialHis.DataContext = this.Core;
|
||||
|
||||
Binding vtBinding = new Binding();
|
||||
Binding vtBinding = new Binding();
|
||||
vtBinding.Source = this.Core;
|
||||
vtBinding.Path = this.Core.IsTransit ? new PropertyPath("TransitId") : new PropertyPath("VisitId");
|
||||
vtBinding.Mode = BindingMode.TwoWay;
|
||||
@ -352,8 +352,11 @@ namespace ENI2.DetailViewControls
|
||||
|
||||
public void ShowLockedBy(ReportingParty reportingParty)
|
||||
{
|
||||
this.stackPanelLock.Visibility = Visibility.Visible;
|
||||
this.textBlockLockUserName.Text = reportingParty.FirstName + " " + reportingParty.LastName;
|
||||
if (reportingParty != null)
|
||||
{
|
||||
this.stackPanelLock.Visibility = Visibility.Visible;
|
||||
this.textBlockLockUserName.Text = reportingParty.FirstName + " " + reportingParty.LastName;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
<Button Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2" Name="buttonAddMissingEntries" Content="{x:Static p:Resources.textAddMissingEntries}" Margin="2" Click="buttonAddMissingEntries_Click"/>
|
||||
</Grid>
|
||||
<enictrl:ENIDataGrid x:Name="dataGridWaste" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||
SelectionMode="Single" AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1">
|
||||
AutoGenerateColumns="False" Margin="0,5,0,0" Grid.Row="1">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="" Binding="{Binding Identifier}" IsReadOnly="True" />
|
||||
<DataGridTextColumn Header="{x:Static p:Resources.textCode}" Binding="{Binding WasteTypeDisplayGrid}" IsReadOnly="True" Width="0.2*" />
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
<MinimumRequiredVersion>3.5.1.0</MinimumRequiredVersion>
|
||||
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
|
||||
<WebPage>publish.html</WebPage>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>3.8.3.%2a</ApplicationVersion>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>3.8.5.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
|
||||
@ -11,6 +11,7 @@ using System.Windows.Media;
|
||||
|
||||
using bsmd.database;
|
||||
using System.Windows.Data;
|
||||
using log4net;
|
||||
|
||||
namespace ENI2
|
||||
{
|
||||
@ -19,9 +20,9 @@ namespace ENI2
|
||||
/// </summary>
|
||||
public partial class SucheControl : UserControl
|
||||
{
|
||||
|
||||
private List<MessageCore> anmeldungen = new List<MessageCore>();
|
||||
private object searchLock = new object();
|
||||
private ILog _log = LogManager.GetLogger("SucheControl");
|
||||
|
||||
#region Construction
|
||||
|
||||
@ -98,7 +99,26 @@ namespace ENI2
|
||||
if (App.UserId.HasValue)
|
||||
{
|
||||
// "locks" dazu abfragen
|
||||
LockingServiceReference.CoreLock[] coreLocks = App.LockingServiceClient.GetLocks();
|
||||
LockingServiceReference.CoreLock[] coreLocks = null;
|
||||
bool retry = false;
|
||||
RESTART:
|
||||
try
|
||||
{
|
||||
coreLocks = App.LockingServiceClient.GetLocks();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
// wenn das System lang lief ist der Service deallokiert? Wirft hier eine Exception. Ich würde an der Stelle den Client neu
|
||||
// erzeugen und nochmal probieren, danach darüber laufen lassen..
|
||||
if (!retry)
|
||||
{
|
||||
_log.ErrorFormat("LockingService:GetLocks(): {0}", ex.Message);
|
||||
_log.Info("trying to restart the locking service client");
|
||||
retry = true;
|
||||
App.RestartLockingService();
|
||||
goto RESTART;
|
||||
}
|
||||
}
|
||||
Dictionary<Guid, bool?> coreLockUpdateDict = new Dictionary<Guid, bool?>();
|
||||
for (int i = 0; i < coreLocks.Length; i++)
|
||||
{
|
||||
|
||||
@ -33,29 +33,29 @@ namespace ENI2.Util
|
||||
public static byte[] ShipSecurityLevels = { 1, 2, 3 };
|
||||
|
||||
public static Dictionary<int, string> Edifact8025 = new Dictionary<int, string> {
|
||||
{1, "Cargo operations" },
|
||||
{2, "Passenger movement" },
|
||||
{3, "Taking bunkers" },
|
||||
{4, "Changing crew" },
|
||||
{5, "Goodwill visit" },
|
||||
{6, "Taking supplies" },
|
||||
{7, "Repair" },
|
||||
{8, "Laid-up" },
|
||||
{9, "Awaiting orders" },
|
||||
{10, "Miscellaneous" },
|
||||
{11, "Crew movement" },
|
||||
{12, "Cruise, leisure and recreation" },
|
||||
{13, "Under government order" },
|
||||
{14, "Quarantine inspection" },
|
||||
{15, "Refuge" },
|
||||
{16, "Unloading cargo" },
|
||||
{17, "Loading cargo" },
|
||||
{18, "Repair in dry dock" },
|
||||
{19, "Repair in wet dock" },
|
||||
{20, "Cargo tank cleaning" },
|
||||
{21, "Means of transport customs clearance" },
|
||||
{22, "De-gassing" },
|
||||
{23, "Waste disposal" }
|
||||
{1, "1 Cargo operations" },
|
||||
{2, "2 Passenger movement" },
|
||||
{3, "3 Taking bunkers" },
|
||||
{4, "4 Changing crew" },
|
||||
{5, "5 Goodwill visit" },
|
||||
{6, "6 Taking supplies" },
|
||||
{7, "7 Repair" },
|
||||
{8, "8 Laid-up" },
|
||||
{9, "9 Awaiting orders" },
|
||||
{10, "10 Miscellaneous" },
|
||||
{11, "11 Crew movement" },
|
||||
{12, "12 Cruise, leisure and recreation" },
|
||||
{13, "13 Under government order" },
|
||||
{14, "14 Quarantine inspection" },
|
||||
{15, "15 Refuge" },
|
||||
{16, "16 Unloading cargo" },
|
||||
{17, "17 Loading cargo" },
|
||||
{18, "18 Repair in dry dock" },
|
||||
{19, "19 Repair in wet dock" },
|
||||
{20, "20 Cargo tank cleaning" },
|
||||
{21, "21 Means of transport customs clearance" },
|
||||
{22, "22 De-gassing" },
|
||||
{23, "23 Waste disposal" }
|
||||
};
|
||||
|
||||
public static string[] vesselClasses =
|
||||
|
||||
@ -25,7 +25,10 @@ namespace ENI2.Util
|
||||
{
|
||||
DateTime? sourceVal = (DateTime?) value;
|
||||
if (sourceVal.HasValue)
|
||||
{
|
||||
//if(sourceVal.Value.)
|
||||
return DateTime.SpecifyKind(sourceVal.Value, DateTimeKind.Utc).ToLocalTime();
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -143,6 +143,7 @@ namespace SendNSWMessageService
|
||||
if (!XtraSendLogic.ShouldSendMessage(message))
|
||||
{
|
||||
message.InternalStatus = Message.BSMDStatus.SUSPENDED;
|
||||
message.ChangedBy = ""; // zurücksetzen für Overview
|
||||
DBManager.Instance.Save(message);
|
||||
continue;
|
||||
}
|
||||
@ -266,7 +267,7 @@ namespace SendNSWMessageService
|
||||
}
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
|
||||
#region old logic
|
||||
/*
|
||||
if ((core.InitialHIS == Message.NSWProvider.DUDR) || (core.InitialHIS == Message.NSWProvider.DUDR_TEST))
|
||||
{
|
||||
@ -475,6 +476,7 @@ namespace SendNSWMessageService
|
||||
}
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ namespace bsmd.ReportGenerator
|
||||
List<string> attachments = new List<string>();
|
||||
attachments.Add(fullPath);
|
||||
|
||||
// BSMDMail.SendNSWReportWithAttachments(subject, attachments, rp.EMail);
|
||||
BSMDMail.SendNSWReportWithAttachments(subject, attachments, rp.UserEMail);
|
||||
|
||||
// remove
|
||||
if (Properties.Settings.Default.DeleteFileAfterSend)
|
||||
|
||||
@ -1107,11 +1107,17 @@ namespace bsmd.database
|
||||
reader.Close();
|
||||
|
||||
if (!core.ETA_NOA_NOD.HasValue && !core.IsTransit)
|
||||
core.ETA_NOA_NOD = core.ETA;
|
||||
{
|
||||
// die Zeit aus MessageCore ist nur ein Datum. Daher verwendet er 00:00 als lokale Zeit, was z.B. nach 01:00 MET zur Anzeige konvertiert wird.
|
||||
// Das darf in diesem Fall nicht sein, der Wert müsste also gefakt lokal gesetzt werden.. ouch hack
|
||||
core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETA.Value, DateTimeKind.Local).ToUniversalTime();
|
||||
}
|
||||
|
||||
if (!core.ETA_NOA_NOD.HasValue && core.IsTransit)
|
||||
core.ETA_NOA_NOD = core.ETAKielCanal;
|
||||
|
||||
{
|
||||
core.ETA_NOA_NOD = DateTime.SpecifyKind(core.ETAKielCanal.Value, DateTimeKind.Local).ToUniversalTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void LoadATA(MessageCore core)
|
||||
|
||||
@ -22,7 +22,7 @@ namespace bsmd.database
|
||||
{
|
||||
protected Guid? id;
|
||||
protected string tablename;
|
||||
private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved
|
||||
private Guid instance_id = Guid.NewGuid(); // Comparison id in case entity has not been saved
|
||||
|
||||
#region enum ValidationBlock
|
||||
|
||||
|
||||
@ -6,13 +6,14 @@ using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
|
||||
namespace bsmd.database
|
||||
{
|
||||
public class MessageCore : DatabaseEntity, IComparable, IEquatable<MessageCore>
|
||||
{
|
||||
|
||||
#region Fields
|
||||
#region (backing) Fields
|
||||
|
||||
private Guid? previous;
|
||||
private Guid? next;
|
||||
@ -21,6 +22,10 @@ namespace bsmd.database
|
||||
|
||||
private Guid? customerId;
|
||||
private int? wetris_zz_56_datensatz_id;
|
||||
private static ILog _log = LogManager.GetLogger("MessageCore");
|
||||
|
||||
private string _visitId;
|
||||
private string _transitId;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -87,11 +92,40 @@ namespace bsmd.database
|
||||
|
||||
[MaxLength(25)]
|
||||
[ENI2Validation]
|
||||
public string VisitId { get; set; }
|
||||
public string VisitId
|
||||
{
|
||||
get { return this._visitId; }
|
||||
set {
|
||||
if(value.IsNullOrEmpty() && !this._visitId.IsNullOrEmpty())
|
||||
{
|
||||
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
|
||||
_log.WarnFormat("Someones resetting the VISIT Id at {0}", st.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this._visitId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[MaxLength(25)]
|
||||
[ENI2Validation]
|
||||
public string TransitId { get; set; }
|
||||
public string TransitId
|
||||
{
|
||||
get { return this._transitId; }
|
||||
set
|
||||
{
|
||||
if (value.IsNullOrEmpty() && !this._transitId.IsNullOrEmpty())
|
||||
{
|
||||
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace();
|
||||
_log.WarnFormat("Someones resetting the TRANSIT Id at {0}", st.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this._transitId = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display Property für ENI-2
|
||||
@ -279,10 +313,8 @@ namespace bsmd.database
|
||||
{
|
||||
SqlCommand scmd = cmd as SqlCommand;
|
||||
|
||||
if (this.VisitId != null) scmd.Parameters.AddWithValue("@P1", this.VisitId);
|
||||
else scmd.Parameters.AddWithValue("@P1", DBNull.Value);
|
||||
if (this.TransitId != null) scmd.Parameters.AddWithValue("@P2", this.TransitId);
|
||||
else scmd.Parameters.AddWithValue("@P2", DBNull.Value);
|
||||
scmd.Parameters.AddWithNullableValue("@P1", this.VisitId);
|
||||
scmd.Parameters.AddWithNullableValue("@P2", this.TransitId);
|
||||
if (this.IMO != null) scmd.Parameters.AddWithValue("@P3", this.IMO);
|
||||
else scmd.Parameters.AddWithValue("@P3", DBNull.Value);
|
||||
if (this.ENI != null) scmd.Parameters.AddWithValue("@P4", this.ENI);
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
|
||||
[assembly: AssemblyCompany("schick Informatik")]
|
||||
[assembly: AssemblyProduct("BSMD NSW interface")]
|
||||
[assembly: AssemblyInformationalVersion("3.8.3")]
|
||||
[assembly: AssemblyInformationalVersion("3.8.5")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014-2017 schick Informatik")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.8.3.*")]
|
||||
[assembly: AssemblyVersion("3.8.5.*")]
|
||||
|
||||
|
||||
@ -58,6 +58,12 @@ namespace bsmd.database
|
||||
message = "";
|
||||
bool conditionResult = false;
|
||||
|
||||
// Aus der List an Messages muss (irgendwie :-) ein Dictionary aufgebaut werden, mit dem man aus den Namen der Fieldnames auf
|
||||
// den Wert bzw. die Liste an Werten (bei Listenklassen) kommt. Das ValidationField "weiß" schon ob es eine Listenklasse ist.
|
||||
|
||||
// das hier muss noch früher rein damit es nicht für jede Regel erneut erzeugt wird
|
||||
ValidationRule.PrepareNameLookupDict(core, messages);
|
||||
|
||||
try
|
||||
{
|
||||
// Bedingungen validieren
|
||||
@ -65,53 +71,17 @@ namespace bsmd.database
|
||||
foreach (ValidationCondition condition in cGroup.Conditions)
|
||||
{
|
||||
object[] otherargs = null;
|
||||
|
||||
// den aktuellen Wert bestimmen
|
||||
|
||||
if(!ValidationRule.ValidationFieldDict.ContainsKey(condition.FieldName))
|
||||
{
|
||||
// TODO: Warnung absetzen
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ValidationField vf = ValidationRule.ValidationFieldDict[condition.FieldName];
|
||||
|
||||
// Wert aus den Daten auslesen
|
||||
|
||||
// Dabei muss unterschieden werden: 1. skalarer Wert
|
||||
// 2. Wert eines Listenelements
|
||||
//
|
||||
|
||||
// als Rückgabe würde dann benötigt der Name des Property, die beteiligte Klasse und natürlich der Identifier (Index) wenn es eine Listenposition war
|
||||
|
||||
|
||||
//if(vf.)
|
||||
//object value = vf.PropertyInfo.GetValue()
|
||||
|
||||
|
||||
|
||||
switch(condition.ConditionOperator)
|
||||
{
|
||||
case ConditionOperatorEnum.EQUAL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NOT_EQUAL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.LESS:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.GREATER:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NULL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NOT_NULL:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ValidationField aFailedField = null;
|
||||
bool conditionValid = condition.Evaluate(core, messages, out aFailedField);
|
||||
|
||||
if (!conditionValid && aFailedField != null)
|
||||
failedFieldList.Add(aFailedField);
|
||||
|
||||
|
||||
string errorMessage = cGroup.ErrorMessage;
|
||||
@ -214,6 +184,54 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private bool Evaluate(MessageCore core, List<Message> messages, out ValidationField failedField)
|
||||
{
|
||||
bool result = false;
|
||||
failedField = null;
|
||||
|
||||
if(ValidationRule.ValidationFieldDict.ContainsKey(this.FieldName))
|
||||
{
|
||||
// den Wert aus der Nachrichtenklasse lesen
|
||||
ValidationField aValField = ValidationRule.ValidationFieldDict[this.FieldName];
|
||||
// object value = aValField.PropertyInfo.GetValue()
|
||||
|
||||
// check type and evaluate with operator (local prop)
|
||||
|
||||
switch (this.ConditionOperator)
|
||||
{
|
||||
case ConditionOperatorEnum.EQUAL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NOT_EQUAL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.LESS:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.GREATER:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NULL:
|
||||
|
||||
break;
|
||||
case ConditionOperatorEnum.NOT_NULL:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// if failed set failedField to aValField
|
||||
|
||||
// else set result to true
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#region hier ist das alte audius Zeugs
|
||||
|
||||
/// <summary>
|
||||
/// evaluate logical group operator
|
||||
/// </summary>
|
||||
@ -306,6 +324,8 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ICloneable implementation
|
||||
|
||||
public object Clone()
|
||||
@ -482,7 +502,6 @@ namespace bsmd.database
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region struct KeyValuePairS
|
||||
|
||||
[Serializable]
|
||||
|
||||
@ -14,6 +14,7 @@ namespace bsmd.database
|
||||
{
|
||||
private static List<ValidationField> _validationFields = null;
|
||||
private static Dictionary<string, ValidationField> _validationFieldDict = null;
|
||||
private static Dictionary<string, object> _lookupDict = null;
|
||||
|
||||
public ValidationRule()
|
||||
{
|
||||
@ -141,6 +142,40 @@ namespace bsmd.database
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static methods
|
||||
|
||||
public static object GetValueFromData(ValidationField field, Dictionary<string,Message> dataDict)
|
||||
{
|
||||
|
||||
// hier könnte auch ein List<object> rauskommen bzw. ein Dict<Identifier,object> mit Werten..
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void PrepareNameLookupDict(MessageCore core, List<Message> messages)
|
||||
{
|
||||
if(_lookupDict == null) _lookupDict = new Dictionary<string, object>();
|
||||
_lookupDict.Clear();
|
||||
foreach(Message message in messages)
|
||||
{
|
||||
|
||||
// Das kann nicht richtig funktionieren da ich hier eigentlich AGNT und nicht Message mappen will :-(
|
||||
|
||||
_lookupDict[message.MessageNotificationClassDisplay] = message;
|
||||
|
||||
Type t = message.GetType();
|
||||
foreach(Type intfType in t.GetInterfaces())
|
||||
{
|
||||
if(intfType == typeof(ISublistContainer))
|
||||
System.Diagnostics.Trace.WriteLine("ISublistContainer: " + message.MessageNotificationClassDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region overrides
|
||||
|
||||
@ -57,7 +57,7 @@ namespace bsmd.database
|
||||
HAZ haz = message.Elements[0] as HAZ;
|
||||
if (haz != null)
|
||||
{
|
||||
if (haz.NoDPGOnBoardOnArrival ?? false)
|
||||
if (!haz.HasPositions) // 15.11.17: "Im Grunde müsste nicht das Feld NoDPG der Auslöser für Suspend sein, sondern wenn keine Position in einer der Tabellen enthalten ist."
|
||||
{
|
||||
message.StatusInfo = "Meldeklasse nicht versandt: Kein Gefahrgut deklariert";
|
||||
return false;
|
||||
|
||||
@ -109,7 +109,7 @@ namespace bsmd.dbh
|
||||
{
|
||||
if (message == null) return false;
|
||||
|
||||
RootType rootType = RootType.DATA;
|
||||
RootType rootType = message.Reset ? RootType.RESET : RootType.DATA;
|
||||
|
||||
if (message.ReportingParty == null)
|
||||
{
|
||||
@ -165,7 +165,7 @@ namespace bsmd.dbh
|
||||
DBHWebReference.RootVisit rootVisit = new DBHWebReference.RootVisit();
|
||||
rootType = DBHWebReference.RootType.VISIT;
|
||||
|
||||
if (message.MessageCore.IMO != null)
|
||||
if (!message.MessageCore.IMO.IsNullOrEmpty())
|
||||
{
|
||||
rootVisit.ItemElementName = DBHWebReference.ItemChoiceType.IMONumber;
|
||||
rootVisit.Item = message.MessageCore.IMO;
|
||||
@ -195,7 +195,7 @@ namespace bsmd.dbh
|
||||
rootType = DBHWebReference.RootType.TRANSIT;
|
||||
itemChoiceType2 = DBHWebReference.ItemChoiceType2.Transit;
|
||||
|
||||
if (message.MessageCore.IMO != null)
|
||||
if (!message.MessageCore.IMO.IsNullOrEmpty())
|
||||
{
|
||||
rootTransit.ItemElementName = DBHWebReference.ItemChoiceType1.IMONumber;
|
||||
rootTransit.Item = message.MessageCore.IMO;
|
||||
|
||||
@ -82,7 +82,8 @@ namespace bsmd.dbh
|
||||
{
|
||||
case dbh.response.RootType.VISIT:
|
||||
// neue VISIT - ID
|
||||
aMessage.MessageCore.VisitId = VisitId;
|
||||
if(!VisitId.IsNullOrEmpty())
|
||||
aMessage.MessageCore.VisitId = VisitId;
|
||||
aMessage.MessageCore.BSMDStatusInternal = MessageCore.BSMDStatus.PREPARE;
|
||||
aMessage.SendSuccess = true;
|
||||
DBManager.Instance.Save(aMessage.MessageCore);
|
||||
|
||||
@ -824,7 +824,7 @@ namespace bsmd.hisnord
|
||||
}
|
||||
|
||||
if (sec.CurrentShipSecurityLevel.HasValue)
|
||||
_sec.CurrentShipSecurityLevel = (posint13type)sec.CurrentShipSecurityLevel.Value;
|
||||
_sec.CurrentShipSecurityLevel = (posint13type) (sec.CurrentShipSecurityLevel.Value - 1);
|
||||
|
||||
List<object> secItems = new List<object>();
|
||||
List<ItemsChoiceType4> secItemNames = new List<ItemsChoiceType4>();
|
||||
@ -1175,6 +1175,7 @@ namespace bsmd.hisnord
|
||||
was_items.Add(was.LastWasteDisposalDate.Value);
|
||||
was_item_names.Add(ItemsChoiceType6.LastWasteDisposalDate);
|
||||
}
|
||||
|
||||
for (int i = 0; i < was.WasteDisposalServiceProvider.Count; i++)
|
||||
{
|
||||
if (!was.WasteDisposalServiceProvider[i].WasteDisposalServiceProviderName.IsNullOrEmpty())
|
||||
@ -1183,6 +1184,7 @@ namespace bsmd.hisnord
|
||||
was_item_names.Add(ItemsChoiceType6.WasteDisposalServiceProviderName);
|
||||
}
|
||||
}
|
||||
|
||||
if (was.WasteDisposalDelivery.HasValue)
|
||||
{
|
||||
was_items.Add((wastedeliverytype)was.WasteDisposalDelivery);
|
||||
@ -1233,12 +1235,12 @@ namespace bsmd.hisnord
|
||||
{
|
||||
was_items.Add(ytype.Y);
|
||||
was_item_names.Add(ItemsChoiceType6.ConfirmationOfCorrectnessAndSufficiency);
|
||||
}
|
||||
|
||||
hn_was.Items = was_items.ToArray();
|
||||
hn_was.ItemsElementName = was_item_names.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
hn_was.Items = was_items.ToArray();
|
||||
hn_was.ItemsElementName = was_item_names.ToArray();
|
||||
|
||||
items1.Add(hn_was);
|
||||
items1ChoiceType.Add(Items1ChoiceType.WAS);
|
||||
|
||||
|
||||
@ -124,13 +124,19 @@ namespace bsmd.hisnord
|
||||
if(nswResponse.NotificationClass == Message.NotificationClass.VISIT)
|
||||
{
|
||||
if ((nswResponse.Status == "ACCEPTED") && !nswResponse.VisitId.IsNullOrEmpty())
|
||||
{
|
||||
_log.InfoFormat("Setting Visit-Id to {0} Core {1}", nswResponse.VisitId, core.Id);
|
||||
core.VisitId = nswResponse.VisitId;
|
||||
}
|
||||
}
|
||||
|
||||
if(nswResponse.NotificationClass == Message.NotificationClass.TRANSIT)
|
||||
{
|
||||
if ((nswResponse.Status == "ACCEPTED") && !nswResponse.TransitId.IsNullOrEmpty())
|
||||
{
|
||||
_log.InfoFormat("Setting Transit-Id to {0} Core {1}", nswResponse.TransitId, core.Id);
|
||||
core.TransitId = nswResponse.TransitId;
|
||||
}
|
||||
}
|
||||
|
||||
if(nswResponse.NotificationClass == Message.NotificationClass.STO)
|
||||
@ -145,11 +151,9 @@ namespace bsmd.hisnord
|
||||
_log.InfoFormat("Cancel rejected for {0}", core.DisplayId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||
DBManager.Instance.Save(core);
|
||||
}
|
||||
|
||||
bool aMessageStillInSENTstate = false;
|
||||
// now find the message that was meant..
|
||||
foreach (Message aMessage in messages)
|
||||
{
|
||||
@ -159,15 +163,7 @@ namespace bsmd.hisnord
|
||||
{
|
||||
aMessage.ReceivedAt = nswResponse.ReceiveAt;
|
||||
|
||||
bool isAccepted = (nswResponse.Status == "ACCEPTED");
|
||||
|
||||
if (aMessage.Reset && nswResponse.IsReset && isAccepted)
|
||||
{
|
||||
_log.InfoFormat("Message {0} RESET confirmed", aMessage.Id);
|
||||
aMessage.SendSuccess = false;
|
||||
}
|
||||
if (nswResponse.IsReset && !aMessage.Reset)
|
||||
aMessage.Reset = nswResponse.IsReset;
|
||||
bool isAccepted = (nswResponse.Status == "ACCEPTED");
|
||||
|
||||
if(isAccepted)
|
||||
{
|
||||
@ -186,6 +182,15 @@ namespace bsmd.hisnord
|
||||
aMessage.InternalStatus = Message.BSMDStatus.ERROR;
|
||||
aMessage.StatusInfo = "Errors reported";
|
||||
}
|
||||
|
||||
if (aMessage.Reset && nswResponse.IsReset && isAccepted)
|
||||
{
|
||||
_log.InfoFormat("Message {0} RESET confirmed", aMessage.Id);
|
||||
aMessage.SendSuccess = false; // bestätigter RESET setzt den grünen Buppel wieder zurück
|
||||
}
|
||||
if (nswResponse.IsReset && !aMessage.Reset)
|
||||
aMessage.Reset = nswResponse.IsReset;
|
||||
|
||||
}
|
||||
|
||||
#region Error / Violation handling
|
||||
@ -226,7 +231,16 @@ namespace bsmd.hisnord
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
if (aMessage.InternalStatus == Message.BSMDStatus.SENT)
|
||||
aMessageStillInSENTstate = true;
|
||||
|
||||
}
|
||||
|
||||
if(!aMessageStillInSENTstate)
|
||||
core.BSMDStatusInternal = MessageCore.BSMDStatus.RESPONDED;
|
||||
DBManager.Instance.Save(core);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user