update scale by price route

This commit is contained in:
Paul Trowbridge 2019-03-13 17:27:59 -04:00
parent 0ce9056d7c
commit 9d6453f837
2 changed files with 9 additions and 7 deletions

View File

@ -31,7 +31,7 @@ Postgres.FirstRow = function (inSQL, args, inResponse) {
}); });
}; };
server.get('/', (req, res) => res.send('node.js express is up and running')) server.get('/', (req, res) => res.send('node.js express is up and running 🤩'))
server.get('/test_sql', function(req, res){ server.get('/test_sql', function(req, res){
@ -258,6 +258,10 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
//console.log(args); //console.log(args);
sql = sql.replace(new RegExp("where_clause",'g'),w); 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("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_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 @@ SELECT
-----------------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
@ -274,11 +272,11 @@ SELECT
,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' "b.iter" --calculated
-----------------------ui columns-------------------------------- -----------------------ui columns--------------------------------
,'scale price' 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