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
ffa6f427
Commit
ffa6f427
authored
Jun 29, 2021
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改同步半成品库存服务
parent
b3dc7e3a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
Program.cs
Bailun.DC.SyncSemiStock/Program.cs
+3
-1
Services.cs
Bailun.DC.SyncSemiStock/Services.cs
+16
-6
No files found.
Bailun.DC.SyncSemiStock/Program.cs
View file @
ffa6f427
...
@@ -17,11 +17,13 @@ namespace Bailun.DC.SyncSemiStock
...
@@ -17,11 +17,13 @@ namespace Bailun.DC.SyncSemiStock
await
builder
.
RunConsoleAsync
();
await
builder
.
RunConsoleAsync
();
//new Services().Init();
//new Services().SyncSupplierPrice();
//new Services().SyncSupplierPrice();
//new Services().SyncStockLog();
//new Services().SyncStockLog();
//new Services().SaveDailySemiStock();
}
}
...
...
Bailun.DC.SyncSemiStock/Services.cs
View file @
ffa6f427
...
@@ -80,11 +80,12 @@ namespace Bailun.DC.SyncSemiStock
...
@@ -80,11 +80,12 @@ namespace Bailun.DC.SyncSemiStock
totalPage
=
json
.
data
.
TotalPages
;
totalPage
=
json
.
data
.
TotalPages
;
total
=
json
.
data
.
TotalItems
;
total
=
json
.
data
.
TotalItems
;
try
{
//删除历史数据
//删除历史数据
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
{
cn
.
Open
();
cn
.
Open
();
}
}
...
@@ -97,14 +98,14 @@ namespace Bailun.DC.SyncSemiStock
...
@@ -97,14 +98,14 @@ namespace Bailun.DC.SyncSemiStock
SaveData
(
json
.
data
.
Items
);
SaveData
(
json
.
data
.
Items
);
//请求第二页之后的数据
//请求第二页之后的数据
while
(
page
<
totalPage
)
while
(
page
<
totalPage
)
{
{
page
++;
page
++;
result
=
DC
.
Common
.
HttpHelper
.
NetHelper
.
Request
(
url
+
"?page="
+
page
+
"&rows="
+
rows
);
result
=
DC
.
Common
.
HttpHelper
.
NetHelper
.
Request
(
url
+
"?page="
+
page
+
"&rows="
+
rows
);
json
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
Models
.
response_StockData
>(
result
);
json
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
Models
.
response_StockData
>(
result
);
if
(
json
.
success
)
if
(
json
.
success
)
{
{
page
=
json
.
data
.
CurrentPage
;
page
=
json
.
data
.
CurrentPage
;
totalPage
=
json
.
data
.
TotalPages
;
totalPage
=
json
.
data
.
TotalPages
;
...
@@ -118,7 +119,7 @@ namespace Bailun.DC.SyncSemiStock
...
@@ -118,7 +119,7 @@ namespace Bailun.DC.SyncSemiStock
//保存每日库存
//保存每日库存
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
{
cn
.
Open
();
cn
.
Open
();
}
}
...
@@ -129,6 +130,15 @@ namespace Bailun.DC.SyncSemiStock
...
@@ -129,6 +130,15 @@ namespace Bailun.DC.SyncSemiStock
}
}
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"获取半成品实时库存数据异常:"
+
ex
.
Message
);
System
.
Threading
.
Thread
.
Sleep
(
5
*
1000
);
Init
();
}
}
}
}
...
...
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