Commit 2066166c by 泽锋 李

fix

parent 243c0ad9
......@@ -13,17 +13,6 @@ namespace AutoGeneratePurchaseAdvise
static async Task Main(string[] args)
{
Console.WriteLine("采购建议计算任务启动...");
//PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.AutoPushBuySys(1);
//PurchaseAdviseServices.AutoPushBuySys(1);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(2);
//dc_auto_first_order_sku_dao.GeneratePurchaseAdvise();
//PurchaseAdviseServices.AutoPushBuySys(2);
//PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(1);
//dc_auto_first_order_sku_dao.GeneratePurchaseAdvise();
//PurchaseAdviseServices.AutoPushBuySys(2);
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<GeneratePurchaseAdviseBackgroundService>();
......
......@@ -106,6 +106,34 @@ namespace AutoTurnOver.DB
}
/// <summary>
/// 获取平台费率
/// </summary>
/// <returns></returns>
public static api_platform_fee_result_dto.result_dto GetPlatformFee(api_platform_fee_input_dto data)
{
try
{
//查询采购建议明细
string url = ConfigHelper.GetValue("PostPlatCategoryRate");
string resultStr = HttpHelper.Request(url, RequestType.POST, data.datas.ToJson(), "application/json", timeout: 1000 * 60 * 60 * 24);
var result = resultStr.ToObj<api_platform_fee_result_dto>();
if (result == null)
{
return new api_platform_fee_result_dto.result_dto() { };
}
else
{
return result.result[0];
}
}
catch (Exception ex)
{
throw new Exception("平台费 接口异常: " + ex.Message);
throw new Exception("平台费 接口异常: " + ex.StackTrace);
}
}
/// <summary>
/// 获取预估物流费用
/// </summary>
/// <returns></returns>
......
......@@ -1851,20 +1851,22 @@ Truncate table dc_report_cash_flow_group_day_temp;
insert dc_report_cash_flow_group_day_temp (`platform_type`,`web_site`,`year`,`month`,`day`,`val`,`data_type`,`type`,`date`)
(
select platform_type,web_site,year(occur_time) as 'year',month(occur_time) as 'month',day(occur_time) as 'day',sum(val) as 'val',data_type,1,min(occur_time) as 'date' from dc_report_cash_flow_log where is_delete=0 GROUP BY occur_time_year_month_no,day(occur_time)
select platform_type,web_site,year(occur_time) as 'year',month(occur_time) as 'month',day(occur_time) as 'day',sum(val) as 'val',data_type,1,min(occur_time) as 'date' from dc_report_cash_flow_log where is_delete=0 and occur_time>=@btime GROUP BY occur_time_year_month_no,day(occur_time)
)
;
", new { btime =DateTime.Now.AddMonths(-3).ToString("yyyy-MM-01 00:00:00")}, commandTimeout: 0);
_connection.Execute(@" -- 刷新 现金流汇总表
insert dc_report_cash_flow_group_day_temp (`platform_type`,`web_site`,`year`,`month`,`day`,`val`,`data_type`,`type`,`date`)
(
select platform_type,web_site,year(pay_time) as 'year',month(pay_time) as 'month',day(pay_time) as 'day',sum(val) as 'val',data_type,2,min(pay_time) as 'date' from dc_report_cash_flow_log where is_delete=0 GROUP BY pay_time_year_month_no,day(pay_time)
select platform_type,web_site,year(pay_time) as 'year',month(pay_time) as 'month',day(pay_time) as 'day',sum(val) as 'val',data_type,2,min(pay_time) as 'date' from dc_report_cash_flow_log where is_delete=0 and pay_time>=@btime GROUP BY pay_time_year_month_no,day(pay_time)
);
alter table dc_report_cash_flow_group_day rename dc_report_cash_flow_group_dayTemp;
alter table dc_report_cash_flow_group_day_temp rename dc_report_cash_flow_group_day;
alter table dc_report_cash_flow_group_dayTemp rename dc_report_cash_flow_group_day_temp;
truncate table dc_report_cash_flow_group_day_temp;
", commandTimeout: 0);
", new { btime = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-01 00:00:00") }, commandTimeout: 0);
var datePar = new {
btime = DateTime.Now.GetMonthFirstDay(),
......
......@@ -73,7 +73,17 @@ namespace AutoTurnOver.DB
task_data.error_stack_trace = "模拟计算销量";
conn.Update(task_data);
// 模拟销量
// 查询平台费
task_data.platform_fee = ApiUtility.GetPlatformFee(new Models.ApiDto.api_platform_fee_input_dto
{
datas = new List<Models.ApiDto.api_platform_fee_input_dto.data_dto> {
new Models.ApiDto.api_platform_fee_input_dto.data_dto{ Plat =task_data.platform_type ,PlatCategoryId =task_data.platform_category_id,Site =task_data.web_site }
}
}).categoryRate;
// 模拟销销售额
logs.AddRange(turnover_list.Where(s => s.type == (int)invented_turnover_model.type_enum.销量).Select((s, index) => new dc_report_cash_flow_forecast_task_log()
{
warehouse_code = task_data.warehouse_code,
......@@ -119,6 +129,29 @@ namespace AutoTurnOver.DB
pay_time = report_cash_flow_dao.CalculationPayTime(configs, s.date, (int)dc_report_cash_flow_log_data_type_enum.销售数量, task_data.platform_type, task_data.web_site)
}));
// 模拟平台费
logs.AddRange(turnover_list.Where(s => s.type == (int)invented_turnover_model.type_enum.销量).Select((s, index) => new dc_report_cash_flow_forecast_task_log()
{
warehouse_code = task_data.warehouse_code,
bailun_sku = task_data.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.平台费用,
is_delete = 0,
item = "",
item_no = $"虚拟销售单 - {task_data.id}-{s.date_str}-{index}",
no = $"虚拟销售单 - {task_data.id}-{s.date_str}-{index}",
occur_time = s.date,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
remarks = "模拟跑单",
task_id = task_data.id,
platform_type = task_data.platform_type,
val = s.val * task_data.sale_unit_price_cny * task_data.platform_fee.Value,
update_time = now,
web_site = task_data.web_site,
pay_time_year_month_no = "",
occur_time_year_month_no = "",
pay_time = report_cash_flow_dao.CalculationPayTime(configs, s.date, (int)dc_report_cash_flow_log_data_type_enum.销售数量, task_data.platform_type, task_data.web_site)
}));
if (task_data.refund_ratio > 0)
{
// 模拟退款
......@@ -170,6 +203,20 @@ namespace AutoTurnOver.DB
if (!"FBA仓".Equals(task_data.warehouse_type, StringComparison.OrdinalIgnoreCase))
{
task_data.tail_logistics_fee = ApiUtility.GetFilterLogisticsAssignLine(new Models.ApiDto.api_logistic_query_input_dto
{
endCountries = task_data.web_site,
high = task_data.high,
LineCodes = task_data.tail_logistics_code,
Long = task_data.@long,
platform = task_data.platform_type,
Site = task_data.web_site,
startPoint = "国内仓".Equals(task_data.warehouse_type, StringComparison.OrdinalIgnoreCase) ? "1" : "2",
warehouseNo = task_data.warehouse_code,
weightKg = task_data.weight_kg,
width = task_data.width
}).TotalPrices;
task_data.error_stack_trace = "模拟计算尾程费";
conn.Update(task_data);
var index = 0;
......@@ -190,19 +237,7 @@ namespace AutoTurnOver.DB
remarks = "模拟跑单",
task_id = task_data.id,
platform_type = task_data.platform_type,
val = 0 -(s.val * ApiUtility.GetFilterLogisticsAssignLine(new Models.ApiDto.api_logistic_query_input_dto
{
endCountries = task_data.web_site,
high = task_data.high,
LineCodes = task_data.tail_logistics_code,
Long = task_data.@long,
platform = task_data.platform_type,
Site = task_data.web_site,
startPoint = "国内仓".Equals(task_data.warehouse_type, StringComparison.OrdinalIgnoreCase) ? "1" : "2",
warehouseNo = task_data.warehouse_code,
weightKg = task_data.weight_kg,
width = task_data.width
}).TotalPrices),
val = 0 - (s.val * task_data.tail_logistics_fee.Value),
update_time = now,
web_site = task_data.web_site,
pay_time_year_month_no = "",
......@@ -234,7 +269,7 @@ namespace AutoTurnOver.DB
remarks = "模拟跑单",
task_id = task_data.id,
platform_type = task_data.platform_type,
val =0 -( s.val * task_data.buy_unit_price_cny),
val = 0 - (s.val * task_data.buy_unit_price_cny),
update_time = now,
web_site = task_data.web_site,
pay_time_year_month_no = "",
......@@ -245,6 +280,20 @@ namespace AutoTurnOver.DB
if (!"国内仓".Equals(task_data.warehouse_type, StringComparison.OrdinalIgnoreCase))
{
task_data.transfer_logistics_fee = ApiUtility.GetFilterLogisticsAssignLine(new Models.ApiDto.api_logistic_query_input_dto
{
endCountries = task_data.web_site,
high = task_data.high,
LineCodes = task_data.transfer_logistics_code,
Long = task_data.@long,
platform = task_data.platform_type,
Site = task_data.web_site,
startPoint = "3",
warehouseNo = task_data.warehouse_code,
weightKg = task_data.weight_kg,
width = task_data.width
}).TotalPrices;
task_data.error_stack_trace = "模拟下调拨单";
conn.Update(task_data);
var index = 0;
......@@ -265,7 +314,7 @@ namespace AutoTurnOver.DB
remarks = "模拟跑单",
task_id = task_data.id,
platform_type = task_data.platform_type,
val = 0 - ( ApiUtility.GetFilterLogisticsAssignLine(new Models.ApiDto.api_logistic_query_input_dto
val = 0 - (ApiUtility.GetFilterLogisticsAssignLine(new Models.ApiDto.api_logistic_query_input_dto
{
endCountries = task_data.web_site,
high = task_data.high,
......@@ -275,7 +324,7 @@ namespace AutoTurnOver.DB
Site = task_data.web_site,
startPoint = "3",
warehouseNo = task_data.warehouse_code,
weightKg = task_data.weight_kg * s.val,
weightKg = s.val * task_data.weight_kg,
width = task_data.width
}).TotalPrices),
update_time = now,
......@@ -376,7 +425,7 @@ namespace AutoTurnOver.DB
// 供应链长度的累积销量 - 累积入库
var date_sum_day = this_time.AddDays(delivery).ToDayEnd();
var sales_sum = turnover_list.Where(s=>s.date>=this_time && s.date<= date_sum_day && s.type== (int)invented_turnover_model.type_enum.销量).Sum(s=>s.val)
var sales_sum = turnover_list.Where(s => s.date >= this_time && s.date <= date_sum_day && s.type == (int)invented_turnover_model.type_enum.销量).Sum(s => s.val)
- turnover_list.Where(s => s.date >= this_time && s.date <= date_sum_day && s.type == (int)invented_turnover_model.type_enum.入库数量).Sum(s => s.val);
// 计算跟安全库存的差值
......@@ -553,20 +602,21 @@ namespace AutoTurnOver.DB
if (m.id > 0)
{
id = m.id;
var result = conn.Update<dc_report_cash_flow_forecast_task>(m,t);
var result = conn.Update<dc_report_cash_flow_forecast_task>(m, t);
conn.Execute(" delete from dc_report_cash_flow_forecast_task_sale where task_id=@task_id ", new { task_id = id });
}
else
{
id = conn.Insert<dc_report_cash_flow_forecast_task>(m,t)??0;
id = conn.Insert<dc_report_cash_flow_forecast_task>(m, t) ?? 0;
}
if (input_data.sales != null)
{
foreach (var item in input_data.sales)
{
conn.Insert(new dc_report_cash_flow_forecast_task_sale {
date =item.date,
conn.Insert(new dc_report_cash_flow_forecast_task_sale
{
date = item.date,
task_id = id,
val = item.val
});
......@@ -582,9 +632,9 @@ namespace AutoTurnOver.DB
public static dc_report_cash_flow_forecast_task_input_dto GetById(int id)
{
var data= _connection.QueryFirstOrDefault<dc_report_cash_flow_forecast_task_input_dto>("select * from dc_report_cash_flow_forecast_task where id=" + id);
data.sales = _connection.Query<dc_report_cash_flow_forecast_task_input_dto.sale_dto>(" select `date`,`val` from dc_report_cash_flow_forecast_task_sale where task_id=@task_id ",new { task_id = id }).ToList();
if (data.sales != null && data.sales.Count>=1)
var data = _connection.QueryFirstOrDefault<dc_report_cash_flow_forecast_task_input_dto>("select * from dc_report_cash_flow_forecast_task where id=" + id);
data.sales = _connection.Query<dc_report_cash_flow_forecast_task_input_dto.sale_dto>(" select `date`,`val` from dc_report_cash_flow_forecast_task_sale where task_id=@task_id ", new { task_id = id }).ToList();
if (data.sales != null && data.sales.Count >= 1)
{
data.btime = data.sales.Min(s => s.date).ToString("yyyy-MM-dd");
data.etime = data.sales.Max(s => s.date).ToString("yyyy-MM-dd");
......@@ -597,26 +647,27 @@ namespace AutoTurnOver.DB
public static dc_report_cash_flow_forecast_task_info_dto GetInfo(report_cash_flow_view_forecast_task_search_dto search)
{
var info_data = new dc_report_cash_flow_forecast_task_info_dto() { views = new List<report_cash_flow_view_dto>() { },turnovers = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto> { } };
var info_data = new dc_report_cash_flow_forecast_task_info_dto() { views = new List<report_cash_flow_view_dto>() { }, turnovers = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto> { } };
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 1 }, date_type_str = "销售数量", remarks = "", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2 }, date_type_str = "销售金额", remarks = "过滤掉刷单的订单 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 3 }, date_type_str = "退款", remarks = "crm 抓取的退款数据,未区分仓库", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 3 }, date_type_str = "退款", remarks = "预计销售数量 * 销售单价 * 退款率", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 4 }, date_type_str = "利润", remarks = "oms 中的订单,分摊到sku的利润,不包含广告费,上架费,退款", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 5 }, date_type_str = "平台费用", remarks = "根据平台、站点、产品分类 从利润系统查询的预估平台费率 * 销售数量 * 销售金额", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 6 }, date_type_str = "释放销售成本", remarks = "采购成本,利润中已经计算了", dates = new List<report_cash_flow_view_dto.date_dto>() });
//info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 7 }, date_type_str = "释放头程费用", remarks = "", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 8 }, date_type_str = "尾程费用", remarks = "oms 订单中海外仓发货的,支付时间 已 读取对应物流商的账期", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 9 }, date_type_str = "新增采购费用", remarks = " 1、采购系统的数据,外采订单直接读取订单支付时间。2、向自己工厂采购的(无需付款)的单,支付时间=下单时间 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 13 }, date_type_str = "新增采购费用_首单", remarks = " 采购首单费用,下单一个月之后如果有出单,讲转移到【新增采购费用】字段", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 10 }, date_type_str = "新增头程费用", remarks = " 调拨单的数据,支付时间 已 读取对应物流商的账期,注:调拨单需要付款之后才能获取到金额 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 14 }, date_type_str = "新增头程费用_首单", remarks = " 调拨首单费用,下单一个月之后如果有出单,讲转移到【新增头程费用】字段 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> {2, 4, 3 }, date_type_str = "汇总利润", remarks = " oms 中的订单,销售额 - 销售成本 (", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2, 3, 5, 8, 9, 10, 11, 12, 13, 14 }, date_type_str = "现金流结余", remarks = " 销售金额 - 新增采购费用 - 新增头程费用 - 平台费用 - 尾程费用 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 8 }, date_type_str = "尾程费用", remarks = "", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 9 }, date_type_str = "新增采购费用", remarks = " ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 13 }, date_type_str = "新增采购费用_首单", remarks = " ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 10 }, date_type_str = "新增头程费用", remarks = " ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 14 }, date_type_str = "新增头程费用_首单", remarks = " ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2, 4, 3 }, date_type_str = "汇总利润", remarks = " (", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.views.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2, 3, 5, 8, 9, 10, 11, 12, 13, 14 }, date_type_str = "现金流结余", remarks = " ", dates = new List<report_cash_flow_view_dto.date_dto>() });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> {(int)invented_turnover_model.type_enum.销量 }, item_title = "销量",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.入库数量 }, item_title = "入库",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.可用库存 }, item_title = "可用库存",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.采购数量 }, item_title = "采购数量",dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.销量 }, item_title = "销量", dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.入库数量 }, item_title = "入库", dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.可用库存 }, item_title = "可用库存", dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
info_data.turnovers.Add(new dc_report_cash_flow_forecast_task_info_dto.turnover_dto { types = new List<int> { (int)invented_turnover_model.type_enum.采购数量 }, item_title = "采购数量", dates = new List<dc_report_cash_flow_forecast_task_info_dto.turnover_dto.date_dto> { } });
var conn = _connection;
......@@ -624,7 +675,7 @@ namespace AutoTurnOver.DB
var pay_sql = " select pay_time as 'date',sum(val) as 'val',data_type,1 as 'type',platform_type,web_site from dc_report_cash_flow_forecast_task_log where task_id=@task_id ";
var turnover_sql = " select * from dc_report_cash_flow_forecast_turnover where task_id=@task_id ";
DynamicParameters parameters = new DynamicParameters();
parameters.Add("task_id",search.task_id);
parameters.Add("task_id", search.task_id);
occur_sql += " GROUP BY data_type,year(occur_time),month(occur_time),day(occur_time) ";
pay_sql += " GROUP BY data_type,year(pay_time),month(pay_time),day(pay_time) ";
......@@ -633,11 +684,11 @@ namespace AutoTurnOver.DB
var turnover_datas = conn.Query<dc_report_cash_flow_forecast_turnover>(turnover_sql, parameters, commandTimeout: 0).ToList();
var min_o_time = occur_datas.Min(s=>s.date);
var min_o_time = occur_datas.Min(s => s.date);
var min_p_time = pay_datas.Min(s => s.date);
var max_o_time = occur_datas.Max(s=>s.date);
var max_o_time = occur_datas.Max(s => s.date);
var max_p_time = pay_datas.Max(s => s.date);
var btime = min_o_time< min_p_time? min_o_time: min_p_time;
var btime = min_o_time < min_p_time ? min_o_time : min_p_time;
var etime = max_o_time > max_p_time ? max_o_time : max_p_time;
foreach (var itemData in info_data.views)
{
......@@ -686,12 +737,13 @@ namespace AutoTurnOver.DB
public static dc_report_cash_flow_forecast_task_date_dto GetDate(int id)
{
var data1 = _connection.QueryFirstOrDefault<DateTime?>(" select min(occur_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id=id});
var data2= _connection.QueryFirstOrDefault<DateTime?>(" select min(pay_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id=id});
var data3 = _connection.QueryFirstOrDefault<DateTime?>(" select max(occur_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id=id});
var data4 = _connection.QueryFirstOrDefault<DateTime?>(" select max(pay_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id=id});
return new dc_report_cash_flow_forecast_task_date_dto {
btime =( (data1 < data2 ? data1 : data2) ?? DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"),
var data1 = _connection.QueryFirstOrDefault<DateTime?>(" select min(occur_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id = id });
var data2 = _connection.QueryFirstOrDefault<DateTime?>(" select min(pay_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id = id });
var data3 = _connection.QueryFirstOrDefault<DateTime?>(" select max(occur_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id = id });
var data4 = _connection.QueryFirstOrDefault<DateTime?>(" select max(pay_time) from dc_report_cash_flow_forecast_task_log where task_id=@task_id ", new { task_id = id });
return new dc_report_cash_flow_forecast_task_date_dto
{
btime = ((data1 < data2 ? data1 : data2) ?? DateTime.Now.AddDays(-7)).ToString("yyyy-MM-dd"),
etime = ((data3 > data4 ? data3 : data4) ?? DateTime.Now.AddDays(7)).ToString("yyyy-MM-dd")
};
}
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models.ApiDto
{
/// <summary>
/// 平台费率查询
/// </summary>
public class api_platform_fee_input_dto
{
public List<data_dto> datas { get; set; }
public class data_dto
{
/// <summary>
/// 平台
/// </summary>
public string Plat { get; set; }
public string Site { get; set; }
/// <summary>
/// 类目id
/// </summary>
public int PlatCategoryId { get; set; }
}
}
public class api_platform_fee_result_dto
{
public int statusCode { get; set; }
public string message { get; set; }
public List<result_dto> result { get; set; }
public class result_dto
{
public string plat { get; set; }
public string site { get; set; }
public int? bailunCategoryId { get; set; }
public int? platCategoryId { get; set; }
/// <summary>
/// 平台费率
/// </summary>
public decimal categoryRate { get; set; }
}
}
}
......@@ -79,6 +79,20 @@ namespace AutoTurnOver.Models.Report
public decimal width { get; set; }
public DateTime update_time { get; set; }
/// <summary>
/// 尾程费单价
/// </summary>
public decimal? tail_logistics_fee { get; set; }
/// <summary>
/// 头程费单价
/// </summary>
public decimal? transfer_logistics_fee { get; set; }
/// <summary>
/// 平台费单价
/// </summary>
public decimal? platform_fee { get; set; }
public int platform_category_id { get; set; }
}
......
......@@ -4,5 +4,6 @@
},
"PPSSkuStatus": "http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
......@@ -4,5 +4,6 @@
},
"PPSSkuStatus": "http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
......@@ -4,5 +4,6 @@
},
"PPSSkuStatus": "http://pps.bailuntec.com/Api/Centre/Publish/External/SkuStatus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
"Lms_GetLogistics": "http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics",
"PostPlatCategoryRate": "http://172.31.255.11/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ using AutoTurnOver.Common;
using AutoTurnOver.DB;
using AutoTurnOver.Utility;
using AutoTurnOver.Models;
using AutoTurnOver.Models.ApiDto;
namespace AutoTurnOver.Controllers
{
......@@ -281,5 +282,32 @@ namespace AutoTurnOver.Controllers
}
/// <summary>
/// 查询物流费用
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
[HttpPost]
public JsonResult GetFilterLogisticsAssignLine([FromBody]api_logistic_query_input_dto m)
{
try
{
var result = ApiUtility.GetFilterLogisticsAssignLine(m);
return new JsonResult(new
{
data = result,
success = true
});
}
catch (Exception ex)
{
return new JsonResult(new
{
success = false,
message = ex.Message
});
}
}
}
}
\ No newline at end of file
......@@ -40,5 +40,7 @@
"Saas_GetUser": "http://sso.bailuntec.com/GetUserResource",
"Saas_Users": "http://sso.bailuntec.com/GetUserByCompany",
"Saas_Departments": "http://sso.bailuntec.com/GetDepartmentsByCompanyId",
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus"
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
......@@ -40,5 +40,7 @@
"Saas_GetUser": "http://sso.bailuntec.com/GetUserResource",
"Saas_Users": "http://sso.bailuntec.com/GetUserByCompany",
"Saas_Departments": "http://sso.bailuntec.com/GetDepartmentsByCompanyId",
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus"
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"PostPlatCategoryRate": "http://172.31.255.11/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
......@@ -40,5 +40,7 @@
"Saas_GetUser": "http://sso.bailuntec.com/GetUserResource",
"Saas_Users": "http://sso.bailuntec.com/GetUserByCompany",
"Saas_Departments": "http://sso.bailuntec.com/GetDepartmentsByCompanyId",
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus"
"Saas_GetMenus": "http://sso.bailuntec.com/GetMenus",
"ApiLogisticsGetFilterLogisticsAssignLine": "http://lms.bailuntec.com/api/Logistics/ApiLogistics/GetFilterLogisticsAssignLine",
"PostPlatCategoryRate": "http://test.profit.bailuntec.com/api/platfee/ProfitPlatfee/PostPlatCategoryRate"
}
......@@ -15,7 +15,7 @@ namespace ResetOutofstock
Console.WriteLine("刷新缺货数据任务启动...");
//try
//{
// var now = DateTime.Now;
var now = DateTime.Now;
// report_cash_flow_dao.CalculationPurchaseOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")), "P2005250048", "LM-EO-007");
//}
//catch (Exception ex)
......@@ -24,8 +24,9 @@ namespace ResetOutofstock
// throw;
//}
//report.ResetCashFlowData();
//report.ResetCashFlowData();
report.ResetLastweekData();
//report.ResetLastweekData();
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ResetOutofstockBackgrounService>();
......
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