Commit 55419128 by guanzhenshan

1、修复平台余额报表期末数不对的问题,2、增加ebay发货单分析报表

parent 6c34f38b
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Ebay
{
public class dc_ebay_report_uk_config
{
public int id { get; set; }
public int type { get; set; }
public string config_value { get; set; }
public string config_desc { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Ebay
{
public class ebayUKLogistics
{
/// <summary>
/// 销售帐号
/// </summary>
public string seller_account { get; set; }
/// <summary>
/// 平台单号
/// </summary>
public string origin_order_id { get; set; }
/// <summary>
/// 物流单号
/// </summary>
public string tracking_order_id { get; set; }
/// <summary>
/// 发货状态
/// </summary>
public string shipping_status { get; set; }
/// <summary>
/// 发货仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// 物流渠道编号
/// </summary>
public string logistics_order_id { get; set; }
/// <summary>
/// 物流渠道名称
/// </summary>
public string logistics_order_name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Ebay
{
public class mEBayUKReport
{
/// <summary>
/// 销售帐号
/// </summary>
public string seller_account { get; set; }
/// <summary>
/// 发货单总数
/// </summary>
public int ordercount { get; set; }
/// <summary>
/// 专线平邮出单数
/// </summary>
public int zsurfacemailcount { get; set; }
/// <summary>
/// 专线包裹出单数
/// </summary>
public int zpackagecount { get; set; }
/// <summary>
/// 专线总出单数
/// </summary>
public int zcount { get; set; }
/// <summary>
/// 专线占比
/// </summary>
public decimal percenz { get; set; }
/// <summary>
/// 海外仓平邮出单数
/// </summary>
public int hsurfacemailcount { get; set; }
/// <summary>
/// 海外仓包裹出单数
/// </summary>
public int hpackagecount { get; set; }
/// <summary>
/// 海外仓包裹总出单数
/// </summary>
public int hcount { get; set; }
/// <summary>
/// 海外仓占比
/// </summary>
public decimal percenh { get; set; }
/// <summary>
/// 需要增加海外仓交易数
/// </summary>
public int needaddh { get; set; }
/// <summary>
/// 累积总差额
/// </summary>
public int needcount { get; set; }
}
}
...@@ -115,5 +115,10 @@ namespace Bailun.DC.Models ...@@ -115,5 +115,10 @@ namespace Bailun.DC.Models
/// </summary> /// </summary>
public DateTime? saleday { get; set; } public DateTime? saleday { get; set; }
/// <summary>
/// 期末余额
/// </summary>
public decimal end_balance { get; set; }
} }
} }
...@@ -387,26 +387,23 @@ namespace Bailun.DC.Services ...@@ -387,26 +387,23 @@ namespace Bailun.DC.Services
{ {
//item.amount = m.amount + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额 //item.amount = m.amount + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额
//item.amount_rmb = item.amount * item.exchangerate; //item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = m.userable_amount+m.amount_sales-m.withdraw_amount; item.before_balance = m.end_balance;
item.end_balance = m.end_balance + item.amount_sales - item.withdraw_amount;
} }
else if (m != null && m.userable_amount != item.userable_amount) else if (m == null || (m != null && m.userable_amount != item.userable_amount))
{ {
//item.amount = item.userable_amount + item.amount_sales - item.withdraw_amount; //item.amount = item.userable_amount + item.amount_sales - item.withdraw_amount;
//item.amount_rmb = item.amount * item.exchangerate; //item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = item.userable_amount; item.before_balance = item.userable_amount;
} item.end_balance = item.userable_amount + item.amount_sales - item.withdraw_amount;
else if (m == null)
{
//item.amount = 0 + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = 0;
} }
} }
else else
{ {
//item.amount = item.userable_amount; //item.amount = item.userable_amount;
//item.amount_rmb = item.userable_amount * item.exchangerate; //item.amount_rmb = item.userable_amount * item.exchangerate;
item.before_balance = m.userable_amount; item.before_balance = item.userable_amount;
item.end_balance = item.userable_amount;
} }
if (item.id <= 0) if (item.id <= 0)
......
...@@ -1815,6 +1815,53 @@ namespace Bailun.DC.Services ...@@ -1815,6 +1815,53 @@ namespace Bailun.DC.Services
} }
} }
/// <summary>
/// 获取Ebay UK站点 平邮发货名字
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public List<Models.Ebay.ebayUKLogistics> ListEbayUKLogistics(DateTime start, DateTime end)
{
var sqlparam = new DynamicParameters();
var sql = $@"select t2.seller_account,t1.* from (select t1.origin_order_id,t1.tracking_order_id,shipping_status,warehouse_code,logistics_order_id,logistics_order_name from dc_base_oms_pick t1
join dc_ebay_report_uk_config t4 on t1.logistics_order_id=t4.config_value and t4.type>1
where t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd")}' and t1.shipping_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}'
group by t1.origin_order_id,t1.tracking_order_id,shipping_status,warehouse_code,logistics_order_id,logistics_order_name
) t1
join dc_base_oms_order t2 on t1.origin_order_id=t2.origin_order_id and t2.website='uk' and t2.platform_type='Ebay'
join dc_ebay_report_uk_config t3 on t2.seller_account=t3.config_value and t3.type=1";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var list = cn.Query<Models.Ebay.ebayUKLogistics>(sql).AsList();
return list;
}
}
/// <summary>
/// 获取Ebay UK站点 配置信息
/// </summary>
/// <returns></returns>
public List<Models.Ebay.dc_ebay_report_uk_config> ListEbayReportUKConfig()
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if(cn.State== System.Data.ConnectionState.Closed)
{
cn.Open();
}
return cn.Query<Models.Ebay.dc_ebay_report_uk_config>("select * from dc_ebay_report_uk_config where type>0").AsList();
}
}
#endregion #endregion
} }
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Bailun.DC.Web.Areas.Logistics.Controllers
{
[Area("Logistics")]
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
public ActionResult EbayUkReport()
{
return View();
}
/// <summary>
///
/// </summary>
/// <param name="start"></param>
/// <returns></returns>
public JsonResult EbayUkReportJson(DateTime start)
{
var service = new Services.OrdersServices();
var obj = service.ListEbayUKLogistics(start, start);
var listconfig = service.ListEbayReportUKConfig();
var groupby = obj.GroupBy(a => a.seller_account).ToList();
var list = new List<Models.Ebay.mEBayUKReport>();
foreach (var item in groupby)
{
var m = new Models.Ebay.mEBayUKReport();
m.seller_account = item.Key;
m.ordercount = item.Count();
m.zsurfacemailcount = item.Where(a => listconfig.Where(b => b.type == 2).Select(c => c.config_value).Contains(a.logistics_order_id)).Count();
m.zpackagecount = item.Where(a => listconfig.Where(b => b.type == 3).Select(c => c.config_value).Contains(a.logistics_order_id)).Count();
m.zcount = m.zsurfacemailcount + m.zpackagecount;
m.percenz = (m.zcount / m.ordercount)*100;
m.hsurfacemailcount = item.Where(a => listconfig.Where(b => b.type == 4).Select(c => c.config_value).Contains(a.logistics_order_id)).Count();
m.hpackagecount = item.Where(a => listconfig.Where(b => b.type == 5).Select(c => c.config_value).Contains(a.logistics_order_id)).Count();
m.hcount = m.hsurfacemailcount + m.hpackagecount;
m.percenh = (m.hcount / m.ordercount)*100;
var need = ((m.ordercount * 0.5 - m.hcount) > 0 ? (m.ordercount * 0.5 - m.hcount) : 0);
m.needaddh = (int)need;
m.needcount = 0;
list.Add(m);
}
return Json(list);
}
}
}
\ No newline at end of file

@{
ViewData["Title"] = "Ebay新政策海外仓发货情况";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", "Ebay海外仓发货分析" };
}
<div class="row">
<div class="col-sm-12">
<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="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
</div>
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="data();"><i class="fa fa-search"></i>&nbsp;查询</button>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" class="table table-hover table-bordered table-condensed table-striped" style="table-layout:fixed;">
<thead>
<tr>
<th>卖家帐号</th>
<th>订单数</th>
<th>专线平邮出单数</th>
<th>专线包裹出单数</th>
<th>专线总出单</th>
<th>专线占比%</th>
<th>海外仓平邮出单数</th>
<th>海外仓包裹出单数</th>
<th>海外仓总出单数</th>
<th>海外仓占比%</th>
<th>需要新增海外仓建议数</th>
<th>累积总差额</th>
</tr>
</thead>
<tbody id="tb"></tbody>
</table>
</div>
</div>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
}
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
//list();
data();
})
function list() {
var columns = [
{
field: 'seller_account', title: '卖家帐号', width: '160', sortable: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>';
}
},
{ field: 'ordercount', title: '订单数', width: '100', sortable: true },
{ field: 'zsurfacemailcount', title: '专线平邮出单数', width: '150', sortable: true },
{ field: 'zpackagecount', title: '专线包裹出单数', width: '150', sortable: true },
{ field: 'zcount', title: '专线总出单', width: '130', sortable: true },
{ field: 'percenz', title: '专线占比', width: '110', sortable: true },
{ field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '150', sortable: true, iscount: true },
{ field: 'hpackagecount', title: '海外仓包裹出单数', width: '150', sortable: true, iscount: true },
{ field: 'hcount', title: '海外仓总出单数', width: '150', sortable: true, iscount: true },
{ field: 'percenh', title: '海外仓占比', width: '120', sortable: true, iscount: true },
{ field: 'needaddh', title: '需要新增海外仓建议数', width: '160', sortable: true, iscount: true },
{ field: 'needcount', title: '累积总差额', width: '130', sortable: true, iscount: true }
];
var url = '@Url.Content("~/Logistics/Home/EbayUkReportJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "");
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function data() {
var start = $('#start').val();
if (start == '') {
alert('请选择发货时间');
return false;
}
$.submit({
type: 'POST',
url: '@Url.Content("~/Logistics/Home/EbayUkReportJson")',
paramData: 'start=' + start,
func: function (result) {
if (result && result.length > 0) {
$('#tb').html('');
for (var i = 0; i < result.length; i++) {
var s = '<tr><td>' + result[i].seller_account + '</td>';
s += '<td>' + result[i].ordercount + '</td>';
s += '<td>' + result[i].zsurfacemailcount + '</td>';
s += '<td>' + result[i].zpackagecount + '</td>';
s += '<td>' + result[i].zcount + '</td>';
s += '<td>' + result[i].percenz + '</td>';
s += '<td>' + result[i].hsurfacemailcount + '</td>';
s += '<td>' + result[i].hpackagecount + '</td>';
s += '<td>' + result[i].hcount + '</td>';
s += '<td>' + result[i].percenh + '</td>';
s += '<td>' + result[i].needaddh + '</td>';
s += '<td>' + result[i].needcount + '</td>';
s += '</tr>';
$('#tb').append(s);
}
}
}
})
}
</script>
}
...@@ -936,7 +936,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -936,7 +936,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{ {
return Json(new { return Json(new {
success = false, success = false,
msg = "平台【"+platformcode+"】在"+saleday+"已经导入了数据,请删除该数据后重新导入。" msg = "平台【"+platformcode+"】在"+day+"已经导入了数据,请删除该数据后重新导入。"
}); });
} }
...@@ -1056,7 +1056,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1056,7 +1056,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
public string UpdateBalanceTest() public string UpdateBalanceTest()
{ {
var result = new Services.FinanceReportServices().ListPlatformBalance(DateTime.Parse("2019-03-05")); var result = new Services.FinanceReportServices().ListPlatformBalance(DateTime.Parse("2019-02-20"));
return result; return result;
} }
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Areas\Logistics\Data\" />
<Folder Include="Areas\Logistics\Models\" />
<Folder Include="Areas\Reports\Data\" /> <Folder Include="Areas\Reports\Data\" />
<Folder Include="Areas\Reports\Models\" /> <Folder Include="Areas\Reports\Models\" />
</ItemGroup> </ItemGroup>
......
...@@ -235,6 +235,18 @@ ...@@ -235,6 +235,18 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<a href="#">
<i class="fa fa-usd"></i>
<span class="nav-label">数据分析</span>
<span class="fa arrow"></span>
</a>
<ul class="nav nav-second-level">
<li>
<a class="J_menuItem" href="@Url.Content("~/Logistics/Home/EbayUkReport")" data-index="0">EbayUK平邮比例</a>
</li>
</ul>
</li>
</ul> </ul>
</div> </div>
</nav> </nav>
......
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