Commit be9645af by lizefeng

出缺货建议时,记录当时的缺货数

parent db7b17c4
......@@ -49,7 +49,7 @@ namespace AutoTurnOver.DB
INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`)
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`)
(
select * from (
select
......@@ -88,7 +88,8 @@ select
t1.sales_upper_limit,
0 as 'ispush',
(case when t1.quantity_out_stock>0 then 2 when t1.`status` then 1 else 3 end) as 'type',
t6.suppliers_id
t6.suppliers_id,
t1.quantity_out_stock
from dc_auto_turnover as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
......@@ -163,7 +164,7 @@ where t1.bailun_sku = t2.bailun_sku and quantity_final_advise=1 and quantity_ini
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`)
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`)
(
select
t1.bailun_sku,
......@@ -187,7 +188,8 @@ where t1.bailun_sku = t2.bailun_sku and quantity_final_advise=1 and quantity_ini
t1.sales_upper_limit,
0 as 'ispush',
2 as 'type',
t6.suppliers_id
t6.suppliers_id,
t7.quantity_out_stock
from dc_auto_turnover as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
......@@ -315,7 +317,7 @@ where ( t5.`status`=0 or t5.`status` is null ) and t1.quantity_begin_advise>0 an
sql = @"
select
sum(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
sum(t5.quantity_out_stock) as 'quantity_out_stock', -- 缺货
sum(t1.quantity_out_stock) as 'quantity_out_stock', -- 缺货
sum(t5.quantity_transfer) as 'quantity_transfer', -- 调拨在途
sum(t5.quantity_purchase) as 'quantity_purchase', -- 采购在途
sum(t5.quantity_inventory) as 'quantity_inventory', -- 库存数
......@@ -342,7 +344,7 @@ select
t1.*,t2.warehouse_name,t3.sku_title_cn as 'sku_name',t4.create_time,t3.buyer_name,
(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
(t5.daily_weighted_sales) as 'daily_weighted_sales', -- 日均加权
(t5.quantity_out_stock) as 'quantity_out_stock', -- 缺货
(t1.quantity_out_stock) as 'quantity_out_stock', -- 缺货
(t7.quantity_out_stock) as 'realtime_quantity_out_stock', -- 实时缺货
(t5.quantity_transfer) as 'quantity_transfer', -- 调拨在途
(t5.quantity_purchase) as 'quantity_purchase', -- 采购在途
......
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