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
85aa6434
Commit
85aa6434
authored
Sep 10, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品汇总,仓库维度。导出
parent
a1c0ca7d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
ReportServices.cs
AutoTurnOver.Services/ReportServices.cs
+2
-0
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+73
-0
No files found.
AutoTurnOver.Services/ReportServices.cs
View file @
85aa6434
...
@@ -646,7 +646,9 @@ namespace AutoTurnOver.Services
...
@@ -646,7 +646,9 @@ namespace AutoTurnOver.Services
{
{
var
dic
=
(
IDictionary
<
string
,
object
>)
o
;
var
dic
=
(
IDictionary
<
string
,
object
>)
o
;
dic
[
"count_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
count
,
2
),
year
=
dat_item
.
year
,
month
=
dat_item
.
month
,
day
=
dat_item
.
day
};
dic
[
"count_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
new
{
val
=
Math
.
Round
(
dat_item
.
count
,
2
),
year
=
dat_item
.
year
,
month
=
dat_item
.
month
,
day
=
dat_item
.
day
};
dic
[
"v_count_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
Math
.
Round
(
dat_item
.
count
,
2
);
dic
[
"sum_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
Math
.
Round
(
dat_item
.
sum
,
2
);
dic
[
"sum_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
Math
.
Round
(
dat_item
.
sum
,
2
);
dic
[
"v_sum_"
+
(
dat_item
.
month
+
"-"
+
dat_item
.
day
)]
=
Math
.
Round
(
dat_item
.
sum
,
2
);
}
}
datas
.
Add
(
o
);
datas
.
Add
(
o
);
...
...
AutoTurnOver/Controllers/ReportsController.cs
View file @
85aa6434
...
@@ -664,6 +664,79 @@ namespace AutoTurnOver.Controllers
...
@@ -664,6 +664,79 @@ namespace AutoTurnOver.Controllers
});
});
}
}
public
FileResult
ExportTableSkuWarehouse
(
string
platform_type
,
string
warehousetype
,
int
?
warehousearea
,
string
warehousecode
,
DateTime
?
btime
,
DateTime
?
etime
)
{
bailun_sku_website_sales_search_dto
search_data
=
new
bailun_sku_website_sales_search_dto
{
platform_type
=
platform_type
,
warehousetype
=
warehousetype
,
etime
=
etime
,
btime
=
btime
,
warehousearea
=
warehousearea
,
warehouse_code
=
warehousecode
};
var
e_btime
=
DateTime
.
Now
.
AddDays
(-
8
).
ToDayHome
();
var
e_etime
=
DateTime
.
Now
.
AddDays
(-
1
).
ToDayEnd
();
if
(
search_data
.
btime
!=
null
)
{
e_btime
=
search_data
.
btime
.
Value
.
ToDayHome
();
}
if
(
search_data
.
etime
!=
null
)
{
e_etime
=
search_data
.
etime
.
Value
.
ToDayEnd
();
}
var
list
=
new
ReportServices
().
GetSkuWarehouseSales
(
search_data
);
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"分类"
,
"仓库"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
var
col_this_date
=
e_etime
;
while
(
col_this_date
.
ToDayHome
()
>
e_btime
.
ToDayHome
())
{
table
.
Columns
.
Add
(
$"
{
col_this_date
.
ToString
(
"MM-dd"
)}
-销量"
);
table
.
Columns
.
Add
(
$"
{
col_this_date
.
ToString
(
"MM-dd"
)}
-销售额"
);
col_this_date
=
col_this_date
.
AddDays
(-
1
);
}
foreach
(
var
itemDataD
in
list
)
{
DataRow
row
=
table
.
NewRow
();
var
itemData
=
(
IDictionary
<
string
,
object
>)
itemDataD
;
row
[
"分类"
]
=
itemData
[
"label"
];
row
[
"仓库"
]
=
itemData
[
"warehouse_name"
];
var
row_this_date
=
e_etime
;
while
(
row_this_date
.
ToDayHome
()
>
e_btime
.
ToDayHome
())
{
row
[
$"
{
row_this_date
.
ToString
(
"MM-dd"
)}
-销量"
]
=
itemData
[
"v_count_"
+
$"
{
row_this_date
.
Month
}
-
{
row_this_date
.
Day
}
"
];
row
[
$"
{
row_this_date
.
ToString
(
"MM-dd"
)}
-销售额"
]
=
itemData
[
"v_sum_"
+
$"
{
row_this_date
.
Month
}
-
{
row_this_date
.
Day
}
"
];
row_this_date
=
row_this_date
.
AddDays
(-
1
);
}
table
.
Rows
.
Add
(
row
);
}
var
fileName
=
AppContext
.
BaseDirectory
+
@"Result\RealtimeStock\商品汇总_仓库.csv"
;
DataTableHelper
.
SaveCSV
(
table
,
fileName
);
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
stream
.
CopyTo
(
memory
);
}
memory
.
Position
=
0
;
return
File
(
memory
,
"text/csv"
,
"商品汇总_仓库.csv"
);
}
public
FileResult
SkuWebsiteSalesExport
(
string
platform_type
,
string
label
,
string
website
,
string
warehouse_code
,
int
?
year
,
int
?
month
,
int
?
day
)
public
FileResult
SkuWebsiteSalesExport
(
string
platform_type
,
string
label
,
string
website
,
string
warehouse_code
,
int
?
year
,
int
?
month
,
int
?
day
)
{
{
var
user
=
AutoUtility
.
GetUser
();
var
user
=
AutoUtility
.
GetUser
();
...
...
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