commit: 2024-12-13 13:27:03
This commit is contained in:
parent
73cd1c3506
commit
31e474ca26
@ -48,6 +48,9 @@ lq AS MATERIALIZED (
|
||||
,lq.url
|
||||
,lq.tacticalmodifier
|
||||
,lq.finalrecommendedprice
|
||||
,lq.lowerpricelimit
|
||||
,lq.upperpricelimit
|
||||
,(lq.upperpricelimit + lq.lowerpricelimit) / 2 midrange
|
||||
,i.partgroup part_group
|
||||
-- ,pricing->'product'->>'itemrel' item_fit
|
||||
,i.mpck pltq
|
||||
@ -55,6 +58,28 @@ lq AS MATERIALIZED (
|
||||
-- ,pricing->'guidance'->'finalPrice'->>'Reason' reason
|
||||
,i.curstdus cstd_usd
|
||||
,i.futstdus fstd_usd
|
||||
,CASE
|
||||
WHEN i.glec = '1NU' THEN
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN units_each >= 24*mpck THEN lq.lowerpricelimit
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each >= 8*mpck THEN (lq.upperpricelimit + lq.lowerpricelimit) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each < 8*mpck THEN lq.upperpricelimit
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each < mpck THEN lq.upperpricelimit * 1.15
|
||||
END END END END
|
||||
ELSE
|
||||
--if more than 8/24 pallets, use floor
|
||||
CASE WHEN units_each >= 08*mpck THEN lq.lowerpricelimit
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each >= 2*mpck THEN (lq.upperpricelimit + lq.lowerpricelimit) / 2
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each < 2*mpck THEN lq.upperpricelimit
|
||||
-- if more than a pallet use the target price
|
||||
ELSE CASE WHEN units_each < mpck THEN lq.upperpricelimit * 1.15
|
||||
END END END END
|
||||
END guidance
|
||||
-- ,(pricing->'guidance'->>'ltp')::numeric ltp
|
||||
-- ,(pricing->'guidance'->>'optimization')::numeric optimization
|
||||
-- ,(pricing->'guidance'->>'inflationFactor')::numeric inflation
|
||||
@ -99,4 +124,4 @@ lq AS MATERIALIZED (
|
||||
,price_usd numeric
|
||||
) ON TRUE
|
||||
)
|
||||
SELECT * FROM hist
|
||||
SELECT * FROM hist --WHERE qid = 108596
|
||||
|
Loading…
Reference in New Issue
Block a user