Commit b850f9a1 by guanzhenshan

修改Ebay UK 站点数据不对的问题

parent 51849295
...@@ -27,5 +27,10 @@ namespace Bailun.DC.Models.Ebay ...@@ -27,5 +27,10 @@ namespace Bailun.DC.Models.Ebay
/// </summary> /// </summary>
public string logistics_method_code { get; set; } public string logistics_method_code { get; set; }
/// <summary>
/// 实际发货物流方式
/// </summary>
public string logistics_order_id { get; set; }
} }
} }
...@@ -1865,11 +1865,19 @@ namespace Bailun.DC.Services ...@@ -1865,11 +1865,19 @@ namespace Bailun.DC.Services
public List<Models.Ebay.ebayUKLogistics> ListEbayUKLogistics(DateTime start, DateTime end) public List<Models.Ebay.ebayUKLogistics> ListEbayUKLogistics(DateTime start, DateTime end)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = $@"select t1.seller_account,t1.origin_order_id,t1.logistics_warehouse_code,t1.logistics_method_code from dc_base_oms_order t1 //var sql = $@"select t1.seller_account,t1.origin_order_id,t1.logistics_warehouse_code,t1.logistics_method_code from dc_base_oms_order t1
join dc_ebay_report_uk_config t2 on t2.type>1 and t1.logistics_method_code=t2.config_value // join dc_ebay_report_uk_config t2 on t2.type>1 and t1.logistics_method_code=t2.config_value
// join dc_ebay_report_uk_config t3 on t3.type=1 and t1.seller_account=t3.config_value
// 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")}'";
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 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
where t1.platform_type='Ebay' and t1.website='uk' and t1.bailun_payment_status!='Canceled' 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")}'"; 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)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
......
...@@ -25,7 +25,7 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers ...@@ -25,7 +25,7 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers
/// </summary> /// </summary>
/// <param name="start"></param> /// <param name="start"></param>
/// <returns></returns> /// <returns></returns>
public JsonResult EbayUkReportJson(DateTime start,DateTime end,int? zstart,int? zend,int? hstart,int? hend) public string EbayUkReportJson(Models.BtTableParameter request,DateTime start,DateTime end,int? zstart,int? zend,int? hstart,int? hend)
{ {
var service = new Services.OrdersServices(); var service = new Services.OrdersServices();
...@@ -41,23 +41,50 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers ...@@ -41,23 +41,50 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers
var m = new Models.Ebay.mEBayUKReport(); var m = new Models.Ebay.mEBayUKReport();
m.seller_account = item.Key; m.seller_account = item.Key;
m.ordercount = item.Count(); m.ordercount = item.Count();
m.zsurfacemailcount = item.Where(a => listconfig.Where(b => b.type == 2).Select(c => c.config_value).Contains(a.logistics_method_code)).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_method_code)).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.zcount = m.zsurfacemailcount + m.zpackagecount;
m.percenz = decimal.Parse((((decimal)m.zcount / (decimal)m.ordercount)*100).ToString("#0.00")); m.percenz = decimal.Parse((((decimal)m.zcount / (decimal)m.ordercount)*100).ToString("#0.00"));
m.hsurfacemailcount = item.Where(a => listconfig.Where(b => b.type == 4).Select(c => c.config_value).Contains(a.logistics_method_code)).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 == 5).Select(c => c.config_value).Contains(a.logistics_method_code)).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.hcount = m.hsurfacemailcount + m.hpackagecount;
m.percenh = decimal.Parse((((decimal)m.hcount / (decimal)m.ordercount)*100).ToString("#0.00")); m.percenh = decimal.Parse((((decimal)m.hcount / (decimal)m.ordercount)*100).ToString("#0.00"));
var need = ((m.ordercount * 0.5 - m.hcount) > 0 ? (m.ordercount * 0.5 - m.hcount) : 0); var need = ((m.ordercount * 0.5 - m.hcount) > 0 ? (m.ordercount * 0.5 - m.hcount) : 0);
m.needaddh = (int)need; m.needaddh = (int)(need*1.5);
m.needcount = 0; m.needcount = 0;
list.Add(m); list.Add(m);
} }
var countM = new Models.Ebay.mEBayUKReport() {
seller_account = "总计",
ordercount = obj.Count,
zsurfacemailcount = obj.Where(a=> listconfig.Where(b => b.type == 2).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
zpackagecount = obj.Where(a => listconfig.Where(b => b.type == 3).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
zcount = 0,
percenz = 0,
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 == 5).Select(c => c.config_value).Contains(a.logistics_order_id)).Count(),
hcount = 0,
percenh = 0,
needcount = 0,
};
countM.zcount = countM.zsurfacemailcount + countM.zpackagecount;
countM.percenz = decimal.Parse((((decimal)countM.zcount / (decimal)countM.ordercount) * 100).ToString("N2"));
countM.hcount = countM.hsurfacemailcount + countM.hpackagecount;
countM.percenh = decimal.Parse((((decimal)countM.hcount / (decimal)countM.ordercount) * 100).ToString("N2"));
var need1 = ((countM.ordercount * 0.5 - countM.hcount) > 0 ? (countM.ordercount * 0.5 - countM.hcount) : 0);
countM.needaddh = (int)(need1 * 1.5);
countM.needcount = 0;
if (zstart.HasValue && zstart.Value > 0) if (zstart.HasValue && zstart.Value > 0)
{ {
list = list.Where(a => a.percenz >= zstart.Value).ToList(); list = list.Where(a => a.percenz >= zstart.Value).ToList();
...@@ -75,7 +102,37 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers ...@@ -75,7 +102,37 @@ namespace Bailun.DC.Web.Areas.Logistics.Controllers
list = list.Where(a => a.percenh < hend.Value).ToList(); list = list.Where(a => a.percenh < hend.Value).ToList();
} }
return Json(list); //return Json(list);
//排序
if (request.order != null && request.order.ToLower() == "desc")
{
switch (request.sort)
{
case "ordercount":
list = list.OrderByDescending(a => a.ordercount).ToList();
break;
case "needaddh":
list = list.OrderByDescending(a => a.needaddh).ToList();
break;
}
}
else
{
switch (request.sort)
{
case "ordercount":
list = list.OrderBy(a => a.ordercount).ToList();
break;
case "needaddh":
list = list.OrderBy(a => a.needaddh).ToList();
break;
}
}
return JsonConvert.SerializeObject(new { total = 25, rows = list,count_row=countM });
} }
} }
} }
\ No newline at end of file
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</div> </div>
<div class="ibox-content m-b-sm border-bottom"> <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;"> @*<table id="roletable" class="table table-hover table-bordered table-condensed table-striped" style="table-layout:fixed;">
<thead> <thead>
<tr> <tr>
<th>卖家帐号</th> <th>卖家帐号</th>
...@@ -52,7 +52,10 @@ ...@@ -52,7 +52,10 @@
</tr> </tr>
</thead> </thead>
<tbody id="tb"></tbody> <tbody id="tb"></tbody>
</table> </table>*@
<table id="roletable" style="table-layout:fixed;"></table>
</div> </div>
</div> </div>
</div> </div>
...@@ -75,34 +78,34 @@ ...@@ -75,34 +78,34 @@
var height = document.body.clientHeight; var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170)); $("#roletable").attr("data-height", (height - 170));
//list(); list();
data(); //data();
}) })
function list() { function list() {
var columns = [ var columns = [
{ {
field: 'seller_account', title: '卖家帐号', width: '160', sortable: true, formatter: function (idx, data) { 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>'; return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account+'</div>';
} }
}, },
{ field: 'ordercount', title: '订单数', width: '100', sortable: true }, { field: 'ordercount', title: '订单数', width: '100', sortable: true,iscount:true },
{ field: 'zsurfacemailcount', title: '专线平邮出单数', width: '150', sortable: true }, { field: 'zsurfacemailcount', title: '专线平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'zpackagecount', title: '专线包裹出单数', width: '150', sortable: true }, { field: 'zpackagecount', title: '专线包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'zcount', title: '专线总出单', width: '130', sortable: true }, { field: 'zcount', title: '专线总出单', width: '130', sortable: false, iscount: true },
{ field: 'percenz', title: '专线占比', width: '110', sortable: true }, { field: 'percenz', title: '专线占比%', width: '110', sortable: false, iscount: true },
{ field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '150', sortable: true, iscount: true }, { field: 'hsurfacemailcount', title: '海外仓平邮出单数', width: '130', sortable: false, iscount: true },
{ field: 'hpackagecount', title: '海外仓包裹出单数', width: '150', sortable: true, iscount: true }, { field: 'hpackagecount', title: '海外仓包裹出单数', width: '130', sortable: false, iscount: true },
{ field: 'hcount', title: '海外仓总出单数', width: '150', sortable: true, iscount: true }, { field: 'hcount', title: '海外仓总出单数', width: '150', sortable: false, iscount: true },
{ field: 'percenh', title: '海外仓占比', width: '120', sortable: true, iscount: true }, { field: 'percenh', title: '海外仓占比%', width: '120', sortable: false, iscount: true },
{ field: 'needaddh', title: '需要新增海外仓建议数', width: '160', sortable: true, iscount: true }, { field: 'needaddh', title: '需新增海外仓数', width: '130', sortable: true, iscount: true },
{ field: 'needcount', 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(); var url = '@Url.Content("~/Logistics/Home/EbayUkReportJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) { if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, ""); tb = OnlyTable("roletable", columns, url, "", { showfooter: true, showCount:true});
} }
else { else {
tb.bootstrapTable('refresh', { url: url }); tb.bootstrapTable('refresh', { url: url });
......
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