Commit fcf6681d by 泽锋 李

利润预估算法 fix

parent 7194b72b
......@@ -1311,7 +1311,11 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
});
// 周转天数 * 加权日均
modalData.quantity_final_advise = (int)Math.Round(result.turnover_sales +result.quantity_safe_inventory );
modalData.quantity_final_advise = null;
if (result.turnover_sales > 0)
{
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
{
date = this_time,
......@@ -1439,12 +1443,13 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
{
#region MyRegion
var quantity_safe_inventory = _connection.QueryFirstOrDefault<int?>(" select quantity_safe_inventory from dc_base_forecast_history where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and date_str=@date_str limit 1 ", new
var dc_base_forecast_historydata = _connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and date_str=@date_str limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
date_str = this_time_end.ToString("yyyy-MM-dd")
});
}) ?? new dc_base_forecast_history();
var quantity_safe_inventory = dc_base_forecast_historydata.quantity_safe_inventory;
datas.FirstOrDefault(s => s.name == "安全库存数量").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
......@@ -1486,13 +1491,12 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
date = this_time,
val = Math.Round( modalData.unit_price??0,1)
});
var dc_base_forecast_historydata = _connection.QueryFirstOrDefault<dc_base_forecast_history>(" select * from dc_base_forecast_history where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku and date_str=@date_str limit 1 ", new
{
warehouse_code = result.warehouse_code,
bailun_sku = result.bailun_sku,
date_str = this_time_end.ToString("yyyy-MM-dd")
})??new dc_base_forecast_history();
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);
modalData.quantity_final_advise = null;
if (dc_base_forecast_historydata.turnover_sales > 0)
{
modalData.quantity_final_advise = (int)Math.Round(dc_base_forecast_historydata.turnover_sales + dc_base_forecast_historydata.quantity_safe_inventory);
}
datas.FirstOrDefault(s => s.name == "实际建议周转数").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
......@@ -1504,13 +1508,7 @@ where t1.gmt_modified>=@btime and t1.gmt_modified<=@etime
date = this_time,
val = modalData.quantity_final_advise_amount
});
modalData.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()
});
modalData.purchase_quantity = (dc_base_forecast_historydata.usable_stock + dc_base_forecast_historydata.quantity_purchase + dc_base_forecast_historydata.quantity_transfer);
datas.FirstOrDefault(s => s.name == "实际周转数").days.Add(new transfer_profit_dto.day_dto
{
date = this_time,
......
......@@ -17,7 +17,7 @@ namespace ResetOutofstock
{
var now = DateTime.Now;
dc_auto_turnover.CopyForecast();
//dc_auto_turnover.CopyForecast();
//report.GenerateWeekTagStockDatas();
//dc_base_transfer_extend_dao.SynchroLmsTransferOrder();
}
......
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