Zwischenstand Version 5.5

This commit is contained in:
Daniel Schick 2019-09-18 18:27:02 +00:00
parent ea3bb0ddc4
commit 085e5457a9
16 changed files with 93 additions and 12 deletions

View File

@ -26,10 +26,12 @@
<value>1000</value>
</setting>
<setting name="LockingServerAddress" serializeAs="String">
<value>http://192.168.2.24/LockingService/LockingService.svc</value>
<!--value>http://192.168.2.24/LockingService/LockingService.svc</value-->
<value>http://heupferd/bsmd.LockingService/LockingService.svc</value>
</setting>
<setting name="ConnectionString" serializeAs="String">
<value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value>
<!--value>Initial Catalog=nsw;Data Source=192.168.2.24\SQLEXPRESS;Uid=dfuser;pwd=dfpasswd;Persist Security Info=False;Connection Reset=false</value-->
<value>Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=E:\DATA\DB\NSW.MDF;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False</value>
</setting>
</ENI2.Properties.Settings>
</applicationSettings>

View File

@ -717,6 +717,17 @@ namespace ENI2
#endregion
#region IMO plausibility
if (!this.Core.IMO.IsNullOrEmpty() && !bsmd.database.Util.IsIMOValid(this.Core.IMO))
{
MessageViolation mv = RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "IMO number does not follow the rules", null, "GLOBAL");
mv.MessageGroupName = Properties.Resources.textOverview;
vViolations.Add(mv);
}
#endregion
#endregion
foreach (MessageError me in vErrors)

View File

@ -95,6 +95,9 @@ namespace ENI2.EditControls
private void doubleUpDownIMO_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
this.CheckComplete();
if ((this.doubleUpDownIMO.Value > 1000000) && (!bsmd.database.Util.IsIMOValid(this.doubleUpDownIMO.Value.ToString())))
MessageBox.Show("IMO has invalid format!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
}
private void comboBoxInitialHIS_SelectionChanged(object sender, SelectionChangedEventArgs e)

View File

@ -82,6 +82,9 @@ namespace ENI2.EditControls
bool hasValue = (doubleUpDownIMO.Value.HasValue && doubleUpDownIMO.Value > 0);
doubleUpDownENI.IsReadOnly = hasValue;
this.CheckComplete();
if ((this.doubleUpDownIMO.Value > 1000000) && (!bsmd.database.Util.IsIMOValid(this.doubleUpDownIMO.Value.ToString())))
MessageBox.Show("IMO has invalid format!", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
}
private void doubleUpDownENI_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

View File

@ -74,6 +74,7 @@ namespace ENI2
public static bool CheckNationality(string nationality)
{
if (nationality.IsNullOrEmpty()) return false;
if (_nationalities == null) _nationalities = getNationalities();
return _nationalities.ContainsKey(nationality);
}

Binary file not shown.

View File

@ -787,6 +787,7 @@ namespace bsmd.database
if (entity is ISublistElement sublistElement)
{
string stringIdentifier = (sublistElement).Identifier;
if (stringIdentifier == null) return;
Regex re = new Regex(@"\d+");
Match m = re.Match(stringIdentifier);
if (m.Success)

View File

@ -617,6 +617,9 @@ namespace bsmd.database
if ((this.DateOfIssue.HasValue) && (this.DateOfIssue.Value < DateTime.Today.AddMonths(-6)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of issue might be too old", null, this.Title, null, this.Tablename));
if ((this.DateOfIssue.HasValue) && (this.DateOfIssue.Value > DateTime.Today))
violations.Add(RuleEngine.CreateViolation(ValidationCode.TIME_IMPLAUSIBLE, "Date of issue is in the future", null, this.Title, null, this.Tablename));
if (this.PortOfCallLast30Days.Count == 0)
{
errors.Add(RuleEngine.CreateError(ValidationCode.NOT_NULL, "Port of Call last 30 day list is EMPTY", null, this.Title, null, this.Tablename));

View File

@ -409,6 +409,9 @@ namespace bsmd.database
if ((this.LastTenPortFacilitesCalled.Count == 0) || (this.LastTenPortFacilitesCalled.Count > 10))
errors.Add(RuleEngine.CreateError(ValidationCode.IMPLAUSIBLE, "LastTenPortFacilitiesCalled", null, this.Title, null, this.Tablename));
if (!(this.ValidISSCOnBoard ?? false))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "No valid security plan on board?", null, this.Title, null, this.Tablename));
if(this.KielCanalPassagePlanned ?? false)
{
if(!KielCanalPassagePlannedIncomming.HasValue && !KielCanalPassagePlannedOutgoing.HasValue)

View File

@ -319,6 +319,12 @@ namespace bsmd.database
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Beam valid?", null, this.Title, null, this.Tablename));
if (this.GrossTonnage.HasValue && ((this.GrossTonnage.Value < 50) || (this.GrossTonnage > 500000)))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Gross tonnage valid?", null, this.Title, null, this.Tablename));
if((this.PortOfRegistry.Length > 1) && (this.Flag.Length == 2))
{
if (!this.PortOfRegistry.Substring(0, 2).Equals(this.Flag))
violations.Add(RuleEngine.CreateViolation(ValidationCode.IMPLAUSIBLE, "Port of registration and flag do not match!", null, this.Title, null, this.Tablename));
}
}
#endregion

View File

@ -32,6 +32,7 @@ namespace bsmd.database
[ShowReport]
[MaxLength(2)]
[Validation(ValidationCode.FLAG_CODE)]
[ENI2Validation]
public string TowageOnDepartureFlag { get; set; }

View File

@ -250,12 +250,12 @@ namespace bsmd.database
int sum = 0;
for (int i = 0, multiplier = 7; i < 6; i++, multiplier--)
{
sum += (Convert.ToInt32(actualIMO[i]) * multiplier);
sum += (Convert.ToInt32(actualIMO.Substring(i,1)) * multiplier);
}
int lastdigit = sum % 10; // letzte Stelle
if (Convert.ToInt32(actualIMO[6]) == lastdigit)
if (Convert.ToInt32(actualIMO.Substring(6,1)) == lastdigit)
return true;
}

View File

@ -4,7 +4,6 @@ using System.ServiceModel;
namespace bsmd.dbh.ResponseService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IResponseService
{
@ -15,7 +14,7 @@ namespace bsmd.dbh.ResponseService
/// </summary>
[OperationContract(Action = "http://tempuri.org/IResponseService/NSWResponse")]
[XmlSerializerFormatAttribute()]
void Root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull,
bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial,

View File

@ -1,15 +1,18 @@
using System;
using System.ServiceModel;
using log4net;
using bsmd.database;
namespace bsmd.dbh.ResponseService
{
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)]
public class ResponseService : IResponseService
{
private readonly ILog _log = LogManager.GetLogger("dbh ResponseService");
public void Root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
public void root(string Version, string MessageId, string VisitId, string TransitId, DateTime Timestamp,
string SenderReference, bsmd.dbh.response.RootType Type,
bsmd.dbh.response.RootReportingClassesFull ReportingClassesFull,
bsmd.dbh.response.RootReportingClassesPartial ReportingClassesPartial,

45
nsw/dbh/readme.md Normal file
View File

@ -0,0 +1,45 @@
# Erkenntnisse DBH Response
Nach dem Server Umzug Aug/Sep. funktionierte der DBH Rückkanal nicht mehr. Mit NSW 3.0 gab es ohnehin schwere Probleme, so dass man den
Weg verlassen hat. In einem Termin in Bremen wurde nun die Reaktivierung besprochen. Ich habe es leider auf Anhieb nicht geschafft, den
Rückkanal wiederzubeleben, da alle Werte leer waren und offensichtlich das Parsing kaputt war.
Dabei habe ich festgestellt, dass DBH im Header die SOAP Header Attribute To: und Action: (von SOAP 1.1) verwendet in der Form:
```
<s:Header xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<To s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://srv-04.bsmd.local/nswservice/dbh/ResponseService.svc</To>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IResponseService/NSWResponse</Action>
</s:Header>
<soapenv:Body>
```
Es hat nur funktioniert, als ich diese beiden Attribute gelöscht habe. Nach langer Suche (kann ja nur serverseitig was ändern, wie dbh angeblich auf die "lowlevel" Themen keinen Einfluss hat) folgendes in der web.config eingetragen:
```
<!-- das default binding für alles Endpunkte -->
<protocolMapping>
<add binding="customBinding" scheme="http" />
<!--add binding="basicHttpBinding" scheme="http" /-->
</protocolMapping>
<bindings>
<!-- das ist das default binding -->
<customBinding>
<binding>
<!--textMessageEncoding messageVersion="Soap11WSAddressing10" /-->
<textMessageEncoding messageVersion="Soap11"/>
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
```
Der interessante Punkt ist dass man die messageVersion (entscheidet darüber, ob To/Action angenommen wird oder nicht, das ist das Addressing) nur angeben kann wenn man customBinding verwendet.
Außerdem habe ich im Service die Klasse ResponseService mit folgenden Attributen dekoriert:
```
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any, ValidateMustUnderstand = false)]
```
Beim nächsten Versuch kamen die Attribute auf einmal nicht mehr mit (konnte man da doch was drehen, Herr Stöver?) und ich habe das Adressing wieder auskommentiert.
Dieser ganze *Bullshit* ist nur eine Gedankenstütze