database: Update v_bki_member, v_bki_delivery and rename scale_id to scale_terminal
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ INSERT INTO delivery (year, did, date, time, zwstid, lnr, lsnr, mgnr, ctime, mti
|
||||
(2025, 1, '2025-09-30', '09:04:38', 'X', 1, '20250930X001', 101, 1759215878, 1759215878),
|
||||
(2025, 2, '2025-09-30', '10:47:13', 'X', 2, '20250930X002', 102, 1759222033, 1759222033);
|
||||
|
||||
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, scale_id, weighing_data, ctime, mtime) VALUES
|
||||
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, scale_termianl, weighing_data, ctime, mtime) VALUES
|
||||
(2025, 1, 1, 'GV', NULL, 'B', 2876, 16.8, 'QUW', 'WLBL', 32019, TRUE, FALSE, '1', '{"id":"2025-09-30/1","nr":1,"date":"2025-09-30","time":"08:52:00","gross_weight":2876,"tare_weight":0,"net_weight":2876}', 1759215878, 1759215878),
|
||||
(2025, 1, 2, 'SB', NULL, 'B', 1342, 15.2, 'QUW', 'WLBL', 32019, TRUE, FALSE, '1', '{"id":"2025-09-30/2","nr":2,"date":"2025-09-30","time":"08:56:00","gross_weight":1342,"tare_weight":0,"net_weight":1342}', 1759215878, 1759215878),
|
||||
(2025, 1, 3, 'WR', 'S', NULL, 3128, 14.5, 'LDW', 'WLXX', 32019, TRUE, FALSE, '1', '{"id":"2025-09-30/4","nr":4,"date":"2025-09-30","time":"09:01:00","gross_weight":3128,"tare_weight":0,"net_weight":3128}', 1759215878, 1759215878),
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ INSERT INTO delivery (year, did, date, time, zwstid, lnr, lsnr, mgnr, ctime, mti
|
||||
(2025, 1, '2025-09-30', '09:04:38', 'X', 1, '20250930X001', 101, 1759215878, 1759215878),
|
||||
(2025, 2, '2025-09-30', '10:47:13', 'X', 2, '20250930X002', 102, 1759222033, 1759222033);
|
||||
|
||||
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, scale_id, weighing_data, ctime, mtime) VALUES
|
||||
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, cultid, weight, kmw, qualid, hkid, kgnr, net_weight, manual_weighing, scale_termianl, weighing_data, ctime, mtime) VALUES
|
||||
(2025, 1, 1, 'GV', NULL, 'B', 2876, 16.8, 'QUW', 'WLNO', 15224, TRUE, FALSE, '1', '{"id":"2025-09-30/1","nr":1,"date":"2025-09-30","time":"08:52:00","gross_weight":2876,"tare_weight":0,"net_weight":2876}', 1759215878, 1759215878),
|
||||
(2025, 1, 2, 'SB', NULL, 'B', 1342, 15.2, 'QUW', 'WLNO', 15224, TRUE, FALSE, '1', '{"id":"2025-09-30/2","nr":2,"date":"2025-09-30","time":"08:56:00","gross_weight":1342,"tare_weight":0,"net_weight":1342}', 1759215878, 1759215878),
|
||||
(2025, 1, 3, 'WR', 'S', NULL, 3128, 14.5, 'LDW', 'WLXX', 15224, TRUE, FALSE, '1', '{"id":"2025-09-30/4","nr":4,"date":"2025-09-30","time":"09:01:00","gross_weight":3128,"tare_weight":0,"net_weight":3128}', 1759215878, 1759215878),
|
||||
|
||||
@@ -189,7 +189,7 @@ CREATE TABLE delivery_part (
|
||||
temperature REAL DEFAULT NULL,
|
||||
acid REAL DEFAULT NULL,
|
||||
|
||||
scale_id TEXT,
|
||||
scale_terminal TEXT,
|
||||
weighing_data TEXT,
|
||||
weighing_reason TEXT CHECK (NOT (manual_weighing = FALSE AND weighing_reason IS NOT NULL)),
|
||||
|
||||
|
||||
@@ -127,6 +127,7 @@ SELECT s.year, m.mgnr, m.lfbis_nr, m.name,
|
||||
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS other_names,
|
||||
a.name AS billing_name, COALESCE(a.address, m.address) AS address,
|
||||
COALESCE(a.country, m.country) AS country, COALESCE(a.postal_dest, m.postal_dest) AS postal_dest,
|
||||
m.volllieferant AS vollablieferer,
|
||||
SUM(COALESCE(IIF((c.year_from IS NULL OR c.year_from <= s.year) AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, NULL), 0)) AS area
|
||||
FROM season s, member m
|
||||
LEFT JOIN member_billing_address a ON a.mgnr = m.mgnr
|
||||
@@ -137,7 +138,7 @@ CREATE VIEW v_bki_delivery AS
|
||||
SELECT m.lfbis_nr, m.name, m.other_names, m.billing_name,
|
||||
m.address, plz.plz, IIF(INSTR(o.name, ',') = 0, o.name, SUBSTR(o.name, 1, INSTR(o.name, ',') - 1)) AS ort,
|
||||
d.date, d.weight, v.type, v.sortid, d.qualid, d.year, d.hkid, d.kmw, d.oe,
|
||||
m.area
|
||||
m.vollablieferer, m.area
|
||||
FROM v_delivery d
|
||||
JOIN v_bki_member m ON (m.year, m.mgnr) = (d.year, d.mgnr)
|
||||
JOIN postal_dest pd ON (pd.country, pd.id) = (m.country, m.postal_dest)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
-- This value MUST NOT be changed while other connections are open!
|
||||
PRAGMA schema_version = 4000;
|
||||
PRAGMA schema_version = 4100;
|
||||
|
||||
Reference in New Issue
Block a user