public static ProductBll GetInstance() { if (instance == null) { instance = new ProductBll(); } return(instance); }
/// <summary> /// 根据产品id 查询sku服务区域 /// </summary> /// <param name="pid">产品id</param> /// <param name="areaid">区域id</param> /// <param name="time">时间</param> /// <param name="skuValue">sku值</param> /// <param name="memberLevel">会员等级</param> /// <returns></returns> public static SkuErrorViewModel GetSkuPriceYj(int pid, int areaid, DateTime time, string skuValue, MemberLevel memberLevel = MemberLevel.普通会员) { //获取时间 DayOfWeek dayOfWeek = time.DayOfWeek; TimeSpan timeSpan = TimeSpan.Parse(time.GetDateTimeFormats('t')[0]); //获取价格 并验证是否存在 var skuPrices = SkuPriceBll.GetInstance().Table().Where(o => o.ProductId == pid).ToList(); if (skuPrices.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.产品的价格不服务 } } ; //获取区域 并验证是否存在 var skuAreas = SkuAreaBll.GetInstance().Table().Where(o => o.ProductId == pid).ToList(); if (skuAreas.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.务地区不存在 } } ; //获取时间 并验证是否存在 var skuTimes = SkuTimeBll.GetInstance().Table().Where(o => o.ProductId == pid).ToList(); if (skuTimes.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.务时间不存在 } } ; //获取并验证 产品价格 的 区域 var query = (from s in skuPrices join a in skuAreas on s.SkuAreaId equals a.Id where a.AreaId == areaid select s).OrderBy(o => o.Id).ToList(); if (query.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.务地区不存在 } } ; //获取并验证 产品价格 的 时间 query = (from s in query join t in skuTimes on s.SkuTimeId equals t.Id where t.Week == dayOfWeek && t.EndTime >= timeSpan && t.StartTime <= timeSpan select s).OrderBy(o => o.Id).ToList(); if (query.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.务时间不存在 } } ; query = query.Where(o => o.SkuValue == skuValue).OrderBy(o => o.Id).ToList(); if (query.Count() == 0) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.Sku不存在 } } ; if (!query.FirstOrDefault().IsEnable) { return new SkuErrorViewModel { SkuError = SkuErrorEnum.产品的价格不服务 } } ; var data = query.FirstOrDefault(); string ProductCode = ProductBll.GetInstance().Get(pid).ProductCode; if (ProductCode.Trim() != "10000") { #region 查询产品价格模板是否存在价格 (isItem判断是否存在价格) //根据产品Id获取价格模板的价格 var items = PriceTempletItemBll.GetInstance().Table().Where(o => o.ProductId == pid).ToList(); // 根据已获取的产品价格Id 去获取价格模板的价格 var priceItem = new List <PriceTempletItem>(); //判断SkuPriceId if (items.Count() > 0) { priceItem = items.Where(o => o.SkuPriceId.Contains("," + data.Id.ToString() + ",")).ToList(); } //判断会员 if (priceItem.Count() > 0) { priceItem = priceItem.Where(o => o.MemberLevel.Contains("," + memberLevel + ",")).ToList(); } //判断时间 if (priceItem.Count() > 0) { foreach (var i in priceItem) { var skuTimeIdArray = i.SkuTimeId.Split(','); List <int> skuTimeIds = new List <int>(); for (int j = 0; j < skuTimeIdArray.Length; j++) { if (skuTimeIdArray[j] != "") { skuTimeIds.Add(int.Parse(skuTimeIdArray[j])); } } var priceItemTime = skuTimes.Where(o => skuTimeIds.Contains(o.Id)).ToList(); var priceTemplet = PriceTempletBll.GetInstance().Get(i.PriceTempletId); if (priceTemplet != null && priceTemplet.State == PriceTempletStateEnum.启用) { //判断价格模板时间 if (time >= priceTemplet.StartTime && time <= priceTemplet.EndTime) { foreach (var t in priceItemTime) { //判断sku时间 if (dayOfWeek == t.Week && timeSpan >= t.StartTime && timeSpan <= t.EndTime) { data.Price = i.Price; data.AdditionalPrice = i.AdditionalPrice; } } } } } } #endregion } return(new SkuErrorViewModel { SkuError = SkuErrorEnum.正常, SkuPriceView = data }); }
/// <summary> /// 添加溢出值 后台修改 比例 /// </summary> /// <param name="ProductId"></param> public void UpdateInventoryOver(object oid) { int ProductId = (int)oid; DateTime dt = DateTime.Now.Date; var InventoryHistory = InventoryOverHistoryBLL.GetInstance().TableNoTracking().Where(o => o.CreTime >= dt).ToList(); var store = StoreBll.GetInstance().TableNoTracking().Where(o => o.State == (int)StoreState.线中).ToList(); var ProductCategory = ProductCategoryBll.GetInstance().TableNoTracking().ToList(); var ProductCategoryidlist = ProductCategory.Select(o => o.Id).ToList(); ProductCategoryidlist.Add(0); var Productlist = ProductBll.GetInstance().TableNoTracking().Where(o => o.Id == ProductId && o.State == ProductStateEnum.架).ToList(); var Productidlist = Productlist.Select(o => o.Id).ToList(); Productidlist.Add(0); var StockSettinglist = StockSettingBLL.GetInstance().TableNoTracking().Where(o => Productidlist.Contains(o.ProductId)).ToList(); if (store != null && store.Count > 0) { foreach (var itemstore in store) { if (ProductCategory != null && ProductCategory.Count > 0) { foreach (var itemProductCategory in ProductCategory) { if (InventoryHistory != null && InventoryHistory.Count > 0) { foreach (var objInventoryHistory in InventoryHistory) { //// //店铺 分类下 当天的总库存 List <StockOutInView> StockOutInViewlist = InventoryBLL.GetInstance().GetStockTotal(itemstore.Id, itemProductCategory.Id, objInventoryHistory.CreTime); List <Product> ProductList = Productlist.Where(o => o.ProductCategoryId == itemProductCategory.Id).ToList(); #region MyRegion if (ProductList != null) { foreach (var item in ProductList) { string sql = " update [InventoryOver] set "; int i = 1; #region 循环 string tstr = ""; while (i < 49) { //分类下 var EmployeeProductViewModellistitem = new List <StockOutInView>(); #region MyRegion if (i == 1) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time1 != null).ToList(); } else if (i == 2) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time2 != null).ToList(); } else if (i == 3) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time3 != null).ToList(); } else if (i == 4) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time4 != null).ToList(); } else if (i == 5) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time5 != null).ToList(); } else if (i == 6) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time6 != null).ToList(); } else if (i == 7) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time7 != null).ToList(); } else if (i == 8) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time8 != null).ToList(); } else if (i == 9) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time9 != null).ToList(); } else if (i == 10) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time10 != null).ToList(); } else if (i == 11) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time11 != null).ToList(); } else if (i == 12) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time12 != null).ToList(); } else if (i == 13) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time13 != null).ToList(); } else if (i == 14) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time14 != null).ToList(); } else if (i == 15) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time15 != null).ToList(); } else if (i == 16) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time16 != null).ToList(); } else if (i == 17) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time17 != null).ToList(); } else if (i == 18) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time18 != null).ToList(); } else if (i == 19) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time19 != null).ToList(); } else if (i == 20) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time20 != null).ToList(); } else if (i == 21) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time21 != null).ToList(); } else if (i == 22) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time22 != null).ToList(); } else if (i == 23) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time23 != null).ToList(); } else if (i == 24) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time24 != null).ToList(); } else if (i == 25) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time25 != null).ToList(); } else if (i == 26) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time26 != null).ToList(); } else if (i == 27) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time27 != null).ToList(); } else if (i == 28) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time28 != null).ToList(); } else if (i == 29) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time29 != null).ToList(); } else if (i == 30) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time30 != null).ToList(); } else if (i == 31) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time31 != null).ToList(); } else if (i == 32) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time32 != null).ToList(); } else if (i == 33) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time33 != null).ToList(); } else if (i == 34) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time34 != null).ToList(); } else if (i == 35) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time35 != null).ToList(); } else if (i == 36) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time36 != null).ToList(); } else if (i == 37) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time37 != null).ToList(); } else if (i == 38) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time38 != null).ToList(); } else if (i == 39) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time39 != null).ToList(); } else if (i == 40) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time40 != null).ToList(); } else if (i == 41) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time41 != null).ToList(); } else if (i == 42) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time42 != null).ToList(); } else if (i == 43) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time43 != null).ToList(); } else if (i == 44) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time44 != null).ToList(); } else if (i == 45) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time45 != null).ToList(); } else if (i == 46) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time46 != null).ToList(); } else if (i == 47) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time47 != null).ToList(); } else if (i == 48) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time48 != null).ToList(); } #endregion //产品下的总库存 int TotalInventory = EmployeeProductViewModellistitem.Select(o => o.EmployeeId).Distinct().Count(); //百分比计算 var StockSetting = StockSettinglist.Where(o => o.ProductId == item.Id).FirstOrDefault(); if (StockSetting != null) { TotalInventory = ZConvert.StrToInt(TotalInventory * ((StockSetting.OverflowValue - 100) / 100)); } else { TotalInventory = 0; } tstr += " [Time" + i + "]=" + TotalInventory + ","; i++; } #endregion if (!string.IsNullOrEmpty(tstr)) { tstr = tstr.Substring(0, tstr.Length - 1); } sql += tstr; sql += " where [StoreId]=" + itemstore.Id + " and [ProductId]=" + item.Id + " and [CreTime]='" + objInventoryHistory.CreTime.Date + "'"; ExecuteSqlCommand(sql, null); } } #endregion } } } } } } }
/// <summary> /// 添加溢出值 /// </summary> public void AddInventoryOver() { int Stockdate = ZConvert.StrToInt(ZConfig.GetConfigString("Stockdate")); DateTime Time = DateTime.Now; for (int z = 0; z < Stockdate; z++) { int t = z == 0 ? 0 : 1; Time = Time.AddDays(t); var InventoryHistory = InventoryOverHistoryBLL.GetInstance().TableNoTracking().Where(o => o.CreTime == Time.Date).FirstOrDefault(); if (InventoryHistory == null) { // 添加记录 InventoryOverHistory obj = new InventoryOverHistory(); obj.CreTime = Time.Date; InventoryOverHistoryBLL.GetInstance().Add(obj); var store = StoreBll.GetInstance().TableNoTracking().Where(o => o.State == (int)StoreState.线中).ToList(); var ProductCategory = ProductCategoryBll.GetInstance().TableNoTracking().ToList(); var ProductCategoryidlist = ProductCategory.Select(o => o.Id).ToList(); ProductCategoryidlist.Add(0); var Productlist = ProductBll.GetInstance().TableNoTracking().Where(o => ProductCategoryidlist.Contains(o.ProductCategoryId) && o.State == ProductStateEnum.架).ToList(); var Productidlist = Productlist.Select(o => o.Id).ToList(); Productidlist.Add(0); var StockSettinglist = StockSettingBLL.GetInstance().TableNoTracking().Where(o => Productidlist.Contains(o.ProductId)).ToList(); if (store != null && store.Count > 0) { foreach (var itemstore in store) { if (ProductCategory != null && ProductCategory.Count > 0) { foreach (var itemProductCategory in ProductCategory) { #region MyRegion //// //店铺 分类下 当天的总库存 List <StockOutInView> StockOutInViewlist = InventoryBLL.GetInstance().GetStockTotal(itemstore.Id, itemProductCategory.Id, Time); List <Product> ProductList = Productlist.Where(o => o.ProductCategoryId == itemProductCategory.Id).ToList(); if (ProductList != null) { foreach (var item in ProductList) { string sql = " INSERT INTO [InventoryOver] ([StoreId] ,[ProductId] ,[CreTime] "; sql += " ,[Time1] ,[Time2] ,[Time3] ,[Time4] ,[Time5] ,[Time6] ,[Time7] ,[Time8] ,[Time9] ,[Time10] ,[Time11] ,[Time12] ,[Time13] ,[Time14] ,[Time15] "; sql += " ,[Time16] ,[Time17] ,[Time18] ,[Time19] ,[Time20] ,[Time21] ,[Time22] ,[Time23] "; sql += " ,[Time24] ,[Time25] ,[Time26] ,[Time27] ,[Time28] ,[Time29] ,[Time30] ,[Time31] ,[Time32] ,[Time33] "; sql += " ,[Time34] ,[Time35] ,[Time36] ,[Time37] ,[Time38] ,[Time39] ,[Time40] ,[Time41] ,[Time42] ,[Time43] ,[Time44] ,[Time45] ,[Time46] ,[Time47] ,[Time48] "; sql += " ) "; sql += " VALUES "; sql += " (" + itemstore.Id + "," + item.Id + ",'" + Time.Date + "' "; int i = 1; #region 循环 while (i < 49) { //分类下 var EmployeeProductViewModellistitem = new List <StockOutInView>(); #region MyRegion if (i == 1) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time1 != null).ToList(); } else if (i == 2) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time2 != null).ToList(); } else if (i == 3) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time3 != null).ToList(); } else if (i == 4) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time4 != null).ToList(); } else if (i == 5) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time5 != null).ToList(); } else if (i == 6) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time6 != null).ToList(); } else if (i == 7) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time7 != null).ToList(); } else if (i == 8) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time8 != null).ToList(); } else if (i == 9) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time9 != null).ToList(); } else if (i == 10) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time10 != null).ToList(); } else if (i == 11) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time11 != null).ToList(); } else if (i == 12) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time12 != null).ToList(); } else if (i == 13) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time13 != null).ToList(); } else if (i == 14) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time14 != null).ToList(); } else if (i == 15) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time15 != null).ToList(); } else if (i == 16) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time16 != null).ToList(); } else if (i == 17) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time17 != null).ToList(); } else if (i == 18) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time18 != null).ToList(); } else if (i == 19) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time19 != null).ToList(); } else if (i == 20) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time20 != null).ToList(); } else if (i == 21) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time21 != null).ToList(); } else if (i == 22) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time22 != null).ToList(); } else if (i == 23) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time23 != null).ToList(); } else if (i == 24) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time24 != null).ToList(); } else if (i == 25) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time25 != null).ToList(); } else if (i == 26) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time26 != null).ToList(); } else if (i == 27) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time27 != null).ToList(); } else if (i == 28) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time28 != null).ToList(); } else if (i == 29) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time29 != null).ToList(); } else if (i == 30) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time30 != null).ToList(); } else if (i == 31) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time31 != null).ToList(); } else if (i == 32) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time32 != null).ToList(); } else if (i == 33) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time33 != null).ToList(); } else if (i == 34) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time34 != null).ToList(); } else if (i == 35) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time35 != null).ToList(); } else if (i == 36) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time36 != null).ToList(); } else if (i == 37) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time37 != null).ToList(); } else if (i == 38) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time38 != null).ToList(); } else if (i == 39) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time39 != null).ToList(); } else if (i == 40) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time40 != null).ToList(); } else if (i == 41) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time41 != null).ToList(); } else if (i == 42) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time42 != null).ToList(); } else if (i == 43) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time43 != null).ToList(); } else if (i == 44) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time44 != null).ToList(); } else if (i == 45) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time45 != null).ToList(); } else if (i == 46) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time46 != null).ToList(); } else if (i == 47) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time47 != null).ToList(); } else if (i == 48) { EmployeeProductViewModellistitem = StockOutInViewlist.Where(o => o.PrdouctId == item.Id && o.Time48 != null).ToList(); } #endregion //产品下的总库存 int TotalInventory = EmployeeProductViewModellistitem.Select(o => o.EmployeeId).Distinct().Count(); //百分比计算 var StockSetting = StockSettinglist.Where(o => o.ProductId == item.Id).FirstOrDefault(); if (StockSetting != null) { TotalInventory = ZConvert.StrToInt(TotalInventory * ((StockSetting.OverflowValue - 100) / 100)); } else { TotalInventory = 0; } sql += " ," + TotalInventory + " "; i++; } #endregion sql += " )"; ExecuteSqlCommand(sql, null); } } #endregion } } } } } } }