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
0328f60a
Commit
0328f60a
authored
Mar 03, 2023
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化账单抓取
parent
d60c2315
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
47 deletions
+99
-47
dc_base_amazon_fulfilled_shipments.cs
AutoTurnOver.Models/dc_base_amazon_fulfilled_shipments.cs
+1
-0
AmazonDataSynchroService.cs
AutoTurnOver.Services/AmazonDataSynchroService.cs
+0
-0
ApiAmzonResponseDto.cs
AutoTurnOver.Services/Dto/ApiAmzonResponseDto.cs
+78
-14
DataTableExtensions.cs
AutoTurnOver.Utility/DataTableExtensions.cs
+16
-29
Program.cs
ResetOutofstock/Program.cs
+2
-2
ResetOutofstockBackgrounService.cs
ResetOutofstock/ResetOutofstockBackgrounService.cs
+2
-2
No files found.
AutoTurnOver.Models/dc_base_amazon_fulfilled_shipments.cs
View file @
0328f60a
...
@@ -22,6 +22,7 @@ namespace AutoTurnOver.Models
...
@@ -22,6 +22,7 @@ namespace AutoTurnOver.Models
public
string
buyer_name
{
get
;
set
;
}
public
string
buyer_name
{
get
;
set
;
}
public
string
buyer_phone_number
{
get
;
set
;
}
public
string
buyer_phone_number
{
get
;
set
;
}
public
string
sku
{
get
;
set
;
}
public
string
sku
{
get
;
set
;
}
public
string
product_name
{
get
;
set
;
}
public
string
product_name
{
get
;
set
;
}
public
decimal
?
quantity_shipped
{
get
;
set
;
}
public
decimal
?
quantity_shipped
{
get
;
set
;
}
public
string
currency
{
get
;
set
;
}
public
string
currency
{
get
;
set
;
}
...
...
AutoTurnOver.Services/AmazonDataSynchroService.cs
View file @
0328f60a
This diff is collapsed.
Click to expand it.
AutoTurnOver.Services/Dto/ApiAmzonResponseDto.cs
View file @
0328f60a
...
@@ -150,6 +150,8 @@ namespace AutoTurnOver.Services.Dto
...
@@ -150,6 +150,8 @@ namespace AutoTurnOver.Services.Dto
public
DateTime
?
DepositDate
{
get
;
set
;
}
public
DateTime
?
DepositDate
{
get
;
set
;
}
}
}
[
JsonProperty
(
"OtherTransaction"
)]
[
JsonConverter
(
typeof
(
OtherTransactionDataConverter
))]
public
List
<
OtherTransactionDto
>
OtherTransaction
{
get
;
set
;
}
=
new
List
<
OtherTransactionDto
>
{
};
public
List
<
OtherTransactionDto
>
OtherTransaction
{
get
;
set
;
}
=
new
List
<
OtherTransactionDto
>
{
};
public
class
OtherTransactionDto
public
class
OtherTransactionDto
...
@@ -209,13 +211,10 @@ namespace AutoTurnOver.Services.Dto
...
@@ -209,13 +211,10 @@ namespace AutoTurnOver.Services.Dto
}
}
public
PromotionDto
Promotion
{
get
;
set
;
}
[
JsonProperty
(
"Promotion"
)]
public
class
PromotionDto
[
JsonConverter
(
typeof
(
PromotionDataConverter
))]
{
public
List
<
PromotionDto
>
Promotion
{
get
;
set
;
}
public
string
MerchantPromotionID
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
public
Amount
Amount
{
get
;
set
;
}
}
}
}
}
}
}
}
...
@@ -260,13 +259,10 @@ namespace AutoTurnOver.Services.Dto
...
@@ -260,13 +259,10 @@ namespace AutoTurnOver.Services.Dto
}
}
public
PromotionDto
PromotionAdjustment
{
get
;
set
;
}
[
JsonProperty
(
"PromotionAdjustment"
)]
public
class
PromotionDto
[
JsonConverter
(
typeof
(
PromotionDataConverter
))]
{
public
List
<
PromotionDto
>
PromotionAdjustment
{
get
;
set
;
}
public
string
MerchantPromotionID
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
public
Amount
Amount
{
get
;
set
;
}
}
}
}
}
}
}
}
...
@@ -285,6 +281,12 @@ namespace AutoTurnOver.Services.Dto
...
@@ -285,6 +281,12 @@ namespace AutoTurnOver.Services.Dto
}
}
}
}
}
}
public
class
PromotionDto
{
public
string
MerchantPromotionID
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
public
Amount
Amount
{
get
;
set
;
}
}
public
class
FeeDto
public
class
FeeDto
{
{
public
string
Type
{
get
;
set
;
}
public
string
Type
{
get
;
set
;
}
...
@@ -330,6 +332,36 @@ namespace AutoTurnOver.Services.Dto
...
@@ -330,6 +332,36 @@ namespace AutoTurnOver.Services.Dto
serializer
.
Serialize
(
writer
,
value
);
serializer
.
Serialize
(
writer
,
value
);
}
}
}
}
class
OtherTransactionDataConverter
:
JsonConverter
{
public
override
bool
CanConvert
(
Type
objectType
)
{
return
(
objectType
==
typeof
(
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
MessageDto
.
SettlementReportDto
.
OtherTransactionDto
));
}
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
JToken
token
=
JToken
.
Load
(
reader
);
if
(
token
.
Type
==
JTokenType
.
Array
)
{
return
token
.
ToObject
<
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
MessageDto
.
SettlementReportDto
.
OtherTransactionDto
>>();
}
if
(
token
.
Type
==
JTokenType
.
Object
)
{
return
new
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
MessageDto
.
SettlementReportDto
.
OtherTransactionDto
>
{
token
.
ToObject
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
MessageDto
.
SettlementReportDto
.
OtherTransactionDto
>()
};
}
else
{
return
new
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
MessageDto
.
SettlementReportDto
.
OtherTransactionDto
>
{
};
}
}
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
serializer
.
Serialize
(
writer
,
value
);
}
}
class
RefundDataConverter
:
JsonConverter
class
RefundDataConverter
:
JsonConverter
{
{
public
override
bool
CanConvert
(
Type
objectType
)
public
override
bool
CanConvert
(
Type
objectType
)
...
@@ -453,6 +485,38 @@ namespace AutoTurnOver.Services.Dto
...
@@ -453,6 +485,38 @@ namespace AutoTurnOver.Services.Dto
}
}
}
}
class
PromotionDataConverter
:
JsonConverter
{
public
override
bool
CanConvert
(
Type
objectType
)
{
return
(
objectType
==
typeof
(
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
PromotionDto
));
}
public
override
object
ReadJson
(
JsonReader
reader
,
Type
objectType
,
object
existingValue
,
JsonSerializer
serializer
)
{
JToken
token
=
JToken
.
Load
(
reader
);
if
(
token
.
Type
==
JTokenType
.
Array
)
{
var
test
=
token
.
ToString
();
return
token
.
ToObject
<
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
PromotionDto
>>();
}
if
(
token
.
Type
==
JTokenType
.
Object
)
{
return
new
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
PromotionDto
>
{
token
.
ToObject
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
PromotionDto
>
()
};
}
else
{
return
new
List
<
ApiAmazonSettlementDto
.
AmazonEnvelopeDto
.
FeeDto
>
{
};
}
}
public
override
void
WriteJson
(
JsonWriter
writer
,
object
value
,
JsonSerializer
serializer
)
{
serializer
.
Serialize
(
writer
,
value
);
}
}
class
AdjustedItemDataConverter
:
JsonConverter
class
AdjustedItemDataConverter
:
JsonConverter
{
{
public
override
bool
CanConvert
(
Type
objectType
)
public
override
bool
CanConvert
(
Type
objectType
)
...
...
AutoTurnOver.Utility/DataTableExtensions.cs
View file @
0328f60a
...
@@ -42,54 +42,41 @@ namespace AutoTurnOver.Utility
...
@@ -42,54 +42,41 @@ namespace AutoTurnOver.Utility
}
}
public
static
string
DataRowToString
(
this
DataRow
row
,
string
key
)
public
static
string
DataRowToString
(
this
DataRow
row
,
int
index
)
{
{
if
(
row
[
key
]
==
null
)
if
(
row
[
index
]
==
null
)
{
{
return
null
;
return
null
;
}
}
else
else
{
{
return
row
[
key
].
ToString
();
return
row
[
index
].
ToString
();
}
}
}
}
public
static
DateTime
?
DataRowToDateTime
(
this
DataRow
row
,
string
key
)
public
static
DateTime
?
DataRowToDateTime
(
this
DataRow
row
,
int
index
)
{
{
try
if
(
row
[
index
]
==
null
)
{
{
if
(
row
[
key
]
==
null
)
return
null
;
{
return
null
;
}
else
{
return
DateTime
.
Parse
(
row
[
key
].
ToString
());
}
}
}
catch
(
Exception
ex
)
else
{
{
return
null
;
return
DateTime
.
Parse
(
row
[
index
].
ToString
())
;
}
}
}
}
public
static
decimal
?
DataRowToNumber
(
this
DataRow
row
,
string
key
)
public
static
decimal
?
DataRowToNumber
(
this
DataRow
row
,
int
index
)
{
{
try
if
(
row
[
index
]
==
null
)
{
{
if
(
row
[
key
]
==
null
)
return
null
;
{
return
null
;
}
else
{
return
decimal
.
Parse
(
row
[
key
].
ToString
());
}
}
}
catch
(
Exception
ex
)
else
{
{
return
null
;
return
decimal
.
Parse
(
row
[
index
].
ToString
())
;
}
}
}
}
...
...
ResetOutofstock/Program.cs
View file @
0328f60a
...
@@ -54,10 +54,10 @@ namespace ResetOutofstock
...
@@ -54,10 +54,10 @@ namespace ResetOutofstock
//new AmazonDataSynchroService().SynchroFinancialEventGroups();
//new AmazonDataSynchroService().SynchroFinancialEventGroups();
//new AmazonDataSynchroService().SynchroReportIds();
//new AmazonDataSynchroService().SynchroReportIds();
//new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL);
//new AmazonDataSynchroService().SynchroReportIds(FikaAmazonAPI.Utils.Constants.ReportTypes.GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL
,10
);
//while (true)
//while (true)
//{
//{
// new AmazonDataSynchroService().Ana
FbaShipmentReport(
);
// new AmazonDataSynchroService().Ana
Report(-1
);
//}
//}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
ResetOutofstock/ResetOutofstockBackgrounService.cs
View file @
0328f60a
...
@@ -623,7 +623,7 @@ namespace ResetOutofstock
...
@@ -623,7 +623,7 @@ namespace ResetOutofstock
try
try
{
{
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"
)}
"
);
new
AmazonDataSynchroService
().
SynchroReportIds
(
FikaAmazonAPI
.
Utils
.
Constants
.
ReportTypes
.
GET_V2_SETTLEMENT_REPORT_DATA_XML
);
new
AmazonDataSynchroService
().
SynchroReportIds
(
FikaAmazonAPI
.
Utils
.
Constants
.
ReportTypes
.
GET_V2_SETTLEMENT_REPORT_DATA_XML
,
9
);
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"
)}
"
);
Thread
.
Sleep
(
1000
*
60
*
3
);
Thread
.
Sleep
(
1000
*
60
*
3
);
}
}
...
@@ -645,7 +645,7 @@ namespace ResetOutofstock
...
@@ -645,7 +645,7 @@ namespace ResetOutofstock
try
try
{
{
Console
.
WriteLine
(
$"开始 拉取亚马逊 fba发货,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始 拉取亚马逊 fba发货,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
new
AmazonDataSynchroService
().
SynchroReportIds
(
FikaAmazonAPI
.
Utils
.
Constants
.
ReportTypes
.
GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL
);
new
AmazonDataSynchroService
().
SynchroReportIds
(
FikaAmazonAPI
.
Utils
.
Constants
.
ReportTypes
.
GET_AMAZON_FULFILLED_SHIPMENTS_DATA_GENERAL
,
9
);
Console
.
WriteLine
(
$"结束 拉取亚马逊 fba发货,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束 拉取亚马逊 fba发货,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Thread
.
Sleep
(
1000
*
60
*
3
);
Thread
.
Sleep
(
1000
*
60
*
3
);
}
}
...
...
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