Merge branch 'feature/substance' of hc-companies/forecast_api into dev
This commit is contained in:
commit
3983f1c91a
@ -213,6 +213,7 @@ SELECT
|
|||||||
,o.majs_descr
|
,o.majs_descr
|
||||||
,o.mins_descr
|
,o.mins_descr
|
||||||
,o.segm
|
,o.segm
|
||||||
|
,o.substance
|
||||||
,o.fs_line
|
,o.fs_line
|
||||||
,o.r_currency
|
,o.r_currency
|
||||||
,o.r_rate
|
,o.r_rate
|
||||||
@ -265,6 +266,7 @@ SELECT
|
|||||||
,o.majs_descr
|
,o.majs_descr
|
||||||
,o.mins_descr
|
,o.mins_descr
|
||||||
,o.segm
|
,o.segm
|
||||||
|
,o.substance
|
||||||
,o.fs_line
|
,o.fs_line
|
||||||
,o.r_currency
|
,o.r_currency
|
||||||
,o.r_rate
|
,o.r_rate
|
||||||
@ -308,6 +310,7 @@ SELECT
|
|||||||
,b.majs_descr
|
,b.majs_descr
|
||||||
,b.mins_descr
|
,b.mins_descr
|
||||||
,b.segm
|
,b.segm
|
||||||
|
,b.substance
|
||||||
,b.fs_line
|
,b.fs_line
|
||||||
,b.r_currency
|
,b.r_currency
|
||||||
,b.r_rate
|
,b.r_rate
|
||||||
@ -397,6 +400,7 @@ SELECT
|
|||||||
,b.majs_descr
|
,b.majs_descr
|
||||||
,b.mins_descr
|
,b.mins_descr
|
||||||
,b.segm
|
,b.segm
|
||||||
|
,b.substance
|
||||||
,b.fs_line
|
,b.fs_line
|
||||||
,b.r_currency
|
,b.r_currency
|
||||||
,b.r_rate
|
,b.r_rate
|
||||||
@ -444,6 +448,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -487,6 +492,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -82,6 +82,7 @@ SELECT
|
|||||||
,o.majs||' - '||i.majsd majs_descr
|
,o.majs||' - '||i.majsd majs_descr
|
||||||
,o.mins||' - '||i.minsd mins_descr
|
,o.mins||' - '||i.minsd mins_descr
|
||||||
,seg.segm
|
,seg.segm
|
||||||
|
,CASE WHEN o.majg = '610' THEN 'Fiber' ELSE 'Plastic' substance
|
||||||
,fs_line
|
,fs_line
|
||||||
,r_currency
|
,r_currency
|
||||||
,r_rate
|
,r_rate
|
||||||
@ -136,9 +137,9 @@ FROM
|
|||||||
--LIMIT 100
|
--LIMIT 100
|
||||||
) WITH DATA;
|
) WITH DATA;
|
||||||
|
|
||||||
CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr);
|
CREATE INDEX osm_qr ON rlarp.osm_pool(quota_rep_descr, bill_cust_descr, ship_cust_descr);
|
||||||
ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id);
|
ALTER TABLE rlarp.osm_pool ADD CONSTRAINT logfk FOREIGN KEY (logid) REFERENCES rlarp.osm_log(id);
|
||||||
|
CREATE INDEX osm_pool_logid ON rlarp.osm_pool(logid);
|
||||||
GRANT ALL ON TABLE rlarp.osm_log TO api;
|
GRANT ALL ON TABLE rlarp.osm_log TO api;
|
||||||
GRANT ALL ON TABLE rlarp.osm_pool TO api;
|
GRANT ALL ON TABLE rlarp.osm_pool TO api;
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +1,27 @@
|
|||||||
WITH
|
WITH
|
||||||
act As (
|
act As (
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
v6part part
|
v6part part
|
||||||
FROM
|
FROM
|
||||||
lgdat.stka
|
lgdat.stka
|
||||||
WHERE
|
WHERE
|
||||||
(
|
(
|
||||||
v6stat = 'A'
|
v6stat = 'A'
|
||||||
OR v6part in ('TWA10203G18B027','TWA10203G18D050','MIH09000G18E001')
|
OR v6part in ('TWA10203G18B027','TWA10203G18D050','MIH09000G18E001')
|
||||||
)
|
)
|
||||||
OR v6type = 'C'
|
OR v6type = 'C'
|
||||||
)
|
)
|
||||||
,stkm AS (
|
,stkm AS (
|
||||||
SELECT
|
SELECT
|
||||||
act.part || ' - ' ||rtrim(COALESCE(m.avdes1,p.awdes1)) part
|
act.part || ' - ' ||rtrim(COALESCE(m.avdes1,p.awdes1)) part
|
||||||
--,COALESCE(m.avgled, p.awgled) glec
|
--,COALESCE(m.avgled, p.awgled) glec
|
||||||
FROM
|
FROM
|
||||||
act
|
act
|
||||||
LEFT OUTER JOIN lgdat.stkmm m ON
|
LEFT OUTER JOIN lgdat.stkmm m ON
|
||||||
m.avpart = act.part
|
m.avpart = act.part
|
||||||
LEFT OUTER JOIN lgdat.stkmp p ON
|
LEFT OUTER JOIN lgdat.stkmp p ON
|
||||||
p.awpart = act.part
|
p.awpart = act.part
|
||||||
WHERE
|
WHERE
|
||||||
substr(COALESCE(m.avgled, p.awgled),1,1) <= '2'
|
substr(COALESCE(m.avgled, p.awgled),1,1) <= '2'
|
||||||
)
|
)
|
||||||
select part from stkm
|
select part from stkm
|
@ -8,6 +8,7 @@ SELECT
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -53,6 +54,7 @@ GROUP BY
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -79,6 +81,7 @@ GROUP BY
|
|||||||
,logid
|
,logid
|
||||||
,tag
|
,tag
|
||||||
,comment
|
,comment
|
||||||
|
,substance
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
json_agg(row_to_json(rows)) x
|
json_agg(row_to_json(rows)) x
|
||||||
|
@ -308,6 +308,7 @@ SELECT
|
|||||||
,i.majs||' - '||i.majsd majs_descr
|
,i.majs||' - '||i.majsd majs_descr
|
||||||
,i.mins||' - '||i.minsd mins_descr
|
,i.mins||' - '||i.minsd mins_descr
|
||||||
,seg.segm
|
,seg.segm
|
||||||
|
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
|
||||||
,'41010' fs_line --master data
|
,'41010' fs_line --master data
|
||||||
,bc.bvcurr r_currency --history cust mix
|
,bc.bvcurr r_currency --history cust mix
|
||||||
,rx.rate r_rate --master data
|
,rx.rate r_rate --master data
|
||||||
@ -430,6 +431,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -473,6 +475,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
|
@ -25,6 +25,7 @@ target AS (select target_increment incr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -78,6 +79,7 @@ target AS (select target_increment incr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -143,6 +145,7 @@ target AS (select target_increment incr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -191,6 +194,7 @@ target AS (select target_increment incr)
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -234,6 +238,7 @@ target AS (select target_increment incr)
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
|
@ -61,6 +61,7 @@ target AS (select incr_qty qincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -119,6 +120,7 @@ target AS (select incr_qty qincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -172,6 +174,7 @@ target AS (select incr_qty qincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -218,6 +221,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -261,6 +265,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
|
@ -61,6 +61,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -119,6 +120,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -171,6 +173,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -251,6 +254,7 @@ FROM
|
|||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
@ -299,6 +303,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
@ -342,6 +347,7 @@ FROM
|
|||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director
|
,director
|
||||||
,segm
|
,segm
|
||||||
|
,substance
|
||||||
,chan
|
,chan
|
||||||
,chansub
|
,chansub
|
||||||
---------product info------------------
|
---------product info------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user