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
@ -50,20 +51,34 @@ BEGIN
,_v1ds ,_v1ds
,_v0ds ,_v0ds
,_iidx ,_iidx
FROM
(
SELECT
m.part_group
,min(i.item) item
,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)) idxk
,CASE WHEN i.v1ds = _v1ds THEN 1 ELSE 0 END prefer
FROM FROM
"CMS.CUSLG".itemmv i "CMS.CUSLG".itemmv i
INNER JOIN rlarp.molds m ON INNER JOIN rlarp.molds m ON
m.stlc = i.stlc m.stlc = i.stlc
WHERE WHERE
i.stlc = _stlc i.stlc = _stlc
AND i.v1ds = _dseg
GROUP BY GROUP BY
m.part_group m.part_group
,i.stlc ,i.stlc
,i.v1ds ,i.v1ds
,i.v0ds ,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)); ,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))
_rslt := jsonb_build_object('mold',_mold,'v1ds',_v1ds,'v0ds',_v0ds,'stlc',_stlc)||_iidx; ,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-------------------------------------