@@ -233,7 +233,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
select
t1.bailun_sku,
'GZBLWH' as 'warehouse_code',
-1 as 'quantity_init_advise', -- 原始采购建议数量 new
( sum(t7.quantity_out_stock) - ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t1.quantity_transfer) + sum(t7.quantity_purchase) ) ) as 'quantity_init_advise', -- 原始采购建议数量 new
GREATEST(5,
( sum(t7.quantity_out_stock) - ( sum((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + sum(t1.quantity_transfer) + sum(t7.quantity_purchase) ) )
) as 'quantity_final_advise', -- 计算moq之后的数量 new
...
...
@@ -858,11 +858,9 @@ t3.suppliers_link,
(t3.unit_price * (case when t1.quantity_actual>0 then t1.quantity_actual else t1.quantity_final_advise end ) ) as 'quantity_final_advise_price', -- 采购金额
t3.suppliers_name,
(case when t2_s.hq_type='fba仓' then t2_s.bailun_account else t2_s.warehouse_name end) as 'source_warehouse_code_name',
t5.history_sevenday_sales as 't_history_sevenday_sales',
t5.history_fourteenday_sales as 't_history_fourteenday_sales',
t5.history_thirtyday_sales as 't_history_thirtyday_sales',
(t1.history_fourteenday_sales - t5.forecast_fourteenday_sales) as 'sudden_increase' -- 突增关注
from dc_auto_purchase_advise_detailed as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code