Commit ebaf3055 by guanzhenshan

更新数据仓报表,平台利润统计去掉刷单数据

parent b2ac9e9c
......@@ -676,7 +676,7 @@ namespace Dapper
/// <returns></returns>
public static IEnumerable<T> Page<T>(this IDbConnection connection, int page, int pagesize, string strsql, ref int total, object parameters = null,string countsql="",int? timeout=null)
{
total = connection.ExecuteScalar<int>((string.IsNullOrEmpty(countsql)?"select count(0) from (" + strsql + ") tb1":countsql),parameters);
total = connection.ExecuteScalar<int>((string.IsNullOrEmpty(countsql)?"select count(0) from (" + strsql + ") tb1":countsql),parameters,null,2*60);
strsql += " limit " + (page - 1) * pagesize + "," + pagesize;
......
......@@ -8,4 +8,8 @@
<PackageReference Include="Dapper" Version="1.50.5" />
</ItemGroup>
<ItemGroup>
<Folder Include="OrderExport\" />
</ItemGroup>
</Project>
......@@ -34,7 +34,7 @@ namespace Bailun.DC.Models
/// <summary>
/// 监控状态
/// </summary>
public int? monitorstatus { get; set; }
public int? status { get; set; }
/// <summary>
/// 清货状态
......@@ -74,7 +74,7 @@ namespace Bailun.DC.Models
/// <summary>
/// 分类名称
/// </summary>
public string categoryname { get; set; }
public string category_name { get; set; }
/// <summary>
/// sku中文名称
......@@ -186,5 +186,9 @@ namespace Bailun.DC.Models
/// </summary>
public string groupupdateuser { get; set; }
/// <summary>
/// 未发货数
/// </summary>
public decimal? quantity_unshipped { get; set; }
}
}
......@@ -375,7 +375,7 @@ namespace Bailun.DC.Services
{
var strlimit = (((page - 1) * pagesize) + "," + pagesize);
var liststock = cn.Query<Models.Warehouse.mWarehouseRedundancy>($@"select t1.bailun_sku,t1.warehouse_code,t1.usable_stock,t2.sku_title_cn,t2.unit_price,t3.warehouse_name,t4.quantity,t5.quantity_out_stock,t6.oneday_total_sales,t6.threeday_total_sales,t6.sevenday_total_sales,t6.fourteenday_total_sales,t6.thirtyday_total_sales,t6.threeday_average_sales,t6.sevenday_average_sales,t6.fourteenday_average_sales,t6.thirtyday_average_sales,t5.quantity_purchase,t5.quantity_transfer,t2.product_code,t2.bailun_category_id,t2.bailun_category_name,t7.status as 'monitorstatus',t8.tortstatus
from dc_daily_stock t1
from dc_base_stock t1
join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code
left join dc_auto_daily_redundance t4 on t4.record_time='{DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")}' and t1.bailun_sku=t4.bailun_sku and t1.warehouse_code=t4.warehouse_code -- 仓库冗余
......@@ -383,7 +383,6 @@ namespace Bailun.DC.Services
left join dc_daily_sales t6 on t1.bailun_sku=t6.bailun_sku and t6.record_date='{DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")}' and t1.warehouse_code=t6.warehouse_code
left join dc_auto_config_sku_warehouse t7 on t7.bailun_sku=t1.bailun_sku and t7.warehouse_code=t1.warehouse_code
left join dc_sku_monitor t8 on t8.sku=t1.bailun_sku and t8.warehousecode=t1.warehouse_code
where t1.record_time='{DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")}'
limit {strlimit}", null, null, true, 30 * 60);
resultcount = liststock.AsList().Count;
......
......@@ -998,7 +998,7 @@ namespace Bailun.DC.Services
sql += " left join dc_base_oms_pick t1 on tb.bailun_order_id =t1.bailun_order_id ";
}
sql += " where tb.bailun_order_status!='Canceled'";
sql += " where tb.bailun_order_status!='Canceled' and tb.has_scalp=0 ";
//presql += " where tb.bailun_order_status!='Canceled' and tb.amount_prepaid>0";
if (!string.IsNullOrWhiteSpace(platform))
......@@ -1094,7 +1094,7 @@ namespace Bailun.DC.Services
sql += " group by bailun_order_id) t2 on tb.bailun_order_id=t2.bailun_order_id ";
sql += " where bailun_order_status!='Canceled'";
sql += " where bailun_order_status!='Canceled' and tb.has_scalp=0 ";
if (!string.IsNullOrWhiteSpace(platform))
{
......
......@@ -34,8 +34,24 @@ namespace Bailun.DC.Services
var sqlparams = new DynamicParameters();
var sql = @"select t1.*,t2.groupname from dc_datawarehouse t1 left join dc_sku_monitor t2 on t2.sku=t1.sku and t2.warehousecode=t1.warehouse_code where 1=1 ";
var countsql = "select count(t1.id) from dc_datawarehouse t1 left join dc_sku_monitor t2 on t2.sku=t1.sku and t2.warehousecode=t1.warehouse_code where 1=1 ";
var sql = @"select t2.hq_type as warehousetype,t2.warehouse_name as warehousename,t2.warehouse_code,t1.bailun_sku as sku,t3.category_id,t3.category_name,t3.sku_title_cn as skuname,(case when t4.status=0 then 1 else 2 end) monitorstatus,t5.clearancestatus,t5.tortstatus,t5.str_skutag,t3.unit_price as buyprice,t1.usable_stock,(t1.usable_stock*t3.unit_price) amount_stock,t6.quantity_purchase,(t6.quantity_purchase*t3.unit_price) as purchase_amount,t6.quantity_transfer,(t6.quantity_transfer*t3.unit_price) amount_transit,t6.quantity_out_stock,t7.oneday_total_sales,(t7.oneday_total_sales*t3.unit_price) as amount_onedaysale,t7.sevenday_total_sales,(t7.sevenday_total_sales*t3.unit_price) amount_sevendaysale,t7.fourteenday_total_sales,t7.thirtyday_total_sales,t7.sevenday_average_sales,t7.fourteenday_average_sales,t7.thirtyday_average_sales,t3.create_time as skucreatetime,t2.area_id,t2.area_name,t5.groupname,t6.quantity_unshipped
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
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
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
where 1=1 ";
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
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
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
where 1 = 1 ";
if (!string.IsNullOrWhiteSpace(searchkey))
{
......@@ -43,58 +59,58 @@ namespace Bailun.DC.Services
if (arr.Count > 0)
{
sql += " and t1.sku in @searchkey";
countsql += " and t1.sku in @searchkey";
sql += " and t1.bailun_sku in @searchkey";
countsql += " and t1.bailun_sku in @searchkey";
sqlparams.Add("searchkey", arr.ToArray());
}
}
if (!string.IsNullOrWhiteSpace(warehousetype))
{
sql += " and t1.warehousetype=@hq_type";
countsql += " and t1.warehousetype=@hq_type";
sql += " and t2.hq_type=@hq_type";
countsql += " and t2.hq_type=@hq_type";
sqlparams.Add("hq_type", warehousetype);
}
if (!string.IsNullOrWhiteSpace(warehousecode))
{
sql += " and t1.warehouse_code=@warehousecode";
countsql += " and t1.warehouse_code=@warehousecode";
sql += " and t2.warehouse_code=@warehousecode";
countsql += " and t2.warehouse_code=@warehousecode";
sqlparams.Add("warehousecode", warehousecode);
}
if (start.HasValue)
{
sql += " and t1.skucreatetime>=@start";
countsql += " and t1.skucreatetime>=@start";
sql += " and t3.create_time>=@start";
countsql += " and t3.create_time>=@start";
sqlparams.Add("start", start.Value);
}
if (end.HasValue)
{
sql += " and t1.skucreatetime<@end";
countsql += " and t1.skucreatetime<@end";
sql += " and t3.create_time<@end";
countsql += " and t3.create_time<@end";
sqlparams.Add("end", end.Value);
}
if (monitorstatus.HasValue)
{
sql += " and t1.monitorstatus=@monitorstatus";
countsql += " and t1.monitorstatus=@monitorstatus";
sql += " and t4.status=@monitorstatus";
countsql += " and t4.status=@monitorstatus";
sqlparams.Add("monitorstatus", monitorstatus.Value);
}
if (cleanstatus.HasValue)
{
sql += " and t1.clearancestatus=@clearancestatus";
countsql += " and t1.clearancestatus=@clearancestatus";
sql += " and t5.clearancestatus=@clearancestatus";
countsql += " and t5.clearancestatus=@clearancestatus";
sqlparams.Add("clearancestatus", cleanstatus.Value);
}
if (infringestatus.HasValue)
{
sql += " and t1.tortstatus=@tortstatus";
countsql += " and t1.tortstatus=@tortstatus";
sql += " and t5.tortstatus=@tortstatus";
countsql += " and t5.tortstatus=@tortstatus";
sqlparams.Add("tortstatus", infringestatus.Value);
}
if (!string.IsNullOrWhiteSpace(skutip))
{
sql += " and t1.str_skutag like @skutip";
countsql += " and t1.str_skutag like @skutip";
sql += " and t5.str_skutag like @skutip";
countsql += " and t5.str_skutag like @skutip";
sqlparams.Add("skutip", "%"+skutip+"%");
}
if (storestart.HasValue && storestart.Value>0)
......@@ -111,8 +127,8 @@ namespace Bailun.DC.Services
}
if (skucategory.HasValue)
{
sql += " and t1.category_id=@categoryid";
countsql += " and t1.category_id=@categoryid";
sql += " and t3.category_id=@categoryid";
countsql += " and t3.category_id=@categoryid";
sqlparams.Add("categoryid", skucategory.Value);
}
if (!string.IsNullOrWhiteSpace(skucategoryids))
......@@ -132,20 +148,20 @@ namespace Bailun.DC.Services
var s = string.Join(",", listcategory.Select(a => a.C_ID));
if (!string.IsNullOrEmpty(s))
{
sql += " and t1.category_id in (" + s + ")";
countsql += " and t1.category_id in (" + s + ")";
sql += " and t3.category_id in (" + s + ")";
countsql += " and t3.category_id in (" + s + ")";
}
}
}
if (areaid.HasValue)
{
sql += " and t1.area_id="+ areaid.Value;
countsql += " and t1.area_id="+areaid.Value;
sql += " and t2.area_id=" + areaid.Value;
countsql += " and t2.area_id=" + areaid.Value;
}
if (!string.IsNullOrEmpty(groupname))
{
sql += " and t2.groupname=@groupname";
countsql += " and t2.groupname=@groupname";
sql += " and t5.groupname=@groupname";
countsql += " and t5.groupname=@groupname";
sqlparams.Add("groupname", groupname);
}
......@@ -153,11 +169,7 @@ namespace Bailun.DC.Services
var ordersql = "";
if (!string.IsNullOrEmpty(request.sort))
{
ordersql += " order by t1." + request.sort + " " + request.order;
}
else
{
ordersql+= " order by t1.monitorstatus desc,t1.usable_stock desc";
ordersql += " order by " + request.sort + " " + request.order;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......@@ -167,7 +179,7 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.Page<dc_sku_monitor>(request.pageIndex, request.limit, sql+ordersql, ref total, sqlparams,countsql);
var obj = cn.Page<dc_sku_monitor>(request.pageIndex, request.limit, sql+ordersql, ref total, sqlparams,countsql,3*60);
return obj.AsList();
}
......@@ -194,7 +206,7 @@ namespace Bailun.DC.Services
{
var sqlparams = new DynamicParameters();
var sql = @"select sum(t1.usable_stock) usable_stock,sum(t1.amount_stock) amount_stock,sum(t1.quantity_purchase) quantity_purchase,sum(t1.purchase_amount) purchase_amount,sum(t1.quantity_transfer) quantity_transfer,sum(t1.amount_transit) amount_transit,sum(t1.quantity_out_stock) quantity_out_stock,sum(t1.oneday_total_sales) oneday_total_sales,sum(t1.amount_onedaysale) amount_onedaysale,sum(t1.sevenday_total_sales) sevenday_total_sales,sum(t1.fourteenday_total_sales) fourteenday_total_sales,sum(t1.thirtyday_total_sales) thirtyday_total_sales,(sum(t1.sevenday_average_sales)/count(t1.id)) sevenday_average_sales,(sum(t1.fourteenday_average_sales)/count(t1.id)) fourteenday_average_sales,(sum(t1.thirtyday_average_sales)/count(t1.id)) thirtyday_average_sales,sum(t1.amount_sevendaysale) amount_sevendaysale from dc_datawarehouse t1 left join dc_sku_monitor t2 on t2.sku=t1.sku and t2.warehousecode=t1.warehouse_code where 1=1 ";
var sql = @"select sum(t1.usable_stock) usable_stock,sum(t1.usable_stock*t3.unit_price) amount_stock,sum(t6.quantity_purchase) quantity_purchase,sum(t6.quantity_purchase*t3.unit_price) as purchase_amount,sum(t6.quantity_transfer) quantity_transfer,sum(t6.quantity_transfer*t3.unit_price) amount_transit,sum(t6.quantity_out_stock) quantity_out_stock,sum(t7.oneday_total_sales) oneday_total_sales,sum(t7.oneday_total_sales*t3.unit_price) as amount_onedaysale,sum(t7.sevenday_total_sales) sevenday_total_sales,sum(t7.sevenday_total_sales*t3.unit_price) amount_sevendaysale,sum(t7.fourteenday_total_sales) fourteenday_total_sales,sum(t7.thirtyday_total_sales) thirtyday_total_sales,sum(t7.sevenday_average_sales) sevenday_average_sales,sum(t7.fourteenday_average_sales) fourteenday_average_sales,sum(t7.thirtyday_average_sales) thirtyday_average_sales 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 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 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 where 1=1 ";
if (!string.IsNullOrWhiteSpace(searchkey))
......@@ -203,49 +215,49 @@ namespace Bailun.DC.Services
if (arr.Count > 0)
{
sql += " and t1.sku in @searchkey";
sql += " and t1.bailun_sku in @searchkey";
sqlparams.Add("searchkey", arr.ToArray());
}
}
if (!string.IsNullOrWhiteSpace(warehousetype))
{
sql += " and t1.warehousetype=@hq_type";
sql += " and t2.hq_type=@hq_type";
sqlparams.Add("hq_type", warehousetype);
}
if (!string.IsNullOrWhiteSpace(warehousecode))
{
sql += " and t1.warehouse_code=@warehousecode";
sql += " and t2.warehouse_code=@warehousecode";
sqlparams.Add("warehousecode", warehousecode);
}
if (start.HasValue)
{
sql += " and t1.skucreatetime>=@start";
sql += " and t3.create_time>=@start";
sqlparams.Add("start", start.Value);
}
if (end.HasValue)
{
sql += " and t1.skucreatetime<@end";
sql += " and t3.create_time<@end";
sqlparams.Add("end", end.Value);
}
if (monitorstatus.HasValue)
{
sql += " and t1.monitorstatus=@monitorstatus";
sql += " and t4.status=@monitorstatus";
sqlparams.Add("monitorstatus", monitorstatus.Value);
}
if (cleanstatus.HasValue)
{
sql += " and t1.clearancestatus=@clearancestatus";
sql += " and t5.clearancestatus=@clearancestatus";
sqlparams.Add("clearancestatus", cleanstatus.Value);
}
if (infringestatus.HasValue)
{
sql += " and t1.tortstatus=@tortstatus";
sql += " and t5.tortstatus=@tortstatus";
sqlparams.Add("tortstatus", infringestatus.Value);
}
if (!string.IsNullOrWhiteSpace(skutip))
{
sql += " and t1.str_skutag like @skutip";
sql += " and t5.str_skutag like @skutip";
sqlparams.Add("skutip", "%" + skutip + "%");
}
if (storestart.HasValue && storestart.Value > 0)
......@@ -260,7 +272,7 @@ namespace Bailun.DC.Services
}
if (skucategory.HasValue)
{
sql += " and t1.category_id=@categoryid";
sql += " and t3.category_id=@categoryid";
sqlparams.Add("categoryid", skucategory.Value);
}
if (!string.IsNullOrWhiteSpace(skucategoryids))
......@@ -280,17 +292,17 @@ namespace Bailun.DC.Services
var s = string.Join(",", listcategory.Select(a => a.C_ID));
if (!string.IsNullOrEmpty(s))
{
sql += " and t1.category_id in (" + s + ")";
sql += " and t3.category_id in (" + s + ")";
}
}
}
if (areaid.HasValue)
{
sql += " and area_id=" + areaid.Value;
sql += " and t2.area_id=" + areaid.Value;
}
if (!string.IsNullOrEmpty(groupname))
{
sql += " and t2.groupname=@groupname";
sql += " and t5.groupname=@groupname";
sqlparams.Add("groupname", groupname);
}
......@@ -302,7 +314,7 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.QueryFirstOrDefault<dc_sku_monitor>(sql,sqlparams);
var obj = cn.QueryFirstOrDefault<dc_sku_monitor>(sql,sqlparams,null,3*60);
return obj;
}
......
......@@ -54,9 +54,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
p.warehouse_code,
p.warehousename,
p.sku,
p.categoryname,
p.category_name,
p.skuname,
monitorstatus = (p.monitorstatus??0)==1?"正在监控":"停止监控",
status = (p.status ?? 0)==1?"正在监控":"停止监控",
clearancestatus = (p.clearancestatus??0)==1?"正在清货":"否",
tortstatus = (p.tortstatus??0)==1?"已侵权":"否",
p.str_skutag,
......@@ -80,6 +80,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
skucreatetime = p.skucreatetime.HasValue?p.skucreatetime.Value.ToString("yyyy-MM-dd HH:mm"):"",
amount_sevendaysale = (p.amount_sevendaysale??0).ToString("N2"),
groupname = string.IsNullOrEmpty(p.groupname)?"":p.groupname.Trim(),
quantity_unshipped = p.quantity_unshipped??0
});
return JsonConvert.SerializeObject(new { total = total, rows = list,count_row = new {
......
......@@ -229,8 +229,8 @@
}
},
{
field: 'categoryname', title: '分类', width: '180', formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.categoryname + '">' + data.categoryname + '</p>';
field: 'category_name', title: '分类', width: '180', formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.category_name + '">' + data.category_name + '</p>';
return str;
}
},
......@@ -240,7 +240,7 @@
return str;
}
},
{ field: 'monitorstatus', title: '监控状态', width: '100', sortable: true },
{ field: 'status', title: '监控状态', width: '100', sortable: true },
{ field: 'clearancestatus', title: '清货状态', width: '100', sortable: true },
{ field: 'tortstatus', title: '侵权状态', width: '100', sortable: true },
{ field: 'str_skutag', title: 'sku标签', width: '120', sortable: true },
......@@ -251,7 +251,7 @@
{ field: 'purchase_amount', 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: 'nosendcount', 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: 'oneday_total_sales', title: '昨日销量', sortable: true, width: '110', iscount: true },
{ field: 'sevenday_average_sales', title: '近七日日均销量', width: '140', sortable: true, iscount: true },
......
......@@ -15,5 +15,14 @@ namespace Bailun.DC.Web.Controllers
{
return View();
}
public ActionResult ExportShipOrder()
{
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