@@ -33,7 +33,7 @@ sum(t1.quantity_transfer+t1.quantity_purchase) as 'quantity_ontheway'
...
@@ -33,7 +33,7 @@ sum(t1.quantity_transfer+t1.quantity_purchase) as 'quantity_ontheway'
from dc_mid_transit as t1
from dc_mid_transit as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
where t1.quantity_out_stock>0 ";
where t1.quantity_out_stock>0 and ( t3.buyer_name in ('张莹霞','张莹霞1','冯兆欣') and t1.warehouse_code ='GZBLWH' ) ";
}
}
else
else
{
{
...
@@ -51,7 +51,7 @@ t1.gmt_transfer_modified
...
@@ -51,7 +51,7 @@ t1.gmt_transfer_modified
from dc_mid_transit as t1
from dc_mid_transit as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
where t1.quantity_out_stock>0
where t1.quantity_out_stock>0 and ( t3.buyer_name in ('张莹霞','张莹霞1','冯兆欣') and t1.warehouse_code ='GZBLWH' )
";
";
}
}
...
@@ -144,7 +144,6 @@ from dc_base_oms_sku as t1
...
@@ -144,7 +144,6 @@ 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_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
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
where t1.pay_time>'2019-03-01' and t1.shipping_status!='TotalShipping' and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0
where t1.pay_time>'2019-03-01' and t1.shipping_status!='TotalShipping' and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0
and ( t6.buyer_name in ('张莹霞','张莹霞1','冯兆欣') and t1.warehouse_code ='GZBLWH' )
";
";
sql=@"
sql=@"
select
select
...
@@ -181,13 +180,28 @@ from dc_base_oms_sku as t1
...
@@ -181,13 +180,28 @@ from dc_base_oms_sku as t1
left join dc_mid_transit as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_mid_transit as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join dc_base_warehouse as t_db on t1.warehouse_code = t_db.warehouse_code
left join view_china_warehouse_stock as t3 on t1.bailun_sku = t3.bailun_sku and t_db.hq_type='国内仓'
left join view_china_warehouse_stock as t3 on t1.bailun_sku = t3.bailun_sku and t_db.hq_type='国内仓'
left join view_china_warehouse_unshipped as t4 on t1.bailun_sku = t4.bailun_sku and t_db.hq_type='国内仓'
left join (
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_shipped` ) else 0 end ) AS `sum_unshipped_quantity`
FROM
( `dc_base_oms_sku` `t1` LEFT JOIN `dc_base_warehouse` `t2` ON ( ( `t1`.`warehouse_code` = `t2`.`warehouse_code` ) ) )
WHERE
( ( `t2`.`hq_type` = '国内仓' ) AND ( `t1`.`shipping_status` <> 'TotalShipping' ) AND ( `t1`.`pay_time` > '2019-03-01' ) ) -- and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0
";
if(!string.IsNullOrWhiteSpace(m.bailun_sku))
{
sql+=$" and bailun_sku= '{m.bailun_sku}' ";
}
sql+=@" GROUP BY
`t1`.`bailun_sku`
) as t4 on t1.bailun_sku = t4.bailun_sku and t_db.hq_type='国内仓'
left join dc_base_stock as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_stock 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_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join view_buy_ontheway_detail as t8 on t1.bailun_sku = t8.bailun_sku and t1.warehouse_code = t8.warehouse_code
left join view_buy_ontheway_detail as t8 on t1.bailun_sku = t8.bailun_sku and t1.warehouse_code = t8.warehouse_code
where t1.shipping_status!='TotalShipping' and t1.pay_time>'2019-03-01' and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0
where t1.shipping_status!='TotalShipping' and t1.pay_time>'2019-03-01' and t1.bailun_order_status !='Canceled' and t1.has_delete=0 and t1.has_scalp=0
and ( t6.buyer_name in ('张莹霞','张莹霞1','冯兆欣') and t1.warehouse_code ='GZBLWH' )