历史记录  
  1. 2025-03-11 10:52:26, 由 罗友军 创建。
  2. 2025-03-11 14:58:15, 由 钟国泽 完成。
    修改了 总计消耗,旧值为 "0",新值为 "1"。
    修改了 指派给 ,旧值为 "zhongguoze",新值为 "luoyoujun"。
    修改了 实际完成,旧值为 "",新值为 "2025-03-11 14:22:40"。
    修改了 任务状态,旧值为 "wait",新值为 "done"。
    修改了 实际开始,旧值为 "0000-00-00 00:00:00",新值为 "2025-03-11 14:56:25"。
    修改了 预计剩余,旧值为 "1",新值为 "0"。
    修改了 由谁完成,旧值为 "",新值为 "zhongguoze"。
    逻辑代码:

    1 取消独立账号限制
                var (lastList, orderSourceList) = await FilterActiveOrderSources(list, result.AssignOrderSourceIds);
                ////取消独立账号的限制
                //lastList = lastList.Where(a => !result.IndependenceOrderSourceIds.Contains(a.OrderSourceId)).ToList();
                if (!lastList.Any())
                {
                    continue;
                }

    2 添加 AU、CA站点
            /// <summary>
            /// 设置首次备货数量
            /// </summary>
            /// <returns></returns>
            public int SetFirstStockProductNum(int? transferFbaType, string siteCode, List<int> independentOrderSourceIds,
                int orderSourceId)
            {
                var isIndependentAccount = independentOrderSourceIds.Any(a => a == orderSourceId);
                //待转导入:首次备货12个
                if ((transferFbaType.HasValue && transferFbaType.Value == (int)EnumFbaCheckPushType.待转导入) ||
                    transferFbaType.HasValue && transferFbaType.Value == (int)EnumFbaCheckPushType.二单转入)
                {
                    var random = new Random();
                    var independentSiteCodes = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "GB", "DE", "US", "CA", "AU" };
                    var allSiteCodes = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
                        { "GB", "DE", "US", "CA", "AU", "MX", "JP" };

                    if (isIndependentAccount)
                    {
                        if (independentSiteCodes.Contains(siteCode))
                        {
                            return random.Next(8, 11);
                        }

                        return random.Next(6, 9);
                    }
                    else
                    {
                        if (allSiteCodes.Contains(siteCode))
                        {
                            return random.Next(10, 13);
                        }
                    }

                    return random.Next(6, 9);
                }

                //一单转入/二单转入/listing导入/多铺导入:首次备货6-8个
                int productNum = new Random().Next(6, 8);
                return productNum;
            }


    3 断货备货服务利润率调整为:FBA自发货销量≥2,且14天利润率≥10%。

      var isConformFbm = new List<int>();
      foreach (var fbmItem in currentFbmItem)
      {
          var isIndependent = independentOrderSourceIdList.Contains(fbmItem.OrderSourceId);
          var currentFbmProfit = (isIndependent ? fbmSumProfitResult : fbmSumProfitList).FirstOrDefault(f => f.OrderSourceID == fbmItem.OrderSourceId && f.SellerSKU == fbmItem.OrderSourceSKU);
          var currentFbmAdProfit = (isIndependent ? fbmAdProfitResult : fbmAdProfitList)
              .FirstOrDefault(f => f.OrderSourceID == fbmItem.OrderSourceId && f.SellerSKU == fbmItem.OrderSourceSKU);

          if (currentFbmProfit == null)
          {
              isConformFbm.Add(0);
              continue;
          }
          if (currentFbmProfit.SumIncomes > 0)
          {
              var profitResult = currentFbmProfit.SumProfit;
              var adProfitInfo = currentFbmAdProfit?.AdCostRMB??0;
              var profitThreshold = isIndependent ? 10 : 0;
              var saleDayThreshold = isIndependent ? fbmItem.SaleDayInfo?.SaleDay14 ?? 0 : fbmItem.SaleDayInfo?.SaleDay30 ?? 0;

              if (((profitResult + adProfitInfo) / currentFbmProfit.SumIncomes) * 100 < profitThreshold || saleDayThreshold < 2)
              {
                  isConformFbm.Add(0);
                  _logger.LogInformation($"断货备货,当前来源渠道{orderSourceName},渠道sku:{transferFba.OrderSourceSKU},同来源渠道同asin自发货的近{(isIndependent ? 14 : 30)}天销量小于2或利润率小于{profitThreshold}%,不备货");
              }
              else
              {
                  break;
              }
          }
          else
          {
              isConformFbm.Add(0);
          }

    4  现恢复二次备货:


                                    //近14天的销量(FBM)
                                    var fourteenDaySaleResult = fbmSaleResultList.Where(a =>
                                        a.SalesDay >= DateTime.Now.AddDays(-14)).Sum(a => a.EstimatedSalesNum);

                                    productNum = fourteenDaySaleResult switch
                                    {
                                        >= 3 and <= 7 when allSumNum >= 0 && allSumNum <= 20 => 10,
                                        >= 3 and <= 7 when allSumNum > 20 && allSumNum <= 40 => 5,
                                        >= 3 and <= 7 => 0,
                                        > 7 => GetProductNum(fbmSaleResultList, allSumNum),
                                        _ => 0
                                    };
                                    if (productNum > 0)
                                    {
                                        break;
                                    }
                                }

            private static int GetProductNum(List<OrderSourceSkuSiteSale_ViewModel> firstStockBySaleList, int allSumNum)
            {
                var thirtyResult = firstStockBySaleList.Where(a => a.SalesDay >= DateTime.Now.AddDays(-30))
                    .Sum(a => a.EstimatedSalesNum);

                var sevenResult = firstStockBySaleList.Where(a => a.SalesDay >= DateTime.Now.AddDays(-7))
                    .Sum(a => a.EstimatedSalesNum);
                var currentSaleNum = thirtyResult * 2;
                if (sevenResult * 4 > currentSaleNum)
                {
                    currentSaleNum = sevenResult * 4;
                }

                if (allSumNum <= currentSaleNum)
                {
                    return (currentSaleNum - allSumNum);
                }

                return 0;
            }


  3. 2025-03-12 10:04:16, 由 梁秀丽 编辑。
    修改了 最初预计,旧值为 "1",新值为 "19"。
  4. 2025-03-12 10:04:55, 由 梁秀丽 编辑。
    修改了 最初预计,旧值为 "19",新值为 "12"。
  5. 2025-05-17 09:38:30, 由 李亚婷 关闭。
    修改了 任务状态,旧值为 "done",新值为 "closed"。
    修改了 指派给 ,旧值为 "luoyoujun",新值为 "closed"。
    修改了 由谁关闭,旧值为 "",新值为 "liyating"。
    修改了 关闭时间,旧值为 "0000-00-00 00:00:00",新值为 "2025-05-17 09:38:30"。
    修改了 关闭原因,旧值为 "",新值为 "done"。
所属迭代 智能中心-智能备货迭代
所属模块 /
相关需求 智能备货:独立账号备货逻辑调整
指派给 Closed 于 2025-05-17 09:38:30
任务类型 后端
任务标签 初始
开发组
任务状态 已关闭
进度 100%
优先级 P0
关键词
抄送给
由谁创建 罗友军 于 2025-03-11 10:52:26
由谁完成 钟国泽 于 2025-03-11 14:22:40
由谁取消 暂无
由谁关闭 李亚婷 于 2025-05-17 09:38:30
关闭原因 已完成
最后编辑 李亚婷 于 2025-05-17 09:38:30
团队 最初预计 总计消耗 预计剩余
工时信息
最初预计 12工时
总计消耗 1工时
预计剩余 0工时
预计开始 2025-03-11
实际开始 2025-03-11
截止日期 2025-03-14