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
ff220f7e
Commit
ff220f7e
authored
Sep 15, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ebay 的缺货推送挑出来,10分钟一次
parent
ffc40343
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
3 deletions
+66
-3
ReportServices.cs
AutoTurnOver.Services/ReportServices.cs
+43
-3
ShortagePushBackgroundService.cs
ShortagePush/ShortagePushBackgroundService.cs
+23
-0
No files found.
AutoTurnOver.Services/ReportServices.cs
View file @
ff220f7e
...
...
@@ -476,7 +476,7 @@ namespace AutoTurnOver.Services
{
// 国内仓
List
<
string
>
platform1s
=
new
List
<
string
>
{
"
ebay"
,
"
amazon"
,
"aliexpress"
,
"shopee"
,
"wish"
,
"lazada"
};
List
<
string
>
platform1s
=
new
List
<
string
>
{
"amazon"
,
"aliexpress"
,
"shopee"
,
"wish"
,
"lazada"
};
foreach
(
var
item
in
platform1s
.
Where
(
s
=>
string
.
IsNullOrWhiteSpace
(
platform
)
||
platform
==
s
))
{
try
...
...
@@ -496,7 +496,7 @@ namespace AutoTurnOver.Services
}
//国外仓1
List
<
string
>
platform2s
=
new
List
<
string
>
{
"
ebay"
,
"
wish"
};
List
<
string
>
platform2s
=
new
List
<
string
>
{
"wish"
};
List
<
string
>
rule1
=
new
List
<
string
>
{
"GBYKD"
,
"JZHYBLGC"
,
"MDBLWYT"
,
"MXBLWYT"
,
"BLUSGDC"
,
"GBBMHBL"
,
"GB4PXBL"
,
"DEBLDG"
,
"USGCBL"
,
"USHWBL"
,
"US4PXBL"
,
"AUWYTBL"
,
"AU4PXBL"
,
"GBWYTUK"
,
"GBLQST"
};
foreach
(
var
item
in
platform2s
.
Where
(
s
=>
string
.
IsNullOrWhiteSpace
(
platform
)
||
platform
==
s
))
{
...
...
@@ -539,6 +539,42 @@ namespace AutoTurnOver.Services
}
public
void
ShortagePushEbay
(
bool
is_all
=
false
)
{
try
{
List
<
dc_auto_shortage_push
>
datas
=
new
List
<
dc_auto_shortage_push
>();
datas
.
AddRange
(
report
.
ChinaShortagePush
(
"ebay"
,
is_all
));
var
err_datas
=
ApiServices
.
ShortagePush
(
datas
,
"ebay"
);
// 记录推送状态
report
.
AddShortagePush
(
datas
.
Where
(
s
=>
!
err_datas
.
Any
(
e
=>
e
.
warehouseCode
==
s
.
warehouse_code
&&
s
.
bailun_sku
==
e
.
sku
)));
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
Console
.
WriteLine
(
ex
.
StackTrace
);
}
//国外仓1
List
<
string
>
rule1
=
new
List
<
string
>
{
"GBYKD"
,
"JZHYBLGC"
,
"MDBLWYT"
,
"MXBLWYT"
,
"BLUSGDC"
,
"GBBMHBL"
,
"GB4PXBL"
,
"DEBLDG"
,
"USGCBL"
,
"USHWBL"
,
"US4PXBL"
,
"AUWYTBL"
,
"AU4PXBL"
,
"GBWYTUK"
,
"GBLQST"
};
try
{
List
<
dc_auto_shortage_push
>
datas
=
new
List
<
dc_auto_shortage_push
>();
datas
.
AddRange
(
report
.
NotChinaShortagePush
(
rule1
,
"ebay"
,
is_all
));
var
err_datas
=
ApiServices
.
ShortagePush
(
datas
,
"ebay"
);
// 记录推送状态
report
.
AddShortagePush
(
datas
.
Where
(
s
=>
!
err_datas
.
Any
(
e
=>
e
.
warehouseCode
==
s
.
warehouse_code
&&
s
.
bailun_sku
==
e
.
sku
)));
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
Console
.
WriteLine
(
ex
.
StackTrace
);
}
}
/// <summary>
/// 过滤掉一部分不需要改在0的数据
/// </summary>
...
...
@@ -568,11 +604,15 @@ namespace AutoTurnOver.Services
}
public
void
ReturnGoodsPush
(
string
platform
=
null
)
{
var
platform_list
=
new
List
<
string
>
{
"
ebay"
,
"
amazon"
,
"aliexpress"
,
"shopee"
,
"wish"
,
"lazada"
,
"opensky"
,
"sears"
,
"walmart"
};
var
platform_list
=
new
List
<
string
>
{
"amazon"
,
"aliexpress"
,
"shopee"
,
"wish"
,
"lazada"
,
"opensky"
,
"sears"
,
"walmart"
};
foreach
(
var
item
in
platform_list
.
Where
(
s
=>
string
.
IsNullOrWhiteSpace
(
platform
)
||
platform
==
s
))
{
PlatformReturnGoodsPush
(
item
);
}
}
public
void
ReturnGoodsPushEaby
()
{
PlatformReturnGoodsPush
(
"ebay"
);
}
public
void
PlatformReturnGoodsPush
(
string
platform
)
{
...
...
ShortagePush/ShortagePushBackgroundService.cs
View file @
ff220f7e
...
...
@@ -37,6 +37,29 @@ namespace ShortagePush
Thread
.
Sleep
(
30
*
60
*
1000
);
}
});
Task
.
Factory
.
StartNew
(()
=>
{
while
(
true
)
{
try
{
System
.
Console
.
WriteLine
(
$"开始推送 Ebay 改零数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
new
ReportServices
().
ShortagePushEbay
();
System
.
Console
.
WriteLine
(
$"结束推送 Ebay 改零数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
System
.
Console
.
WriteLine
(
$"开始推送 Ebay 回货数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
new
ReportServices
().
ReturnGoodsPushEaby
();
System
.
Console
.
WriteLine
(
$"结束推送 Ebay 回货数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
.
Message
);
}
Thread
.
Sleep
(
10
*
60
*
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