PortArea Helper erster Versuch
Ein Bereich in INFO mit Hilfsdaten zur Auswahl der passenden PortArea
This commit is contained in:
parent
6e8fdb0d35
commit
d596f1f7fb
@ -96,14 +96,14 @@ namespace ENI2.Controls
|
|||||||
|
|
||||||
tmpList.Sort();
|
tmpList.Sort();
|
||||||
|
|
||||||
//System.Windows.Application.Current.Dispatcher.Invoke(delegate {
|
System.Windows.Application.Current.Dispatcher.Invoke(delegate {
|
||||||
foreach (StatusEntry se in tmpList)
|
foreach (StatusEntry se in tmpList)
|
||||||
entries.Add(se);
|
entries.Add(se);
|
||||||
//});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
bgWorker.RunWorkerCompleted += (o, e) =>
|
bgWorker.RunWorkerCompleted += (o, e) =>
|
||||||
{
|
{
|
||||||
|
|
||||||
// Enumeration parsen und text ausgeben
|
// Enumeration parsen und text ausgeben
|
||||||
ServiceControllerStatus excel = (ServiceControllerStatus)serverStatus.Excel;
|
ServiceControllerStatus excel = (ServiceControllerStatus)serverStatus.Excel;
|
||||||
|
|||||||
@ -60,6 +60,7 @@
|
|||||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textShippingArea}" Name="label_INFOShippingArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="0" Content="{x:Static p:Resources.textShippingArea}" Name="label_INFOShippingArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textMaerskSeago}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="0" Grid.Column="2" Content="{x:Static p:Resources.textMaerskSeago}" Name="label_MaerskSeaGo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortArea}" Name="label_INFOPortArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textPortArea}" Name="label_INFOPortArea" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
|
<Label HorizontalContentAlignment="Right" Grid.Row="1" Grid.Column="2" Content="Info port area" Name="label_INFOPortAreaInfo" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textRequestedPositionInPortOfCall}" Name="label_INFORequestedBerth" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="2" Grid.Column="0" Content="{x:Static p:Resources.textRequestedPositionInPortOfCall}" Name="label_INFORequestedBerth" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textBowThrusterPower}" Name="label_INFOBowThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="3" Grid.Column="0" Content="{x:Static p:Resources.textBowThrusterPower}" Name="label_INFOBowThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textSternThrusterPower}" Name="label_INFOSternThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
<Label HorizontalContentAlignment="Right" Grid.Row="4" Grid.Column="0" Content="{x:Static p:Resources.textSternThrusterPower}" Name="label_INFOSternThrusterPower" VerticalContentAlignment="Center" Margin="0,0,10,0"/>
|
||||||
@ -70,6 +71,18 @@
|
|||||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxShippingArea" Margin="2" SelectedIndex="{Binding ShippingArea, Converter={util:ByteConverter}}" ContextMenu="{DynamicResource ClearContextMenu}" />
|
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="comboBoxShippingArea" Margin="2" SelectedIndex="{Binding ShippingArea, Converter={util:ByteConverter}}" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||||
<ComboBox Grid.Row="0" Grid.Column="3" x:Name="comboBoxGroup" Margin="0,2,4,2" ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="comboBoxGroup_SelectionChanged"/>
|
<ComboBox Grid.Row="0" Grid.Column="3" x:Name="comboBoxGroup" Margin="0,2,4,2" ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value" SelectionChanged="comboBoxGroup_SelectionChanged"/>
|
||||||
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxPortArea" Margin="2" SelectedValue="{Binding PortArea}" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}" />
|
<ComboBox Grid.Row="1" Grid.Column="1" Name="comboBoxPortArea" Margin="2" SelectedValue="{Binding PortArea}" SelectedValuePath="Key" DisplayMemberPath="Value" ContextMenu="{DynamicResource ClearContextMenu}" />
|
||||||
|
<Grid Grid.Row="1" Grid.Column="3">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="28" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ComboBox x:Name="comboBoxPortAreaHelper" Margin="2" SelectionChanged="comboBoxPortAreaHelper_SelectionChanged" />
|
||||||
|
<Button Grid.Column="1" Name="buttonSetPortArea" Margin="2" Click="buttonSetPortArea_Click" BorderThickness="0" Background="Transparent" ToolTip="Set this port area">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image Source="../Resources/check.png" Margin="0,0,0,0" Height="20" Width="20" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
<TextBox Grid.Row="2" Grid.Column="1" Name="textRequestedPostionInPortOfCall" Margin="2" Text="{Binding RequestedPositionInPortOfCall, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
<TextBox Grid.Row="2" Grid.Column="1" Name="textRequestedPostionInPortOfCall" Margin="2" Text="{Binding RequestedPositionInPortOfCall, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
||||||
<TextBox Grid.Row="3" Grid.Column="1" Name="textBowThrusterPower" Margin="2" Text="{Binding BowThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
<TextBox Grid.Row="3" Grid.Column="1" Name="textBowThrusterPower" Margin="2" Text="{Binding BowThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
||||||
<TextBox Grid.Row="4" Grid.Column="1" Name="textSternThrusterPower" Margin="2" Text="{Binding SternThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
<TextBox Grid.Row="4" Grid.Column="1" Name="textSternThrusterPower" Margin="2" Text="{Binding SternThrusterPower, Converter={util:TrimStringConverter}}" VerticalContentAlignment="Center"/>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ namespace ENI2.DetailViewControls
|
|||||||
private Message _infoMessage;
|
private Message _infoMessage;
|
||||||
private Message _servMessage;
|
private Message _servMessage;
|
||||||
private Message _ladgMessage;
|
private Message _ladgMessage;
|
||||||
|
private Dictionary<string, string> portAreas = null;
|
||||||
|
|
||||||
private static readonly string[] shippingAreas = {
|
private static readonly string[] shippingAreas = {
|
||||||
Properties.Resources.textShippingAreaNORTHBALTIC,
|
Properties.Resources.textShippingAreaNORTHBALTIC,
|
||||||
@ -109,11 +111,11 @@ namespace ENI2.DetailViewControls
|
|||||||
_infoMessage.Elements.Add(info);
|
_infoMessage.Elements.Add(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, string> portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
|
portAreas = LocalizedLookup.getPortAreasForLocode(this.Core.PoC);
|
||||||
this.comboBoxPortArea.ItemsSource = portAreas;
|
this.comboBoxPortArea.ItemsSource = portAreas;
|
||||||
|
|
||||||
this.comboBoxShippingArea.ItemsSource = shippingAreas;
|
this.comboBoxShippingArea.ItemsSource = shippingAreas;
|
||||||
this.infoGroupBox.DataContext = info;
|
this.infoGroupBox.DataContext = info;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -161,6 +163,15 @@ namespace ENI2.DetailViewControls
|
|||||||
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
|
if (this.Core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.comboBoxGroup.SelectedIndex = 4;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region init port area helper
|
||||||
|
|
||||||
|
if (LocalizedLookup.getPortAreaInfos().ContainsKey(this.Core.PoC))
|
||||||
|
{
|
||||||
|
this.comboBoxPortAreaHelper.ItemsSource = LocalizedLookup.getPortAreaInfos()[this.Core.PoC];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
#region datagrid LADG
|
#region datagrid LADG
|
||||||
@ -459,5 +470,31 @@ namespace ENI2.DetailViewControls
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region set port area code from selected combobox item
|
||||||
|
|
||||||
|
private void buttonSetPortArea_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxPortAreaHelper.SelectedItem != null)
|
||||||
|
{
|
||||||
|
PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
|
||||||
|
if (portAreas.ContainsKey(pai.PortAreaCode))
|
||||||
|
{
|
||||||
|
var pair = portAreas.SingleOrDefault(p => p.Key == pai.PortAreaCode);
|
||||||
|
this.comboBoxPortArea.SelectedItem = pair;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBoxPortAreaHelper_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (this.comboBoxPortAreaHelper.SelectedItem != null)
|
||||||
|
{
|
||||||
|
PortAreaInfo pai = this.comboBoxPortAreaHelper.SelectedItem as PortAreaInfo;
|
||||||
|
this.comboBoxPortAreaHelper.ToolTip = $"{pai.Remark} Ships: {pai.Ships} Agentur: {pai.Agency} Liegeplatz: {pai.Berth}";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -956,9 +956,15 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
string portArea = reader.ReadText("INFO.PortArea")?.ToUpper();
|
string portArea = reader.ReadText("INFO.PortArea")?.ToUpper();
|
||||||
if (!portArea.IsNullOrEmpty() && DBManager.Instance.GetPortAreaDict().ContainsKey(portArea))
|
if (!portArea.IsNullOrEmpty() && DBManager.Instance.GetPortAreaDict().ContainsKey(portArea))
|
||||||
|
{
|
||||||
info.PortArea = portArea;
|
info.PortArea = portArea;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
info.PortArea = "";
|
info.PortArea = "";
|
||||||
|
if (!portArea.IsNullOrEmpty() && info.RequestedPositionInPortOfCall.IsNullOrEmpty())
|
||||||
|
info.RequestedPositionInPortOfCall = portArea;
|
||||||
|
}
|
||||||
|
|
||||||
info.ShippingArea = reader.ReadShippingArea("INFO.ShippingArea"); // enum read func
|
info.ShippingArea = reader.ReadShippingArea("INFO.ShippingArea"); // enum read func
|
||||||
bool? fumigatedBulkCargo = reader.ReadBoolean("INFO.FumigatedBulkCargo");
|
bool? fumigatedBulkCargo = reader.ReadBoolean("INFO.FumigatedBulkCargo");
|
||||||
|
|||||||
@ -16,6 +16,7 @@ namespace ENI2
|
|||||||
private static readonly SQLiteConnection _con;
|
private static readonly SQLiteConnection _con;
|
||||||
private const string _locode_DB_NAME = "db.sqlite";
|
private const string _locode_DB_NAME = "db.sqlite";
|
||||||
private static Dictionary<string, string> _nationalities = null;
|
private static Dictionary<string, string> _nationalities = null;
|
||||||
|
private static Dictionary<string, List<PortAreaInfo>> _portAreaInfos = null;
|
||||||
|
|
||||||
static LocalizedLookup()
|
static LocalizedLookup()
|
||||||
{
|
{
|
||||||
@ -188,6 +189,8 @@ namespace ENI2
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Dictionary<string, string> getCargoCodesNST()
|
public static Dictionary<string, string> getCargoCodesNST()
|
||||||
{
|
{
|
||||||
Dictionary<string, string> result = new Dictionary<string, string>();
|
Dictionary<string, string> result = new Dictionary<string, string>();
|
||||||
@ -304,5 +307,41 @@ namespace ENI2
|
|||||||
reader.Close();
|
reader.Close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, List<PortAreaInfo>> getPortAreaInfos()
|
||||||
|
{
|
||||||
|
if(_portAreaInfos == null)
|
||||||
|
{
|
||||||
|
_portAreaInfos = new Dictionary<string, List<PortAreaInfo>>();
|
||||||
|
string query = @"SELECT Locode, Agentur, Schiffe, Liegeplatz, Hafengebiet, `Hafengebiet-Code`, Bemerkungen from INFO_PortArea_Helper";
|
||||||
|
SQLiteCommand cmd = new SQLiteCommand(query, _con);
|
||||||
|
IDataReader reader = cmd.ExecuteReader();
|
||||||
|
while(reader.Read())
|
||||||
|
{
|
||||||
|
PortAreaInfo pai = new PortAreaInfo();
|
||||||
|
if (reader.IsDBNull(0)) continue;
|
||||||
|
pai.Locode = reader.GetString(0);
|
||||||
|
if (!reader.IsDBNull(1))
|
||||||
|
pai.Agency = reader.GetString(1);
|
||||||
|
if (!reader.IsDBNull(2))
|
||||||
|
pai.Ships = reader.GetString(2);
|
||||||
|
if (!reader.IsDBNull(3))
|
||||||
|
pai.Berth = reader.GetString(3);
|
||||||
|
if (!reader.IsDBNull(4))
|
||||||
|
pai.PortArea = reader.GetString(4);
|
||||||
|
if (!reader.IsDBNull(5))
|
||||||
|
pai.PortAreaCode = reader.GetString(5);
|
||||||
|
if (!reader.IsDBNull(6))
|
||||||
|
pai.Remark = reader.GetString(6);
|
||||||
|
if (!_portAreaInfos.ContainsKey(pai.Locode))
|
||||||
|
{
|
||||||
|
_portAreaInfos[pai.Locode] = new List<PortAreaInfo>();
|
||||||
|
}
|
||||||
|
_portAreaInfos[pai.Locode].Add(pai);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _portAreaInfos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -234,4 +234,34 @@ namespace bsmd.database
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region class PortAreaInfo
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// simple helper class container to map support data from sqlite lookup db
|
||||||
|
/// </summary>
|
||||||
|
public class PortAreaInfo
|
||||||
|
{
|
||||||
|
public string Locode { get; set; }
|
||||||
|
|
||||||
|
public string Agency { get; set; }
|
||||||
|
|
||||||
|
public string Ships { get; set; }
|
||||||
|
|
||||||
|
public string Berth { get; set; }
|
||||||
|
|
||||||
|
public string PortArea { get; set; }
|
||||||
|
|
||||||
|
public string PortAreaCode { get; set; }
|
||||||
|
|
||||||
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("{0} ({1})", PortArea, PortAreaCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
BIN
misc/db.sqlite
BIN
misc/db.sqlite
Binary file not shown.
Loading…
Reference in New Issue
Block a user