Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
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
DataCenter_Core2.1_20190520
Commits
49e82627
Commit
49e82627
authored
Aug 16, 2021
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传物流流水调整为分片上传
parent
20ab0b02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
13 deletions
+80
-13
UploadFileServices.cs
Bailun.DC.Services/DataWareHouse/UploadFileServices.cs
+41
-0
List.cshtml
...un.DC.Web/Areas/DataWareHouse/Views/Logistics/List.cshtml
+36
-10
OrderBillings.cshtml
...as/DataWareHouse/Views/PlatformOrder/OrderBillings.cshtml
+1
-1
BaseController.cs
Bailun.DC.Web/Base/BaseController.cs
+2
-2
No files found.
Bailun.DC.Services/DataWareHouse/UploadFileServices.cs
0 → 100644
View file @
49e82627
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
MySql.Data.MySqlClient
;
using
Dapper
;
using
Bailun.DC.Models.DataWareHouse
;
using
System.Linq
;
namespace
Bailun.DC.Services.DataWareHouse
{
public
class
UploadFileServices
{
/// <summary>
/// 获取上传的流水数据文件解析情况
/// </summary>
/// <param name="platform">平台类型</param>
/// <param name="website">站点</param>
/// <param name="month">月份</param>
/// <param name="datatype">数据类型,1:销售平台,2:物流商流水</param>
/// <returns></returns>
public
List
<
uploadfiles
>
GetPlatformUploadfile
(
string
platform
,
string
website
,
string
month
,
int
datatype
)
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_DW
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
sql
=
$"select * from uploadfiles where platform='
{
platform
}
' and month='
{
month
}
' and datatype=
{
datatype
}
"
;
if
(!
string
.
IsNullOrEmpty
(
website
))
{
sql
+=
$" and website='
{
website
}
'"
;
}
return
cn
.
Query
<
uploadfiles
>(
sql
).
ToList
();
}
}
}
}
Bailun.DC.Web/Areas/DataWareHouse/Views/Logistics/List.cshtml
View file @
49e82627
...
...
@@ -37,7 +37,7 @@
</div>
<div class="form-group" style="margin-left:10px">
<label>账单月份</label>
<input id="month" name="month" class="form-control" style="width:1
35
px" placeholder="账单归属月份" />
<input id="month" name="month" class="form-control" style="width:1
10
px" placeholder="账单归属月份" />
</div>
<div class="form-group" style="margin-left:10px">
<label>时间</label>
...
...
@@ -47,7 +47,7 @@
</div>
<div class="form-group" style="margin-left:10px">
<label>单号</label>
<input id="orderno" name="orderno" class="form-control" style="width:
20
0px" placeholder="请输入单号" />
<input id="orderno" name="orderno" class="form-control" style="width:
11
0px" placeholder="请输入单号" />
</div>
<div class="form-group">
<label> </label>
...
...
@@ -56,6 +56,7 @@
<button type="button" style="margin-left:10px" class="btn btn-warning" onclick="downloadTemplate()">模版下载</button>
<button id="btn_Upload" type="button" style="" class="btn btn-warning">导入流水</button>
@*<button id="btn_Upload_Merge" type="button" style="" class="btn btn-warning">导入站点合并流水</button>*@
<span id="txt_tip"></span>
</div>
</div>
</form>
...
...
@@ -357,11 +358,11 @@
}
uploadfile('btn_Upload',
'@Url.Content("~/DataWareHouse/Logistics/UploadF
lowing
")' + '?platform=' + platform + '&month=' + month + '&website=' + website,
'@Url.Content("~/DataWareHouse/Logistics/UploadF
ileFragment
")' + '?platform=' + platform + '&month=' + month + '&website=' + website,
function(result){
if(result.success)
{
alert('
上传成功
!');
alert('
文件上传成功,后台会自动解析文件,请稍后再查看数据解析情况
!');
}
else
{
...
...
@@ -462,7 +463,8 @@
function uploadfile(id,url,callback)
{
uploader = new WebUploader.Uploader({
var _GUID = WebUploader.Base.guid();//一个GUID
var uploader = new WebUploader.Uploader({
// swf文件路径
swf: BASE_URL + 'Uploader.swf',
// 文件接收服务端。
...
...
@@ -477,14 +479,38 @@
accept: {
extensions: "xls,xlsx",
mimeTypes: ".xls,.xlsx"
},
chunked: true,//开始分片上传
chunkSize: 2048000,//每一片的大小
formData: {
guid: _GUID //自定义参数,待会儿解释
}
});
uploader.on('uploadSuccess', function (file, response) {
if(callback!=undefined)
{
callback(response);
}
$.submit({
type:'post',
url: '@Url.Content("~/DataWareHouse/Logistics/MergeUploadFile")',
paramData: 'guid=' + _GUID + '&filename=' + file.name + '&platform=' + platform + '&website=' + website+'&month='+month+'&datatype=2',
func: function (result) {
if (result.success) {
alert('文件上传成功,后台会自动解析文件,请稍后再查看数据解析情况!');
}
else {
alert(result.msg);
}
}
})
});
uploader.on('uploadProgress', function (file, percentage) {
//$("#uploader .progress-bar").width(percentage * 100 + '%');
$('#txt_tip').html('正在上传文件,当前进度:' + percentage * 100 + '%');
});
uploader.on('uploadSuccess', function () {
$('#txt_tip').html('上传成功,待保存数据');
});
uploader.on('uploadError', function (file) {
...
...
@@ -505,7 +531,7 @@
if (result.data.length > 0) {
for (var i in result.data) {
$('#website').append('<button class="btn btn-info wsites" type="button" aria-pressed="false" onclick="selWebsite(\'' + result.data[i] + '\',this)">' + result.data[i]+'</button>');
}
}
...
...
Bailun.DC.Web/Areas/DataWareHouse/Views/PlatformOrder/OrderBillings.cshtml
View file @
49e82627
...
...
@@ -546,7 +546,7 @@
});
uploader.on('uploadSuccess', function () {
$('#txt_tip').html('上传成功');
$('#txt_tip').html('上传成功
,待保存数据
');
});
uploader.on('uploadError', function (file) {
...
...
Bailun.DC.Web/Base/BaseController.cs
View file @
49e82627
...
...
@@ -195,7 +195,7 @@ namespace Bailun.DC.Web.Base
}
[
HttpPost
]
public
JsonResult
MergeUploadFile
(
string
guid
,
string
platform
,
string
website
,
string
month
,
string
filename
)
public
JsonResult
MergeUploadFile
(
string
guid
,
string
platform
,
string
website
,
string
month
,
string
filename
,
int
datatype
=
1
)
{
//uploadfiles
...
...
@@ -228,7 +228,7 @@ namespace Bailun.DC.Web.Base
hashcode
=
""
,
filekey
=
""
,
datatype
=
1
//
销售平台
datatype
=
datatype
//1=
销售平台
};
var
_platformService
=
new
Services
.
DataWareHouse
.
PlatformOrderServices
();
...
...
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