Remove obsolete SQL scripts for country data and matrix rates
Deleted `data-country.sql` and `data-countrymatrixrate.sql` scripts as they are no longer utilized, streamlining the codebase and reducing redundancy.
This commit is contained in:
parent
270914b7cd
commit
ac7d72d19b
16 changed files with 1246608 additions and 50 deletions
|
|
@ -4,13 +4,11 @@ package de.avatic.lcc.model.country;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
|
||||||
|
|
||||||
|
|
||||||
@Table("country")
|
|
||||||
public class Country {
|
public class Country {
|
||||||
|
|
||||||
@Id
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@ package de.avatic.lcc.model.nodes;
|
||||||
import de.avatic.lcc.model.country.Country;
|
import de.avatic.lcc.model.country.Country;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
|
||||||
|
|
||||||
|
|
||||||
@Table(name = "outbound_country_mapping")
|
|
||||||
public class OutboundCountryMapping {
|
public class OutboundCountryMapping {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,35 @@
|
||||||
package de.avatic.lcc.model.user;
|
package de.avatic.lcc.model.user;
|
||||||
|
|
||||||
|
//
|
||||||
import jakarta.validation.constraints.NotNull;
|
//import jakarta.validation.constraints.NotNull;
|
||||||
import org.springframework.data.annotation.Id;
|
//import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
//import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||||
import org.springframework.data.relational.core.mapping.Column;
|
//import org.springframework.data.relational.core.mapping.Column;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
//import org.springframework.data.relational.core.mapping.Table;
|
||||||
@Deprecated
|
//
|
||||||
@Table(name = "sys_user_group_mapping")
|
//@Deprecated
|
||||||
public class SysUserGroupMapping {
|
//public class SysUserGroupMapping {
|
||||||
|
//
|
||||||
@Id
|
// @Id
|
||||||
private Integer id;
|
// private Integer id;
|
||||||
|
//
|
||||||
@NotNull
|
// @NotNull
|
||||||
@Column("group_id")
|
// @Column("group_id")
|
||||||
private AggregateReference<SysGroup,Integer> group;
|
// private AggregateReference<SysGroup,Integer> group;
|
||||||
|
//
|
||||||
public Integer getId() {
|
// public Integer getId() {
|
||||||
return id;
|
// return id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setId(Integer id) {
|
// public void setId(Integer id) {
|
||||||
this.id = id;
|
// this.id = id;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public AggregateReference<SysGroup, Integer> getGroup() {
|
// public AggregateReference<SysGroup, Integer> getGroup() {
|
||||||
return group;
|
// return group;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setGroup(AggregateReference<SysGroup, Integer> group) {
|
// public void setGroup(AggregateReference<SysGroup, Integer> group) {
|
||||||
this.group = group;
|
// this.group = group;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
1245595
src/main/resources/data.sql
Normal file
1245595
src/main/resources/data.sql
Normal file
File diff suppressed because it is too large
Load diff
18
src/main/resources/master_data/00-property_set_period.sql
Normal file
18
src/main/resources/master_data/00-property_set_period.sql
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
INSERT INTO property_set (state)
|
||||||
|
SELECT 'VALID'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM property_set ps
|
||||||
|
WHERE ps.state = 'VALID'
|
||||||
|
AND ps.start_date <= NOW()
|
||||||
|
AND (ps.end_date IS NULL OR ps.end_date > NOW())
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO validity_period (state)
|
||||||
|
SELECT 'VALID'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM validity_period vp
|
||||||
|
WHERE vp.state = 'VALID'
|
||||||
|
AND vp.start_date <= NOW()
|
||||||
|
AND (vp.end_date IS NULL OR vp.end_date > NOW())
|
||||||
|
);
|
||||||
|
|
@ -1,3 +1,17 @@
|
||||||
|
|
||||||
|
-- ===================================================
|
||||||
|
-- INSERT a property set if not exists.
|
||||||
|
-- ===================================================
|
||||||
|
|
||||||
|
INSERT INTO property_set (state)
|
||||||
|
SELECT 'VALID'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM property_set ps
|
||||||
|
WHERE ps.state = 'VALID'
|
||||||
|
AND ps.start_date <= NOW()
|
||||||
|
AND (ps.end_date IS NULL OR ps.end_date > NOW())
|
||||||
|
);
|
||||||
|
|
||||||
-- ===================================================
|
-- ===================================================
|
||||||
-- INSERT Statements für system_property_type
|
-- INSERT Statements für system_property_type
|
||||||
-- Mapping: external mapping id -> external_mapping_id
|
-- Mapping: external mapping id -> external_mapping_id
|
||||||
|
|
@ -1,6 +1,22 @@
|
||||||
-- Country Data Import SQL Script
|
-- Country Data Import SQL Script
|
||||||
-- Generated from Lastenheft_Requirements Appendix A_Länder 1.csv
|
-- Generated from Lastenheft_Requirements Appendix A_Länder 1.csv
|
||||||
|
|
||||||
|
|
||||||
|
-- ===================================================
|
||||||
|
-- INSERT a property set if not exists.
|
||||||
|
-- ===================================================
|
||||||
|
|
||||||
|
INSERT INTO property_set (state)
|
||||||
|
SELECT 'VALID'
|
||||||
|
WHERE NOT EXISTS (
|
||||||
|
SELECT 1 FROM property_set ps
|
||||||
|
WHERE ps.state = 'VALID'
|
||||||
|
AND ps.start_date <= NOW()
|
||||||
|
AND (ps.end_date IS NULL OR ps.end_date > NOW())
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- =============================================================================
|
-- =============================================================================
|
||||||
-- 1. INSERT COUNTRY PROPERTY TYPES
|
-- 1. INSERT COUNTRY PROPERTY TYPES
|
||||||
-- =============================================================================
|
-- =============================================================================
|
||||||
|
|
@ -32,6 +48,7 @@ INSERT INTO `country` (`iso_code`, `region_code`, `is_deprecated`) VALUES
|
||||||
('AT', 'EMEA', FALSE),
|
('AT', 'EMEA', FALSE),
|
||||||
('AU', 'APAC', FALSE),
|
('AU', 'APAC', FALSE),
|
||||||
('AW', 'LATAM', FALSE),
|
('AW', 'LATAM', FALSE),
|
||||||
|
('AX', 'EMEA', FALSE),
|
||||||
('AZ', 'EMEA', FALSE),
|
('AZ', 'EMEA', FALSE),
|
||||||
('BA', 'EMEA', FALSE),
|
('BA', 'EMEA', FALSE),
|
||||||
('BB', 'LATAM', FALSE),
|
('BB', 'LATAM', FALSE),
|
||||||
523
src/main/resources/master_data/07-packaging.sql
Normal file
523
src/main/resources/master_data/07-packaging.sql
Normal file
|
|
@ -0,0 +1,523 @@
|
||||||
|
-- ============================================
|
||||||
|
-- Packaging Data Import SQL
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Zuerst die packaging_property_types für stackable und rust prevention erstellen
|
||||||
|
-- (falls sie noch nicht existieren)
|
||||||
|
INSERT INTO packaging_property_type (name, external_mapping_id, data_type, validation_rule, is_required)
|
||||||
|
VALUES
|
||||||
|
('Stackable', 'STACKABLE', 'BOOLEAN', NULL, FALSE),
|
||||||
|
('Rust Prevention', 'RUST_PREVENTION', 'BOOLEAN', NULL, FALSE)
|
||||||
|
ON DUPLICATE KEY UPDATE
|
||||||
|
name = VALUES(name),
|
||||||
|
data_type = VALUES(data_type);
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- SHU Packaging Dimensions
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Part Number: 28152640129
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 7000, 7900, 'CM', 677000, 'KG', 1, FALSE);
|
||||||
|
SET @shu_dim_28152640129 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8222640822
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 942000, 'KG', 630, FALSE);
|
||||||
|
SET @shu_dim_8222640822 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 3064540201
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 868000, 'KG', 160, FALSE);
|
||||||
|
SET @shu_dim_3064540201 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640113
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 6500, 'CM', 702000, 'KG', 54, FALSE);
|
||||||
|
SET @shu_dim_8212640113 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643516
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 4700, 'CM', 912000, 'KG', 60, FALSE);
|
||||||
|
SET @shu_dim_28152643516 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640104
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5700, 'CM', 1074000, 'KG', 400, FALSE);
|
||||||
|
SET @shu_dim_4222640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643502
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 4700, 'CM', 912000, 'KG', 60, FALSE);
|
||||||
|
SET @shu_dim_28152643502 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152640804
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 4700, 'CM', 740000, 'KG', 48, FALSE);
|
||||||
|
SET @shu_dim_28152640804 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640805
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5700, 'CM', 912000, 'KG', 300, FALSE);
|
||||||
|
SET @shu_dim_4222640805 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640803
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5700, 'CM', 962000, 'KG', 320, FALSE);
|
||||||
|
SET @shu_dim_4222640803 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640811
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 3400, 'CM', 962000, 'KG', 320, FALSE);
|
||||||
|
SET @shu_dim_8212640811 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640827
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 3400, 'CM', 962000, 'KG', 320, FALSE);
|
||||||
|
SET @shu_dim_8212640827 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640104
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5700, 'CM', 1074000, 'KG', 400, FALSE);
|
||||||
|
SET @shu_dim_5512640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640106
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5700, 'CM', 1074000, 'KG', 400, FALSE);
|
||||||
|
SET @shu_dim_5512640106 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500575
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 1050000, 'KG', 600, FALSE);
|
||||||
|
SET @shu_dim_8263500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500576
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 1050000, 'KG', 600, FALSE);
|
||||||
|
SET @shu_dim_8263500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500575
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 1050000, 'KG', 600, FALSE);
|
||||||
|
SET @shu_dim_28523500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500576
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('SHU', 12000, 8000, 5200, 'CM', 1050000, 'KG', 600, FALSE);
|
||||||
|
SET @shu_dim_28523500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- HU Packaging Dimensions
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Part Number: 28152640129
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 700, 790, 'MM', 677000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28152640129 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8222640822
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 942000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8222640822 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 3064540201
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 868000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_3064540201 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640113
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 650, 'MM', 702000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8212640113 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643516
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 470, 'MM', 912000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28152643516 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640104
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 570, 'MM', 1074000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_4222640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643502
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 470, 'MM', 912000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28152643502 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152640804
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 470, 'MM', 740000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28152640804 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640805
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 570, 'MM', 912000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_4222640805 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640803
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 570, 'MM', 962000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_4222640803 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640811
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 340, 'MM', 962000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8212640811 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640827
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 340, 'MM', 962000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8212640827 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640104
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 570, 'MM', 1074000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_5512640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640106
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 570, 'MM', 1074000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_5512640106 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500575
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 1050000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8263500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500576
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 1050000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_8263500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500575
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 1050000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28523500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500576
|
||||||
|
INSERT INTO packaging_dimension (type, length, width, height, displayed_dimension_unit, weight, displayed_weight_unit, content_unit_count, is_deprecated)
|
||||||
|
VALUES ('HU', 1200, 800, 520, 'MM', 1050000, 'KG', 1, FALSE);
|
||||||
|
SET @hu_dim_28523500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- Packaging Einträge
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Part Number: 28152640129
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28152640129' LIMIT 1),
|
||||||
|
@hu_dim_28152640129,
|
||||||
|
@shu_dim_28152640129,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28152640129 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8222640822
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8222640822' LIMIT 1),
|
||||||
|
@hu_dim_8222640822,
|
||||||
|
@shu_dim_8222640822,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8222640822 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 3064540201
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '3064540201' LIMIT 1),
|
||||||
|
@hu_dim_3064540201,
|
||||||
|
@shu_dim_3064540201,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_3064540201 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640113
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8212640113' LIMIT 1),
|
||||||
|
@hu_dim_8212640113,
|
||||||
|
@shu_dim_8212640113,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8212640113 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643516
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28152643516' LIMIT 1),
|
||||||
|
@hu_dim_28152643516,
|
||||||
|
@shu_dim_28152643516,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28152643516 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640104
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '4222640104' LIMIT 1),
|
||||||
|
@hu_dim_4222640104,
|
||||||
|
@shu_dim_4222640104,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_4222640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152643502
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28152643502' LIMIT 1),
|
||||||
|
@hu_dim_28152643502,
|
||||||
|
@shu_dim_28152643502,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28152643502 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28152640804
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28152640804' LIMIT 1),
|
||||||
|
@hu_dim_28152640804,
|
||||||
|
@shu_dim_28152640804,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28152640804 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640805
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '4222640805' LIMIT 1),
|
||||||
|
@hu_dim_4222640805,
|
||||||
|
@shu_dim_4222640805,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_4222640805 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 4222640803
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '4222640803' LIMIT 1),
|
||||||
|
@hu_dim_4222640803,
|
||||||
|
@shu_dim_4222640803,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_4222640803 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640811
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8212640811' LIMIT 1),
|
||||||
|
@hu_dim_8212640811,
|
||||||
|
@shu_dim_8212640811,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8212640811 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8212640827
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8212640827' LIMIT 1),
|
||||||
|
@hu_dim_8212640827,
|
||||||
|
@shu_dim_8212640827,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8212640827 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640104
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '5512640104' LIMIT 1),
|
||||||
|
@hu_dim_5512640104,
|
||||||
|
@shu_dim_5512640104,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_5512640104 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 5512640106
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '5512640106' LIMIT 1),
|
||||||
|
@hu_dim_5512640106,
|
||||||
|
@shu_dim_5512640106,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_5512640106 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500575
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8263500575' LIMIT 1),
|
||||||
|
@hu_dim_8263500575,
|
||||||
|
@shu_dim_8263500575,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8263500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 8263500576
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '8263500576' LIMIT 1),
|
||||||
|
@hu_dim_8263500576,
|
||||||
|
@shu_dim_8263500576,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_8263500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500575
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28523500575' LIMIT 1),
|
||||||
|
@hu_dim_28523500575,
|
||||||
|
@shu_dim_28523500575,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28523500575 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- Part Number: 28523500576
|
||||||
|
INSERT INTO packaging (supplier_node_id, material_id, hu_dimension_id, shu_dimension_id, is_deprecated)
|
||||||
|
VALUES (
|
||||||
|
(SELECT id FROM node WHERE name = 'Linde (China) Forklift Truck (Supplier)' LIMIT 1),
|
||||||
|
(SELECT id FROM material WHERE part_number = '28523500576' LIMIT 1),
|
||||||
|
@hu_dim_28523500576,
|
||||||
|
@shu_dim_28523500576,
|
||||||
|
FALSE
|
||||||
|
);
|
||||||
|
SET @packaging_28523500576 = LAST_INSERT_ID();
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- Packaging Properties
|
||||||
|
-- ============================================
|
||||||
|
|
||||||
|
-- Stackable und Rust Prevention Property Type IDs ermitteln
|
||||||
|
SET @stackable_type_id = (SELECT id FROM packaging_property_type WHERE external_mapping_id = 'STACKABLE' LIMIT 1);
|
||||||
|
SET @rust_prevention_type_id = (SELECT id FROM packaging_property_type WHERE external_mapping_id = 'RUST_PREVENTION' LIMIT 1);
|
||||||
|
|
||||||
|
-- Part Number: 28152640129 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28152640129, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28152640129, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8222640822 - Stackable: No, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8222640822, 'false'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8222640822, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 3064540201 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_3064540201, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_3064540201, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8212640113 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8212640113, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8212640113, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 28152643516 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28152643516, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28152643516, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 4222640104 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_4222640104, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_4222640104, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 28152643502 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28152643502, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28152643502, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 28152640804 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28152640804, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28152640804, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 4222640805 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_4222640805, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_4222640805, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 4222640803 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_4222640803, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_4222640803, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8212640811 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8212640811, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8212640811, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8212640827 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8212640827, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8212640827, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 5512640104 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_5512640104, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_5512640104, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 5512640106 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_5512640106, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_5512640106, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8263500575 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8263500575, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8263500575, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 8263500576 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_8263500576, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_8263500576, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 28523500575 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28523500575, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28523500575, 'false');
|
||||||
|
|
||||||
|
-- Part Number: 28523500576 - Stackable: Yes, Rust Prevention: No
|
||||||
|
INSERT INTO packaging_property (packaging_property_type_id, packaging_id, property_value)
|
||||||
|
VALUES
|
||||||
|
(@stackable_type_id, @packaging_28523500576, 'true'),
|
||||||
|
(@rust_prevention_type_id, @packaging_28523500576, 'false');
|
||||||
|
|
||||||
|
-- ============================================
|
||||||
|
-- Ende des Imports
|
||||||
|
-- ============================================
|
||||||
182
src/main/resources/master_data/excel_to_sql_converter.py
Normal file
182
src/main/resources/master_data/excel_to_sql_converter.py
Normal file
|
|
@ -0,0 +1,182 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Excel zu SQL Converter für Material-Datenbank
|
||||||
|
Liest Excel-Datei aus und erzeugt SQL INSERT-Statements
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def clean_text(text):
|
||||||
|
"""Bereinigt Text von SQL-gefährlichen Zeichen"""
|
||||||
|
if pd.isna(text) or text is None:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
# Zu String konvertieren und Anführungszeichen escapen
|
||||||
|
text = str(text).strip()
|
||||||
|
text = text.replace("'", "''") # SQL-Escape für single quotes
|
||||||
|
return text
|
||||||
|
|
||||||
|
def normalize_part_number(part_number):
|
||||||
|
"""Normalisiert Part Number auf 12 Zeichen mit führenden Nullen"""
|
||||||
|
if pd.isna(part_number) or part_number is None:
|
||||||
|
return "000000000000"
|
||||||
|
|
||||||
|
# Zu String konvertieren (ohne Float-Konvertierung)
|
||||||
|
part_str = str(part_number).strip()
|
||||||
|
|
||||||
|
# Bei rein numerischen Werten: mit führenden Nullen auffüllen
|
||||||
|
if part_str.isdigit():
|
||||||
|
return part_str.zfill(12)
|
||||||
|
else:
|
||||||
|
# Bei alphanumerischen Part Numbers: auf 12 Zeichen begrenzen/auffüllen
|
||||||
|
if len(part_str) > 12:
|
||||||
|
return part_str[:12] # Kürzen auf 12 Zeichen
|
||||||
|
else:
|
||||||
|
return part_str.ljust(12, '0') # Mit Nullen am Ende auffüllen
|
||||||
|
|
||||||
|
def format_hs_code(hs_code):
|
||||||
|
"""Formatiert HS Code als 8-stelligen String"""
|
||||||
|
if pd.isna(hs_code) or hs_code is None:
|
||||||
|
return "NULL"
|
||||||
|
|
||||||
|
# Zu String konvertieren
|
||||||
|
hs_str = str(hs_code).strip()
|
||||||
|
|
||||||
|
# Nur numerische HS Codes verarbeiten
|
||||||
|
if hs_str.replace('.', '').isdigit():
|
||||||
|
# Float zu Int zu String (entfernt Dezimalstellen)
|
||||||
|
hs_str = str(int(float(hs_str))).zfill(8)
|
||||||
|
return f"'{hs_str}'"
|
||||||
|
else:
|
||||||
|
# Nicht-numerische HS Codes direkt verwenden
|
||||||
|
return f"'{hs_str}'"
|
||||||
|
|
||||||
|
def excel_to_sql(excel_file_path, output_sql_path=None):
|
||||||
|
"""
|
||||||
|
Konvertiert Excel-Datei zu SQL INSERT-Statements
|
||||||
|
|
||||||
|
Args:
|
||||||
|
excel_file_path: Pfad zur Excel-Datei
|
||||||
|
output_sql_path: Pfad für SQL-Output (optional)
|
||||||
|
"""
|
||||||
|
|
||||||
|
print(f"Lese Excel-Datei: {excel_file_path}")
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Excel-Datei einlesen
|
||||||
|
# usecols="B:D" liest nur die Spalten B, C, D
|
||||||
|
# skiprows=1 überspringt die erste Zeile (Row 0)
|
||||||
|
# dtype=str stellt sicher, dass alle Werte als String gelesen werden
|
||||||
|
df = pd.read_excel(
|
||||||
|
excel_file_path,
|
||||||
|
usecols="B:D", # Nur Spalten B, C, D
|
||||||
|
skiprows=1, # Überspringt leere erste Zeile
|
||||||
|
sheet_name=0, # Erstes Sheet
|
||||||
|
dtype=str # Alle Spalten als String lesen
|
||||||
|
)
|
||||||
|
|
||||||
|
# Spalten umbenennen für bessere Handhabung
|
||||||
|
df.columns = ['part_number', 'description', 'hs_code']
|
||||||
|
|
||||||
|
print(f"Gefundene Datensätze: {len(df)}")
|
||||||
|
|
||||||
|
# Vorschau anzeigen
|
||||||
|
show_preview(df)
|
||||||
|
|
||||||
|
# Leere Zeilen entfernen
|
||||||
|
df = df.dropna(subset=['part_number', 'description'], how='all')
|
||||||
|
|
||||||
|
print(f"Datensätze nach Bereinigung: {len(df)}")
|
||||||
|
|
||||||
|
# SQL-Statements generieren
|
||||||
|
sql_statements = []
|
||||||
|
sql_statements.append("-- Material Daten Import")
|
||||||
|
sql_statements.append("-- Generiert aus Excel-Datei\n")
|
||||||
|
|
||||||
|
for index, row in df.iterrows():
|
||||||
|
try:
|
||||||
|
# Daten extrahieren und bereinigen
|
||||||
|
part_number = str(row['part_number']).strip() if pd.notna(row['part_number']) else ""
|
||||||
|
normalized_part_number = normalize_part_number(row['part_number'])
|
||||||
|
name = clean_text(row['description'])
|
||||||
|
hs_code = format_hs_code(row['hs_code'])
|
||||||
|
|
||||||
|
# Überspringe Zeilen ohne Part Number oder Description
|
||||||
|
if not part_number or not name or part_number == 'nan':
|
||||||
|
print(f"Überspringe Zeile {index + 2}: Fehlende Daten")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# SQL INSERT-Statement erstellen
|
||||||
|
sql = f"""INSERT INTO material (part_number, normalized_part_number, hs_code, name, is_deprecated)
|
||||||
|
VALUES ('{part_number}', '{normalized_part_number}', {hs_code}, '{name}', FALSE);"""
|
||||||
|
|
||||||
|
sql_statements.append(sql)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Fehler bei Zeile {index + 2}: {e}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# SQL-Ausgabe
|
||||||
|
sql_content = "\n".join(sql_statements)
|
||||||
|
|
||||||
|
# In Datei schreiben wenn Pfad angegeben
|
||||||
|
if output_sql_path:
|
||||||
|
with open(output_sql_path, 'w', encoding='utf-8') as f:
|
||||||
|
f.write(sql_content)
|
||||||
|
print(f"\nSQL-Datei erstellt: {output_sql_path}")
|
||||||
|
|
||||||
|
# Auch auf Konsole ausgeben
|
||||||
|
print(f"\n--- SQL-Statements ({len(sql_statements) - 2} Datensätze) ---")
|
||||||
|
print(sql_content)
|
||||||
|
|
||||||
|
return sql_content
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Fehler beim Verarbeiten der Excel-Datei: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def show_preview(df, num_rows=5):
|
||||||
|
"""Zeigt eine Vorschau der zu verarbeitenden Daten"""
|
||||||
|
print(f"\n📋 Vorschau der ersten {num_rows} Datensätze:")
|
||||||
|
print("-" * 80)
|
||||||
|
for i in range(min(num_rows, len(df))):
|
||||||
|
row = df.iloc[i]
|
||||||
|
part_num = str(row['part_number']).strip() if pd.notna(row['part_number']) else "N/A"
|
||||||
|
normalized = normalize_part_number(row['part_number'])
|
||||||
|
name = clean_text(row['description'])[:50] + "..." if len(clean_text(row['description'])) > 50 else clean_text(row['description'])
|
||||||
|
hs = format_hs_code(row['hs_code']).replace("'", "")
|
||||||
|
|
||||||
|
print(f" {i+1}. Part: {part_num} → {normalized}")
|
||||||
|
print(f" Name: {name}")
|
||||||
|
print(f" HS: {hs}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Hauptfunktion"""
|
||||||
|
# Pfade anpassen
|
||||||
|
excel_file = "master_data.xlsx" # Pfad zur Excel-Datei
|
||||||
|
sql_file = "material_import.sql" # Ausgabe-SQL-Datei
|
||||||
|
|
||||||
|
print("🔄 Excel zu SQL Converter für Material-Datenbank")
|
||||||
|
print("=" * 50)
|
||||||
|
|
||||||
|
# Prüfen ob Excel-Datei existiert
|
||||||
|
if not Path(excel_file).exists():
|
||||||
|
print(f"❌ Fehler: Excel-Datei '{excel_file}' nicht gefunden!")
|
||||||
|
print("Bitte Pfad in der main()-Funktion anpassen.")
|
||||||
|
return
|
||||||
|
|
||||||
|
# Konvertierung durchführen
|
||||||
|
sql_content = excel_to_sql(excel_file, sql_file)
|
||||||
|
|
||||||
|
if sql_content:
|
||||||
|
print("\n✅ Konvertierung erfolgreich abgeschlossen!")
|
||||||
|
print(f"📄 SQL-Statements wurden in '{sql_file}' gespeichert.")
|
||||||
|
print(f"📊 Bereit für Import in die Material-Datenbank!")
|
||||||
|
else:
|
||||||
|
print("\n❌ Konvertierung fehlgeschlagen!")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
@ -0,0 +1,210 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Excel to SQL Converter für Container Rates
|
||||||
|
Konvertiert Excel-Matrix-Daten in SQL INSERT-Statements für die country_matrix_rate Tabelle.
|
||||||
|
Rundet alle Raten automatisch auf 2 Nachkommastellen.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import pandas as pd
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def read_excel_data(file_path):
|
||||||
|
"""
|
||||||
|
Liest die Excel-Datei und gibt die relevanten Daten zurück.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# Excel-Datei einlesen
|
||||||
|
df = pd.read_excel(file_path)
|
||||||
|
|
||||||
|
# Spalten-Mapping entsprechend der Excel-Struktur
|
||||||
|
expected_columns = ['Relation', 'Title', 'recipient country', 'EUR_per_km', 'floater', 'CT per km']
|
||||||
|
|
||||||
|
if not all(col in df.columns for col in expected_columns):
|
||||||
|
raise ValueError(f"Erwartete Spalten nicht gefunden. Gefunden: {list(df.columns)}")
|
||||||
|
|
||||||
|
# Nur relevante Spalten extrahieren
|
||||||
|
result_data = []
|
||||||
|
for _, row in df.iterrows():
|
||||||
|
from_country = row['Title']
|
||||||
|
to_country = row['recipient country']
|
||||||
|
rate = row['CT per km']
|
||||||
|
|
||||||
|
# Null-Werte und leere Zeilen überspringen
|
||||||
|
if pd.isna(from_country) or pd.isna(to_country) or pd.isna(rate):
|
||||||
|
continue
|
||||||
|
|
||||||
|
result_data.append({
|
||||||
|
'from_country': str(from_country).strip(),
|
||||||
|
'to_country': str(to_country).strip(),
|
||||||
|
'rate': round(float(rate), 2) # Auf 2 Nachkommastellen runden
|
||||||
|
})
|
||||||
|
|
||||||
|
return result_data
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Fehler beim Lesen der Excel-Datei: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def generate_sql_statements(data, output_file):
|
||||||
|
"""
|
||||||
|
Generiert SQL-Statements und schreibt sie in eine Datei.
|
||||||
|
"""
|
||||||
|
sql_statements = []
|
||||||
|
|
||||||
|
# Header-Kommentar
|
||||||
|
header = f"""-- Container Rates Import
|
||||||
|
-- Generiert am: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
|
||||||
|
-- Anzahl Records: {len(data)}
|
||||||
|
-- Hinweis: Alle Raten wurden auf 2 Nachkommastellen gerundet
|
||||||
|
|
||||||
|
-- Subquery zur Ermittlung der aktuell gültigen validity_period_id
|
||||||
|
-- Diese findet die ID der Periode, die den Status 'VALID' hat und
|
||||||
|
-- deren Zeitraum das aktuelle Datum umfasst
|
||||||
|
SET @validity_period_id = (
|
||||||
|
SELECT id
|
||||||
|
FROM validity_period
|
||||||
|
WHERE state = 'VALID'
|
||||||
|
AND start_date <= NOW()
|
||||||
|
AND (end_date IS NULL OR end_date > NOW())
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
|
||||||
|
-- Fehlerbehandlung falls keine gültige Periode gefunden wird
|
||||||
|
SELECT CASE
|
||||||
|
WHEN @validity_period_id IS NULL THEN
|
||||||
|
SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Keine gültige validity_period gefunden!'
|
||||||
|
ELSE @validity_period_id
|
||||||
|
END AS validity_period_check;
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
sql_statements.append(header)
|
||||||
|
|
||||||
|
# INSERT-Statements generieren
|
||||||
|
insert_statements = []
|
||||||
|
|
||||||
|
for record in data:
|
||||||
|
from_country = record['from_country']
|
||||||
|
to_country = record['to_country']
|
||||||
|
rate = record['rate']
|
||||||
|
|
||||||
|
# SQL-Statement für jeden Datensatz
|
||||||
|
sql = f"""INSERT INTO country_matrix_rate (
|
||||||
|
from_country_id,
|
||||||
|
to_country_id,
|
||||||
|
rate,
|
||||||
|
validity_period_id
|
||||||
|
) VALUES (
|
||||||
|
(SELECT id FROM country WHERE iso_code = '{from_country}'),
|
||||||
|
(SELECT id FROM country WHERE iso_code = '{to_country}'),
|
||||||
|
{rate:.2f},
|
||||||
|
@validity_period_id
|
||||||
|
);"""
|
||||||
|
|
||||||
|
insert_statements.append(sql)
|
||||||
|
|
||||||
|
# Alle INSERT-Statements zusammenfügen
|
||||||
|
sql_statements.append("-- INSERT-Statements für country_matrix_rate\n")
|
||||||
|
sql_statements.extend(insert_statements)
|
||||||
|
|
||||||
|
# Abschluss-Kommentar
|
||||||
|
footer = f"""
|
||||||
|
-- Import abgeschlossen
|
||||||
|
-- {len(data)} Records eingefügt
|
||||||
|
-- Prüfen Sie die Logs auf Fehler bei nicht gefundenen ISO-Codes
|
||||||
|
|
||||||
|
-- Verification Query (optional):
|
||||||
|
-- SELECT
|
||||||
|
-- cmr.*,
|
||||||
|
-- c_from.iso_code as from_iso,
|
||||||
|
-- c_to.iso_code as to_iso
|
||||||
|
-- FROM country_matrix_rate cmr
|
||||||
|
-- JOIN country c_from ON cmr.from_country_id = c_from.id
|
||||||
|
-- JOIN country c_to ON cmr.to_country_id = c_to.id
|
||||||
|
-- WHERE cmr.validity_period_id = @validity_period_id;
|
||||||
|
"""
|
||||||
|
|
||||||
|
sql_statements.append(footer)
|
||||||
|
|
||||||
|
# In Datei schreiben
|
||||||
|
try:
|
||||||
|
with open(output_file, 'w', encoding='utf-8') as f:
|
||||||
|
f.write('\n'.join(sql_statements))
|
||||||
|
print(f"SQL-Datei erfolgreich erstellt: {output_file}")
|
||||||
|
print(f"Anzahl der generierten INSERT-Statements: {len(insert_statements)}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Fehler beim Schreiben der SQL-Datei: {e}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
def print_data_summary(data):
|
||||||
|
"""
|
||||||
|
Gibt eine Zusammenfassung der gelesenen Daten aus.
|
||||||
|
"""
|
||||||
|
print(f"\n=== DATEN-ZUSAMMENFASSUNG ===")
|
||||||
|
print(f"Anzahl Records: {len(data)}")
|
||||||
|
|
||||||
|
# Unique from countries
|
||||||
|
from_countries = sorted(set(record['from_country'] for record in data))
|
||||||
|
print(f"From Countries: {', '.join(from_countries)}")
|
||||||
|
|
||||||
|
# Unique to countries
|
||||||
|
to_countries = sorted(set(record['to_country'] for record in data))
|
||||||
|
print(f"To Countries: {', '.join(to_countries)}")
|
||||||
|
|
||||||
|
# Rate-Statistiken
|
||||||
|
rates = [record['rate'] for record in data]
|
||||||
|
print(f"Rate Bereich: {min(rates):.2f} - {max(rates):.2f} EUR/km")
|
||||||
|
print(f"Durchschnittliche Rate: {sum(rates)/len(rates):.2f} EUR/km")
|
||||||
|
|
||||||
|
print(f"\n=== SAMPLE DATA ===")
|
||||||
|
for i, record in enumerate(data[:5]):
|
||||||
|
print(f"{i+1}. {record['from_country']} -> {record['to_country']}: {record['rate']:.2f} EUR/km")
|
||||||
|
if len(data) > 5:
|
||||||
|
print(f"... und {len(data)-5} weitere Records")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
Hauptfunktion des Scripts.
|
||||||
|
"""
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print("Usage: python excel_to_sql.py <excel_file_path>")
|
||||||
|
print("Beispiel: python excel_to_sql.py matrix_data.xlsx")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
excel_file = sys.argv[1]
|
||||||
|
|
||||||
|
# Prüfen ob Datei existiert
|
||||||
|
if not Path(excel_file).exists():
|
||||||
|
print(f"Error: Datei '{excel_file}' nicht gefunden!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Output-Dateiname generieren
|
||||||
|
output_file = Path(excel_file).stem + "_import.sql"
|
||||||
|
|
||||||
|
print(f"Lese Excel-Datei: {excel_file}")
|
||||||
|
|
||||||
|
# Excel-Daten lesen
|
||||||
|
data = read_excel_data(excel_file)
|
||||||
|
|
||||||
|
if not data:
|
||||||
|
print("Keine gültigen Daten in der Excel-Datei gefunden!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Daten-Zusammenfassung anzeigen
|
||||||
|
print_data_summary(data)
|
||||||
|
|
||||||
|
# SQL-Statements generieren
|
||||||
|
print(f"\nGeneriere SQL-Statements...")
|
||||||
|
generate_sql_statements(data, output_file)
|
||||||
|
|
||||||
|
print(f"\n=== FERTIG ===")
|
||||||
|
print(f"SQL-Datei: {output_file}")
|
||||||
|
print(f"\nHinweise:")
|
||||||
|
print(f"1. Stellen Sie sicher, dass alle ISO-Codes in der country-Tabelle existieren")
|
||||||
|
print(f"2. Prüfen Sie, dass eine gültige validity_period mit state='VALID' existiert")
|
||||||
|
print(f"3. Führen Sie die SQL-Datei in Ihrer Datenbank aus")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
BIN
src/main/resources/master_data/master_data.xlsx
Normal file
BIN
src/main/resources/master_data/master_data.xlsx
Normal file
Binary file not shown.
|
|
@ -1,3 +1,5 @@
|
||||||
|
-- DROP TABLE IF EXISTS `lcc`.`calculation_job`, `lcc`.`calculation_job_destination`, `lcc`.`calculation_job_route_section`, `lcc`.`container_rate`, `lcc`.`country`, `lcc`.`country_matrix_rate`, `lcc`.`country_property`, `lcc`.`country_property_type`, `lcc`.`distance_matrix`, `lcc`.`material`, `lcc`.`node`, `lcc`.`node_predecessor_chain`, `lcc`.`node_predecessor_entry`, `lcc`.`outbound_country_mapping`, `lcc`.`packaging`, `lcc`.`packaging_dimension`, `lcc`.`packaging_property`, `lcc`.`packaging_property_type`, `lcc`.`premise`, `lcc`.`premise_destination`, `lcc`.`premise_route`, `lcc`.`premise_route_node`, `lcc`.`premise_route_section`, `lcc`.`property_set`, `lcc`.`sys_group`, `lcc`.`sys_user`, `lcc`.`sys_user_group_mapping`, `lcc`.`sys_user_node`, `lcc`.`system_property`, `lcc`.`system_property_type`, `lcc`.`validity_period`;
|
||||||
|
|
||||||
-- Property management tables
|
-- Property management tables
|
||||||
CREATE TABLE IF NOT EXISTS `property_set`
|
CREATE TABLE IF NOT EXISTS `property_set`
|
||||||
(
|
(
|
||||||
|
|
@ -5,7 +7,7 @@ CREATE TABLE IF NOT EXISTS `property_set`
|
||||||
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
`start_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`start_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`end_date` TIMESTAMP NULL,
|
`end_date` TIMESTAMP NULL,
|
||||||
`state` CHAR(8),
|
`state` CHAR(8) NOT NULL,
|
||||||
CONSTRAINT `chk_property_state_values` CHECK (`state` IN ('DRAFT', 'VALID', 'INVALID', 'EXPIRED')),
|
CONSTRAINT `chk_property_state_values` CHECK (`state` IN ('DRAFT', 'VALID', 'INVALID', 'EXPIRED')),
|
||||||
CONSTRAINT `chk_property_date_range` CHECK (`end_date` IS NULL OR `end_date` > `start_date`),
|
CONSTRAINT `chk_property_date_range` CHECK (`end_date` IS NULL OR `end_date` > `start_date`),
|
||||||
INDEX `idx_dates` (`start_date`, `end_date`),
|
INDEX `idx_dates` (`start_date`, `end_date`),
|
||||||
|
|
@ -20,6 +22,7 @@ CREATE TABLE IF NOT EXISTS `system_property_type`
|
||||||
`external_mapping_id` VARCHAR(16),
|
`external_mapping_id` VARCHAR(16),
|
||||||
`data_type` VARCHAR(16) NOT NULL,
|
`data_type` VARCHAR(16) NOT NULL,
|
||||||
`validation_rule` VARCHAR(64),
|
`validation_rule` VARCHAR(64),
|
||||||
|
UNIQUE KEY `idx_external_mapping` (`external_mapping_id`),
|
||||||
CONSTRAINT `chk_system_data_type_values` CHECK (`data_type` IN
|
CONSTRAINT `chk_system_data_type_values` CHECK (`data_type` IN
|
||||||
('INT', 'PERCENTAGE', 'BOOLEAN', 'CURRENCY', 'ENUMERATION',
|
('INT', 'PERCENTAGE', 'BOOLEAN', 'CURRENCY', 'ENUMERATION',
|
||||||
'TEXT'))
|
'TEXT'))
|
||||||
|
|
@ -138,9 +141,9 @@ CREATE TABLE IF NOT EXISTS node
|
||||||
address VARCHAR(500) NOT NULL,
|
address VARCHAR(500) NOT NULL,
|
||||||
external_mapping_id VARCHAR(32),
|
external_mapping_id VARCHAR(32),
|
||||||
predecessor_required BOOLEAN NOT NULL DEFAULT FALSE,
|
predecessor_required BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
is_destination BOOLEAN,
|
is_destination BOOLEAN NOT NULL,
|
||||||
is_source BOOLEAN,
|
is_source BOOLEAN NOT NULL,
|
||||||
is_intermediate BOOLEAN,
|
is_intermediate BOOLEAN NOT NULL,
|
||||||
geo_lat DECIMAL(7, 4) CHECK (geo_lat BETWEEN -90 AND 90),
|
geo_lat DECIMAL(7, 4) CHECK (geo_lat BETWEEN -90 AND 90),
|
||||||
geo_lng DECIMAL(7, 4) CHECK (geo_lng BETWEEN -180 AND 180),
|
geo_lng DECIMAL(7, 4) CHECK (geo_lng BETWEEN -180 AND 180),
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
|
@ -193,10 +196,10 @@ CREATE TABLE IF NOT EXISTS distance_matrix
|
||||||
to_geo_lng DECIMAL(7, 4) CHECK (to_geo_lng BETWEEN -180 AND 180),
|
to_geo_lng DECIMAL(7, 4) CHECK (to_geo_lng BETWEEN -180 AND 180),
|
||||||
distance DECIMAL(15, 2) NOT NULL COMMENT 'travel distance between the two nodes in meters',
|
distance DECIMAL(15, 2) NOT NULL COMMENT 'travel distance between the two nodes in meters',
|
||||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
state CHAR(10),
|
state CHAR(10) NOT NULL,
|
||||||
FOREIGN KEY (from_node_id) REFERENCES node (id),
|
FOREIGN KEY (from_node_id) REFERENCES node (id),
|
||||||
FOREIGN KEY (to_node_id) REFERENCES node (id),
|
FOREIGN KEY (to_node_id) REFERENCES node (id),
|
||||||
CONSTRAINT `chk_state` CHECK (`state` IN
|
CONSTRAINT `chk_distance_matrix_state` CHECK (`state` IN
|
||||||
('VALID', 'STALE')),
|
('VALID', 'STALE')),
|
||||||
INDEX idx_from_to_nodes (from_node_id, to_node_id)
|
INDEX idx_from_to_nodes (from_node_id, to_node_id)
|
||||||
);
|
);
|
||||||
|
|
@ -208,7 +211,7 @@ CREATE TABLE IF NOT EXISTS validity_period
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
start_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
start_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
end_date TIMESTAMP DEFAULT NULL,
|
end_date TIMESTAMP DEFAULT NULL,
|
||||||
state CHAR(8) CHECK (state IN ('DRAFT', 'VALID', 'INVALID', 'EXPIRED')),
|
state CHAR(8) NOT NULL CHECK (state IN ('DRAFT', 'VALID', 'INVALID', 'EXPIRED')),
|
||||||
CONSTRAINT `chk_validity_date_range` CHECK (`end_date` IS NULL OR `end_date` > `start_date`)
|
CONSTRAINT `chk_validity_date_range` CHECK (`end_date` IS NULL OR `end_date` > `start_date`)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -269,11 +272,11 @@ CREATE TABLE IF NOT EXISTS packaging_dimension
|
||||||
`displayed_weight_unit` CHAR(2) DEFAULT 'KG',
|
`displayed_weight_unit` CHAR(2) DEFAULT 'KG',
|
||||||
`content_unit_count` INT UNSIGNED NOT NULL COMMENT 'how many units are contained in packaging (if there is a child packaging this references to the child packaging, otherwise this references a single unit)',
|
`content_unit_count` INT UNSIGNED NOT NULL COMMENT 'how many units are contained in packaging (if there is a child packaging this references to the child packaging, otherwise this references a single unit)',
|
||||||
`is_deprecated` BOOLEAN NOT NULL DEFAULT FALSE,
|
`is_deprecated` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
CONSTRAINT `chk_type_values` CHECK (`type` IN
|
CONSTRAINT `chk_packaging_dimension_type_values` CHECK (`type` IN
|
||||||
('SHU', 'HU')),
|
('SHU', 'HU')),
|
||||||
CONSTRAINT `chk_packaging_displayed_dimension_unit` CHECK (`displayed_dimension_unit` IN
|
CONSTRAINT `chk_packaging_dimension_displayed_dimension_unit` CHECK (`displayed_dimension_unit` IN
|
||||||
('MM', 'CM', 'M')),
|
('MM', 'CM', 'M')),
|
||||||
CONSTRAINT `chk_packaging_displayed_weight_unit` CHECK (`displayed_weight_unit` IN
|
CONSTRAINT `chk_packaging_dimension_displayed_weight_unit` CHECK (`displayed_weight_unit` IN
|
||||||
('G', 'KG'))
|
('G', 'KG'))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -341,7 +344,7 @@ CREATE TABLE IF NOT EXISTS premise
|
||||||
oversea_share DECIMAL(7, 4),
|
oversea_share DECIMAL(7, 4),
|
||||||
hs_code CHAR(8),
|
hs_code CHAR(8),
|
||||||
tariff_rate DECIMAL(7, 4),
|
tariff_rate DECIMAL(7, 4),
|
||||||
state CHAR(10) DEFAULT 'DRAFT',
|
state CHAR(10) NOT NULL 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_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_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_width INT UNSIGNED COMMENT 'user entered dimensions in mm (if system-wide packaging is used, packaging dimensions are copied here after creation)',
|
||||||
|
|
@ -455,7 +458,7 @@ CREATE TABLE IF NOT EXISTS calculation_job
|
||||||
calculation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
calculation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
validity_period_id INT NOT NULL,
|
validity_period_id INT NOT NULL,
|
||||||
property_set_id INT NOT NULL,
|
property_set_id INT NOT NULL,
|
||||||
job_state CHAR(10) CHECK (job_state IN
|
job_state CHAR(10) NOT NULL CHECK (job_state IN
|
||||||
('CREATED', 'SCHEDULED', 'VALID', 'INVALID', 'EXCEPTION')),
|
('CREATED', 'SCHEDULED', 'VALID', 'INVALID', 'EXCEPTION')),
|
||||||
user_id INT NOT NULL,
|
user_id INT NOT NULL,
|
||||||
FOREIGN KEY (premise_id) REFERENCES premise (id),
|
FOREIGN KEY (premise_id) REFERENCES premise (id),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue