/// <summary> /// 执行 /// </summary> /// <returns></returns> private async Task Execution() { var stockInOutRecord = await _stockInOutRecordBll.GetStockInOut(_startTime.ToTimestamp(), _endTime.ToTimestamp(), $"{(int)BillTypeEnum.Retail},{(int)BillTypeEnum.RetailBack}"); 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 = -1 * record.TotalCount; var totalWeight = goodsSpecAnalysis * totalCount; var totalContentsWeight = totalWeight * goodsContentsAnalysis; _reportBll.AddStatisticsRetailGoods(new Entity.Database.StatisticsRetailGoods() { 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(); } }