Commit e21b10df by guanzhenshan

1、增加页面数据排序功能

2、增加存储仓库库存冗余分析数据的方法
3、增加sku销售分析报告获取数据的方法
parent 963161ce
......@@ -4,6 +4,9 @@ using System.Text;
namespace Bailun.DC.Models.Warehouse
{
/// <summary>
/// 仓库冗余报告
/// </summary>
public class dc_mid_skuwarehouse_redundancy
{
/// <summary>
......@@ -140,5 +143,30 @@ namespace Bailun.DC.Models.Warehouse
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// sku个数
/// </summary>
public int skucount { get; set; }
/// <summary>
/// 日销sku个数
/// </summary>
public int skusales_count { get; set; }
/// <summary>
/// 动销sku比例
/// </summary>
public decimal skusales_rate { get; set; }
/// <summary>
/// 冗余sku个数
/// </summary>
public int redundancy_sku_count { get; set; }
/// <summary>
/// 冗余sku个数比例
/// </summary>
public decimal redundancy_sku_rate { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Warehouse
{
public class dc_mid_skuwarehouse_sales
{
public int id { get; set; }
/// <summary>
///
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
///
/// </summary>
public string bailun_sku_name { get; set; }
/// <summary>
///
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
///
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
///
/// </summary>
public string warehouse_type { get; set; }
/// <summary>
///
/// </summary>
public int stock_count { get; set; }
/// <summary>
///
/// </summary>
public decimal? stock_amount { get; set; }
/// <summary>
///
/// </summary>
public DateTime sku_developtime { get; set; }
/// <summary>
///
/// </summary>
public int? aliexpress_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? aliexpress_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? amazon_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? amazon_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? fba_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? fba_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? ebay_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? ebay_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? amazon2B_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? amazon2B_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? jollychic_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? jollychic_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? joom_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? joom_saleamount { get; set;}
/// <summary>
///
/// </summary>
public int? marketing_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? marketing_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? mymall_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? mymall_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? opensky_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? opensky_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? priceminister_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? priceminister_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? qoo10_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? qoo10_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? shopee_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? shopee_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? shopify_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? shopify_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? walmart_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? walmart_saleamount { get; set; }
/// <summary>
///
/// </summary>
public int? wish_salecount { get; set; }
/// <summary>
///
/// </summary>
public decimal? wish_saleamount { get; set; }
/// <summary>
///
/// </summary>
public DateTime? day { get; set; }
/// <summary>
///
/// </summary>
public DateTime? createtime { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Warehouse
{
/// <summary>
/// 仓库维度 库存冗余分析报告
/// </summary>
public class dc_mid_warehouse_redundancy
{
public int id { get; set; }
public string warehouse_code { get; set; }
public string warehouse_name { get; set; }
public int? skucount { get; set; }
public int? productcount { get; set; }
public decimal? amount_total { get; set; }
public decimal? skusales_count { get; set; }
public decimal? skusales_rate { get; set; }
public decimal? daily_productsale_count { get; set; }
public decimal? productsale_rate { get; set; }
public decimal? dailysale_amount { get; set; }
public decimal? saleamount_rate { get; set; }
public decimal? redundancy_sku_count { get; set; }
public decimal? redundancy_sku_rate { get; set; }
public decimal? redundancy_product_count { get; set; }
public decimal? redundancy_product_rate { get; set; }
public decimal? redundancy_amount { get; set; }
public decimal? redundancy_amount_rate { get; set; }
public DateTime day { get; set; }
public DateTime createtime { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Warehouse
{
public class mWarehouseRedundancy
{
/// <summary>
/// sku编码
/// </summary>
public string bailun_sku { get; set; }
/// <summary>
/// 仓库编码
/// </summary>
public string warehouse_code { get; set; }
/// <summary>
/// sku仓库数量
/// </summary>
public int usable_stock { get; set; }
/// <summary>
/// sku中文标题
/// </summary>
public string sku_title_cn { get; set; }
/// <summary>
/// 采购价格
/// </summary>
public decimal unit_price { get; set; }
/// <summary>
/// 仓库名称
/// </summary>
public string warehouse_name { get; set; }
/// <summary>
/// 冗余数量
/// </summary>
public int? quantity { get; set; }
/// <summary>
/// 缺货数
/// </summary>
public int? quantity_out_stock { get; set; }
/// <summary>
/// 昨日销量
/// </summary>
public int? oneday_total_sales { get; set; }
/// <summary>
/// 近3天销量
/// </summary>
public int? threeday_total_sales { get; set; }
/// <summary>
/// 近7天销量
/// </summary>
public int? sevenday_total_sales { get; set; }
/// <summary>
/// 近14天销量
/// </summary>
public int? fourteenday_total_sales { get; set; }
/// <summary>
/// 近30天销量
/// </summary>
public int? thirtyday_total_sales { get; set; }
/// <summary>
/// 近3天日均销量
/// </summary>
public decimal? threeday_average_sales { get; set; }
/// <summary>
/// 近7天日均销量
/// </summary>
public decimal? sevenday_average_sales { get; set; }
/// <summary>
/// 近14天日均销量
/// </summary>
public decimal? fourteenday_average_sales { get; set; }
/// <summary>
/// 近30天日均销量
/// </summary>
public decimal? thirtyday_average_sales { get; set; }
}
}
......@@ -5,6 +5,7 @@ using Bailun.DC.Models;
using Dapper;
using MySql.Data.MySqlClient;
using System.Linq;
using Bailun.DC.Models.Warehouse;
namespace Bailun.DC.Services
{
......@@ -400,7 +401,45 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 获取仓库 库存分析报表
/// </summary>
/// <param name="request">分页信息</param>
/// <param name="warehousetype">仓库类型</param>
/// <param name="warehousecode">仓库编码</param>
/// <param name="total">符合条件的总记录数</param>
/// <returns></returns>
public List<dc_mid_warehouse_redundancy> ListWarehouseRedundancy(BtTableParameter request, string warehousetype, string warehousecode,ref int total)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var sqlparam = new DynamicParameters();
var sql = "select * from dc_mid_warehouse_redundancy t1 ";
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.hq_type=@warehousetype";
sqlparam.Add("warehousetype", warehousetype);
}
sql+= "where t1.day = '" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "'";
if (!string.IsNullOrEmpty(warehousecode))
{
sql += " and t1.warehouse_code=@code";
sqlparam.Add("code", warehousecode);
}
var obj = cn.Page<dc_mid_warehouse_redundancy>(request.pageIndex, request.limit, sql, ref total);
return obj.AsList();
}
}
}
......
......@@ -575,24 +575,24 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="end">付款结束时间</param>
/// <returns></returns>
[HttpPost]
public JsonResult PlatformProfitCountJson(string platform,DateTime? start,DateTime? end,DateTime? shipstart,DateTime? shipend)
public JsonResult PlatformProfitCountJson(string platform,DateTime? start,DateTime? end,DateTime? shipstart,DateTime? shipend,string currency)
{
var result = new List<Models.Orders.dc_base_oms_sku>();
if (shipstart.HasValue || shipend.HasValue)
{
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform, start, end, shipstart, shipend);
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform, start, end, shipstart, shipend, currency.ToUpper() == "USD");
}
else
{
result = new Services.OrdersServices().ListPlatformProfit(platform, start, end, shipstart, shipend);
result = new Services.OrdersServices().ListPlatformProfit(platform, start, end, shipstart, shipend,currency.ToUpper()=="USD");
}
if (result.Count > 0)
{
var m = new Models.Orders.dc_base_oms_sku
{
platform_type = "总计",
platform_type = "总计("+currency+")",
order_count = result.Sum(a => a.order_count),
amount_sales = result.Sum(a => a.amount_sales),
customerprice = result.Sum(a => a.customerprice) / result.Count,
......
......@@ -153,7 +153,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
public string WarehouseRedundancyJson(BtTableParameter parameter, string warehousetype, string code)
{
var total = 0;
//var obj = new Services.WareHouseServices().
var services = new Services.WareHouseServices();
var obj = services.ListWarehouseRedundancy(parameter, warehousetype, code, ref total);
return JsonConvert.SerializeObject(new {
......
......@@ -854,7 +854,10 @@
//syncListData();
$('td').click(function () {
ShowDetail(this);
if ($('#chk_showdetail').is(":checked")) {
ShowDetail(this);
}
})
GetData();
......
......@@ -11,6 +11,7 @@
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<input id="chk_showdetail" type="checkbox" checked="checked" /><label for="chk_showdetail">是否可看明细</label>
<select id="timetype" class="form-control" style="width:120px;">
<option value="1">按日的方式</option>
<option value="2">按周的方式</option>
......@@ -23,7 +24,7 @@
<select id="sel_paycompany" class="form-control" style="width:200px;">
<option value="0">百伦供应链</option>
@*<option value="1">广州百伦科技有限公司</option>
<option value="2" selected>香港百伦科技有限公司</option>*@
<option value="2" selected>香港百伦科技有限公司</option>*@
</select>
<button type="button" class="btn btn-sm btn-primary" onclick="GetData();"><i class="fa fa-search"></i>&nbsp;查询</button>
</div>
......@@ -1219,7 +1220,9 @@
//syncListData();
$(".item-row div").click(function () {
ShowDetail(this);
if ($('#chk_showdetail').is(":checked")) {
ShowDetail(this);
}
})
$('.fa1').hide();
......
......@@ -140,7 +140,7 @@
}
},
{
field: 'cost_handle_platform', title: '平台操作费', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
field: 'cost_handle_platform', title: '第三方仓处理费', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'平台操作费\',\'cost_handle_platform\',1)">' + data.cost_handle_platform + '</span>';
}
},
......
......@@ -105,7 +105,7 @@
{ field: 'cost_paypal_fee', title: 'Paypal费', width: '110', sortable: true, iscount: true },
{ field: 'cost_refund_commisson', title: '退款佣金', width: '110', sortable: true, iscount: true },
{ field: 'cost_handle_bailun', title: '处理费', width: '110', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '平台操作费', width: '110', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '第三方仓处理费', width: '110', sortable: true, iscount: true },
{ field: 'cost_tail', title: '尾程费', width: '90', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '90', sortable: true, iscount: true },
{ field: 'profit_total', title: '利润', width: '90', sortable: true, iscount: true },
......
......@@ -129,7 +129,7 @@
{ field: 'cost_paypal_fee', title: 'Paypal费用', width: '120', sortable: true, iscount: true },
{ field: 'cost_refund_commisson', title: '退款佣金费用', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_bailun', title: '处理费(百伦)', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '平台操作费', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '第三方仓处理费', width: '130', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '100', sortable: true, iscount: true },
{ field: 'cost_logistics', title: '尾程费', width: '120', sortable: true, iscount: true },
{ field: 'profit_total', title: '利润', width: '100', sortable: true, iscount: true },
......
......@@ -11,6 +11,13 @@
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>币种</label>
<select id="currency" name="currency" class="form-control">
<option value="CNY">人民币</option>
<option value="USD">美元</option>
</select>
</div>
<div class="form-group">
<label>平台类型:</label>
<select id="platform" name="platform" class="form-control">
<option value="">选择平台</option>
......@@ -60,7 +67,11 @@
<tbody id="tb">
</tbody>
<tfoot id="footer">
</tfoot>
</table>
</div>
</div>
</div>
......@@ -72,9 +83,25 @@
text-overflow: ellipsis;
}
.alink{color:cornflowerblue;cursor:pointer;}
.tablesorter-headerDesc {
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=' );
}
.tablesorter-headerAsc {
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
}
</style>
}
@section scripts{
<script src="~/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
......@@ -117,7 +144,8 @@
layer.close(lindex);
if (result && result.length > 0) {
$('#tb').html('');
for (var i = 0; i < result.length; i++) {
$('#footer').html('');
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>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)">' + result[i].order_count + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'0\',0)">' + result[i].amount_sales + '</td>';
......@@ -127,7 +155,7 @@
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'头程费\',\'cost_first\',1)">' + result[i].cost_first + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'尾程费\',\'cost_tail\',1)">' + result[i].cost_tail + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'处理费(百伦)\',\'cost_handle_bailun\',1)">' + result[i].cost_handle_bailun + '</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 + '\',\'第三方仓处理费\',\'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">' + result[i].noshippingcount + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</td>';
......@@ -137,18 +165,27 @@
$('#tb').append(s);
}
@*$('#tb').find('td').each(function () {
$(this).css('cursor', 'pointer');
var platformcode = $(this).attr('title');
if (!$(this).hasClass('platform')) {
$(this).click(function () {
layer_show(platformcode + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platformcode + '&start=' + $('#start').val() + '&end=' + $('#end').val(), '90%', '90%');
return;
})
}
})*@
$("#roletable").trigger("destroy");
$("#roletable").tablesorter();
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>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)">' + result[i].order_count + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'0\',0)">' + result[i].amount_sales + '</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 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_first\',1)">' + result[i].cost_first + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'尾程费\',\'cost_tail\',1)">' + result[i].cost_tail + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'处理费(百伦)\',\'cost_handle_bailun\',1)">' + result[i].cost_handle_bailun + '</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">' + 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>' + 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>' + result[i].amount_refund_rate + '</td>';
$('#footer').append(foot_s);
}
else {
layer.alert('没有找到相应数据!');
......
......@@ -99,8 +99,8 @@
}
},
{
field: 'cost_handle_platform', title: '平台操作费', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.website + '\',\'平台操作费\',\'cost_handle_platform\',1)">' + data.cost_handle_platform + '</span>';
field: 'cost_handle_platform', title: '第三方仓处理费', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.website + '\',\'第三方仓处理费\',\'cost_handle_platform\',1)">' + data.cost_handle_platform + '</span>';
}
},
{
......

@{
ViewData["Title"] = "仓库库存分析报告";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "库存", "库存分析报表" };
}
<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>
<select id="warehousetype" name="warehousetype" class="form-control">
<option value="">选择仓库类型</option>
<option value="国内仓">国内仓</option>
<option value="海外仓">海外仓</option>
<option value="FBA仓">FBA仓</option>
<option value="第三方仓库">第三方仓库</option>
<option value="半成品仓">半成品仓</option>
<option value="耗材仓">耗材仓</option>
</select>
</div>
<div class="form-group">
<label>仓库:</label>
<select id="warehousecode" name="warehousecode" class="form-control" style="width:160px;">
<option value="">选择仓库</option>
</select>
</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">
<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 () {
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 160));
list();
listwarehouse();
$('#warehousetype').change(function () {
listwarehouse();
})
})
function list() {
var columns = [
{
field: 'warehouse_name', title: '仓库名称', width: '190', sortable: false, iscount: true
},
{
field: 'skucount', title: 'Sku总个数', width: '120', sortable: true, iscount: true
},
{
field: 'productcount', title: '产品个数', width: '110', sortable: true, iscount: true
},
{
field: 'amount_total', title: '总金额', width: '130', sortable: true, iscount: true
},
{ field: 'skusales_count', title: '日销sku个数', width: '130', sortable: true, iscount: true },
{
field: 'skusales_rate', title: '动销sku比例', width: '130', sortable: true, iscount: true
},
{
field: 'daily_productsale_count', title: '日销产品个数', width: '150', sortable: true, iscount: true
},
{
field: 'productsale_rate', title: '动销产品比例', width: '130', sortable: true, iscount: true
},
{
field: 'dailysale_amount', title: '日销金额', width: '130', sortable: true, iscount: true
},
{ field: 'saleamount_rate', title: '动销金额比例', width: '130', sortable: true, iscount: true },
{ field: 'redundancy_sku_count', title: '冗余sku个数', width: '130', sortable: true, iscount: true },
{ field: 'redundancy_sku_rate', title: '冗余sku个数比例', width: '100', sortable: true, iscount: true },
{ field: 'redundancy_product_count', title: '冗余产品个数', width: '120', sortable: true, iscount: true },
{ field: 'redundancy_product_rate', title: '冗余产品个数比例', width: '130', sortable: true, iscount: true },
{ field: 'redundancy_amount', title: '冗余金额', width: '100', sortable: true, iscount: true },
{ field: 'redundancy_amount_rate', title: '冗余金额比例', width: '130', sortable: true, iscount: true },
];
var url = '@Url.Content("~/Reports/Warehouse/LogicWarehouseJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, loadsuccess: function (d) {
//替换汇总行的相关列值
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 d.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
break;
}
}
}
}
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function listwarehouse() {
var type = $('#warehousetype').val();
$.submit({
url: '@Url.Content("~/Home/ListWarehouseFromStockAndSales")',
paramData: 'warehousetype=' + type,
type:'POST',
func: function (result) {
if (result != null && result != undefined) {
$('#warehousecode').html('<option value="">仓库不限</option>');
for (var i = 0; i < result.length; i++) {
$('#warehousecode').append('<option value="' + result[i].warehouse_code + '">' + result[i].warehouse_name + '</option>');
}
}
}
})
}
function SkuDetail(code) {
layer_show('Sku仓库', '@Url.Content("~/Reports/Warehouse/ListWareHouseSku?code=")' + code,'90%','90%');
}
</script>
}
......@@ -2,12 +2,19 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
namespace Bailun.DC.Web.Controllers
{
public class ApiController : Controller
{
private readonly IHostingEnvironment _hostingEnvironment;
public ApiController(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public IActionResult Index()
{
return View();
......@@ -54,9 +61,26 @@ namespace Bailun.DC.Web.Controllers
/// 保存仓库冗余记录
/// </summary>
/// <returns></returns>
[HttpPost]
public string SkuWarehouseRedundancy()
{
var result = new Services.InventoryServices().SaveSkuWarehouseRedundancy();
var filename = _hostingEnvironment.WebRootPath+"\\Files\\turnfile\\redundancy.csv";
var result = new Services.InventoryServices().SaveSkuWarehouseRedundancy(filename);
return result;
}
/// <summary>
/// 保存仓库sku销售额+销量数据
/// </summary>
/// <returns></returns>
[HttpPost]
public string SkuWarehouseSales()
{
var filename = _hostingEnvironment.WebRootPath + "\\Files\\turnfile\\skusales.csv";
var result = new Services.InventoryServices().SaveSkuWarehouseSales(filename);
return result;
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Bailun.DC.Web.Controllers
{
/// <summary>
/// 数据导出中心
/// </summary>
public class DownloadController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
\ No newline at end of file
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