basis for make_date is calendar of targer
This commit is contained in:
parent
6f880d8569
commit
8221fccf6c
48
index.js
48
index.js
@ -718,23 +718,23 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
|
|||||||
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
||||||
,b.calc_status --0
|
,b.calc_status --0
|
||||||
,b.flag --0
|
,b.flag --0
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag shipdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) adj_orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) adj_orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag adj_requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag adj_shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||||
,b.version --calculated
|
,b.version --calculated
|
||||||
,b.iter --calculated
|
,b.iter --calculated
|
||||||
-----------------------ui columns--------------------------------
|
-----------------------ui columns--------------------------------
|
||||||
,'adjust volume' iterdet
|
,'adjust volume' iterdet
|
||||||
,null::jsonb iterdef
|
,null::jsonb iterdef
|
||||||
,od.ssyr order_season
|
,od.ssyr order_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom),'Mon') order_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
|
||||||
,sd.ssyr ship_season
|
,sd.ssyr ship_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag,'Mon') ship_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||||
,rd.ssyr request_season
|
,rd.ssyr request_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag,'Mon') request_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||||
,b.part_descr
|
,b.part_descr
|
||||||
,b.part_family
|
,b.part_family
|
||||||
,b.part_group
|
,b.part_group
|
||||||
@ -766,11 +766,11 @@ server.get('/addmonth_v', bodyParser.json(), function (req, res) {
|
|||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = closest.m
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||||
LEFT OUTER JOIN gld sd ON
|
LEFT OUTER JOIN gld sd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||||
WHERE
|
WHERE
|
||||||
m._month = (SELECT _month FROM closest)
|
m._month = (SELECT _month FROM closest)
|
||||||
)
|
)
|
||||||
@ -1274,23 +1274,23 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) {
|
|||||||
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
||||||
,b.calc_status --0
|
,b.calc_status --0
|
||||||
,b.flag --0
|
,b.flag --0
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag shipdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) adj_orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) adj_orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag adj_requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag adj_shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||||
,b.version --calculated
|
,b.version --calculated
|
||||||
,b.iter --calculated
|
,b.iter --calculated
|
||||||
-----------------------ui columns--------------------------------
|
-----------------------ui columns--------------------------------
|
||||||
,'adjust volume' iterdet
|
,'adjust volume' iterdet
|
||||||
,null::jsonb iterdef
|
,null::jsonb iterdef
|
||||||
,od.ssyr order_season
|
,od.ssyr order_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom),'Mon') order_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
|
||||||
,sd.ssyr ship_season
|
,sd.ssyr ship_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag,'Mon') ship_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||||
,rd.ssyr request_season
|
,rd.ssyr request_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag,'Mon') request_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||||
,b.part_descr
|
,b.part_descr
|
||||||
,b.part_family
|
,b.part_family
|
||||||
,b.part_group
|
,b.part_group
|
||||||
@ -1322,11 +1322,11 @@ server.get('/addmonth_vp', bodyParser.json(), function (req, res) {
|
|||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = closest.m
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||||
LEFT OUTER JOIN gld sd ON
|
LEFT OUTER JOIN gld sd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||||
WHERE
|
WHERE
|
||||||
m._month = (SELECT _month FROM closest)
|
m._month = (SELECT _month FROM closest)
|
||||||
)
|
)
|
||||||
|
@ -391,23 +391,23 @@ SELECT
|
|||||||
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
||||||
,b.calc_status --0
|
,b.calc_status --0
|
||||||
,b.flag --0
|
,b.flag --0
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag shipdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) adj_orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) adj_orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag adj_requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag adj_shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||||
,b.version --calculated
|
,b.version --calculated
|
||||||
,b.iter --calculated
|
,b.iter --calculated
|
||||||
-----------------------ui columns--------------------------------
|
-----------------------ui columns--------------------------------
|
||||||
,'adjust volume' iterdet
|
,'adjust volume' iterdet
|
||||||
,null::jsonb iterdef
|
,null::jsonb iterdef
|
||||||
,od.ssyr order_season
|
,od.ssyr order_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom),'Mon') order_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
|
||||||
,sd.ssyr ship_season
|
,sd.ssyr ship_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag,'Mon') ship_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||||
,rd.ssyr request_season
|
,rd.ssyr request_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag,'Mon') request_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||||
,b.part_descr
|
,b.part_descr
|
||||||
,b.part_family
|
,b.part_family
|
||||||
,b.part_group
|
,b.part_group
|
||||||
@ -439,11 +439,11 @@ FROM
|
|||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = closest.m
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||||
LEFT OUTER JOIN gld sd ON
|
LEFT OUTER JOIN gld sd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||||
WHERE
|
WHERE
|
||||||
m._month = 'Jul'
|
m._month = 'Jul'
|
||||||
)
|
)
|
||||||
|
@ -395,23 +395,23 @@ SELECT
|
|||||||
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
,b.fb_val_loc_pl*s.factor*m.momix fb_val_loc_pl
|
||||||
,b.calc_status --0
|
,b.calc_status --0
|
||||||
,b.flag --0
|
,b.flag --0
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag shipdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) adj_orderdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) adj_orderdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag adj_requestdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||||
,make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag adj_shipdate
|
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||||
,b.version --calculated
|
,b.version --calculated
|
||||||
,b.iter --calculated
|
,b.iter --calculated
|
||||||
-----------------------ui columns--------------------------------
|
-----------------------ui columns--------------------------------
|
||||||
,'adjust volume' iterdet
|
,'adjust volume' iterdet
|
||||||
,null::jsonb iterdef
|
,null::jsonb iterdef
|
||||||
,od.ssyr order_season
|
,od.ssyr order_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom),'Mon') order_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom),'Mon') order_month
|
||||||
,sd.ssyr ship_season
|
,sd.ssyr ship_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag,'Mon') ship_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag,'Mon') ship_month
|
||||||
,rd.ssyr request_season
|
,rd.ssyr request_season
|
||||||
,to_char(make_date(mseq.yr + 2020,closest.s,m.odom) + rlag,'Mon') request_month
|
,to_char(make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag,'Mon') request_month
|
||||||
,b.part_descr
|
,b.part_descr
|
||||||
,b.part_family
|
,b.part_family
|
||||||
,b.part_group
|
,b.part_group
|
||||||
@ -443,11 +443,11 @@ FROM
|
|||||||
LEFT OUTER JOIN mseq ON
|
LEFT OUTER JOIN mseq ON
|
||||||
mseq.m = closest.m
|
mseq.m = closest.m
|
||||||
LEFT OUTER JOIN gld od ON
|
LEFT OUTER JOIN gld od ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) BETWEEN od.sdat AND od.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) BETWEEN od.sdat AND od.edat
|
||||||
LEFT OUTER JOIN gld rd ON
|
LEFT OUTER JOIN gld rd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag BETWEEN rd.sdat AND rd.edat
|
||||||
LEFT OUTER JOIN gld sd ON
|
LEFT OUTER JOIN gld sd ON
|
||||||
make_date(mseq.yr + 2020,closest.s,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag BETWEEN sd.sdat AND sd.edat
|
||||||
WHERE
|
WHERE
|
||||||
m._month = (SELECT _month FROM closest)
|
m._month = (SELECT _month FROM closest)
|
||||||
)
|
)
|
||||||
@ -641,4 +641,5 @@ GROUP BY
|
|||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
)
|
)
|
||||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
SELECT * FROM insagg
|
||||||
|
--SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||||
|
Loading…
Reference in New Issue
Block a user