From 7d901e7f42c1f4aa6b106008d462e5da9993f7ab Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Wed, 1 Mar 2023 16:01:32 -0500 Subject: [PATCH] new forecast baseline dates --- build/build_forecast.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build/build_forecast.sql b/build/build_forecast.sql index e592eef..49ae916 100644 --- a/build/build_forecast.sql +++ b/build/build_forecast.sql @@ -149,11 +149,11 @@ gld AS ( WHERE ( --base period orders booked.... - o.odate BETWEEN '2022-06-01' AND '2023-02-15' + o.odate BETWEEN '2022-06-01' AND '2023-03-01' --...or any open orders currently booked before cutoff.... - OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2023-02-15') + OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2023-03-01') --...or anything that shipped in that period - OR ((o.fspr BETWEEN '2301' AND '2309' OR o.fspr = '0000') AND o.sdate < '2023-02-15') + OR ((o.fspr BETWEEN '2301' AND '2309' OR o.fspr = '0000') AND o.sdate < '2023-03-01') ) AND fs_line = '41010' AND calc_status <> 'CANCELED' @@ -303,7 +303,7 @@ gld AS ( 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 '2022-02-15' AND '2022-05-31' + o.odate BETWEEN '2022-03-01' AND '2022-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 @@ -584,14 +584,14 @@ SELECT ,o.pseas + 1 --incremented ,o.sdate + interval '1 year' --incremented ,o.sseas + 1 --incremented - ,'b22' "version" + ,'b23' "version" ,'copy' iter FROM baseline o LEFT OUTER JOIN gld ON o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat WHERE - o.odate + interval '1 year' >= '2021-06-01' + o.odate + interval '1 year' >= '2023-06-01' ) --INSERT INTO rlarp.osmf SELECT @@ -715,7 +715,7 @@ FROM SELECT * FROM baseline UNION ALL SELECT * FROM incr - ) x + ) x; ---identify short ships: causes disconnect with actual sales------------------------------------------------------------------- --UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';