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
a2ea0329
Commit
a2ea0329
authored
May 08, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
刷新缺货数据时,降低事务的锁级别
parent
73b940d0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
406 additions
and
10 deletions
+406
-10
report.cs
AutoTurnOver.DB/report.cs
+0
-0
AccountDto.cs
AutoTurnOver.Models/ApiDto/AccountDto.cs
+2
-2
LmsShipLogisticsDto.cs
AutoTurnOver.Models/ApiDto/LmsShipLogisticsDto.cs
+23
-0
PlatformDto.cs
AutoTurnOver.Models/ApiDto/PlatformDto.cs
+19
-0
crm_case_order_dto.cs
AutoTurnOver.Models/ApiDto/crm_case_order_dto.cs
+33
-0
crm_message_custom_template_dto.cs
...TurnOver.Models/ApiDto/crm_message_custom_template_dto.cs
+20
-0
quantity_out_stock_detail_dto.cs
AutoTurnOver.Models/Report/quantity_out_stock_detail_dto.cs
+11
-0
return_speed_change_dto.cs
AutoTurnOver.Models/return_speed_change_dto.cs
+42
-0
ApiServices.cs
AutoTurnOver.Services/ApiServices.cs
+158
-5
ReportServices.cs
AutoTurnOver.Services/ReportServices.cs
+52
-2
RedisConsts.cs
AutoTurnOver.Utility/RedisConsts.cs
+2
-0
CommonController.cs
AutoTurnOver/Controllers/CommonController.cs
+36
-0
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+0
-0
appsettings.json
AutoTurnOver/appsettings.json
+8
-1
No files found.
AutoTurnOver.DB/report.cs
View file @
a2ea0329
This diff is collapsed.
Click to expand it.
AutoTurnOver.Models/ApiDto/AccountDto.cs
View file @
a2ea0329
...
...
@@ -22,12 +22,12 @@ namespace AutoTurnOver.Models.ApiDto
public
string
SiteEn
{
get
;
set
;
}
}
public
class
AccountResultDto
public
class
PamsResultDto
<
T
>
{
public
bool
Success
{
get
;
set
;
}
public
string
Message
{
get
;
set
;
}
public
List
<
AccountDto
>
Data
{
get
;
set
;
}
public
T
Data
{
get
;
set
;
}
}
}
AutoTurnOver.Models/ApiDto/LmsShipLogisticsDto.cs
0 → 100644
View file @
a2ea0329
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models.ApiDto
{
/// <summary>
/// 物流方式
/// </summary>
public
class
LmsShipLogisticsDto
{
public
string
Line_Code
{
get
;
set
;
}
public
string
Line_Name
{
get
;
set
;
}
}
public
class
LmsResultDto
<
T
>
{
public
bool
Success
{
get
;
set
;
}
public
string
ErrorMessage
{
get
;
set
;
}
public
T
Data
{
get
;
set
;
}
}
}
AutoTurnOver.Models/ApiDto/PlatformDto.cs
0 → 100644
View file @
a2ea0329
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models.ApiDto
{
public
class
PlatformDto
{
public
int
ID
{
get
;
set
;
}
public
string
Name
{
get
{
return
EnglishName
;
}
}
public
string
EnglishName
{
get
;
set
;
}
}
}
AutoTurnOver.Models/ApiDto/crm_case_order_dto.cs
0 → 100644
View file @
a2ea0329
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models.ApiDto
{
public
class
crm_case_order_dto
{
public
string
order_no
{
get
;
set
;
}
public
string
platform_type
{
get
;
set
;
}
}
public
class
crm_message_dto
{
public
string
order_no
{
get
;
set
;
}
public
string
platform_type
{
get
;
set
;
}
}
public
class
crm_message_reply_dto
{
public
string
order_no
{
get
;
set
;
}
public
string
platform_type
{
get
;
set
;
}
}
public
class
crm_api_result_dto
<
T
>
{
public
bool
success
{
get
;
set
;
}
public
string
message
{
get
;
set
;
}
public
T
data
{
get
;
set
;
}
}
}
AutoTurnOver.Models/ApiDto/crm_message_custom_template_dto.cs
0 → 100644
View file @
a2ea0329
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models.ApiDto
{
/// <summary>
/// crm 出信模板
/// </summary>
public
class
crm_message_custom_template_dto
{
public
int
ID
{
get
;
set
;
}
public
string
Content
{
get
;
set
;
}
public
string
Title
{
get
;
set
;
}
public
string
Subject
{
get
;
set
;
}
}
}
AutoTurnOver.Models/Report/quantity_out_stock_detail_dto.cs
View file @
a2ea0329
...
...
@@ -198,6 +198,10 @@ namespace AutoTurnOver.Models.Report
public
int
sum_order_count
{
get
;
set
;
}
public
int
sum_sku_count
{
get
;
set
;
}
public
int
crm_case_count
{
get
;
set
;
}
public
int
crm_message_count
{
get
;
set
;
}
public
int
crm_message_reply_count
{
get
;
set
;
}
}
public
class
quantity_out_stock_detail_search_dto
...
...
@@ -216,6 +220,13 @@ namespace AutoTurnOver.Models.Report
public
int
?
bailun_account_id
{
get
;
set
;}
public
bool
isSum
{
get
;
set
;
}
public
DateTime
?
pay_time_min
{
get
;
set
;
}
public
DateTime
?
pay_time_max
{
get
;
set
;
}
public
string
shiplogistics_code
{
get
;
set
;
}
public
string
platform_type
{
get
;
set
;
}
}
public
class
buy_ontheway_detail_dto
...
...
AutoTurnOver.Models/return_speed_change_dto.cs
0 → 100644
View file @
a2ea0329
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
AutoTurnOver.Models
{
public
class
return_speed_change_dto
{
public
int
id
{
get
;
set
;
}
public
string
product_code
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
public
string
warehouse_name
{
get
;
set
;
}
public
string
bailun_sku
{
get
;
set
;
}
public
string
sku_name
{
get
;
set
;
}
public
int
has_available_stock
{
get
;
set
;
}
public
string
buyer_name
{
get
;
set
;
}
public
string
ebay_bailun_require_logistics
{
get
;
set
;
}
public
string
ebay_logistics_method_name
{
get
;
set
;
}
}
public
class
return_speed_change_search_dto
{
public
int
?
search_type
{
get
;
set
;
}
public
string
warehousetype
{
get
;
set
;
}
public
int
?
warehousearea
{
get
;
set
;
}
public
string
warehouse_code
{
get
;
set
;
}
public
string
key_words
{
get
;
set
;
}
public
string
purchase_user
{
get
;
set
;
}
public
bool
isSum
{
get
;
set
;
}
public
bool
?
has_available_stock
{
get
;
set
;
}
}
}
AutoTurnOver.Services/ApiServices.cs
View file @
a2ea0329
...
...
@@ -147,7 +147,7 @@ namespace AutoTurnOver.Services
}
/// <summary>
///
推送采购计划
///
账号列表
/// </summary>
public
static
List
<
AccountDto
>
AccountList
()
{
...
...
@@ -156,7 +156,7 @@ namespace AutoTurnOver.Services
{
string
url
=
ConfigHelper
.
GetValue
(
"Pams_GetAccountToken"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
GET
,
""
,
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
AccountResultDto
>();
var
result
=
resultStr
.
ToObj
<
PamsResultDto
<
List
<
AccountDto
>>
>();
if
(
result
==
null
)
{
throw
new
Exception
(
"账号系统异常: 未获取到数据"
);
...
...
@@ -167,9 +167,6 @@ namespace AutoTurnOver.Services
}
return
result
.
Data
;
});
}
public
static
List
<
AccountDto
>
AccountList
(
string
name
)
...
...
@@ -202,5 +199,161 @@ namespace AutoTurnOver.Services
}
/// <summary>
/// 查询crm case 数据
/// </summary>
public
static
List
<
crm_case_order_dto
>
CrmCaseOrder
(
List
<
string
>
order_no_list
)
{
if
(
order_no_list
==
null
||
order_no_list
.
Count
<=
0
)
{
return
new
List
<
crm_case_order_dto
>();
}
string
url
=
ConfigHelper
.
GetValue
(
"Crm_Case_Order"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
POST
,
"order_no_list="
+
string
.
Join
(
","
,
order_no_list
),
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
crm_api_result_dto
<
List
<
crm_case_order_dto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"crm系统: 获取case 数据失败"
);
}
if
(!
result
.
success
)
{
throw
new
Exception
(
"crm系统: "
+
result
.
message
);
}
return
result
.
data
;
}
public
static
List
<
crm_message_dto
>
CrmMessage
(
List
<
string
>
order_no_list
)
{
if
(
order_no_list
==
null
||
order_no_list
.
Count
<=
0
)
{
return
new
List
<
crm_message_dto
>();
}
string
url
=
ConfigHelper
.
GetValue
(
"Crm_Message"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
POST
,
"order_no_list="
+
string
.
Join
(
","
,
order_no_list
),
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
crm_api_result_dto
<
List
<
crm_message_dto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"crm系统: 获取客户来信 数据失败"
);
}
if
(!
result
.
success
)
{
throw
new
Exception
(
"crm系统: "
+
result
.
message
);
}
return
result
.
data
;
}
public
static
List
<
crm_message_reply_dto
>
CrmMessageReply
(
List
<
string
>
order_no_list
)
{
if
(
order_no_list
==
null
||
order_no_list
.
Count
<=
0
)
{
return
new
List
<
crm_message_reply_dto
>();
}
string
url
=
ConfigHelper
.
GetValue
(
"Crm_Message_Reply"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
POST
,
"order_no_list="
+
string
.
Join
(
","
,
order_no_list
),
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
crm_api_result_dto
<
List
<
crm_message_reply_dto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"crm系统: 获取出信数据失败"
);
}
if
(!
result
.
success
)
{
throw
new
Exception
(
"crm系统: "
+
result
.
message
);
}
return
result
.
data
;
}
public
static
List
<
LmsShipLogisticsDto
>
ShipLogisticsList
()
{
//查询采购建议明细
return
RedisHelper
.
Get
(
RedisConsts
.
Lms_GetLogistics
,
()
=>
{
string
url
=
ConfigHelper
.
GetValue
(
"Lms_GetLogistics"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
GET
,
""
,
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
LmsResultDto
<
List
<
LmsShipLogisticsDto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"lms系统异常: 未获取到数据"
);
}
if
(!
result
.
Success
)
{
throw
new
Exception
(
"lms系统异常: "
+
result
.
ErrorMessage
);
}
return
result
.
Data
;
});
}
public
static
List
<
LmsShipLogisticsDto
>
ShipLogisticsList
(
string
name
)
{
try
{
if
(
string
.
IsNullOrWhiteSpace
(
name
))
return
ShipLogisticsList
();
return
ShipLogisticsList
().
Where
(
s
=>
(
s
.
Line_Code
??
""
).
Contains
(
name
,
StringComparison
.
OrdinalIgnoreCase
)
||
(
s
.
Line_Name
??
""
).
Contains
(
name
,
StringComparison
.
OrdinalIgnoreCase
)
).
ToList
();
}
catch
(
Exception
ex
)
{
report
.
AddError
(
new
dc_task_error_log
{
date
=
DateTime
.
Now
,
message
=
ex
.
Message
,
stack_trace
=
ex
.
StackTrace
,
task_name
=
"ahipLogistics_api"
});
throw
;
}
}
/// <summary>
/// 平台列表
/// </summary>
public
static
List
<
PlatformDto
>
PlatformList
()
{
string
url
=
ConfigHelper
.
GetValue
(
"Pams_PlatformList"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
GET
,
""
,
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
PamsResultDto
<
List
<
PlatformDto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"账号系统异常: 未获取到平台数据"
);
}
if
(!
result
.
Success
)
{
throw
new
Exception
(
"账号系统异常: "
+
result
.
Message
);
}
return
result
.
Data
;
}
/// <summary>
/// 查询出信模板
/// </summary>
/// <param name="order_no_list"></param>
/// <returns></returns>
public
static
List
<
crm_message_custom_template_dto
>
MessageCustomTemplateList
()
{
string
url
=
ConfigHelper
.
GetValue
(
"Crm_Message_Custom_Template"
);
string
resultStr
=
HttpHelper
.
Request
(
url
,
RequestType
.
POST
,
""
,
timeout
:
1000
*
60
*
60
*
24
);
var
result
=
resultStr
.
ToObj
<
crm_api_result_dto
<
List
<
crm_message_custom_template_dto
>>>();
if
(
result
==
null
)
{
throw
new
Exception
(
"crm系统: 获取case 数据失败"
);
}
if
(!
result
.
success
)
{
throw
new
Exception
(
"crm系统: "
+
result
.
message
);
}
return
result
.
data
;
}
}
}
AutoTurnOver.Services/ReportServices.cs
View file @
a2ea0329
...
...
@@ -313,12 +313,47 @@ namespace AutoTurnOver.Services
public
List
<
quantity_out_stock_dto
>
QuantityOutStockList
(
quantity_out_stock_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
return
report
.
QuantityOutStockList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
return
report
.
QuantityOutStockList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
}
public
List
<
quantity_out_stock_detail_dto
>
QuantityOutStockDetailList
(
quantity_out_stock_detail_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
return
report
.
QuantityOutStockDetailList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
var
datas
=
report
.
QuantityOutStockDetailList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
if
(
datas
.
Count
<=
200
&&
datas
.
Count
>=
1
&&
!
m
.
isSum
)
{
var
orders
=
datas
.
Select
(
s
=>
(
"ebay"
.
Equals
(
s
.
platform_type
)
?
s
.
transaction_id
:
s
.
origin_order_id
)).
ToList
();
var
crm_case_order_list
=
ApiServices
.
CrmCaseOrder
(
orders
);
var
crm_case_message_list
=
ApiServices
.
CrmMessage
(
orders
);
var
crm_case_message_reply_list
=
ApiServices
.
CrmMessageReply
(
orders
);
foreach
(
var
item
in
datas
)
{
item
.
crm_case_count
=
crm_case_order_list
.
Where
(
s
=>
item
.
platform_type
.
Equals
(
s
.
platform_type
)
&&
(
(
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
transaction_id
.
Equals
(
s
.
order_no
))
||
(!
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
origin_order_id
.
Equals
(
s
.
order_no
))
)
).
Count
();
item
.
crm_message_count
=
crm_case_message_list
.
Where
(
s
=>
item
.
platform_type
.
Equals
(
s
.
platform_type
)
&&
(
(
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
transaction_id
.
Equals
(
s
.
order_no
))
||
(!
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
origin_order_id
.
Equals
(
s
.
order_no
))
)
).
Count
();
item
.
crm_message_reply_count
=
crm_case_message_reply_list
.
Where
(
s
=>
item
.
platform_type
.
Equals
(
s
.
platform_type
)
&&
(
(
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
transaction_id
.
Equals
(
s
.
order_no
))
||
(!
"ebay"
.
Equals
(
item
.
platform_type
)
&&
item
.
origin_order_id
.
Equals
(
s
.
order_no
))
)
).
Count
();
}
}
return
datas
;
}
public
List
<
out_stock_dto
>
OutStockList
(
out_stock_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
...
...
@@ -326,5 +361,20 @@ namespace AutoTurnOver.Services
return
report
.
OutStockList
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
}
public
List
<
return_speed_change_dto
>
ReturnSpeedChange
(
return_speed_change_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
return
report
.
ReturnSpeedChange
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
}
/// <summary>
/// 标记回货
/// </summary>
/// <param name="m"></param>
public
int
MarkReturnSpeedChange
(
return_speed_change_search_dto
m
)
{
return
report
.
MarkReturnSpeedChange
(
m
);
}
}
}
AutoTurnOver.Utility/RedisConsts.cs
View file @
a2ea0329
...
...
@@ -7,5 +7,7 @@ namespace AutoTurnOver.Utility
public
class
RedisConsts
{
public
static
string
Pams_GetAccountToken
=
"Pams_GetAccountToken"
;
public
static
string
Lms_GetLogistics
=
"Lms_GetLogistics"
;
public
static
string
Pams_PlatformList
=
"Pams_PlatformList"
;
}
}
AutoTurnOver/Controllers/CommonController.cs
View file @
a2ea0329
...
...
@@ -106,6 +106,42 @@ namespace AutoTurnOver.Controllers
}
public
JsonResult
ShipLogisticsList
(
string
name
)
{
try
{
var
list
=
ApiServices
.
ShipLogisticsList
(
name
);
return
new
JsonResult
(
list
.
Select
(
p
=>
new
{
id
=
p
.
Line_Code
,
text
=
p
.
Line_Code
+
" - "
+
p
.
Line_Name
}));
}
catch
(
Exception
ex
)
{
throw
;
}
}
public
JsonResult
PlatformList
()
{
var
datas
=
ApiServices
.
PlatformList
();
return
new
JsonResult
(
datas
);
}
/// <summary>
/// crm 自定义出信模板
/// </summary>
/// <returns></returns>
public
JsonResult
MessageCustomTemplateList
()
{
var
datas
=
ApiServices
.
PlatformList
();
return
new
JsonResult
(
datas
);
}
...
...
AutoTurnOver/Controllers/ReportsController.cs
View file @
a2ea0329
This diff is collapsed.
Click to expand it.
AutoTurnOver/appsettings.json
View file @
a2ea0329
...
...
@@ -18,5 +18,12 @@
"Password"
:
"SpaceHorse1"
,
"Defaultdatabase"
:
0
},
"SaveDefaultWares"
:
"http://api.skums.bailuntec.com/api/sku/productware/savedefaultwares"
"SaveDefaultWares"
:
"http://api.skums.bailuntec.com/api/sku/productware/savedefaultwares"
,
"Crm_Case_Order"
:
"http://crm.bailuntec.com/api/CaseOrderList"
,
"Crm_Message"
:
"http://crm.bailuntec.com/api/MessageList"
,
"Crm_Message_Reply"
:
"http://crm.bailuntec.com/api/MessageReplyList"
,
"Lms_GetLogistics"
:
"http://lms.bailuntec.com/api/DataInfo/ApiLogistics/GetLogistics"
,
"Pams_PlatformList"
:
"http://pams.bailuntec.com/Api/GetPlatformSites?type=1"
,
"Crm_Message_Custom_Template"
:
"http://crm.bailuntec.com/api/MessageCustomTemplateList"
}
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