Commit c57175d6 by 泽锋 李

fix

parent af7a4890
......@@ -85,12 +85,12 @@ namespace AutoTurnOver.DB
public int Delete<T>(T entityToDelete, IDbTransaction transaction = null, int? commandTimeout = null)
{
return _connection.Delete(entityToDelete, transaction, commandTimeout);
return _connection.Delete<T>(entityToDelete, transaction, commandTimeout);
}
public int Delete<T>(object id, IDbTransaction transaction = null, int? commandTimeout = null)
{
return _connection.Delete(id, transaction, commandTimeout);
return _connection.Delete<T>(id, transaction, commandTimeout);
}
public int? Insert<TEntity>(TEntity entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null)
{
......
......@@ -1965,10 +1965,7 @@ truncate table dc_base_lastweek_data_temp; ", new { btime = DateTime.Now.AddDays
public static void ResetCashFlowData()
{
//现金流汇总报表,9点之前还在跑数据,不用刷新
if (DateTime.Now.Hour >= 9)
{
_connection.Execute(@" -- 刷新 现金流汇总表
_connection.Execute(@" -- 刷新 现金流汇总表
set session transaction isolation level read uncommitted;
start transaction;
......@@ -1982,7 +1979,7 @@ select platform_type,web_site,year(occur_time) as 'year',month(occur_time) as 'm
;
", new { btime = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-01 00:00:00") }, commandTimeout: 0);
_connection.Execute(@" -- 刷新 现金流汇总表
_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 and pay_time>=@btime GROUP BY pay_time_year_month_no,day(pay_time)
......@@ -1994,14 +1991,14 @@ alter table dc_report_cash_flow_group_dayTemp rename dc_report_cash_flow_group_d
truncate table dc_report_cash_flow_group_day_temp;
", new { btime = DateTime.Now.AddMonths(-3).ToString("yyyy-MM-01 00:00:00") }, commandTimeout: 0);
var datePar = new
{
btime = DateTime.Now.GetMonthFirstDay(),
etime = DateTime.Now.LastDayOfMonth().ToString("yyyy-MM-dd 23:59:59"),
lastBtime = DateTime.Now.AddMonths(-1).GetMonthFirstDay(),
lastEtime = DateTime.Now.AddMonths(-1).LastDayOfMonth().ToString("yyyy-MM-dd 23:59:59")
};
_connection.Execute(@" -- 刷新 现金流汇总表
var datePar = new
{
btime = DateTime.Now.GetMonthFirstDay(),
etime = DateTime.Now.LastDayOfMonth().ToString("yyyy-MM-dd 23:59:59"),
lastBtime = DateTime.Now.AddMonths(-1).GetMonthFirstDay(),
lastEtime = DateTime.Now.AddMonths(-1).LastDayOfMonth().ToString("yyyy-MM-dd 23:59:59")
};
_connection.Execute(@" -- 刷新 现金流汇总表
set session transaction isolation level read uncommitted;
start transaction;
......@@ -2052,7 +2049,7 @@ truncate table dc_report_cash_flow_sku_group_temp;
update dc_report_cash_flow_sku_group set current_balance=current_income+current_expend ,last_balance=last_income+last_expend;
", datePar, commandTimeout: 0);
_connection.Execute(@"
_connection.Execute(@"
update dc_base_stock set pay_amount_30=0,income_amount_30=0;
update dc_base_stock as t1,
( select bailun_sku,warehouse_code, abs(sum(case when data_type not in (2) then val else 0 end )) as 'pay_amount_30',
......@@ -2062,14 +2059,13 @@ set t1.pay_amount_30 =t2.pay_amount_30, t1.income_amount_30 = t2.income_amount_
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
", new { btime = DateTime.Now.AddDays(-30).ToDayHome() }, commandTimeout: 0);
_connection.Execute(@"
_connection.Execute(@"
update dc_base_stock set available_days=0;
update dc_base_stock as t1,
dc_auto_turnover as t2
set t1.available_days = (t1.usable_stock / if(t2.daily_weighted_sales<=0,1,t2.daily_weighted_sales))
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
", commandTimeout: 0);
}
}
/// <summary>
......
......@@ -16,6 +16,7 @@ namespace ResetOutofstock
try
{
var now = DateTime.Now;
//report.ResetCashFlowData();
//report.StockWeekBackUp();
//report.PurchaseWeekBackUp();
//report_cash_flow_dao.CalculationTransferOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
......
......@@ -18,7 +18,7 @@ namespace ResetOutofstock
{
Console.WriteLine("开始刷新调拨订单数据");
var now = DateTime.Now;
report_cash_flow_dao.CalculationTransferOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
//report_cash_flow_dao.CalculationTransferOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
//report.ResetCashFlowData();
Console.WriteLine("结束调拨订单数据");
});
......
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