Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
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
DataCenter_Core2.1_20190520
Commits
f75329a5
Commit
f75329a5
authored
Oct 29, 2020
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整wms物流基础数据
parent
30b63a09
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
9 deletions
+19
-9
Services.cs
Bailun.DC.SyncLogisticInfo/Services.cs
+19
-9
No files found.
Bailun.DC.SyncLogisticInfo/Services.cs
View file @
f75329a5
...
...
@@ -13,7 +13,7 @@ namespace Bailun.DC.SyncLogisticInfo
{
public
class
Services
:
BackgroundService
{
private
static
bool
isRuning
=
false
;
private
Timer
_timer
;
protected
override
Task
ExecuteAsync
(
CancellationToken
stoppingToken
)
...
...
@@ -28,7 +28,7 @@ namespace Bailun.DC.SyncLogisticInfo
{
var
now
=
DateTime
.
Now
;
if
(
now
.
Minute
%
30
==
0
)
//每30分钟同步一次
if
(
now
.
Minute
%
10
==
0
&&
!
isRuning
)
//每30分钟同步一次
{
Console
.
WriteLine
(
"开始启动 "
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
Init
();
...
...
@@ -45,6 +45,9 @@ namespace Bailun.DC.SyncLogisticInfo
public
void
Init
()
{
try
{
isRuning
=
true
;
Dapper
.
SimpleCRUD
.
SetDialect
(
SimpleCRUD
.
Dialect
.
MySQL
);
var
starttime
=
DateTime
.
Parse
(
"2020-01-01"
);
...
...
@@ -63,8 +66,8 @@ namespace Bailun.DC.SyncLogisticInfo
var
m
=
cn
.
QueryFirstOrDefault
<
DateTime
?>(
"select end_time from job_point_log where job_name='dc-base-logisticinfo'"
);
if
(
m
!=
null
&&
m
.
HasValue
)
{
starttime
=
m
.
Value
.
AddMinutes
(-
3
);
endtime
=
starttime
.
AddHours
(
1
);
starttime
=
m
.
Value
.
AddMinutes
(-
2
);
endtime
=
starttime
.
AddHours
(
2
);
}
}
...
...
@@ -77,7 +80,7 @@ namespace Bailun.DC.SyncLogisticInfo
}
while
(
total
==
-
1
||
total
>((
page
-
1
)*
pagesize
))
while
(
total
==
-
1
||
total
>
((
page
-
1
)
*
pagesize
))
{
var
j
=
new
{
...
...
@@ -92,16 +95,16 @@ namespace Bailun.DC.SyncLogisticInfo
var
str
=
Common
.
HttpHelper
.
NetHelper
.
HttpPostJson
(
url
,
JsonConvert
.
SerializeObject
(
j
));
var
json
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
mResult
>(
str
);
if
(
json
!=
null
&&
json
.
success
&&
json
.
result
.
result
.
Count
>
0
)
if
(
json
!=
null
&&
json
.
success
&&
json
.
result
.
result
.
Count
>
0
)
{
Save
(
json
.
result
.
result
);
Console
.
WriteLine
(
"总记录数:"
+
json
.
result
.
total
+
",当前页记录数:"
+
json
.
result
.
result
.
Count
+
"条记录。"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
Console
.
WriteLine
(
"总记录数:"
+
json
.
result
.
total
+
",当前页记录数:"
+
json
.
result
.
result
.
Count
+
"条记录。"
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
total
=
json
.
result
.
total
;
page
++;
}
else
{
page
=
1
;
page
=
1
;
total
=
0
;
endtime
=
endtime
.
AddDays
(
1
);
}
...
...
@@ -114,10 +117,17 @@ namespace Bailun.DC.SyncLogisticInfo
cn
.
Open
();
}
cn
.
Execute
(
"update job_point_log start_time='"
+
starttime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)+
"',end_time='"
+
endtime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)+
"' where job_name='dc-base-logisticinfo'"
);
cn
.
Execute
(
"update job_point_log start_time='"
+
starttime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"',end_time='"
+
endtime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"' where job_name='dc-base-logisticinfo'"
);
}
isRuning
=
false
;
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
isRuning
=
false
;
}
}
...
...
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