vault backup: 2023-11-07 00:48:22

This commit is contained in:
Paul Trowbridge 2023-11-07 00:48:22 -05:00
parent 1f308befbb
commit 1b54c2d370

View File

@ -19,6 +19,7 @@ DECLARE
_rslt jsonb; _rslt jsonb;
_targ jsonb; _targ jsonb;
_list jsonb; _list jsonb;
_iidx jsonb;
BEGIN BEGIN
--_item := 'AMK06000G18B054'; --_item := 'AMK06000G18B054';
@ -31,9 +32,9 @@ BEGIN
----------------base product-------------------------------- ----------------base product--------------------------------
SELECT SELECT
m.part_group, i.v1ds,i.v0ds m.part_group, i.v1ds,i.v0ds,jsonb_build_object('assc',i.assc,'majg',i.majg::int,'coltier',i.coltier) idxk
INTO INTO
_mold,_v1ds ,_v0ds _mold,_v1ds ,_v0ds, _iidx
FROM FROM
"CMS.CUSLG".itemmv i "CMS.CUSLG".itemmv i
INNER JOIN rlarp.molds m ON INNER JOIN rlarp.molds m ON
@ -42,7 +43,7 @@ BEGIN
i.item = _item; i.item = _item;
--RAISE NOTICE 'mold %', _mold; --RAISE NOTICE 'mold %', _mold;
--RAISE NOTICE 'v1ds %', _v1ds; --RAISE NOTICE 'v1ds %', _v1ds;
_rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds); _rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds)||_iidx;
----------------channel------------------------------------- ----------------channel-------------------------------------
@ -80,6 +81,29 @@ BEGIN
--RAISE NOTICE 'target: %', jsonb_pretty(_targ); --RAISE NOTICE 'target: %', jsonb_pretty(_targ);
_rslt := _rslt||COALESCE(_targ,'{}'::jsonb); _rslt := _rslt||COALESCE(_targ,'{}'::jsonb);
----------------inflation index-----------------------------
SELECT
jsonb_build_object(
'iidx'
,jsonb_build_object(
priority
,min(factor)
)
)
INTO
_iidx
FROM
rlarp.costindex
WHERE
timeframe @> current_date
AND (
attr @> _iidx
OR attr @> jsonb_build_object('stlc',_mold)
)
GROUP BY
priority;
--RAISE NOTICE 'target: %', jsonb_pretty(_targ);
_rslt := _rslt||COALESCE(_iidx,'{}'::jsonb);
----------------list ppricing------------------------------- ----------------list ppricing-------------------------------
SELECT coalesce(rlarp.get_list(_bill, _ship, _item, _qty),'{}'::jsonb) INTO _list; SELECT coalesce(rlarp.get_list(_bill, _ship, _item, _qty),'{}'::jsonb) INTO _list;
_rslt := _rslt||_list; _rslt := _rslt||_list;