Commit 6d207d00 by 泽锋 李

fix

parent c0f1e0d9
......@@ -19,9 +19,198 @@ namespace AutoTurnOver.DB
public class report_cash_flow_dao : connectionHelper
{
/// <summary>
/// 计算订单
/// 计算订单 销售字段
/// </summary>
public static void CalculationOrder(DateTime btime, DateTime? etime)
public static void CalculationOrderSale(DateTime btime, DateTime? etime)
{
try
{
var conn = _connection;
int page = 1;
int rows = 5000;
List<dc_report_cash_flow_config> configs = conn.Query<dc_report_cash_flow_config>(" select * from dc_report_cash_flow_config ").AsList();
while (true)
{
var now = DateTime.Now;
var sql = " select * from dc_base_oms_sku where gmt_create>=@btime ";
DynamicParameters parameters = new DynamicParameters();
parameters.Add("btime", btime.ToString("yyyy-MM-dd 00:00:00"));
if (etime != null)
{
sql += " and gmt_create<=@etime ";
parameters.Add("etime", etime.Value.ToString("yyyy-MM-dd 23:59:59"));
}
sql += $" order by id desc limit {(page - 1) * rows},{rows} ";
var order_list = conn.Query<dc_base_oms_sku>(sql, parameters).AsList();
if (order_list == null || order_list.Count <= 0)
{
break;
}
page++;
var addList = new List<dc_report_cash_flow_log>();
var updateList = new List<dc_report_cash_flow_log>();
foreach (var order_item in order_list)
{
try
{
var item_no = order_item.bailun_order_id;
#region 利润
dc_report_cash_flow_log item2 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.利润,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.profit_total * order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
item_no = order_item.bailun_order_id
};
item2.occur_time_year_month_no = $"{item2.occur_time.Year}-{item2.occur_time.Month}-{item2.bailun_sku}";
item2.pay_time = CalculationPayTime(configs, item2.occur_time, item2.data_type, item2.platform_type);
item2.pay_time_year_month_no = $"{item2.pay_time.Year}-{item2.pay_time.Month}-{item2.bailun_sku}";
item2.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item2.data_type,
bailun_sku = item2.bailun_sku,
item_no = item2.item_no
}) ?? 0;
if (item2.id > 0)
{
updateList.Add(item2);
//conn.Update(item2);
}
else
{
addList.Add(item2);
//conn.Insert(item2);
}
#endregion
#region 销售数量
dc_report_cash_flow_log item1 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.销售数量,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
item_no = order_item.bailun_order_id
};
item1.occur_time_year_month_no = $"{item1.occur_time.Year}-{item1.occur_time.Month}-{item1.bailun_sku}";
item1.pay_time = CalculationPayTime(configs, item1.occur_time, item1.data_type, item1.platform_type);
item1.pay_time_year_month_no = $"{item1.pay_time.Year}-{item1.pay_time.Month}-{item1.bailun_sku}";
item1.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item1.data_type,
bailun_sku = item1.bailun_sku,
item_no = item1.item_no
}) ?? 0;
if (item1.id > 0)
{
updateList.Add(item1);
//conn.Update(item1);
}
else
{
addList.Add(item1);
//conn.Insert(item1);
}
#endregion
#region 销售金额
dc_report_cash_flow_log item = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.销售金额,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.amount_sales * order_item.seller_order_exchange_rate * order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
item_no = order_item.bailun_order_id
};
item.occur_time_year_month_no = $"{item.occur_time.Year}-{item.occur_time.Month}-{item.bailun_sku}";
item.pay_time = CalculationPayTime(configs, item.occur_time, item.data_type, item.platform_type);
item.pay_time_year_month_no = $"{item.pay_time.Year}-{item.pay_time.Month}-{item.bailun_sku}";
item.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item.data_type,
bailun_sku = item.bailun_sku,
item_no = item.item_no
}) ?? 0;
if (item.id > 0)
{
updateList.Add(item);
//conn.Update(item);
}
else
{
addList.Add(item);
//conn.Insert(item);
}
#endregion
}
catch (Exception ex)
{
Console.WriteLine($"现金流-订单-{order_item.bailun_order_id}-异常" + ex.Message);
Console.WriteLine("现金流-订单-异常" + ex.StackTrace);
}
}
if (addList != null && addList.Count >= 1)
{
conn.BatchInsert(addList);
}
if (updateList != null && updateList.Count >= 1)
{
UpdateUsersTest(conn, updateList);
}
}
}
catch (Exception ex)
{
Console.WriteLine("现金流-订单-异常" + ex.Message);
Console.WriteLine("现金流-订单-异常" + ex.StackTrace);
}
}
/// <summary>
/// 计算订单 费
/// </summary>
/// <param name="btime"></param>
/// <param name="etime"></param>
public static void CalculationOrderFee(DateTime btime, DateTime? etime)
{
try
{
......@@ -177,46 +366,6 @@ namespace AutoTurnOver.DB
#endregion
#region 销售释放成本
dc_report_cash_flow_log item5 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.释放销售成本,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.cost_product * order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.后收,
item_no = order_item.bailun_order_id
};
item5.occur_time_year_month_no = $"{item5.occur_time.Year}-{item5.occur_time.Month}-{item5.bailun_sku}";
item5.pay_time = CalculationPayTime(configs, item5.occur_time, item5.data_type, item5.platform_type);
item5.pay_time_year_month_no = $"{item5.pay_time.Year}-{item5.pay_time.Month}-{item5.bailun_sku}";
item5.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item5.data_type,
bailun_sku = item5.bailun_sku,
item_no = item5.item_no
}) ?? 0;
if (item5.id > 0)
{
updateList.Add(item5);
//conn.Update(item5);
}
else
{
addList.Add(item5);
//conn.Insert(item5);
}
#endregion
#region 平台费
dc_report_cash_flow_log item3 = new dc_report_cash_flow_log()
......@@ -256,123 +405,113 @@ namespace AutoTurnOver.DB
}
#endregion
}
catch (Exception ex)
{
Console.WriteLine($"现金流-订单-{order_item.bailun_order_id}-异常" + ex.Message);
Console.WriteLine("现金流-订单-异常" + ex.StackTrace);
}
#region 利润
}
dc_report_cash_flow_log item2 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.利润,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.profit_total * order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
item_no = order_item.bailun_order_id
};
item2.occur_time_year_month_no = $"{item2.occur_time.Year}-{item2.occur_time.Month}-{item2.bailun_sku}";
item2.pay_time = CalculationPayTime(configs, item2.occur_time, item2.data_type, item2.platform_type);
item2.pay_time_year_month_no = $"{item2.pay_time.Year}-{item2.pay_time.Month}-{item2.bailun_sku}";
item2.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item2.data_type,
bailun_sku = item2.bailun_sku,
item_no = item2.item_no
}) ?? 0;
if (item2.id > 0)
{
updateList.Add(item2);
//conn.Update(item2);
}
else
{
addList.Add(item2);
//conn.Insert(item2);
}
if (addList != null && addList.Count >= 1)
{
conn.BatchInsert(addList);
}
if (updateList != null && updateList.Count >= 1)
{
UpdateUsersTest(conn, updateList);
}
#endregion
}
}
catch (Exception ex)
{
Console.WriteLine("现金流-订单-异常" + ex.Message);
Console.WriteLine("现金流-订单-异常" + ex.StackTrace);
}
#region 销售数量
dc_report_cash_flow_log item1 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.销售数量,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
item_no = order_item.bailun_order_id
};
item1.occur_time_year_month_no = $"{item1.occur_time.Year}-{item1.occur_time.Month}-{item1.bailun_sku}";
item1.pay_time = CalculationPayTime(configs, item1.occur_time, item1.data_type, item1.platform_type);
item1.pay_time_year_month_no = $"{item1.pay_time.Year}-{item1.pay_time.Month}-{item1.bailun_sku}";
item1.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item1.data_type,
bailun_sku = item1.bailun_sku,
item_no = item1.item_no
}) ?? 0;
if (item1.id > 0)
{
updateList.Add(item1);
//conn.Update(item1);
}
else
{
addList.Add(item1);
//conn.Insert(item1);
}
}
#endregion
/// <summary>
/// 计算订单 成本
/// </summary>
/// <param name="btime"></param>
/// <param name="etime"></param>
public static void CalculationOrderCost(DateTime btime, DateTime? etime)
{
try
{
var conn = _connection;
int page = 1;
int rows = 5000;
List<dc_report_cash_flow_config> configs = conn.Query<dc_report_cash_flow_config>(" select * from dc_report_cash_flow_config ").AsList();
while (true)
{
var now = DateTime.Now;
var sql = " select * from dc_base_oms_sku where gmt_create>=@btime ";
DynamicParameters parameters = new DynamicParameters();
parameters.Add("btime", btime.ToString("yyyy-MM-dd 00:00:00"));
if (etime != null)
{
sql += " and gmt_create<=@etime ";
parameters.Add("etime", etime.Value.ToString("yyyy-MM-dd 23:59:59"));
}
sql += $" order by id desc limit {(page - 1) * rows},{rows} ";
var order_list = conn.Query<dc_base_oms_sku>(sql, parameters).AsList();
if (order_list == null || order_list.Count <= 0)
{
break;
}
page++;
#region 销售金额
var addList = new List<dc_report_cash_flow_log>();
var updateList = new List<dc_report_cash_flow_log>();
dc_report_cash_flow_log item = new dc_report_cash_flow_log()
foreach (var order_item in order_list)
{
try
{
var item_no = order_item.bailun_order_id;
#region 销售释放成本
dc_report_cash_flow_log item5 = new dc_report_cash_flow_log()
{
bailun_sku = order_item.bailun_sku,
data_type = (int)dc_report_cash_flow_log_data_type_enum.销售金额,
data_type = (int)dc_report_cash_flow_log_data_type_enum.释放销售成本,
is_delete = (order_item.has_delete == 1 || order_item.has_scalp == 1) ? 1 : 0,
item = order_item.bailun_order_id,
update_time = now,
no = order_item.bailun_order_id,
platform_type = order_item.platform_type,
remarks = "",
val = order_item.amount_sales * order_item.seller_order_exchange_rate * order_item.bailun_sku_quantity_ordered,
val = order_item.cost_product * order_item.bailun_sku_quantity_ordered,
occur_time = order_item.paid_time ?? new DateTime(1991, 1, 1),
warehouse_code = order_item.warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.实时,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.后收,
item_no = order_item.bailun_order_id
};
item.occur_time_year_month_no = $"{item.occur_time.Year}-{item.occur_time.Month}-{item.bailun_sku}";
item.pay_time = CalculationPayTime(configs, item.occur_time, item.data_type, item.platform_type);
item.pay_time_year_month_no = $"{item.pay_time.Year}-{item.pay_time.Month}-{item.bailun_sku}";
item.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
item5.occur_time_year_month_no = $"{item5.occur_time.Year}-{item5.occur_time.Month}-{item5.bailun_sku}";
item5.pay_time = CalculationPayTime(configs, item5.occur_time, item5.data_type, item5.platform_type);
item5.pay_time_year_month_no = $"{item5.pay_time.Year}-{item5.pay_time.Month}-{item5.bailun_sku}";
item5.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{
data_type = item.data_type,
bailun_sku = item.bailun_sku,
item_no = item.item_no
data_type = item5.data_type,
bailun_sku = item5.bailun_sku,
item_no = item5.item_no
}) ?? 0;
if (item.id > 0)
if (item5.id > 0)
{
updateList.Add(item);
//conn.Update(item);
updateList.Add(item5);
//conn.Update(item5);
}
else
{
addList.Add(item);
//conn.Insert(item);
addList.Add(item5);
//conn.Insert(item5);
}
#endregion
......@@ -393,7 +532,7 @@ namespace AutoTurnOver.DB
{
UpdateUsersTest(conn, updateList);
}
}
}
catch (Exception ex)
......
......@@ -11,4 +11,8 @@
<ProjectReference Include="..\AutoTurnOver.Utility\AutoTurnOver.Utility.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="AutoTurnOver\Models\" />
</ItemGroup>
</Project>
......@@ -6,6 +6,7 @@ using System.IO;
using AutoTurnOver.Utility;
using System.Linq;
using AutoTurnOver.Models.Base;
using AutoTurnOver.Models.Report;
namespace AutoTurnOver.Services
{
......@@ -838,5 +839,27 @@ namespace AutoTurnOver.Services
}
#endregion
#region 物流商账期
public List<dc_report_logistics_company_config_dto> LogisticsCompanyConfigPage(dc_report_logistics_company_config_search_dto m, int offset, int limit, ref int total)
{
return DB.db_config.LogisticsCompanyConfigPage(m, offset, limit, ref total);
}
public string SaveLogisticsCompanyConfig(dc_report_logistics_company_config m)
{
return DB.db_config.SaveLogisticsCompanyConfig(m);
}
public dc_report_logistics_company_config GetLogisticsCompanyConfigById(int id)
{
return DB.db_config.GetLogisticsCompanyConfigById(id);
}
#endregion
}
}
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading.Tasks;
using AutoTurnOver.Common;
using AutoTurnOver.Models;
using AutoTurnOver.Models.Report;
using AutoTurnOver.Utility;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
......@@ -733,8 +734,6 @@ namespace AutoTurnOver.Controllers
#region 销量预测模型配置
#region 暴增配置
[HttpGet]
public JsonResult SalesForecastConfigList(int limit, int offset, string order, string sort, string warehousecode, string warehousetype, int? warehousearea, string bailun_sku)
{
......@@ -769,7 +768,7 @@ namespace AutoTurnOver.Controllers
}
catch (Exception ex)
{
return Json(new { success =false,message = ex.Message });
return Json(new { success = false, message = ex.Message });
}
}
......@@ -778,8 +777,8 @@ namespace AutoTurnOver.Controllers
{
var m = new Services.ConfigServices().GetSalesForecastConfigById(id);
return new JsonResult(m);
}
}
/// <summary>
/// 删除数据
/// </summary>
......@@ -798,10 +797,8 @@ namespace AutoTurnOver.Controllers
new Services.ConfigServices().DelSalesForecastConfig(id);
return Json(new { success = true, message = ex.Message });
}
}
#endregion
}
#endregion
......@@ -844,5 +841,45 @@ namespace AutoTurnOver.Controllers
}
#endregion
#region 物流商账期
[HttpGet]
public JsonResult LogisticsCompanyConfigPage(int limit, int offset, string order, string sort, string company_code)
{
var m = new dc_report_logistics_company_config_search_dto
{
company_code = company_code
};
var total = 0;
var service = new Services.ConfigServices();
var list = service.LogisticsCompanyConfigPage(m, offset, limit, ref total);
return new JsonResult(new
{
rows = list,
total = total,
});
}
[HttpPost]
public JsonResult SaveLogisticsCompanyConfig([FromBody]dc_report_logistics_company_config m)
{
var result = new Services.ConfigServices().SaveLogisticsCompanyConfig(m);
return new JsonResult(result);
}
[HttpGet]
public JsonResult GetLogisticsCompanyConfigById(int id)
{
var m = new Services.ConfigServices().GetLogisticsCompanyConfigById(id);
return new JsonResult(m);
}
#endregion
}
}
\ No newline at end of file
......@@ -23,9 +23,9 @@ namespace ResetOutofstock
var now = DateTime.Now;
if (now.Hour == 01 && now.Minute == 01)
{
Console.WriteLine($"开始 刷新现金流 订单数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_dao.CalculationOrder(now.AddMonths(-3),DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
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")}");
report_cash_flow_dao.CalculationOrderSale(now.AddMonths(-3),DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(销售),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 01 && now.Minute == 02)
{
......@@ -51,6 +51,18 @@ namespace ResetOutofstock
report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束 刷新订单尾程费 退款数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 01 && now.Minute == 06)
{
Console.WriteLine($"开始 刷新现金流 订单数据 (费),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_dao.CalculationOrderFee(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(费),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
if (now.Hour == 01 && now.Minute == 07)
{
Console.WriteLine($"开始 刷新现金流 订单数据 (成本),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_dao.CalculationOrderCost(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(成本),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
public override void Dispose()
......
......@@ -14,8 +14,8 @@ namespace ResetOutofstock
{
Console.WriteLine("刷新缺货数据任务启动...");
//report_cash_flow_dao.CalculationOrderCostLogistics(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
var now = DateTime.Now;
// report_cash_flow_dao.CalculationOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<ResetOutofstockBackgrounService>();
......
......@@ -20,10 +20,10 @@ namespace ResetOutofstock
try
{
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")}");
var now = DateTime.Now;
report_cash_flow_dao.CalculationOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
report_cash_flow_dao.CalculationOrderFee(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(销售),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
......@@ -34,7 +34,49 @@ namespace ResetOutofstock
Thread.Sleep(240 * 60 * 60 * 1000);
}
});
Task.Factory.StartNew(() => {
while (true)
{
try
{
Console.WriteLine($"开始 刷新现金流 订单数据(成本),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var now = DateTime.Now;
report_cash_flow_dao.CalculationOrderCost(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(成本),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(240 * 60 * 60 * 1000);
}
});
Task.Factory.StartNew(() => {
while (true)
{
try
{
Console.WriteLine($"开始 刷新现金流 订单数据(费),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
var now = DateTime.Now;
report_cash_flow_dao.CalculationOrderSale(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
Console.WriteLine($"结束刷新现金流 订单数据(费),线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(240 * 60 * 60 * 1000);
}
});
Task.Factory.StartNew(() => {
while (true)
{
......
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