Add entities for calculations, countries, rates, and nodes

Introduced several domain model classes for the application including `CalculationJob` and its related entities, `Country`, `RegionCode`, `ContainerRate`, and `DistanceMatrix`. These classes provide comprehensive data structures for logistics calculations, geographical mappings, and rate management.
This commit is contained in:
Jan 2025-03-21 16:19:09 +01:00
parent d06bf1d881
commit c4d3933061
50 changed files with 3429 additions and 107 deletions

View file

@ -0,0 +1,106 @@
package de.avatic.lcc.model.calculations;
import de.avatic.lcc.model.premisses.Premiss;
import de.avatic.lcc.model.properties.PropertySet;
import de.avatic.lcc.model.user.SysUser;
import de.avatic.lcc.model.rates.ValidityPeriod;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.time.OffsetDateTime;
import java.util.Set;
@Table(name = "calculation_job")
public class CalculationJob {
@Id
private Integer id;
@NotNull
private OffsetDateTime calculationDate;
private CalculationJobState jobState;
@NotNull
private AggregateReference<Premiss,Integer> premiss;
@NotNull
private AggregateReference<ValidityPeriod, Integer> validityPeriod;
@NotNull
private AggregateReference<PropertySet,Integer> propertySet;
@NotNull
private AggregateReference<SysUser, Integer> user;
@MappedCollection(idColumn = "calculation_job_id")
private Set<CalculationJobSink> sinks;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public OffsetDateTime getCalculationDate() {
return calculationDate;
}
public void setCalculationDate(OffsetDateTime calculationDate) {
this.calculationDate = calculationDate;
}
public CalculationJobState getJobState() {
return jobState;
}
public void setJobState(CalculationJobState jobState) {
this.jobState = jobState;
}
public AggregateReference<Premiss, Integer> getPremiss() {
return premiss;
}
public void setPremiss(AggregateReference<Premiss, Integer> premiss) {
this.premiss = premiss;
}
public AggregateReference<ValidityPeriod, Integer> getValidityPeriod() {
return validityPeriod;
}
public void setValidityPeriod(AggregateReference<ValidityPeriod, Integer> validityPeriod) {
this.validityPeriod = validityPeriod;
}
public AggregateReference<PropertySet, Integer> getPropertySet() {
return propertySet;
}
public void setPropertySet(AggregateReference<PropertySet, Integer> propertySet) {
this.propertySet = propertySet;
}
public AggregateReference<SysUser, Integer> getUser() {
return user;
}
public void setUser(AggregateReference<SysUser, Integer> user) {
this.user = user;
}
public Set<CalculationJobSink> getSinks() {
return sinks;
}
public void setSinks(Set<CalculationJobSink> sinks) {
this.sinks = sinks;
}
}

View file

@ -0,0 +1,85 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_airfreight")
public class CalculationJobAirfreight {
@Id
private Integer id;
@NotNull
@Digits(integer = 7, fraction = 4)
private BigDecimal airFreightShareMax;
@NotNull
@Digits(integer = 7, fraction = 4)
private BigDecimal airFreightShare;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal airFreightVolumetricWeight;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal airFreightWeight;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualCost;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getAirFreightShareMax() {
return airFreightShareMax;
}
public void setAirFreightShareMax(BigDecimal airFreightShareMax) {
this.airFreightShareMax = airFreightShareMax;
}
public BigDecimal getAirFreightShare() {
return airFreightShare;
}
public void setAirFreightShare(BigDecimal airFreightShare) {
this.airFreightShare = airFreightShare;
}
public BigDecimal getAirFreightVolumetricWeight() {
return airFreightVolumetricWeight;
}
public void setAirFreightVolumetricWeight(BigDecimal airFreightVolumetricWeight) {
this.airFreightVolumetricWeight = airFreightVolumetricWeight;
}
public BigDecimal getAirFreightWeight() {
return airFreightWeight;
}
public void setAirFreightWeight(BigDecimal airFreightWeight) {
this.airFreightWeight = airFreightWeight;
}
public BigDecimal getAnnualCost() {
return annualCost;
}
public void setAnnualCost(BigDecimal annualCost) {
this.annualCost = annualCost;
}
}

View file

@ -0,0 +1,72 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_custom")
public class CalculationJobCustom {
@Id
private Integer id;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal customValue;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal customDuties;
@NotNull
@Digits(integer = 7, fraction = 4)
private BigDecimal customRate;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualCost;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getCustomValue() {
return customValue;
}
public void setCustomValue(BigDecimal customValue) {
this.customValue = customValue;
}
public BigDecimal getCustomDuties() {
return customDuties;
}
public void setCustomDuties(BigDecimal customDuties) {
this.customDuties = customDuties;
}
public BigDecimal getCustomRate() {
return customRate;
}
public void setCustomRate(BigDecimal customRate) {
this.customRate = customRate;
}
public BigDecimal getAnnualCost() {
return annualCost;
}
public void setAnnualCost(BigDecimal annualCost) {
this.annualCost = annualCost;
}
}

View file

@ -0,0 +1,70 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_handling")
public class CalculationJobHandling {
@Id
private Integer id;
private Boolean isSmallUnit;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualRepackingCost;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualHandlingCost;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualDisposalCost;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Boolean getSmallUnit() {
return isSmallUnit;
}
public void setSmallUnit(Boolean smallUnit) {
isSmallUnit = smallUnit;
}
public BigDecimal getAnnualRepackingCost() {
return annualRepackingCost;
}
public void setAnnualRepackingCost(BigDecimal annualRepackingCost) {
this.annualRepackingCost = annualRepackingCost;
}
public BigDecimal getAnnualHandlingCost() {
return annualHandlingCost;
}
public void setAnnualHandlingCost(BigDecimal annualHandlingCost) {
this.annualHandlingCost = annualHandlingCost;
}
public BigDecimal getAnnualDisposalCost() {
return annualDisposalCost;
}
public void setAnnualDisposalCost(BigDecimal annualDisposalCost) {
this.annualDisposalCost = annualDisposalCost;
}
}

View file

@ -0,0 +1,108 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_inventory")
public class CalculationJobInventory {
@Id
private Integer id;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal operationalStock;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal safetyStock;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal stockedInventory;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal inTransportStock;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal stockBeforePayment;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualCapitalCost;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualStorageCost;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getOperationalStock() {
return operationalStock;
}
public void setOperationalStock(BigDecimal operationalStock) {
this.operationalStock = operationalStock;
}
public BigDecimal getSafetyStock() {
return safetyStock;
}
public void setSafetyStock(BigDecimal safetyStock) {
this.safetyStock = safetyStock;
}
public BigDecimal getStockedInventory() {
return stockedInventory;
}
public void setStockedInventory(BigDecimal stockedInventory) {
this.stockedInventory = stockedInventory;
}
public BigDecimal getInTransportStock() {
return inTransportStock;
}
public void setInTransportStock(BigDecimal inTransportStock) {
this.inTransportStock = inTransportStock;
}
public BigDecimal getStockBeforePayment() {
return stockBeforePayment;
}
public void setStockBeforePayment(BigDecimal stockBeforePayment) {
this.stockBeforePayment = stockBeforePayment;
}
public BigDecimal getAnnualCapitalCost() {
return annualCapitalCost;
}
public void setAnnualCapitalCost(BigDecimal annualCapitalCost) {
this.annualCapitalCost = annualCapitalCost;
}
public BigDecimal getAnnualStorageCost() {
return annualStorageCost;
}
public void setAnnualStorageCost(BigDecimal annualStorageCost) {
this.annualStorageCost = annualStorageCost;
}
}

View file

@ -0,0 +1,48 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_risk")
public class CalculationJobRisk {
@Id
private Integer id;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualRiskCost;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualChanceCost;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getAnnualRiskCost() {
return annualRiskCost;
}
public void setAnnualRiskCost(BigDecimal annualRiskCost) {
this.annualRiskCost = annualRiskCost;
}
public BigDecimal getAnnualChanceCost() {
return annualChanceCost;
}
public void setAnnualChanceCost(BigDecimal annualChanceCost) {
this.annualChanceCost = annualChanceCost;
}
}

View file

@ -0,0 +1,184 @@
package de.avatic.lcc.model.calculations;
import de.avatic.lcc.model.premisses.PremissRouteSection;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_route_section")
public class CalculationJobRouteSection {
@Id
private Integer id;
private CalculationJobTransportationRuleType usedRule;
private Boolean isUnmixedPrice;
private Boolean isCbmPrice;
private Boolean isWeightPrice;
private Boolean isStacked;
private Boolean isPreRun;
private Boolean isMainRun;
private Boolean isPostRun;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal rate;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal distance;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal cbmPrice;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal weightPrice;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualCost;
@NotNull
@Digits(integer = 15, fraction = 2)
private Integer transitTime;
@NotNull
private AggregateReference<PremissRouteSection, Integer> premissRouteSection;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public CalculationJobTransportationRuleType getUsedRule() {
return usedRule;
}
public void setUsedRule(CalculationJobTransportationRuleType usedRule) {
this.usedRule = usedRule;
}
public Boolean getUnmixedPrice() {
return isUnmixedPrice;
}
public void setUnmixedPrice(Boolean unmixedPrice) {
isUnmixedPrice = unmixedPrice;
}
public Boolean getCbmPrice() {
return isCbmPrice;
}
public void setCbmPrice(BigDecimal cbmPrice) {
this.cbmPrice = cbmPrice;
}
public void setCbmPrice(Boolean cbmPrice) {
isCbmPrice = cbmPrice;
}
public Boolean getWeightPrice() {
return isWeightPrice;
}
public void setWeightPrice(BigDecimal weightPrice) {
this.weightPrice = weightPrice;
}
public BigDecimal getAnnualCost() {
return annualCost;
}
public void setAnnualCost(BigDecimal annualCost) {
this.annualCost = annualCost;
}
public Integer getTransitTime() {
return transitTime;
}
public void setTransitTime(Integer transitTime) {
this.transitTime = transitTime;
}
public AggregateReference<PremissRouteSection, Integer> getPremissRouteSection() {
return premissRouteSection;
}
public void setPremissRouteSection(AggregateReference<PremissRouteSection, Integer> premissRouteSection) {
this.premissRouteSection = premissRouteSection;
}
public void setWeightPrice(Boolean weightPrice) {
isWeightPrice = weightPrice;
}
public Boolean getStacked() {
return isStacked;
}
public void setStacked(Boolean stacked) {
isStacked = stacked;
}
public Boolean getPreRun() {
return isPreRun;
}
public void setPreRun(Boolean preRun) {
isPreRun = preRun;
}
public Boolean getMainRun() {
return isMainRun;
}
public void setMainRun(Boolean mainRun) {
isMainRun = mainRun;
}
public Boolean getPostRun() {
return isPostRun;
}
public void setPostRun(Boolean postRun) {
isPostRun = postRun;
}
public BigDecimal getRate() {
return rate;
}
public void setRate(BigDecimal rate) {
this.rate = rate;
}
public BigDecimal getDistance() {
return distance;
}
public void setDistance(BigDecimal distance) {
this.distance = distance;
}
}

View file

@ -0,0 +1,141 @@
package de.avatic.lcc.model.calculations;
import de.avatic.lcc.model.premisses.PremissSink;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "calculation_job_sink")
public class CalculationJobSink {
@Id
private Integer id;
@Unsigned
private Integer safetyStock;
@Unsigned
private Integer shippingFrequency;
@Digits(integer = 15, fraction = 2)
private BigDecimal totalCost;
@NotNull
private AggregateReference<PremissSink, Integer> premissSink;
@MappedCollection
@Column("calculation_job_transportation_id")
private CalculationJobTransportation transportation;
@Column("calculation_job_airfreight_id")
private CalculationJobAirfreight airfreight;
@Column("calculation_job_custom_id")
private CalculationJobCustom custom;
@Column("calculation_job_inventory_id")
private CalculationJobInventory inventory;
@Column("calculation_job_handling_id")
private CalculationJobHandling handling;
@Column("calculation_job_risk_id")
private CalculationJobRisk risk;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSafetyStock() {
return safetyStock;
}
public void setSafetyStock(Integer safetyStock) {
this.safetyStock = safetyStock;
}
public Integer getShippingFrequency() {
return shippingFrequency;
}
public void setShippingFrequency(Integer shippingFrequency) {
this.shippingFrequency = shippingFrequency;
}
public BigDecimal getTotalCost() {
return totalCost;
}
public void setTotalCost(BigDecimal totalCost) {
this.totalCost = totalCost;
}
public AggregateReference<PremissSink, Integer> getPremissSink() {
return premissSink;
}
public void setPremissSink(AggregateReference<PremissSink, Integer> premissSink) {
this.premissSink = premissSink;
}
public CalculationJobTransportation getTransportation() {
return transportation;
}
public void setTransportation(CalculationJobTransportation transportation) {
this.transportation = transportation;
}
public CalculationJobAirfreight getAirfreight() {
return airfreight;
}
public void setAirfreight(CalculationJobAirfreight airfreight) {
this.airfreight = airfreight;
}
public CalculationJobCustom getCustom() {
return custom;
}
public void setCustom(CalculationJobCustom custom) {
this.custom = custom;
}
public CalculationJobInventory getInventory() {
return inventory;
}
public void setInventory(CalculationJobInventory inventory) {
this.inventory = inventory;
}
public CalculationJobHandling getHandling() {
return handling;
}
public void setHandling(CalculationJobHandling handling) {
this.handling = handling;
}
public CalculationJobRisk getRisk() {
return risk;
}
public void setRisk(CalculationJobRisk risk) {
this.risk = risk;
}
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.calculations;
public enum CalculationJobState {
CREATED, SCHEDULED, VALID, INVALIDATED, EXCEPTION
}

View file

@ -0,0 +1,117 @@
package de.avatic.lcc.model.calculations;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
import java.util.Set;
@Table(name = "calculation_job_transportation")
public class CalculationJobTransportation {
@Id
private Integer id;
private CalculationJobTransportationType transportationType;
@Unsigned
@NotNull
private Integer huPerLayer;
@NotNull
private String layerStructure;
@Unsigned
@NotNull
private Integer layerCount;
private Boolean transportWeightExceeded;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal transportsPerYear;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal annualCost;
@MappedCollection(idColumn = "calculation_job_transportation_id")
private Set<CalculationJobRouteSection> sections;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public CalculationJobTransportationType getTransportationType() {
return transportationType;
}
public void setTransportationType(CalculationJobTransportationType transportationType) {
this.transportationType = transportationType;
}
public Integer getHuPerLayer() {
return huPerLayer;
}
public void setHuPerLayer(Integer huPerLayer) {
this.huPerLayer = huPerLayer;
}
public String getLayerStructure() {
return layerStructure;
}
public void setLayerStructure(String layerStructure) {
this.layerStructure = layerStructure;
}
public Integer getLayerCount() {
return layerCount;
}
public void setLayerCount(Integer layerCount) {
this.layerCount = layerCount;
}
public Boolean getTransportWeightExceeded() {
return transportWeightExceeded;
}
public void setTransportWeightExceeded(Boolean transportWeightExceeded) {
this.transportWeightExceeded = transportWeightExceeded;
}
public BigDecimal getTransportsPerYear() {
return transportsPerYear;
}
public void setTransportsPerYear(BigDecimal transportsPerYear) {
this.transportsPerYear = transportsPerYear;
}
public BigDecimal getAnnualCost() {
return annualCost;
}
public void setAnnualCost(BigDecimal annualCost) {
this.annualCost = annualCost;
}
public Set<CalculationJobRouteSection> getSections() {
return sections;
}
public void setSections(Set<CalculationJobRouteSection> sections) {
this.sections = sections;
}
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.calculations;
public enum CalculationJobTransportationRuleType {
CONTAINER, MATRIX
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.calculations;
public enum CalculationJobTransportationType {
TEU, FEU, HC, TRUCK
}

View file

@ -0,0 +1,70 @@
package de.avatic.lcc.model.country;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table("country")
public class Country {
@Id
private Integer id;
@NotNull
@Size(max=2)
private IsoCode isoCode;
@NotNull
@Size(max=5)
private RegionCode regionCode;
@NotNull
@Size(max=128)
private String name;
@NotNull
private Boolean isDeprecated;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public IsoCode getIsoCode() {
return isoCode;
}
public void setIsoCode(IsoCode isoCode) {
this.isoCode = isoCode;
}
public RegionCode getRegionCode() {
return regionCode;
}
public void setRegionCode(RegionCode regionCode) {
this.regionCode = regionCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getDeprecated() {
return isDeprecated;
}
public void setDeprecated(Boolean deprecated) {
isDeprecated = deprecated;
}
}

View file

@ -0,0 +1,50 @@
package de.avatic.lcc.model.country;
/**
* Represents ISO 3166-1 Alpha-2 country codes.
* These codes consist of two letters and uniquely identify a country or territory.
*/
public enum IsoCode {
AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ,
BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BR, BS, BT, BV, BW, BY, BZ,
CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ,
DE, DJ, DK, DM, DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR,
GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS, GT, GU, GW, GY,
HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP,
KE, KG, KH, KI, KM, KN, KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY,
MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ, MR, MS, MT, MU, MV, MW, MX, MY, MZ,
NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM, PN, PR, PS, PT, PW, PY,
QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SK, SL, SM, SN, SO, SR, SS, ST, SV, SX, SY, SZ,
TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ,
VA, VC, VE, VG, VI, VN, VU, WF, WS, YE, YT, ZA, ZM, ZW;
/**
* Converts a string to the corresponding IsoCode enum value.
*
* @param code The ISO code as a string
* @return The corresponding enum value
* @throws IllegalArgumentException if the specified code is invalid
*/
public static IsoCode fromString(String code) {
if (code != null) {
try {
return valueOf(code.toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Ungültiger ISO-Code: " + code, e);
}
}
throw new IllegalArgumentException("ISO-Code darf nicht null sein");
}
/**
* Returns the ISO code as a string.
*
* @return The ISO code as a string
*/
public String getCode() {
return name();
}
}

View file

@ -0,0 +1,57 @@
package de.avatic.lcc.model.country;
/**
* Repräsentiert die geografischen Regionen für Länderklassifizierungen.
* EMEA - Europa, Mittlerer Osten und Afrika
* APAC - Asien und Pazifikraum
* LATAM - Lateinamerika
* NAM - Nordamerika
*/
public enum RegionCode {
EMEA("Europa, Mittlerer Osten und Afrika"),
APAC("Asien und Pazifikraum"),
LATAM("Lateinamerika"),
NAM("Nordamerika");
private final String beschreibung;
RegionCode(String beschreibung) {
this.beschreibung = beschreibung;
}
/**
* Gibt die Beschreibung der Region zurück.
*
* @return Die ausführliche Beschreibung der Region
*/
public String getBeschreibung() {
return beschreibung;
}
/**
* Konvertiert einen String in den entsprechenden RegionCode Enum-Wert.
*
* @param code Der Regions-Code als String
* @return Der entsprechende Enum-Wert
* @throws IllegalArgumentException wenn der angegebene Code ungültig ist
*/
public static RegionCode fromString(String code) {
if (code != null) {
try {
return valueOf(code.toUpperCase());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Ungültiger Regions-Code: " + code, e);
}
}
throw new IllegalArgumentException("Regions-Code darf nicht null sein");
}
/**
* Gibt den Regions-Code als String zurück.
*
* @return Der Regions-Code als String
*/
public String getCode() {
return name();
}
}

View file

@ -0,0 +1,80 @@
package de.avatic.lcc.model.materials;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table("material")
public class Material {
@Id
private Integer id;
@NotNull
@Size(max = 12)
private String partNumber;
@NotNull
@Size(max = 12)
private String normalizedPartNumber;
@Size(max = 8)
private String hsCode;
@NotNull
@Size(max = 500)
private String name;
@NotNull
private Boolean isDeprecated;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPartNumber() {
return partNumber;
}
public void setPartNumber(String partNumber) {
this.partNumber = partNumber;
}
public String getNormalizedPartNumber() {
return normalizedPartNumber;
}
public void setNormalizedPartNumber(String normalizedPartNumber) {
this.normalizedPartNumber = normalizedPartNumber;
}
public String getHsCode() {
return hsCode;
}
public void setHsCode(String hsCode) {
this.hsCode = hsCode;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getDeprecated() {
return isDeprecated;
}
public void setDeprecated(Boolean deprecated) {
isDeprecated = deprecated;
}
}

View file

@ -0,0 +1,136 @@
package de.avatic.lcc.model.nodes;
import jakarta.validation.constraints.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
@Table(name = "distance_matrix")
public class DistanceMatrix {
@Id
private Integer id;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-90.0000")
@DecimalMax("90.0000")
private BigDecimal fromGeoLat;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-180.0000")
@DecimalMax("180.0000")
private BigDecimal fromGeoLng;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-90.0000")
@DecimalMax("90.0000")
private BigDecimal toGeoLat;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-180.0000")
@DecimalMax("180.0000")
private BigDecimal toGeoLng;
@Digits(integer = 15, fraction = 2)
@NotNull
private BigDecimal distance;
private OffsetDateTime updatedAt;
@Size(max = 10)
private String state;
@NotNull
@Column("from_node_id")
private AggregateReference<Node,Integer> fromNode;
@NotNull
@Column("to_node_id")
private AggregateReference<Node,Integer> toNode;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getFromGeoLat() {
return fromGeoLat;
}
public void setFromGeoLat(BigDecimal fromGeoLat) {
this.fromGeoLat = fromGeoLat;
}
public BigDecimal getFromGeoLng() {
return fromGeoLng;
}
public void setFromGeoLng(BigDecimal fromGeoLng) {
this.fromGeoLng = fromGeoLng;
}
public BigDecimal getToGeoLat() {
return toGeoLat;
}
public void setToGeoLat(BigDecimal toGeoLat) {
this.toGeoLat = toGeoLat;
}
public BigDecimal getToGeoLng() {
return toGeoLng;
}
public void setToGeoLng(BigDecimal toGeoLng) {
this.toGeoLng = toGeoLng;
}
public BigDecimal getDistance() {
return distance;
}
public void setDistance(BigDecimal distance) {
this.distance = distance;
}
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public AggregateReference<Node, Integer> getFromNode() {
return fromNode;
}
public void setFromNode(AggregateReference<Node, Integer> fromNode) {
this.fromNode = fromNode;
}
public AggregateReference<Node, Integer> getToNode() {
return toNode;
}
public void setToNode(AggregateReference<Node, Integer> toNode) {
this.toNode = toNode;
}
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.nodes;
public enum DistanceMatrixState {
VALID, STALE
}

View file

@ -0,0 +1,174 @@
package de.avatic.lcc.model.nodes;
import de.avatic.lcc.model.country.Country;
import jakarta.validation.constraints.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Set;
@Table(name = "node")
public class Node {
@Id
private Integer id;
@NotNull
@Size(max = 255)
private String name;
@NotNull
@Size(max = 500)
private String address;
@Size(max = 32)
private String externalMappingId;
@NotNull
private Boolean predecessorRequired;
private Boolean isSink;
private Boolean isSource;
private Boolean isIntermediate;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-90.0000")
@DecimalMax("90.0000")
private BigDecimal geoLat;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-180.0000")
@DecimalMax("180.0000")
private BigDecimal geoLng;
@NotNull
private OffsetDateTime updatedAt;
@NotNull
private Boolean isDeprecated;
@Column("country_id")
@NotNull
private AggregateReference<Country,Integer> country;
@MappedCollection(idColumn = "node_id", keyColumn = "sequence_number")
private List<NodePredecessor> nodePredecessors;
@MappedCollection(idColumn = "node_id")
private Set<OutboundCountryMapping> outboundCountryMapping;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getExternalMappingId() {
return externalMappingId;
}
public void setExternalMappingId(String externalMappingId) {
this.externalMappingId = externalMappingId;
}
public Boolean getPredecessorRequired() {
return predecessorRequired;
}
public void setPredecessorRequired(Boolean predecessorRequired) {
this.predecessorRequired = predecessorRequired;
}
public Boolean getSink() {
return isSink;
}
public void setSink(Boolean sink) {
isSink = sink;
}
public Boolean getSource() {
return isSource;
}
public void setSource(Boolean source) {
isSource = source;
}
public Boolean getIntermediate() {
return isIntermediate;
}
public void setIntermediate(Boolean intermediate) {
isIntermediate = intermediate;
}
public BigDecimal getGeoLat() {
return geoLat;
}
public void setGeoLat(BigDecimal geoLat) {
this.geoLat = geoLat;
}
public BigDecimal getGeoLng() {
return geoLng;
}
public void setGeoLng(BigDecimal geoLng) {
this.geoLng = geoLng;
}
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public Boolean getDeprecated() {
return isDeprecated;
}
public void setDeprecated(Boolean deprecated) {
isDeprecated = deprecated;
}
public AggregateReference<Country, Integer> getCountry() {
return country;
}
public void setCountry(AggregateReference<Country, Integer> country) {
this.country = country;
}
}

View file

@ -0,0 +1,35 @@
package de.avatic.lcc.model.nodes;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "node_predecessor")
public class NodePredecessor {
@Id
private Integer id;
@NotNull
@Column("predecessor_node_id")
private AggregateReference<Node,Integer> predecessorNode;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public AggregateReference<Node, Integer> getPredecessorNode() {
return predecessorNode;
}
public void setPredecessorNode(AggregateReference<Node, Integer> predecessorNode) {
this.predecessorNode = predecessorNode;
}
}

View file

@ -0,0 +1,33 @@
package de.avatic.lcc.model.nodes;
import de.avatic.lcc.model.country.Country;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "outbound_country_mapping")
public class OutboundCountryMapping {
@Id
private Integer id;
@NotNull
private Country country;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Country getCountry() {
return country;
}
public void setCountry(Country country) {
this.country = country;
}
}

View file

@ -0,0 +1,16 @@
package de.avatic.lcc.model.packaging;
/**
* Represents the supported dimensional units in the system.
* This enum is used to specify the unit of measurement for dimensions
* in packaging-related classes and operations.
* <p>
* The supported dimensional units are:
* - M: Meters
* - CM: Centimeters
* - MM: Millimeters
*/
public enum DimensionUnit {
M, CM, MM
}

View file

@ -0,0 +1,176 @@
package de.avatic.lcc.model.packaging;
import de.avatic.lcc.model.materials.Material;
import de.avatic.lcc.model.nodes.Node;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.util.Set;
/**
* Represents a packaging entity in the system. This class defines various
* attributes related to a packaging, including its dimensions, weight, type,
* and associations with other entities such as material and supplier nodes.
* It is used to manage packaging details in the application.
*
* The packaging entity contains details about its size, weight, and content,
* as well as its hierarchical relationship with other packaging or a parent
* packaging.
*/
@Table(name = "packaging")
public class Packaging {
@Id
private Integer id;
@NotNull
@Size(max = 3)
private PackagingType type;
@Unsigned
@NotNull
private Integer length;
@Unsigned
@NotNull
private Integer width;
@Unsigned
@NotNull
private Integer height;
@NotNull
private DimensionUnit displayedDimensionUnit;
@NotNull
private Integer weight;
@NotNull
private WeightUnit displayedWeightUnit;
@NotNull
private Integer contentUnitCount;
private Boolean isDeprecated;
@NotNull
private AggregateReference<Node,Integer> supplierNode;
@NotNull
private AggregateReference<Material, Integer> material;
private AggregateReference<Packaging, Integer> parent;
@MappedCollection(idColumn = "packaging_id")
private Set<PackagingProperty> properties;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public PackagingType getType() {
return type;
}
public void setType(PackagingType type) {
this.type = type;
}
public Integer getLength() {
return length;
}
public void setLength(Integer length) {
this.length = length;
}
public Integer getWidth() {
return width;
}
public void setWidth(Integer width) {
this.width = width;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public DimensionUnit getDisplayedDimensionUnit() {
return displayedDimensionUnit;
}
public void setDisplayedDimensionUnit(DimensionUnit displayedDimensionUnit) {
this.displayedDimensionUnit = displayedDimensionUnit;
}
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public WeightUnit getDisplayedWeightUnit() {
return displayedWeightUnit;
}
public void setDisplayedWeightUnit(WeightUnit displayedWeightUnit) {
this.displayedWeightUnit = displayedWeightUnit;
}
public Integer getContentUnitCount() {
return contentUnitCount;
}
public void setContentUnitCount(Integer contentUnitCount) {
this.contentUnitCount = contentUnitCount;
}
public Boolean getDeprecated() {
return isDeprecated;
}
public void setDeprecated(Boolean deprecated) {
isDeprecated = deprecated;
}
public AggregateReference<Node, Integer> getSupplierNode() {
return supplierNode;
}
public void setSupplierNode(AggregateReference<Node, Integer> supplierNode) {
this.supplierNode = supplierNode;
}
public AggregateReference<Material, Integer> getMaterial() {
return material;
}
public void setMaterial(AggregateReference<Material, Integer> material) {
this.material = material;
}
public AggregateReference<Packaging, Integer> getParent() {
return parent;
}
public void setParent(AggregateReference<Packaging, Integer> parent) {
this.parent = parent;
}
}

View file

@ -0,0 +1,22 @@
package de.avatic.lcc.model.packaging;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "packaging_property")
public class PackagingProperty {
@Id
private Integer id;
@Size(max = 500)
private String propertyValue;
@NotNull
private AggregateReference<PackagingPropertyType,Integer> packagingPropertyType;
}

View file

@ -0,0 +1,53 @@
package de.avatic.lcc.model.packaging;
import de.avatic.lcc.model.properties.PropertyDataType;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
/**
* Represents the type of a property used in packaging.
* This includes details such as its name, data type, validation rules, and whether the property is required.
*/
@Table("packaging_property_type")
public class PackagingPropertyType {
@Id
/**
* Unique identifier for the packaging property type.
*/
private Integer id;
@NotNull
@Size(max = 255)
/**
* Name of the property type.
* Must not be null and must not exceed 255 characters.
*/
private String name;
@Size(max = 16)
/**
* The data type of the property, defining the kind of value it holds.
* Must not exceed 16 characters.
*/
private PropertyDataType dataType;
@Size(max = 64)
/**
* Optional validation rule specifying restrictions or patterns for this property type.
* Must not exceed 64 characters.
*/
private String validationRule;
@NotNull
/**
* Indicates whether the property is mandatory (true) or optional (false).
* Must not be null.
*/
private Boolean isRequired;
}

View file

@ -0,0 +1,6 @@
package de.avatic.lcc.model.packaging;
public enum PackagingType {
SHU, HU
}

View file

@ -0,0 +1,19 @@
package de.avatic.lcc.model.packaging;
/**
* Represents the supported units of weight measurement in the system.
* This enum is utilized to specify the weight unit for various entities
* such as packaging and related operations.
* <p>
* The supported weight units are:
* - T: Tons
* - KG: Kilograms
* - G: Grams
*/
public enum WeightUnit {
T,
KG,
G
}

View file

@ -0,0 +1,299 @@
package de.avatic.lcc.model.premisses;
import de.avatic.lcc.model.materials.Material;
import de.avatic.lcc.model.nodes.Node;
import de.avatic.lcc.model.packaging.DimensionUnit;
import de.avatic.lcc.model.packaging.Packaging;
import de.avatic.lcc.model.packaging.WeightUnit;
import de.avatic.lcc.model.user.SysUser;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.Set;
@Table(name = "premiss")
public class Premiss {
@Id
private Integer id;
private OffsetDateTime createdAt;
private OffsetDateTime updatedAt;
@Digits(integer = 15, fraction = 2)
private BigDecimal materialCost;
private Boolean isFcaEnabled;
@Digits(integer = 7, fraction = 2)
private BigDecimal overseaShare;
@Size(max = 8)
private String hsCode;
@Digits(integer = 7, fraction = 2)
private BigDecimal customRate;
@Size(max = 16)
private PremissState state;
@Unsigned
private Integer individualHuLength;
@Unsigned
private Integer individualHuHeight;
@Unsigned
private Integer individualHuWidth;
@Unsigned
private Integer individualHuWeight;
@Size(max = 2)
private DimensionUnit huDisplayedDimensionUnit;
@Size(max = 2)
private WeightUnit huDisplayedWeightUnit;
@Unsigned
private Integer huUnitCount;
private Boolean huStackable;
private Boolean huMixable;
@MappedCollection(idColumn = "premiss_id")
private Set<PremissSink> sinks;
@NotNull
@Column("material_id")
private AggregateReference<Material, Integer> material;
@Column("supplier_node_id")
private AggregateReference<Node, Integer> supplierNode;
@Column("user_supplier_node_id")
private AggregateReference<Node, Integer> userSupplierNode;
@Column("packaging_id")
private AggregateReference<Packaging, Integer> packaging;
@NotNull
private AggregateReference<SysUser, Integer> user;
@MappedCollection(idColumn = "premiss_id")
private Set<PremissSink> premissPremissSinks;
public Set<PremissSink> getSinks() {
return sinks;
}
public void setSinks(Set<PremissSink> sinks) {
this.sinks = sinks;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public OffsetDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(OffsetDateTime createdAt) {
this.createdAt = createdAt;
}
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}
public BigDecimal getMaterialCost() {
return materialCost;
}
public void setMaterialCost(BigDecimal materialCost) {
this.materialCost = materialCost;
}
public Boolean getFcaEnabled() {
return isFcaEnabled;
}
public void setFcaEnabled(Boolean fcaEnabled) {
isFcaEnabled = fcaEnabled;
}
public BigDecimal getOverseaShare() {
return overseaShare;
}
public void setOverseaShare(BigDecimal overseaShare) {
this.overseaShare = overseaShare;
}
public String getHsCode() {
return hsCode;
}
public void setHsCode(String hsCode) {
this.hsCode = hsCode;
}
public BigDecimal getCustomRate() {
return customRate;
}
public void setCustomRate(BigDecimal customRate) {
this.customRate = customRate;
}
public PremissState getState() {
return state;
}
public void setState(PremissState state) {
this.state = state;
}
public Integer getIndividualHuLength() {
return individualHuLength;
}
public void setIndividualHuLength(Integer individualHuLength) {
this.individualHuLength = individualHuLength;
}
public Integer getIndividualHuHeight() {
return individualHuHeight;
}
public void setIndividualHuHeight(Integer individualHuHeight) {
this.individualHuHeight = individualHuHeight;
}
public Integer getIndividualHuWidth() {
return individualHuWidth;
}
public void setIndividualHuWidth(Integer individualHuWidth) {
this.individualHuWidth = individualHuWidth;
}
public Integer getIndividualHuWeight() {
return individualHuWeight;
}
public void setIndividualHuWeight(Integer individualHuWeight) {
this.individualHuWeight = individualHuWeight;
}
public DimensionUnit getHuDisplayedDimensionUnit() {
return huDisplayedDimensionUnit;
}
public void setHuDisplayedDimensionUnit(DimensionUnit huDisplayedDimensionUnit) {
this.huDisplayedDimensionUnit = huDisplayedDimensionUnit;
}
public WeightUnit getHuDisplayedWeightUnit() {
return huDisplayedWeightUnit;
}
public void setHuDisplayedWeightUnit(WeightUnit huDisplayedWeightUnit) {
this.huDisplayedWeightUnit = huDisplayedWeightUnit;
}
public Integer getHuUnitCount() {
return huUnitCount;
}
public void setHuUnitCount(Integer huUnitCount) {
this.huUnitCount = huUnitCount;
}
public Boolean getHuStackable() {
return huStackable;
}
public void setHuStackable(Boolean huStackable) {
this.huStackable = huStackable;
}
public Boolean getHuMixable() {
return huMixable;
}
public void setHuMixable(Boolean huMixable) {
this.huMixable = huMixable;
}
public AggregateReference<Material, Integer> getMaterial() {
return material;
}
public void setMaterial(AggregateReference<Material, Integer> material) {
this.material = material;
}
public AggregateReference<Node, Integer> getSupplierNode() {
return supplierNode;
}
public void setSupplierNode(AggregateReference<Node, Integer> supplierNode) {
this.supplierNode = supplierNode;
}
public AggregateReference<Node, Integer> getUserSupplierNode() {
return userSupplierNode;
}
public void setUserSupplierNode(AggregateReference<Node, Integer> userSupplierNode) {
this.userSupplierNode = userSupplierNode;
}
public AggregateReference<Packaging, Integer> getPackaging() {
return packaging;
}
public void setPackaging(AggregateReference<Packaging, Integer> packaging) {
this.packaging = packaging;
}
public AggregateReference<SysUser, Integer> getUser() {
return user;
}
public void setUser(AggregateReference<SysUser, Integer> user) {
this.user = user;
}
public Set<PremissSink> getPremissPremissSinks() {
return premissPremissSinks;
}
public void setPremissPremissSinks(Set<PremissSink> premissPremissSinks) {
this.premissPremissSinks = premissPremissSinks;
}
}

View file

@ -0,0 +1,87 @@
package de.avatic.lcc.model.premisses;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.util.List;
import java.util.Set;
@Table(name = "premiss_route")
public class PremissRoute {
@Id
private Integer id;
private Boolean isFastest;
private Boolean isCheapest;
private Boolean isSelected;
@MappedCollection
private PremissSink premissSink;
@MappedCollection(idColumn = "premiss_route_id", keyColumn = "list_position")
private List<PremissRouteSection> sections;
@MappedCollection(idColumn = "premiss_route_id")
private Set<PremissRouteNode> nodes;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Boolean getFastest() {
return isFastest;
}
public void setFastest(Boolean fastest) {
isFastest = fastest;
}
public Boolean getCheapest() {
return isCheapest;
}
public void setCheapest(Boolean cheapest) {
isCheapest = cheapest;
}
public Boolean getSelected() {
return isSelected;
}
public void setSelected(Boolean selected) {
isSelected = selected;
}
public PremissSink getPremissSink() {
return premissSink;
}
public void setPremissSink(PremissSink premissSink) {
this.premissSink = premissSink;
}
public List<PremissRouteSection> getSections() {
return sections;
}
public void setSections(List<PremissRouteSection> sections) {
this.sections = sections;
}
public Set<PremissRouteNode> getNodes() {
return nodes;
}
public void setNodes(Set<PremissRouteNode> nodes) {
this.nodes = nodes;
}
}

View file

@ -0,0 +1,135 @@
package de.avatic.lcc.model.premisses;
import de.avatic.lcc.model.nodes.Node;
import de.avatic.lcc.model.user.SysUserNode;
import jakarta.validation.constraints.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "premiss_route_node")
public class PremissRouteNode {
@Id
private Integer id;
@NotNull
@Size(max = 255)
private String name;
@Size(max = 500)
private String address;
private Boolean isSink;
private Boolean isIntermediate;
private Boolean isSource;
@DecimalMin("-90")
@DecimalMax("90")
@Digits(integer = 7, fraction = 4)
private BigDecimal geoLat;
@DecimalMin("-180")
@DecimalMax("180")
@Digits(integer = 7, fraction = 4)
private BigDecimal geoLng;
private Boolean isOutdated;
private AggregateReference<Node,Integer> node;
private AggregateReference<SysUserNode,Integer> userNode;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Boolean getSink() {
return isSink;
}
public void setSink(Boolean sink) {
isSink = sink;
}
public Boolean getIntermediate() {
return isIntermediate;
}
public void setIntermediate(Boolean intermediate) {
isIntermediate = intermediate;
}
public Boolean getSource() {
return isSource;
}
public void setSource(Boolean source) {
isSource = source;
}
public BigDecimal getGeoLat() {
return geoLat;
}
public void setGeoLat(BigDecimal geoLat) {
this.geoLat = geoLat;
}
public BigDecimal getGeoLng() {
return geoLng;
}
public void setGeoLng(BigDecimal geoLng) {
this.geoLng = geoLng;
}
public Boolean getOutdated() {
return isOutdated;
}
public void setOutdated(Boolean outdated) {
isOutdated = outdated;
}
public AggregateReference<Node, Integer> getNode() {
return node;
}
public void setNode(AggregateReference<Node, Integer> node) {
this.node = node;
}
public AggregateReference<SysUserNode, Integer> getUserNode() {
return userNode;
}
public void setUserNode(AggregateReference<SysUserNode, Integer> userNode) {
this.userNode = userNode;
}
}

View file

@ -0,0 +1,122 @@
package de.avatic.lcc.model.premisses;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "premiss_route_section")
public class PremissRouteSection {
@Id
private Integer id;
@Unsigned
@NotNull
private Integer listPosition;
@Size(max = 16)
private PremissRouteSectionType transportType;
@Digits(integer = 15, fraction = 2)
private BigDecimal rateD2d;
private Boolean isPreRun;
private Boolean isMainRun;
private Boolean isPostRun;
private Boolean isOutdated;
@NotNull
private PremissRouteNode fromRouteNode;
@NotNull
private PremissRouteNode toRouteNode;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getListPosition() {
return listPosition;
}
public void setListPosition(Integer listPosition) {
this.listPosition = listPosition;
}
public PremissRouteSectionType getTransportType() {
return transportType;
}
public void setTransportType(PremissRouteSectionType transportType) {
this.transportType = transportType;
}
public BigDecimal getRateD2d() {
return rateD2d;
}
public void setRateD2d(BigDecimal rateD2d) {
this.rateD2d = rateD2d;
}
public Boolean getPreRun() {
return isPreRun;
}
public void setPreRun(Boolean preRun) {
isPreRun = preRun;
}
public Boolean getMainRun() {
return isMainRun;
}
public void setMainRun(Boolean mainRun) {
isMainRun = mainRun;
}
public Boolean getPostRun() {
return isPostRun;
}
public void setPostRun(Boolean postRun) {
isPostRun = postRun;
}
public Boolean getOutdated() {
return isOutdated;
}
public void setOutdated(Boolean outdated) {
isOutdated = outdated;
}
public PremissRouteNode getFromRouteNode() {
return fromRouteNode;
}
public void setFromRouteNode(PremissRouteNode fromRouteNode) {
this.fromRouteNode = fromRouteNode;
}
public PremissRouteNode getToRouteNode() {
return toRouteNode;
}
public void setToRouteNode(PremissRouteNode toRouteNode) {
this.toRouteNode = toRouteNode;
}
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.premisses;
public enum PremissRouteSectionType {
RAIL, SEA, POST_RUN, ROAD, D2D
}

View file

@ -0,0 +1,63 @@
package de.avatic.lcc.model.premisses;
import de.avatic.lcc.model.nodes.Node;
import jakarta.validation.constraints.NotNull;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.util.Set;
@Table(name = "premiss_sink")
public class PremissSink {
@Id
private Integer id;
@Unsigned
@NotNull
private Integer annualAmount;
@NotNull
@Column("sink_node_id")
private AggregateReference<Node,Integer> sinkNode;
@MappedCollection(idColumn = "premiss_sink_id")
private Set<PremissRoute> routes;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getAnnualAmount() {
return annualAmount;
}
public void setAnnualAmount(Integer annualAmount) {
this.annualAmount = annualAmount;
}
public AggregateReference<Node, Integer> getSinkNode() {
return sinkNode;
}
public void setSinkNode(AggregateReference<Node, Integer> sinkNode) {
this.sinkNode = sinkNode;
}
public Set<PremissRoute> getRoutes() {
return routes;
}
public void setRoutes(Set<PremissRoute> routes) {
this.routes = routes;
}
}

View file

@ -0,0 +1,6 @@
package de.avatic.lcc.model.premisses;
public enum PremissState {
DRAFT, COMPLETED, ARCHIVED, DELETED
}

View file

@ -0,0 +1,45 @@
package de.avatic.lcc.model.properties;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "country_property")
public class CountryProperty {
@Id
private Integer id;
@Size(max = 500)
private String propertyValue;
@Column("country_property_type")
private AggregateReference<CountryPropertyType, Integer> type;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPropertyValue() {
return propertyValue;
}
public void setPropertyValue(String propertyValue) {
this.propertyValue = propertyValue;
}
public AggregateReference<CountryPropertyType, Integer> getType() {
return type;
}
public void setType(AggregateReference<CountryPropertyType, Integer> type) {
this.type = type;
}
}

View file

@ -0,0 +1,77 @@
package de.avatic.lcc.model.properties;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table("country_property_type")
public class CountryPropertyType {
@Id
private Integer id;
@NotNull
@Size(max = 255)
private String name;
@Size(max = 16)
private String externalMappingId;
@NotNull
private PropertyDataType dataType;
@Size(max = 64)
private String validationRule;
private Boolean isRequired;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExternalMappingId() {
return externalMappingId;
}
public void setExternalMappingId(String externalMappingId) {
this.externalMappingId = externalMappingId;
}
public PropertyDataType getDataType() {
return dataType;
}
public void setDataType(PropertyDataType dataType) {
this.dataType = dataType;
}
public String getValidationRule() {
return validationRule;
}
public void setValidationRule(String validationRule) {
this.validationRule = validationRule;
}
public Boolean getRequired() {
return isRequired;
}
public void setRequired(Boolean required) {
isRequired = required;
}
}

View file

@ -0,0 +1,6 @@
package de.avatic.lcc.model.properties;
public enum PropertyDataType {
INT, BOOLEAN, CURRENCY, ENUMERATION, TEXT
}

View file

@ -0,0 +1,30 @@
package de.avatic.lcc.model.properties;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.time.OffsetDateTime;
import java.util.Set;
@Table(name = "property_set")
public class PropertySet {
@Id
private Integer id;
private OffsetDateTime startDate;
private OffsetDateTime endDate;
private PropertySetState state;
@MappedCollection(idColumn = "property_set_id")
private Set<SystemProperty> systemProperties;
@MappedCollection(idColumn = "property_set_id")
private Set<CountryProperty> countryProperties;
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.properties;
public enum PropertySetState {
DRAFT, VALID, INVALID, EXPIRED
}

View file

@ -0,0 +1,47 @@
package de.avatic.lcc.model.properties;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "system_property")
public class SystemProperty {
@Id
private Integer id;
@Size(max = 500)
private String propertyValue;
@NotNull
@Column("system_property_type_id")
private AggregateReference<SystemPropertyType,Integer> type;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPropertyValue() {
return propertyValue;
}
public void setPropertyValue(String propertyValue) {
this.propertyValue = propertyValue;
}
public AggregateReference<SystemPropertyType, Integer> getType() {
return type;
}
public void setType(AggregateReference<SystemPropertyType, Integer> type) {
this.type = type;
}
}

View file

@ -0,0 +1,68 @@
package de.avatic.lcc.model.properties;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table("system_property_type")
public class SystemPropertyType {
@Id
private Integer id;
@NotNull
@Size(max = 255)
private String name;
@Size(max = 16)
private String externalMappingId;
@NotNull
private PropertyDataType dataType;
@Size(max = 64)
private String validationRule;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExternalMappingId() {
return externalMappingId;
}
public void setExternalMappingId(String externalMappingId) {
this.externalMappingId = externalMappingId;
}
public PropertyDataType getDataType() {
return dataType;
}
public void setDataType(PropertyDataType dataType) {
this.dataType = dataType;
}
public String getValidationRule() {
return validationRule;
}
public void setValidationRule(String validationRule) {
this.validationRule = validationRule;
}
}

View file

@ -0,0 +1,111 @@
package de.avatic.lcc.model.rates;
import de.avatic.lcc.model.nodes.Node;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import jdk.jfr.Unsigned;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "container_rate")
public class ContainerRate {
@Id
private Integer id;
@Column("container_rate_type")
private ContainerRateType type;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal rateTeu;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal rateFeu;
@NotNull
@Digits(integer = 15, fraction = 2)
private BigDecimal rateHc;
@Unsigned
@NotNull
private Integer leadTime;
@NotNull
@Column("from_node_id")
private AggregateReference<Node,Integer> fromNode;
@NotNull
@Column("to_node_id")
private AggregateReference<Node,Integer>toNode;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public ContainerRateType getType() {
return type;
}
public void setType(ContainerRateType type) {
this.type = type;
}
public BigDecimal getRateTeu() {
return rateTeu;
}
public void setRateTeu(BigDecimal rateTeu) {
this.rateTeu = rateTeu;
}
public BigDecimal getRateFeu() {
return rateFeu;
}
public void setRateFeu(BigDecimal rateFeu) {
this.rateFeu = rateFeu;
}
public BigDecimal getRateHc() {
return rateHc;
}
public void setRateHc(BigDecimal rateHc) {
this.rateHc = rateHc;
}
public Integer getLeadTime() {
return leadTime;
}
public void setLeadTime(Integer leadTime) {
this.leadTime = leadTime;
}
public AggregateReference<Node, Integer> getFromNode() {
return fromNode;
}
public void setFromNode(AggregateReference<Node, Integer> fromNode) {
this.fromNode = fromNode;
}
public AggregateReference<Node, Integer> getToNode() {
return toNode;
}
public void setToNode(AggregateReference<Node, Integer> toNode) {
this.toNode = toNode;
}
}

View file

@ -0,0 +1,5 @@
package de.avatic.lcc.model.rates;
public enum ContainerRateType {
RAIL, SEA, POST_RUN, ROAD
}

View file

@ -0,0 +1,59 @@
package de.avatic.lcc.model.rates;
import de.avatic.lcc.model.country.Country;
import jakarta.validation.constraints.Digits;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "country_matrix_rate")
public class CountryMatrixRate {
@Id
private Integer id;
@Digits(integer = 15, fraction = 2)
private BigDecimal rate;
@NotNull
private AggregateReference<Country, Integer> fromCountry;
@NotNull
private AggregateReference<Country, Integer> toCountry;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public BigDecimal getRate() {
return rate;
}
public void setRate(BigDecimal rate) {
this.rate = rate;
}
public AggregateReference<Country, Integer> getFromCountry() {
return fromCountry;
}
public void setFromCountry(AggregateReference<Country, Integer> fromCountry) {
this.fromCountry = fromCountry;
}
public AggregateReference<Country, Integer> getToCountry() {
return toCountry;
}
public void setToCountry(AggregateReference<Country, Integer> toCountry) {
this.toCountry = toCountry;
}
}

View file

@ -0,0 +1,33 @@
package de.avatic.lcc.model.rates;
import de.avatic.lcc.model.properties.PropertySetState;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.time.OffsetDateTime;
import java.util.Set;
@Table(name = "validity_period")
public class ValidityPeriod {
@Id
private Integer id;
@NotNull
private OffsetDateTime startDate;
@NotNull
private OffsetDateTime endDate;
private PropertySetState state;
@MappedCollection(idColumn = "validity_period_id")
private Set<ContainerRate> containerRates;
@MappedCollection(idColumn = "validity_period_id")
private Set<CountryMatrixRate> countryMatrixRates;
}

View file

@ -0,0 +1,23 @@
package de.avatic.lcc.model.user;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "sys_group")
public class SysGroup {
@Id
private Integer id;
@NotNull
@Size(max = 64)
private String groupName;
@NotNull
@Size(max = 128)
private String groupDescription;
}

View file

@ -0,0 +1,94 @@
package de.avatic.lcc.model.user;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;
import org.springframework.data.relational.core.mapping.Table;
import java.util.Set;
@Table(name = "sys_user")
public class SysUser {
@Id
private Integer id;
@NotNull
@Size(max = 32)
private String workdayId;
@NotNull
@Size(max = 254)
private String email;
@NotNull
@Size(max = 100)
private String firstname;
@NotNull
@Size(max = 100)
private String lastname;
@MappedCollection(idColumn = "user_id")
private Set<SysUserGroupMapping> groups ;
private Boolean isActive;
public Integer getId() {
return id;
}
public void setId(final Integer id) {
this.id = id;
}
public String getWorkdayId() {
return workdayId;
}
public void setWorkdayId(final String workdayId) {
this.workdayId = workdayId;
}
public String getEmail() {
return email;
}
public void setEmail(final String email) {
this.email = email;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(final String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(final String lastname) {
this.lastname = lastname;
}
public Set<SysUserGroupMapping> getGroups() {
return groups;
}
public void setGroups(Set<SysUserGroupMapping> groups) {
this.groups = groups;
}
public Boolean getActive() {
return isActive;
}
public void setActive(Boolean active) {
isActive = active;
}
}

View file

@ -0,0 +1,35 @@
package de.avatic.lcc.model.user;
import jakarta.validation.constraints.NotNull;
import org.springframework.data.annotation.Id;
import org.springframework.data.jdbc.core.mapping.AggregateReference;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
@Table(name = "sys_user_group_mapping")
public class SysUserGroupMapping {
@Id
private Integer id;
@NotNull
@Column("group_id")
private AggregateReference<SysGroup,Integer> group;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public AggregateReference<SysGroup, Integer> getGroup() {
return group;
}
public void setGroup(AggregateReference<SysGroup, Integer> group) {
this.group = group;
}
}

View file

@ -0,0 +1,83 @@
package de.avatic.lcc.model.user;
import jakarta.validation.constraints.*;
import org.springframework.data.annotation.Id;
import org.springframework.data.relational.core.mapping.Table;
import java.math.BigDecimal;
@Table(name = "sys_user_node")
public class SysUserNode {
@Id
private Integer id;
@NotNull
@Size(max = 254)
private String name;
@NotNull
@Size(max = 500)
private String address;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-90.0000")
@DecimalMax("90.0000")
private BigDecimal geoLat;
@Digits(integer = 7, fraction = 4)
@DecimalMin("-180.0000")
@DecimalMax("180.0000")
private BigDecimal geoLng;
private Boolean isDeprecated;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public BigDecimal getGeoLat() {
return geoLat;
}
public void setGeoLat(BigDecimal geoLat) {
this.geoLat = geoLat;
}
public BigDecimal getGeoLng() {
return geoLng;
}
public void setGeoLng(BigDecimal geoLng) {
this.geoLng = geoLng;
}
public Boolean getDeprecated() {
return isDeprecated;
}
public void setDeprecated(Boolean deprecated) {
isDeprecated = deprecated;
}
}

View file

@ -210,9 +210,9 @@ CREATE TABLE container_rate
from_node_id INT NOT NULL,
to_node_id INT NOT NULL,
container_rate_type CHAR(8) CHECK (container_rate_type IN ('RAIL', 'SEA', 'POST-RUN', 'ROAD')),
rate_20 DECIMAL(15, 2) NOT NULL COMMENT 'rate for 20ft container in EUR',
rate_40 DECIMAL(15, 2) NOT NULL COMMENT 'rate for 40ft container in EUR',
rate_40_hc DECIMAL(15, 2) NOT NULL COMMENT 'rate for 40ft HQ container in EUR',
rate_teu DECIMAL(15, 2) NOT NULL COMMENT 'rate for 20ft container in EUR',
rate_feu DECIMAL(15, 2) NOT NULL COMMENT 'rate for 40ft container in EUR',
rate_hc DECIMAL(15, 2) NOT NULL COMMENT 'rate for 40ft HQ container in EUR',
lead_time INT UNSIGNED NOT NULL COMMENT 'lead time in days',
validity_period_id INT NOT NULL,
FOREIGN KEY (from_node_id) REFERENCES node (id),
@ -284,7 +284,7 @@ CREATE TABLE packaging_property_type
`name` VARCHAR(255) NOT NULL,
`data_type` VARCHAR(16),
`validation_rule` VARCHAR(64),
`is_required` BOOLEAN NOT NULl DEFAULT FALSE,
`is_required` BOOLEAN NOT NULL DEFAULT FALSE,
CONSTRAINT `chk_packaging_data_type_values` CHECK (`data_type` IN
('INT', 'PERCENTAGE', 'BOOLEAN', 'CURRENCY', 'ENUMERATION',
'TEXT'))
@ -317,11 +317,11 @@ CREATE TABLE premiss
oversea_share DECIMAL(7, 4),
hs_code CHAR(8),
custom_rate DECIMAL(7, 4),
state CHAR(10),
individual_hu_length INT UNSIGNED NOT NULL COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_height INT UNSIGNED NOT NULL COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_width INT UNSIGNED NOT NULL COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_weight INT UNSIGNED NOT NULL COMMENT 'user entered weight in g (if system-wide packaging is used, packaging weight are copied here after creation)',
state CHAR(10) DEFAULT 'DRAFT',
individual_hu_length INT UNSIGNED COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_height INT UNSIGNED COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_width INT UNSIGNED COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
individual_hu_weight INT UNSIGNED COMMENT 'user entered weight in g (if system-wide packaging is used, packaging weight are copied here after creation)',
hu_displayed_dimension_unit CHAR(2) DEFAULT 'MM',
hu_displayed_weight_unit CHAR(2) DEFAULT 'G',
hu_unit_count INT UNSIGNED DEFAULT NULL,
@ -371,7 +371,6 @@ CREATE TABLE premiss_route
CREATE TABLE premiss_route_node
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
premiss_route_id INT NOT NULL,
node_id INT DEFAULT NULL,
user_node_id INT DEFAULT NULL,
name VARCHAR(255) NOT NULL,
@ -382,10 +381,8 @@ CREATE TABLE premiss_route_node
geo_lat DECIMAL(7, 4) CHECK (geo_lat BETWEEN -90 AND 90),
geo_lng DECIMAL(7, 4) CHECK (geo_lng BETWEEN -180 AND 180),
is_outdated BOOLEAN DEFAULT FALSE,
FOREIGN KEY (premiss_route_id) REFERENCES premiss_route (id),
FOREIGN KEY (node_id) REFERENCES node (id),
FOREIGN KEY (user_node_id) REFERENCES sys_user_node (id),
INDEX idx_premiss_route_id (premiss_route_id),
INDEX idx_node_id (node_id),
INDEX idx_user_node_id (user_node_id),
CONSTRAINT `chk_node` CHECK (`user_node_id` IS NULL OR `node_id` IS NULL)
@ -445,27 +442,45 @@ CREATE TABLE calculation_job_sink
safety_stock INT UNSIGNED COMMENT 'safety stock in single pieces ?!?!',
shipping_frequency INT UNSIGNED COMMENT 'annual shipping frequency',
total_cost DECIMAL(15, 2) COMMENT 'aka MEK_B in EUR',
calculation_job_custom_id INT NOT NULL,
calculation_job_inventory_id INT NOT NULL,
calculation_job_handling_id INT NOT NULL,
calculation_job_risk_id INT NOT NULL,
calculation_job_material_id INT NOT NULL,
calculation_job_transportation_id INT NOT NULL,
calculation_job_airfreight_id INT NOT NULL,
FOREIGN KEY (calculation_job_id) REFERENCES calculation_job (id),
FOREIGN KEY (premiss_sink_id) REFERENCES premiss_sink (id),
FOREIGN KEY (calculation_job_custom_id) REFERENCES calculation_job_custom (id),
FOREIGN KEY (calculation_job_inventory_id) REFERENCES calculation_job_inventory (id),
FOREIGN KEY (calculation_job_handling_id) REFERENCES calculation_job_handling (id),
FOREIGN KEY (calculation_job_risk_id) REFERENCES calculation_job_risk (id),
FOREIGN KEY (calculation_job_material_id) REFERENCES calculation_job_material (id),
FOREIGN KEY (calculation_job_transportation_id) REFERENCES calculation_job_transportation (id),
FOREIGN KEY (calculation_job_airfreight_id) REFERENCES calculation_job_airfreight (id),
INDEX idx_calculation_job_id (calculation_job_id),
INDEX idx_premiss_sink_id (premiss_sink_id)
);
CREATE TABLE calculation_job_material
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
material_cost DECIMAL(15, 2) NOT NULL,
fca_cost DECIMAL(15, 2) NOT NULL
);
CREATE TABLE calculation_job_transportation
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
transportation_type CHAR(8) CHECK (transportation_type IN
('20', '40', '40HC', 'TRUCK')),
('TEU', 'FEU', 'HC', 'TRUCK')),
hu_per_layer INT UNSIGNED NOT NULL COMMENT 'number of handling units per layer',
layer_structure JSON NOT NULL COMMENT 'json representation of a single layer',
layer_count INT UNSIGNED NOT NULL COMMENT 'number of layers per full container or truck',
transport_weight_exceeded BOOLEAN DEFAULT FALSE COMMENT 'limiting factor: TRUE if weight limited or FALSE if volume limited',
transports_per_year DECIMAL(15, 2) NOT NULL COMMENT 'TODO: what is this?!',
annual_cost DECIMAL(15, 2) NOT NULL COMMENT 'total annual transportation costs in EUR',
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id),
INDEX idx_calculation_job_sink_id (calculation_job_sink_id)
annual_cost DECIMAL(15, 2) NOT NULL COMMENT 'total annual transportation costs in EUR'
);
CREATE TABLE calculation_job_route_section
@ -500,56 +515,47 @@ CREATE TABLE calculation_job_route_section
CREATE TABLE calculation_job_airfreight
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
air_freight_share_max DECIMAL(7, 4) NOT NULL,
air_freight_share DECIMAL(7, 4) NOT NULL,
air_freight_volumetric_weight DECIMAL(15, 2) NOT NULL,
air_freight_weight DECIMAL(15, 2) NOT NULL,
annual_cost DECIMAL(15, 2) NOT NULL,
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id)
annual_cost DECIMAL(15, 2) NOT NULL
);
CREATE TABLE calculation_job_custom
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
custom_value DECIMAL(15, 2) NOT NULL,-- Zollwert,
custom_duties DECIMAL(15, 2) NOT NULL,-- Zollabgaben,
custom_rate DECIMAL(7, 4) NOT NULL,-- Zollsatz,
annual_cost DECIMAL(15, 2) NOT NULL,-- Zollabgaben inkl. Einmalkosten,
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id)
annual_cost DECIMAL(15, 2) NOT NULL-- Zollabgaben inkl. Einmalkosten,
);
CREATE TABLE calculation_job_inventory
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
operational_stock DECIMAL(15, 2) NOT NULL COMMENT 'operational stock in single pieces',
safety_stock DECIMAL(15, 2) NOT NULL COMMENT 'safety stock in single pieces',
stocked_inventory DECIMAL(15, 2) NOT NULL COMMENT 'sum of operational and safety stock ?!',
in_transport_stock DECIMAL(15, 2) NOT NULL,
stock_before_payment DECIMAL(15, 2) NOT NULL,
annual_capital_cost DECIMAL(15, 2) NOT NULL,
annual_storage_cost DECIMAL(15, 2) NOT NULL, -- Flächenkosten,
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id)
annual_storage_cost DECIMAL(15, 2) NOT NULL -- Flächenkosten,
);
CREATE TABLE calculation_job_handling
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
is_small_unit BOOLEAN DEFAULT FALSE COMMENT 'small unit equals KLT, volume of a handling unit is smaller than 0.08 cbm ',
annual_repacking_cost DECIMAL(15, 2) NOT NULL,
annual_handling_cost DECIMAL(15, 2) NOT NULL,
annual_disposal_cost DECIMAL(15, 2) NOT NULL,
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id)
annual_disposal_cost DECIMAL(15, 2) NOT NULL
);
CREATE TABLE calculation_job_risk
(
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
calculation_job_sink_id INT NOT NULL,
annual_risk_cost DECIMAL(15, 2) NOT NULL COMMENT 'complete calculation with globally stored worst case container rates',
annual_chance_cost DECIMAL(15, 2) NOT NULL COMMENT 'complete calculation with globally stored best case container rates',
FOREIGN KEY (calculation_job_sink_id) REFERENCES calculation_job_sink (id)
annual_chance_cost DECIMAL(15, 2) NOT NULL COMMENT 'complete calculation with globally stored best case container rates'
);