Commit 0cc3b764 by 泽锋 李

fix

parent 2e95eea7
......@@ -1043,7 +1043,7 @@ select t7_1.warehouse_code,t7_1.bailun_sku,(to_days(t7_1.estimated_arrival_time)
/// </summary>
public static void CopyForecast()
{
_connection.Execute(@"REPLACE INTO dc_base_forecast_history(`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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`)
_connection.Execute(@"REPLACE INTO dc_base_forecast_history(`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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`,`turnover_sales`)
(
select
t1.bailun_sku,
......@@ -1068,7 +1068,8 @@ t1.abroad_inbound_delivery as 'abroad_inbound_delivery',
t1.quantity_final_advise as 'quantity_final_advise',
t2.usable_stock as 'usable_stock',
t3.quantity_transfer as 'quantity_transfer',
t3.quantity_purchase as 'quantity_purchase'
t3.quantity_purchase as 'quantity_purchase',
t1.turnover_sales as 'turnover_sales'
from dc_auto_turnover as t1
left join dc_base_stock as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code =t2.warehouse_code
left join dc_mid_transit as t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code =t3.warehouse_code
......@@ -1076,7 +1077,7 @@ where t1.gmt_modified>=@btime and t1.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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`)
_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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`,`turnover_sales`)
(
select
t1.bailun_sku,
......@@ -1101,7 +1102,8 @@ t1.abroad_inbound_delivery as 'abroad_inbound_delivery',
t1.quantity_final_advise as 'quantity_final_advise',
t2.usable_stock as 'usable_stock',
t3.quantity_transfer as 'quantity_transfer',
t3.quantity_purchase as 'quantity_purchase'
t3.quantity_purchase as 'quantity_purchase',
t1.turnover_sales as 'turnover_sales'
from dc_auto_turnover_ocean as t1
left join dc_base_stock as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code =t2.warehouse_code
left join dc_mid_transit as t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code =t3.warehouse_code
......@@ -1109,7 +1111,7 @@ where t1.gmt_modified>=@btime and t1.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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`)
_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`,`usable_stock`,`quantity_transfer`,`quantity_purchase`,`turnover_sales`)
(
select
t1.bailun_sku,
......@@ -1134,7 +1136,8 @@ t1.abroad_inbound_delivery as 'abroad_inbound_delivery',
t1.quantity_final_advise as 'quantity_final_advise',
t2.usable_stock as 'usable_stock',
t3.quantity_transfer as 'quantity_transfer',
t3.quantity_purchase as 'quantity_purchase'
t3.quantity_purchase as 'quantity_purchase',
t1.turnover_sales
from dc_auto_turnover_air as t1
left join dc_base_stock as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code =t2.warehouse_code
left join dc_mid_transit as t3 on t1.bailun_sku = t3.bailun_sku and t1.warehouse_code =t3.warehouse_code
......@@ -1284,7 +1287,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
{
datas.FirstOrDefault(s => s.name == "安全库存数量").days.Add(new transfer_profit_dto.day_dto
{
has_int=true,
date = this_time,
val = result.quantity_safe_inventory
});
......@@ -1312,7 +1314,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
modalData.quantity_final_advise = (int)Math.Round(result.turnover_sales +result.quantity_safe_inventory );
datas.FirstOrDefault(s => s.name == "实际建议周转数").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.quantity_final_advise
});
......@@ -1328,7 +1329,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
modalData.turnover = dc_mid_transit_data+ dc_stock_data;
datas.FirstOrDefault(s => s.name == "实际周转数").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.turnover
});
......@@ -1378,7 +1378,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
modalData.quantity_final_advise_air = (int)Math.Round(result_air.turnover_sales + result_air.quantity_safe_inventory);
datas.FirstOrDefault(s => s.name == "空运周转数(推荐空运)").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.quantity_final_advise_air
});
......@@ -1448,7 +1447,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
});
datas.FirstOrDefault(s => s.name == "安全库存数量").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = quantity_safe_inventory
});
......@@ -1494,10 +1492,9 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
bailun_sku = result.bailun_sku,
date_str = this_time_end.ToString("yyyy-MM-dd")
})??new dc_base_forecast_history();
modalData.quantity_final_advise = ((dc_base_forecast_historydata.turnover_days * dc_base_forecast_historydata.daily_weighted_sales) + dc_base_forecast_historydata.quantity_safe_inventory);
modalData.quantity_final_advise = (int)Math.Round((dc_base_forecast_historydata.turnover_days * dc_base_forecast_historydata.daily_weighted_sales) + dc_base_forecast_historydata.quantity_safe_inventory);
datas.FirstOrDefault(s => s.name == "实际建议周转数").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.quantity_final_advise
});
......@@ -1516,7 +1513,6 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
});
datas.FirstOrDefault(s => s.name == "实际周转数").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.purchase_quantity
});
......@@ -1540,7 +1536,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
val = modalData.freight_price
});
var dc_base_forecast_history_ocean_data = _connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history_ocean where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and date_str<=@date_str order by `date` desc limit 1 ", new
var dc_base_forecast_history_ocean_data = _connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history_ocean where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and `date`<=@date_str order by `date` desc limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
......@@ -1549,12 +1545,11 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
modalData.quantity_final_advise_ocean = null;
if (dc_base_forecast_history_ocean_data.id > 0)
{
modalData.quantity_final_advise_ocean =(dc_base_forecast_history_ocean_data.turnover_days * dc_base_forecast_history_ocean_data.daily_weighted_sales) + dc_base_forecast_history_ocean_data.quantity_safe_inventory;
modalData.quantity_final_advise_ocean =(int)Math.Round( (dc_base_forecast_history_ocean_data.turnover_sales + dc_base_forecast_history_ocean_data.quantity_safe_inventory));
}
datas.FirstOrDefault(s => s.name == "海运周转数(推荐海运)").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.quantity_final_advise_ocean
});
......@@ -1571,7 +1566,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
val = modalData.freight_price_ocean
});
var dc_base_forecast_history_air_data =_connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history_air where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and date_str<=@date_str order by `date` desc limit 1 ", new
var dc_base_forecast_history_air_data =_connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history_air where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and `date`<=@date_str order by `date` desc limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
......@@ -1580,12 +1575,11 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
modalData.quantity_final_advise_air = null;
if (dc_base_forecast_history_air_data.id > 0)
{
modalData.quantity_final_advise_air = (dc_base_forecast_history_air_data.turnover_days * dc_base_forecast_history_air_data.daily_weighted_sales) + dc_base_forecast_history_air_data.quantity_safe_inventory;
modalData.quantity_final_advise_air = (dc_base_forecast_history_air_data.turnover_sales + dc_base_forecast_history_air_data.quantity_safe_inventory);
}
datas.FirstOrDefault(s => s.name == "空运周转数(推荐空运)").days.Add(new transfer_profit_dto.day_dto
{
has_int = false,
date = this_time,
val = modalData.quantity_final_advise_air
});
......
......@@ -29,5 +29,9 @@ namespace AutoTurnOver.DB
public int transfer_delivery { get; set; }
public int transfer_bale_delivery { get; set; }
public int abroad_inbound_delivery { get; set; }
public int turnover_sales { get; set; }
public int usable_stock { get; set; }
public int quantity_transfer { get; set; }
public int quantity_purchase { get; set; }
}
}
......@@ -9,7 +9,7 @@ namespace AutoTurnOver.Models.Report
/// <summary>
/// 实际建议周转数
/// </summary>
public decimal? quantity_final_advise;
public int? quantity_final_advise;
/// <summary>
/// 实际周转数
......@@ -43,7 +43,7 @@ namespace AutoTurnOver.Models.Report
/// <summary>
/// 海运周转数(推荐海运)
/// </summary>
public decimal? quantity_final_advise_ocean;
public int? quantity_final_advise_ocean;
/// <summary>
/// 海运周转运费
......
......@@ -28,7 +28,7 @@ namespace AutoTurnOver.Models
}
else
{
return (val ?? 0).ToString("N");
return Math.Round((val ?? 0),2).ToString("N");
}
} }
......
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