update volume and price, as well as description on other routes

This commit is contained in:
Paul Trowbridge 2019-03-13 23:32:12 -04:00
parent 92657e72c3
commit 0e3bc60dd7
2 changed files with 12 additions and 10 deletions

View File

@ -223,7 +223,7 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount); 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_version",'g'),req.body.scenario.version);
sql = sql.replace(new RegExp("replace_iteration",'g'),"tool volume"); 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_iterdet",'g'),"scale_v");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
@ -264,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("target_increment",'g'),req.body.amount);
sql = sql.replace(new RegExp("replace_version",'g'),req.body.scenario.version); 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_iteration",'g'),"tool price");
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale price"); sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_p");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body)); sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
@ -304,6 +304,10 @@ server.post('/scale_vp', bodyParser.json(), function (req, res) {
sql = sql.replace(new RegExp("where_clause",'g'),w); sql = sql.replace(new RegExp("where_clause",'g'),w);
sql = sql.replace(new RegExp("target_vol",'g'),req.body.qty); sql = sql.replace(new RegExp("target_vol",'g'),req.body.qty);
sql = sql.replace(new RegExp("target_prc",'g'),req.body.amount); sql = sql.replace(new RegExp("target_prc",'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 and price");
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_vp");
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
//console.log(sql); //console.log(sql);
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
} }

View File

@ -114,8 +114,6 @@ target AS (select target_vol vincr, target_prc pincr)
-----------------scenario---------------------------- -----------------scenario----------------------------
where_clause where_clause
-----------------additional params------------------- -----------------additional params-------------------
AND version = 'b20'
AND iter = 'copy'
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
AND adj_orderdate <= adj_shipdate AND adj_orderdate <= adj_shipdate
GROUP BY GROUP BY
@ -275,11 +273,11 @@ target AS (select target_vol vincr, target_prc pincr)
,b.adj_orderdate ,b.adj_orderdate
,b.adj_requestdate ,b.adj_requestdate
,b.adj_shipdate ,b.adj_shipdate
,b.version --calculated ,'replace_version' "version" --calculated
,b.iter --calculated ,'replace_iteration' iter --calculated
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'scale vp' iterdet ,'replace_iterdet' iterdet
,null::jsonb iterdef ,$$replace_iterdef$$::jsonb iterdef
,b.order_season ,b.order_season
,b.order_month ,b.order_month
,b.ship_season ,b.ship_season
@ -400,8 +398,8 @@ target AS (select target_vol vincr, target_prc pincr)
,b.version --calculated ,b.version --calculated
,b.iter --calculated ,b.iter --calculated
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'scale vp' iterdet ,b.iterdet
,null::jsonb iterdef ,b.iterdef
,b.order_season ,b.order_season
,b.order_month ,b.order_month
,b.ship_season ,b.ship_season