Commit d13be784 by 泽锋 李

利润模型,新增调拨在途,库存可用日期

parent 714a87d8
...@@ -2247,14 +2247,28 @@ order by t1.gmt_modified asc ...@@ -2247,14 +2247,28 @@ order by t1.gmt_modified asc
} }
else else
{ {
sql = @" select ta.*,t4.product_code,t4.weight,t4.sku_title_cn as 'product_name',t4.brand as 'brand',t5.`stock` as 'fba_storage_capacity', sql = @" select ta.*,
t5.`stock` - (ifnull(t6.quantity_transfer_temp_schedule,0) + ifnull(t6.quantity_transfer_temporary_storage,0) + ifnull(t6.quantity_transfer_plan,0) + ifnull(t6.quantity_purchase,0) ) as 'storage_capacity' t4.product_code,
t4.weight,t4.sku_title_cn as 'product_name',
t4.brand as 'brand',
t5.`stock` as 'fba_storage_capacity',
( case when t7.`status`=0 or t7.`status` is null then 0 else 1 end ) as 'monitor_status',
t5.`stock` - (ifnull(t6.quantity_transfer_temp_schedule,0) + ifnull(t6.quantity_transfer_temporary_storage,0) + ifnull(t6.quantity_transfer_plan,0) + ifnull(t6.quantity_purchase,0) ) as 'storage_capacity',
t16.usable_stock as 'usable_stock',
t6.quantity_purchase,
t6.quantity_transfer,
t6.quantity_transfer_order,
t6.quantity_transfer_temp_schedule,
t6.quantity_transfer_temporary_storage
from dc_report_profit_analysis as ta from dc_report_profit_analysis as ta
left join dc_auto_turnover as dat on dat.warehouse_code = ta.warehouse_code and dat.bailun_sku = ta.bailun_sku left join dc_auto_turnover as dat on dat.warehouse_code = ta.warehouse_code and dat.bailun_sku = ta.bailun_sku
left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku left join dc_base_sku as t4 on dat.bailun_sku = t4.bailun_sku
left join dc_base_storage_capacity as t5 on ta.bailun_sku = t5.bailun_sku and ta.warehouse_code = t5.warehouse_code left join dc_base_storage_capacity as t5 on ta.bailun_sku = t5.bailun_sku and ta.warehouse_code = t5.warehouse_code
left join dc_mid_transit as t6 on ta.bailun_sku = t6.bailun_sku and ta.warehouse_code = t6.warehouse_code left join dc_mid_transit as t6 on ta.bailun_sku = t6.bailun_sku and ta.warehouse_code = t6.warehouse_code
left join dc_auto_config_sku_warehouse as t7 on dat.bailun_sku = t7.bailun_sku and dat.warehouse_code = t7.warehouse_code
left join dc_base_stock as t16 on dat.bailun_sku = t16.bailun_sku and dat.warehouse_code = t16.warehouse_code
"; ";
} }
...@@ -2282,7 +2296,6 @@ left join dc_auto_turnover as dat on dat.warehouse_code = ta.warehouse_code and ...@@ -2282,7 +2296,6 @@ left join dc_auto_turnover as dat on dat.warehouse_code = ta.warehouse_code and
if (m.monitor_status != null) if (m.monitor_status != null)
{ {
sqlCount += " left join dc_auto_config_sku_warehouse as t7 on dat.bailun_sku = t7.bailun_sku and dat.warehouse_code = t7.warehouse_code "; sqlCount += " left join dc_auto_config_sku_warehouse as t7 on dat.bailun_sku = t7.bailun_sku and dat.warehouse_code = t7.warehouse_code ";
sql += " left join dc_auto_config_sku_warehouse as t7 on dat.bailun_sku = t7.bailun_sku and dat.warehouse_code = t7.warehouse_code ";
} }
if (m.returngoodspush_state != null) if (m.returngoodspush_state != null)
{ {
......
...@@ -341,6 +341,30 @@ namespace AutoTurnOver.Models ...@@ -341,6 +341,30 @@ namespace AutoTurnOver.Models
} }
public class dc_report_profit_analysis_dto: dc_report_profit_analysis { public class dc_report_profit_analysis_dto: dc_report_profit_analysis {
public decimal? quantity_transfer_temporary_storage { get; set; }
public decimal? quantity_transfer_temp_schedule { get; set; }
public decimal? quantity_transfer_order { get; set; }
public decimal? quantity_transfer { get; set; }
public decimal? quantity_purchase { get; set; }
public decimal? usable_stock { get; set; }
public DateTime now { get { return DateTime.Now; } }
/// <summary>
/// 库存可用天数
/// </summary>
public int stock_available_days { get {
return (int)Math.Ceiling((
(quantity_purchase??0)+(quantity_transfer??0)+(usable_stock??0)+Math.Max(0, ocean_purchase)
) / forecast_daily_weighted_sales);
} }
public DateTime stock_available_date { get
{
return now.AddDays(stock_available_days);
} }
/// <summary>
/// 监控状态
/// </summary>
public int monitor_status { get; set; }
public string product_code { get; set; } public string product_code { get; set; }
public string brand { get; set; } public string brand { get; set; }
public decimal? weight { get; set; } public decimal? weight { get; set; }
......
...@@ -755,7 +755,8 @@ namespace AutoTurnOver.Services ...@@ -755,7 +755,8 @@ namespace AutoTurnOver.Services
"空运周转运费","实际-海运运费差值", "实际-海运周转采购金额差值" ,"实际-空运运费差值", "实际-空运周转采购金额差值", "海运-空运运费差值", "海运-空运周转采购金额差值", "安全库存数量", "空运周转天数", "实际周转天数", "空运周转运费","实际-海运运费差值", "实际-海运周转采购金额差值" ,"实际-空运运费差值", "实际-空运周转采购金额差值", "海运-空运运费差值", "海运-空运周转采购金额差值", "安全库存数量", "空运周转天数", "实际周转天数",
"海运周转天数", "30天预测销量海运运费-实际周转运费金额", "30天预测销量空运运费-实际周转运费金额", "30天预测销量空运运费-海运周转运费金额" "海运周转天数", "30天预测销量海运运费-实际周转运费金额", "30天预测销量空运运费-实际周转运费金额", "30天预测销量空运运费-海运周转运费金额"
, "差值(实际-海运)/实际周转采购金额占比" , "差值(海运-空运)/实际周转采购金额占比" , "差值(空运-实际)/实际周转采购金额占比" , "差值(实际-海运)/实际周转采购金额占比" , "差值(海运-空运)/实际周转采购金额占比" , "差值(空运-实际)/实际周转采购金额占比"
, "海运与实际运费差额/库存差额" , "空运与实际运费差额/库存差额" , "30天销量海运与实际运费差额/库存金额" , "30天销量空运与实际运费差额/库存金额" , "补海运周转数","补海运周转金额" , "海运与实际运费差额/库存差额" , "空运与实际运费差额/库存差额" , "30天销量海运与实际运费差额/库存金额" , "30天销量空运与实际运费差额/库存金额" , "补海运周转数","补海运周转金额",
"采购在途","调拨在途(采购临时)","调拨在途(暂存)","调拨在途(调拨单)","可用天数","拟下单日期","可用日期"
}; };
foreach (var item in cols) foreach (var item in cols)
{ {
...@@ -767,6 +768,14 @@ namespace AutoTurnOver.Services ...@@ -767,6 +768,14 @@ namespace AutoTurnOver.Services
DataRow row = table.NewRow(); DataRow row = table.NewRow();
row["采购在途"] = itemData.quantity_purchase;
row["调拨在途(采购临时)"] = itemData.quantity_transfer_temp_schedule;
row["调拨在途(暂存)"] = itemData.quantity_transfer_temporary_storage;
row["调拨在途(调拨单)"] = itemData.quantity_transfer_order;
row["可用天数"] = itemData.stock_available_days;
row["拟下单日期"] = itemData.now.ToString("yyyy-MM-dd");
row["可用日期"] = itemData.stock_available_date.ToString("yyyy-MM-dd");
row["Fba库容值"] = itemData.fba_storage_capacity; row["Fba库容值"] = itemData.fba_storage_capacity;
row["可用库容值"] = itemData.storage_capacity; row["可用库容值"] = itemData.storage_capacity;
row["空运票数占比"] = itemData.order_count_3_radio; row["空运票数占比"] = itemData.order_count_3_radio;
......
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