Commit 82184d0d by guanzhenshan

增加利润报表曲线图

parent 95300acb
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.OrderChart
{
/// <summary>
/// 平台利润统计图表
/// </summary>
public class ProformProfitChart
{
public decimal val { get; set; }
public DateTime date { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Orders
{
/// <summary>
/// itemid的销量
/// </summary>
public class mItemIdOrderCount
{
public int count { get; set; }
public string itemid { get; set; }
}
public class mItemIdOrderCount_Input
{
public string platform { get; set; }
public DateTime start { get; set; }
public DateTime end { get; set; }
public string[] itemid { get; set; }
}
}
...@@ -367,7 +367,7 @@ namespace Bailun.DC.Services ...@@ -367,7 +367,7 @@ namespace Bailun.DC.Services
tb.Columns.Add("monitorstatus"); tb.Columns.Add("monitorstatus");
tb.Columns.Add("tortstatus"); tb.Columns.Add("tortstatus");
var page = 1; var page = 1;
var pagesize = 100000; var pagesize = 10000;
var listcount = cn.QueryFirstOrDefault<int>("select count(id) from dc_base_stock"); var listcount = cn.QueryFirstOrDefault<int>("select count(id) from dc_base_stock");
var resultcount = 0; var resultcount = 0;
...@@ -440,8 +440,21 @@ namespace Bailun.DC.Services ...@@ -440,8 +440,21 @@ namespace Bailun.DC.Services
try try
{ {
var str = DataTableToCsv(tb); var str = DataTableToCsv(tb);
System.IO.File.Delete(filepath);
System.IO.File.WriteAllText(filepath, str); if (!System.IO.Directory.Exists(filepath))
{
System.IO.Directory.CreateDirectory(filepath);
}
var filename = filepath+"redundancy.csv";
if (System.IO.File.Exists(filename))
{
System.IO.File.Delete(filename);
}
System.IO.File.WriteAllText(filename, str);
MySqlBulkLoader loader = new MySqlBulkLoader(cn) MySqlBulkLoader loader = new MySqlBulkLoader(cn)
{ {
...@@ -449,14 +462,14 @@ namespace Bailun.DC.Services ...@@ -449,14 +462,14 @@ namespace Bailun.DC.Services
FieldQuotationCharacter = '"', FieldQuotationCharacter = '"',
EscapeCharacter = '"', EscapeCharacter = '"',
LineTerminator = "\r\n", LineTerminator = "\r\n",
FileName = filepath, FileName = filename,
NumberOfLinesToSkip = 0, NumberOfLinesToSkip = 0,
TableName = "dc_mid_skuwarehouse_redundancy", TableName = "dc_mid_skuwarehouse_redundancy",
}; };
var count = loader.Load(); var count = loader.Load();
System.Threading.Thread.Sleep(5 * 1000); System.Threading.Thread.Sleep(2 * 1000);
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -44,14 +44,30 @@ namespace Bailun.DC.Services ...@@ -44,14 +44,30 @@ namespace Bailun.DC.Services
left join dc_daily_sales t7 on t7.record_date = DATE_SUB(curdate(),INTERVAL 1 DAY) and t1.bailun_sku=t7.bailun_sku and t7.warehouse_code=t1.warehouse_code left join dc_daily_sales t7 on t7.record_date = DATE_SUB(curdate(),INTERVAL 1 DAY) and t1.bailun_sku=t7.bailun_sku and t7.warehouse_code=t1.warehouse_code
where 1=1 "; where 1=1 ";
var countsql = @"select count(t1.id) from dc_base_stock t1 var countsql = @"select count(t1.id) from dc_base_stock t1 ";
left join dc_base_warehouse t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku t3 on t1.bailun_sku = t3.bailun_sku #region 组装联表条件
left join dc_auto_config_sku_warehouse t4 on t4.bailun_sku = t1.bailun_sku and t4.warehouse_code = t1.warehouse_code
left join dc_sku_monitor t5 on t5.sku = t1.bailun_sku and t5.warehousecode = t1.warehouse_code if (!string.IsNullOrWhiteSpace(warehousetype) || !string.IsNullOrWhiteSpace(warehousecode)|| areaid.HasValue)
left join dc_mid_transit t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code {
left join dc_daily_sales t7 on t7.record_date = DATE_SUB(curdate(), INTERVAL 1 DAY) and t1.bailun_sku = t7.bailun_sku and t7.warehouse_code = t1.warehouse_code countsql += " left join dc_base_warehouse t2 on t1.warehouse_code = t2.warehouse_code ";
where 1 = 1 "; }
if (start.HasValue || end.HasValue || skucategory.HasValue || !string.IsNullOrWhiteSpace(skucategoryids))
{
countsql += " left join dc_base_sku t3 on t1.bailun_sku = t3.bailun_sku ";
}
if (monitorstatus.HasValue)
{
countsql += " left join dc_auto_config_sku_warehouse t4 on t4.bailun_sku = t1.bailun_sku and t4.warehouse_code = t1.warehouse_code ";
}
if(cleanstatus.HasValue|| infringestatus.HasValue|| !string.IsNullOrWhiteSpace(skutip))
{
countsql += " left join dc_sku_monitor t5 on t5.sku = t1.bailun_sku and t5.warehousecode = t1.warehouse_code ";
}
countsql += " where 1 = 1 ";
#endregion
if (!string.IsNullOrWhiteSpace(searchkey)) if (!string.IsNullOrWhiteSpace(searchkey))
{ {
...@@ -65,6 +81,11 @@ namespace Bailun.DC.Services ...@@ -65,6 +81,11 @@ namespace Bailun.DC.Services
} }
} }
if (areaid.HasValue)
{
sql += " and t2.area_id=" + areaid.Value;
countsql += " and t2.area_id=" + areaid.Value;
}
if (!string.IsNullOrWhiteSpace(warehousetype)) if (!string.IsNullOrWhiteSpace(warehousetype))
{ {
sql += " and t2.hq_type=@hq_type"; sql += " and t2.hq_type=@hq_type";
...@@ -153,11 +174,7 @@ namespace Bailun.DC.Services ...@@ -153,11 +174,7 @@ namespace Bailun.DC.Services
} }
} }
} }
if (areaid.HasValue)
{
sql += " and t2.area_id=" + areaid.Value;
countsql += " and t2.area_id=" + areaid.Value;
}
if (!string.IsNullOrEmpty(groupname)) if (!string.IsNullOrEmpty(groupname))
{ {
sql += " and t5.groupname=@groupname"; sql += " and t5.groupname=@groupname";
......
...@@ -44,7 +44,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -44,7 +44,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var total = 0; var total = 0;
var obj = service.List(request, warehousetype, areaid, warehousecode, start, end, monitorstatus, cleanstatus, infringestatus, skutip, storestart, storeend, skucategory, searchkey, skucategoryids,groupname, ref total); var obj = service.List(request, warehousetype, areaid, warehousecode, start, end, monitorstatus, cleanstatus, infringestatus, skutip, storestart, storeend, skucategory, searchkey, skucategoryids,groupname, ref total);
var countM = service.ListCount(warehousetype, areaid, warehousecode, start, end, monitorstatus, cleanstatus, infringestatus, skutip, storestart, storeend, skucategory, skucategoryids, searchkey,groupname); var countM = new Models.dc_sku_monitor();//service.ListCount(warehousetype, areaid, warehousecode, start, end, monitorstatus, cleanstatus, infringestatus, skutip, storestart, storeend, skucategory, skucategoryids, searchkey,groupname);
countM.skuname = "总计:"; countM.skuname = "总计:";
...@@ -84,7 +84,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -84,7 +84,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}); });
return JsonConvert.SerializeObject(new { total = total, rows = list,count_row = new { return JsonConvert.SerializeObject(new { total = total, rows = list,count_row = new {
skuname = "总计", skuname = "正在加载...",
usable_stock = (countM.usable_stock??0), usable_stock = (countM.usable_stock??0),
amount_stock = (countM.amount_stock??0).ToString("N2"), amount_stock = (countM.amount_stock??0).ToString("N2"),
quantity_purchase = (countM.quantity_purchase??0), quantity_purchase = (countM.quantity_purchase??0),
...@@ -106,6 +106,39 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -106,6 +106,39 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }); } });
} }
[HttpPost]
public JsonResult DataWareHouseCountJson(Models.BtTableParameter request, string warehousetype, int? areaid, string warehousecode, DateTime? start, DateTime? end, int? monitorstatus, int? cleanstatus, int? infringestatus, string skutip, int? storestart, int? storeend, int? skucategory, string searchkey, string skucategoryids, string groupname)
{
var service = new Services.SkuMonitorServices();
var countM = service.ListCount(warehousetype, areaid, warehousecode, start, end, monitorstatus, cleanstatus, infringestatus, skutip, storestart, storeend, skucategory, skucategoryids, searchkey, groupname);
countM.skuname = "总计:";
return Json(new {
count_row = new {
skuname = "总计",
usable_stock = (countM.usable_stock ?? 0),
amount_stock = (countM.amount_stock ?? 0).ToString("N2"),
quantity_purchase = (countM.quantity_purchase ?? 0),
purchase_amount = (countM.purchase_amount ?? 0).ToString("N2"),
quantity_transfer = (countM.quantity_transfer ?? 0),
amount_transit = (countM.amount_transit ?? 0).ToString("N2"),
quantity_out_stock = (countM.quantity_out_stock ?? 0),
oneday_total_sales = (countM.oneday_total_sales ?? 0),
amount_onedaysale = (countM.amount_onedaysale ?? 0).ToString("N2"),
sevenday_total_sales = (countM.sevenday_total_sales ?? 0),
fourteenday_total_sales = (countM.fourteenday_total_sales ?? 0),
thirtyday_total_sales = (countM.thirtyday_total_sales ?? 0),
sevenday_average_sales = (countM.sevenday_average_sales ?? 0).ToString("N4"),
fourteenday_average_sales = (countM.fourteenday_average_sales ?? 0).ToString("N4"),
thirtyday_average_sales = (countM.thirtyday_average_sales ?? 0),
amount_sevendaysale = (countM.amount_sevendaysale ?? 0).ToString("N2")
}
});
}
/// <summary> /// <summary>
/// Sku库存分析报表(财务) /// Sku库存分析报表(财务)
/// </summary> /// </summary>
......
...@@ -205,60 +205,61 @@ ...@@ -205,60 +205,61 @@
}) })
function list() {
var columns = [ var columns = [
{ {
field: 'id', title: '<input class="chkall" type="checkbox" onclick="selectall(this)" />',width:'30', formatter: function (idx, data) { field: 'id', title: '<input class="chkall" type="checkbox" onclick="selectall(this)" />', width: '30', formatter: function (idx, data) {
return '<input class="chkitem" type="checkbox" val="' + data.sku + "|" + data.warehouse_code+'" />'; return '<input class="chkitem" type="checkbox" val="' + data.sku + "|" + data.warehouse_code + '" />';
} }
}, },
{ {
field: 'groupname', title: '分组名称', width: '150', formatter: function (idx, data) { field: 'groupname', title: '分组名称', width: '150', formatter: function (idx, data) {
//var str = '<p class="mules" title="' + data.groupname + '">' + data.groupname + '</p>'; //var str = '<p class="mules" title="' + data.groupname + '">' + data.groupname + '</p>';
var str = '<a href="http://pro.bailuntec.com/proMgr/productMgr?groupName=' + data.groupname + '" target="_blank" >' + data.groupname + '</a>'; var str = '<a href="http://pro.bailuntec.com/proMgr/productMgr?groupName=' + data.groupname + '" target="_blank" >' + data.groupname + '</a>';
return str; return str;
} }
}, },
{ field: 'warehousetype', title: '仓库类型',width:'100' }, { field: 'warehousetype', title: '仓库类型', width: '100' },
{ field: 'warehousename', title: '仓库名称', width: '130' }, { field: 'warehousename', title: '仓库名称', width: '130' },
{ {
field: 'sku', title: 'sku', width: '100', formatter: function (idx, data) { field: 'sku', title: 'sku', width: '100', formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.sku + '">' + data.sku + '</p>'; var str = '<p class="mules" title="' + data.sku + '">' + data.sku + '</p>';
return str; return str;
} }
}, },
{ {
field: 'category_name', title: '分类', width: '180', formatter: function (idx, data) { field: 'category_name', title: '分类', width: '180', formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.category_name + '">' + data.category_name + '</p>'; var str = '<p class="mules" title="' + data.category_name + '">' + data.category_name + '</p>';
return str; return str;
} }
}, },
{ {
field: 'skuname', title: '中文名称', width: '180',iscount:true,formatter: function (idx, data) { field: 'skuname', title: '中文名称', width: '180', iscount: true, formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.skuname + '">' + data.skuname + '</p>'; var str = '<p class="mules" title="' + data.skuname + '">' + data.skuname + '</p>';
return str; return str;
} }
}, },
{ field: 'status', title: '监控状态', width: '100', sortable: true }, { field: 'status', title: '监控状态', width: '100', sortable: true },
{ field: 'clearancestatus', title: '清货状态', width: '100', sortable: true }, { field: 'clearancestatus', title: '清货状态', width: '100', sortable: true },
{ field: 'tortstatus', title: '侵权状态', width: '100', sortable: true }, { field: 'tortstatus', title: '侵权状态', width: '100', sortable: true },
{ field: 'str_skutag', title: 'sku标签', width: '120', sortable: true }, { field: 'str_skutag', title: 'sku标签', width: '120', sortable: true },
{ field: 'buyprice', title: '采购价', width: '100', sortable: true }, { field: 'buyprice', title: '采购价', width: '100', sortable: true },
{ field: 'usable_stock', title: '库存数量', width: '110', sortable: true, iscount: true }, { field: 'usable_stock', title: '库存数量', width: '110', sortable: true, iscount: true },
{ field: 'amount_stock', title: '库存金额', width: '110', sortable: true, iscount: true }, { field: 'amount_stock', title: '库存金额', width: '110', sortable: true, iscount: true },
{ field: 'quantity_purchase', title: '采购在途数量', width: '120', sortable: true, iscount: true }, { field: 'quantity_purchase', title: '采购在途数量', width: '120', sortable: true, iscount: true },
{ field: 'purchase_amount', title: '采购在途金额', width: '120', sortable: true, iscount: true }, { field: 'purchase_amount', title: '采购在途金额', width: '120', sortable: true, iscount: true },
{ field: 'quantity_transfer', title: '调拨在途数量', width: '120', sortable: true, iscount: true }, { field: 'quantity_transfer', title: '调拨在途数量', width: '120', sortable: true, iscount: true },
{ field: 'amount_transit', title: '调拨在途金额', width: '120', sortable: true, iscount: true }, { field: 'amount_transit', title: '调拨在途金额', width: '120', sortable: true, iscount: true },
{ field: 'quantity_unshipped', title: '待发货数量', width: '120', sortable: true, iscount: true }, { field: 'quantity_unshipped', title: '待发货数量', width: '120', sortable: true, iscount: true },
{ field: 'quantity_out_stock', title: '缺货数量', sortable: true, width: '110', iscount: true }, { field: 'quantity_out_stock', title: '缺货数量', sortable: true, width: '110', iscount: true },
{ field: 'oneday_total_sales', title: '昨日销量', sortable: true, width: '110', iscount: true }, { field: 'oneday_total_sales', title: '昨日销量', sortable: true, width: '110', iscount: true },
{ field: 'sevenday_average_sales', title: '近七日日均销量', width: '140', sortable: true, iscount: true }, { field: 'sevenday_average_sales', title: '近七日日均销量', width: '140', sortable: true, iscount: true },
{ field: 'fourteenday_average_sales', title: '近十四日均销量', width: '140', sortable: true, iscount: true }, { field: 'fourteenday_average_sales', title: '近十四日均销量', width: '140', sortable: true, iscount: true },
{ field: 'thirtyday_average_sales', title: '近三十日均销量', width: '140', sortable: true, iscount: true }, { field: 'thirtyday_average_sales', title: '近三十日均销量', width: '140', sortable: true, iscount: true },
{ field: 'amount_sevendaysale', title: '7天总销售额', width: '140', sortable: true, iscount: true } { field: 'amount_sevendaysale', title: '7天总销售额', width: '140', sortable: true, iscount: true }
]; ];
function list() {
var s = ''; var s = '';
...@@ -285,7 +286,9 @@ ...@@ -285,7 +286,9 @@
} }
} }
} }
} };
getCount();
} }
}); });
} }
...@@ -294,6 +297,38 @@ ...@@ -294,6 +297,38 @@
} }
} }
function getCount() {
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
$.submit({
type:'POST',
url: '@Url.Content("~/Reports/Inventory/DataWareHouseCountJson")',
paramData: $("#toolbar").serialize() + '&skucategoryids=' + s,
func: function (result) {
if (result) {
var tr = $('.fixed-table-footer').find('tr');
for (var c in columns) {
var key = columns[c].field;
if (columns[c].iscount) {
for (var v in result.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(result.count_row[v]);
break;
}
}
}
}
}
}
})
}
function listwarehouse() { function listwarehouse() {
var wtype = $('#warehousetype').val(); var wtype = $('#warehousetype').val();
var area = $('#areaid').val(); var area = $('#areaid').val();
......
...@@ -123,12 +123,12 @@ ...@@ -123,12 +123,12 @@
{ field: 'website', title: '站点', width: '80', sortable: false, iscount: true }, { field: 'website', title: '站点', width: '80', sortable: false, iscount: true },
{ {
field: 'amount_sales', title: '销售额', width: '100', sortable: true, iscount: true, formatter: function (idx, data) { field: 'amount_sales', title: '销售额', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'销售额\',\'amount_sales\',1)">' + data.amount_sales + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'销售额\',\'amount_sales\',1)">' + data.amount_sales + '</span><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'amount_sales\',\'销售额\');" title="点击查看曲线图">';
} }
}, },
{ {
field: 'order_count', title: '销售数量', width: '100', sortable: true, iscount: true, formatter: function (idx, data) { field: 'order_count', title: '销售数量', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'订单数\',\'\',0)">' + data.order_count + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'订单数\',\'\',0)">' + data.order_count + '</span><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'order_count\',\'订单数\');" title="点击查看曲线图">';
} }
}, },
{ {
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
//{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true }, //{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true },
{ {
field: 'profit_total', title: '实际利润', width: '120', sortable: true, iscount: true, formatter: function (idx, data) { field: 'profit_total', title: '实际利润', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'实际利润\',\'profit_total\',1)">' + data.profit_total + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'实际利润\',\'profit_total\',1)">' + data.profit_total + '</span><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'profit_total\',\'利润\');" title="点击查看曲线图">';
} }
}, },
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true }, { field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true },
...@@ -313,6 +313,14 @@ ...@@ -313,6 +313,14 @@
return s; return s;
} }
function ShowChart(platform, website, account, colval,title)
{
var warehousetype = $('#warehousetype').val();
var warehousecode = $('#warehousecode').val();
layer_show(platform + " " + website + " " + account + ' 曲线图', '@Url.Content("~/Reports/Orders/OrderSalesGraph?platform=")' + platform + '&website=' + website + '&sellaccount=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&titlename=' + title + '&warehousetype=' + warehousetype + '&warehousecode=' + warehousecode, '90%', '90%');
}
</script> </script>
} }

@{
ViewData["Title"] = "利润图标";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", "平台利润统计",ViewBag.platform, ViewBag.titlename + "曲线图" };
}
<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="@(ViewBag.start)" placeholder="付款开始时间" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end)" placeholder="付款结束时间" />
</div>
<div class="form-group">
<label>发货时间</label>
<input id="shipstart" name="shipstart" type="text" class="form-control" style="width:130px;" value="@(ViewBag.shipstart)" placeholder="发货开始时间" />
<span>至</span>
<input id="shipend" name="shipend" type="text" class="form-control" style="width:130px;" value="@(ViewBag.shipend)" 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>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<div id="echart-contain" style="width:100%;height:480px;">
</div>
</div>
</div>
</div>
@section scripts{
<script src="~/js/echarts.min.js"></script>
<script type="text/javascript">
var titlename = '@(ViewBag.titlename)';
$(document).ready(function () {
list();
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
laydate.render({ elem: '#shipstart' });
laydate.render({ elem: '#shipend' });
})
function list() {
var shipstart = $('#shipstart').val();
var shipend = $('#shipend').val();
var start = $('#start').val();
var end = $('#end').val();
if ((shipstart != '' || shipend != '') && (start != '' || end != '')) {
layer.alert('搜索条件不能同时选择付款时间和发货时间,只能选其一。');
return false;
}
if (start == '' && end == '' && shipstart == '' && shipend == '') {
layer.alert('请选择时间进行搜索。');
return false;
}
let load_index = layer.load();
$.submit({
type:'POST',
url: '@Url.Content("~/Reports/Orders/OrderProfitGraphJson")',
paramData: 'col=@(ViewBag.col)&platform=@(ViewBag.platform)&currency=@(ViewBag.currency)&skucategoryids=@(ViewBag.skucategoryids)&start=' + start + '&end=' + end + '&shipstart=' + shipstart + '&shipend=' + shipend,
func: function (result) {
layer.close(load_index);
if (result.success) {
var arrval = new Array();
var arrname = new Array();
for (var i = 0; i < result.data.length;i++)
{
var obj = result.data[i];
arrval.push(obj.val);
arrname.push(obj.date);
}
showchart(arrval, arrname);
}
else {
alert(result.msg);
}
}
})
}
function showchart(arrval, arrname) {
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart-contain'));
option = {
title: {
text: '@(ViewBag.platform) ' + titlename + '的曲线图'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: [titlename]
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: arrname
},
yAxis: {
type: 'value'
},
series: [
{
name: titlename,
type: 'line',
stack: '总量',
data: arrval
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
</script>
}

@{
ViewData["Title"] = "OrderSalesGraph";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", "平台销售统计", ViewBag.platform, ViewBag.titlename + "曲线图" };
}
<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="@(ViewBag.start)" placeholder="付款开始时间" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end)" 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>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<div id="echart-contain" style="width:100%;height:480px;">
</div>
</div>
</div>
</div>
@section scripts{
<script src="~/js/echarts.min.js"></script>
<script type="text/javascript">
var titlename = '@(ViewBag.titlename)';
$(document).ready(function () {
list();
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
laydate.render({ elem: '#shipstart' });
laydate.render({ elem: '#shipend' });
})
function list() {
var start = $('#start').val();
var end = $('#end').val();
if (start == '' && end == '') {
layer.alert('请选择时间进行搜索。');
return false;
}
let load_index = layer.load();
$.submit({
type:'POST',
url: '@Url.Content("~/Reports/Orders/OrderSalesGraphJson")',
paramData: 'col=@(ViewBag.col)&platform=@(ViewBag.platform)&sellaccount=@(ViewBag.sellaccount)&website=@(ViewBag.website)&skucategoryids=@(ViewBag.skucategoryids)&start=' + start + '&end=' + end +'&warehousetype=@ViewBag.warehousetype&warehousecode=@(ViewBag.warehousecode)',
func: function (result) {
layer.close(load_index);
if (result.success) {
var arrval = new Array();
var arrname = new Array();
for (var i = 0; i < result.data.length;i++)
{
var obj = result.data[i];
arrval.push(obj.val);
arrname.push(obj.date);
}
showchart(arrval, arrname);
}
else {
alert(result.msg);
}
}
})
}
function showchart(arrval, arrname) {
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById('echart-contain'));
option = {
title: {
text: '@(ViewBag.platform) ' + titlename + '的曲线图'
},
tooltip: {
trigger: 'axis'
},
legend: {
data: [titlename]
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: arrname
},
yAxis: {
type: 'value'
},
series: [
{
name: titlename,
type: 'line',
stack: '总量',
data: arrval
}
]
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option);
}
</script>
}
...@@ -112,6 +112,8 @@ ...@@ -112,6 +112,8 @@
padding-right: 30px; padding-right: 30px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg=='); background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
} }
</style> </style>
} }
@section scripts{ @section scripts{
...@@ -126,10 +128,7 @@ ...@@ -126,10 +128,7 @@
laydate.render({ elem: '#shipstart' }); laydate.render({ elem: '#shipstart' });
laydate.render({ elem: '#shipend' }); laydate.render({ elem: '#shipend' });
//var height = document.body.clientHeight;
//$("#roletable").attr("data-height", (height - 170));
list(); list();
listPlatform(); listPlatform();
...@@ -172,8 +171,8 @@ ...@@ -172,8 +171,8 @@
$('#footer').html(''); $('#footer').html('');
for (var i = 0; i < result.length-1; i++) { for (var i = 0; i < result.length-1; i++) {
var s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>'; var s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)">' + result[i].order_count + '</td>'; s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)" >' + result[i].order_count + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'订单数\',\'order_count\');" title="点击查看曲线图"></td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'0\',0)">' + result[i].amount_sales + '</td>'; s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\',0)"> ' + result[i].amount_sales + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\');" title="点击查看曲线图"></td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>'; s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>';
s += '<td>' + result[i].customerprice + '</td>'; s += '<td>' + result[i].customerprice + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>'; s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>';
...@@ -183,7 +182,7 @@ ...@@ -183,7 +182,7 @@
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'第三方仓处理费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>'; s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'第三方仓处理费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>'; s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>';
s += '<td class="alink">' + result[i].noshippingcount + '</td>'; s += '<td class="alink">' + result[i].noshippingcount + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</td>'; s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\');" title="点击查看曲线图"></td>';
s += '<td>' + result[i].profit_rate + '</td>'; s += '<td>' + result[i].profit_rate + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>'; s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>';
s += '<td>' + result[i].amount_refund_rate + '</td>'; s += '<td>' + result[i].amount_refund_rate + '</td>';
...@@ -195,8 +194,8 @@ ...@@ -195,8 +194,8 @@
var i = result.length - 1; var i = result.length - 1;
var foot_s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>'; var foot_s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)">' + result[i].order_count + '</td>'; foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)" >' + result[i].order_count + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'订单数\',\'order_count\');" title="点击查看曲线图"></td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'0\',0)">' + result[i].amount_sales + '</td>'; foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\',0)"> ' + result[i].amount_sales + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'销售额\',\'amount_sales\');" title="点击查看曲线图"></td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>'; foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>';
foot_s += '<td>' + result[i].customerprice + '</td>'; foot_s += '<td>' + result[i].customerprice + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>'; foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>';
...@@ -206,7 +205,7 @@ ...@@ -206,7 +205,7 @@
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'第三方仓处理费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>'; foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'第三方仓处理费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>'; foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>';
foot_s += '<td class="alink">' + result[i].noshippingcount + '</td>'; foot_s += '<td class="alink">' + result[i].noshippingcount + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</td>'; foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</a><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'利润\',\'profit_total\');" title="点击查看曲线图"></td>';
foot_s += '<td>' + result[i].profit_rate + '</td>'; foot_s += '<td>' + result[i].profit_rate + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>'; foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>';
foot_s += '<td>' + result[i].amount_refund_rate + '</td>'; foot_s += '<td>' + result[i].amount_refund_rate + '</td>';
...@@ -267,7 +266,8 @@ ...@@ -267,7 +266,8 @@
} }
} }
function listcategory12() { function listcategory12()
{
$.submit({ $.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")', url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '', paramData: '',
...@@ -297,6 +297,19 @@ ...@@ -297,6 +297,19 @@
return s; return s;
} }
function ShowChart(platform, title, colval) {
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
layer_show(platform + " " + title+"曲线图", '@Url.Content("~/Reports/Orders/OrderProfitGraph?platform=")' + platform + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&shipstart=' + $('#shipstart').val() + '&shipend=' + $('#shipend').val() + '&currency=' + $('#currency').val() + '&skucategoryids=' + s + '&titlename=' + title, '90%', '90%');
}
</script> </script>
} }
......
...@@ -64,7 +64,7 @@ namespace Bailun.DC.Web.Controllers ...@@ -64,7 +64,7 @@ namespace Bailun.DC.Web.Controllers
[HttpPost] [HttpPost]
public string SkuWarehouseRedundancy() public string SkuWarehouseRedundancy()
{ {
var filename = _hostingEnvironment.WebRootPath+"\\Files\\turnfile\\redundancy.csv"; var filename = _hostingEnvironment.WebRootPath+"\\Files\\turnfile\\";
var result = new Services.InventoryServices().SaveSkuWarehouseRedundancy(filename); var result = new Services.InventoryServices().SaveSkuWarehouseRedundancy(filename);
...@@ -172,5 +172,42 @@ namespace Bailun.DC.Web.Controllers ...@@ -172,5 +172,42 @@ namespace Bailun.DC.Web.Controllers
return Json(list); return Json(list);
} }
/// <summary>
/// 获取item_id时间段内的销量
/// </summary>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <param name="itemid">item_id</param>
/// <returns></returns>
[HttpPost]
public JsonResult ListItemIdOrderCount([FromBody]Models.Orders.mItemIdOrderCount_Input m)
{
if (m.itemid.Length > 1000 || m.itemid.Length==0)
{
return Json(new {
success = false,
msg = "itemid数组元素个数必须大于0个,小于1000个"
});
}
if (string.IsNullOrWhiteSpace(m.platform))
{
return Json(new
{
success = false,
msg = "平台不能为空"
});
}
var list = new Services.OrdersServices().GetItemIdOrderCount(m.platform, m.start, m.end, m.itemid);
return Json(new
{
success = true,
msg = "",
data = list
});
}
} }
} }
\ No newline at end of file
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script> <script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script>
<script src="~/js/jquery.cookie.js" type="text/javascript"></script> <script src="~/js/jquery.cookie.js" type="text/javascript"></script>
<!--常用js方法--> <!--常用js方法-->
<script src="/js/common.js?=20190613001"></script> <script src="/js/common.js?i=20190618002"></script>
@RenderSection("scripts", required: false) @RenderSection("scripts", required: false)
<script type="text/javascript"> <script type="text/javascript">
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<!--下拉选择搜索控件--> <!--下拉选择搜索控件-->
<script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script> <script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script>
<!--常用js方法--> <!--常用js方法-->
<script src="/css/js/common.js?=20190613001"></script> <script src="/css/js/common.js?i=20190618002"></script>
@RenderSection("scripts", required: false) @RenderSection("scripts", required: false)
<script type="text/javascript"> <script type="text/javascript">
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using System.Threading.Tasks; using System.Threading.Tasks;
using Bailun.ServiceFabric.Core.Extension.HttpContext; using Bailun.ServiceFabric.Core.Extension.HttpContext;
using Bailun.ServiceFabric.Extension; using Bailun.ServiceFabric.Extension;
...@@ -46,7 +48,7 @@ namespace Bailun.DC.Web ...@@ -46,7 +48,7 @@ namespace Bailun.DC.Web
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>(); services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
......
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