Commit 9ae1eb18 by lizefeng

采购建议推单的时候 如果遇到同仓库重复的sku,则合并推送

parent 8f00bdad
......@@ -12,6 +12,8 @@ namespace AutoGeneratePurchaseAdvise
static async Task Main(string[] args)
{
Console.WriteLine("采购建议计算任务启动...");
//PurchaseAdviseServices.AutoPushBuySys(1);
//PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.AutoPushBuySys(5);
// 创建采购计划
......
......@@ -136,12 +136,12 @@ namespace AutoTurnOver.Services
bp_remark = $"用户{user.UserName} 在 aims 操作推送"
};
data.bi_buyplandetail = item.Select(s => new bi_buyplandetail
data.bi_buyplandetail = item.GroupBy(s=>s.bailun_sku).Select(s => new bi_buyplandetail
{
bd_count = s.quantity_actual > 0 ? s.quantity_actual : s.quantity_final_advise,
bd_price = s.unit_price,
bd_sku = s.bailun_sku,
sys_source = s.type
bd_count = s.Sum(g=> g.quantity_actual > 0 ? g.quantity_actual : g.quantity_final_advise),
bd_price = s.Max(g=>g.unit_price),
bd_sku = s.Key,
sys_source = s.Any(g => g.type == 2) ? 2 : s.Any(g => g.type == 1) ? 1 : 3,
}).ToList();
var result = ApiServices.PushBuyPlan(data, is_skip_error);
......
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