Commit 32de294e by guanzhenshan

调整SKU报表,解决排序问题

parent 807089e8
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models
{
public class dc_mid_sku_statistics
{
public int id { get; set; }
public string bailun_sku { get; set; }
/// <summary>
/// 库存数量
/// </summary>
public int? count_stock { get; set; }
/// <summary>
/// 库存金额
/// </summary>
public decimal? amount_stock { get; set; }
/// <summary>
/// 采购在途
/// </summary>
public int? count_onway_purchase { get; set; }
/// <summary>
/// 采购在途金额
/// </summary>
public decimal? amount_onway_purchase { get; set; }
/// <summary>
/// 调拨在途
/// </summary>
public int? count_onway_allot { get; set; }
/// <summary>
/// 调拨在途金额
/// </summary>
public decimal? amount_onway_allot { get; set; }
/// <summary>
/// 待发货
/// </summary>
public int? count_unshipping { get; set; }
/// <summary>
/// 缺货
/// </summary>
public int? count_outstock { get; set; }
/// <summary>
/// 昨日销量
/// </summary>
public int? one_day_sale_count { get; set; }
/// <summary>
/// 昨日销售额
/// </summary>
public decimal? one_day_sale_amount { get; set; }
/// <summary>
/// 7天销量
/// </summary>
public int? seven_day_sale_count { get; set; }
/// <summary>
/// 14天销售额
/// </summary>
public int? fourteen_day_sale_count { get; set; }
/// <summary>
/// 30天销售额
/// </summary>
public int? thirty_day_sale_count { get; set; }
/// <summary>
/// 最后更新时间
/// </summary>
public DateTime lastupdatetime { get; set; }
public string sku_image { get; set; }
public string category_name { get; set; }
public string sku_title_en { get; set; }
public string sku_title_cn { get; set; }
}
}
......@@ -39,11 +39,11 @@ namespace Bailun.DC.Services
/// <param name="skuname"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<Models.Stock.mSku> ListSku(BtTableParameter parameter,string sku,string skuname,ref int total)
public List<Models.dc_mid_sku_statistics> ListSku(BtTableParameter parameter,string sku,string skuname,ref int total)
{
var sqlparam = new DynamicParameters();
var sql = @"select t1.bailun_sku,t2.sku_image,t2.category_name,t2.sku_title_en,t2.sku_title_cn,t1.count_stock as usable_stock,t1.amount_stock,t1.count_onway_purchase as quantity_purchase,t1.amount_onway_purchase as purchase_amount,t1.count_onway_allot as quantity_transfer,t1.amount_onway_allot as amount_transit,t1.one_day_sale_count as oneday_total_sales,t1.one_day_sale_amount as amount_onedaysale,t1.seven_day_sale_count as sevenday_total_sales,t1.fourteen_day_sale_count as fourteenday_total_sales,t1.thirty_day_sale_count as thirtyday_total_sales";
var sql = @"select t1.bailun_sku,t2.sku_image,t2.category_name,t2.sku_title_en,t2.sku_title_cn,t1.count_stock,t1.amount_stock,t1.count_onway_purchase,t1.amount_onway_purchase,t1.count_onway_allot,t1.amount_onway_allot,t1.one_day_sale_count,t1.one_day_sale_amount,t1.seven_day_sale_count,t1.fourteen_day_sale_count,t1.thirty_day_sale_count,t1.count_unshipping,t1.count_outstock";
var sqlwhere = " from dc_mid_sku_statistics t1 join dc_base_sku t2 on t1.bailun_sku = t2.bailun_sku where 1=1 ";
......@@ -75,7 +75,7 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.Page<Models.Stock.mSku>(parameter.pageIndex, parameter.limit, sql + sqlwhere, ref total, sqlparam, "select count(*) from (select t1.bailun_sku "+sqlwhere+") tb");
var obj = cn.Page<Models.dc_mid_sku_statistics>(parameter.pageIndex, parameter.limit, sql + sqlwhere, ref total, sqlparam, "select count(*) from (select t1.bailun_sku "+sqlwhere+") tb");
return obj.AsList();
}
......@@ -88,11 +88,11 @@ namespace Bailun.DC.Services
/// <param name="sku"></param>
/// <param name="skuname"></param>
/// <returns></returns>
public Models.Stock.mSku ListSkuCount(string sku, string skuname)
public Models.dc_mid_sku_statistics ListSkuCount(string sku, string skuname)
{
var sqlparam = new DynamicParameters();
var sql = @"select sum(t1.count_stock) as usable_stock,sum(t1.amount_stock) as amount_stock,sum(t1.count_onway_purchase) as quantity_purchase,sum(t1.amount_onway_purchase) as purchase_amount,sum(t1.count_onway_allot) as quantity_transfer,sum(t1.amount_onway_allot) as amount_transit,sum(t1.one_day_sale_count) as oneday_total_sales,sum(t1.one_day_sale_amount) as amount_onedaysale,sum(t1.seven_day_sale_count) as sevenday_total_sales,sum(t1.fourteen_day_sale_count) as fourteenday_total_sales,sum(t1.thirty_day_sale_count) as thirtyday_total_sales from dc_mid_sku_statistics t1
var sql = @"select sum(t1.count_stock) as count_stock,sum(t1.amount_stock) as amount_stock,sum(t1.count_onway_purchase) as count_onway_purchase,sum(t1.amount_onway_purchase) as amount_onway_purchase,sum(t1.count_onway_allot) as count_onway_allot,sum(t1.amount_onway_allot) as amount_onway_allot,sum(t1.one_day_sale_count) as one_day_sale_count,sum(t1.one_day_sale_amount) as one_day_sale_amount,sum(t1.seven_day_sale_count) as seven_day_sale_count,sum(t1.fourteen_day_sale_count) as fourteen_day_sale_count,sum(t1.thirty_day_sale_count) as thirty_day_sale_count from dc_mid_sku_statistics t1
join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku ";
var sqlwhere = " where 1=1 ";
......@@ -115,7 +115,7 @@ join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku ";
cn.Open();
}
var obj = cn.QueryFirst<Models.Stock.mSku>(sql + sqlwhere, sqlparam);
var obj = cn.QueryFirst<Models.dc_mid_sku_statistics>(sql + sqlwhere, sqlparam);
return obj;
}
......
......@@ -28,7 +28,7 @@ namespace Bailun.DC.SkuStatistics
{
var now = DateTime.Now;
if (now.Minute == 1) //每10分钟同步一次
if (now.Minute == 1) //每1小时同步一次
{
UpdateStock();
UpdateOnWay();
......
......@@ -53,30 +53,32 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var countM = services.ListSkuCount(sku, skuname);
countM.sku_title_cn = "总计:";
countM.amount_onedaysale = Math.Round(countM.amount_onedaysale ?? 0, 2, MidpointRounding.AwayFromZero);
countM.one_day_sale_amount = Math.Round(countM.one_day_sale_amount ?? 0, 2, MidpointRounding.AwayFromZero);
countM.amount_stock = Math.Round(countM.amount_stock ?? 0, 2, MidpointRounding.AwayFromZero);
countM.amount_transit = Math.Round(countM.amount_transit ?? 0, 2, MidpointRounding.AwayFromZero);
countM.purchase_amount = Math.Round(countM.purchase_amount ?? 0, 2, MidpointRounding.AwayFromZero);
countM.amount_onway_allot = Math.Round(countM.amount_onway_allot ?? 0, 2, MidpointRounding.AwayFromZero);
countM.amount_onway_purchase = Math.Round(countM.amount_onway_purchase ?? 0, 2, MidpointRounding.AwayFromZero);
var list = obj.Select(p => new {
amount_onedaysale = p.amount_onedaysale??0,
amount_stock = p.amount_stock??0,
amount_transit = p.amount_transit??0,
amount_onway_allot = p.amount_onway_allot??0,
amount_onway_purchase = p.amount_onway_purchase??0,
p.amount_stock,
p.bailun_sku,
p.category_name,
fourteenday_total_sales = p.fourteenday_total_sales??0,
noshippingcount = p.noshippingcount??0,
nostockcount = p.nostockcount??0,
oneday_total_sales = p.oneday_total_sales??0,
purchase_amount = p.purchase_amount??0,
quantity_purchase = p.quantity_purchase??0,
quantity_transfer = p.quantity_transfer??0,
sevenday_total_sales = p.sevenday_total_sales??0,
p.count_onway_allot,
p.count_onway_purchase,
p.count_outstock,
p.count_stock,
p.count_unshipping,
p.fourteen_day_sale_count,
p.one_day_sale_amount,
p.one_day_sale_count,
p.seven_day_sale_count,
p.sku_image,
p.sku_title_cn,
p.sku_title_en,
thirtyday_total_sales = p.thirtyday_total_sales??0,
usable_stock = p.usable_stock??0,
p.thirty_day_sale_count,
});
......
......@@ -73,32 +73,32 @@
}
},
{
field: 'usable_stock', title: '库存数量', width: '110', sortable: true, iscount: true
field: 'count_stock', title: '库存数量', width: '110', sortable: true, iscount: true
},
{
field: 'amount_stock', title: '库存金额', width: '110', sortable: true, iscount: true
},
{
field: 'quantity_purchase', title: '采购在途数量', width: '130', sortable: true, iscount: true
field: 'count_onway_purchase', title: '采购在途数量', width: '130', sortable: true, iscount: true
},
{ field: 'purchase_amount', title: '采购在途金额', width: '130', sortable: true, iscount: true },
{ field: 'amount_onway_purchase', title: '采购在途金额', width: '130', sortable: true, iscount: true },
{
field: 'quantity_transfer', title: '调拨在途数量', width: '130', sortable: true, iscount: true
field: 'count_onway_allot', title: '调拨在途数量', width: '130', sortable: true, iscount: true
},
{
field: 'amount_transit', title: '调拨在途金额', width: '150', sortable: true, iscount: true
field: 'amount_onway_allot', title: '调拨在途金额', width: '150', sortable: true, iscount: true
},
{
field: 'noshippingcount', title: '待发货数量', width: '130', sortable: true, iscount: true
field: 'count_unshipping', title: '待发货数量', width: '130', sortable: true, iscount: true
},
{
field: 'nostockcount', title: '缺货数量', width: '130', sortable: true, iscount: true
field: 'count_outstock', title: '缺货数量', width: '130', sortable: true, iscount: true
},
{ field: 'oneday_total_sales', title: '昨日总销量', width: '130', sortable: true, iscount: true },
{ field: 'amount_onedaysale', title: '昨日总销售额', width: '130', sortable: true, iscount: true },
{ field: 'sevenday_total_sales', title: '七天销量', width: '100', sortable: true, iscount: true },
{ field: 'fourteenday_total_sales', title: '十四天销量', width: '120', sortable: true, iscount: true },
{ field: 'thirtyday_total_sales', title: '三十天销量', width: '130', sortable: true, iscount: true }
{ field: 'one_day_sale_count', title: '昨日总销量', width: '130', sortable: true, iscount: true },
{ field: 'one_day_sale_amount', title: '昨日总销售额', width: '130', sortable: true, iscount: true },
{ field: 'seven_day_sale_count', title: '七天销量', width: '100', sortable: true, iscount: true },
{ field: 'fourteen_day_sale_count', title: '十四天销量', width: '120', sortable: true, iscount: true },
{ field: 'thirty_day_sale_count', title: '三十天销量', width: '130', sortable: true, iscount: true }
];
var url = '@Url.Content("~/Reports/Sku/ListSkuJson")' + '?' + $("#toolbar").serialize();
......
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