left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join ( select bailun_sku,sum(bailun_sku_quantity_ordered) as 'quantity',GROUP_CONCAT(bailun_order_id) as 'bailun_order_ids' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and website='us' and gmt_create>@time and has_scalp=0 GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
left join ( select bailun_sku,sum(bailun_sku_quantity_ordered) as 'quantity',GROUP_CONCAT(bailun_order_id) as 'bailun_order_ids' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and website='us' and gmt_create>@time and has_scalp=0 and has_buyer_remark = 0
and has_platsku_remark = 0 GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪') and t1.warehouse_code in ('BLGZ03') )
-- and t6.suppliers_name not in ('深圳市龙岗区平湖欧妮菲制衣厂','深圳市福田区曼戈制衣厂')
and ( t5.`status`=0 or t5.`status` is null ) and t8.quantity>0
INSERT into dc_base_oms_bailun_no_map_items_temp(`bailun_order_id`,`items`) (
select t1.bailun_order_id,GROUP_CONCAT(DISTINCT t1.item_id) as 'items' from dc_base_oms_platform_sku as t1
where t1.create_time>'2019-03-01 12:00:00' and t1.bailun_order_status = 'Handling' and t1.has_delete=0 and t1.has_scalp=0 and t1.bailun_interception_status not in ('Success','Part') and t1.platform_type!='FBA'
where t1.create_time>'2019-03-01 12:00:00' and t1.bailun_order_status = 'Handling' and t1.has_delete=0 and t1.has_scalp=0 and t1.has_buyer_remark = 0
and t1.has_platsku_remark = 0 and t1.bailun_interception_status not in ('Success','Part') and t1.platform_type!='FBA'
GROUP BY t1.bailun_order_id
);
...
...
@@ -926,7 +927,8 @@ INSERT into dc_base_oms_sku_outofstock_temp (
from dc_base_oms_sku as t1
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.company_id=1 and t1.has_innersale=0 and t1.create_time>'2019-03-01 12:00:00' and t1.bailun_picking_status!='TotalPicked' and t1.bailun_order_status = 'Handling' and t1.has_delete=0 and t1.has_scalp=0 and t1.bailun_interception_status not in ('Success','Part') and t1.platform_type!='FBA'
where t1.company_id=1 and t1.has_innersale=0 and t1.create_time>'2019-03-01 12:00:00' and t1.bailun_picking_status!='TotalPicked' and t1.bailun_order_status = 'Handling' and t1.has_delete=0 and t1.has_scalp=0 and t1.has_buyer_remark = 0
and t1.has_platsku_remark = 0 and t1.bailun_interception_status not in ('Success','Part') and t1.platform_type!='FBA'
);
alter table dc_base_oms_sku_outofstock rename dc_base_oms_sku_outofstockTemp;
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`
sum(case when t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0 and t1.has_buyer_remark = 0
and t1.has_platsku_remark = 0 then ( `t1`.`bailun_sku_quantity_ordered` - `t1`.`bailun_sku_quantity_picked` ) else 0 end ) AS `sum_unshipped_quantity`
FROM
( `dc_base_oms_sku_outofstock` `t1` LEFT JOIN `dc_base_warehouse` `t2` ON ( ( `t1`.`warehouse_code` = `t2`.`warehouse_code` ) ) )
WHERE
...
...
@@ -1230,13 +1233,14 @@ INSERT into dc_base_oms_sku_7_temp (
from dc_base_oms_sku as t1
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.company_id=1 and t1.has_innersale=0 and t1.create_time>@time and t1.has_delete=0 and t1.has_scalp=0
where t1.company_id=1 and t1.has_innersale=0 and t1.create_time>@time and t1.has_delete=0 and t1.has_scalp=0 and t1.has_buyer_remark = 0
and t1.has_platsku_remark = 0
);
alter table dc_base_oms_sku_7 rename dc_base_oms_sku_7Temp;
alter table dc_base_oms_sku_7_temp rename dc_base_oms_sku_7;
alter table dc_base_oms_sku_7Temp rename dc_base_oms_sku_7_temp;