Commit 7f8e01b0 by 泽锋 李

新增刷新订单财报数据的任务

parent ba0d41e5
......@@ -116,14 +116,13 @@ and cashier_time>=@b_this_time and cashier_time<=@e_this_time ", new
}
/// <summary>
/// 计算订单明细
/// 计算订单 品类明细
/// </summary>
/// <param name="bTime"></param>
public static void CalculationOrder(DateTime bTime)
{
// 查询分类
var etime = DateTime.Now;
var thisTime = etime;
while (thisTime >= bTime)
......@@ -233,5 +232,80 @@ GROUP BY t2.product_type,t2.product_type_desc", new {
thisTime = thisTime.AddDays(-1);
}
}
/// <summary>
/// 计算订单 平台明细
/// </summary>
/// <param name="bTime"></param>
public static void CalculationOrderPlatfrom(DateTime bTime)
{
// 查询分类
var etime = DateTime.Now;
var thisTime = etime;
while (thisTime >= bTime)
{
var b_this_time = thisTime.ToDayHome();
var e_this_time = thisTime.ToDayEnd();
var group_datas = _connection.Query<oms_order_platfrom_group_dto>(@"select
t1.platform_type,
sum(t1.amount_sales * t1.seller_order_exchange_rate * t1.bailun_sku_quantity_ordered) as 'amount_sales'
from dc_base_oms_sku as t1
where t1.paid_time>=@b_this_time and t1.paid_time<=@e_this_time
and t1.bailun_order_status != 'Canceled'
and t1.has_fba_s = 0
and t1.has_delete = 0
and t1.has_scalp = 0
and t1.has_buyer_remark = 0
and t1.has_platsku_remark = 0
GROUP BY t1.platform_type ", new
{
b_this_time = b_this_time,
e_this_time = e_this_time
}).ToList();
if (group_datas != null)
{
List<dc_report_finance> datas = new List<dc_report_finance>();
foreach (var item in group_datas)
{
datas.Add(new dc_report_finance()
{
data_type = "销售收入",
item_name = item.platform_type ?? "未知",
item_id = item.platform_type??"未知",
date = b_this_time,
val = item.amount_sales,
update_date = DateTime.Now
});
}
foreach (var data in datas)
{
data.id = _connection.QueryFirstOrDefault<int>(" select id from dc_report_finance where data_type=@data_type and item_id=@item_id and date=@date ", new
{
data_type = data.data_type,
item_id = data.item_id,
date = data.date
});
if (data.id > 0)
{
_connection.Update(data);
}
else
{
_connection.Insert(data);
}
}
}
thisTime = thisTime.AddDays(-1);
}
}
}
}
......@@ -40,4 +40,10 @@ namespace AutoTurnOver.Models.Report
public decimal cost_first { get; set; }
public decimal profit_total { get; set; }
}
public class oms_order_platfrom_group_dto
{
public string platform_type { get; set; }
public decimal amount_sales { get; set; }
}
}
......@@ -29,7 +29,7 @@ namespace ResetOutofstock
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-1), DateTime.Now);
//dc_report_finance_dao.CalculationOrder(DateTime.Now.AddYears(-1));
dc_report_finance_dao.CalculationOrderPlatfrom(DateTime.Now.AddYears(-1));
}
catch (Exception ex)
{
......
......@@ -28,17 +28,23 @@ namespace ResetOutofstock
dc_report_finance_dao.CalculationCashPayment(DateTime.Now.AddDays(-90));
Console.WriteLine($"结束 刷新财务付现数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 0 && now.Minute == 01)
if (now.Hour == 0 && now.Minute == 02)
{
Console.WriteLine($"开始 刷新出库退税数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
dc_report_finance_dao.CalculationTax(DateTime.Now.AddDays(-90));
Console.WriteLine($"结束 刷新出库退税数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 0 && now.Minute == 01)
if (now.Hour == 0 && now.Minute == 03)
{
Console.WriteLine($"开始 刷新出库退税数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始 刷新订单财报数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
dc_report_finance_dao.CalculationOrder(DateTime.Now.AddDays(-90));
Console.WriteLine($"结束 刷新出库退税数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"结束 刷新订单财报数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 0 && now.Minute == 04)
{
Console.WriteLine($"开始 订单-平台财报数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
dc_report_finance_dao.CalculationOrderPlatfrom(DateTime.Now.AddDays(-90));
Console.WriteLine($"结束 订单-平台财报数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
......
......@@ -29,9 +29,15 @@ namespace ResetOutofstock
});
Task.Factory.StartNew(() =>
{
Console.WriteLine($"开始 刷新出库退税数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"开始 刷新订单财报数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
dc_report_finance_dao.CalculationOrder(DateTime.Now.AddYears(-1));
Console.WriteLine($"结束 刷新出库退税数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Console.WriteLine($"结束 刷新订单财报数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
});
Task.Factory.StartNew(() =>
{
Console.WriteLine($"开始 订单-平台财报数据 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
dc_report_finance_dao.CalculationOrderPlatfrom(DateTime.Now.AddYears(-1));
Console.WriteLine($"结束 订单-平台财报数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
});
......
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