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
d676272b
Commit
d676272b
authored
Oct 31, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分类汇总新增导出
parent
61a5e1c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
0 deletions
+78
-0
ReportServices.cs
AutoTurnOver.Services/ReportServices.cs
+66
-0
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+12
-0
No files found.
AutoTurnOver.Services/ReportServices.cs
View file @
d676272b
...
@@ -577,5 +577,71 @@ namespace AutoTurnOver.Services
...
@@ -577,5 +577,71 @@ namespace AutoTurnOver.Services
}
}
public
MemoryStream
GetGoodsExport
(
bailun_sku_goods_search_dto
search_data
,
UserData
user
)
{
try
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"Result\RealtimeStock\
{
user
.
UserAccount
}
商品汇总-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}
.csv"
;
var
total
=
0
;
var
list
=
GetGoods
(
search_data
,
0
,
int
.
MaxValue
,
ref
total
);
// 查询站点,组织列头
var
web_sites
=
ApiServices
.
PlatformtypeWebsiteList
(
search_data
.
platform_type
);
if
(
list
==
null
||
list
.
Count
<=
0
)
return
null
;
DataTable
table
=
new
DataTable
();
List
<
string
>
cols
=
new
List
<
string
>()
{
"内部商品编码"
,
"分类"
,
"产品名称"
};
foreach
(
var
item
in
web_sites
)
{
cols
.
Add
(
$"
{
item
.
platform_type
}
-
{
item
.
website
}
-昨日销量"
);
cols
.
Add
(
$"
{
item
.
platform_type
}
-
{
item
.
website
}
-近7天日均销量"
);
cols
.
Add
(
$"
{
item
.
platform_type
}
-
{
item
.
website
}
-昨日销售额"
);
cols
.
Add
(
$"
{
item
.
platform_type
}
-
{
item
.
website
}
-近7天总销售额"
);
}
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"内部商品编码"
]
=
itemData
.
product_inner_code
;
row
[
"分类"
]
=
itemData
.
bailun_category_name
;
row
[
"产品名称"
]
=
itemData
.
sku_title_cn
;
foreach
(
var
dat_item
in
web_sites
)
{
row
[(
$"
{
dat_item
.
platform_type
}
-
{
dat_item
.
website
}
-昨日销量"
)]
=
itemData
[
"yesterday_count_"
+
(
dat_item
.
platform_type
+
"-"
+
dat_item
.
website
)];
row
[(
$"
{
dat_item
.
platform_type
}
-
{
dat_item
.
website
}
-近7天日均销量"
)]
=
itemData
[
"yesterday_average_7_"
+
(
dat_item
.
platform_type
+
"-"
+
dat_item
.
website
)];
row
[(
$"
{
dat_item
.
platform_type
}
-
{
dat_item
.
website
}
-昨日销售额"
)]
=
itemData
[
"yesterday_amount_"
+
(
dat_item
.
platform_type
+
"-"
+
dat_item
.
website
)];
row
[(
$"
{
dat_item
.
platform_type
}
-
{
dat_item
.
website
}
-近7天总销售额"
)]
=
itemData
[
"amount_7_"
+
(
dat_item
.
platform_type
+
"-"
+
dat_item
.
website
)];
}
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
,
true
);
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
stream
.
CopyTo
(
memory
);
}
memory
.
Position
=
0
;
return
memory
;
}
catch
(
Exception
)
{
throw
;
}
}
}
}
}
}
AutoTurnOver/Controllers/ReportsController.cs
View file @
d676272b
...
@@ -718,6 +718,18 @@ namespace AutoTurnOver.Controllers
...
@@ -718,6 +718,18 @@ namespace AutoTurnOver.Controllers
});
});
}
}
public
FileResult
GetGoodsExport
(
string
product_inner_code
,
string
platform_type
)
{
var
user
=
AutoUtility
.
GetUser
();
var
m
=
new
bailun_sku_goods_search_dto
{
product_inner_code
=
product_inner_code
,
platform_type
=
platform_type
};
var
memory
=
new
ReportServices
().
GetGoodsExport
(
m
,
user
);
return
File
(
memory
,
"text/csv"
,
$"
{
user
.
UserAccount
}
商品汇总数据信息.csv"
);
}
public
JsonResult
GetGoodsSumFooter
(
string
product_inner_code
,
string
platform_type
)
public
JsonResult
GetGoodsSumFooter
(
string
product_inner_code
,
string
platform_type
)
{
{
...
...
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