Commit 4fbbe580 by guanzhenshan

调整ebay uk站点的分析报表,增加letter出单数

parent 8bd75b0f
......@@ -62,9 +62,24 @@ namespace Bailun.DC.Models.Ebay
public int needaddh { get; set; }
/// <summary>
/// letter 出单数
/// </summary>
public int lettercount { get; set; }
/// <summary>
/// 包裹/letter的倍数
/// </summary>
public decimal percenl { get; set; }
/// <summary>
/// 累积总差额
/// </summary>
public int needcount { get; set; }
/// <summary>
/// 需要新增包裹数
/// </summary>
public double needcount_bg { get; set; }
}
}
......@@ -3233,6 +3233,39 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 获取Ebay UK站点 leter的发货占比
/// Add by Allan at 20200711
/// </summary>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public List<Models.Ebay.ebayUKLogistics> ListEbayUKLogistics_Letter(DateTime start, DateTime end)
{
var sqlparam = new DynamicParameters();
var sql = $@"select * from (
select distinct t1.seller_account,t1.origin_order_id,t1.logistics_warehouse_code,t1.logistics_method_code,t2.logistics_order_id
from dc_base_oms_order t1
join dc_base_oms_pick t2 on t1.bailun_order_id=t2.bailun_order_id and t2.logistics_order_id is not null
join dc_ebay_report_uk_config t3 on t3.type=1 and t1.seller_account=t3.config_value
join dc_ebay_report_uk_config t4 on t2.logistics_order_id = t4.config_value and t4.type in (4,5,6,7)
where t1.platform_type='Ebay' and t1.website='uk' and t1.bailun_payment_status!='Canceled' and t1.paid_time>='{start.ToString("yyyy-MM-dd")}' and t1.paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd")}') t1";
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, null, null, true, 2 * 60).AsList();
return list;
}
}
/// <summary>
/// 获取Ebay UK站点 配置信息
/// </summary>
/// <returns></returns>
......
......@@ -25,7 +25,7 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers
/// </summary>
/// <param name="start"></param>
/// <returns></returns>
public string EbayUkReportJson(Models.BtTableParameter request,DateTime start,DateTime end,int? zstart,int? zend,int? hstart,int? hend)
public string EbayUkReportJson_backup(Models.BtTableParameter request,DateTime start,DateTime end,int? zstart,int? zend,int? hstart,int? hend)
{
var service = new Services.OrdersServices();
......@@ -134,5 +134,120 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers
return JsonConvert.SerializeObject(new { total = 25, rows = list,count_row=countM });
}
/// <summary>
/// 获取Ebay UK站点 leter的发货占比
/// Add by Allan at 20200711
/// </summary>
/// <param name="start"></param>
/// <returns></returns>
public string EbayUkReportJson(Models.BtTableParameter request, DateTime start, DateTime end, int? l_start, int? l_end, int? bg_start, int? bg_end)
{
var service = new Services.OrdersServices();
var obj = service.ListEbayUKLogistics_Letter(start, end);
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.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 == 7).Select(c => c.config_value).Contains(a.logistics_order_id)).Count();
//m.hcount = m.hsurfacemailcount + m.hpackagecount;
//m.percenh = decimal.Parse((((decimal)m.hcount / (decimal)m.ordercount) * 100).ToString("#0.00"));
m.lettercount = item.Where(a => listconfig.Where(b => b.type == 6).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(); //letter
m.percenl = m.hpackagecount / m.lettercount;
//需新增包裹数=1.2*信封transactionid数-包裹transactionid订单数
var need = ((m.lettercount * 1.2 - m.hpackagecount) > 0 ? (m.lettercount * 1.2 - m.hpackagecount) : 0);
//m.needaddh = (int)(need * 1.5);
//m.needcount = 0;
m.needcount_bg = Math.Ceiling(need);
//letter占比
m.percenz = decimal.Parse((m.lettercount*100 / m.ordercount).ToString("#0.00"));
//包裹占比
m.percenh = decimal.Parse((m.hpackagecount*100 / m.ordercount).ToString("#0.00"));
list.Add(m);
}
var countM = new Models.Ebay.mEBayUKReport()
{
seller_account = "总计",
ordercount = obj.Count,
hsurfacemailcount = obj.Where(a => listconfig.Where(b => b.type == 4).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
hpackagecount = obj.Where(a => listconfig.Where(b => b.type == 7).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
lettercount = obj.Where(a => listconfig.Where(b => b.type == 6).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
};
countM.percenl = countM.hpackagecount / countM.lettercount;
var need1 = ((countM.lettercount * 1.2 - countM.hpackagecount) > 0 ? (countM.lettercount * 1.2 - countM.hpackagecount) : 0);
countM.needcount_bg = Math.Ceiling(need1);
if (l_start.HasValue && l_start.Value > 0)
{
list = list.Where(a => a.percenz >= l_start.Value).ToList();
}
if (l_end.HasValue && l_end.Value > 0)
{
list = list.Where(a => a.percenz < l_end.Value).ToList();
}
if (bg_start.HasValue && bg_start.Value > 0)
{
list = list.Where(a => a.percenh >= bg_start.Value).ToList();
}
if (bg_end.HasValue && bg_end.Value > 0)
{
list = list.Where(a => a.percenh < bg_end.Value).ToList();
}
//排序
if (request.order != null && request.order.ToLower() == "desc")
{
switch (request.sort)
{
case "ordercount":
list = list.OrderByDescending(a => a.ordercount).ToList();
break;
case "needcount_bg":
list = list.OrderByDescending(a => a.needcount_bg).ToList();
break;
}
}
else
{
switch (request.sort)
{
case "ordercount":
list = list.OrderBy(a => a.ordercount).ToList();
break;
case "needcount_bg":
list = list.OrderBy(a => a.needcount_bg).ToList();
break;
}
}
return JsonConvert.SerializeObject(new { total = 25, rows = list, count_row = countM });
}
}
}
\ No newline at end of file
......@@ -16,14 +16,14 @@
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
</div>
<div class="form-group">
<label>专线占比</label>
<input id="zstart" name="zstart" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="zend" name="zend" type="number" class="form-control" style="width:60px" value="0" />%
<label>letter占比</label>
<input id="l_start" name="l_start" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="l_end" name="l_end" type="number" class="form-control" style="width:60px" value="0" />%
</div>
<div class="form-group">
<label>海外仓占比</label>
<input id="hstart" name="hstart" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="hend" name="hend" type="number" class="form-control" style="width:60px" value="0" />%
<label>包裹占比</label>
<input id="bg_start" name="bg_hstart" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="bg_end" name="bg_end" type="number" class="form-control" style="width:60px" value="0" />%
</div>
<div class="form-group">
<label>&nbsp;</label>
......@@ -90,16 +90,10 @@
}
},
{ field: 'ordercount', title: '订单数', width: '100', sortable: true,iscount:true },
{ field: 'zsurfacemailcount', title: '专线平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'zpackagecount', title: '专线包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'zcount', title: '专线总出单', width: '130', sortable: false, iscount: true },
{ field: 'percenz', title: '专线占比%', width: '110', sortable: false, iscount: true },
{ field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'hpackagecount', title: '海外仓包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'hcount', title: '海外仓总出单数', width: '150', sortable: false, iscount: true },
{ field: 'percenh', title: '海外仓占比%', width: '120', sortable: false, iscount: true },
{ field: 'needaddh', title: '需新增海外仓数', width: '130', sortable: true, iscount: true },
{ field: 'needcount', title: '累积总差额', width: '120', sortable: false, iscount: true }
{ field: 'percenl', title: '包裹/letter倍数', width: '130', sortable: false, iscount: true },
{ field: 'needcount_bg', title: '需新增包裹数', width: '110', sortable: false, iscount: true }
];
var url = '@Url.Content("~/Logistics/Home/EbayUkReportJson")' + '?' + $("#toolbar").serialize();
......

@{
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"))" />至
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
</div>
<div class="form-group">
<label>专线占比</label>
<input id="zstart" name="zstart" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="zend" name="zend" type="number" class="form-control" style="width:60px" value="0" />%
</div>
<div class="form-group">
<label>海外仓占比</label>
<input id="hstart" name="hstart" type="number" class="form-control" style="width:60px" value="0" />%-
<input id="hend" name="hend" type="number" class="form-control" style="width:60px" value="0" />%
</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>*@
<table id="roletable" style="table-layout:fixed;"></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' });
laydate.render({ elem: '#end' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170));
list();
//data();
})
function list() {
var columns = [
{
field: 'seller_account', title: '卖家帐号', width: '130', sortable: false, iscount: true, formatter: function (idx, data) {
return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>';
}
},
{ field: 'ordercount', title: '订单数', width: '100', sortable: true,iscount:true },
{ field: 'zsurfacemailcount', title: '专线平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'zpackagecount', title: '专线包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'zcount', title: '专线总出单', width: '130', sortable: false, iscount: true },
{ field: 'percenz', title: '专线占比%', width: '110', sortable: false, iscount: true },
{ field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'hpackagecount', title: '海外仓包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'hcount', title: '海外仓总出单数', width: '150', sortable: false, iscount: true },
{ field: 'percenh', title: '海外仓占比%', width: '120', sortable: false, iscount: true },
{ field: 'needaddh', title: '需新增海外仓数', width: '130', sortable: true, iscount: true },
{ field: 'needcount', title: '累积总差额', width: '120', sortable: false, iscount: true }
];
var url = '@Url.Content("~/Logistics/Home/EbayUkReportJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", { showfooter: true, showCount:true});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function data() {
var start = $('#start').val();
if (start == '') {
alert('请选择发货开始时间');
return false;
}
var end = $('#end').val();
if (end == '') {
alert("请选择发货结束时间");
return false;
}
var index = layer.load();
$.submit({
type: 'POST',
url: '@Url.Content("~/Logistics/Home/EbayUkReportJson")',
paramData: $("#toolbar").serialize(),
func: function (result) {
layer.close(index);
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>
}
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