Commit 21eac031 by guanzhenshan

增加查看库龄计算规则页面

parent 1c0c1b62
...@@ -37,5 +37,10 @@ namespace Bailun.DC.Models.Stock ...@@ -37,5 +37,10 @@ namespace Bailun.DC.Models.Stock
public decimal amount { get; set; } public decimal amount { get; set; }
/// <summary>
/// 库龄的计算依据
/// </summary>
public string basisdata_json { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Stock
{
public class mMidStockAgeJson
{
/// <summary>
/// 实时库存
/// </summary>
public int stock { get; set; }
/// <summary>
/// 采购入库数
/// </summary>
public int purchasecount { get; set; }
/// <summary>
/// 调拨入库数
/// </summary>
public int allotcount { get; set; }
/// <summary>
/// 库龄库存数
/// </summary>
public int agecount { get; set; }
/// <summary>
/// 采购单号集合
/// </summary>
public List<string> listpurchase { get; set; }
/// <summary>
/// 调拨单号集合
/// </summary>
public List<string> listallot { get; set; }
}
}
...@@ -1045,7 +1045,7 @@ namespace Bailun.DC.Services ...@@ -1045,7 +1045,7 @@ namespace Bailun.DC.Services
{ {
var sqlparam = new DynamicParameters(); 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,stock_time 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 sql = "select t1.bailun_sku,t3.sku_title_cn as sku_name,t1.warehouse_code,t1.warehouse_name,t1.stock,t3.unit_price,(t1.stock*t3.unit_price) as amount,t1.`day`,t1.warehouse_type,t1.sku_category from dc_mid_stock_age t1"; var sql = "select t1.id,t1.bailun_sku,t3.sku_title_cn as sku_name,t1.warehouse_code,t1.warehouse_name,t1.stock,t3.unit_price,(t1.stock*t3.unit_price) as amount,t1.`day`,t1.warehouse_type,t1.sku_category from dc_mid_stock_age t1";
var sqlwhere = " "; var sqlwhere = " ";
sqlwhere += " left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku "; sqlwhere += " left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku ";
...@@ -1220,6 +1220,25 @@ namespace Bailun.DC.Services ...@@ -1220,6 +1220,25 @@ namespace Bailun.DC.Services
} }
} }
/// <summary>
/// 获取库龄详情数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public dc_mid_stock_age GetStockAge(int id)
{
var sql = "select * from dc_mid_stock_age where id="+id;
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
return cn.QueryFirstOrDefault<dc_mid_stock_age>(sql);
}
}
#endregion #endregion
#region 进销存 #region 进销存
......
...@@ -241,6 +241,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -241,6 +241,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
stock_time = (DateTime.Now-a.day).Days+((DateTime.Now - a.day).Hours>0?1:0) +"d", stock_time = (DateTime.Now-a.day).Days+((DateTime.Now - a.day).Hours>0?1:0) +"d",
a.sku_name, a.sku_name,
a.sku_category, a.sku_category,
a.id,
}); });
...@@ -367,5 +368,30 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -367,5 +368,30 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
} }
/// <summary>
/// 查看库龄数据详情页面
/// </summary>
/// <param name="id">key</param>
/// <returns></returns>
public ActionResult InventoryAgingDetail(int id)
{
var obj = new Services.InventoryServices().GetStockAge(id);
var json = new Models.Stock.mMidStockAgeJson();
if (obj != null)
{
json = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.Stock.mMidStockAgeJson>(obj.basisdata_json);
}
ViewBag.m = obj;
ViewBag.d = obj != null ? ((DateTime.Now - obj.day).Days + ((DateTime.Now - obj.day).Hours > 0 ? 1 : 0) + "d") : "";
ViewBag.json = json;
return View();
}
} }
} }
\ No newline at end of file
@{
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">
<div style="line-height:40px;">
<div>@(ViewBag.m.bailun_sku+"-"+ViewBag.m.warehouse_name)</div>
<div>总库存=@(ViewBag.json.stock)</div>
<div>库龄=@(ViewBag.d)</div>
<div>库龄库存=@(ViewBag.json.stock)</div>
<div>
入库=
@("(采购入库:"+string.Join("+",ViewBag.json.listpurchase)+")+(调拨入库:"+string.Join("+",ViewBag.json.listallot)+")")
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
...@@ -135,7 +135,11 @@ ...@@ -135,7 +135,11 @@
{ field: 'warehouse_name', title: '仓库名称', width: '150', iscount: true }, { field: 'warehouse_name', title: '仓库名称', width: '150', iscount: true },
{ field: 'quantity_stock', title: '库存数量', width: '150', iscount: true, sortable: true }, { field: 'quantity_stock', title: '库存数量', width: '150', iscount: true, sortable: true },
{ field: 'amount', title: '库存金额', width: '150', iscount: true, sortable: true }, { field: 'amount', title: '库存金额', width: '150', iscount: true, sortable: true },
{ field: 'stock_time', title: '库龄(天)', width: '110', sortable: true} {
field: 'stock_time', title: '库龄(天)', width: '110', sortable: true, formatter: function (idx, data) {
return '<a href="javascript:;" onclick="ShowDetail('+data.id+')">' + data.stock_time + "</a>";
}
}
]; ];
var url = '@Url.Content("~/Reports/Sku/ListInventoryAgingJson")' + '?' + $("#toolbar").serialize(); var url = '@Url.Content("~/Reports/Sku/ListInventoryAgingJson")' + '?' + $("#toolbar").serialize();
...@@ -169,6 +173,10 @@ ...@@ -169,6 +173,10 @@
} }
} }
function ShowDetail(id) {
layer_show('库龄推算规则', '@Url.Content("~/Reports/Sku/InventoryAgingDetail?id=")'+id, '90%', '90%');
}
function listwarehouse() { function listwarehouse() {
var type = $('#warehousetype').val(); var type = $('#warehousetype').val();
......
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