Commit 5ef638b6 by 泽锋 李

fix

parent 3d6244dc
......@@ -1055,6 +1055,60 @@ quantity_final_advise as 'quantity_final_advise'
from dc_auto_turnover where gmt_modified>=@btime and gmt_modified<=@etime
)
", new { btime = DateTime.Now.ToDayHome(), etime = DateTime.Now.ToDayEnd() },commandTimeout:0);
_connection.Execute(@"REPLACE INTO dc_base_forecast_history_ocean(`bailun_sku`,`warehouse_code`,`bailun_sku_warehouse_code`,`date`,`date_str`,`create_date`,`sales`,`turnover_days`,`quantity_safe_inventory`,`supplier_delivery`,`transfer_config_delivery`,`transfer_bale_config_delivery`,`abroad_inbound_config_delivery`,`inspection_config_delivery`,`inspection_delivery`,`transfer_delivery`,`daily_weighted_sales`,`transfer_bale_delivery`,`abroad_inbound_delivery`,`quantity_final_advise`)
(
select
bailun_sku,
warehouse_code,
CONCAT(bailun_sku,warehouse_code) as 'bailun_sku_warehouse_code',
gmt_modified as 'date',
DATE_FORMAT(gmt_modified,'%Y-%m-%d') as 'date_str',
now() as 'create_date',
forecast_oneday_sales as 'sales',
turnover_days as 'turnover_days',
quantity_safe_inventory as 'quantity_safe_inventory',
supplier_delivery as 'supplier_delivery',
transfer_config_delivery as 'transfer_config_delivery',
transfer_bale_config_delivery as 'transfer_bale_config_delivery',
abroad_inbound_config_delivery as 'abroad_inbound_config_delivery',
inspection_config_delivery as 'inspection_config_delivery',
inspection_delivery as 'inspection_delivery',
transfer_delivery as 'transfer_delivery',
daily_weighted_sales as 'daily_weighted_sales',
transfer_bale_delivery as 'transfer_bale_delivery',
abroad_inbound_delivery as 'abroad_inbound_delivery',
quantity_final_advise as 'quantity_final_advise'
from dc_auto_turnover_ocean where gmt_modified>=@btime and gmt_modified<=@etime
)
", new { btime = DateTime.Now.ToDayHome(), etime = DateTime.Now.ToDayEnd() }, commandTimeout: 0);
_connection.Execute(@"REPLACE INTO dc_base_forecast_history_air(`bailun_sku`,`warehouse_code`,`bailun_sku_warehouse_code`,`date`,`date_str`,`create_date`,`sales`,`turnover_days`,`quantity_safe_inventory`,`supplier_delivery`,`transfer_config_delivery`,`transfer_bale_config_delivery`,`abroad_inbound_config_delivery`,`inspection_config_delivery`,`inspection_delivery`,`transfer_delivery`,`daily_weighted_sales`,`transfer_bale_delivery`,`abroad_inbound_delivery`,`quantity_final_advise`)
(
select
bailun_sku,
warehouse_code,
CONCAT(bailun_sku,warehouse_code) as 'bailun_sku_warehouse_code',
gmt_modified as 'date',
DATE_FORMAT(gmt_modified,'%Y-%m-%d') as 'date_str',
now() as 'create_date',
forecast_oneday_sales as 'sales',
turnover_days as 'turnover_days',
quantity_safe_inventory as 'quantity_safe_inventory',
supplier_delivery as 'supplier_delivery',
transfer_config_delivery as 'transfer_config_delivery',
transfer_bale_config_delivery as 'transfer_bale_config_delivery',
abroad_inbound_config_delivery as 'abroad_inbound_config_delivery',
inspection_config_delivery as 'inspection_config_delivery',
inspection_delivery as 'inspection_delivery',
transfer_delivery as 'transfer_delivery',
daily_weighted_sales as 'daily_weighted_sales',
transfer_bale_delivery as 'transfer_bale_delivery',
abroad_inbound_delivery as 'abroad_inbound_delivery',
quantity_final_advise as 'quantity_final_advise'
from dc_auto_turnover_air where gmt_modified>=@btime and gmt_modified<=@etime
)
", new { btime = DateTime.Now.ToDayHome(), etime = DateTime.Now.ToDayEnd() }, commandTimeout: 0);
}
/// <summary>
......@@ -1167,26 +1221,76 @@ from dc_auto_turnover where gmt_modified>=@btime and gmt_modified<=@etime
}
else // 过去
{
#region MyRegion
var unit_price = _connection.QueryFirstOrDefault<decimal?>(" select unit_price from dc_base_purchase_details where warehouse_into_code=@warehouse_into_code and bailun_sku=@bailun_sku and status!=-1 and create_time<=@btime limit 1 ", new
{
warehouse_into_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
btime = this_time_end
});
datas.FirstOrDefault(s => s.name == "采购单价").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = _connection.QueryFirstOrDefault<decimal?>(" select unit_price from dc_base_purchase_details where warehouse_into_code=@warehouse_into_code and bailun_sku=@bailun_sku and status!=-1 and create_time<=@btime limit 1 ", new
{
warehouse_into_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
btime = this_time_end
})
val = unit_price
});
var quantity_final_advise = _connection.QueryFirstOrDefault<decimal?>(" select quantity_final_advise from dc_base_forecast_history where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and status!=-1 and create_time<=@btime limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
date_str = this_time_end.ToString("yyyy-MM-dd")
});
datas.FirstOrDefault(s => s.name == "实际建议周转数").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = _connection.QueryFirstOrDefault<decimal?>(" select unit_price from dc_base_purchase_details where warehouse_into_code=@warehouse_into_code and bailun_sku=@bailun_sku and status!=-1 and create_time<=@btime limit 1 ", new
{
warehouse_into_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
btime = this_time_end
})
val = quantity_final_advise
});
datas.FirstOrDefault(s => s.name == "实际建议周转金额").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = quantity_final_advise * unit_price
});
var purchase_quantity = _connection.QueryFirstOrDefault<decimal?>(" select sum(quantity_purchase) from dc_base_purchase_details where warehouse_into_code=@warehouse_into_code and bailun_sku=@bailun_sku and status!=-1 and create_time>=@btime and create_time<=@etime ", new
{
warehouse_into_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
etime = this_time_end,
btime = this_time_end.ToDayHome()
});
datas.FirstOrDefault(s => s.name == "实际周转数").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = purchase_quantity
});
var freight_unit_price = _connection.QueryFirstOrDefault<decimal?>(" select freight_unit_price from dc_base_transfer_freight_log where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and action_date<=@btime limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
action_date = this_time_end
});
datas.FirstOrDefault(s => s.name == "实际运费单价").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = freight_unit_price
});
datas.FirstOrDefault(s => s.name == "实际周转运费").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
val = freight_unit_price * purchase_quantity
});
#endregion
//var freight_unit_price = _connection.QueryFirstOrDefault<decimal?>(" select freight_unit_price from dc_base_transfer_freight_log where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and action_date<=@btime limit 1 ", new
//{
// warehouse_code = result.warehouse_code,
// bailun_sku = result.bailun_sku,
// action_date = this_time_end
//});
//datas.FirstOrDefault(s => s.name == "海运周转数(推荐海运)").days.Add(new transfer_profit_dto.day_dto
//{
// date = this_time,
// val = freight_unit_price
//});
}
index++;
this_time = this_time.AddDays(1);
......
......@@ -36,7 +36,7 @@ namespace ResetOutofstock
//dc_auto_turnover.ResetHistory();
//dc_auto_turnover.CopyForecast();
}
}
catch (Exception ex)
{
......
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