left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
where t1.create_time>'2019-03-01 12:00:00' and t1.bailun_picking_status!='TotalPicked' and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0 and t1.bailun_interception_status not in ('Success','Part') and t1.platform_type!='FBA'
) ",commandTimeout:0);
);
alter table dc_base_oms_sku_outofstock rename dc_base_oms_sku_outofstockTemp;
alter table dc_base_oms_sku_outofstock_temp rename dc_base_oms_sku_outofstock;
alter table dc_base_oms_sku_outofstockTemp rename dc_base_oms_sku_outofstock_temp;
set session transaction isolation level read uncommitted;
start transaction;
-- 清空视图表的数据
Truncate table china_warehouse_unshipped;
Truncate table china_warehouse_unshipped_temp;
INSERT into china_warehouse_unshipped(`bailun_sku`,`sum_unshipped_quantity`) (
INSERT into china_warehouse_unshipped_temp(`bailun_sku`,`sum_unshipped_quantity`) (
SELECT
`t1`.`bailun_sku` AS `bailun_sku`,
sum(case when t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0 then ( `t1`.`bailun_sku_quantity_ordered` - `t1`.`bailun_sku_quantity_picked` ) else 0 end ) AS `sum_unshipped_quantity`
...
...
@@ -319,7 +328,12 @@ WHERE
`t2`.`hq_type` = '国内仓' and t1.warehouse_code not in('GZBLZZG','QYBLZZC','SZBLZZC')
GROUP BY
`t1`.`bailun_sku`
) ",commandTimeout:0);
);
alter table china_warehouse_unshipped rename china_warehouse_unshippedTemp;
alter table china_warehouse_unshipped_temp rename china_warehouse_unshipped;
alter table china_warehouse_unshippedTemp rename china_warehouse_unshipped_temp;