Switch source table from rlarp.itemmv to "CMS.CUSLG".itemm

This commit is contained in:
PhilRunninger 2023-03-01 17:55:30 -05:00
parent 59cb926d9c
commit ed5975daf7
6 changed files with 99 additions and 98 deletions

View File

@ -1,3 +1,4 @@
-- Connection: usmidsap01.ubm
--\timing --\timing
TRUNCATE TABLE rlarp.osmf; TRUNCATE TABLE rlarp.osmf;

View File

@ -39,7 +39,7 @@ SELECT DISTINCT
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance ,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
FROM FROM
rlarp.osm_pool o rlarp.osm_pool o
LEFT OUTER JOIN rlarp.itemmv i ON LEFT OUTER JOIN "CMS.CUSLG".itemmv i ON
i.item = o.part i.item = o.part
LEFT OUTER JOIN seg ON LEFT OUTER JOIN seg ON
seg.glec = i.glec seg.glec = i.glec

View File

@ -154,7 +154,7 @@ incr AS (
,row_number() OVER (PARTITION BY o.styc||'.'||o.colgrp||substring(o.sizc,1,3),o.account, o.shipgrp ORDER BY o.odate DESC) rn ,row_number() OVER (PARTITION BY o.styc||'.'||o.colgrp||substring(o.sizc,1,3),o.account, o.shipgrp ORDER BY o.odate DESC) rn
FROM FROM
rlarp.osm_dev o rlarp.osm_dev o
INNER JOIN rlarp.itemmv i ON INNER JOIN "CMS.CUSLG".itemm i ON
i.item = o.part i.item = o.part
WHERE WHERE
---exclude R&A's ---exclude R&A's
@ -226,7 +226,7 @@ SELECT
,jsonb_agg(DISTINCT iter) iters ,jsonb_agg(DISTINCT iter) iters
FROM FROM
rlarp.osm_pool o rlarp.osm_pool o
,rlarp.itemmv i ,"CMS.CUSLG".itemm i
WHERE WHERE
i.item = o.part i.item = o.part
--AND o.units <> 0 --AND o.units <> 0
@ -415,7 +415,7 @@ GROUP BY
FROM FROM
rlarp.osm_pool o rlarp.osm_pool o
--need to join to itemm to get the product from osm_pool --need to join to itemm to get the product from osm_pool
,rlarp.itemmv i ,"CMS.CUSLG".itemm i
WHERE WHERE
i.item = o.part i.item = o.part
GROUP BY GROUP BY

View File

@ -354,7 +354,7 @@ SELECT
FROM FROM
basemix b basemix b
CROSS JOIN log CROSS JOIN log
LEFT OUTER JOIN rlarp.itemmv i ON LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
i.item = b.part i.item = b.part
LEFT OUTER JOIN SEG ON LEFT OUTER JOIN SEG ON
SEG.GLEC = i.glec SEG.GLEC = i.glec

View File

@ -11,7 +11,7 @@ target AS (select 'replace_new_mold' new_mold)
SUM(value_usd) value_usd SUM(value_usd) value_usd
FROM FROM
rlarp.osm_pool o rlarp.osm_pool o
LEFT OUTER JOIN rlarp.itemmv i ON LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
i.item = o.part i.item = o.part
WHERE WHERE
-----------------scenario---------------------------- -----------------scenario----------------------------
@ -46,7 +46,7 @@ target AS (select 'replace_new_mold' new_mold)
CASE WHEN substring(b.part,9,12) = substring(i.item,9,12) THEN '1' ELSE 0 END fit CASE WHEN substring(b.part,9,12) = substring(i.item,9,12) THEN '1' ELSE 0 END fit
FROM FROM
basemix b basemix b
LEFT OUTER JOIN rlarp.itemmv i ON LEFT OUTER JOIN "CMS.CUSLG".itemm i ON
i.stlc = (SELECT new_mold FROM target WHERE new_mold <> '') i.stlc = (SELECT new_mold FROM target WHERE new_mold <> '')
AND CASE WHEN b.sizc = i.sizc THEN '1' ELSE '0' END|| AND CASE WHEN b.sizc = i.sizc THEN '1' ELSE '0' END||
CASE WHEN i.aplnt = 'I' THEN '0' ELSE '1' END|| CASE WHEN i.aplnt = 'I' THEN '0' ELSE '1' END||

View File

@ -160,13 +160,13 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
remove o remove o
INNER JOIN pl ON INNER JOIN pl ON
pl.original = o.part pl.original = o.part
INNER JOIN rlarp.itemmv m ON INNER JOIN "CMS.CUSLG".itemm m ON
m.item = pl.replace m.item = pl.replace
LEFT OUTER JOIN rlarp.icstx c ON LEFT OUTER JOIN rlarp.icstx c ON
c.part = pl.replace c.part = pl.replace
AND c.plnt = m.dplt AND c.plnt = m.dplt
LEFT OUTER JOIN rlarp.plpr r ON LEFT OUTER JOIN rlarp.plpr r ON
yaplnt = m.dplt r.plnt = m.dplt
LEFT OUTER JOIN rlarp.ffcret x ON LEFT OUTER JOIN rlarp.ffcret x ON
x.fcur = r.curr x.fcur = r.curr
AND x.tcur = 'US' AND x.tcur = 'US'