/// <summary> /// 执行更新商品库存 /// </summary> /// <returns></returns> private async Task Process() { var lastUpdateTime = await _reportBll.GetStockGoodsLastUpdateTime(); var recentModifyStockGoods = await _stockQtyBll.GetRecentModifyStockGoods(lastUpdateTime.ToTimestamp()); if (recentModifyStockGoods == null || !recentModifyStockGoods.Any()) { return; } foreach (var stockGoods in recentModifyStockGoods) { var goodsSpecAnalysis = Common.GoodsSpecAnalysis(stockGoods.GoodsSpec); var goodsContentsAnalysis = Common.GoodsContentsAnalysis(stockGoods.GoodsContents); var totalCount = stockGoods.TotalCount; var totalWeight = goodsSpecAnalysis * totalCount; var totalContentsWeight = totalWeight * goodsContentsAnalysis; _reportBll.SaveStatisticsStockGoods(new StatisticsStockGoods() { City = stockGoods.City, District = stockGoods.District, GoodsId = stockGoods.GoodsId, GoodsCategoryId = stockGoods.GoodsCategoryId, GoodsCategoryName = stockGoods.GoodsCategoryName, GoodsContents = stockGoods.GoodsContents, GoodsName = stockGoods.GoodsName, GoodsSpec = stockGoods.GoodsSpec, OrgId = stockGoods.OrgId, Province = stockGoods.Province, ShopId = stockGoods.ShopId, ShopName = stockGoods.ShopName, Street = stockGoods.Street, TotalContentsWeight = totalContentsWeight, TotalCount = totalCount, TotalWeight = totalWeight, UpdateTime = DateTime.Now, StatisticsId = PrimaryKeyHelper.Instance.CreateID() }).Wait(); } }