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
dc26554a
Commit
dc26554a
authored
Feb 20, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
99275a56
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
174 additions
and
1 deletion
+174
-1
report.cs
AutoTurnOver.DB/report.cs
+55
-0
dc_report_goods.cs
AutoTurnOver.Models/dc_report_goods.cs
+18
-0
ReportServices.cs
AutoTurnOver.Services/ReportServices.cs
+50
-0
SkuAutoTurnServices.cs
AutoTurnOver.Services/SkuAutoTurnServices.cs
+1
-1
ReportsController.cs
AutoTurnOver/Controllers/ReportsController.cs
+50
-0
No files found.
AutoTurnOver.DB/report.cs
View file @
dc26554a
...
@@ -4369,5 +4369,60 @@ where (t1.gmt_purchase_modified>=@start_time and t1.gmt_purchase_modified<=@end_
...
@@ -4369,5 +4369,60 @@ where (t1.gmt_purchase_modified>=@start_time and t1.gmt_purchase_modified<=@end_
conn
.
Update
(
new_task_synchro_log
);
conn
.
Update
(
new_task_synchro_log
);
}
}
/// <summary>
/// 查询商品报表数据
/// </summary>
/// <param name="searchData"></param>
/// <param name="offset"></param>
/// <param name="limit"></param>
/// <param name="total"></param>
/// <returns></returns>
public
static
List
<
dc_report_goods
>
GetReportGoodsPage
(
dc_report_goods_search_dto
searchData
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
var
sql
=
" select * from dc_report_goods as t1 left join dc_base_warehouse as t2 on t1.warehouse_code=t2.warehouse_code where 1=1 "
;
var
countSql
=
" select count(1) from dc_report_goods as t1 left join dc_base_warehouse as t2 on t1.warehouse_code=t2.warehouse_code where 1=1 "
;
DynamicParameters
parameters
=
new
DynamicParameters
();
if
(!
string
.
IsNullOrWhiteSpace
(
searchData
.
product_code
))
{
sql
+=
" and t1.product_code=@product_code "
;
countSql
+=
" and t1.product_code=@product_code "
;
parameters
.
Add
(
"product_code"
,
searchData
.
product_code
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
searchData
.
warehouse_code
))
{
sql
+=
" and t1.warehouse_code=@warehouse_code "
;
countSql
+=
" and t1.warehouse_code=@warehouse_code "
;
parameters
.
Add
(
"warehouse_code"
,
searchData
.
warehouse_code
);
}
if
(
searchData
.
warehousearea
>
0
)
{
sql
+=
" and t2.area_id=@area_id "
;
countSql
+=
" and t2.area_id=@area_id "
;
parameters
.
Add
(
"area_id"
,
searchData
.
warehousearea
);
}
if
(!
string
.
IsNullOrWhiteSpace
(
searchData
.
warehousetype
))
{
sql
+=
" and t2.hq_type=@warehousetype "
;
countSql
+=
" and t2.hq_type=@warehousetype "
;
parameters
.
Add
(
"warehousetype"
,
searchData
.
warehousetype
);
}
if
(!
string
.
IsNullOrEmpty
(
sort
))
{
sql
+=
" order by "
+
sort
;
if
(!
string
.
IsNullOrEmpty
(
order
))
{
sql
+=
" "
+
order
;
}
else
{
sql
+=
" asc"
;
}
}
sql
+=
" limit "
+
offset
+
","
+
limit
;
total
=
_connection
.
QueryFirstOrDefault
<
int
>(
countSql
,
parameters
);
return
_connection
.
Query
<
dc_report_goods
>(
sql
,
parameters
).
AsList
();
}
}
}
}
}
...
...
AutoTurnOver.Models/dc_report_goods.cs
View file @
dc26554a
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Text
;
using
System.Text
;
namespace
AutoTurnOver.Models
namespace
AutoTurnOver.Models
...
@@ -35,4 +36,21 @@ namespace AutoTurnOver.Models
...
@@ -35,4 +36,21 @@ namespace AutoTurnOver.Models
{
{
}
}
public
class
dc_report_goods_search_dto
{
[
Description
(
"商品编码"
)]
public
string
product_code
{
get
;
set
;
}
[
Description
(
"仓库类型"
)]
public
string
warehousetype
{
get
;
set
;
}
[
Description
(
"仓库国家"
)]
public
int
?
warehousearea
{
get
;
set
;
}
/// <summary>
/// 仓库编码
/// </summary>
[
Description
(
"仓库编码"
)]
public
string
warehouse_code
{
get
;
set
;
}
}
}
}
AutoTurnOver.Services/ReportServices.cs
View file @
dc26554a
...
@@ -1036,5 +1036,55 @@ namespace AutoTurnOver.Services
...
@@ -1036,5 +1036,55 @@ namespace AutoTurnOver.Services
{
{
return
report
.
GetProductTypeList
();
return
report
.
GetProductTypeList
();
}
}
public
List
<
dc_report_goods
>
GetReportGoodsPage
(
dc_report_goods_search_dto
m
,
int
offset
,
int
limit
,
ref
int
total
,
string
order
=
""
,
string
sort
=
""
)
{
return
report
.
GetReportGoodsPage
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
}
public
string
ReportGoodsExport
(
dc_report_goods_search_dto
m
,
string
order
,
string
sort
)
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"商品销量报表(仓库维度)-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
var
total
=
0
;
int
page
=
1
;
int
rows
=
250000
;
while
(
true
)
{
var
list
=
GetReportGoodsPage
(
m
,
(
page
-
1
)
*
rows
,
rows
,
ref
total
,
order
,
sort
);
if
(
list
==
null
||
list
.
Count
<=
0
)
break
;
DataTable
table
=
new
DataTable
();
string
[]
cols
=
new
string
[]
{
"Sku"
,
"商品编码"
,
"内部编码"
,
"sku标题"
,
"仓库编码"
,
"仓库名称"
,
"仓库所在国家"
,
"MOQ"
,
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
foreach
(
var
itemData
in
list
)
{
DataRow
row
=
table
.
NewRow
();
//row["计算时间"] = itemData.gmt_modified.ToString("yyyy-MM-dd");
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
,
page
==
1
);
page
++;
}
//var memory = new MemoryStream();
//using (var stream = new FileStream(fileName, FileMode.Open))
//{
// stream.CopyTo(memory);
//}
//memory.Position = 0;
//return memory;
return
fileName
;
}
}
}
}
}
AutoTurnOver.Services/SkuAutoTurnServices.cs
View file @
dc26554a
...
@@ -474,7 +474,7 @@ namespace AutoTurnOver.Services
...
@@ -474,7 +474,7 @@ namespace AutoTurnOver.Services
table
.
Rows
.
Add
(
row
);
table
.
Rows
.
Add
(
row
);
}
}
EPPlusHelper
.
ExportExcel
(
table
,
fileName
);
CsvFileHelper
.
SaveCSV
(
table
,
fileName
);
return
fileName
;
return
fileName
;
}
}
...
...
AutoTurnOver/Controllers/ReportsController.cs
View file @
dc26554a
...
@@ -1210,6 +1210,7 @@ namespace AutoTurnOver.Controllers
...
@@ -1210,6 +1210,7 @@ namespace AutoTurnOver.Controllers
//var fileData = await QiNiuCloudHelper.UploadAsync(memory, $"商品销售情况统计{user.UserName}-{DateTime.Now.ToString("yyyyMMddHHmmss")}导入结果.csv");
//var fileData = await QiNiuCloudHelper.UploadAsync(memory, $"商品销售情况统计{user.UserName}-{DateTime.Now.ToString("yyyyMMddHHmmss")}导入结果.csv");
//return File(memory, "text/csv", $"{user.UserAccount}商品汇总数据信息.csv");
//return File(memory, "text/csv", $"{user.UserAccount}商品汇总数据信息.csv");
}
}
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【报表】->【商品销售情况统计】->【搜索】页面"
,
0
)]
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【报表】->【商品销售情况统计】->【搜索】页面"
,
0
)]
public
JsonResult
GetGoodsSumFooter
(
string
product_inner_code
,
string
platform_type
)
public
JsonResult
GetGoodsSumFooter
(
string
product_inner_code
,
string
platform_type
)
{
{
...
@@ -1383,5 +1384,53 @@ namespace AutoTurnOver.Controllers
...
@@ -1383,5 +1384,53 @@ namespace AutoTurnOver.Controllers
return
new
JsonResult
(
result
);
return
new
JsonResult
(
result
);
}
}
[
HttpGet
]
[
BrowseLog
(
"Bailun_aims"
,
"触发【百伦自动周转系统】->【报表】->【商品销量报表】->【搜索】页面"
,
0
)]
public
JsonResult
GetReportGoodsPage
([
FromQuery
]
dc_report_goods_search_dto
m
,
[
FromQuery
]
int
offset
,
[
FromQuery
]
int
limit
,
[
FromQuery
]
string
order
,
[
FromQuery
]
string
sort
)
{
try
{
var
total
=
0
;
var
service
=
new
Services
.
ReportServices
();
var
list
=
service
.
GetReportGoodsPage
(
m
,
offset
,
limit
,
ref
total
,
order
,
sort
);
return
new
JsonResult
(
new
{
rows
=
list
,
total
=
total
,
pagecount
=
(
total
/
limit
+
(
total
%
limit
>
0
?
1
:
0
))
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
message
=
ex
.
Message
,
stack_trace
=
ex
.
StackTrace
});
}
}
public
ActionResult
GetReportGoodsExport
([
FromQuery
]
dc_report_goods_search_dto
m
,
[
FromQuery
]
int
offset
,
[
FromQuery
]
int
limit
,
[
FromQuery
]
string
order
,
[
FromQuery
]
string
sort
)
{
try
{
var
user
=
AutoUtility
.
GetUser
();
dc_task_download_dao
.
PushData
<
dc_report_goods_search_dto
>(
new
dc_task_download
{
parameter
=
m
.
ToJson
(),
task_name
=
"商品销量报表(仓库维度)"
},
user
);
return
new
JsonResult
(
new
{
success
=
true
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
});
}
}
}
}
}
}
\ No newline at end of file
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