fix: preserve pallet snapshots across partial pick
This commit is contained in:
@@ -3163,7 +3163,7 @@ CREATE TABLE IF NOT EXISTS fl_inbound_pallet_allocation (
|
|||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY uk_pallet_allocation_no (tenant_id, inbound_id, allocation_no),
|
UNIQUE KEY uk_pallet_allocation_no (tenant_id, inbound_id, allocation_no),
|
||||||
UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no),
|
UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no),
|
||||||
UNIQUE KEY uk_pallet_allocation_weight (tenant_id, weight_result_id),
|
UNIQUE KEY uk_pallet_allocation_weight (tenant_id, inbound_id, weight_result_id),
|
||||||
KEY idx_allocation_location (tenant_id, warehouse_id, location_id, allocation_status),
|
KEY idx_allocation_location (tenant_id, warehouse_id, location_id, allocation_status),
|
||||||
KEY idx_allocation_reservation (reservation_id),
|
KEY idx_allocation_reservation (reservation_id),
|
||||||
CONSTRAINT fk_allocation_inbound FOREIGN KEY (inbound_id) REFERENCES fl_inbound_order (id)
|
CONSTRAINT fk_allocation_inbound FOREIGN KEY (inbound_id) REFERENCES fl_inbound_order (id)
|
||||||
@@ -10259,9 +10259,16 @@ SET @sql = IF((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
|||||||
'ALTER TABLE fl_inbound_pallet_allocation ADD UNIQUE KEY uk_pallet_allocation_slot (tenant_id,inbound_id,block_id,slot_no)',
|
'ALTER TABLE fl_inbound_pallet_allocation ADD UNIQUE KEY uk_pallet_allocation_slot (tenant_id,inbound_id,block_id,slot_no)',
|
||||||
'SELECT 1'));
|
'SELECT 1'));
|
||||||
PREPARE statement FROM @sql; EXECUTE statement; DEALLOCATE PREPARE statement;
|
PREPARE statement FROM @sql; EXECUTE statement; DEALLOCATE PREPARE statement;
|
||||||
SET @sql = IF((SELECT COUNT(*) FROM information_schema.statistics
|
SET @sql = IF((SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||||
WHERE table_schema=DATABASE() AND table_name='fl_inbound_pallet_allocation' AND index_name='uk_pallet_allocation_weight') = 0,
|
FROM information_schema.statistics
|
||||||
'ALTER TABLE fl_inbound_pallet_allocation ADD UNIQUE KEY uk_pallet_allocation_weight (tenant_id,weight_result_id)', 'SELECT 1');
|
WHERE table_schema=DATABASE() AND table_name='fl_inbound_pallet_allocation'
|
||||||
|
AND index_name='uk_pallet_allocation_weight') <> 'tenant_id,inbound_id,weight_result_id',
|
||||||
|
'ALTER TABLE fl_inbound_pallet_allocation DROP INDEX uk_pallet_allocation_weight, ADD UNIQUE KEY uk_pallet_allocation_weight (tenant_id,inbound_id,weight_result_id)',
|
||||||
|
IF((SELECT COUNT(*) FROM information_schema.statistics
|
||||||
|
WHERE table_schema=DATABASE() AND table_name='fl_inbound_pallet_allocation'
|
||||||
|
AND index_name='uk_pallet_allocation_weight') = 0,
|
||||||
|
'ALTER TABLE fl_inbound_pallet_allocation ADD UNIQUE KEY uk_pallet_allocation_weight (tenant_id,inbound_id,weight_result_id)',
|
||||||
|
'SELECT 1'));
|
||||||
PREPARE statement FROM @sql; EXECUTE statement; DEALLOCATE PREPARE statement;
|
PREPARE statement FROM @sql; EXECUTE statement; DEALLOCATE PREPARE statement;
|
||||||
SET @sql = IF((SELECT COUNT(*) FROM information_schema.statistics
|
SET @sql = IF((SELECT COUNT(*) FROM information_schema.statistics
|
||||||
WHERE table_schema=DATABASE() AND table_name='fl_inbound_pallet_allocation' AND index_name='idx_allocation_reservation') = 0,
|
WHERE table_schema=DATABASE() AND table_name='fl_inbound_pallet_allocation' AND index_name='idx_allocation_reservation') = 0,
|
||||||
@@ -15017,6 +15024,11 @@ BEGIN
|
|||||||
WHERE table_schema = 'baiyue_firstleg'
|
WHERE table_schema = 'baiyue_firstleg'
|
||||||
AND table_name = 'fl_inbound_pallet_allocation'
|
AND table_name = 'fl_inbound_pallet_allocation'
|
||||||
AND index_name = 'uk_pallet_allocation_slot') <> 'tenant_id,inbound_id,block_id,slot_no'
|
AND index_name = 'uk_pallet_allocation_slot') <> 'tenant_id,inbound_id,block_id,slot_no'
|
||||||
|
OR (SELECT GROUP_CONCAT(column_name ORDER BY seq_in_index)
|
||||||
|
FROM information_schema.statistics
|
||||||
|
WHERE table_schema = 'baiyue_firstleg'
|
||||||
|
AND table_name = 'fl_inbound_pallet_allocation'
|
||||||
|
AND index_name = 'uk_pallet_allocation_weight') <> 'tenant_id,inbound_id,weight_result_id'
|
||||||
OR (SELECT COUNT(DISTINCT index_name) FROM information_schema.statistics
|
OR (SELECT COUNT(DISTINCT index_name) FROM information_schema.statistics
|
||||||
WHERE table_schema = 'baiyue_firstleg'
|
WHERE table_schema = 'baiyue_firstleg'
|
||||||
AND table_name = 'fl_inbound_pallet_allocation'
|
AND table_name = 'fl_inbound_pallet_allocation'
|
||||||
|
|||||||
@@ -736,7 +736,7 @@ CREATE TABLE IF NOT EXISTS fl_inbound_pallet_allocation (
|
|||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
UNIQUE KEY uk_pallet_allocation_no (tenant_id, inbound_id, allocation_no),
|
UNIQUE KEY uk_pallet_allocation_no (tenant_id, inbound_id, allocation_no),
|
||||||
UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no),
|
UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no),
|
||||||
UNIQUE KEY uk_pallet_allocation_weight (tenant_id, weight_result_id),
|
UNIQUE KEY uk_pallet_allocation_weight (tenant_id, inbound_id, weight_result_id),
|
||||||
KEY idx_allocation_location (tenant_id, warehouse_id, location_id, allocation_status),
|
KEY idx_allocation_location (tenant_id, warehouse_id, location_id, allocation_status),
|
||||||
KEY idx_allocation_reservation (reservation_id),
|
KEY idx_allocation_reservation (reservation_id),
|
||||||
CONSTRAINT fk_allocation_inbound FOREIGN KEY (inbound_id) REFERENCES fl_inbound_order (id)
|
CONSTRAINT fk_allocation_inbound FOREIGN KEY (inbound_id) REFERENCES fl_inbound_order (id)
|
||||||
|
|||||||
+4
-1
@@ -185,9 +185,12 @@ class PdaSplitSettlementSqlContractTest {
|
|||||||
|
|
||||||
assertThat(moduleSql)
|
assertThat(moduleSql)
|
||||||
.contains("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no)")
|
.contains("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, inbound_id, block_id, slot_no)")
|
||||||
|
.contains("UNIQUE KEY uk_pallet_allocation_weight (tenant_id, inbound_id, weight_result_id)")
|
||||||
.doesNotContain("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, block_id, slot_no)");
|
.doesNotContain("UNIQUE KEY uk_pallet_allocation_slot (tenant_id, block_id, slot_no)");
|
||||||
assertThat(unifiedSql)
|
assertThat(unifiedSql)
|
||||||
.contains("'tenant_id,inbound_id,block_id,slot_no'")
|
.contains("'tenant_id,inbound_id,block_id,slot_no'")
|
||||||
.contains("ADD UNIQUE KEY uk_pallet_allocation_slot (tenant_id,inbound_id,block_id,slot_no)");
|
.contains("ADD UNIQUE KEY uk_pallet_allocation_slot (tenant_id,inbound_id,block_id,slot_no)")
|
||||||
|
.contains("'tenant_id,inbound_id,weight_result_id'")
|
||||||
|
.contains("ADD UNIQUE KEY uk_pallet_allocation_weight (tenant_id,inbound_id,weight_result_id)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user