Commit b5cc4f3d by lizefeng

新增无库仓商品销量监控

parent 6f9a99aa
......@@ -375,6 +375,31 @@ alter table buy_ontheway_detail rename buy_ontheway_detailTemp;
alter table buy_ontheway_detail_temp rename buy_ontheway_detail;
alter table buy_ontheway_detailTemp rename buy_ontheway_detail_temp;
truncate table buy_ontheway_detail_temp; ", commandTimeout: 0);
//刷新无库仓商品日均
_connection.Execute(@" -- 刷新无库仓商品日均
set session transaction isolation level read uncommitted;
start transaction;
-- 清空视图表的数据
Truncate table dc_not_stock_goods_sales_temp;
INSERT into dc_not_stock_goods_sales_temp(`product_inner_code`,`warehouse_code`,`test_sales`,`success_sales`) (
select
t2.product_inner_code,t1.warehouse_code,
sum(case when TIMESTAMPDIFF(day,t2.push_time,now())<21 then t1.bailun_sku_quantity_ordered else 0 end) as 'test_sales', -- 推送之后 21 日的销量
sum(case when TIMESTAMPDIFF(day,t2.push_time,now())<7 then t1.bailun_sku_quantity_ordered else 0 end) as 'success_sales' -- 最近7日销量
from dc_base_oms_sku as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
left join dc_auto_config_sku_warehouse as t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code = t3.warehouse_code
where t1.warehouse_code='BLGZ03' and t1.bailun_order_status!='Canceled' and (t3.`status`=0 or t3.`status` is null)
GROUP BY t2.product_inner_code,t1.warehouse_code
);
alter table dc_not_stock_goods_sales rename dc_not_stock_goods_salesTemp;
alter table dc_not_stock_goods_sales_temp rename dc_not_stock_goods_sales;
alter table dc_not_stock_goods_salesTemp rename dc_not_stock_goods_sales_temp;
truncate table dc_not_stock_goods_sales_temp; ", commandTimeout: 0);
}
catch (Exception ex)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment