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
9a0fffe8
Commit
9a0fffe8
authored
Feb 14, 2023
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增新现金流sku ,导出服务
parent
8edb112f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
88 additions
and
2 deletions
+88
-2
dc_ana_deviation_dao.cs
AutoTurnOver.DB/dc_ana_deviation_dao.cs
+2
-2
DeviationServices.cs
AutoTurnOver.Services/DeviationServices.cs
+52
-0
TaskDownloadServices.cs
AutoTurnOver.Services/TaskDownloadServices.cs
+18
-0
DeviationController.cs
AutoTurnOver/Controllers/DeviationController.cs
+16
-0
No files found.
AutoTurnOver.DB/dc_ana_deviation_dao.cs
View file @
9a0fffe8
...
...
@@ -365,8 +365,8 @@ namespace AutoTurnOver.DB
var
viewDatas
=
new
List
<
deviation_view_dto
>()
{
};
var
year
=
DateTime
.
Now
.
Year
;
var
allDatas
=
datas
.
GroupBy
(
s
=>
new
{
s
.
sku
,
s
.
project
,
s
.
field_type
,
s
.
field
}).
OrderByDescending
(
s
=>
s
.
Key
).
OrderBy
(
s
=>
s
.
Key
.
field_type
).
OrderBy
(
s
=>
s
.
Key
.
project
).
OrderBy
(
s
=>
s
.
Key
.
sku
);
var
pageDatas
=
allDatas
.
Take
(
limit
).
Skip
(
offse
t
).
ToList
();
var
allDatas
=
datas
.
GroupBy
(
s
=>
new
{
s
.
sku
,
s
.
project
,
s
.
field_type
,
s
.
field
}).
OrderByDescending
(
s
=>
s
.
Key
.
field
).
OrderByDescending
(
s
=>
s
.
Key
.
field_type
).
OrderBy
(
s
=>
s
.
Key
.
project
).
OrderBy
(
s
=>
s
.
Key
.
sku
).
ToList
(
);
var
pageDatas
=
allDatas
.
Skip
(
offset
).
Take
(
limi
t
).
ToList
();
foreach
(
var
item
in
pageDatas
)
{
deviation_view_dto
itemData
=
new
deviation_view_dto
()
...
...
AutoTurnOver.Services/DeviationServices.cs
View file @
9a0fffe8
using
AutoTurnOver.DB
;
using
AutoTurnOver.Models
;
using
AutoTurnOver.Utility
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
namespace
AutoTurnOver.Services
...
...
@@ -29,5 +32,54 @@ namespace AutoTurnOver.Services
{
return
dc_ana_deviation_dao
.
GetProjects
();
}
internal
string
SkuExport
(
deviation_search_dto
search_data
,
out
int
rows
)
{
try
{
var
services
=
new
DailyServices
();
var
fileName
=
AppContext
.
BaseDirectory
+
$@"新现金流报表(sku)-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
()}
.csv"
;
DataTable
table
=
new
DataTable
();
var
dateYear
=
DateTime
.
Now
.
Year
;
List
<
string
>
cols
=
new
List
<
string
>
{
"数据类型"
,
"字段"
,
"sku"
,
$"
{
dateYear
}
-01"
,
$"
{
dateYear
}
-02"
,
$"
{
dateYear
}
-03"
,
$"
{
dateYear
}
-04"
,
$"
{
dateYear
}
-05"
,
$"
{
dateYear
}
-06"
,
$"
{
dateYear
}
-07"
,
$"
{
dateYear
}
-08"
,
$"
{
dateYear
}
-09"
,
$"
{
dateYear
}
-10"
,
$"
{
dateYear
}
-11"
,
$"
{
dateYear
}
-12"
};
foreach
(
var
item
in
cols
)
{
table
.
Columns
.
Add
(
item
);
}
int
total
=
0
;
var
findDataList
=
DB
.
dc_ana_deviation_dao
.
GetSkuViews
(
search_data
,
0
,
int
.
MaxValue
,
ref
total
,
""
,
""
);
rows
=
findDataList
.
Count
();
foreach
(
var
itemData
in
findDataList
)
{
DataRow
row
=
table
.
NewRow
();
row
[
"数据类型"
]
=
itemData
.
field_type
;
row
[
"字段"
]
=
itemData
.
field
;
row
[
"sku"
]
=
itemData
.
group_key
;
row
[
$"
{
dateYear
}
-01"
]
=
itemData
.
month1
;
row
[
$"
{
dateYear
}
-02"
]
=
itemData
.
month2
;
row
[
$"
{
dateYear
}
-03"
]
=
itemData
.
month3
;
row
[
$"
{
dateYear
}
-04"
]
=
itemData
.
month4
;
row
[
$"
{
dateYear
}
-05"
]
=
itemData
.
month5
;
row
[
$"
{
dateYear
}
-06"
]
=
itemData
.
month6
;
row
[
$"
{
dateYear
}
-07"
]
=
itemData
.
month7
;
row
[
$"
{
dateYear
}
-08"
]
=
itemData
.
month8
;
row
[
$"
{
dateYear
}
-09"
]
=
itemData
.
month9
;
row
[
$"
{
dateYear
}
-10"
]
=
itemData
.
month10
;
row
[
$"
{
dateYear
}
-11"
]
=
itemData
.
month11
;
row
[
$"
{
dateYear
}
-12"
]
=
itemData
.
month12
;
table
.
Rows
.
Add
(
row
);
}
CsvFileHelper
.
SaveCSV
(
table
,
fileName
);
return
fileName
;
}
catch
(
Exception
)
{
throw
;
}
}
}
}
AutoTurnOver.Services/TaskDownloadServices.cs
View file @
9a0fffe8
...
...
@@ -86,6 +86,9 @@ namespace AutoTurnOver.Services
case
"快速导出实时库存"
:
item
.
result_file_url
=
await
DownloadQuickExportStock
(
item
.
parameter
,
item
);
break
;
case
"新现金流报表(sku)"
:
item
.
result_file_url
=
await
DownloadDeviationSkuExport
(
item
.
parameter
,
item
);
break
;
default
:
throw
new
Exception
(
"无法识别的任务"
);
}
item
.
end_date
=
DateTime
.
Now
;
...
...
@@ -405,6 +408,21 @@ namespace AutoTurnOver.Services
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
/// <summary>
/// 下载快速导出库存
/// </summary>
public
async
Task
<
string
>
DownloadDeviationSkuExport
(
string
par_json
,
dc_task_download
download_data
)
{
var
rows
=
0
;
deviation_search_dto
search_data
=
par_json
.
ToObject
<
deviation_search_dto
>();
Console
.
WriteLine
(
"DownloadStock - 开始生成文件"
);
var
memory
=
new
DeviationServices
().
SkuExport
(
search_data
,
out
rows
);
download_data
.
rows
=
rows
;
Console
.
WriteLine
(
"DownloadStock - 开始生成上传文件"
);
var
fileData
=
await
AutoTurnOver
.
Utility
.
QiNiuCloudHelper
.
UploadSectioningAsync
(
memory
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
}
}
AutoTurnOver/Controllers/DeviationController.cs
View file @
9a0fffe8
...
...
@@ -54,5 +54,20 @@ namespace AutoTurnOver.Controllers
{
return
new
JsonResult
(
new
DeviationServices
().
GetProjects
().
Select
(
s
=>
new
{
Name
=
s
}));
}
public
ActionResult
GetSkuViewsExport
([
FromForm
]
deviation_search_dto
m
)
{
var
user
=
AutoUtility
.
GetUser
();
dc_task_download_dao
.
PushData
<
deviation_search_dto
>(
new
dc_task_download
{
parameter
=
m
.
ToJson
(),
task_name
=
"新现金流报表(sku)"
},
user
);
return
new
JsonResult
(
new
{
success
=
true
});
}
}
}
\ 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