update scale volume route to contain iteration info

This commit is contained in:
Paul Trowbridge 2019-03-13 23:25:07 -04:00
parent 9d6453f837
commit 92657e72c3
2 changed files with 9 additions and 7 deletions

View File

@ -221,6 +221,10 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
//console.log(args);
sql = sql.replace(new RegExp("where_clause",'g'),w);
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume");
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale volume");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql);
Postgres.FirstRow(sql,[],res)
}
@ -260,7 +264,7 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool price");
sql = sql.replace(new RegExp("replace_iterdet",'g'),"addmonth_vupd");
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale price");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql);
Postgres.FirstRow(sql,[],res)

View File

@ -114,8 +114,6 @@ SELECT
-----------------scenario----------------------------
where_clause
-----------------additional params-------------------
AND version = 'b20'
AND iter = 'copy'
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND adj_orderdate <= adj_shipdate
GROUP BY
@ -274,11 +272,11 @@ SELECT
,b.adj_orderdate
,b.adj_requestdate
,b.adj_shipdate
,b.version --calculated
,b.iter --calculated
,'replace_version' "version" --calculated
,'replace_iteration' iter --calculated
-----------------------ui columns--------------------------------
,'scale volume' iterdet
,null::jsonb iterdef
,'replace_iterdet' iterdet
,$$replace_iterdef$$::jsonb iterdef
,b.order_season
,b.order_month
,b.ship_season