vault backup: 2023-11-10 11:44:21

This commit is contained in:
Paul Trowbridge 2023-11-10 11:44:21 -05:00
parent 12b963b22f
commit 16be2ad264

View File

@ -36,13 +36,14 @@ BEGIN
----------------base product-------------------------------- ----------------base product--------------------------------
SELECT SELECT
m.part_group part_group
,min(i.item) item ,item
,i.stlc ,stlc
,i.v1ds ,v1ds
,i.v0ds ,v0ds
,jsonb_strip_nulls(jsonb_build_object('assc',CASE WHEN i.assc <> '' THEN i.assc ELSE null::text END,'majg',i.majg::int,'coltier',i.coltier)) idxk ,idxk
INTO INTO
_mold _mold
,_item ,_item
@ -51,19 +52,33 @@ BEGIN
,_v0ds ,_v0ds
,_iidx ,_iidx
FROM FROM
"CMS.CUSLG".itemmv i (
INNER JOIN rlarp.molds m ON SELECT
m.stlc = i.stlc m.part_group
WHERE ,min(i.item) item
i.stlc = _stlc ,i.stlc
AND i.v1ds = _dseg ,i.v1ds
GROUP BY ,i.v0ds
m.part_group ,jsonb_strip_nulls(jsonb_build_object('assc',CASE WHEN i.assc <> '' THEN i.assc ELSE null::text END,'majg',i.majg::int,'coltier',i.coltier)) idxk
,i.stlc ,CASE WHEN i.v1ds = _v1ds THEN 1 ELSE 0 END prefer
,i.v1ds FROM
,i.v0ds "CMS.CUSLG".itemmv i
,jsonb_strip_nulls(jsonb_build_object('assc',CASE WHEN i.assc <> '' THEN i.assc ELSE null::text END,'majg',i.majg::int,'coltier',i.coltier)); INNER JOIN rlarp.molds m ON
_rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds,'stlc',_stlc)||_iidx; m.stlc = i.stlc
WHERE
i.stlc = _stlc
GROUP BY
m.part_group
,i.stlc
,i.v1ds
,i.v0ds
,jsonb_strip_nulls(jsonb_build_object('assc',CASE WHEN i.assc <> '' THEN i.assc ELSE null::text END,'majg',i.majg::int,'coltier',i.coltier))
,CASE WHEN i.v1ds = _v1ds THEN 1 ELSE 0 END
) best
ORDER BY
prefer DESC
LIMIT 1;
_rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds,'stlc',_stlc,'item',_item,'desg',_dseg)||_iidx;
RAISE NOTICE 'item data %', _iidx; RAISE NOTICE 'item data %', _iidx;
----------------channel------------------------------------- ----------------channel-------------------------------------