Commit b1c54947 by 泽锋 李

新增供应链采购在途

parent 722a9a80
......@@ -1322,25 +1322,18 @@ where id=@id
sql = @"
select
sum(ifnull(t4.usable_stock,0)) as 'stock',
sum(ifnull(t1.quantity_purchase,0)) as 'quantity_purchase',
sum(ifnull(t1.`quantity_arrival`,0)) as 'quantity_arrival',
sum(ifnull(t1.`quantity_inbound`,0)) as 'quantity_inbound',
sum(ifnull(t1.`quantity_not_inbound`,0)) as 'quantity_not_inbound',
sum(ifnull(t8.distribution_quantity,0)) as 'prod_distribution_quantity',
sum(ifnull(( t8.order_quantity - t8.distribution_quantity),0)) as 'prod_not_distribution_quantity',
sum(ifnull(t8.prod_quantity,0)) as 'prod_quantity'
sum(ifnull(t1.`quantity_not_inbound`,0)) as 'quantity_not_inbound'
from dc_base_purchase_details as t1
from dc_base_purchase_details as t1
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_stock as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code
left join dc_mid_transit as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_auto_turnover as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_forecast_fluctuation as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join ( select * from dc_base_prod_order where is_delete=0 ) as t8 on t1.bailun_sku = t8.bailun_sku and t1.purchase_id = t8.purchase_no
";
if ((categoryModels != null && categoryModels.Count >= 1) || !string.IsNullOrWhiteSpace(search_data.buyer_name) || search_data.product_type > 0)
{
sql += " left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku ";
}
if (search_data.has_tort != null)
{
sql += " left join dc_base_tort as t9 on t1.bailun_sku = t9.bailun_sku ";
......@@ -1349,7 +1342,7 @@ left join ( select * from dc_base_prod_order where is_delete=0 ) as t8 on t1.ba
{
sql += " left join dc_auto_config_sku_warehouse as t10 on t1.bailun_sku = t10.bailun_sku and t1.warehouse_code = t10.warehouse_code ";
}
sql += " where t1.`status` not in (-1,4) and t1.has_delete =0 and t1.quantity_not_inbound > 0 ";
sql += " where t1.`status` not in (-1,4) and t1.has_delete =0 and t1.quantity_not_inbound > 0 ";
}
else
{
......@@ -1394,7 +1387,7 @@ left join dc_base_stock as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_
left join dc_mid_transit as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_auto_turnover as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_forecast_fluctuation as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join ( select * from dc_base_prod_order where is_delete=0 ) as t8 on t1.bailun_sku = t8.bailun_sku and t1.purchase_id = t8.purchase_no
left join dc_base_prod_order as t8 on t1.bailun_sku = t8.bailun_sku and t1.purchase_id = t8.purchase_no
";
......@@ -1406,7 +1399,7 @@ left join ( select * from dc_base_prod_order where is_delete=0 ) as t8 on t1.b
{
sql += " left join dc_auto_config_sku_warehouse as t10 on t1.bailun_sku = t10.bailun_sku and t1.warehouse_code = t10.warehouse_code ";
}
sql += " where t1.`status` not in (-1,4) and t1.has_delete =0 and t1.quantity_not_inbound > 0 ";
sql += " where t1.`status` not in (-1,4) and t1.has_delete =0 and t1.quantity_not_inbound > 0 and t8.is_delete=0 ";
}
......
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