Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
data-center-auto
Commits
7f8e01b0
Commit
7f8e01b0
authored
Nov 18, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增刷新订单财报数据的任务
parent
ba0d41e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
9 deletions
+101
-9
dc_report_finance_dao.cs
AutoTurnOver.DB/dc_report_finance_dao.cs
+76
-2
dc_report_finance.cs
AutoTurnOver.Models/Report/dc_report_finance.cs
+6
-0
Program.cs
ResetOutofstock/Program.cs
+1
-1
ReportFinanceBackgrounService.cs
ResetOutofstock/ReportFinanceBackgrounService.cs
+10
-4
ResetOutofstockBackgrounService.cs
ResetOutofstock/ResetOutofstockBackgrounService.cs
+8
-2
No files found.
AutoTurnOver.DB/dc_report_finance_dao.cs
View file @
7f8e01b0
...
...
@@ -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
);
}
}
}
}
AutoTurnOver.Models/Report/dc_report_finance.cs
View file @
7f8e01b0
...
...
@@ -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
;
}
}
}
ResetOutofstock/Program.cs
View file @
7f8e01b0
...
...
@@ -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
)
{
...
...
ResetOutofstock/ReportFinanceBackgrounService.cs
View file @
7f8e01b0
...
...
@@ -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
==
0
1
)
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
0
2
)
{
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
==
0
1
)
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
0
3
)
{
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"
)}
"
);
}
...
...
ResetOutofstock/ResetOutofstockBackgrounService.cs
View file @
7f8e01b0
...
...
@@ -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"
)}
"
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment