Commit 3296107f by lizefeng

供应商交期没算出来,则取值-1

parent 2435f29b
...@@ -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' )
"; ";
if (!string.IsNullOrWhiteSpace(m.product_inner_code)) if (!string.IsNullOrWhiteSpace(m.product_inner_code))
......
...@@ -93,7 +93,7 @@ namespace AutoTurnOver.Services ...@@ -93,7 +93,7 @@ namespace AutoTurnOver.Services
else else
{ {
// 不够5个单不算这个值 // 不够5个单不算这个值
data.delivery_days = 0; data.delivery_days = -1;
} }
data.virtual_delivery_days = temp_delivery_days; data.virtual_delivery_days = temp_delivery_days;
data.payment_type = purchaseList.Any(s => s.pay_type == 1) ? 1 : 2; data.payment_type = purchaseList.Any(s => s.pay_type == 1) ? 1 : 2;
...@@ -109,7 +109,7 @@ namespace AutoTurnOver.Services ...@@ -109,7 +109,7 @@ namespace AutoTurnOver.Services
else else
{ {
// 不够3个单,不该有平均数 // 不够3个单,不该有平均数
data.delivery_days = 0; data.delivery_days = -1;
data.supplier_name = ""; data.supplier_name = "";
AveragePurchase.Save(data, conn); AveragePurchase.Save(data, conn);
} }
......
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