Commit 5693df86 by guanzhenshan

增加库龄字段显示

parent ed03e3f9
......@@ -1014,7 +1014,7 @@ namespace Bailun.DC.Services
public List<dc_mid_stock_date> ListStockDate(BtTableParameter parameter, string sku, string warehousetype, string warehouse,DateTime? start,DateTime? end,ref int total)
{
var sqlparam = new DynamicParameters();
var sql = "select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,sum(t1.quantity_stock) as quantity_stock,sum(t1.quantity_stock*t1.unit_price) as amount from dc_mid_stock_date t1 ";
var sql = "select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,sum(t1.quantity_stock) as quantity_stock,sum(t1.quantity_stock*t1.unit_price) as amount,stock_time from dc_mid_stock_date t1 ";
var sqlwhere = " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code ";
if (!string.IsNullOrEmpty(warehousetype))
......@@ -1046,7 +1046,7 @@ namespace Bailun.DC.Services
sqlparam.Add("end", end.Value.AddDays(1));
}
sqlwhere += " group by t1.bailun_sku,t1.warehouse_code";
sqlwhere += " group by t1.bailun_sku,t1.warehouse_code,stock_time";
var sqlsort = "";
if (!string.IsNullOrEmpty(parameter.sort))
......
......@@ -209,6 +209,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
a.warehouse_name,
quantity_stock = a.quantity_stock.ToString("N0"),
amount = a.amount.ToString("N2"),
stock_time = (DateTime.Now-a.stock_time).Days+"d"
});
......@@ -270,12 +271,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var _service = new Services.InventoryServices();
var obj = _service.ListStockDate(new BtTableParameter { limit=0}, sku, warehousetype, warehouse, start, end, ref total);
var colNames = new List<string> {"sku","仓库编码","仓库名称", "库存数量", "库存金额"};
var colNames = new List<string> {"sku","仓库编码","仓库名称", "库存数量", "库存金额","库龄(天)"};
var list = new List<string>();
foreach (var item in obj)
{
list.Add(item.bailun_sku + "|" + item.warehouse_code + "|" + item.warehouse_name + "|" + item.quantity_stock + "|" + item.amount);
list.Add(item.bailun_sku + "|" + item.warehouse_code + "|" + item.warehouse_name + "|" + item.quantity_stock + "|" + item.amount+"|"+(DateTime.Now-item.stock_time).Days+"d");
}
var guid = Guid.NewGuid().ToString();
......
......@@ -91,6 +91,7 @@
{ field: 'warehouse_name', title: '仓库名称', width: '150', iscount: true },
{ field: 'quantity_stock', title: '库存数量', width: '150', iscount: true, sortable: true },
{ field: 'amount', title: '库存金额', width: '150', iscount: true, sortable: true },
{ field: 'stock_time', title: '库龄(天)', width: '110', sortable: true}
];
var url = '@Url.Content("~/Reports/Sku/ListInventoryAgingJson")' + '?' + $("#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