From ac85db006478731daab90029a8f2962b7b387021 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 22 Sep 2025 20:20:44 +0200 Subject: [PATCH] Fixed: - property descriptions integrated - booking_klt property added to calculations. --- .../src/components/layout/config/Property.vue | 10 ++- .../avatic/lcc/dto/generic/PropertyDTO.java | 33 +++++++ .../properties/SystemPropertyMappingId.java | 3 +- .../country/CountryPropertyRepository.java | 15 ++++ .../properties/PropertyRepository.java | 13 ++- .../lcc/service/access/PropertyService.java | 2 +- .../steps/HandlingCostCalculationService.java | 2 +- ...ialDetailPackagingPropertyTransformer.java | 3 + .../resources/master_data/01-properties.sql | 90 +++++++++---------- src/main/resources/master_data/02-country.sql | 10 +-- src/main/resources/schema.sql | 10 ++- 11 files changed, 130 insertions(+), 61 deletions(-) diff --git a/src/frontend/src/components/layout/config/Property.vue b/src/frontend/src/components/layout/config/Property.vue index 3852069..537fa36 100644 --- a/src/frontend/src/components/layout/config/Property.vue +++ b/src/frontend/src/components/layout/config/Property.vue @@ -2,8 +2,9 @@
-
{{ property.name }}:
-
Ext. Mapping: {{ property.external_mapping_id }}
+
{{ property.name }}:
+
{{ property.description }}
+
{{ property.external_mapping_id}}
@@ -43,10 +44,11 @@ import Dropdown from "@/components/UI/Dropdown.vue"; import IconButton from "@/components/UI/IconButton.vue"; import Tooltip from "@/components/UI/Tooltip.vue"; import {parseNumberFromString} from "@/common.js"; +import BasicBadge from "@/components/UI/BasicBadge.vue"; export default { name: "Property", - components: {Tooltip, IconButton, Dropdown, ToggleSwitch, PhGear, InputField}, + components: {BasicBadge, Tooltip, IconButton, Dropdown, ToggleSwitch, PhGear, InputField}, props: { property: { type: Object, @@ -199,6 +201,7 @@ export default { align-items: center; gap: 2.4rem; height: 8rem; + margin: 3.6rem 0 ; } .caption-column { @@ -206,6 +209,7 @@ export default { flex-direction: column; font-weight: 300; font-size: 1.4rem; + max-width: 60rem; } .caption-column-id { diff --git a/src/main/java/de/avatic/lcc/dto/generic/PropertyDTO.java b/src/main/java/de/avatic/lcc/dto/generic/PropertyDTO.java index ab7b633..bd01ed6 100644 --- a/src/main/java/de/avatic/lcc/dto/generic/PropertyDTO.java +++ b/src/main/java/de/avatic/lcc/dto/generic/PropertyDTO.java @@ -24,6 +24,15 @@ public class PropertyDTO { @JsonProperty("validation_rule") private String validationRule; + @JsonProperty("description") + private String description; + + @JsonProperty("property_group") + private String propertyGroup; + + @JsonProperty("sequence_number") + private Integer sequenceNumber; + public String getName() { return name; } @@ -79,4 +88,28 @@ public class PropertyDTO { public String getValidationRule() { return validationRule; } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getPropertyGroup() { + return propertyGroup; + } + + public void setPropertyGroup(String propertyGroup) { + this.propertyGroup = propertyGroup; + } + + public Integer getSequenceNumber() { + return sequenceNumber; + } + + public void setSequenceNumber(Integer sequenceNumber) { + this.sequenceNumber = sequenceNumber; + } } diff --git a/src/main/java/de/avatic/lcc/model/properties/SystemPropertyMappingId.java b/src/main/java/de/avatic/lcc/model/properties/SystemPropertyMappingId.java index f3f19dd..7041272 100644 --- a/src/main/java/de/avatic/lcc/model/properties/SystemPropertyMappingId.java +++ b/src/main/java/de/avatic/lcc/model/properties/SystemPropertyMappingId.java @@ -42,7 +42,8 @@ public enum SystemPropertyMappingId { KLT_HANDLING("GR handling KLT [EUR/HU]", "0,71 €"), GLT_HANDLING("GR handling GLT [EUR/HU]", "3,50 €"), - BOOKING("GLT/KLT booking & document handling [EUR/GR]", "3,50 €"), + BOOKING("GLT booking & document handling [EUR/GR]", "3,50 €"), + BOOKING_KLT("KLT booking & document handling [EUR/GR]", "0,35 €"), GLT_RELEASE("GLT release from storage [EUR/GLT release]", "2,23 €"), KLT_RELEASE("KLT release from storage [EUR/KLT release]", "1,12 €"), GLT_DISPATCH("GLT dispatch [EUR/GLT dispatch]", "1,61 €"), diff --git a/src/main/java/de/avatic/lcc/repositories/country/CountryPropertyRepository.java b/src/main/java/de/avatic/lcc/repositories/country/CountryPropertyRepository.java index ebe5f29..4e9fe97 100644 --- a/src/main/java/de/avatic/lcc/repositories/country/CountryPropertyRepository.java +++ b/src/main/java/de/avatic/lcc/repositories/country/CountryPropertyRepository.java @@ -65,8 +65,12 @@ public class CountryPropertyRepository { type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, type.is_required as is_required, + type.description as description, + type.property_group as propertyGroup, + type.sequence_number as sequenceNumber, draft.property_value as draftValue, valid.property_value as validValue + FROM country_property_type AS type LEFT JOIN ( SELECT cp.property_value, cp.country_property_type_id @@ -104,6 +108,10 @@ public class CountryPropertyRepository { type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, type.is_required as is_required, + type.is_required as is_required, + type.description as description, + type.property_group as propertyGroup, + type.sequence_number as sequenceNumber, MAX(CASE WHEN ps.state = 'DRAFT' THEN cp.property_value END) as draftValue, MAX(CASE WHEN ps.state = 'VALID' THEN cp.property_value END) as validValue FROM country_property_type AS type @@ -121,6 +129,9 @@ public class CountryPropertyRepository { String query = """ SELECT type.name as name, type.data_type as dataType, type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, type.is_required as is_required, + type.description as description, + type.property_group as propertyGroup, + type.sequence_number as sequenceNumber, property.property_value as draftValue, property.property_value as validValue FROM country_property_type AS type LEFT JOIN country_property AS property ON property.country_property_type_id = type.id @@ -161,6 +172,10 @@ public class CountryPropertyRepository { dto.setRequired(rs.getBoolean("is_required")); dto.setDataType(rs.getString("dataType")); + dto.setDescription(rs.getString("description")); + dto.setPropertyGroup(rs.getString("propertyGroup")); + dto.setSequenceNumber(rs.getInt("sequenceNumber")); + return dto; } } diff --git a/src/main/java/de/avatic/lcc/repositories/properties/PropertyRepository.java b/src/main/java/de/avatic/lcc/repositories/properties/PropertyRepository.java index 0b4917f..91d4717 100644 --- a/src/main/java/de/avatic/lcc/repositories/properties/PropertyRepository.java +++ b/src/main/java/de/avatic/lcc/repositories/properties/PropertyRepository.java @@ -92,13 +92,14 @@ public class PropertyRepository { String query = """ SELECT type.name as name, type.data_type as dataType, type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, + type.description as description, type.property_group as propertyGroup, type.sequence_number as sequenceNumber, MAX(CASE WHEN ps.state = ? THEN sp.property_value END) as draftValue, MAX(CASE WHEN ps.state = ? THEN sp.property_value END) as validValue FROM system_property_type AS type LEFT JOIN system_property AS sp ON sp.system_property_type_id = type.id LEFT JOIN property_set AS ps ON ps.id = sp.property_set_id AND ps.state IN (?, ?) - GROUP BY type.id, type.name, type.data_type, type.external_mapping_id, type.validation_rule - HAVING draftValue IS NOT NULL OR validValue IS NOT NULL ORDER BY type.name; + GROUP BY type.id, type.name, type.data_type, type.external_mapping_id, type.validation_rule, type.description, type.property_group, type.sequence_number + HAVING draftValue IS NOT NULL OR validValue IS NOT NULL ORDER BY type.property_group , type.sequence_number; """; return jdbcTemplate.query(query, new PropertyMapper(), ValidityPeriodState.DRAFT.name(), ValidityPeriodState.VALID.name(), ValidityPeriodState.DRAFT.name(), ValidityPeriodState.VALID.name()); @@ -115,11 +116,12 @@ public class PropertyRepository { String query = """ SELECT type.name as name, type.data_type as dataType, type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, + type.description as description, type.property_group as propertyGroup, type.sequence_number as sequenceNumber, NULL as draftValue, property.property_value as validValue FROM system_property_type AS type LEFT JOIN system_property AS property ON property.system_property_type_id = type.id LEFT JOIN property_set AS propertySet ON propertySet.id = property.property_set_id - WHERE propertySet.id = ? AND (propertySet.state = ? OR propertySet.state = ?) ORDER BY type.name; + WHERE propertySet.id = ? AND (propertySet.state = ? OR propertySet.state = ?) ORDER BY type.property_group , type.sequence_number; """; return jdbcTemplate.query(query, new PropertyMapper(), propertySetId, ValidityPeriodState.EXPIRED.name(), ValidityPeriodState.INVALID.name()); @@ -129,6 +131,7 @@ public class PropertyRepository { public Optional getPropertyByMappingId(SystemPropertyMappingId mappingId) { String query = """ SELECT type.name as name, type.data_type as dataType, type.external_mapping_id as externalMappingId, type.validation_rule as validationRule, + type.description as description, type.property_group as propertyGroup, type.sequence_number as sequenceNumber, property.property_value as draftValue, property.property_value as validValue FROM system_property_type AS type LEFT JOIN system_property AS property ON property.system_property_type_id = type.id @@ -190,6 +193,10 @@ public class PropertyRepository { dto.setRequired(true); dto.setDataType(rs.getString("dataType")); + dto.setDescription(rs.getString("description")); + dto.setPropertyGroup(rs.getString("propertyGroup")); + dto.setSequenceNumber(rs.getInt("sequenceNumber")); + return dto; } } diff --git a/src/main/java/de/avatic/lcc/service/access/PropertyService.java b/src/main/java/de/avatic/lcc/service/access/PropertyService.java index 380b5c5..b415328 100644 --- a/src/main/java/de/avatic/lcc/service/access/PropertyService.java +++ b/src/main/java/de/avatic/lcc/service/access/PropertyService.java @@ -147,7 +147,7 @@ public class PropertyService { private Object convertStringByDataType(String value, String dataType) { return switch (dataType.toUpperCase()) { - case "TEXT" -> value; + case "TEXT", "ENUMERATION" -> value; case "CURRENCY", "PERCENTAGE" -> Double.valueOf(value); case "BOOLEAN" -> Boolean.valueOf(value); case "INT" -> Integer.valueOf(value); diff --git a/src/main/java/de/avatic/lcc/service/calculation/execution/steps/HandlingCostCalculationService.java b/src/main/java/de/avatic/lcc/service/calculation/execution/steps/HandlingCostCalculationService.java index bef9df3..b4bcd82 100644 --- a/src/main/java/de/avatic/lcc/service/calculation/execution/steps/HandlingCostCalculationService.java +++ b/src/main/java/de/avatic/lcc/service/calculation/execution/steps/HandlingCostCalculationService.java @@ -57,7 +57,7 @@ public class HandlingCostCalculationService { BigDecimal disposal = destinationDisposal != null ? destinationDisposal : BigDecimal.valueOf(Double.parseDouble(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.DISPOSAL).orElseThrow().getCurrentValue())); BigDecimal wageFactor = BigDecimal.valueOf(Double.parseDouble(countryPropertyRepository.getByMappingIdAndCountryId(CountryPropertyMappingId.WAGE, destination.getCountryId()).orElseThrow().getCurrentValue())); - BigDecimal booking = BigDecimal.valueOf(Double.parseDouble(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.BOOKING).orElseThrow().getCurrentValue())); + BigDecimal booking = BigDecimal.valueOf(Double.parseDouble(propertyRepository.getPropertyByMappingId(SystemPropertyMappingId.BOOKING_KLT).orElseThrow().getCurrentValue())); return new HandlingResult(LoadCarrierType.SLC, getRepackingCost(hu, loadCarrierType, addRepackingCosts, destinationRepacking).multiply(huAnnualAmount), diff --git a/src/main/java/de/avatic/lcc/service/transformer/material/MaterialDetailPackagingPropertyTransformer.java b/src/main/java/de/avatic/lcc/service/transformer/material/MaterialDetailPackagingPropertyTransformer.java index 3cd00df..f9c2d94 100644 --- a/src/main/java/de/avatic/lcc/service/transformer/material/MaterialDetailPackagingPropertyTransformer.java +++ b/src/main/java/de/avatic/lcc/service/transformer/material/MaterialDetailPackagingPropertyTransformer.java @@ -30,6 +30,9 @@ public class MaterialDetailPackagingPropertyTransformer { dto.setExternalMappingId(property.getType().getExternalMappingId()); dto.setValidationRule(property.getType().getValidationRule()); + + + return dto; } diff --git a/src/main/resources/master_data/01-properties.sql b/src/main/resources/master_data/01-properties.sql index 177236c..830ae2a 100644 --- a/src/main/resources/master_data/01-properties.sql +++ b/src/main/resources/master_data/01-properties.sql @@ -5,51 +5,51 @@ -- Description -> name -- =================================================== -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Reference route: Port of origin', 'START_REF', 'TEXT', '{}','Reference route used to demonstrate sea freight fluctuation, port in country of origin','Reference route','1'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Reference route: Port of destination', 'END_REF', 'TEXT', '{}','Reference route used to demonstrate sea freight fluctuation, port in country of destination','Reference route','2'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'All-time-high container rate (40 ft.) [EUR]', 'RISK_REF', 'CURRENCY', '{"GT":0}','Highest container rate to be used to demnastrate sea freight fluctuation, cost for 40 Ft. (FEU) general purpose container','Reference route','3'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'All-time-low container rate (40 ft.) [EUR]', 'CHANCE_REF', 'CURRENCY', '{"GT":0}','Lowest container rate to be used to demnastrate sea freight fluctuation, cost for 40 Ft. (FEU) general purpose container','Reference route','4'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Payment terms [days]', 'PAYMENT_TERMS', 'INT', '{}','Payment target [days] agreed with suppliers','General','3'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Annual working days', 'WORKDAYS', 'INT', '{"GT": 0, "LT": 366}','Annual working days (production)','General','2'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Interest rate inventory [%]', 'INTEREST_RATE', 'PERCENTAGE', '{"GTE": 0}','Calculatory interest rate for inventories and payment targets','General','4'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'FCA fee [%]', 'FCA_FEE', 'PERCENTAGE', '{"GTE": 0}','FCA fee to be added on EXW prices (MEK_A)','General','5'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Default customs rate [%]', 'TARIFF_RATE', 'PERCENTAGE', '{"GTE":0}','Customs rate to be applied, if no exact value is available','General','6'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Customs clearance fee per import & HS code [EUR]', 'CUSTOM_FEE', 'CURRENCY', '{"GTE":0}','Average customs clearance fee charged for the import of one HS code per import (mixed container)','General','7'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Standard reporting format', 'REPORTING', 'ENUMERATION', '{"ENUM":["MEK_B","MEK_C"]}','Defines standard format for reports (MEK_B = excl. Risks, MEK_C = incl. risks)','General','1'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( '40 ft.', 'FEU', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','1'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( '20 ft.', 'TEU', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','2'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( '40 ft. HC', 'FEU_HQ', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','3'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Container utilization in mixed containers [%]', 'CONTAINER_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Defines, to which degree the volume of a mixed container shall be utilized (loss due to inefficient stacking and different packaging sizes).','Sea and road transport','6'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Truck utilization road transport EMEA [%]', 'TRUCK_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Defines, to which degree the volume of a truck shall be utilized (loss due to inefficient stacking and different packaging sizes).','Sea and road transport','8'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Max validity period of container freight rates [days]', 'VALID_DAYS', 'INT', '{"GT": 0}','Defines the maximum period of time, after which container freight rates cannot be used for calculations anymore.','General','8'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Metropolition region size (diameter) [km]', 'RADIUS_REGION', 'INT', '{"GT": 0}','Defines the average distance a supplier may have from a defined source (e.g. center of metropolitan area), for which a container rate is maintained.','General','9'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Min delivery frequency / year for containter transports', 'FREQ_MIN', 'INT', '{"GT": 0, "LT": 366}','Relevant for low runners; defines into how many deliveries a HU shall be split, if HU content >= yearly demand (e.g. 4 = 1/4 of yearly demand is allocated to a shipment)','General','10'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Max delivery frequency / year for containter transport', 'FREQ_MAX', 'INT', '{"GT": 0, "LT": 366}','Relevant for high runners; defines the maximum shipping frequency for sea shipments (e.g. 52 = weekly, 104 = 2x/week, 12 = monthly etc.)','General','11'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Max load 20 ft. container [kg]', 'TEU_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a TEU container.','Sea and road transport','4'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Max load 40 ft. container [kg]', 'FEU_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a FEU container. Can be also limited by local law (e.g. road transport weight in CN limited to 21 tons).','Sea and road transport','5'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Max load truck [kg]', 'TRUCK_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a truck (use standard type, usually 40-ton truck)','Sea and road transport','7'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Pre-carriage [EUR/kg]', 'AIR_PRECARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for pre-carriage to airport in country of origin','Air transport','1'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Pre-carriage handling [EUR]', 'AIR_HANDLING', 'CURRENCY', '{"GTE": 0}','For air transports only: one time costs for handling of air shipments (documents)','Air transport','2'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Main carriage [EUR/kg]', 'AIR_MAINCARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for flight. (use as reference route the flight route with the highest traffic, e.g. CN-DE)','Air transport','3'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Hand over fee [EUR]', 'AIR_HANDOVER_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: one time cost for handover of air shipment ','Air transport','4'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Customs clearance fee [EUR]', 'AIR_CUSTOM_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: one time cost for customs clearance of air shipment ','Air transport','5'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'On-carriage [EUR/kg]', 'AIR_ONCARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for on-carriage from airport to destination','Air transport','6'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Terminal handling fee [EUR/kg]', 'AIR_TERMINAL_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for handling of shipment in airport terminal','Air transport','7'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GR handling KLT [EUR/HU] (DE)', 'KLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Cost per KLT for the handling in the Goods Receipt area of a warehouse or plant; reference country: Germany','Warehouse','4'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GR handling GLT [EUR/HU] (DE)', 'GLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Cost per KLT for the handling in the Goods Receipt area of a warehouse or plant; reference country: Germany','Warehouse','5'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GLT booking & document handling [EUR/GR] (DE)', 'BOOKING', 'CURRENCY', '{"GTE": 0}','One time document handling fee for 1 GLT; reference country: Germany','Warehouse','2'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GLT release from storage [EUR/GLT release] (DE)', 'GLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one GLT from the storage; reference country: Germany','Warehouse','11'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'KLT release from storage [EUR/KLT release] (DE)', 'KLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one KLT from the storage; reference country: Germany','Warehouse','12'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GLT dispatch [EUR/GLT dispatch] (DE)', 'GLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to release one GLT from the storage; reference country: Germany','Warehouse','13'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'KLT dispacth [EUR/KLT dispatch] (DE)', 'KLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to release one KLT from the storage; reference country: Germany','Warehouse','14'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Repacking KLT, HU <15kg [EUR/HU] (DE)', 'KLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (<15 kg) from one-way to returnable empty; reference country: Germany','Warehouse','6'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Repacking KLT, HU >=15kg [EUR/HU] (DE)', 'KLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (>=15 kg) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','7'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Repacking GLT, HU <15kg [EUR/HU] (DE)', 'GLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (<15 kg) from oneway to returnable empty; reference country: Germany','Warehouse','8'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Repacking GLT, HU 15 - 2000kg [EUR/HU] (DE)', 'GLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (>=15 - 2000 kg) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','9'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Repacking GLT, HU >2000kg [EUR/HU] (DE)', 'GLT_REPACK_L', 'INT', '{"GTE": 0}','Cost to repack one GLT (> 2000 kg, e.g. counterweight) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','10'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'GLT disposal [EUR/GLT] (DE)', 'DISPOSAL', 'INT', '{"GTE": 0}','Cost to dispose one wooden pallet (value valid for all countries)','Warehouse','15'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'Space costs per cbm per night [EUR/cbm] (DE)', 'SPACE_COST', 'CURRENCY', '{"GTE": 0}','Cost per month for a standard storage bin (1,20 x 0,80 x 1,00 m)','Warehouse','1'); -INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sort_id) VALUES ( 'KLT booking & document handling [EUR/GR] (DE)', 'BOOKING_KLT', 'CURRENCY', '{"GTE": 0}','One time document handling fee for 1 KLT; reference country: Germany','Warehouse','3'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: Port of origin', 'START_REF', 'TEXT', '{}','Reference route used to demonstrate sea freight fluctuation, port in country of origin','Reference route','1'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: Port of destination', 'END_REF', 'TEXT', '{}','Reference route used to demonstrate sea freight fluctuation, port in country of destination','Reference route','2'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'All-time-high container rate (40 ft.) [EUR]', 'RISK_REF', 'CURRENCY', '{"GT":0}','Highest container rate to be used to demnastrate sea freight fluctuation, cost for 40 Ft. (FEU) general purpose container','Reference route','3'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'All-time-low container rate (40 ft.) [EUR]', 'CHANCE_REF', 'CURRENCY', '{"GT":0}','Lowest container rate to be used to demnastrate sea freight fluctuation, cost for 40 Ft. (FEU) general purpose container','Reference route','4'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Payment terms [days]', 'PAYMENT_TERMS', 'INT', '{}','Payment target [days] agreed with suppliers','General','3'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Annual working days', 'WORKDAYS', 'INT', '{"GT": 0, "LT": 366}','Annual working days (production)','General','2'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Interest rate inventory [%]', 'INTEREST_RATE', 'PERCENTAGE', '{"GTE": 0}','Calculatory interest rate for inventories and payment targets','General','4'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'FCA fee [%]', 'FCA_FEE', 'PERCENTAGE', '{"GTE": 0}','FCA fee to be added on EXW prices (MEK_A)','General','5'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Default customs rate [%]', 'TARIFF_RATE', 'PERCENTAGE', '{"GTE":0}','Customs rate to be applied, if no exact value is available','General','6'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Customs clearance fee per import & HS code [EUR]', 'CUSTOM_FEE', 'CURRENCY', '{"GTE":0}','Average customs clearance fee charged for the import of one HS code per import (mixed container)','General','7'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Standard reporting format', 'REPORTING', 'ENUMERATION', '{"ENUM":["MEK_B","MEK_C"]}','Defines standard format for reports (MEK_B = excl. Risks, MEK_C = incl. risks)','General','1'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '40 ft.', 'FEU', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','1'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '20 ft.', 'TEU', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','2'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '40 ft. HC', 'FEU_HQ', 'BOOLEAN', '{}','To be activated, if calculation shall be possible with this container size. Container rates to be maintained.','Sea and road transport','3'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Container utilization in mixed containers [%]', 'CONTAINER_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Defines, to which degree the volume of a mixed container shall be utilized (loss due to inefficient stacking and different packaging sizes).','Sea and road transport','6'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Truck utilization road transport EMEA [%]', 'TRUCK_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Defines, to which degree the volume of a truck shall be utilized (loss due to inefficient stacking and different packaging sizes).','Sea and road transport','8'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max validity period of container freight rates [days]', 'VALID_DAYS', 'INT', '{"GT": 0}','Defines the maximum period of time, after which container freight rates cannot be used for calculations anymore.','General','8'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Metropolition region size (diameter) [km]', 'RADIUS_REGION', 'INT', '{"GT": 0}','Defines the average distance a supplier may have from a defined source (e.g. center of metropolitan area), for which a container rate is maintained.','General','9'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Min delivery frequency / year for containter transports', 'FREQ_MIN', 'INT', '{"GT": 0, "LT": 366}','Relevant for low runners; defines into how many deliveries a HU shall be split, if HU content >= yearly demand (e.g. 4 = 1/4 of yearly demand is allocated to a shipment)','General','10'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max delivery frequency / year for containter transport', 'FREQ_MAX', 'INT', '{"GT": 0, "LT": 366}','Relevant for high runners; defines the maximum shipping frequency for sea shipments (e.g. 52 = weekly, 104 = 2x/week, 12 = monthly etc.)','General','11'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max load 20 ft. container [kg]', 'TEU_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a TEU container.','Sea and road transport','4'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max load 40 ft. container [kg]', 'FEU_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a FEU container. Can be also limited by local law (e.g. road transport weight in CN limited to 21 tons).','Sea and road transport','5'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max load truck [kg]', 'TRUCK_LOAD', 'INT', '{"GT": 0}','Defines the weight limit of a truck (use standard type, usually 40-ton truck)','Sea and road transport','7'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Pre-carriage [EUR/kg]', 'AIR_PRECARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for pre-carriage to airport in country of origin','Air transport','1'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Pre-carriage handling [EUR]', 'AIR_HANDLING', 'CURRENCY', '{"GTE": 0}','For air transports only: one time costs for handling of air shipments (documents)','Air transport','2'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Main carriage [EUR/kg]', 'AIR_MAINCARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for flight. (use as reference route the flight route with the highest traffic, e.g. CN-DE)','Air transport','3'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Hand over fee [EUR]', 'AIR_HANDOVER_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: one time cost for handover of air shipment ','Air transport','4'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Customs clearance fee [EUR]', 'AIR_CUSTOM_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: one time cost for customs clearance of air shipment ','Air transport','5'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'On-carriage [EUR/kg]', 'AIR_ONCARRIAGE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for on-carriage from airport to destination','Air transport','6'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Terminal handling fee [EUR/kg]', 'AIR_TERMINAL_FEE', 'CURRENCY', '{"GTE": 0}','For air transports only: cost per kg for handling of shipment in airport terminal','Air transport','7'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GR handling KLT [EUR/HU] (DE)', 'KLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Cost per KLT for the handling in the Goods Receipt area of a warehouse or plant; reference country: Germany','Warehouse','4'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GR handling GLT [EUR/HU] (DE)', 'GLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Cost per KLT for the handling in the Goods Receipt area of a warehouse or plant; reference country: Germany','Warehouse','5'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT booking & document handling [EUR/GR] (DE)', 'BOOKING', 'CURRENCY', '{"GTE": 0}','One time document handling fee for 1 GLT; reference country: Germany','Warehouse','2'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT release from storage [EUR/GLT release] (DE)', 'GLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one GLT from the storage; reference country: Germany','Warehouse','11'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT release from storage [EUR/KLT release] (DE)', 'KLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one KLT from the storage; reference country: Germany','Warehouse','12'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT dispatch [EUR/GLT dispatch] (DE)', 'GLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to release one GLT from the storage; reference country: Germany','Warehouse','13'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT dispatch [EUR/KLT dispatch] (DE)', 'KLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to release one KLT from the storage; reference country: Germany','Warehouse','14'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking KLT, HU <15kg [EUR/HU] (DE)', 'KLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (<15 kg) from one-way to returnable empty; reference country: Germany','Warehouse','6'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking KLT, HU >=15kg [EUR/HU] (DE)', 'KLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (>=15 kg) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','7'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU <15kg [EUR/HU] (DE)', 'GLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (<15 kg) from oneway to returnable empty; reference country: Germany','Warehouse','8'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU 15 - 2000kg [EUR/HU] (DE)', 'GLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (>=15 - 2000 kg) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','9'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU >2000kg [EUR/HU] (DE)', 'GLT_REPACK_L', 'INT', '{"GTE": 0}','Cost to repack one GLT (> 2000 kg, e.g. counterweight) from one-way to returnable empty with crane handling; reference country: Germany','Warehouse','10'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT disposal [EUR/GLT] (DE)', 'DISPOSAL', 'INT', '{"GTE": 0}','Cost to dispose one wooden pallet (value valid for all countries)','Warehouse','15'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Space costs per cbm per night [EUR/cbm] (DE)', 'SPACE_COST', 'CURRENCY', '{"GTE": 0}','Cost per month for a standard storage bin (1,20 x 0,80 x 1,00 m)','Warehouse','1'); +INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT booking & document handling [EUR/GR] (DE)', 'BOOKING_KLT', 'CURRENCY', '{"GTE": 0}','One time document handling fee for 1 KLT; reference country: Germany','Warehouse','3'); -- =================================================== diff --git a/src/main/resources/master_data/02-country.sql b/src/main/resources/master_data/02-country.sql index 7460ab9..31b1d91 100644 --- a/src/main/resources/master_data/02-country.sql +++ b/src/main/resources/master_data/02-country.sql @@ -22,12 +22,12 @@ WHERE NOT EXISTS ( -- ============================================================================= INSERT INTO `country_property_type` -(`name`, `external_mapping_id`, `data_type`, `validation_rule`, `is_required`) +(`name`, `external_mapping_id`, `data_type`, `validation_rule`, `is_required`, `description`, `property_group`, `sequence_number`) VALUES - ('Customs Union', 'UNION', 'ENUMERATION', '{ "ENUM" : ["EU", "NONE"]}', FALSE), - ('Safety Stock [working days]', 'SAFETY_STOCK', 'INT', '{"GTE": 0}', FALSE), - ('Air Freight Share [%]', 'AIR_SHARE', 'PERCENTAGE', '{"GTE": 0}', FALSE), - ('Wage Factor [%]', 'WAGE', 'PERCENTAGE', '{"GT": 0}', FALSE); + ('Customs Union', 'UNION', 'ENUMERATION', '{ "ENUM" : ["EU", "NONE"]}', FALSE, 'Custom union description', 'General', 1), + ('Safety Stock [working days]', 'SAFETY_STOCK', 'INT', '{"GTE": 0}', FALSE, 'Safety stock description', 'General', 2), + ('Air Freight Share [%]', 'AIR_SHARE', 'PERCENTAGE', '{"GTE": 0}', FALSE, 'Air freight description', 'General', 3), + ('Wage Factor [%]', 'WAGE', 'PERCENTAGE', '{"GT": 0}', FALSE, 'Wage factor description', 'General', 4); -- ============================================================================= -- 2. INSERT COUNTRIES diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql index 91a4d20..242ef87 100644 --- a/src/main/resources/schema.sql +++ b/src/main/resources/schema.sql @@ -21,8 +21,8 @@ CREATE TABLE IF NOT EXISTS `system_property_type` `name` VARCHAR(255) NOT NULL, `external_mapping_id` VARCHAR(16), `description` VARCHAR(255) NOT NULL, - `property_group` VARCHAR(32) NOT NULL, - `sort_id` INT, + `property_group` VARCHAR(32) NOT NULL, + `sequence_number` INT NOT NULL, `data_type` VARCHAR(16) NOT NULL, `validation_rule` VARCHAR(64), UNIQUE KEY `idx_external_mapping` (`external_mapping_id`), @@ -52,6 +52,9 @@ CREATE TABLE IF NOT EXISTS `country` `iso_code` CHAR(2) NOT NULL COMMENT 'ISO 3166-1 alpha-2 country code', `region_code` CHAR(5) NOT NULL COMMENT 'Geographic region code (EMEA/LATAM/APAC/NAM)', `name` VARCHAR(255) NOT NULL, + `description` VARCHAR(255) NOT NULL, + `property_group` VARCHAR(32) NOT NULL, + `sequence_number` INT NOT NULL, `is_deprecated` BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (`id`), UNIQUE KEY `uk_country_iso_code` (`iso_code`), @@ -308,6 +311,9 @@ CREATE TABLE IF NOT EXISTS packaging_property_type `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(255) NOT NULL, external_mapping_id VARCHAR(16) NOT NULL, + `description` VARCHAR(255) NOT NULL, + `property_group` VARCHAR(32) NOT NULL, + `sequence_number` INT NOT NULL, `data_type` VARCHAR(16), `validation_rule` VARCHAR(64), `is_required` BOOLEAN NOT NULL DEFAULT FALSE,