Commit 00e1d47d by guanzhenshan

不合理服务增加是否合理字段,合理的sku都要增加日均销量数据

parent f4e67d9e
......@@ -5111,7 +5111,7 @@ group by currency";
/// <returns></returns>
public List<dc_mid_month_sale_putin> ListMonthSalePutin(string month,int? type)
{
var sql = $@"select t1.warehouse_type,sum(t1.count_outbound) count_outbound,sum(t1.count_outbound*t1.buyprice) amount_outbound,sum(t1.count_putin) count_putin,sum(t1.count_putin*t1.buyprice) amount_putin,sum(t1.count_putin-t1.count_outbound) count_diff,sum((t1.count_putin-t1.count_outbound)*t1.buyprice) amount_diff from dc_mid_month_sale_putin t1 where t1.`month`='{month}'
var sql = $@"select t1.warehouse_type,t1.category_simple_name,sum(t1.count_outbound) count_outbound,sum(t1.count_outbound*t1.buyprice) amount_outbound,sum(t1.count_putin) count_putin,sum(t1.count_putin*t1.buyprice) amount_putin,sum(t1.count_putin-t1.count_outbound) count_diff,sum((t1.count_putin-t1.count_outbound)*t1.buyprice) amount_diff from dc_mid_month_sale_putin t1 where t1.`month`='{month}'
";
if (type.HasValue)
{
......@@ -5125,7 +5125,14 @@ group by currency";
}
}
sql += " group by t1.warehouse_type";
if (type.HasValue && (type.Value == 1 || type.Value == 2))
{
sql += " group by t1.warehouse_type,category_simple_name";
}
else
{
sql += " group by t1.warehouse_type";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -5150,10 +5157,10 @@ group by currency";
/// <param name="type">是否筛选增加了或者减少了,1:增加了,2:减少了</param>
/// <param name="total">符合条件的总数</param>
/// <returns></returns>
public List<dc_mid_month_sale_putin_report> ListMonthSalePutinDetail(BtTableParameter parameter, string month, string warehousetype, string warehouse, int? type,int? isclear,int? isnew,int? isaims,ref int total,int isreasonable=-1)
public List<dc_mid_month_sale_putin_report> ListMonthSalePutinDetail(BtTableParameter parameter, string month, string warehousetype, string warehouse, int? type,int? isclear,int? isnew,int? isaims,ref int total,string category, int isreasonable=-1)
{
var sqlparam = new DynamicParameters();
var sql = $@"select t1.warehouse_type,t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.count_putin,(t1.count_putin*t1.buyprice) amount_putin,t1.count_outbound,(t1.count_outbound*t1.buyprice) amount_outbound,(t1.count_putin-t1.count_outbound) count_diff,((t1.count_putin-t1.count_outbound)*t1.buyprice) amount_diff,t2.is_clear,t2.is_new,t2.is_aimsorder,t2.count_usable_stock,t2.avg_sevenday_sales,t2.avg_fourteenday_sales,t2.avg_thirtyday_sales,t2.avg_sales,t2.sale_putin_id,t2.avg_weighting_day_sales,t1.category_simple_name from dc_mid_month_sale_putin t1
var sql = $@"select t1.warehouse_type,t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.count_putin,(t1.count_putin*t1.buyprice) amount_putin,t1.count_outbound,(t1.count_outbound*t1.buyprice) amount_outbound,(t1.count_putin-t1.count_outbound) count_diff,((t1.count_putin-t1.count_outbound)*t1.buyprice) amount_diff,t2.is_clear,t2.is_new,t2.is_aimsorder,t2.count_usable_stock,t2.avg_sevenday_sales,t2.avg_fourteenday_sales,t2.avg_thirtyday_sales,t2.avg_sales,t2.sale_putin_id,t2.avg_weighting_day_sales,t1.category_simple_name,t2.is_reasonable from dc_mid_month_sale_putin t1
left join dc_mid_month_sale_putin_report t2 on t1.id=t2.sale_putin_id
where t1.`month`='{month}'";
......@@ -5219,11 +5226,17 @@ group by currency";
if (isreasonable == 0) //不合理
{
sql += " and t2.id is not null ";
sql += " and t2.is_reasonable=0 ";
}
else if (isreasonable == 1) //合理
{
sql += " and t2.id is null ";
sql += " and t2.is_reasonable=1 ";
}
if (!string.IsNullOrEmpty(category))
{
sql += " and t1.category_simple_name=@category ";
sqlparam.Add("category", category);
}
......@@ -5262,7 +5275,7 @@ group by currency";
/// <param name="warehouse">仓库编码</param>
/// <param name="type">是否筛选增加了或者减少了,1:增加了,2:减少了</param>
/// <returns></returns>
public dc_mid_month_sale_putin_report ListMonthSalePutinDetailCount(string month, string warehousetype, string warehouse, int? type, int? isclear, int? isnew, int? isaims, int isreasonable = -1)
public dc_mid_month_sale_putin_report ListMonthSalePutinDetailCount(string month, string warehousetype, string warehouse, int? type, int? isclear, int? isnew, int? isaims, string category, int isreasonable = -1)
{
var sqlparam = new DynamicParameters();
var sql = $@"select sum(t1.count_putin) count_putin,sum(t1.count_putin*t1.buyprice) amount_putin,sum(t1.count_outbound) count_outbound,sum(t1.count_outbound*t1.buyprice) amount_outbound,sum(t1.count_putin-t1.count_outbound) count_diff,sum((t1.count_putin-t1.count_outbound)*t1.buyprice) amount_diff,sum(t2.count_usable_stock) count_usable_stock from dc_mid_month_sale_putin t1
......@@ -5331,11 +5344,17 @@ group by currency";
if (isreasonable == 0) //不合理
{
sql += " and t2.id is not null ";
sql += " and t2.is_reasonable=0 ";
}
else if (isreasonable == 1) //合理
{
sql += " and t2.id is null ";
sql += " and t2.is_reasonable=1 ";
}
if (!string.IsNullOrEmpty(category))
{
sql += " and t1.category_simple_name=@category ";
sqlparam.Add("category", category);
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......
......@@ -6473,6 +6473,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
obj1.Add(new dc_mid_month_sale_putin
{
warehouse_type = "总计",
category_simple_name = "",
count_outbound = obj1.Sum(a => a.count_outbound),
amount_outbound = obj1.Sum(a => a.amount_outbound),
count_putin = obj1.Sum(a => a.count_putin),
......@@ -6487,6 +6488,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
obj2.Add(new dc_mid_month_sale_putin
{
warehouse_type = "总计",
category_simple_name = "",
count_outbound = obj2.Sum(a => a.count_outbound),
amount_outbound = obj2.Sum(a => a.amount_outbound),
count_putin = obj2.Sum(a => a.count_putin),
......@@ -6501,6 +6503,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
obj3.Add(new dc_mid_month_sale_putin
{
warehouse_type = "总计",
category_simple_name = "",
count_outbound = obj3.Sum(a => a.count_outbound),
amount_outbound = obj3.Sum(a => a.amount_outbound),
count_putin = obj3.Sum(a => a.count_putin),
......@@ -6536,12 +6539,13 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="month">月份</param>
/// <param name="type">是否筛选增加了或者减少了,1:增加了,2:减少了</param>
/// <returns></returns>
public ActionResult ListUnReasonable(string warehousetype, string month,int? type,int isun=-1)
public ActionResult ListUnReasonable(string warehousetype, string month,int? type, string category, int isun=-1)
{
ViewBag.warehousetype = warehousetype;
ViewBag.month = (string.IsNullOrEmpty(month)?DateTime.Now.AddMonths(-1).ToString("yyyy-MM"):month);
ViewBag.type = type ?? -1;
ViewBag.isun = isun;
ViewBag.category = category;
return View();
}
......@@ -6559,13 +6563,13 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="isaims">是否aims下单</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string ListUnReasonableJson(BtTableParameter parameter, string month, string warehousetype,string warehouse,int? type,int? isclear,int? isnew,int? isaims,int isreasonable = -1)
public string ListUnReasonableJson(BtTableParameter parameter, string month, string warehousetype,string warehouse,int? type,int? isclear,int? isnew,int? isaims,string category, int isreasonable = -1)
{
var total = 0;
var _service = new Services.FinanceReportServices();
var obj = _service.ListMonthSalePutinDetail(parameter, month, warehousetype, warehouse, type, isclear, isnew, isaims, ref total, isreasonable);
var objCount = _service.ListMonthSalePutinDetailCount(month, warehousetype, warehouse, type, isclear, isnew, isaims,isreasonable);
var obj = _service.ListMonthSalePutinDetail(parameter, month, warehousetype, warehouse, type, isclear, isnew, isaims, ref total, category, isreasonable);
var objCount = _service.ListMonthSalePutinDetailCount(month, warehousetype, warehouse, type, isclear, isnew, isaims, category, isreasonable);
var list = obj.Select(a=> new {
a.warehouse_type,
......@@ -6590,7 +6594,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
a.avg_thirtyday_sales,
a.avg_sales,
a.avg_weighting_day_sales,
sale_putin_id = a.sale_putin_id>0?"不合理":"合理"
sale_putin_id = a.is_reasonable==0?"不合理":"合理"
});
return JsonConvert.SerializeObject(new
......@@ -6624,12 +6628,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="isaims">是否aims下单</param>
/// <param name="isreasonable">是否获取不合理数据,0:是</param>
/// <returns></returns>
public ActionResult ExportUnReasonable(string month, string warehousetype, string warehouse, int? type, int? isclear, int? isnew, int? isaims, int isreasonable = -1)
public ActionResult ExportUnReasonable(string month, string warehousetype, string warehouse, int? type, int? isclear, int? isnew, int? isaims, string category,int isreasonable = -1)
{
var total = 0;
var _service = new Services.FinanceReportServices();
var obj = _service.ListMonthSalePutinDetail(new BtTableParameter { limit=0,offset=1}, month, warehousetype, warehouse, type, isclear, isnew, isaims, ref total, isreasonable);
var obj = _service.ListMonthSalePutinDetail(new BtTableParameter { limit=0,offset=1}, month, warehousetype, warehouse, type, isclear, isnew, isaims, ref total, category, isreasonable);
var list = obj.Select(a => new {
a.warehouse_type,
......@@ -6652,7 +6656,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
a.avg_fourteenday_sales,
a.avg_thirtyday_sales,
a.avg_sales,
sale_putin_id = a.sale_putin_id > 0 ? "不合理" : "合理",
sale_putin_id = a.is_reasonable == 0 ? "不合理" : "合理",
a.category_simple_name,
a.avg_weighting_day_sales
});
......
......@@ -144,7 +144,7 @@
columns.push({ field: 'avg_sales', title: '可消耗天数', width: '110', sortable: true });
columns.push({ field: 'sale_putin_id', title: '是否合理', width: '110', sortable: true });
var url = '@Url.Content("~/Reports/Finance/ListUnReasonableJson")' + '?' + $("#toolbar").serialize();
var url = '@Url.Content("~/Reports/Finance/ListUnReasonableJson")' + '?' + $("#toolbar").serialize() +'&category=@(ViewBag.category)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
......@@ -180,7 +180,7 @@
}
function exportlist() {
window.open('@Url.Content("~/Reports/Finance/ExportUnReasonable?")' + $("#toolbar").serialize() + (@(ViewBag.isun)== 0 ? '&isreasonable=0' : ''), '_blank');
window.open('@Url.Content("~/Reports/Finance/ExportUnReasonable?")' + $("#toolbar").serialize() + (@(ViewBag.isun)== 0 ? '&isreasonable=0' : '')+'&category=@(ViewBag.category)', '_blank');
}
</script>
......
......@@ -46,6 +46,7 @@
<thead>
<tr>
<td>仓库类型</td>
<td>百伦简单分类</td>
<td>出库数量</td>
<td>出库金额</td>
<td>入库数量</td>
......@@ -61,6 +62,7 @@
<thead>
<tr>
<td>仓库类型</td>
<td>百伦简单分类</td>
<td>出库数量</td>
<td>出库金额</td>
<td>入库数量</td>
......@@ -123,7 +125,8 @@
//增加
for (var i in result.list1) {
var o = result.list1[i];
var s = '<tr><td><a href="javascript:;" onclick="showdetail(\'' + o.warehouse_type + '增加部分的明细\',\'' + m + '\',\'' + o.warehouse_type + '\',1);">' + o.warehouse_type + '</a></td>';
var s = '<tr><td><a href="javascript:;" onclick="showdetail(\'' + o.warehouse_type + '增加部分的明细\',\'' + m + '\',\'' + o.warehouse_type + '\',1,\'' + o.category_simple_name+'\');">' + o.warehouse_type + '</a></td>';
s += '<td>' + o.category_simple_name+'</td>';
s += '<td>' + o.count_outbound + '</td>';
s += '<td>' + o.amount_outbound + '</td>';
s += '<td>' + o.count_putin + '</td>';
......@@ -138,7 +141,8 @@
//减少
for (var i in result.list2) {
var o = result.list2[i];
var s = '<tr><td><a href="javascript:;" onclick="showdetail(\'' + o.warehouse_type + '减少部分的明细\',\'' + m + '\',\'' + o.warehouse_type + '\',2);">' + o.warehouse_type + '</a></td>';
var s = '<tr><td><a href="javascript:;" onclick="showdetail(\'' + o.warehouse_type + '减少部分的明细\',\'' + m + '\',\'' + o.warehouse_type + '\',2,\'' + o.category_simple_name +'\');">' + o.warehouse_type + '</a></td>';
s += '<td>' + o.category_simple_name + '</td>';
s += '<td>' + o.count_outbound + '</td>';
s += '<td>' + o.amount_outbound + '</td>';
s += '<td>' + o.count_putin + '</td>';
......@@ -158,13 +162,17 @@
})
}
function showdetail(title, month, warehousetype, type) {
function showdetail(title, month, warehousetype, type,category) {
if (warehousetype == '总计') {
return false;
}
layer_show(title, '@Url.Content("~/Reports/Finance/ListUnReasonable?month=")' + month + '&warehousetype=' + warehousetype + ((type == null || type == undefined) ? "":'&type=' + type), '95%', '95%');
if (category == undefined) {
category = '';
}
layer_show((category == '' ? "" : category+"+") + title, '@Url.Content("~/Reports/Finance/ListUnReasonable?month=")' + month + '&warehousetype=' + warehousetype + ((type == null || type == undefined) ? "" : '&type=' + type) + '&category=' + category, '95%', '95%');
}
</script>
......
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