/// <summary> /// 执行 /// </summary> /// <returns></returns> private async Task Execution() { var stockInOutRecord = await _stockInOutRecordBll.GetStockInOut(_startTime.ToTimestamp(), _endTime.ToTimestamp(), $"{(int)BillTypeEnum.ReceiptIn},{(int)BillTypeEnum.ReceiptBack}"); if (stockInOutRecord == null || !stockInOutRecord.Any()) { return; } foreach (var record in stockInOutRecord) { var goodsSpecAnalysis = Common.GoodsSpecAnalysis(record.GoodsSpec); var goodsContentsAnalysis = Common.GoodsContentsAnalysis(record.GoodsContents); var totalCount = record.TotalCount; var totalWeight = goodsSpecAnalysis * totalCount; var totalContentsWeight = totalWeight * goodsContentsAnalysis; _reportBll.AddStatisticsPurchaseGoods(new Entity.Database.StatisticsPurchaseGoods() { GoodsId = record.GoodsId, GoodsName = record.GoodsName, GoodsContents = record.GoodsContents, GoodsSpec = record.GoodsSpec, GoodsCategoryId = record.GoodsCategoryId, GoodsCategoryName = record.GoodsCategoryName, ShopId = record.ShopId, ShopName = record.ShopName, Province = record.Province, City = record.City, District = record.District, Street = record.Street, OrgId = record.OrgId, EndTime = _endTime, StartTime = _startTime, TotalCount = totalCount, TotalWeight = totalWeight, TotalContentsWeight = totalContentsWeight, StatisticsId = PrimaryKeyHelper.Instance.CreateID() }).Wait(); } }