POListControl umbenannt, neue Übersicht mit Tabs
This commit is contained in:
parent
114b9db663
commit
b94835ee4b
@ -1,56 +1,56 @@
|
|||||||
<UserControl x:Class="ENI2.Controls.POListControl"
|
<UserControl x:Class="ENI2.Controls.MaerskListControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:util="clr-namespace:ENI2.Util"
|
xmlns:util="clr-namespace:ENI2.Util"
|
||||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||||
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
|
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
|
||||||
xmlns:p="clr-namespace:ENI2.Properties"
|
xmlns:p="clr-namespace:ENI2.Properties"
|
||||||
xmlns:local="clr-namespace:ENI2.Controls"
|
xmlns:local="clr-namespace:ENI2.Controls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<col:ArrayList x:Key="arrList">
|
<col:ArrayList x:Key="arrList">
|
||||||
<col:DictionaryEntry Key="None" Value="0" />
|
<col:DictionaryEntry Key="None" Value="0" />
|
||||||
<col:DictionaryEntry Key="Maersk BRV/WHV" Value="1" />
|
<col:DictionaryEntry Key="Maersk BRV/WHV" Value="1" />
|
||||||
<col:DictionaryEntry Key="SeaGo BHV" Value="2" />
|
<col:DictionaryEntry Key="SeaGo BHV" Value="2" />
|
||||||
<col:DictionaryEntry Key="SeaGo WHV" Value="4" />
|
<col:DictionaryEntry Key="SeaGo WHV" Value="4" />
|
||||||
</col:ArrayList>
|
</col:ArrayList>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<GroupBox Name="groupBoxRP" Header="{x:Static p:Resources.textPOLists}">
|
<GroupBox Name="groupBoxRP" Header="{x:Static p:Resources.textPOLists}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="28" />
|
<RowDefinition Height="28" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Calendar week" />
|
<Label Content="Calendar week" />
|
||||||
<xctk:DoubleUpDown x:Name="doubleUpDownCalendarWeek" VerticalContentAlignment="Center" VerticalAlignment="Center"
|
<xctk:DoubleUpDown x:Name="doubleUpDownCalendarWeek" VerticalContentAlignment="Center" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Stretch" Margin="2" Value="01" ValueChanged="doubleUpDownCalendarWeek_ValueChanged"/>
|
HorizontalAlignment="Stretch" Margin="2" Value="01" ValueChanged="doubleUpDownCalendarWeek_ValueChanged"/>
|
||||||
<Label Content="Type" />
|
<Label Content="Type" />
|
||||||
<ComboBox x:Name="comboBoxFilterType" Margin="2" SelectionChanged="comboBoxFilterType_SelectionChanged" Width="100" />
|
<ComboBox x:Name="comboBoxFilterType" Margin="2" SelectionChanged="comboBoxFilterType_SelectionChanged" Width="100" />
|
||||||
|
|
||||||
<Button x:Name="buttonExcelExport" Margin="2" Click="buttonExcelExport_Click" Content="Export Excel" Width="100" />
|
<Button x:Name="buttonExcelExport" Margin="2" Click="buttonExcelExport_Click" Content="Export Excel" Width="100" />
|
||||||
<Button x:Name="buttonSaveChanges" Margin="2" Click="buttonSaveChanges_Click" Content="Save changes" Width="100" IsEnabled="False" />
|
<Button x:Name="buttonSaveChanges" Margin="2" Click="buttonSaveChanges_Click" Content="Save changes" Width="100" IsEnabled="False" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
<local:ENIDataGrid Grid.Row="1" Margin="2,8,2,2" x:Name="dataGridPOCores" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
|
||||||
SelectionMode="Single" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False">
|
SelectionMode="Single" AutoGenerateColumns="False" CellEditEnding="dataGridPOCores_CellEditEnding" CanUserAddRows="False">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="IMO/ENI" Binding="{Binding IMOENIDisplay}" IsReadOnly="True" />
|
<DataGridTextColumn Header="IMO/ENI" Binding="{Binding IMOENIDisplay}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn x:Name="gridColumnPONumber" Header="PO number" Binding="{Binding PONumber, Mode=TwoWay}" IsReadOnly="False" />
|
<DataGridTextColumn x:Name="gridColumnPONumber" Header="PO number" Binding="{Binding PONumber, Mode=TwoWay}" IsReadOnly="False" />
|
||||||
<DataGridComboBoxColumn x:Name="gridColumnGroup" Header="Group" IsReadOnly="False" SelectedValueBinding="{Binding Flags, Mode=TwoWay}"
|
<DataGridComboBoxColumn x:Name="gridColumnGroup" Header="Group" IsReadOnly="False" SelectedValueBinding="{Binding Flags, Mode=TwoWay}"
|
||||||
ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value">
|
ItemsSource="{StaticResource arrList}" DisplayMemberPath="Key" SelectedValuePath="Value">
|
||||||
</DataGridComboBoxColumn>
|
</DataGridComboBoxColumn>
|
||||||
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
|
<DataGridTextColumn Header="Ship name" Binding="{Binding Shipname}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
<DataGridTextColumn Header="ETA" Binding="{Binding ETA_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="ETD" Binding="{Binding ETD_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
<DataGridTextColumn Header="ETD" Binding="{Binding ETD_NOA_NOD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn x:Name="gridColumnATA" Header="ATA" Binding="{Binding POATA, StringFormat=\{0:dd.MM.yyyy\}, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" />
|
<DataGridTextColumn x:Name="gridColumnATA" Header="ATA" Binding="{Binding POATA, StringFormat=\{0:dd.MM.yyyy\}, Mode=TwoWay, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="False" />
|
||||||
<DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
<DataGridTextColumn Header="ATD" Binding="{Binding ATD, StringFormat=\{0:dd.MM.yyyy HH:mm\}, Converter={util:UtcToLocalDateTimeConverter}}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
|
<DataGridTextColumn Header="Hafen" Binding="{Binding PortnameDisplay}" IsReadOnly="True" />
|
||||||
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
|
<DataGridTextColumn Header="Id" Binding="{Binding DisplayId}" IsReadOnly="True" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</local:ENIDataGrid>
|
</local:ENIDataGrid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,278 +1,278 @@
|
|||||||
// Copyright (c) 2017 schick Informatik
|
// Copyright (c) 2017 schick Informatik
|
||||||
// Description: PO Nummer Übersicht. Ergänzung Nummern. Excel Export
|
// Description: PO Nummer Übersicht. Ergänzung Nummern. Excel Export
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
using Microsoft.Office.Interop.Excel;
|
using Microsoft.Office.Interop.Excel;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using bsmd.database;
|
using bsmd.database;
|
||||||
|
|
||||||
namespace ENI2.Controls
|
namespace ENI2.Controls
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for POListControl.xaml
|
/// Interaction logic for MaerskListControl.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class POListControl : UserControl
|
public partial class MaerskListControl : UserControl
|
||||||
{
|
{
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private readonly string[] _comboBoxEntries =
|
private readonly string[] _comboBoxEntries =
|
||||||
{
|
{
|
||||||
"All",
|
"All",
|
||||||
"Maersk BRV/WHV",
|
"Maersk BRV/WHV",
|
||||||
"SeaGo BHV",
|
"SeaGo BHV",
|
||||||
"SeaGo WHV"
|
"SeaGo WHV"
|
||||||
};
|
};
|
||||||
|
|
||||||
private List<MessageCore> searchResult = new List<MessageCore>();
|
private List<MessageCore> searchResult = new List<MessageCore>();
|
||||||
private readonly List<MessageCore> filteredResult = new List<MessageCore>();
|
private readonly List<MessageCore> filteredResult = new List<MessageCore>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Construction
|
#region Construction
|
||||||
|
|
||||||
public POListControl()
|
public MaerskListControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Loaded += POList_Loaded;
|
Loaded += POList_Loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region control event handler
|
#region control event handler
|
||||||
|
|
||||||
private void POList_Loaded(object sender, RoutedEventArgs e)
|
private void POList_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.comboBoxFilterType.ItemsSource = this._comboBoxEntries;
|
this.comboBoxFilterType.ItemsSource = this._comboBoxEntries;
|
||||||
this.doubleUpDownCalendarWeek.Value = bsmd.database.Util.GetIso8601WeekOfYear(DateTime.Now);
|
this.doubleUpDownCalendarWeek.Value = bsmd.database.Util.GetIso8601WeekOfYear(DateTime.Now);
|
||||||
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonExcelExport_Click(object sender, RoutedEventArgs e)
|
private void buttonExcelExport_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (this.filteredResult.Count == 0) return;
|
if (this.filteredResult.Count == 0) return;
|
||||||
|
|
||||||
OpenFileDialog ofd = new OpenFileDialog
|
OpenFileDialog ofd = new OpenFileDialog
|
||||||
{
|
{
|
||||||
Filter = "Excel Files|*.xls;*.xlsx"
|
Filter = "Excel Files|*.xls;*.xlsx"
|
||||||
};
|
};
|
||||||
if (ofd.ShowDialog() ?? false)
|
if (ofd.ShowDialog() ?? false)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
|
Microsoft.Office.Interop.Excel.Application excelApp = new Microsoft.Office.Interop.Excel.Application();
|
||||||
excelApp.DisplayAlerts = false;
|
excelApp.DisplayAlerts = false;
|
||||||
Workbook workBook = excelApp.Workbooks.Open(ofd.FileName);
|
Workbook workBook = excelApp.Workbooks.Open(ofd.FileName);
|
||||||
Worksheet workSheet = workBook.Worksheets[1];
|
Worksheet workSheet = workBook.Worksheets[1];
|
||||||
|
|
||||||
int rowIndex = 3;
|
int rowIndex = 3;
|
||||||
foreach(MessageCore core in this.filteredResult)
|
foreach(MessageCore core in this.filteredResult)
|
||||||
{
|
{
|
||||||
workSheet.Cells[rowIndex, 7].Value = core.Shipname;
|
workSheet.Cells[rowIndex, 7].Value = core.Shipname;
|
||||||
workSheet.Cells[rowIndex, 10].Value = core.PoC.Substring(2);
|
workSheet.Cells[rowIndex, 10].Value = core.PoC.Substring(2);
|
||||||
if(core.POATA.HasValue)
|
if(core.POATA.HasValue)
|
||||||
workSheet.Cells[rowIndex, 11].Value = core.POATA.Value.ToShortDateString();
|
workSheet.Cells[rowIndex, 11].Value = core.POATA.Value.ToShortDateString();
|
||||||
workSheet.Cells[rowIndex, 13].Value = core.PONumber;
|
workSheet.Cells[rowIndex, 13].Value = core.PONumber;
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
workBook.Save();
|
workBook.Save();
|
||||||
workBook.Close();
|
workBook.Close();
|
||||||
Marshal.ReleaseComObject(workBook);
|
Marshal.ReleaseComObject(workBook);
|
||||||
excelApp.Quit();
|
excelApp.Quit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSaveChanges_Click(object sender, RoutedEventArgs e)
|
private void buttonSaveChanges_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
foreach(MessageCore messageCore in this.filteredResult)
|
foreach(MessageCore messageCore in this.filteredResult)
|
||||||
{
|
{
|
||||||
if (messageCore.IsDirty)
|
if (messageCore.IsDirty)
|
||||||
{
|
{
|
||||||
DBManager.Instance.Save(messageCore);
|
DBManager.Instance.Save(messageCore);
|
||||||
messageCore.IsDirty = false;
|
messageCore.IsDirty = false;
|
||||||
// load ATA for this Core
|
// load ATA for this Core
|
||||||
/* DAS ATA WIRD JETZT NICHT MEHR IN DIE MELDEKLASSE GESPEICHERT
|
/* DAS ATA WIRD JETZT NICHT MEHR IN DIE MELDEKLASSE GESPEICHERT
|
||||||
Message ataMessage = DBManager.Instance.GetMessage(messageCore, Message.NotificationClass.ATA);
|
Message ataMessage = DBManager.Instance.GetMessage(messageCore, Message.NotificationClass.ATA);
|
||||||
if(ataMessage?.Elements.Count == 1)
|
if(ataMessage?.Elements.Count == 1)
|
||||||
{
|
{
|
||||||
if(messageCore.ATA != ((ATA)ataMessage.Elements[0]).ATAPortOfCall)
|
if(messageCore.ATA != ((ATA)ataMessage.Elements[0]).ATAPortOfCall)
|
||||||
{
|
{
|
||||||
((ATA)ataMessage.Elements[0]).ATAPortOfCall = messageCore.ATA;
|
((ATA)ataMessage.Elements[0]).ATAPortOfCall = messageCore.ATA;
|
||||||
DBManager.Instance.Save(ataMessage.Elements[0]);
|
DBManager.Instance.Save(ataMessage.Elements[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.buttonSaveChanges.IsEnabled = false;
|
this.buttonSaveChanges.IsEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doubleUpDownCalendarWeek_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
private void doubleUpDownCalendarWeek_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
{
|
{
|
||||||
if (!this.IsLoaded) return;
|
if (!this.IsLoaded) return;
|
||||||
this.comboBoxFilterType.SelectedIndex = -1;
|
this.comboBoxFilterType.SelectedIndex = -1;
|
||||||
this.PerformSearch();
|
this.PerformSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxFilterType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void comboBoxFilterType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
this.dataGridPOCores.ItemsSource = null;
|
this.dataGridPOCores.ItemsSource = null;
|
||||||
if (this.comboBoxFilterType.SelectedIndex == -1) return;
|
if (this.comboBoxFilterType.SelectedIndex == -1) return;
|
||||||
|
|
||||||
this.filteredResult.Clear();
|
this.filteredResult.Clear();
|
||||||
foreach (MessageCore core in this.searchResult)
|
foreach (MessageCore core in this.searchResult)
|
||||||
{
|
{
|
||||||
switch (this.comboBoxFilterType.SelectedIndex)
|
switch (this.comboBoxFilterType.SelectedIndex)
|
||||||
{
|
{
|
||||||
case 0: this.filteredResult.Add(core); break;
|
case 0: this.filteredResult.Add(core); break;
|
||||||
case 1: if (core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.filteredResult.Add(core); break;
|
case 1: if (core.IsFlagSet(MessageCore.CoreFlags.MAERSK_BHV)) this.filteredResult.Add(core); break;
|
||||||
case 2: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.filteredResult.Add(core); break;
|
case 2: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_BHV)) this.filteredResult.Add(core); break;
|
||||||
case 3: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.filteredResult.Add(core); break;
|
case 3: if (core.IsFlagSet(MessageCore.CoreFlags.SEAGO_WHV)) this.filteredResult.Add(core); break;
|
||||||
case 4: if (core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.filteredResult.Add(core); break;
|
case 4: if (core.IsFlagSet(MessageCore.CoreFlags.HOEGH)) this.filteredResult.Add(core); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
private void dataGridPOCores_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.EditAction == DataGridEditAction.Commit)
|
if (e.EditAction == DataGridEditAction.Commit)
|
||||||
{
|
{
|
||||||
if (e.Column == gridColumnPONumber)
|
if (e.Column == gridColumnPONumber)
|
||||||
{
|
{
|
||||||
// validate for "true" number
|
// validate for "true" number
|
||||||
var el = e.EditingElement as System.Windows.Controls.TextBox;
|
var el = e.EditingElement as System.Windows.Controls.TextBox;
|
||||||
if (!el.Text.IsDigitsOnly())
|
if (!el.Text.IsDigitsOnly())
|
||||||
{
|
{
|
||||||
el.Text = string.Empty;
|
el.Text = string.Empty;
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buttonSaveChanges.IsEnabled = true;
|
buttonSaveChanges.IsEnabled = true;
|
||||||
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
||||||
editedCore.IsDirty = true;
|
editedCore.IsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e.Column == gridColumnGroup)
|
if(e.Column == gridColumnGroup)
|
||||||
{
|
{
|
||||||
var el = e.EditingElement as ComboBox;
|
var el = e.EditingElement as ComboBox;
|
||||||
DictionaryEntry selectedItem = (DictionaryEntry) el.SelectedItem;
|
DictionaryEntry selectedItem = (DictionaryEntry) el.SelectedItem;
|
||||||
MessageCore.CoreFlags coreFlag = (MessageCore.CoreFlags) Enum.Parse(typeof(MessageCore.CoreFlags), selectedItem.Value.ToString());
|
MessageCore.CoreFlags coreFlag = (MessageCore.CoreFlags) Enum.Parse(typeof(MessageCore.CoreFlags), selectedItem.Value.ToString());
|
||||||
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
||||||
// clear all first
|
// clear all first
|
||||||
editedCore.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
|
editedCore.SetFlag(false, MessageCore.CoreFlags.MAERSK_BHV);
|
||||||
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
|
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_BHV);
|
||||||
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
|
editedCore.SetFlag(false, MessageCore.CoreFlags.SEAGO_WHV);
|
||||||
editedCore.SetFlag(false, MessageCore.CoreFlags.HOEGH);
|
editedCore.SetFlag(false, MessageCore.CoreFlags.HOEGH);
|
||||||
if (coreFlag != MessageCore.CoreFlags.NONE)
|
if (coreFlag != MessageCore.CoreFlags.NONE)
|
||||||
{
|
{
|
||||||
editedCore.SetFlag(true, coreFlag);
|
editedCore.SetFlag(true, coreFlag);
|
||||||
}
|
}
|
||||||
buttonSaveChanges.IsEnabled = true;
|
buttonSaveChanges.IsEnabled = true;
|
||||||
editedCore.IsDirty = true;
|
editedCore.IsDirty = true;
|
||||||
}
|
}
|
||||||
if(e.Column == gridColumnATA)
|
if(e.Column == gridColumnATA)
|
||||||
{
|
{
|
||||||
var el = e.EditingElement as System.Windows.Controls.TextBox;
|
var el = e.EditingElement as System.Windows.Controls.TextBox;
|
||||||
if(DateTime.TryParse(el.Text, out DateTime localATA))
|
if(DateTime.TryParse(el.Text, out DateTime localATA))
|
||||||
{
|
{
|
||||||
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
MessageCore editedCore = this.filteredResult[e.Row.GetIndex()];
|
||||||
editedCore.ATA = DateTime.SpecifyKind(localATA, DateTimeKind.Local).ToUniversalTime();
|
editedCore.ATA = DateTime.SpecifyKind(localATA, DateTimeKind.Local).ToUniversalTime();
|
||||||
buttonSaveChanges.IsEnabled = true;
|
buttonSaveChanges.IsEnabled = true;
|
||||||
editedCore.IsDirty = true;
|
editedCore.IsDirty = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
el.Text = string.Empty;
|
el.Text = string.Empty;
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
|
|
||||||
private void PerformSearch()
|
private void PerformSearch()
|
||||||
{
|
{
|
||||||
this.dataGridPOCores.ItemsSource = null;
|
this.dataGridPOCores.ItemsSource = null;
|
||||||
this.filteredResult.Clear();
|
this.filteredResult.Clear();
|
||||||
|
|
||||||
if (!this.doubleUpDownCalendarWeek.Value.HasValue) return;
|
if (!this.doubleUpDownCalendarWeek.Value.HasValue) return;
|
||||||
|
|
||||||
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
|
Dictionary<MessageCore.SearchFilterType, string> filterDict = new Dictionary<MessageCore.SearchFilterType, string>();
|
||||||
|
|
||||||
DateTime start = bsmd.database.Util.FirstDateOfWeekISO8601(DateTime.Now.Year, (int)this.doubleUpDownCalendarWeek.Value);
|
DateTime start = bsmd.database.Util.FirstDateOfWeekISO8601(DateTime.Now.Year, (int)this.doubleUpDownCalendarWeek.Value);
|
||||||
DateTime end = start.Add(new TimeSpan(6, 23, 59, 59));
|
DateTime end = start.Add(new TimeSpan(6, 23, 59, 59));
|
||||||
|
|
||||||
// Die Suche findet in einem erweiterten Intervall statt, da später wenn möglich nach ATA gefiltert wird
|
// Die Suche findet in einem erweiterten Intervall statt, da später wenn möglich nach ATA gefiltert wird
|
||||||
uint from = start.Subtract(new TimeSpan(10, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
|
uint from = start.Subtract(new TimeSpan(10, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
|
||||||
uint to = end.Add(new TimeSpan(5, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
|
uint to = end.Add(new TimeSpan(5, 0, 0, 0)).ToUniversalTime().ToUnixTimeStamp();
|
||||||
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from.ToString() ?? "", to.ToString() ?? ""));
|
filterDict.Add(MessageCore.SearchFilterType.FILTER_ETA, string.Format("{0}:{1}", from.ToString() ?? "", to.ToString() ?? ""));
|
||||||
|
|
||||||
Util.UIHelper.SetBusyState();
|
Util.UIHelper.SetBusyState();
|
||||||
|
|
||||||
// suche auslösen
|
// suche auslösen
|
||||||
this.searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict);
|
this.searchResult = DBManager.GetSingleCon(Properties.Settings.Default.ConnectionString).GetMessageCoresWithFilters(filterDict);
|
||||||
// alle anderen Häfen weg
|
// alle anderen Häfen weg
|
||||||
this.searchResult.RemoveAll(item => (item.PoC == null) || (!item.PoC.Equals("DEBRV") && !item.PoC.Equals("DEWHV") && !item.PoC.Equals("DEWVN")));
|
this.searchResult.RemoveAll(item => (item.PoC == null) || (!item.PoC.Equals("DEBRV") && !item.PoC.Equals("DEWHV") && !item.PoC.Equals("DEWVN")));
|
||||||
|
|
||||||
// rückwärts iterieren um nach ETA und ATA zu filtern
|
// rückwärts iterieren um nach ETA und ATA zu filtern
|
||||||
if (this.searchResult.Count > 0)
|
if (this.searchResult.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = this.searchResult.Count - 1; i >= 0; i--)
|
for (int i = this.searchResult.Count - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
MessageCore messageCore = this.searchResult[i];
|
MessageCore messageCore = this.searchResult[i];
|
||||||
if (messageCore.ATA.HasValue)
|
if (messageCore.ATA.HasValue)
|
||||||
{
|
{
|
||||||
if ((messageCore.ATA.Value < start) || (messageCore.ATA.Value > end))
|
if ((messageCore.ATA.Value < start) || (messageCore.ATA.Value > end))
|
||||||
{
|
{
|
||||||
this.searchResult.RemoveAt(i);
|
this.searchResult.RemoveAt(i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!messageCore.POATA.HasValue)
|
if(!messageCore.POATA.HasValue)
|
||||||
{
|
{
|
||||||
messageCore.POATA = messageCore.ATA;
|
messageCore.POATA = messageCore.ATA;
|
||||||
messageCore.IsDirty = true;
|
messageCore.IsDirty = true;
|
||||||
this.buttonSaveChanges.IsEnabled = true;
|
this.buttonSaveChanges.IsEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((messageCore.ETA.Value < start) || (messageCore.ETA.Value > end)) this.searchResult.RemoveAt(i);
|
if ((messageCore.ETA.Value < start) || (messageCore.ETA.Value > end)) this.searchResult.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResult.Sort((x, y) => DateTime.Compare(x.ATA ?? DateTime.MaxValue, y.ATA ?? DateTime.MaxValue));
|
searchResult.Sort((x, y) => DateTime.Compare(x.ATA ?? DateTime.MaxValue, y.ATA ?? DateTime.MaxValue));
|
||||||
|
|
||||||
this.dataGridPOCores.SelectedItem = null;
|
this.dataGridPOCores.SelectedItem = null;
|
||||||
this.filteredResult.AddRange(searchResult);
|
this.filteredResult.AddRange(searchResult);
|
||||||
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
this.dataGridPOCores.ItemsSource = this.filteredResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
12
ENI2/Controls/MaerskOverviewControl.xaml
Normal file
12
ENI2/Controls/MaerskOverviewControl.xaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="ENI2.Controls.MaerskOverviewControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:ENI2.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
ENI2/Controls/MaerskOverviewControl.xaml.cs
Normal file
28
ENI2/Controls/MaerskOverviewControl.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ENI2.Controls
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MaerskOverviewControl.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MaerskOverviewControl : UserControl
|
||||||
|
{
|
||||||
|
public MaerskOverviewControl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -228,6 +228,9 @@
|
|||||||
<Compile Include="Controls\LocodeControl.xaml.cs">
|
<Compile Include="Controls\LocodeControl.xaml.cs">
|
||||||
<DependentUpon>LocodeControl.xaml</DependentUpon>
|
<DependentUpon>LocodeControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controls\MaerskOverviewControl.xaml.cs">
|
||||||
|
<DependentUpon>MaerskOverviewControl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
|
<Compile Include="EditControls\CompareExcelDialog.xaml.cs">
|
||||||
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
|
<DependentUpon>CompareExcelDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -249,8 +252,8 @@
|
|||||||
<Compile Include="Excel\ExcelManager.cs" />
|
<Compile Include="Excel\ExcelManager.cs" />
|
||||||
<Compile Include="Excel\ExcelReader.cs" />
|
<Compile Include="Excel\ExcelReader.cs" />
|
||||||
<Compile Include="Excel\ExcelUtil.cs" />
|
<Compile Include="Excel\ExcelUtil.cs" />
|
||||||
<Compile Include="Controls\POListControl.xaml.cs">
|
<Compile Include="Controls\MaerskListControl.xaml.cs">
|
||||||
<DependentUpon>POListControl.xaml</DependentUpon>
|
<DependentUpon>MaerskListControl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Controls\ReportingPartyControl.xaml.cs">
|
<Compile Include="Controls\ReportingPartyControl.xaml.cs">
|
||||||
<DependentUpon>ReportingPartyControl.xaml</DependentUpon>
|
<DependentUpon>ReportingPartyControl.xaml</DependentUpon>
|
||||||
@ -458,7 +461,11 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Include="Controls\POListControl.xaml">
|
<Page Include="Controls\MaerskOverviewControl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Controls\MaerskListControl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace ENI2
|
|||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
private ReportingPartyControl rpControl;
|
private ReportingPartyControl rpControl;
|
||||||
private POListControl poControl;
|
private MaerskOverviewControl moControl;
|
||||||
private ServerStatusControl statusControl;
|
private ServerStatusControl statusControl;
|
||||||
private readonly SucheControl sucheControl;
|
private readonly SucheControl sucheControl;
|
||||||
private CompareExcelDialog compareExcelDialog;
|
private CompareExcelDialog compareExcelDialog;
|
||||||
@ -281,11 +281,11 @@ namespace ENI2
|
|||||||
}
|
}
|
||||||
else if(sender == this.buttonPOListe)
|
else if(sender == this.buttonPOListe)
|
||||||
{
|
{
|
||||||
if (this.poControl == null)
|
if (this.moControl == null)
|
||||||
{
|
{
|
||||||
this.poControl = new POListControl();
|
this.moControl = new MaerskOverviewControl();
|
||||||
}
|
}
|
||||||
this.rootContainer.Children.Add(poControl);
|
this.rootContainer.Children.Add(moControl);
|
||||||
}
|
}
|
||||||
else if(sender == this.buttonStatus)
|
else if(sender == this.buttonStatus)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user