Fixed issues when editing the shipcall as BSMD

This commit is contained in:
Daniel Schick 2023-10-06 16:53:52 +02:00 committed by Daniel Schick
parent da8ef2f113
commit eb51074328
6 changed files with 220 additions and 206 deletions

View File

@ -1,7 +1,7 @@
//----------------------
// <auto-generated>
// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32
// Generated REST API Client Code Generator v1.8.4.0 on 06.10.2023 16:40:06
// Using the tool OpenAPI Generator v7.0.0
// </auto-generated>
//----------------------
@ -3770,7 +3770,7 @@ namespace BreCalClient.misc.Client
/// <example>
/// ApiKeyPrefix["Authorization"] = "Bearer";
/// </example>
/// where ApiKey["Authorization"] would then be used to set the value of your bearer token.
/// <EFBFBD> where ApiKey["Authorization"] would then be used to set the value of your bearer token.
///
/// <remarks>
/// OAuth2 workflows should set tokens via AccessToken.
@ -6513,11 +6513,16 @@ namespace BreCalClient.misc.Model
/// <param name="participants">participants.</param>
/// <param name="created">created.</param>
/// <param name="modified">modified.</param>
public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime? eta = default(DateTime?), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
{
this.Id = id;
this.ShipId = shipId;
this.Type = type;
// to ensure "eta" is required (not null)
if (eta == null)
{
throw new ArgumentNullException("eta is a required property for Shipcall and cannot be null");
}
this.Eta = eta;
this.Voyage = voyage;
this.Etd = etd;
@ -6564,7 +6569,7 @@ namespace BreCalClient.misc.Model
/// Gets or Sets Eta
/// </summary>
[DataMember(Name = "eta", IsRequired = true, EmitDefaultValue = true)]
public DateTime Eta { get; set; }
public DateTime? Eta { get; set; }
/// <summary>
/// Gets or Sets Voyage
/// </summary>

View File

@ -350,6 +350,7 @@ components:
eta:
type: string
format: date-time
nullable: true
voyage:
type: string
maxLength: 16

View File

@ -122,15 +122,23 @@ namespace BreCalClient
this.datePickerETA.IsEnabled = true;
this.datePickerETD.IsEnabled = false;
this.datePickerETD.Value = null;
this.comboBoxDepartureBerth.SelectedIndex = -1;
this.comboBoxDepartureBerth.IsEnabled = false;
this.comboBoxArrivalBerth.IsEnabled = true;
break;
case TypeEnum.Outgoing:
this.datePickerETA.IsEnabled = false;
this.datePickerETD.IsEnabled = true;
this.datePickerETA.Value = null;
this.comboBoxArrivalBerth.SelectedIndex = -1;
this.comboBoxArrivalBerth.IsEnabled = false;
this.comboBoxDepartureBerth.IsEnabled = true;
break;
case TypeEnum.Shifting:
this.datePickerETA.IsEnabled = true;
this.datePickerETD.IsEnabled = true;
this.comboBoxArrivalBerth.IsEnabled = true;
this.comboBoxDepartureBerth.IsEnabled = true;
break;
}
}
@ -145,8 +153,8 @@ namespace BreCalClient
if (this.ShipcallModel.Shipcall != null)
{
this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem;
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now;
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1);
this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value;
this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value;
this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id;
this.ShipcallModel.Ship = (Ship)this.comboBoxShip.SelectedItem;

View File

@ -491,8 +491,8 @@ namespace BreCalClient
{
if (x.Shipcall == null) return 0;
if (y.Shipcall == null) return 0;
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta : x.Shipcall.Etd ?? x.Shipcall.Eta;
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta : y.Shipcall.Etd ?? y.Shipcall.Eta;
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Shipcall.Eta ?? DateTime.Now : x.Shipcall.Etd ?? DateTime.Now;
DateTime yDate = (y.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? y.Shipcall.Eta ?? DateTime.Now : y.Shipcall.Etd ?? DateTime.Now;
return DateTime.Compare(xDate, yDate);
});
break;

View File

@ -151,7 +151,7 @@ namespace BreCalClient
this.textBlockCallsign.Text = this.ShipcallControlModel?.Ship?.Callsign;
if ((this.ShipcallControlModel?.Shipcall?.Type == 1) || (this.ShipcallControlModel?.Shipcall?.Type == 3))
{
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta.ToString("dd.MM. HH:mm");
this.textBlockETA.Text = this.ShipcallControlModel?.Shipcall?.Eta?.ToString("dd.MM. HH:mm");
}
if(this.ShipcallControlModel?.Shipcall?.Type == 2)
{

View File

@ -67,7 +67,7 @@ class ShipcallSchema(Schema):
id = fields.Int()
ship_id = fields.Int()
type = fields.Int()
eta = fields.DateTime()
eta = fields.DateTime(Required = False, allow_none=True)
voyage = fields.Str(Required = False, allow_none=True)
etd = fields.DateTime(Required = False, allow_none=True)
arrival_berth_id = fields.Int(Required = False, allow_none=True)