dont use iterdet anymore since not in osm. iter = source + behavior
This commit is contained in:
parent
1f97d74257
commit
932c95e83c
17
index.js
17
index.js
@ -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('/logs', (req, res) => res.sendFile('~/forecast_api/logs.html'))
|
||||
@ -149,8 +149,7 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) {
|
||||
sql = sql.replace(new RegExp("target_increment",'g'),req.body.amount);
|
||||
sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
|
||||
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'),"addmonth_vd");
|
||||
sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
console.log(sql)
|
||||
@ -184,8 +183,7 @@ server.post('/addmonth_vp', bodyParser.json(), function (req, res) {
|
||||
sql = sql.replace(new RegExp("target_price",'g'),req.body.amount);
|
||||
sql = sql.replace(new RegExp("target_month",'g'),req.body.month);
|
||||
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'),"addmonth_vupd");
|
||||
sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
Postgres.FirstRow(sql,[],res)
|
||||
@ -225,8 +223,7 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
|
||||
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_v");
|
||||
sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
Postgres.FirstRow(sql,[],res)
|
||||
@ -266,8 +263,7 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
|
||||
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 price");
|
||||
sql = sql.replace(new RegExp("replace_iterdet",'g'),"scale_p");
|
||||
sql = sql.replace(new RegExp("replace_iteration",'g'),req.body.iter);
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
Postgres.FirstRow(sql,[],res)
|
||||
@ -308,8 +304,7 @@ server.post('/scale_vp', bodyParser.json(), function (req, res) {
|
||||
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("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_iteration",'g'),req.body.iter);
|
||||
sql = sql.replace(new RegExp("replace_iterdef",'g'),JSON.stringify(req.body));
|
||||
//console.log(sql);
|
||||
Postgres.FirstRow(sql,[],res)
|
||||
|
@ -15,6 +15,6 @@
|
||||
"tar_qty": 18623740,
|
||||
"stamp": "2019-03-01 10:00:00",
|
||||
"user": "Trowbridge, Paul",
|
||||
"type": "scale_vp",
|
||||
"source": "forecast ui"
|
||||
"source": "forecast ui",
|
||||
"type":"scale_v"
|
||||
}
|
@ -395,7 +395,7 @@ SELECT
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' iter --calculated
|
||||
,'replace_source'||' volume' iter --calculated
|
||||
-----------------------ui columns--------------------------------
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
|
@ -392,7 +392,7 @@ SELECT
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag adj_requestdate
|
||||
,make_date(mseq.yr + 2020,mseq.cal,m.odom) + rlag + slag adj_shipdate
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' iter --calculated
|
||||
,'replace_source'||' volume' iter
|
||||
-----------------------ui columns--------------------------------
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
|
@ -273,7 +273,7 @@ SELECT
|
||||
,b.adj_requestdate
|
||||
,b.adj_shipdate
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' "b.iter" --calculated
|
||||
,'replace_source'||' price' iter --calculated
|
||||
-----------------------ui columns--------------------------------
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
|
@ -273,7 +273,7 @@ SELECT
|
||||
,b.adj_requestdate
|
||||
,b.adj_shipdate
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' iter --calculated
|
||||
,'replace_source'||' volume' iter
|
||||
-----------------------ui columns--------------------------------
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
|
@ -274,7 +274,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
||||
,b.adj_requestdate
|
||||
,b.adj_shipdate
|
||||
,'replace_version' "version" --calculated
|
||||
,'replace_iteration' iter --calculated
|
||||
,'replace_source'||' volume' iter
|
||||
-----------------------ui columns--------------------------------
|
||||
,'replace_iterdet' iterdet
|
||||
,$$replace_iterdef$$::jsonb iterdef
|
||||
|
Loading…
Reference in New Issue
Block a user