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
7ab2265e
Commit
7ab2265e
authored
Dec 28, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4076d690
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
15 deletions
+69
-15
dc_auto_shortage_push_route_dto.cs
AutoTurnOver.Models/dc_auto_shortage_push_route_dto.cs
+22
-0
DailyServices.cs
AutoTurnOver.Services/DailyServices.cs
+11
-11
TaskDownloadServices.cs
AutoTurnOver.Services/TaskDownloadServices.cs
+17
-0
DailyController.cs
AutoTurnOver/Controllers/DailyController.cs
+19
-4
No files found.
AutoTurnOver.Models/dc_auto_shortage_push_route_dto.cs
View file @
7ab2265e
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Text
;
namespace
AutoTurnOver.Models
...
...
@@ -17,4 +18,25 @@ namespace AutoTurnOver.Models
public
DateTime
push_date
{
get
;
set
;
}
public
DateTime
?
push_time
{
get
;
set
;
}
}
public
class
export_sortage_push_search_dto
{
[
Description
(
"平台"
)]
public
string
platform
{
get
;
set
;
}
[
Description
(
"SKU"
)]
public
string
bailun_sku
{
get
;
set
;
}
[
Description
(
"结束时间"
)]
public
DateTime
?
end_date
{
get
;
set
;
}
[
Description
(
"开始时间"
)]
public
DateTime
?
start_date
{
get
;
set
;
}
[
Description
(
"仓库编码"
)]
public
string
warehousecode
{
get
;
set
;
}
[
Description
(
"仓库类型"
)]
public
string
warehousetype
{
get
;
set
;
}
[
Description
(
"仓库国家"
)]
public
int
?
warehousearea
{
get
;
set
;
}
}
}
AutoTurnOver.Services/DailyServices.cs
View file @
7ab2265e
...
...
@@ -59,18 +59,18 @@ namespace AutoTurnOver.Services
return
DB
.
daily
.
TaskDownloadList
(
user_name
,
task_name
,
offset
,
limit
,
ref
total
,
start_date
,
end_date
);
}
public
MemoryStream
ExportShortagePush
(
string
platform
,
string
bailun_sku
,
DateTime
?
start_date
,
DateTime
?
end_date
,
UserData
user
,
string
warehousecode
,
string
warehousetype
,
int
?
warehouseare
a
)
public
string
ExportShortagePush
(
export_sortage_push_search_dto
searchDat
a
)
{
try
{
var
fileName
=
AppContext
.
BaseDirectory
+
$@"
Result\RealtimeStock\
{
user
.
UserAccount
}
修改在线数量日志-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}
.csv"
;
var
fileName
=
AppContext
.
BaseDirectory
+
$@"
改在线数据-
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmss"
)}{
Guid
.
NewGuid
(
)}
.csv"
;
int
page
=
1
;
int
rows
=
50000
;
while
(
true
)
{
int
total
=
0
;
var
list
=
ShortagePushList
(
platform
,
bailun_sku
,
(
page
-
1
)*
rows
,
rows
,
ref
total
,
start_date
,
end_date
,
warehousecode
,
warehousetype
,
warehousearea
);
var
list
=
ShortagePushList
(
searchData
.
platform
,
searchData
.
bailun_sku
,
(
page
-
1
)*
rows
,
rows
,
ref
total
,
searchData
.
start_date
,
searchData
.
end_date
,
searchData
.
warehousecode
,
searchData
.
warehousetype
,
searchData
.
warehousearea
);
if
(
list
==
null
||
list
.
Count
<=
0
)
break
;
...
...
@@ -98,14 +98,14 @@ namespace AutoTurnOver.Services
}
var
memory
=
new
MemoryStream
();
using
(
var
stream
=
new
FileStream
(
fileName
,
FileMode
.
Open
))
{
stream
.
CopyTo
(
memory
);
}
memory
.
Position
=
0
;
return
memory
;
return
fileName
;
//
var memory = new MemoryStream();
//
using (var stream = new FileStream(fileName, FileMode.Open))
//
{
//
stream.CopyTo(memory);
//
}
//
memory.Position = 0;
//
return memory;
}
catch
(
Exception
)
{
...
...
AutoTurnOver.Services/TaskDownloadServices.cs
View file @
7ab2265e
...
...
@@ -39,6 +39,9 @@ namespace AutoTurnOver.Services
break
;
case
"周转表"
:
item
.
result_file_url
=
await
DownloadAuto
(
item
.
parameter
,
item
);
break
;
case
"改在线记录"
:
item
.
result_file_url
=
await
DownloadShortagePush
(
item
.
parameter
,
item
);
break
;
default
:
throw
new
Exception
(
"无法识别的任务"
);
}
...
...
@@ -60,6 +63,20 @@ namespace AutoTurnOver.Services
/// <summary>
/// 下载改在线记录
/// </summary>
public
async
Task
<
string
>
DownloadShortagePush
(
string
par_json
,
dc_task_download
download_data
)
{
export_sortage_push_search_dto
search_data
=
par_json
.
ToObject
<
export_sortage_push_search_dto
>();
Console
.
WriteLine
(
"DownloadStock - 开始生成文件"
);
var
memory
=
new
DailyServices
().
ExportShortagePush
(
search_data
);
Console
.
WriteLine
(
"DownloadStock - 开始生成上传文件"
);
var
fileData
=
await
AutoTurnOver
.
Utility
.
QiNiuCloudHelper
.
UploadSectioningAsync
(
memory
);
Console
.
WriteLine
(
"DownloadStock - 上传完毕"
);
return
fileData
;
}
/// <summary>
/// 下载库存
/// </summary>
public
async
Task
<
string
>
DownloadStock
(
string
par_json
,
dc_task_download
download_data
)
...
...
AutoTurnOver/Controllers/DailyController.cs
View file @
7ab2265e
...
...
@@ -166,11 +166,26 @@ namespace AutoTurnOver.Controllers
}
}
public
FileResult
ExportShortagePush
(
string
platform
,
string
bailun_sku
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousecode
,
string
warehousetype
,
int
?
warehouseare
a
)
public
JsonResult
ExportShortagePush
([
FromQuery
]
export_sortage_push_search_dto
search_dat
a
)
{
var
user
=
AutoUtility
.
GetUser
();
var
memory
=
new
DailyServices
().
ExportShortagePush
(
platform
,
bailun_sku
,
start_date
,
end_date
,
AutoUtility
.
GetUser
(),
warehousecode
,
warehousetype
,
warehousearea
);
return
File
(
memory
,
"text/csv"
,
$"
{
user
.
UserAccount
}
修改在线数量日志.csv"
);
try
{
var
user
=
AutoUtility
.
GetUser
();
dc_task_download_dao
.
PushData
<
dc_base_stock_search_dto
>(
new
dc_task_download
{
parameter
=
search_data
.
ToJson
(),
task_name
=
"改在线记录"
},
user
);
return
new
JsonResult
(
new
{
success
=
true
});
}
catch
(
Exception
ex
)
{
return
new
JsonResult
(
new
{
success
=
false
,
message
=
ex
.
Message
});
}
//var user = AutoUtility.GetUser();
//var memory = new DailyServices().ExportShortagePush(searchData, user);
//return File(memory, "text/csv", $"{user.UserAccount}修改在线数量日志.csv");
}
/// <summary>
...
...
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