Merge branch 'dev' of github.com:fleetside72/forecast_api into dev

This commit is contained in:
Paul Trowbridge 2019-03-20 00:44:27 -05:00
commit ccb40d309d
8 changed files with 38 additions and 15 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ npm-debug.log
logs.html logs.html
stat.html stat.html
*.pem *.pem
node.log

View File

@ -162,7 +162,6 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) {
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_source",'g'),req.body.source); sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
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) console.log(sql)
Postgres.FirstRow(sql,[],res) Postgres.FirstRow(sql,[],res)
} }
@ -196,7 +195,7 @@ server.post('/addmonth_vp', bodyParser.json(), function (req, res) {
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_source",'g'),req.body.source); sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
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)
} }
@ -236,7 +235,7 @@ server.post('/scale_v', bodyParser.json(), function (req, res) {
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_source",'g'),req.body.source); sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
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)
} }
@ -276,7 +275,7 @@ server.post('/scale_p', bodyParser.json(), function (req, res) {
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_source",'g'),req.body.source); sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
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)
} }
@ -317,7 +316,7 @@ server.post('/scale_vp', bodyParser.json(), function (req, res) {
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_source",'g'),req.body.source); sql = sql.replace(new RegExp("replace_source",'g'),req.body.source);
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)
} }

View File

@ -151,8 +151,8 @@ SELECT
,terms ,terms
,''::text custpo --0 ,''::text custpo --0
,'I' dhincr --0 ,'I' dhincr --0
,sum(diext) diext ,null::numeric diext
,sum(ditdis) ditdis ,null::numeric ditdis
,null::date dcodat --calculated date mix ,null::date dcodat --calculated date mix
,null::date ddqdat --calculated date mix ,null::date ddqdat --calculated date mix
,null::date dcmdat --calculated date mix ,null::date dcmdat --calculated date mix

View File

@ -145,8 +145,8 @@ SELECT
,terms ,terms
,''::text custpo --0 ,''::text custpo --0
,'I' dhincr --0 ,'I' dhincr --0
,sum(diext) diext ,null::numeric diext
,sum(ditdis) ditdis ,null::numeric ditdis
,null::date dcodat --calculated date mix ,null::date dcodat --calculated date mix
,null::date ddqdat --calculated date mix ,null::date ddqdat --calculated date mix
,null::date dcmdat --calculated date mix ,null::date dcmdat --calculated date mix

23
route_sql/part_list.sql Normal file
View File

@ -0,0 +1,23 @@
WITH
act As (
SELECT DISTINCT
v6part part
FROM
lgdat.stka
WHERE
v6stat = 'A'
)
,stkm AS (
SELECT
act.part || ' - ' ||rtrim(COALESCE(m.avdes1,p.awdes1)) part
--,COALESCE(m.avgled, p.awgled) glec
FROM
act
LEFT OUTER JOIN lgdat.stkmm m ON
m.avpart = act.part
LEFT OUTER JOIN lgdat.stkmp p ON
p.awpart = act.part
WHERE
substr(COALESCE(m.avgled, p.awgled),1,1) <= '2'
)
select part from stkm

View File

@ -14,8 +14,8 @@ SELECT
,terms ,terms
,''::text custpo --0 ,''::text custpo --0
,'I' dhincr --0 ,'I' dhincr --0
,sum(diext) diext ,null::numeric diext
,sum(ditdis) ditdis ,null::numeric ditdis
,null::date dcodat --calculated date mix ,null::date dcodat --calculated date mix
,null::date ddqdat --calculated date mix ,null::date ddqdat --calculated date mix
,null::date dcmdat --calculated date mix ,null::date dcmdat --calculated date mix

View File

@ -14,8 +14,8 @@ SELECT
,terms ,terms
,''::text custpo --0 ,''::text custpo --0
,'I' dhincr --0 ,'I' dhincr --0
,sum(diext) diext ,null::numeric diext
,sum(ditdis) ditdis ,null::numeric ditdis
,null::date dcodat --calculated date mix ,null::date dcodat --calculated date mix
,null::date ddqdat --calculated date mix ,null::date ddqdat --calculated date mix
,null::date dcmdat --calculated date mix ,null::date dcmdat --calculated date mix

View File

@ -14,8 +14,8 @@ target AS (select target_vol vincr, target_prc pincr)
,terms ,terms
,''::text custpo --0 ,''::text custpo --0
,'I' dhincr --0 ,'I' dhincr --0
,sum(diext) diext ,null::numeric diext
,sum(ditdis) ditdis ,null::numeric ditdis
,null::date dcodat --calculated date mix ,null::date dcodat --calculated date mix
,null::date ddqdat --calculated date mix ,null::date ddqdat --calculated date mix
,null::date dcmdat --calculated date mix ,null::date dcmdat --calculated date mix