Fehlerkorrekturen bei WAS und INFO
This commit is contained in:
parent
da7b586258
commit
4cf91200df
@ -745,6 +745,8 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
|
||||
if (crewdMessage != null)
|
||||
{
|
||||
if (crewdMessage.Elements.Count > 0)
|
||||
{
|
||||
CREWD crewdFirst = crewdMessage.Elements[0] as CREWD;
|
||||
@ -766,6 +768,7 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(pasaMessage.Elements.Count > 0)
|
||||
{
|
||||
@ -796,6 +799,8 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
|
||||
if (pasdMessage != null)
|
||||
{
|
||||
if (pasdMessage.Elements.Count > 0)
|
||||
{
|
||||
PASD pasdFirst = pasdMessage.Elements[0] as PASD;
|
||||
@ -824,6 +829,7 @@ namespace ENI2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -466,55 +466,63 @@ namespace ENI2.DetailViewControls
|
||||
{
|
||||
do
|
||||
{
|
||||
// skip first two rows
|
||||
// skip first three rows
|
||||
reader.Read();
|
||||
reader.Read();
|
||||
reader.Read();
|
||||
|
||||
int cnt = 0;
|
||||
object o = null;
|
||||
|
||||
while (reader.Read() && (cnt < 15))
|
||||
{
|
||||
if (((IExcelDataReader)reader).FieldCount < 10)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have 10 Columns of data");
|
||||
}
|
||||
Waste waste = new Waste();
|
||||
// Diese Funktion kann das "alte" Sheet Format nicht mehr einlesen!
|
||||
|
||||
while (reader.Read() && (cnt < 35))
|
||||
{
|
||||
if (reader.FieldCount < 9)
|
||||
{
|
||||
throw new InvalidDataException("Sheet must have 9 Columns of data");
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(1)) o = reader.GetValue(1); else o = null;
|
||||
if (o != null)
|
||||
if ((o != null) && Int32.TryParse(o.ToString(), out int wasteType))
|
||||
{
|
||||
waste.WasteType = Convert.ToInt32(o);
|
||||
if (waste.WasteType == 2313) waste.WasteType = 2600;
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(3)) waste.WasteDescription = reader.GetString(3);
|
||||
|
||||
if (!reader.IsDBNull(4)) o = reader.GetValue(4); else o = null;
|
||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5); else o = null;
|
||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6); else o = null;
|
||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(7)) waste.WasteDisposalPort = reader.GetString(7);
|
||||
|
||||
if (!reader.IsDBNull(8)) o = reader.GetValue(8); else o = null;
|
||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null;
|
||||
if (o != null) waste.WasteDisposedAtLastPort_MTQ = Convert.ToDouble(o);
|
||||
|
||||
Waste waste = _was.GetWasteForType(wasteType);
|
||||
if (waste == null)
|
||||
{
|
||||
waste = new Waste();
|
||||
waste.WasteType = wasteType;
|
||||
waste.WAS = this._was;
|
||||
waste.IsDirty = true;
|
||||
waste.Identifier = Waste.GetNewIdentifier(this._was.Waste);
|
||||
this._was.Waste.Add(waste);
|
||||
}
|
||||
else
|
||||
{
|
||||
waste.IsDirty = true;
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(4)) waste.WasteDescription = reader.GetString(4);
|
||||
if (waste.WasteDescription.IsNullOrEmpty())
|
||||
waste.WasteDescription = "-";
|
||||
|
||||
if (!reader.IsDBNull(5)) o = reader.GetValue(5); else o = null;
|
||||
if (o != null) waste.WasteDisposalAmount_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(6)) o = reader.GetValue(6); else o = null;
|
||||
if (o != null) waste.WasteCapacity_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(7)) o = reader.GetValue(7); else o = null;
|
||||
if (o != null) waste.WasteAmountRetained_MTQ = Convert.ToDouble(o);
|
||||
|
||||
if (!reader.IsDBNull(8)) waste.WasteDisposalPort = reader.GetString(8);
|
||||
|
||||
if (!reader.IsDBNull(9)) o = reader.GetValue(9); else o = null;
|
||||
if (o != null) waste.WasteAmountGeneratedTillNextPort_MTQ = Convert.ToDouble(o);
|
||||
|
||||
importWasteList.Add(waste);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
} while (reader.NextResult());
|
||||
}
|
||||
@ -526,7 +534,7 @@ namespace ENI2.DetailViewControls
|
||||
if (importWasteList.Count > 0)
|
||||
{
|
||||
this.dataGridWaste.Items.Refresh();
|
||||
this.SublistElementChanged(Message.NotificationClass.SEC);
|
||||
this.SublistElementChanged(Message.NotificationClass.WAS);
|
||||
MessageBox.Show(String.Format(Properties.Resources.textWasteImported, importWasteList.Count), Properties.Resources.textCaptionInformation, MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1039,8 +1039,11 @@ namespace ENI2.Excel
|
||||
Waste waste = was.Waste[i];
|
||||
|
||||
if (waste.WasteType.HasValue)
|
||||
{
|
||||
WriteNumber(wasteCode, waste.WasteType.Value);
|
||||
WriteText(wastetype, waste.WasteTypeDisplay);
|
||||
if (WAS.WasteCodeDict.ContainsKey(waste.WasteType.Value.ToString()))
|
||||
WriteText(wastetype, WAS.WasteCodeDict[waste.WasteType.Value.ToString()]);
|
||||
}
|
||||
WriteText(wasteDescription, waste.WasteDescription);
|
||||
if (waste.WasteDisposalAmount_MTQ.HasValue)
|
||||
WriteNumber(wasteAmount, waste.WasteDisposalAmount_MTQ.Value);
|
||||
|
||||
@ -427,7 +427,7 @@ namespace bsmd.database
|
||||
List<DatabaseEntity> portAreas = pa.LoadList(reader);
|
||||
DBManager.allPortAreas = new Dictionary<string, PortArea>();
|
||||
foreach (PortArea aPa in portAreas)
|
||||
DBManager.allPortAreas.Add(aPa.Code, aPa);
|
||||
DBManager.allPortAreas[aPa.Code] = aPa; // TODO da gibt es doppelte Einträge
|
||||
}
|
||||
return DBManager.allPortAreas;
|
||||
}
|
||||
|
||||
@ -150,9 +150,7 @@ namespace bsmd.database
|
||||
{
|
||||
if(isDE)
|
||||
{
|
||||
if ((notificationClass == Message.NotificationClass.CREWD) ||
|
||||
(notificationClass == Message.NotificationClass.PASD) ||
|
||||
(notificationClass == Message.NotificationClass.STO)) continue;
|
||||
if (notificationClass == Message.NotificationClass.STO) continue;
|
||||
}
|
||||
if(isDK)
|
||||
{
|
||||
|
||||
@ -516,6 +516,14 @@ namespace bsmd.database
|
||||
|
||||
#region public convenience method
|
||||
|
||||
public Waste GetWasteForType(int wasteType)
|
||||
{
|
||||
foreach (Waste waste in this.Waste)
|
||||
if (waste.WasteType.HasValue && waste.WasteType.Value == wasteType)
|
||||
return waste;
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Waste> AddRemainingWasteTypes()
|
||||
{
|
||||
List<Waste> result = new List<Waste>();
|
||||
|
||||
@ -32,39 +32,16 @@ namespace bsmd.database
|
||||
[Browsable(false)]
|
||||
public WAS WAS { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
[Browsable(false)]
|
||||
[ShowReport]
|
||||
public string WasteTypeDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!WasteType.HasValue) return "";
|
||||
switch (WasteType.Value)
|
||||
{
|
||||
case 1: return "WASTE_OILS-SLUDGE";
|
||||
case 2: return "WASTE_OILS-BILGE_WATER";
|
||||
case 3: return "WASTE_OILS-OTHERS";
|
||||
case 4: return "GARBAGE-FOOD_WASTE";
|
||||
case 5: return "GARBATE-PLASTIC";
|
||||
case 6: return "GARBAGE-OTHER";
|
||||
case 7: return "SEWAGE";
|
||||
case 8: return "CARGO-ASSOCIATED_WASTE";
|
||||
case 9: return "CARGO-RESIDUES";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[ShowReport]
|
||||
[JsonIgnore]
|
||||
public string WasteTypeDisplayV4
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!WasteType.HasValue) return "";
|
||||
if (!WasteType.HasValue) return string.Empty;
|
||||
switch(WasteType.Value)
|
||||
{
|
||||
// "old" waste codes (pre V7), used to display old data
|
||||
case 1100: return "Oily residues (sludge)";
|
||||
case 1200: return "Oily bilge water";
|
||||
case 1300: return "Waste oil - others (specify)";
|
||||
@ -81,7 +58,7 @@ namespace bsmd.database
|
||||
case 5200: return "Cargo residues - Marpol Annex II";
|
||||
case 5300: return "Cargo residues - Marpol Annex V";
|
||||
|
||||
default: return "Others (specify)";
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,7 +68,14 @@ namespace bsmd.database
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0} {1}", WasteType, WasteTypeDisplayV4);
|
||||
if (!this.WasteType.HasValue) return string.Empty;
|
||||
string code = WasteTypeDisplayV4;
|
||||
if(code.IsNullOrEmpty())
|
||||
{
|
||||
if (WAS.WasteCodeDict.ContainsKey(this.WasteType.ToString()))
|
||||
code = WAS.WasteCodeDict[this.WasteType.ToString()];
|
||||
}
|
||||
return string.Format("{0} {1}", WasteType, code);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,27 +133,12 @@ namespace bsmd.database
|
||||
get
|
||||
{
|
||||
if (!this.WasteType.HasValue) return false;
|
||||
switch(this.WasteType.Value)
|
||||
foreach(string wasteCode in WAS.WasteCodes)
|
||||
{
|
||||
case 1100:
|
||||
case 1200:
|
||||
case 1300:
|
||||
case 2100:
|
||||
case 2200:
|
||||
case 2300:
|
||||
case 2311:
|
||||
case 2308:
|
||||
case 2313:
|
||||
case 2600:
|
||||
case 2309:
|
||||
case 3000:
|
||||
case 5100:
|
||||
case 5200:
|
||||
case 5300:
|
||||
if (wasteCode.Equals(this.WasteType.Value.ToString()))
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user