diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs
index f53e437..d4a06ed 100644
--- a/misc/BreCalApi.cs
+++ b/misc/BreCalApi.cs
@@ -1,7 +1,7 @@
//----------------------
//
-// Generated REST API Client Code Generator v1.8.4.0 on 29.09.2023 14:42:26
+// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32
// Using the tool OpenAPI Generator v7.0.0
//
//----------------------
@@ -51,6 +51,9 @@ using System.Threading.Tasks;
*/
namespace BreCalClient.misc.Api
{
+
+#pragma warning disable CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
+
///
/// Represents a collection of functions to interact with the API endpoints
///
@@ -7632,5 +7635,8 @@ namespace BreCalClient.misc.Model
yield break;
}
}
+
+#pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null'
}
+
diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
index 26ac431..7898a06 100644
--- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml
@@ -8,7 +8,7 @@
xmlns:db="clr-namespace:BreCalClient;assembly=BreCalClient"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
- Title="{x:Static p:Resources.textEditShipcall}" Height="375" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
+ Title="{x:Static p:Resources.textEditShipcall}" Height="403" Width="800" Loaded="Window_Loaded" ResizeMode="NoResize" Icon="Resources/containership.ico">
@@ -32,6 +32,7 @@
+
@@ -58,7 +59,7 @@
-
+
@@ -127,6 +128,8 @@
+
+
diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
index 9d9fd23..968923f 100644
--- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs
@@ -67,12 +67,17 @@ namespace BreCalClient
if (this.ShipcallModel.Shipcall != null)
{
this.Times.EtaBerth = this.datePickerETA.Value;
- this.ShipcallModel.Shipcall.ArrivalBerthId = (int) this.comboBoxArrivalBerth.SelectedValue;
+
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
}
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
+ if((this.comboBoxArrivalBerth.SelectedValue != null) && ((int?)this.comboBoxArrivalBerth.SelectedValue != this.ShipcallModel.Shipcall.ArrivalBerthId))
+ {
+ this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
+ }
+
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
@@ -87,6 +92,9 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.ReplenishingTerminal = this.checkBoxReplenishingTerminal.IsChecked;
this.ShipcallModel.Shipcall.ReplenishingLock = this.checkBoxReplenishingLock.IsChecked;
+ if (!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
+ this.Times.Remarks = this.textBoxRemarks.Text.Trim();
+
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
{
@@ -130,7 +138,9 @@ namespace BreCalClient
this.datePickerETA.Value = this.ShipcallModel.Shipcall.Eta;
}
- if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
+ if (Times.BerthId.HasValue)
+ this.comboBoxArrivalBerth.SelectedValue = Times.BerthId;
+ else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
@@ -155,6 +165,9 @@ namespace BreCalClient
this.checkBoxReplenishingLock.IsChecked = this.ShipcallModel.Shipcall.ReplenishingLock;
this.checkBoxReplenishingTerminal.IsChecked = this.ShipcallModel.Shipcall.ReplenishingTerminal;
+ if(!string.IsNullOrEmpty(this.Times.Remarks))
+ this.textBoxRemarks.Text = this.Times.Remarks;
+
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
{
if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id;
diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
index 6ade5d7..2f41799 100644
--- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml
@@ -55,7 +55,7 @@
-
+
@@ -118,6 +118,8 @@
+
+
diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
index e605b81..17ccaf1 100644
--- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs
@@ -67,12 +67,15 @@ namespace BreCalClient
{
if (this.ShipcallModel.Shipcall != null)
{
- this.Times.EtaBerth = this.datePickerETD.Value;
- this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
+ this.Times.EtdBerth = this.datePickerETD.Value;
if (this.comboBoxPierside.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPierside.SelectedIndex == 0) ? true : false;
}
+ if ((this.comboBoxDepartureBerth.SelectedValue != null) && ((int?)this.comboBoxDepartureBerth.SelectedValue != this.ShipcallModel.Shipcall.DepartureBerthId))
+ {
+ this.Times.BerthId = (int?)this.comboBoxDepartureBerth.SelectedValue;
+ }
this.Times.BerthInfo = this.textBoxBerthRemarks.Text.Trim();
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
@@ -84,6 +87,8 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
+ if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
+ this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
@@ -128,7 +133,9 @@ namespace BreCalClient
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
- if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
+ if (this.Times.BerthId.HasValue)
+ this.comboBoxDepartureBerth.SelectedValue = this.Times.BerthId;
+ else if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
if (this.ShipcallModel.Shipcall.PierSide.HasValue)
@@ -148,6 +155,8 @@ namespace BreCalClient
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
+ if(!string.IsNullOrEmpty(this.Times.Remarks))
+ this.textBoxRemarks.Text = this.Times.Remarks;
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
{
diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
index b144d8b..fcf2af5 100644
--- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
+++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml
@@ -85,7 +85,7 @@
-
+
@@ -142,8 +142,8 @@
-
-
+
+
diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
index b004041..eaf3478 100644
--- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
+++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs
@@ -70,13 +70,17 @@ namespace BreCalClient
{
this.Times.EtdBerth = this.datePickerETD.Value;
this.Times.EtaBerth = this.datePickerETA.Value;
- this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
- this.ShipcallModel.Shipcall.ArrivalBerthId = (int)this.comboBoxArrivalBerth.SelectedValue;
+ this.ShipcallModel.Shipcall.DepartureBerthId = (int)this.comboBoxDepartureBerth.SelectedValue;
if (this.comboBoxPiersideArrival.SelectedIndex >= 0)
{
this.ShipcallModel.Shipcall.PierSide = (this.comboBoxPiersideArrival.SelectedIndex == 0) ? true : false;
}
this.Times.BerthInfo = this.textBoxBerthRemarksArrival.Text.Trim();
+ if ((this.comboBoxArrivalBerth.SelectedValue != null) && ((int?)this.comboBoxArrivalBerth.SelectedValue != this.ShipcallModel.Shipcall.ArrivalBerthId))
+ {
+ this.Times.BerthId = (int?)this.comboBoxArrivalBerth.SelectedValue;
+ }
+
this.ShipcallModel.Shipcall.Draft = (float?)this.doubleUpDownDraft.Value;
this.ShipcallModel.Shipcall.TidalWindowFrom = this.datePickerTidalWindowFrom.Value;
this.ShipcallModel.Shipcall.TidalWindowTo = this.datePickerTidalWindowTo.Value;
@@ -88,6 +92,8 @@ namespace BreCalClient
this.ShipcallModel.Shipcall.PilotRequired = this.checkBoxPilotRequired.IsChecked;
this.ShipcallModel.Shipcall.MooredLock = this.checkBoxMooredLock.IsChecked;
this.ShipcallModel.Shipcall.RainSensitiveCargo = this.checkBoxRainsensitiveCargo.IsChecked;
+ if(!string.IsNullOrEmpty(this.textBoxRemarks.Text.Trim()))
+ this.Times.Remarks = this.textBoxRemarks.Text.Trim();
Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem;
if (participant != null)
@@ -141,8 +147,11 @@ namespace BreCalClient
this.datePickerETD.Value = this.ShipcallModel.Shipcall.Etd;
}
- if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
+ if (this.Times.BerthId.HasValue)
+ this.comboBoxArrivalBerth.SelectedValue = this.Times.BerthId;
+ else if (this.ShipcallModel.Shipcall.ArrivalBerthId.HasValue)
this.comboBoxArrivalBerth.SelectedValue = this.ShipcallModel.Shipcall.ArrivalBerthId;
+
if (this.ShipcallModel.Shipcall.DepartureBerthId.HasValue)
this.comboBoxDepartureBerth.SelectedValue = this.ShipcallModel.Shipcall.DepartureBerthId;
@@ -163,6 +172,8 @@ namespace BreCalClient
this.checkBoxMooredLock.IsChecked = this.ShipcallModel.Shipcall.MooredLock;
this.checkBoxRainsensitiveCargo.IsChecked = this.ShipcallModel.Shipcall.RainSensitiveCargo;
+ if(!string.IsNullOrEmpty(this.Times.Remarks))
+ this.textBoxRemarks.Text = this.Times.Remarks;
foreach (int participant_id in this.ShipcallModel.Shipcall.Participants)
{
diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs
index ec64f03..dc43dcc 100644
--- a/src/BreCalClient/MainWindow.xaml.cs
+++ b/src/BreCalClient/MainWindow.xaml.cs
@@ -38,7 +38,7 @@ namespace BreCalClient
private readonly List _visibleControlModels = new();
private readonly DefaultApi _api;
- private readonly CancellationTokenSource _tokenSource = new();
+ private CancellationTokenSource _tokenSource = new();
private LoginResult? _loginResult;
private bool _refreshImmediately = false;
@@ -277,7 +277,13 @@ namespace BreCalClient
{
while (!_tokenSource.Token.IsCancellationRequested || _refreshImmediately)
{
- _refreshImmediately = false;
+
+ if (_refreshImmediately)
+ {
+ _refreshImmediately = false;
+ _tokenSource = new CancellationTokenSource();
+ }
+
List? shipcalls = null;
try
{
@@ -570,7 +576,8 @@ namespace BreCalClient
{
etc.Times.ShipcallId = obj.ShipcallControlModel.Shipcall.Id;
}
- await _api.TimesPostAsync(etc.Times);
+ Id apiResultId = await _api.TimesPostAsync(etc.Times);
+ etc.Times.Id = apiResultId.VarId;
obj.ShipcallControlModel?.Times.Add(etc.Times);
}
_refreshImmediately = true;
@@ -625,7 +632,9 @@ namespace BreCalClient
{
editControl.Times.ShipcallId = sc.ShipcallControlModel.Shipcall.Id;
}
- await _api.TimesPostAsync(editControl.Times);
+ Id resultAPI_Id = await _api.TimesPostAsync(editControl.Times);
+ editControl.Times.Id = resultAPI_Id.VarId;
+
sc.ShipcallControlModel?.Times.Add(editControl.Times);
}
await _api.ShipcallsPutAsync(editControl.ShipcallModel.Shipcall);
diff --git a/src/BreCalClient/ShipcallControl.xaml b/src/BreCalClient/ShipcallControl.xaml
index 0f21e42..7f2d80c 100644
--- a/src/BreCalClient/ShipcallControl.xaml
+++ b/src/BreCalClient/ShipcallControl.xaml
@@ -118,6 +118,7 @@
+
@@ -139,6 +140,7 @@
+
@@ -159,6 +161,7 @@
+
@@ -180,6 +183,7 @@
+
@@ -201,6 +205,7 @@
+
@@ -219,10 +224,11 @@
-
+
+
diff --git a/src/BreCalClient/ShipcallControl.xaml.cs b/src/BreCalClient/ShipcallControl.xaml.cs
index d6d5658..c9839f4 100644
--- a/src/BreCalClient/ShipcallControl.xaml.cs
+++ b/src/BreCalClient/ShipcallControl.xaml.cs
@@ -167,44 +167,65 @@ namespace BreCalClient
if (this.ShipcallControlModel != null)
{
foreach (Times times in this.ShipcallControlModel.Times)
- {
+ {
+ string? berthText = null;
+ if ((BreCalLists.Berths != null) && times.BerthId.HasValue)
+ {
+ Berth? berth = BreCalLists.Berths.Find((x) => x.Id == times.BerthId);
+ berthText = berth?.Name;
+ }
+ if(berthText == null)
+ {
+ if (this.ShipcallControlModel.Shipcall?.Type == (int) Extensions.TypeEnum.Outgoing)
+ {
+ Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.ShipcallControlModel.Shipcall?.DepartureBerthId);
+ berthText = berth?.Name;
+ }
+ else
+ {
+ Berth? berth = BreCalLists.Berths?.Find((x) => x.Id == this.ShipcallControlModel.Shipcall?.ArrivalBerthId);
+ berthText = berth?.Name;
+ }
+ }
+
if (times.ParticipantType == (int)Extensions.ParticipantType.AGENCY)
{
+ this.labelAgencyBerth.Content = berthText;
this.labelAgencyETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelAgencyETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockAgencyRemarks.Text = times.Remarks;
}
if (times.ParticipantType == (int) Extensions.ParticipantType.MOORING)
{
+ this.labelMooringBerth.Content = berthText;
this.labelMooringETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelMooringETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockMooringRemarks.Text = times.Remarks;
}
if (times.ParticipantType == (int)Extensions.ParticipantType.PORT_ADMINISTRATION)
{
+ this.labelPortAuthorityBerth.Content = berthText;
this.labelPortAuthorityETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelPortAuthorityETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockPortAuthorityRemarks.Text = times.Remarks;
}
if (times.ParticipantType == (int)Extensions.ParticipantType.PILOT)
{
+ this.labelPilotBerth.Content = berthText;
this.labelPilotETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelPilotETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockPilotRemarks.Text = times.Remarks;
}
if (times.ParticipantType == (int)Extensions.ParticipantType.TUG)
{
+ this.labelTugBerth.Content = berthText;
this.labelTugETA.Content = times.EtaBerth.HasValue ? times.EtaBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelTugETD.Content = times.EtdBerth.HasValue ? times.EtdBerth.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockTugRemarks.Text = times.Remarks;
}
if (times.ParticipantType == (int)Extensions.ParticipantType.TERMINAL)
- {
- if (BreCalLists.Berths != null)
- {
- Berth? berth = BreCalLists.Berths.Find((x) => x.Id == times.BerthId);
- this.labelTerminalBerth.Content = (berth != null) ? berth.Name : "";
- }
+ {
+ this.labelTerminalBerth.Content = berthText;
this.labelOperationsStart.Content = times.OperationsStart.HasValue ? times.OperationsStart.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.labelOperationsEnd.Content = times.OperationsEnd.HasValue ? times.OperationsEnd.Value.ToString("dd.MM.yyyy HH:mm") : "- / -";
this.textBlockTerminalRemarks.Text = times.Remarks;
diff --git a/src/server/BreCal/impl/times.py b/src/server/BreCal/impl/times.py
index def3cfe..9792a88 100644
--- a/src/server/BreCal/impl/times.py
+++ b/src/server/BreCal/impl/times.py
@@ -124,10 +124,11 @@ def PutTimes(schemaModel):
pooledConnection.close()
- if affected_rows == 1:
- return json.dumps({"id" : schemaModel["id"]}), 200, {'Content-Type': 'application/json; charset=utf-8'}
+ # if affected_rows == 1: # this doesn't work as expected
- return json.dumps("no such record"), 404, {'Content-Type': 'application/json; charset=utf-8'}
+ return json.dumps({"id" : schemaModel["id"]}), 200, {'Content-Type': 'application/json; charset=utf-8'}
+
+ # return json.dumps("no such record"), 404, {'Content-Type': 'application/json; charset=utf-8'}
except Exception as ex:
logging.error(ex)