Commit d5f2b12e by guanzhenshan

解决半成品进销存统计数据有误差的问题

parent 4203bcdd
...@@ -47,7 +47,7 @@ namespace Bailun.DC.DailySemiPurchaseSellStock ...@@ -47,7 +47,7 @@ namespace Bailun.DC.DailySemiPurchaseSellStock
public void Init(DateTime day, int count = 0) public void Init(DateTime day, int count = 0)
{ {
try try
{ {
var sql = ""; var sql = "";
...@@ -123,10 +123,10 @@ namespace Bailun.DC.DailySemiPurchaseSellStock ...@@ -123,10 +123,10 @@ namespace Bailun.DC.DailySemiPurchaseSellStock
} }
Console.WriteLine("在途库存done," + DateTime.Now); Console.WriteLine("在途库存done," + DateTime.Now);
temparr.AddRange(objPreStock.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code.ToUpper(), p.warehouse_name))); temparr.AddRange(objPreStock.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code, p.warehouse_name)));
temparr.AddRange(objStock.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code.ToUpper(), p.warehouse_name))); temparr.AddRange(objStock.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code, p.warehouse_name)));
temparr.AddRange(objPreOnWay.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code.ToUpper(), p.warehouse_name))); temparr.AddRange(objPreOnWay.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code, p.warehouse_name)));
temparr.AddRange(objOnWay.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code.ToUpper(), p.warehouse_name))); temparr.AddRange(objOnWay.Select(p => new Tuple<string, string, string>(p.bailun_sku.ToUpper(), p.warehouse_code, p.warehouse_name)));
temparr = temparr.Distinct().ToList(); temparr = temparr.Distinct().ToList();
} }
...@@ -151,32 +151,32 @@ namespace Bailun.DC.DailySemiPurchaseSellStock ...@@ -151,32 +151,32 @@ namespace Bailun.DC.DailySemiPurchaseSellStock
start_stock_count = 0, start_stock_count = 0,
}; };
var p = objPreStock.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_code.ToUpper() == item.Item2).FirstOrDefault(); var p = objPreStock.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_name == item.Item3);
if (p != null) if (p.Count()>0)
{ {
m.start_stock_count = p.count; m.start_stock_count = p.Sum(a=>a.count);
m.start_stock_amount = p.amount; m.start_stock_amount = p.Sum(a=>a.amount);
} }
p = objStock.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_code.ToUpper() == item.Item2).FirstOrDefault(); p = objStock.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_name == item.Item3);
if (p != null) if (p.Count()>0)
{ {
m.end_stock_count = p.count; m.end_stock_count = p.Sum(a=>a.count);
m.end_stock_amount = p.amount; m.end_stock_amount = p.Sum(a=>a.amount);
} }
p = objPreOnWay.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_code.ToUpper() == item.Item2).FirstOrDefault(); p = objPreOnWay.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_name == item.Item3);
if (p != null) if (p.Count()>0)
{ {
m.start_onway_count = p.count; m.start_onway_count = p.Sum(a=>a.count);
m.start_onway_amount = p.amount; m.start_onway_amount = p.Sum(a=>a.amount);
} }
p = objOnWay.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_code.ToUpper() == item.Item2).FirstOrDefault(); p = objOnWay.Where(a => a.bailun_sku.ToUpper() == item.Item1 && a.warehouse_name == item.Item3);
if (p != null) if (p.Count()>0)
{ {
m.end_onway_count = p.count; m.end_onway_count = p.Sum(a=>a.count);
m.end_onway_amount = p.amount; m.end_onway_amount = p.Sum(a=>a.amount);
} }
list.Add(m); list.Add(m);
...@@ -251,7 +251,7 @@ namespace Bailun.DC.DailySemiPurchaseSellStock ...@@ -251,7 +251,7 @@ namespace Bailun.DC.DailySemiPurchaseSellStock
/// <summary> /// <summary>
/// 数量 /// 数量
/// </summary> /// </summary>
public int count { get; set; } public decimal count { get; set; }
/// <summary> /// <summary>
/// 金额 /// 金额
......
...@@ -43,7 +43,7 @@ namespace Bailun.DC.Models ...@@ -43,7 +43,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 期初库存数 /// 期初库存数
/// </summary> /// </summary>
public int start_stock_count { get; set; } public decimal start_stock_count { get; set; }
/// <summary> /// <summary>
/// 期初库存金额 /// 期初库存金额
...@@ -53,7 +53,7 @@ namespace Bailun.DC.Models ...@@ -53,7 +53,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 期初在途数量 /// 期初在途数量
/// </summary> /// </summary>
public int start_onway_count { get; set; } public decimal start_onway_count { get; set; }
/// <summary> /// <summary>
/// 期初在途金额 /// 期初在途金额
...@@ -63,7 +63,7 @@ namespace Bailun.DC.Models ...@@ -63,7 +63,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 期末库存数量 /// 期末库存数量
/// </summary> /// </summary>
public int end_stock_count { get; set; } public decimal end_stock_count { get; set; }
/// <summary> /// <summary>
/// 期末库存金额 /// 期末库存金额
...@@ -73,7 +73,7 @@ namespace Bailun.DC.Models ...@@ -73,7 +73,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 期末在途数 /// 期末在途数
/// </summary> /// </summary>
public int end_onway_count { get; set; } public decimal end_onway_count { get; set; }
/// <summary> /// <summary>
/// 期末在途金额 /// 期末在途金额
...@@ -88,7 +88,7 @@ namespace Bailun.DC.Models ...@@ -88,7 +88,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 在库差异数量 /// 在库差异数量
/// </summary> /// </summary>
public int? diff_stock_count { get; set; } public decimal? diff_stock_count { get; set; }
/// <summary> /// <summary>
/// 在库差异金额 /// 在库差异金额
...@@ -98,7 +98,7 @@ namespace Bailun.DC.Models ...@@ -98,7 +98,7 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 在途差异数量 /// 在途差异数量
/// </summary> /// </summary>
public int? diff_onway_count { get; set; } public decimal? diff_onway_count { get; set; }
/// <summary> /// <summary>
/// 在途差异金额 /// 在途差异金额
...@@ -108,12 +108,12 @@ namespace Bailun.DC.Models ...@@ -108,12 +108,12 @@ namespace Bailun.DC.Models
/// <summary> /// <summary>
/// 总数量 /// 总数量
/// </summary> /// </summary>
public int count { get; set; } public decimal count { get; set; }
/// <summary> /// <summary>
/// 总金额 /// 总金额
/// </summary> /// </summary>
public int amount { get; set; } public decimal amount { get; set; }
} }
} }
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