Compare commits

..

No commits in common. "ae9bba67bd862a6af80f3aeb4c6254c7fb419173" and "f111c8818fa5086df962fb832ef4504fde19a276" have entirely different histories.

2 changed files with 520 additions and 594 deletions

View File

@ -1,5 +1,5 @@
--\timing --\timing
truncate table rlarp.osmf_dev; truncate table rlarp.osmfs;
WITH WITH
gld AS ( gld AS (
@ -25,460 +25,27 @@ gld AS (
--AND DIGITS(N1FSYP) = '1901' --AND DIGITS(N1FSYP) = '1901'
) )
--SELECT * FROM gld --SELECT * FROM gld
,baseline AS ( ,cop AS (
SELECT SELECT
-----------documents------------- o.plnt
null::int "ddord#" ,o."ddord#"
,null::int "dditm#"
,null::int "fgbol#"
,null::int "fgent#"
,null::int "diinv#"
,null::int "dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate dcodat
,o.rdate ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo
,null::text return_reas
,o.terms
,null::text custpo
,null::text remit_to
,null::text bill_class
,o.bill_cust
,null::text bill_rep
,null::text bill_terr
,null::text ship_class
,ship_cust
,null::text ship_rep
,null::text ship_terr
,null::text dsm
,null::text account
,null::text shipgrp
,null::text geo
,null::text chan
,null::text chansub
,null::text orig_ctry
,null::text orig_prov
,null::text orig_post
,null::text bill_ctry
,null::text bill_prov
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part
,null::text styc
,null::text colc
,null::text colgrp
,null::text coltier
,null::text colstat
,null::text sizc
,null::text pckg
,null::text kit
,null::text brnd
,null::text majg
,null::text ming
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line
,o.r_currency
,null::numeric r_rate
,o.c_currency
,null::numeric c_rate
,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.calc_status
,o.flag
,o.odate
,o.oseas
,o.rdate
,o.rseas
-----when null, greatest/least is just going to act like coalesce
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
,ss.ssyr sseas
,'15mo' "version"
,'actuals' iter
FROM
rlarp.osm_dev o
--snap the ship dates of the historic fiscal period
LEFT OUTER JOIN gld ON
gld.fspr = o.fspr
--get the shipping season for open orders based on the snapped date
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
WHERE
(
o.odate BETWEEN '2019-06-01' AND '2019-01-31'
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-02-01')
OR o.fspr BETWEEN '2001' AND '2008'
)
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
GROUP BY
o.fspr
,plnt
,o.promo
,o.terms
,o.bill_cust
,ship_cust
,o.part
,o.fs_line
,o.r_currency
,o.c_currency
,o.calc_status
,o.flag
,o.odate
,o.oseas
,o.rdate
,o.rseas
,greatest(least(o.sdate,gld.edat),gld.sdat)
,ss.ssyr
UNION ALL
SELECT
-----------documents-------------
null::int "ddord#"
,null::int "dditm#"
,null::int "fgbol#"
,null::int "fgent#"
,null::int "diinv#"
,null::int "dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate + interval '1 year' dcodat
,o.rdate + interval '1 year' ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo
,null::text return_reas
,o.terms
,null::text custpo
,null::text remit_to
,null::text bill_class
,o.bill_cust
,null::text bill_rep
,null::text bill_terr
,null::text ship_class
,ship_cust
,null::text ship_rep
,null::text ship_terr
,null::text dsm
,null::text account
,null::text shipgrp
,null::text geo
,null::text chan
,null::text chansub
,null::text orig_ctry
,null::text orig_prov
,null::text orig_post
,null::text bill_ctry
,null::text bill_prov
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part
,null::text styc
,null::text colc
,null::text colgrp
,null::text coltier
,null::text colstat
,null::text sizc
,null::text pckg
,null::text kit
,null::text brnd
,null::text majg
,null::text ming
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line
,o.r_currency
,null::numeric r_rate
,o.c_currency
,null::numeric c_rate
,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.calc_status
,o.flag
,o.odate + interval '1 year' odate
,o.oseas + 1 rseas
,o.rdate + interval '1 year' rdate
,o.rseas + 1 rseas
-----when null, greatest/least is just going to act like coalesce
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' sdate
,ss.ssyr sseas
,'actuals' "version"
,'actuals_plug' iter
FROM
rlarp.osm_dev o
LEFT OUTER JOIN gld ON
gld.fspr = o.fspr
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
WHERE
o.odate BETWEEN '2019-02-01' AND '2019-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
------exclude actuals for now and use forecast to get the plug for the rest of the year
AND false
GROUP BY
o.fspr
,plnt
,o.promo
,o.terms
,o.bill_cust
,ship_cust
,o.part
,o.fs_line
,o.r_currency
,o.c_currency
,o.calc_status
,o.flag
,o.odate
,o.oseas
,o.rdate
,o.rseas
,greatest(least(o.sdate,gld.edat),gld.sdat)
,ss.ssyr
UNION ALL
SELECT
-----------documents-------------
null::int "ddord#"
,null::int "dditm#"
,null::int "fgbol#"
,null::int "fgent#"
,null::int "diinv#"
,null::int "dilin#"
,null::int quoten
,null::int quotel
----------dates/status------------------
,o.odate + interval '1 year' dcodat
,o.rdate + interval '1 year' ddqdat
,null::date dcmdat
,null::date fesdat
,greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' dhidat
,null::text fesind
,null::text dhpost
,o.fspr
-----------measures--------------------
,null::numeric ddqtoi
,null::numeric ddqtsi
,null::numeric fgqshp
,null::numeric diqtsh
,null::numeric diext
,null::numeric ditdis
,null::jsonb discj
,null::text dhincr
,plnt
,o.promo
,null::text return_reas
,o.terms
,null::text custpo
,null::text remit_to
,null::text bill_class
,o.bill_cust
,null::text bill_rep
,null::text bill_terr
,null::text ship_class
,ship_cust
,null::text ship_rep
,null::text ship_terr
,null::text dsm
,null::text account
,null::text shipgrp
,null::text geo
,null::text chan
,null::text chansub
,null::text orig_ctry
,null::text orig_prov
,null::text orig_post
,null::text bill_ctry
,null::text bill_prov
,null::text bill_post
,null::text dest_ctry
,null::text dest_prov
,null::text dest_post
,o.part
,null::text styc
,null::text colc
,null::text colgrp
,null::text coltier
,null::text colstat
,null::text sizc
,null::text pckg
,null::text kit
,null::text brnd
,null::text majg
,null::text ming
,null::text majs
,null::text mins
,null::text gldco
,null::text gldc
,null::text glec
,null::text harm
,null::text clss
,null::text brand
,null::text assc
,null::text ddunit
,null::text unti
,null::numeric lbs
,null::numeric plt
,null::text plcd
,o.fs_line
,o.r_currency
,null::numeric r_rate
,o.c_currency
,null::numeric c_rate
,sum(o.fb_qty) fb_qty
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_dis) fb_val_loc_dis
,sum(o.fb_val_loc_qt) fb_val_loc_qt
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,sum(o.fb_val_loc_tar) fb_val_loc_tar
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.calc_status
,o.flag
,o.odate odate
,o.oseas rseas
,o.rdate rdate
,o.rseas rseas
-----when null, greatest/least is just going to act like coalesce
,greatest(least(o.sdate,gld.edat),gld.sdat) sdate
,ss.ssyr sseas
,'actuals' "version"
,'forecast_plug' iter
FROM
rlarp.osmp_dev o
LEFT OUTER JOIN gld ON
gld.fspr = o.fspr
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
WHERE
o.odate BETWEEN '2020-02-01' AND '2020-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
GROUP BY
o.fspr
,plnt
,o.promo
,o.terms
,o.bill_cust
,ship_cust
,o.part
,o.fs_line
,o.r_currency
,o.c_currency
,o.calc_status
,o.flag
,o.odate
,o.oseas
,o.rdate
,o.rseas
,greatest(least(o.sdate,gld.edat),gld.sdat)
,ss.ssyr
)
,incr AS (
SELECT
o."ddord#"
,o."dditm#" ,o."dditm#"
,o."fgbol#" ,o."fgbol#"
,o."fgent#" ,o."fgent#"
,o."diinv#" ,o."diinv#"
,o."dilin#" ,o."dilin#"
,o.quoten
,o.quotel
,o.dcodat + interval '1 year' --incremented
,o.ddqdat + interval '1 year' --incremented
,o.dcmdat
,o.fesdat
,o.dhidat + interval '1 year' --incremented
,o.fesind
,o.dhpost
,gld.fspr --incremented
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.diext
,o.ditdis
,o.discj
,o.dhincr
,o.plnt
,o.promo ,o.promo
,o.return_reas ,o.return_reas
,o.terms ,o.terms
,o.custpo ,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to ,o.remit_to
,o.bill_class ,o.bill_class
,o.bill_cust ,o.bill_cust
@ -488,83 +55,453 @@ SELECT
,o.ship_cust ,o.ship_cust
,o.ship_rep ,o.ship_rep
,o.ship_terr ,o.ship_terr
,o.dsm ,o.quota_rep
,o.account ,o.account
,o.shipgrp ,o.shipgrp
,o.geo ,o.geo
,o.chan ,o.chan
,o.chansub
,o.orig_ctry ,o.orig_ctry
,o.orig_prov ,o.orig_prov
,o.orig_post ,o.orig_post
,o.bill_ctry
,o.bill_prov
,o.bill_post
,o.dest_ctry ,o.dest_ctry
,o.dest_prov ,o.dest_prov
,o.dest_post ,o.dest_post
,o.part ,o.part
,o.styc ,o.ord_gldc
,o.colc
,o.colgrp
,o.coltier
,o.colstat
,o.sizc
,o.pckg
,o.kit
,o.brnd
,o.majg ,o.majg
,o.ming ,o.ming
,o.majs ,o.majs
,o.mins ,o.mins
,o.gldco
,o.gldc ,o.gldc
,o.glec ,o.glec
,o.harm ,o.harm
,o.clss ,o.clss
,o.brand ,o.brand
,o.assc ,o.assc
,o.ddunit
,o.unti
,o.lbs
,o.plt
,o.plcd
,o.fs_line ,o.fs_line
,o.r_currency ,o.r_currency
,o.r_rate ,o.r_rate
,o.c_currency ,o.c_currency
,o.c_rate ,o.c_rate
,o.fb_qty ,o.ddqtoi
,o.fb_val_loc ,o.ddqtsi
,o.fb_val_loc_dis ,o.fgqshp
,o.fb_val_loc_qt ,o.diqtsh
,o.fb_val_loc_pl ,sum(o.fb_qty) fb_qty
,o.fb_val_loc_tar ,sum(o.fb_cst_loc) fb_cst_loc
,o.fb_cst_loc ,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,o.fb_cst_loc_cur ,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,o.fb_cst_loc_fut ,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,o.calc_status ,o.calc_status
,o.flag ,o.flag
,o.odate + interval '1 year' --incremented ,o.orderdate
,o.oseas + 1 --incremented ,o.requestdate
,o.rdate + interval '1 year' --incremented ,greatest(least(o.shipdate,gld.edat),gld.sdat) shipdate
,o.rseas + 1 --incremented ,o.adj_orderdate
,o.sdate + interval '1 year' --incremented ,o.adj_requestdate
,o.sseas + 1 --incremented ,greatest(least(o.adj_shipdate,gld.edat),gld.sdat) adj_shipdate
,'b21' "version" ,'9p3' "version"
,'baseline' iter ,'actual' iter
FROM FROM
baseline o rlarp.osm_dev o
LEFT OUTER JOIN gld ON LEFT OUTER JOIN gld ON
o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat gld.fspr = o.fspr
WHERE
(
o.adj_orderdate BETWEEN '2019-06-01' AND '2019-01-31'
OR o.calc_status IN ('OPEN','BACKORDER')
OR o.fspr BETWEEN '2001' AND '2008'
) )
INSERT INTO rlarp.osmf_dev AND fs_line = '41010'
AND calc_status <> 'CANCELED'
GROUP BY
o.plnt
,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo
,o.return_reas
,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust
,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status
,o.flag
,o.orderdate
,o.requestdate
,greatest(least(o.shipdate,gld.edat),gld.sdat)
,o.adj_orderdate
,o.adj_requestdate
,greatest(least(o.adj_shipdate,gld.edat),gld.sdat)
UNION ALL
SELECT
o.plnt
,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo
,o.return_reas
,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust
,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,sum(o.fb_qty) fb_qty
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,o.calc_status
,o.flag
,o.orderdate
,o.requestdate
,greatest(least(o.shipdate,gld.edat),gld.sdat) shipdate
,o.adj_orderdate
,o.adj_requestdate
,greatest(least(o.adj_shipdate,gld.edat),gld.sdat) adj_shipdate
,'9p3' "version"
,'forecast' iter
FROM
rlarp.osmf o
LEFT OUTER JOIN gld ON
gld.fspr = o.fspr
WHERE
o.adj_orderdate BETWEEN '2019-03-01' AND '2019-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
GROUP BY
o.plnt
,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo
,o.return_reas
,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,o.fspr
,o.remit_to
,o.bill_class
,o.bill_cust
,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status
,o.flag
,o.orderdate
,o.requestdate
,greatest(least(o.shipdate,gld.edat),gld.sdat)
,o.adj_orderdate
,o.adj_requestdate
,greatest(least(o.adj_shipdate,gld.edat),gld.sdat)
)
,incr AS (
SELECT
o.plnt
,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo
,o.return_reas
,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,gld.fspr
,o.remit_to
,o.bill_class
,o.bill_cust
,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,sum(o.fb_qty) fb_qty
,sum(o.fb_cst_loc) fb_cst_loc
,sum(o.fb_cst_loc_cur) fb_cst_loc_cur
,sum(o.fb_cst_loc_fut) fb_cst_loc_fut
,sum(o.fb_val_loc) fb_val_loc
,sum(o.fb_val_loc_pl) fb_val_loc_pl
,o.calc_status
,o.flag
----these dates should already be snapped since the derive from the adjusted set
,o.orderdate + interval '1 year' orderdate
,o.requestdate + interval '1 year' requestdate
,o.shipdate + interval '1 year' shipdate
,o.adj_orderdate + interval '1 year' adj_orderdate
,o.adj_requestdate + interval '1 year' adj_requestdate
,o.adj_shipdate + interval '1 year' adj_shipdate
,'b20' "version"
,'copy' iter
FROM
cop o
LEFT OUTER JOIN gld ON
(o.adj_shipdate + interval '1 year') BETWEEN gld.sdat AND gld.edat
WHERE
adj_orderdate BETWEEN '2018-06-01' AND '2019-05-31'
GROUP BY
o.plnt
,o."ddord#"
,o."dditm#"
,o."fgbol#"
,o."fgent#"
,o."diinv#"
,o."dilin#"
,o.promo
,o.return_reas
,o.terms
,o.custpo
,o.dhincr
,o.diext
,o.ditdis
,o.dcodat
,o.ddqdat
,o.dcmdat
,o.dhidat
,gld.fspr
,o.remit_to
,o.bill_class
,o.bill_cust
,o.bill_rep
,o.bill_terr
,o.ship_class
,o.ship_cust
,o.ship_rep
,o.ship_terr
,o.quota_rep
,o.account
,o.shipgrp
,o.geo
,o.chan
,o.orig_ctry
,o.orig_prov
,o.orig_post
,o.dest_ctry
,o.dest_prov
,o.dest_post
,o.part
,o.ord_gldc
,o.majg
,o.ming
,o.majs
,o.mins
,o.gldc
,o.glec
,o.harm
,o.clss
,o.brand
,o.assc
,o.fs_line
,o.r_currency
,o.r_rate
,o.c_currency
,o.c_rate
,o.ddqtoi
,o.ddqtsi
,o.fgqshp
,o.diqtsh
,o.calc_status
,o.flag
,o.orderdate + interval '1 year'
,o.requestdate + interval '1 year'
,o.shipdate + interval '1 year'
,o.adj_orderdate + interval '1 year'
,o.adj_requestdate + interval '1 year'
,o.adj_shipdate + interval '1 year'
)
INSERT INTO rlarp.osmfs
SELECT * FROM incr SELECT * FROM incr
UNION ALL UNION ALL
SELECT * FROM baseline; SELECT * FROM cop;
---identify short ships: causes disconnect with actual sales------------------------------------------------------------------- ---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
--UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER'; UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';
---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem------------------- ---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem-------------------
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate; UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;

View File

@ -1,126 +1,115 @@
|column |alt_name |osmp_dev|osm_fcpool|osmp_source|osm_stack_retain|ui |revised_pool| | column | osmp_dev | source | osm_stack_retain | ui |
|---------------|--------------|--------|----------|-----------|----------------|---|------------| | -------------- | -------- | -------- | ---------------- | --- |
|ddord# | |x | |null |x | | | | ddord# | x | null | x | |
|dditm# | |x | |null | | | | | dditm# | x | null | | |
|fgbol# | |x | |null | | | | | fgbol# | x | null | | |
|fgent# | |x | |null | | | | | fgent# | x | null | | |
|diinv# | |x | |null |x | | | | diinv# | x | null | x | |
|dilin# | |x | |null | | | | | dilin# | x | null | | |
|quoten | |x | |null |x | | | | quoten | x | null | x | |
|quotel | |x | |null | | | | | quotel | x | null | | |
|dcodat | |x | |null | | | | | dcodat | x | null | | |
|ddqdat | |x | |null | | | | | ddqdat | x | null | | |
|dcmdat | |x | |null | | | | | dcmdat | x | null | | |
|fesdat | |x | |null | | | | | fesdat | x | null | | |
|dhidat | |x | |null | | | | | dhidat | x | null | | |
|fesind | |x | |null | | | | | fesind | x | null | | |
|dhpost | |x | |null | | | | | dhpost | x | null | | |
|fspr | |x | |forecast | | |x | | fspr | x | forecast | | |
|ddqtoi | |x | |forecast | | |x | | ddqtoi | x | forecast | | |
|ddqtsi | |x | |null | | | | | ddqtsi | x | null | | |
|fgqshp | |x | |null | | | | | fgqshp | x | null | | |
|diqtsh | |x | |null | | | | | diqtsh | x | null | | |
|diext | |x | |null | | | | | diext | x | null | | |
|ditdis | |x | |null | | | | | ditdis | x | null | | |
|discj | |x | |null | | | | | discj | x | null | | |
|dhincr | |x | |forecast | | |x | | dhincr | x | forecast | | |
|plnt | |x | |forecast |x | |x | | plnt | x | forecast | x | |
|promo | |x | |forecast |x |x |x | | promo | x | forecast | x | x |
|return_reas | |x | |null | | | | | return_reas | x | null | | |
|terms | |x | |forecast | | |x | | terms | x | forecast | | |
|custpo | |x | |null | | | | | custpo | x | null | | |
|remit_to | |x | |forecast | | |x | | remit_to | x | forecast | | |
|bill_class | |x | |cust |x | | | | bill_class | x | cust | x | |
|bill_cust | |x | |forecast | | |x | | bill_cust | x | forecast | | x |
|bill_cust_descr| | | |ui_only | |x |x | | bill_rep | x | cust | | |
|bill_rep | |x | |cust | | | | | bill_terr | x | cust | | |
|bill_terr | |x | |cust | | | | | ship_class | x | cust | x | |
|ship_class | |x | |cust |x | | | | ship_cust | x | forecast | x | x |
|ship_cust | |x | |forecast |x | |x | | ship_rep | x | cust | | |
|ship_cust_descr| | | |ui_only | |x |x | | ship_terr | x | cust | | |
|ship_rep | |x | |cust | | | | | dsm | x | forecast | x | x |
|ship_terr | |x | |cust | | | | | account | x | cust | x | x |
|dsm |quota_rep |x | |forecast |x |x |x | | shipgrp | x | cust | x | x |
|quota_rep_descr| | | |ui_only | |x |x | | geo | x | cust | x | |
|account |billto_group |x | |cust |x |x |x | | chan | x | cust | x | x |
|shipgrp |shipto_group |x | |cust |x |x |x | | chansub | x | cust | x | x |
|geo | |x | |cust |x | | | | chanretail | | ui_only | | x |
|chan | |x | |cust |x |x |x | | orig_ctry | x | plnt | | |
|chansub |mod_chan |x | |cust |x |x |x | | orig_prov | x | plnt | | |
|chanretail |mod_chansub | | |ui_only | |x |x | | orig_post | x | plnt | | |
|orig_ctry | |x | |plnt | | | | | bill_ctry | x | cust | x | |
|orig_prov | |x | |plnt | | | | | bill_prov | x | cust | x | |
|orig_post | |x | |plnt | | | | | bill_post | x | cust | x | |
|bill_ctry | |x | |cust |x | | | | dest_ctry | x | cust | x | |
|bill_prov | |x | |cust |x | | | | dest_prov | x | cust | x | |
|bill_post | |x | |cust |x | | | | dest_post | x | cust | x | |
|dest_ctry | |x | |cust |x | | | | part | x | forecast | x | |
|dest_prov | |x | |cust |x | | | | partd | | ui_only | | x |
|dest_post | |x | |cust |x | | | | part_groupd | | ui_only | | x |
|part | |x | |forecast |x | |x | | styc | x | itemm | x | |
|part_descr | | | |ui_only | |x |x | | colc | x | itemm | x | |
|part_group | | | |ui_only | |x |x | | colgrp | x | itemm | x | |
|styc | |x | |itemm |x | | | | coltier | x | itemm | x | |
|colc |color |x | |itemm |x | | | | colstat | x | itemm | | |
|colgrp | |x | |itemm |x | | | | sizc | x | itemm | x | |
|coltier | |x | |itemm |x | | | | pckg | x | itemm | x | |
|colstat | |x | |itemm | | | | | kit | x | itemm | x | |
|sizc | |x | |itemm |x | | | | brnd | x | itemm | x | x |
|pckg | |x | |itemm |x | | | | majg | x | itemm | x | |
|kit | |x | |itemm |x | | | | majgd | | ui_only | | x |
|brnd |branding |x | |itemm |x |x |x | | ming | x | itemm | x | |
|majg | |x | |itemm |x | | | | mingd | | ui_only | | x |
|majgd |majg_descr | | |ui_only | |x |x | | majs | x | itemm | x | |
|ming | |x | |itemm |x | | | | majsd | | ui_only | | x |
|mingd |ming_descr | | |ui_only | |x |x | | mins | x | itemm | x | |
|majs | |x | |itemm |x | | | | minsd | | ui_only | | x |
|majsd |majs_descr | | |ui_only | |x |x | | gldco | x | itemm | | |
|mins | |x | |itemm |x | | | | gldc | x | itemm | | |
|minsd |mins_descr | | |ui_only | |x |x | | glec | x | itemm | x | |
|gldco |ord_gldc |x | |itemm | | | | | segm | | ui_only | | x |
|gldc | |x | |itemm | | | | | harm | x | itemm | | |
|glec | |x | |itemm |x | | | | clss | x | itemm | x | |
|segm | | | |ui_only | |x |x | | brand | x | itemm | | |
|harm | |x | |itemm | | | | | assc | x | itemm | | |
|clss | |x | |itemm |x | | | | ddunit | x | itemm | | |
|brand | |x | |itemm | | | | | unti | x | itemm | | |
|assc | |x | |itemm | | | | | lbs | x | itemm | x | |
|ddunit | |x | |itemm | | | | | plt | x | punit | x | |
|unti |units |x | |itemm | | | | | plcd | x | iprcbhc | x | |
|lbs | |x | |itemm |x | | | | fs_line | x | forecast | x | |
|plt | |x | |punit |x | | | | r_currency | x | forecast | x | |
|plcd | |x | |iprcbhc |x | | | | r_rate | x | forecast | x | |
|fs_line | |x | |forecast |x | |x | | c_currency | x | forecast | x | |
|r_currency | |x | |forecast |x | |x | | c_rate | x | forecast | x | |
|r_rate | |x | |forecast |x | |x | | fb_qty | x | forecast | x | x |
|c_currency | |x | |forecast |x | |x | | fb_val_loc | x | forecast | x | x |
|c_rate | |x | |forecast |x | |x | | value_usd | | ui_only | | x |
|fb_qty | |x | |forecast |x |x |x | | fb_val_loc_dis | x | null | | |
|fb_val_loc |value_loc |x | |forecast |x |x |x | | fb_val_loc_qt | x | null | x | |
|value_usd | | | |ui_only | |x |x | | fb_val_loc_pl | x | pricel | x | |
|fb_val_loc_dis | |x | |null | | | | | fb_val_loc_tar | x | target | x | |
|fb_val_loc_qt | |x | |null |x | | | | fb_cst_loc | x | forecast | x | x |
|fb_val_loc_pl | |x | |pricel |x | | | | cost_loc | | ui_only | | x |
|fb_val_loc_tar | |x | |target |x | | | | fb_cst_loc_cur | x | icstx | x | |
|fb_cst_loc |cost_loc |x | |forecast |x |x |x | | fb_cst_loc_fut | x | icstx | | |
|cost_usd | | | |ui_only | |x |x | | calc_status | x | forecast | x | |
|fb_cst_loc_cur | |x | |icstx |x | | | | flag | x | forecast | x | |
|fb_cst_loc_fut | |x | |icstx | | | | | odate | x | forecast | x | x |
|calc_status | |x | |forecast |x | |x | | oseas | x | forecast | x | x |
|flag | |x | |forecast |x | |x | | rdate | x | forecast | x | x |
|odate |orderdate |x | |forecast |x |x |x | | rseas | x | forecast | x | x |
|order_month | | | |ui_only | |x |x | | sdate | x | forecast | x | x |
|oseas |order_season |x | |forecast |x |x |x | | sseas | x | forecast | x | x |
|rdate |requestdate |x | |forecast |x |x |x | | version | x | forecast | | x |
|request_month | | | |ui_only | |x |x | | iter | x | forecast | | x |
|rseas |request_season|x | |forecast |x |x |x |
|sdate |shipdate |x | |forecast |x |x |x |
|ship_month | | | |ui_only | |x |x |
|sseas |ship_season |x | |forecast |x |x |x |
|version | |x | |forecast | |x |x |
|iter | |x | |forecast | |x |x |
|log | |x | |forecast | |x |x |
|comment | | | |ui_only | |x |x |
|iterdet | | | |forecast | | |x |
|iterdef | | | |forecast | | |x |
|director_descr | | | |forecast | | |x |