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
9a72600f
Commit
9a72600f
authored
Feb 18, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增周转刷新任务
parent
78333d93
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
3 deletions
+53
-3
dc_auto_turnover.cs
AutoTurnOver.DB/dc_auto_turnover.cs
+32
-2
Program.cs
ResetOutofstock/Program.cs
+2
-1
ResetOutofstockBackgrounService.cs
ResetOutofstock/ResetOutofstockBackgrounService.cs
+19
-0
No files found.
AutoTurnOver.DB/dc_auto_turnover.cs
View file @
9a72600f
...
...
@@ -487,9 +487,39 @@ from dc_auto_turnover as dat
/// </summary>
public
static
void
ResetHistory
()
{
var
init_now
=
DateTime
.
Now
.
ToDayHome
();
var
total
=
_connection
.
Query
<
int
>(
" select count(1) from dc_auto_turnover "
);
var
now
=
DateTime
.
Now
;
var
init_date
=
DateTime
.
Parse
(
now
.
ToString
(
"yyyy-MM-dd 05:00:00"
));
if
(
now
>
init_date
)
{
var
init_now
=
DateTime
.
Now
.
ToDayHome
();
var
end_date
=
DateTime
.
Parse
(
now
.
ToString
(
"yyyy-MM-dd 23:00:00"
));
var
total
=
_connection
.
QueryFirstOrDefault
<
int
>(
" select count(1) from dc_auto_turnover where gmt_modified<@init_now "
,
new
{
init_now
});
var
rows
=
(
int
)
Math
.
Floor
(
total
/
((
end_date
-
init_now
).
TotalMinutes
-
5
));
var
datas
=
_connection
.
Query
<
ResetHistoryDto
>(
" select bailun_sku,warehouse_code from dc_auto_turnover where gmt_modified<@init_now limit @rows "
,
new
{
init_now
,
rows
}).
ToList
();
if
(
datas
!=
null
)
{
foreach
(
var
item
in
datas
)
{
_connection
.
Insert
(
new
dc_base_queue
{
submit_date
=
DateTime
.
Now
,
error_message
=
""
,
consume_date
=
null
,
error_stack_trace
=
""
,
message
=
new
{
bailun_sku
=
item
.
bailun_sku
,
warehouse_code
=
item
.
warehouse_code
}.
ToJson
(),
type
=
"刷新周转表"
});
}
}
}
}
public
class
ResetHistoryDto
{
public
string
bailun_sku
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
}
public
static
IEnumerable
<
string
>
GetLabelList
()
{
...
...
ResetOutofstock/Program.cs
View file @
9a72600f
...
...
@@ -31,7 +31,8 @@ namespace ResetOutofstock
//daily.ResetFbaExtendSales(DateTime.Now);
//dc_aims_transfer_warehouse_dao.TransferWarehouseTask();
//daily.ResetFbaExtendReview(DateTime.Now);
//report.PurchaseWeekBackUp();
//report.PurchaseWeekBackUp();
}
catch
(
Exception
ex
)
...
...
ResetOutofstock/ResetOutofstockBackgrounService.cs
View file @
9a72600f
...
...
@@ -237,6 +237,25 @@ namespace ResetOutofstock
}
});
Task
.
Factory
.
StartNew
(()
=>
{
while
(
true
)
{
try
{
Console
.
WriteLine
(
$"开始刷新 已经停止监控的周转数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
dc_auto_turnover
.
ResetHistory
();
Console
.
WriteLine
(
$"结束刷新 已经停止监控的周转数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
}
Thread
.
Sleep
(
55
*
1000
);
}
});
return
Task
.
CompletedTask
;
}
...
...
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