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
8ac3493b
Commit
8ac3493b
authored
Sep 09, 2019
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决导入英文格式因日期格式不统一出错的问题
parent
d794e578
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
55 deletions
+67
-55
FinanceController.cs
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
+43
-47
ListEbayIncome.cshtml
....DC.Web/Areas/Reports/Views/Finance/ListEbayIncome.cshtml
+24
-8
No files found.
Bailun.DC.Web/Areas/Reports/Controllers/FinanceController.cs
View file @
8ac3493b
...
...
@@ -4574,8 +4574,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <summary>
/// 导入Ebay收入明细
/// </summary>
/// <param name="formattype">1:中文账户,2:英文国外账户,3:英文国内账户 </param>
/// <returns></returns>
public
JsonResult
UploadEbayIncome
(
int
companyid
,
int
isChs
)
public
JsonResult
UploadEbayIncome
(
int
companyid
,
int
formattype
)
{
var
result
=
""
;
if
(
Request
.
Form
.
Files
.
Count
==
0
)
...
...
@@ -4603,6 +4604,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
});
}
try
{
var
read
=
new
System
.
IO
.
StreamReader
(
file
.
OpenReadStream
());
var
list
=
new
List
<
dc_base_income_ebay_paypal
>();
...
...
@@ -4620,7 +4623,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
s
=
tempArr
[
0
];
for
(
var
i
=
1
;
i
<
tempArr
.
Length
-
1
;
i
++)
{
if
((
tempArr
[
i
-
1
]==
""
||
tempArr
[
i
-
1
].
Substring
(
tempArr
[
i
-
1
].
Length
-
1
,
1
)
==
","
)
&&
(
tempArr
[
i
+
1
]
==
""
||
tempArr
[
i
+
1
].
Substring
(
0
,
1
)
==
","
)
&&
tempArr
[
i
].
Length
>
1
)
if
((
tempArr
[
i
-
1
]
==
""
||
tempArr
[
i
-
1
].
Substring
(
tempArr
[
i
-
1
].
Length
-
1
,
1
)
==
","
)
&&
(
tempArr
[
i
+
1
]
==
""
||
tempArr
[
i
+
1
].
Substring
(
0
,
1
)
==
","
)
&&
tempArr
[
i
].
Length
>
1
)
{
tempArr
[
i
]
=
tempArr
[
i
].
Replace
(
","
,
"||"
);
}
...
...
@@ -4630,21 +4633,38 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
var
arr
=
s
.
Split
(
','
);
if
(
arr
.
Length
>
1
)
if
(
arr
.
Length
>
1
)
//中文账户
{
var
time
=
DateTime
.
Now
;
if
(
isChs
==
1
)
if
(
formattype
==
1
)
{
time
=
DateTime
.
Parse
(
arr
[
0
]
+
" "
+
arr
[
1
]);
}
else
if
(
formattype
==
2
)
//英文国外账户
{
var
arrDate
=
arr
[
0
].
Split
(
'/'
);
if
(
arrDate
.
Length
==
3
)
{
time
=
DateTime
.
Parse
(
arrDate
[
2
]
+
"-"
+
arrDate
[
0
]
+
"-"
+
arrDate
[
1
]
+
" "
+
arr
[
1
]);
}
else
{
return
Json
(
new
{
success
=
false
,
msg
=
"第"
+
row_index
+
"行时间格式转换失败,请重试或联系管理员。"
,
});
}
}
else
if
(
formattype
==
3
)
//英文国内账户
{
var
arrDate
=
arr
[
0
].
Split
(
'/'
);
if
(
arrDate
.
Length
==
3
)
{
time
=
DateTime
.
Parse
(
arrDate
[
2
]+
"-"
+
arrDate
[
0
]+
"-"
+
arrDate
[
1
]+
" "
+
arr
[
1
]);
time
=
DateTime
.
Parse
(
arrDate
[
2
]
+
"-"
+
arrDate
[
1
]
+
"-"
+
arrDate
[
0
]
+
" "
+
arr
[
1
]);
}
else
{
...
...
@@ -4681,9 +4701,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
item_title
=
arr
[
15
].
Replace
(
"||"
,
","
),
item_id
=
arr
[
16
],
shipping_handling_amount
=
decimal
.
Parse
(
arr
[
17
]
==
""
?
"0"
:
arr
[
17
].
Replace
(
"||"
,
","
)),
insurance_amount
=
decimal
.
Parse
(
arr
[
18
]==
""
?
"0"
:
arr
[
18
].
Replace
(
"||"
,
","
)),
sales_tax
=
decimal
.
Parse
(
arr
[
19
]==
""
?
"0"
:
arr
[
19
].
Replace
(
"||"
,
","
)),
shipping_handling_amount
=
decimal
.
Parse
(
arr
[
17
]
==
""
?
"0"
:
arr
[
17
].
Replace
(
"||"
,
","
)),
insurance_amount
=
decimal
.
Parse
(
arr
[
18
]
==
""
?
"0"
:
arr
[
18
].
Replace
(
"||"
,
","
)),
sales_tax
=
decimal
.
Parse
(
arr
[
19
]
==
""
?
"0"
:
arr
[
19
].
Replace
(
"||"
,
","
)),
option_name1
=
arr
[
20
].
Replace
(
"||"
,
","
),
option_value1
=
arr
[
21
].
Replace
(
"||"
,
","
),
option_name2
=
arr
[
22
].
Replace
(
"||"
,
","
),
...
...
@@ -4692,9 +4712,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
invoice_number
=
arr
[
25
],
custom_number
=
arr
[
26
],
quantity
=
int
.
Parse
(
arr
[
27
]==
""
?
"0"
:
arr
[
27
]),
quantity
=
int
.
Parse
(
arr
[
27
]
==
""
?
"0"
:
arr
[
27
]),
receipt_id
=
arr
[
28
],
balance
=
decimal
.
Parse
(
arr
[
29
]==
""
?
"0"
:
arr
[
29
].
Replace
(
"||"
,
","
)),
balance
=
decimal
.
Parse
(
arr
[
29
]
==
""
?
"0"
:
arr
[
29
].
Replace
(
"||"
,
","
)),
address_line1
=
arr
[
30
].
Replace
(
"||"
,
","
),
address_line2
=
arr
[
31
].
Replace
(
"||"
,
","
),
...
...
@@ -4719,7 +4739,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return
Json
(
new
{
success
=
false
,
msg
=
"第"
+
row_index
+
"行出现异常,异常信息:"
+
ex
.
Message
,
msg
=
"第"
+
row_index
+
"行出现异常,异常信息:"
+
ex
.
Message
,
});
}
}
...
...
@@ -4735,46 +4755,22 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
result
=
new
Services
.
FinanceReportServices
().
SaveEbayPayPalInfo
(
list
);
}
//Dictionary<string, DataTable> dic = Base.NpolHelper.ExcelToDataTable(file.OpenReadStream(), file.FileName, true);
//if (dic.Count > 0)
//{
// var tb = dic.FirstOrDefault();
// var service = new Services.FinanceReportServices();
// var listRate = new List<Tuple<string, decimal>>();
// for (var i = 0; i < tb.Value.Rows.Count; i++)
// {
// var row = tb.Value.Rows[i];
// try
// {
// if (isChs == 1)
// {
// list.Add(FormatTableRowForChs(objAccount, row,companyid));
// }
// else
// {
// list.Add(FormatTableRowForEnglish(objAccount, row,companyid));
// }
// }
// catch (Exception ex)
// {
// return Json(new {
// success = false,
// msg = "第" + (i + 1) + "行出现异常,异常信息:" + ex.Message
// });
// }
// }
//}
return
Json
(
new
{
return
Json
(
new
{
success
=
string
.
IsNullOrEmpty
(
result
),
msg
=
result
});
}
catch
(
Exception
ex
)
{
return
Json
(
new
{
success
=
false
,
msg
=
"解析出现异常,异常信息:"
+
ex
.
Message
,
});
}
}
#
region
Private
...
...
Bailun.DC.Web/Areas/Reports/Views/Finance/ListEbayIncome.cshtml
View file @
8ac3493b
...
...
@@ -29,7 +29,8 @@
<label> </label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i> 查询</button>
<button id="btnUpload_chs" type="button" class="btn btn-success">导入paypal中文数据</button>
<button id="btnUpload_en" type="button" class="btn btn-success">导入paypal英文数据</button>
<button id="btnUpload_en_inside" type="button" class="btn btn-success">导入paypal英文【国内】账户</button>
<button id="btnUpload_en_outside" type="button" class="btn btn-success">导入paypal英文【国外】帐号</button>
</div>
</div>
</form>
...
...
@@ -89,22 +90,25 @@
function list() {
var columns = [
{ field: 'record_time', title: '报告日期', width: '1
5
0', sortable: true },
{ field: 'record_time', title: '报告日期', width: '1
6
0', sortable: true },
{ field: 'account_name', title: '帐号', width: '180' },
{ field: 'time_zone', title: '时区', width: '70'},
{ field: 'type', title: '类型', width: '170'},
{
field: 'type', title: '类型', width: '190', formatter: function (idx, data) {
return '<div class="mules" title="' + data.type + '">' + data.type + '</div>';
}},
{ field: 'status', title: '状态', width: '120', iscount: true},
{ field: 'currency', title: '币种', width: '70'},
{ field: 'gross', title: '总额', width: '100', sortable: true, iscount: true },
{ field: 'fee', title: '费用', width: '90', sortable: true, iscount: true },
{ field: 'net', title: '净额', width: '90', sortable: true, iscount: true },
{
field: 'from_email', title: '发件人邮箱地址', width: '1
8
0', formatter: function (idx, data) {
field: 'from_email', title: '发件人邮箱地址', width: '1
9
0', formatter: function (idx, data) {
return '<div class="mules" title="' + data.from_email + '">' + data.from_email + '</div>';
}
},
{
field: 'to_email', title: '收件人邮箱地址', width: '1
6
0', formatter: function (idx, data) {
field: 'to_email', title: '收件人邮箱地址', width: '1
9
0', formatter: function (idx, data) {
return '<div class="mules" title="' + data.to_email + '">' + data.to_email + '</div>';
}
},
...
...
@@ -148,7 +152,7 @@
companyid = d.companyid;
uploadfile('btnUpload_chs',
'@Url.Content("~/Reports/Finance/UploadEbayIncome")' + '?companyid=' + companyid +'&
isChs
=1',
'@Url.Content("~/Reports/Finance/UploadEbayIncome")' + '?companyid=' + companyid +'&
formattype
=1',
function(result){
if(result.success)
{
...
...
@@ -160,8 +164,20 @@
}
});
uploadfile('btnUpload_en',
'@Url.Content("~/Reports/Finance/UploadEbayIncome")' + '?companyid=' + companyid +'&isChs=0',
uploadfile('btnUpload_en_inside',
'@Url.Content("~/Reports/Finance/UploadEbayIncome")' + '?companyid=' + companyid +'&formattype=3',
function(result){
if(result.success)
{
alert('上传成功!');
}
else
{
alert(result.msg);
}
});
uploadfile('btnUpload_en_outside',
'@Url.Content("~/Reports/Finance/UploadEbayIncome")' + '?companyid=' + companyid +'&formattype=2',
function(result){
if(result.success)
{
...
...
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