Commit 0f445433 by guanzhenshan

完成账单流水解析相关配置管理和提示,相关问题出现的情况和处理方案。

parent a453fdc1
......@@ -31,5 +31,9 @@ namespace Bailun.DC.Models.DataWareHouse
/// </summary>
public string col_orderno { get; set; }
public string col_currency { get; set; }
public int delstatus { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.DataWareHouse
{
public class flowing_sales_config
{
public int id { get; set; }
public string platform { get; set; }
public string website { get; set; }
public string colname_orderno { get; set; }
public string colname_platformsku { get; set; }
public string colname_datatime { get; set; }
public string colname_currency { get; set; }
public int delstatus { get; set; }
}
}
......@@ -96,6 +96,34 @@ namespace Bailun.DC.Services.DataWareHouse
}
/// <summary>
/// 删除配置
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public string DelOrderFeeConfig(int id)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_DW))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.QueryFirstOrDefault<order_fee_config>("select * from order_fee_config where delstatus=0 and id=" + id);
if (obj != null)
{
obj.delstatus = 1;
cn.Update(obj);
}
else
{
return "找不到该配置";
}
}
return "";
}
}
}
......@@ -92,6 +92,31 @@ namespace Bailun.DC.Services.DataWareHouse
return "";
}
public string InsertOrderFeeConfig(List<order_fee_config> listconfigs)
{
try
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_DW))
{
if(cn.State== System.Data.ConnectionState.Closed)
{
cn.Open();
}
foreach (var item in listconfigs)
{
cn.Insert(item);
}
}
return "";
}
catch (Exception ex)
{
return ex.Message;
}
}
/// <summary>
/// 获取费用解析财务流水配置
/// </summary>
......@@ -237,7 +262,7 @@ namespace Bailun.DC.Services.DataWareHouse
}
else
{
list = cn.Query<order_fee_value_amazon>(sql, sqlparam).ToList();
list = cn.Query<order_fee_value_amazon>(sql, sqlparam,null,true,2*60).ToList();
}
var config = cn.Query<order_fee_config>($"select * from order_fee_config where id in ('{string.Join("','", list.Select(a => a.order_fee_config_id).Distinct().ToList())}')");
......
......@@ -63,6 +63,7 @@
</div>
<div class="ibox-content m-b-sm border-bottom table-responsive">
<button class="btn btn-xs btn-danger" onclick="ShowFlowingConfig(2)" style="margin-bottom:5px;">重要:流水字段解析配置</button>
<table id="roletable" class="table table-hover table-bordered table-striped" style="table-layout:fixed;">
<thead id="tb_head">
......@@ -213,7 +214,7 @@
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
var month = '';
var month = '@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))';
var uploader;
......@@ -546,6 +547,9 @@
})
}
function ShowFlowingConfig(datatype) {
layer_show('流水字段解析配置', '@Url.Content("~/DataWareHouse/PlatformOrder/FlowingConfig")' + '?platform=' + platform+'&datatype=' + datatype, '90%', '90%');
}
</script>
}
\ No newline at end of file
@{
ViewData["Title"] = "账单流水字段指定配置";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "销售平台流水", "账单流水字段指定配置列表" };
}
<div class="row">
<div class="col-sm-12">
<div class="alert alert-warning">
</div>
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>月份</label>
<input id="month" name="month" type="text" class="form-control" style="width:120px;" value="@(ViewBag.month)" placeholder="请输入月份" />
</div>
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
<button id="btn_uploadFlowing" type="button" class="btn btn-warning">导入</button>
<a href="@Url.Content("~/templatefile/汇率.xlsx")" target="_blank">模版下载</a>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table class="table table-hover table-bordered table-condensed table-striped">
<thead>
<tr>
<th>月份</th>
<th>币种</th>
<th>汇率</th>
</tr>
</thead>
<tbody id="tb">
</tbody>
</table>
</div>
</div>
</div>
@section css{
<link href="~/js/webuploader-0.1.5/webuploader.css" rel="stylesheet" />
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.webuploader-pick {
position: relative;
display: block;
cursor: pointer;
background: none;
padding: 0px;
color: #fff;
text-align: center;
border-radius: 3px;
overflow: hidden;
}
.webuploader-container {
background-color: cornflowerblue !important;
}
</style>
}
@section scripts{
<script src="~/js/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript">
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
var tb;
var companyid = 0;
$(document).ready(function () {
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
list();
laydate.render({
elem: '#month', type: 'month', done: function (value, date, endDate) {
//console.log(value); //得到日期生成的值,如:2017-08-18
//console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
//console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。
month = value;
initUpload();
}
});
initUpload();
})
function list() {
$.submit({
url: '@Url.Content("~/DataWareHouse/PlatformOrder/ExchangeRateJson")',
paramData: $("#toolbar").serialize(),
type:'POST',
func: function (result) {
$('#tb').html('');
if (result.success) {
for (var i = 0; i < result.list.length; i++) {
var _obj = result.list[i];
var _str = '<tr>';
_str += '<td>' + _obj.month + '</td>';
_str += '<td>' + _obj.currency + '</td>';
_str += '<td>' + _obj.exchange_rate + '</td>';
_str += '</tr>';
$('#tb').append(_str);
}
}
}
})
}
function initUpload() {
var month = $('#month').val();
if (month == '') {
alert('请选择月份');
return false;
}
uploadfile('btn_uploadFlowing',
'@Url.Content("~/DataWareHouse/PlatformOrder/UploadExchangeRate")' + '?month=' + month,
function(result){
if(result.success)
{
alert('文件上传成功');
}
else
{
alert(result.msg);
}
});
}
function uploadfile(id,url,callback)
{
var uploader = new WebUploader.Uploader({
// swf文件路径
swf: BASE_URL + 'Uploader.swf',
// 文件接收服务端。
server: url != undefined ? (url + '?companyid=' + companyid) : '@Url.Content("~/File/UploadFile")',
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: '#'+id,
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传!
resize: false,
auto:true
});
uploader.on('uploadSuccess', function (file, response) {
if(callback!=undefined)
{
callback(response);
}
});
uploader.on('uploadError', function (file) {
layer.msg("上传出错");
});
}
</script>
}
......@@ -83,6 +83,9 @@
</div>
<div class="ibox-content m-b-sm border-bottom">
<button class="btn btn-xs btn-danger" onclick="ShowOrderFeeConfig()" style="margin-bottom:5px;">重要:财务会计流水取数逻辑配置</button>
<a class="btn btn-xs btn-warning" style="margin-left:5px;margin-bottom:5px;" href="@Url.Content("~/templatefile/财务会计流水解析常见问题.pdf")" target="_blank">流水解析常见问题</a>
<button class="btn btn-xs btn-success" onclick="ShowExchangeRate()" style="margin-bottom:5px;margin-left:5px;">月份汇率</button>
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
......@@ -289,7 +292,7 @@
if(result.success)
{
alert('文件上传成功');
}
else
{
......@@ -381,6 +384,13 @@
}
}
function ShowOrderFeeConfig() {
layer_show('财务会计流水取数逻辑配置', '@Url.Content("~/DataWareHouse/PlatformOrder/OrderFeeConfig")' + '?platform=' + $('#platform').val() + '&datatype=' + $('#datatype').val(), '90%', '90%');
}
function ShowExchangeRate() {
layer_show('月份汇率', '@Url.Content("~/DataWareHouse/PlatformOrder/ExchangeRate")' + '?month=' + $('#month').val(), '90%', '90%');
}
</script>
}
......@@ -42,7 +42,7 @@
<div class="form-group">
<label>账单月份</label>
<input id="month" name="month" style="width:100px" class="form-control" placeholder="请选择月份" />
<input id="month" name="month" style="width:100px" class="form-control" placeholder="请选择月份" value="@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))" />
</div>
<div class="form-group" style="margin-left:10px">
......@@ -70,6 +70,7 @@
</div>
<div class="ibox-content m-b-sm border-bottom table-responsive">
<button class="btn btn-xs btn-danger" onclick="ShowFlowingConfig(1)" style="margin-bottom:5px;">重要:流水字段解析配置</button>
<table id="roletable" class="table table-hover table-bordered table-striped" style="table-layout:fixed;">
<thead id="tb_head">
......@@ -220,7 +221,7 @@
var BASE_URL = '@(Url.Content("~/js/webuploader-0.1.5/"))';
var month = '';
var month = '@(DateTime.Now.AddMonths(-1).ToString("yyyy-MM"))';
$(document).ready(function () {
......@@ -360,7 +361,7 @@
//if (month == '') {
// alert('请选择月份');
// return false;
// returUrl false;
//}
//if (websitecount > 0 && website == '') {
......@@ -557,6 +558,9 @@
});
}
function ShowFlowingConfig(datatype) {
layer_show('流水字段解析配置', '@Url.Content("~/DataWareHouse/PlatformOrder/FlowingConfig")' + '?platform=' + platform+'&datatype=' + datatype, '90%', '90%');
}
</script>
}
\ No newline at end of file
......@@ -41,7 +41,8 @@ namespace Bailun.DC.Web.Base
/// <param name="list"></param>
/// <param name="columns"></param>
/// <param name="tbName"></param>
public void ToCSV(List<string> list, List<string> columns, string tbName, string filePath)
/// <param name="Split_Sign">数据分隔符号</param>
public void ToCSV(List<string> list, List<string> columns, string tbName, string filePath,string Split_Sign="|")
{
var strb = string.Empty;
......@@ -72,7 +73,7 @@ namespace Bailun.DC.Web.Base
//添加表内容
foreach (var item in list)
{
var arr = item.Split('|');
var arr = item.Split(Split_Sign);
strb = string.Empty;
foreach (var rowitem in arr)
{
......
......@@ -608,7 +608,8 @@ namespace Bailun.DC.Web.Controllers
a.website,
a.bailun_sku,
count = a.bailun_sku_quantity_ordered,
amount = a.amount_sales
amount = a.amount_sales,
})
});
}
......@@ -653,7 +654,6 @@ namespace Bailun.DC.Web.Controllers
});
}
}
/// <summary>
......
......@@ -622,7 +622,6 @@ namespace Bailun.DC.Web.Controllers
var _currency = _row["币种"].ToString();
var _exchangerate = decimal.Parse(_row["汇率"].ToString());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment