Commit fa09b629 by wangwanchang

新增采购单、调拨单、库存、销售单、仓库、sku统计同步时间。新增半成品仓库销量统计。

parent bc7c674b
......@@ -149,5 +149,13 @@ namespace Bailun.DataCenter.Application.Allot.Dto
/// 规格
/// </summary>
public string S_SIZE { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
}
}
\ No newline at end of file
......@@ -174,5 +174,13 @@ namespace Bailun.DataCenter.Application.Order.Dto
/// 支付时间
/// </summary>
public DateTime paytime { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
}
}
\ No newline at end of file
......@@ -247,5 +247,13 @@ namespace Bailun.DataCenter.Application.Purchase.Dto
/// 规格
/// </summary>
public string S_SIZE { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Bailun.DataCenter.Core.Statistic;
using System;
namespace Bailun.DataCenter.Application.Statistic.Dto
{
......@@ -132,5 +133,13 @@ namespace Bailun.DataCenter.Application.Statistic.Dto
/// 采购价
/// </summary>
public decimal? buyprice { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Bailun.DataCenter.Core.Statistic;
using System;
namespace Bailun.DataCenter.Application.Statistic.Dto
{
......@@ -258,5 +259,13 @@ namespace Bailun.DataCenter.Application.Statistic.Dto
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ using Abp.Application.Services.Dto;
using Abp.AutoMapper;
using Bailun.DataCenter.Core.Statistic;
using System;
namespace Bailun.DataCenter.Application.Statistic.Dto
{
......@@ -143,5 +144,13 @@ namespace Bailun.DataCenter.Application.Statistic.Dto
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
}
}
\ No newline at end of file
......@@ -139,5 +139,13 @@ namespace Bailun.DataCenter.Application.Statistic.Dto
/// </summary>
/// <returns></returns>
public decimal? thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
}
}
\ No newline at end of file
......@@ -50,6 +50,14 @@ namespace Bailun.DataCenter.Application.Statistic
/// <param name="keyValue">主键值</param>
/// <returns></returns>
dc_sku_statistic GetEntity(string keyValue);
/// <summary>
/// 获取仓库下所有sku列表信息
/// </summary>
/// <param name="pagination"></param>
/// <param name="warehouse"></param>
/// <returns></returns>
IEnumerable<dc_sku_statistic> GetWarehouseChildList(Pagination pagination, string warehouse);
#endregion
#region 提交数据
......
......@@ -150,6 +150,27 @@ namespace Bailun.DataCenter.Application.Statistic
}
return _skuStatisticRepository.SingleBySql<SkuStatisticDto>(strsql.ToString(),new MySqlParameter[] {});
}
/// <summary>
/// 获取仓库下所有sku列表信息
/// </summary>
/// <param name="pagination"></param>
/// <param name="warehouse"></param>
/// <returns></returns>
public IEnumerable<dc_sku_statistic> GetWarehouseChildList(Pagination pagination,string warehouse)
{
List<dc_sku_statistic> list = new List<dc_sku_statistic>();
var waredata = _warehouseInfoAppService.GetList(new { codeorparentcode = warehouse }.ToJson()).Select(t => t.WareCode).ToList();
var querydata = _skuStatisticRepository.GetAll().Where(d=>waredata.Contains(d.warehouse_code)).Select(d=>d.Id);
int totalcount = querydata.Count();
if (totalcount > 0)
{
list = (from d in _skuStatisticRepository.GetAll() join t in querydata.OrderBy(s=>s).Skip((pagination.page-1)*pagination.rows).Take(pagination.rows) on d.Id equals t select d).ToList();
pagination.records = totalcount;
}
return list;
}
/// <summary>
/// 获取实体
/// </summary>
......
......@@ -114,6 +114,14 @@ namespace Bailun.DataCenter.Core.Allot
/// </summary>
/// <returns></returns>
public string remark { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion
}
......
......@@ -139,6 +139,15 @@ namespace Bailun.DataCenter.Core.Order
/// 支付时间
/// </summary>
public DateTime paytime { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion
}
......
......@@ -211,7 +211,14 @@ namespace Bailun.DataCenter.Core.Purchase
/// </summary>
/// <returns></returns>
public string remark { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion
}
}
\ No newline at end of file
......@@ -133,6 +133,14 @@ namespace Bailun.DataCenter.Domain.Statistic
/// </summary>
/// <returns></returns>
public decimal? thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
......
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
namespace Bailun.DataCenter.Core.Statistic
{
......@@ -130,6 +131,14 @@ namespace Bailun.DataCenter.Core.Statistic
/// 采购价
/// </summary>
public decimal buyprice { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
......
using Abp.Domain.Entities;
using System;
namespace Bailun.DataCenter.Core.Statistic
{
......@@ -259,7 +260,15 @@ namespace Bailun.DataCenter.Core.Statistic
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
......
using Abp.Domain.Entities;
using System;
namespace Bailun.DataCenter.Core.Statistic
{
......@@ -142,7 +143,14 @@ namespace Bailun.DataCenter.Core.Statistic
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
\ No newline at end of file
......@@ -92,6 +92,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 三十天总销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
......@@ -45,7 +45,7 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// <returns></returns>
public DateTime createtime { get; set; }
/// <summary>
/// 唯一id
/// 日志表主键唯一id
/// </summary>
/// <returns></returns>
public int unionid { get; set; }
......@@ -55,6 +55,16 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// </summary>
/// <returns></returns>
public StockType logtype { get; set; }
/// <summary>
/// 交易号
/// </summary>
public string order_no { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
#endregion
}
......
......@@ -127,6 +127,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 采购价
/// </summary>
public decimal buyprice { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
......@@ -96,6 +96,14 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion Model
}
......
......@@ -121,6 +121,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 订单来源
/// </summary>
public string datasource { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion Model
}
......
......@@ -176,6 +176,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
///
/// </summary>
public string remark { get; set; }
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
#endregion Model
}
......
......@@ -242,6 +242,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
......@@ -92,5 +92,14 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// </summary>
public int WaitTransferQuantity { get; set; }
#endregion
/// <summary>
/// 同步创建时间
/// </summary>
public DateTime syncreatetime { get; set; }
/// <summary>
/// 同步更新时间
/// </summary>
public DateTime synupdatetime { get; set; }
}
}
......@@ -129,6 +129,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
......@@ -113,6 +113,15 @@ namespace Bailun.DataCenter.Tasks.Entity.Dto
/// 近三十日销售额
/// </summary>
public decimal thirtydays_salesmoney { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime updatetime { get; set; }
#endregion
}
}
......@@ -175,6 +175,7 @@ namespace Bailun.DataCenter.Tasks.Entity
/// 备注
/// </summary>
public string remark { get; set; }
#endregion Model
}
}
......@@ -181,6 +181,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuAllot
skuA.createtime = item.createtime;
skuA.updatetime = item.updatetime;
skuA.remark = item.remark;
skuA.synupdatetime = DateTime.Now;
#endregion
bool rs = Db.Update(skuA);
if (rs && flag)
......@@ -213,6 +214,8 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuAllot
storage_quantity = item.storage_quantity,
createtime = item.createtime,
updatetime = item.updatetime,
syncreatetime = DateTime.Now,
synupdatetime=DateTime.Now,
remark = item.remark
#endregion
};
......
......@@ -149,6 +149,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuFbaOrder
skuO.seller = item.seller;
skuO.isfba = item.isfba;
skuO.datasource = item.datasource;
skuO.synupdatetime = DateTime.Now;
#endregion
bool rs = Db.Update(skuO);
if (rs)
......@@ -187,7 +188,9 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuFbaOrder
sellaccount = item.sellaccount,
seller = item.seller,
isfba = item.isfba,
datasource = item.datasource
datasource = item.datasource,
syncreatetime=DateTime.Now,
synupdatetime=DateTime.Now
#endregion
};
int sid = Db.Insert(skuO);
......
......@@ -150,6 +150,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuOrder
skuO.seller = item.seller;
skuO.isfba = item.isfba;
skuO.datasource = item.datasource;
skuO.synupdatetime = DateTime.Now;
#endregion
bool rs = Db.Update(skuO);
if (rs)
......@@ -188,7 +189,9 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuOrder
sellaccount = item.sellaccount,
seller = item.seller,
isfba = item.isfba,
datasource = item.datasource
datasource = item.datasource,
syncreatetime=DateTime.Now,
synupdatetime=DateTime.Now
#endregion
};
int sid = Db.Insert(skuO);
......
......@@ -169,6 +169,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuPurchase
skuP.stayallot_quantity = item.stayallot_quantity;
//createtime
skuP.updatetime = item.updatetime;
skuP.synupdatetime = DateTime.Now;
//remark;
#endregion
bool rs = Db.Update(skuP);
......@@ -222,6 +223,8 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuPurchase
skuP.createtime = item.createtime;
skuP.updatetime = item.updatetime;
skuP.remark = item.remark;
skuP.syncreatetime = DateTime.Now;
skuP.synupdatetime = DateTime.Now;
#endregion
int sid = Db.Insert(skuP);
if (sid > 0)
......
......@@ -60,9 +60,12 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
string strSql = string.Format(@"SELECT s_number,delivery_warehousecode,delivery_warehouse_name,DATE_FORMAT(paytime,'%Y-%m-%d') paytime,SUM(quantity) quantity
FROM dc_sku_order
WHERE payTime>='{0}' and payTime<'{1}' and state !=3
GROUP BY s_number,delivery_warehousecode,DATE_FORMAT(paytime,'%Y-%m-%d')",dtNow.AddDays(-30).ToShortDateString(), dtNow.ToShortDateString());
GROUP BY s_number,delivery_warehousecode,DATE_FORMAT(paytime,'%Y-%m-%d')", dtNow.AddDays(-30).ToShortDateString(), dtNow.ToShortDateString());
List<dc_sku_order> skuSOList = SqlMapper.Query<dc_sku_order>(conn, strSql).ToList();
string MaterSql = string.Format("SELECT * FROM dc_material_statistic");
List<dc_material_statistic> MaterskuSOList = SqlMapper.Query<dc_material_statistic>(conn, MaterSql).ToList();
var wareSql = string.Format("select * from dc_warehouse_info");
List<dc_warehouse_info> WareList = SqlMapper.Query<dc_warehouse_info>(conn, wareSql).ToList();
......@@ -70,6 +73,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
List<dc_sku_statistic> dssList = new List<dc_sku_statistic>();
using (IDatabase Db = new Database(conn, sqlGenerator))
{
#region 订单销量统计
if (null != skuSOList && skuSOList.Count > 0)
{
......@@ -88,7 +92,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
}
catch (Exception ex)
{
log.ErrorFormat("销量统计错误:订单号:{3},sku:{0},仓库:{1}{2}", item.s_number, item.delivery_warehousecode, item.delivery_warehouse_name, item.o_number);
log.ErrorFormat("销量统计错误:sku:{0},仓库:{1}{2}", item.s_number, item.delivery_warehousecode, item.delivery_warehouse_name);
}
string skuNumber = item.s_number;
......@@ -135,6 +139,66 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
}
}
#endregion
#region 半成品销量统计
if (null != MaterskuSOList && MaterskuSOList.Count > 0)
{
DateTime dateNow = DateTime.Now;
foreach (var item in MaterskuSOList)
{
try
{
var waremodel = WareList.FirstOrDefault(d => d.WareCode == item.warehouse_code);
if (!string.IsNullOrEmpty(waremodel.ParentWareCode) && (waremodel.IsShip == 0 || waremodel.IsEnable == 0))
{
waremodel = WareList.FirstOrDefault(d => d.WareCode == waremodel.ParentWareCode);
}
item.warehouse_code = waremodel.WareCode;
item.warehouse_name = waremodel.WareName;
}
catch (Exception ex)
{
log.ErrorFormat("半成品销量统计错误:sku:{0},仓库:{1}{2}", item.s_number, item.warehouse_code, item.warehouse_name);
}
string skuNumber = item.s_number;
string warehousecode = item.warehouse_code;
int dsaIndex = dsaList.FindIndex(t => t.s_number == skuNumber);
if (dsaIndex < 0)
{
dc_sku_active dsa = new dc_sku_active();
dsa.s_number = skuNumber;
dsaList.Add(dsa);
dsaIndex = dsaList.FindIndex(t => t.s_number == skuNumber);
}
int dssIndex = dssList.FindIndex(t => t.s_number == skuNumber && t.warehouse_code == warehousecode);
if (dssIndex < 0)
{
dc_sku_statistic dss = new dc_sku_statistic();
dss.s_number = skuNumber;
dss.warehouse_code = warehousecode;
dss.warehouse_name = item.warehouse_name;
dssList.Add(dss);
dssIndex = dssList.FindIndex(t => t.s_number == skuNumber && t.warehouse_code == warehousecode);
}
//近一日
dsaList[dsaIndex].oneday_sales +=Convert.ToInt32(item.oneday_sales);
dssList[dssIndex].oneday_sales += Convert.ToInt32(item.oneday_sales);
//近七日
dsaList[dsaIndex].sevendays_sales += Convert.ToInt32(item.sevendays_sales);
dssList[dssIndex].sevendays_sales += Convert.ToInt32(item.sevendays_sales);
//近十四日
dsaList[dsaIndex].fourteendays_sales += Convert.ToInt32(item.fourteendays_sales);
dssList[dssIndex].fourteendays_sales += Convert.ToInt32(item.fourteendays_sales);
//近三十日
dsaList[dsaIndex].thirtydays_sales += Convert.ToInt32(item.thirtydays_sales);
dssList[dssIndex].thirtydays_sales += Convert.ToInt32(item.thirtydays_sales);
}
}
#endregion
#region 增加sku当前状态表销售额信息
if (dsaList.Count > 0)
......@@ -207,12 +271,12 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
}
else
{
string img = "";
if (!string.IsNullOrEmpty(skuinfo.S_IMAGE_MAIN))
{
img = skuinfo.S_IMAGE_MAIN.Split(',')[0];
}
if (!string.IsNullOrWhiteSpace(skuinfo.S_TITLE))
{
......@@ -227,7 +291,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
item.s_categoryname = skuinfo.S_CATEGORYNAME_NEW;
}
item.s_image = img;
item.oneday_salesmoney = item.oneday_sales * buyprice;
item.sevendays_salesmoney = item.sevendays_salesmoney * buyprice;
item.fourteendays_salesmoney = item.fourteendays_sales * buyprice;
......@@ -236,7 +300,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuSales
Db.Insert(item);
}
}
}
}
#endregion
}
}
......
......@@ -43,7 +43,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
public void MaterialStatistics()
{
using(IDbConnection conn=new MySqlConnection(connString))
using (IDbConnection conn = new MySqlConnection(connString))
{
#region 半成品库存
string stocksql = string.Format(@"select * from dc_material_stock");
......@@ -59,17 +59,33 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
#endregion
#region 半成品仓库一个月销售流水跟踪
DateTime dtNow = DateTime.Now;
string MonthSql = string.Format(@"SELECT s_number,s_title,warehouse_id,warehouse_name,logtype,DATE_FORMAT(createtime,'%Y-%m-%d') createtime,SUM(stock_quantity) stock_quantity
//DateTime dtNow = DateTime.Now;
//string MonthSql = string.Format(@"SELECT s_number,s_title,warehouse_id,warehouse_name,logtype,DATE_FORMAT(createtime,'%Y-%m-%d') createtime,SUM(stock_quantity) stock_quantity
// FROM dc_material_stocklog
// WHERE createtime>='{0}' and createtime<'{1}' and logtype in(3,5)
// GROUP BY s_number,warehouse_id,logtype,DATE_FORMAT(createtime,'%Y-%m-%d')", dtNow.AddDays(-30).ToShortDateString(), dtNow.ToShortDateString());
//List<dc_material_stocklog> MonthList = SqlMapper.Query<dc_material_stocklog>(conn, MonthSql).ToList();
#endregion
#region 半成品仓库一个月销售流水跟踪
DateTime curtime = DateTime.Now;
string MonthSaleSql = string.Format(@"SELECT s_number,s_title,warehouse_id,warehouse_name,order_no,DATE_FORMAT(createtime,'%Y-%m-%d') createtime,SUM(stock_quantity) stock_quantity
FROM dc_material_stocklog
WHERE createtime>='{0}' and createtime<'{1}' and logtype in(3,5)
GROUP BY s_number,warehouse_id,logtype,DATE_FORMAT(createtime,'%Y-%m-%d')", dtNow.AddDays(-30).ToShortDateString(), dtNow.ToShortDateString());
List<dc_material_stocklog> MonthList = SqlMapper.Query<dc_material_stocklog>(conn, MonthSql).ToList();
WHERE createtime>='{0}' and createtime<'{1}' and logtype=3 group by s_number,s_title,warehouse_id,order_no,DATE_FORMAT(createtime,'%Y-%m-%d')", curtime.AddDays(-30).ToShortDateString(), curtime.ToShortDateString());
List<dc_material_stocklog> MonthSaleList = SqlMapper.Query<dc_material_stocklog>(conn, MonthSaleSql).ToList();
List<dc_material_stocklog> MonthCancelSaleList = new List<dc_material_stocklog>();
if (null != MonthSaleList && MonthSaleList.Count > 0)
{
string MonthCancelSaleSql = string.Format(@"SELECT s_number,s_title,warehouse_id,warehouse_name,order_no,stock_quantity
FROM dc_material_stocklog where logtype=5 and order_no in('{0}')", string.Join("','", MonthSaleList.Select(d => d.order_no).Distinct()));
MonthCancelSaleList = SqlMapper.Query<dc_material_stocklog>(conn, MonthCancelSaleSql).ToList();
}
#endregion
List<dc_material_statistic> dmsList = new List<dc_material_statistic>();
using(IDatabase db=new Database(conn, sqlGenerator))
using (IDatabase db = new Database(conn, sqlGenerator))
{
#region 库存
//库存
......@@ -142,10 +158,10 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
#region 一个月总销量
//一个月总销量
if (null != MonthList && MonthList.Count > 0)
if (null != MonthSaleList && MonthSaleList.Count > 0)
{
DateTime dateNow = DateTime.Now;
foreach (var item in MonthList)
foreach (var item in MonthSaleList)
{
var skuNumber = item.s_number;
var warehouseId = item.warehouse_id;
......@@ -160,49 +176,35 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
dmsList.Add(dms);
dmsIndex = dmsList.FindIndex(t => t.s_number == skuNumber && t.warehouse_id == warehouseId);
}
decimal cancelsale = (MonthCancelSaleList != null && MonthCancelSaleList.Count > 0) ? MonthCancelSaleList.Where(d => d.order_no == item.order_no && d.s_number == skuNumber && d.warehouse_id == warehouseId).Sum(d => d.stock_quantity) : 0;
#region 昨日总销量
//采购入库或者采购退货属于采购数量
if (item.logtype == StockType.生产消耗 && dateNow.AddDays(-1).Date == item.createtime.Date)
if (dateNow.AddDays(-1).Date == item.createtime.Date)
{
dmsList[dmsIndex].oneday_sales += item.stock_quantity;
}
if (item.logtype == StockType.取消生产 && dateNow.AddDays(-1).Date == item.createtime.Date)
{
dmsList[dmsIndex].oneday_sales -= item.stock_quantity;
dmsList[dmsIndex].oneday_sales -= cancelsale;
}
#endregion
#region 七天总销量
if (item.logtype == StockType.生产消耗 && dateNow.AddDays(-1).Date >= item.createtime.Date && dateNow.AddDays(-7).Date <= item.createtime.Date)
if (dateNow.AddDays(-1).Date >= item.createtime.Date && dateNow.AddDays(-7).Date <= item.createtime.Date)
{
dmsList[dmsIndex].sevendays_sales += item.stock_quantity;
}
if (item.logtype == StockType.取消生产)
{
dmsList[dmsIndex].sevendays_sales -= item.stock_quantity;
dmsList[dmsIndex].sevendays_sales -= cancelsale;
}
#endregion
#region 十四天总销量
if (item.logtype == StockType.生产消耗 && dateNow.AddDays(-1).Date >= item.createtime.Date && dateNow.AddDays(-14).Date <= item.createtime.Date)
if (dateNow.AddDays(-1).Date >= item.createtime.Date && dateNow.AddDays(-14).Date <= item.createtime.Date)
{
dmsList[dmsIndex].fourteendays_sales += item.stock_quantity;
}
if (item.logtype == StockType.取消生产)
{
dmsList[dmsIndex].fourteendays_sales -= item.stock_quantity;
dmsList[dmsIndex].fourteendays_sales -= cancelsale;
}
#endregion
#region 三十日总销量
if (item.logtype == StockType.生产消耗)
{
dmsList[dmsIndex].thirtydays_sales += item.stock_quantity;
}
if (item.logtype == StockType.取消生产)
{
dmsList[dmsIndex].thirtydays_sales -= item.stock_quantity;
}
dmsList[dmsIndex].thirtydays_sales += item.stock_quantity;
dmsList[dmsIndex].thirtydays_sales -= cancelsale;
#endregion
}
}
......@@ -225,15 +227,18 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
dms.sevendays_sales = item.sevendays_sales;
dms.fourteendays_sales = item.fourteendays_sales;
dms.thirtydays_sales = item.thirtydays_sales;
dms.updatetime = DateTime.Now;
db.Update(dms);
}
else
{
item.warehouse_code = item.warehouse_id == 2 ? "MJYS" : item.warehouse_id == 5 ? "MJYSMR" : "MJOTHER";
item.warehouse_code = (item.warehouse_id == 1 || item.warehouse_id == 2) ? "BIAT74" : item.warehouse_id == 5 ? "BIAT70" : item.warehouse_id == 7 ? "BIAT87" : "unknown";
item.createtime = DateTime.Now;
item.updatetime = DateTime.Now;
db.Insert(item);
}
}
}
}
#endregion
}
}
......
......@@ -620,6 +620,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
{
dsaR.s_title_chinese = skuinfo.S_TITLE_CHINESE;
}
dsaR.updatetime = DateTime.Now;
Db.Update(dsaR);
}
else
......@@ -638,6 +639,8 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
item.s_categoryname = string.IsNullOrEmpty(skuinfo.S_CATEGORYNAME_NEW) ? "" : skuinfo.S_CATEGORYNAME_NEW;
item.s_title = string.IsNullOrEmpty(skuinfo.S_TITLE) ? "" : skuinfo.S_TITLE;
item.s_title_chinese = string.IsNullOrEmpty(skuinfo.S_TITLE_CHINESE) ? "" : skuinfo.S_TITLE_CHINESE;
item.createtime = DateTime.Now;
item.updatetime = DateTime.Now;
Db.Insert(item);
}
}
......@@ -715,6 +718,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
{
dssR.s_title_chinese = skuinfo.S_TITLE_CHINESE;
}
dssR.updatetime = DateTime.Now;
Db.Update(dssR);
}
else
......@@ -738,6 +742,8 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStatistics
item.s_categoryname = string.IsNullOrEmpty(skuinfo.S_CATEGORYNAME_NEW) ? "" : skuinfo.S_CATEGORYNAME_NEW;
item.s_title = string.IsNullOrEmpty(skuinfo.S_TITLE) ? "" : skuinfo.S_TITLE;
item.s_title_chinese = string.IsNullOrEmpty(skuinfo.S_TITLE_CHINESE) ? "" : skuinfo.S_TITLE_CHINESE;
item.createtime = DateTime.Now;
item.updatetime = DateTime.Now;
Db.Insert(item);
}
#endregion
......
......@@ -101,7 +101,9 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStock
s_title = item.s_title,
unionid = item.unionid,
logtype=item.logtype,
createtime = DateTime.Now
createtime=item.createtime,
syncreatetime = DateTime.Now,
order_no=item.order_no
};
int sid = Db.Insert(skuA);
}
......
......@@ -138,6 +138,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStock
skuA.TransferOnWayQuantity = item.TransferOnWayQuantity;
skuA.VirtualStock = item.VirtualStock;
skuA.WaitTransferQuantity = item.WaitTransferQuantity;
skuA.synupdatetime = DateTime.Now;
bool rs = Db.Update(skuA);
if (rs)
{
......@@ -163,7 +164,9 @@ namespace Bailun.DataCenter.Tasks.Jobs.SkuStock
SupplierShipQuantity = item.SupplierShipQuantity,
TransferOnWayQuantity = item.TransferOnWayQuantity,
VirtualStock = item.VirtualStock,
WaitTransferQuantity = item.WaitTransferQuantity
WaitTransferQuantity = item.WaitTransferQuantity,
syncreatetime=DateTime.Now,
synupdatetime=DateTime.Now
};
int sid = Db.Insert(skuA);
if (sid > 0)
......
......@@ -101,6 +101,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.WarehouseStatistics
dsaR.sevendays_salesmoney = item.sevendays_salesmoney;
dsaR.fourteendays_salesmoney = item.fourteendays_salesmoney;
dsaR.thirtydays_salesmoney = item.thirtydays_salesmoney;
dsaR.updatetime = DateTime.Now;
Db.Update(dsaR);
}
else
......@@ -129,6 +130,8 @@ namespace Bailun.DataCenter.Tasks.Jobs.WarehouseStatistics
sevendays_salesmoney = item.sevendays_salesmoney,
fourteendays_salesmoney = item.fourteendays_salesmoney,
thirtydays_salesmoney = item.thirtydays_salesmoney,
createtime = DateTime.Now,
updatetime=DateTime.Now,
remark = ""
};
Db.Insert(dw);
......@@ -216,6 +219,7 @@ namespace Bailun.DataCenter.Tasks.Jobs.WarehouseStatistics
dsaN.sevendays_salesmoney = item.sevendays_salesmoney;
dsaN.fourteendays_salesmoney = item.fourteendays_salesmoney;
dsaN.thirtydays_salesmoney = item.thirtydays_salesmoney;
dsaN.updatetime = DateTime.Now;
Db.Update(dsaN);
}
else
......@@ -244,7 +248,9 @@ namespace Bailun.DataCenter.Tasks.Jobs.WarehouseStatistics
sevendays_salesmoney = item.sevendays_salesmoney,
fourteendays_salesmoney = item.fourteendays_salesmoney,
thirtydays_salesmoney = item.thirtydays_salesmoney,
remark = ""
remark = "",
createtime = DateTime.Now,
updatetime=DateTime.Now
};
Db.Insert(dw);
}
......
......@@ -28,8 +28,6 @@ namespace Bailun.DataCenter.Tasks.Jobs.WarehouseStatistics
//.EndAt(DateTime.Now.AddMinutes(1))//指定结束时间
.WithIdentity(JobName, GroupName)
//.StartNow()
//http://blog.csdn.net/a355586533/article/details/40348537
//http://cron.qqe2.com/b
.WithCronSchedule("0 30 * * * ? ")//Cron运行模式 每三十秒钟运行一次
//.WithSimpleSchedule(x => x
// .WithIntervalInMinutes(60)//多少小时执行一次
......
......@@ -144,7 +144,8 @@ namespace Bailun.DataCenter.Tasks
// isFirstRequest = false;
//} while (pageCurrent3 > 0);
//SkuStatisticsJob ss = new SkuStatisticsJob();
SkuStatisticsJob ss = new SkuStatisticsJob();
ss.SkuStatistics("");
//string skuNumber = string.Empty;
//do
//{
......
......@@ -148,6 +148,7 @@
{ label: '入库数量', name: 'storage_quantity', index: 'storage_quantity', align: 'center', sortable: true },
{ label: '创建时间', name: 'createtime', index: 'createtime', align: 'center', sortable: true },
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'center', sortable: true },
{ label: '同步时间', name: 'synupdatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......
using System.Web.Mvc;
namespace Bailun.DataCenter.Web.Areas.Statistic
{
public class CostSummaryAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "CostSummary";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
this.AreaName + "_Default",
this.AreaName + "/{controller}/{action}/{id}",
new { area = this.AreaName, controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "Bailun.DataCenter.Web.Areas." + this.AreaName + ".Controllers" }
);
}
}
}
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Optimization" />
<add namespace="Bailun.DataCenter.Web" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
\ No newline at end of file
......@@ -245,6 +245,7 @@
},
{ label: '创建时间', name: 'createtime', index: 'createtime', align: 'left', sortable: true },
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'left', sortable: true },
{ label: '同步时间', name: 'synupdatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......
......@@ -313,7 +313,8 @@
}
},
{ label: '创建时间', name: 'createtime', index: 'createtime', align: 'center', sortable: true },
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'center', sortable: true }
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'center', sortable: true },
{ label: '同步时间', name: 'synupdatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......
......@@ -166,7 +166,8 @@
{ label: '入库数量', name: 'storage_quantity', index: 'storage_quantity', width: '60px', align: 'center', sortable: true },
{ label: '待调拨数量', name: 'stayallot_quantity', index: 'stayallot_quantity', width: '60px', align: 'center', sortable: true },
{ label: '创建时间', name: 'createtime', index: 'createtime', align: 'center', sortable: true },
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'center', sortable: true }
{ label: '更新时间', name: 'updatetime', index: 'updatetime', align: 'center', sortable: true },
{ label: '同步时间', name: 'synupdatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......
......@@ -113,6 +113,27 @@ namespace Bailun.DataCenter.Web.Areas.Statistic.Controllers
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="warehousecode">仓库编码</param>
/// <returns>返回列表Json</returns>
public ActionResult GetWarehouseChildList(Pagination pagination, string warehousecode)
{
var watch = CommonHelper.TimerStart();
var data = _skuStatisticAppService.GetWarehouseChildList(pagination,warehousecode);
var jsonData = new
{
rows = data,
total = pagination.total,
page = pagination.page,
records = pagination.records,
costtime = CommonHelper.TimerEnd(watch)
};
return ToJsonResult(jsonData);
}
/// <summary>
/// 获取实体
/// </summary>
/// <param name="keyValue">主键值</param>
......
......@@ -135,6 +135,7 @@
{ label: '七天总销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'center', sortable: true },
{ label: '十四天总销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'center', sortable: true },
{ label: '三十天总销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'center', sortable: true },
{ label: '同步时间', name: 'updatetime', index: 'updatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......@@ -185,6 +186,7 @@
{ label: '近七日销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'center', sortable: true },
{ label: '近十四日销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'center', sortable: true },
{ label: '近三十日销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'center', sortable: true },
{ label: '同步时间', name: 'updatetime', index: 'updatetime', align: 'left', sortable: true },
],
caption: "库存状态",
rowNum: "1000",
......
......@@ -78,26 +78,10 @@
var $gridTable = $('#gridTable');
$gridTable.jqGrid('GridUnload');
GetGrid();
//var $gridTable = $('#gridTable');
//var waretype=$("#sel_warehouse_type").attr("data-value");
//var url = "../../Statistic/SkuStatistic/GetPageListJson";
//if (waretype == 99) {
// $gridTable.jqGrid('GridUnload');
// GetGrid();
//}
//$gridTable.jqGrid('setGridParam', {
// url: url,
// page: 1,
// postData: {
// queryJson: GetQueryJson()
// }
//}).trigger('reloadGrid');
});
$("#sel_warehouse_type").ComboBox({
//url: "/ProductManage/Product/GetDeliverId",
id: "Id",
description: "全部",
text: "TypeName",
......@@ -124,7 +108,6 @@
result = getWarehouseByType(typeId);
$("#Warehouse").ComboBox({
//url: "/PurchaseAdvice/PurchaseMonitor/GetWarehouseList",
id: "WareCode",
description: "全部仓库",
text: "WareName",
......
......@@ -270,6 +270,7 @@
{ label: '七天总销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'center', sortable: true },
{ label: '十四天总销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'left', sortable: true },
{ label: '三十天总销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'center', sortable: true },
{ label: '同步时间', name: 'updatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......@@ -296,10 +297,11 @@
subGrid: true,
subGridRowExpanded: function (subgrid_id, row_id) {
var warehousecode = $gridTable.jqGrid('getRowData', row_id)['warehouse_code'];
bindPurchaseSubGrid(subgrid_id, row_id, warehousecode);
bindAllotSubGrid(subgrid_id, row_id, warehousecode);
bindOrderSubGrid(subgrid_id, row_id, warehousecode);
bindFBAOrderSubGrid(subgrid_id, row_id, warehousecode);
//bindPurchaseSubGrid(subgrid_id, row_id, warehousecode);
//bindAllotSubGrid(subgrid_id, row_id, warehousecode);
//bindOrderSubGrid(subgrid_id, row_id, warehousecode);
//bindFBAOrderSubGrid(subgrid_id, row_id, warehousecode);
bindSkuStaticSubGrid(subgrid_id, row_id, warehousecode);
}
});
}
......@@ -506,7 +508,6 @@
shrinkToFit: true,
});
}
function bindFBAOrderSubGrid(subgrid_id, row_id, warehousecode) {
var subgrid_table_id = subgrid_id + "_f";
var subgrid_pager_id = subgrid_table_id + "_pgr";
......@@ -565,6 +566,79 @@
});
}
function bindSkuStaticSubGrid(subgrid_id, row_id, warehousecode) {
var subgrid_table_id = subgrid_id + "_sw";
var subgrid_pager_id = subgrid_table_id + "_pgr";
$("#" + subgrid_id).append("<table id='" + subgrid_table_id + "'></table><div id=" + subgrid_pager_id + "></div>");
$("#" + subgrid_table_id).jqGrid({
autowidth: true,
url: "../../Statistic/SkuStatistic/GetPageListJson",
postData: {
queryJson: JSON.stringify({ Warehouse:warehousecode})
},
datatype: "json",
height: "100%",
colModel: [
{ label: '自增编号', name: 'Id', index: 'Id', align: 'left', sortable: false, hidden: true },
{
label: 'sku编码', name: 's_number', index: 's_number', align: 'left', sortable: false,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkums(\'' + cellvalue + '\')">' + cellvalue + '</a>';
}
},
{ label: '所在仓库', name: 'warehouse_name', index: 'warehouse_name', align: 'left', sortable: false },
{ label: '主图', name: 's_image', index: 's_image', align: 'left', width: 100, sortable: false, formatter: displayImgFormatter },
{ label: '分类名称', name: 's_categoryname', index: 's_categoryname', align: 'left', sortable: false },
{ label: '英文标题', name: 's_title', index: 's_title', align: 'left', sortable: false },
{ label: '中文标题', name: 's_title_chinese', index: 's_title_chinese', align: 'left', sortable: false },
{ label: '库存总数量', name: 'stock_quantity', index: 'stock_quantity', align: 'center', sortable: true },
{ label: '库存总金额', name: 'stock_money', index: 'stock_quantity', align: 'center', sortable: true },
{
label: '采购在途数量', name: 'purchase_transit_quantity', index: 'purchase_transit_quantity', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,1,\'采购明细\')">' + cellvalue + '</a>';
}
},
{ label: '采购在途金额', name: 'purchase_transit_money', index: 'purchase_transit_money', align: 'center', sortable: true },
{
label: '调拨在途数量', name: 'allot_transit_quantity', index: 'allot_transit_quantity', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,2,\'调拨明细\')">' + cellvalue + '</a>';
}
},
{ label: '调拨在途金额', name: 'allot_transit_money', index: 'allot_transit_money', align: 'center', sortable: true },
{
label: '待发货数量', name: 'plan_shipped', index: 'plan_shipped', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,4,\'订单明细\')">' + cellvalue + '</a>';
}
},
{ label: '缺货数量', name: 'out_stock', index: 'out_stock', align: 'center', sortable: true },
{ label: '昨日总销量', name: 'oneday_sales', index: 'oneday_sales', align: 'left', sortable: true },
{ label: '昨日总销量额', name: 'oneday_salesmoney', index: 'oneday_salesmoney', align: 'left', sortable: true },
{ label: '七天总销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'left', sortable: true },
{ label: '十四天总销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'left', sortable: true },
{ label: '三十天总销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'left', sortable: true },
],
caption: "仓库明细",
rowNum: 30,
rowList: [30, 50, 100],
pager: subgrid_pager_id,
sortname: 'stock_quantity',
sortorder: 'desc',
rownumbers: true,
gridview: true,
viewrecords: true,
multiselect: false,
shrinkToFit: true,
});
}
function displayImgFormatter(cellvalue, options, rowObject) {
if (!cellvalue) return cellvalue;
var imgUrlList = cellvalue.split(',');
return "<img src='" + imgUrlList[0] + "' title='" + rowObject['Title'] + "' width='50' height='50'/>";
};
function SumStock($this, total) {
var footerData = {
"warehouse_name": "合计:",
......@@ -678,4 +752,26 @@
});
}
}
var navigateToSkuWareDetail = function (sku, warehousecode, status, type, title) {
if (!isNullOrEmpty(sku)) {
var url = '../../Purchase/SkuPurchase/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode;
//调拨
if (type === 2) {
url = '/Allot/SkuAllot/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode;
}
//销售订单
else if (type === 4) {
url = '/Order/SkuOrder/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode + '&shipstatus=1';
}
top.tablist.newTab({
id: "sku_statistics",
title: title,
closed: true,
replace: true,
icon: "fa fa-file-text-o",
url: url
});
}
}
</script>
\ No newline at end of file
......@@ -270,6 +270,7 @@
{ label: '七天总销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'center', sortable: true },
{ label: '十四天总销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'left', sortable: true },
{ label: '三十天总销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'center', sortable: true },
{ label: '同步时间', name: 'updatetime', index: 'synupdatetime', align: 'left', sortable: true },
],
rowNum: 30,
rowList: [30, 50, 100],
......@@ -296,10 +297,11 @@
subGrid: true,
subGridRowExpanded: function (subgrid_id, row_id) {
var warehousecode = $gridTable.jqGrid('getRowData', row_id)['warehouse_code'];
bindPurchaseSubGrid(subgrid_id, row_id, warehousecode);
bindAllotSubGrid(subgrid_id, row_id, warehousecode);
bindOrderSubGrid(subgrid_id, row_id, warehousecode);
bindFBAOrderSubGrid(subgrid_id, row_id, warehousecode);
//bindPurchaseSubGrid(subgrid_id, row_id, warehousecode);
//bindAllotSubGrid(subgrid_id, row_id, warehousecode);
//bindOrderSubGrid(subgrid_id, row_id, warehousecode);
//bindFBAOrderSubGrid(subgrid_id, row_id, warehousecode);
bindSkuStaticSubGrid(subgrid_id, row_id, warehousecode);
}
});
}
......@@ -565,6 +567,75 @@
});
}
function bindSkuStaticSubGrid(subgrid_id, row_id, warehousecode) {
var subgrid_table_id = subgrid_id + "_sw";
var subgrid_pager_id = subgrid_table_id + "_pgr";
$("#" + subgrid_id).append("<table id='" + subgrid_table_id + "'></table><div id=" + subgrid_pager_id + "></div>");
$("#" + subgrid_table_id).jqGrid({
autowidth: true,
url: "../../Statistic/SkuStatistic/GetWarehouseChildList",
postData: {
warehousecode: warehousecode
},
datatype: "json",
height: "100%",
colModel: [
{ label: '自增编号', name: 'Id', index: 'Id', align: 'left', sortable: false, hidden: true },
{
label: 'sku编码', name: 's_number', index: 's_number', align: 'left', sortable: false,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkums(\'' + cellvalue + '\')">' + cellvalue + '</a>';
}
},
{ label: '所在仓库', name: 'warehouse_name', index: 'warehouse_name', align: 'left', sortable: false },
{ label: '主图', name: 's_image', index: 's_image', align: 'left', width: 100, sortable: false, formatter: displayImgFormatter },
{ label: '分类名称', name: 's_categoryname', index: 's_categoryname', align: 'left', sortable: false },
{ label: '英文标题', name: 's_title', index: 's_title', align: 'left', sortable: false },
{ label: '中文标题', name: 's_title_chinese', index: 's_title_chinese', align: 'left', sortable: false },
{ label: '库存总数量', name: 'stock_quantity', index: 'stock_quantity', align: 'center', sortable: true },
{ label: '库存总金额', name: 'stock_money', index: 'stock_quantity', align: 'center', sortable: true },
{
label: '采购在途数量', name: 'purchase_transit_quantity', index: 'purchase_transit_quantity', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,1,\'采购明细\')">' + cellvalue + '</a>';
}
},
{ label: '采购在途金额', name: 'purchase_transit_money', index: 'purchase_transit_money', align: 'center', sortable: true },
{
label: '调拨在途数量', name: 'allot_transit_quantity', index: 'allot_transit_quantity', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,2,\'调拨明细\')">' + cellvalue + '</a>';
}
},
{ label: '调拨在途金额', name: 'allot_transit_money', index: 'allot_transit_money', align: 'center', sortable: true },
{
label: '待发货数量', name: 'plan_shipped', index: 'plan_shipped', align: 'center', sortable: true,
formatter: function (cellvalue, options, rowObject) {
return '<a style="color: rgb(51, 122, 183);cursor:pointer" onclick="navigateToSkuWareDetail(\'' + rowObject.s_number + '\',\'' + rowObject.warehouse_code + '\',1,4,\'订单明细\')">' + cellvalue + '</a>';
}
},
{ label: '缺货数量', name: 'out_stock', index: 'out_stock', align: 'center', sortable: true },
{ label: '昨日总销量', name: 'oneday_sales', index: 'oneday_sales', align: 'left', sortable: true },
{ label: '昨日总销量额', name: 'oneday_salesmoney', index: 'oneday_salesmoney', align: 'left', sortable: true },
{ label: '七天总销量', name: 'sevendays_sales', index: 'sevendays_sales', align: 'left', sortable: true },
{ label: '十四天总销量', name: 'fourteendays_sales', index: 'fourteendays_sales', align: 'left', sortable: true },
{ label: '三十天总销量', name: 'thirtydays_sales', index: 'thirtydays_sales', align: 'left', sortable: true },
{ label: '同步时间', name: 'updatetime', index: 'updatetime', align: 'left', sortable: true },
],
caption: "仓库明细",
rowNum: 30,
rowList: [30, 50, 100],
pager: subgrid_pager_id,
sortname: 'stock_quantity',
sortorder: 'desc',
rownumbers: true,
gridview: true,
viewrecords: true,
multiselect: false,
shrinkToFit: true,
});
}
function SumStock($this, total) {
var footerData = {
"warehouse_name": "合计:",
......@@ -615,6 +686,12 @@
}
}
function displayImgFormatter(cellvalue, options, rowObject) {
if (!cellvalue) return cellvalue;
var imgUrlList = cellvalue.split(',');
return "<img src='" + imgUrlList[0] + "' title='" + rowObject['Title'] + "' width='50' height='50'/>";
};
var navigateToDetail = function (warehousecode, status, type, title) {
if (!isNullOrEmpty(warehousecode)) {
var url = '../../Purchase/SkuPurchase/Index?warehousecode=' + warehousecode + '&status=' + status;
......@@ -678,4 +755,26 @@
});
}
}
var navigateToSkuWareDetail = function (sku, warehousecode, status, type, title) {
if (!isNullOrEmpty(sku)) {
var url = '../../Purchase/SkuPurchase/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode;
//调拨
if (type === 2) {
url = '/Allot/SkuAllot/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode;
}
//销售订单
else if (type === 4) {
url = '/Order/SkuOrder/Index?sku=' + sku + '&status=' + status + '&warehousecode=' + warehousecode + '&shipstatus=1';
}
top.tablist.newTab({
id: "sku_statistics",
title: title,
closed: true,
replace: true,
icon: "fa fa-file-text-o",
url: url
});
}
}
</script>
\ No newline at end of file
......@@ -1168,6 +1168,7 @@
<Compile Include="Areas\Allot\AllotAreaRegistration.cs" />
<Compile Include="Areas\BasicInfo\BasicInfoAreaRegistration.cs" />
<Compile Include="Areas\BasicInfo\Controllers\WarehouseInfoController.cs" />
<Compile Include="Areas\CostSummary\CostSummaryAreaRegistration.cs" />
<Compile Include="Areas\Inventory\Controllers\MaterialStockController.cs" />
<Compile Include="Areas\Inventory\InventoryAreaRegistration.cs" />
<Compile Include="Areas\Order\Controllers\SkuOrderController.cs" />
......@@ -1241,6 +1242,7 @@
<Content Include="Areas\BasicInfo\Views\WarehouseInfo\Form.cshtml" />
<Content Include="Areas\BasicInfo\Views\WarehouseInfo\Index.cshtml" />
<Content Include="Areas\Statistic\Views\WarehouseActive\WarehouseActiveNewIndex.cshtml" />
<Content Include="Areas\CostSummary\Views\web.config" />
<None Include="Properties\PublishProfiles\bailun.pms_release.pubxml" />
<None Include="Properties\PublishProfiles\BiProduct.pubxml" />
<Content Include="Views\Shared\_ReportIndex.cshtml" />
......@@ -1255,6 +1257,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Areas\CostSummary\Controllers\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bailun.DataCenter.Application\Bailun.DataCenter.Application.csproj">
......
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