public bool Validate(OrderInfo order, out string errorMsg) { errorMsg = string.Empty; List <string> errorMsgList = new List <string>(); #region [ 商品库存检查 ] if (!ValidateQuantity(order, out errorMsgList)) { foreach (var item in errorMsgList) { errorMsg += item + "<br />"; } return(false); } #endregion foreach (OrderItemGroup itemGroup in order.OrderItemGroupList) { if (itemGroup.PackageChecked) { if (itemGroup.PackageType == 1) { foreach (OrderProductItem item in itemGroup.ProductItemList) { #region 1.商品状态检查 if (!item["ProductStatus"].ToString().Equals(((int)ECommerce.Enums.ProductStatus.Show).ToString())) { errorMsg = LanguageHelper.GetText("商品【{0}】未上架!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"]); return(false); } #endregion #region 2.商品库存检查 //if (itemGroup.Quantity * item.UnitQuantity > item.TotalInventory) //{ // errorMsg = LanguageHelper.GetText("商品【{0}】库存不足!", order.LanguageCode); // errorMsg = string.Format(errorMsg, item["ProductTitle"]); // return false; //} #endregion #region 3.每单限购最小数量检查 int minCountPerOrder = 0; int.TryParse(item["MinCountPerOrder"].ToString(), out minCountPerOrder); if (itemGroup.Quantity * item.UnitQuantity < minCountPerOrder) { errorMsg = LanguageHelper.GetText("商品【{0}】每单限购数量{1}-{2}!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"], item["MinCountPerOrder"], item["MaxCountPerOrder"]); return(false); } #endregion #region 4.每单限购最大数量检查 int maxCountPerOrder = 0; int.TryParse(item["MaxCountPerOrder"].ToString(), out maxCountPerOrder); if (itemGroup.Quantity * item.UnitQuantity > maxCountPerOrder) { errorMsg = LanguageHelper.GetText("商品【{0}】每单限购数量{1}-{2}!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"], item["MinCountPerOrder"], item["MaxCountPerOrder"]); return(false); } #endregion List <OrderGiftItem> giftList = null; if (order.GiftItemList != null && order.GiftItemList.Count > 0) { giftList = order.GiftItemList.FindAll(m => m.ParentPackageNo == itemGroup.PackageNo && m.MerchantSysNo == item.MerchantSysNo && m.ParentProductSysNo == item.ProductSysNo); } if (giftList == null) { giftList = new List <OrderGiftItem>(); } //非赠品池赠品 var normalGiftList = giftList.FindAll(m => !m.IsGiftPool); foreach (var gift in normalGiftList) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(gift.ProductSysNo); gift.TotalInventory = giftSalesInfo.OnlineQty; if (gift.UnitQuantity * gift.ParentCount > gift.TotalInventory) { errorMsg = LanguageHelper.GetText("赠品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, gift.ProductName); return(false); } } //订单级别用户选择的赠品(包含非赠品池删除后保留的赠品和赠品池选择的赠品) List <OrderGiftItem> orderGiftList = new List <OrderGiftItem>(); if (order.GiftItemList != null) { orderGiftList = order.GiftItemList.FindAll(m => m.ParentPackageNo.Equals(0) && m.ParentProductSysNo.Equals(0) && ((m.IsGiftPool && m.IsSelect) || !m.IsGiftPool)); } var productList = order.OrderItemGroupList.FindAll(m => m.MerchantSysNo == item.MerchantSysNo); var merchantOrderGiftList = orderGiftList.FindAll(m => m.MerchantSysNo == item.MerchantSysNo); if (merchantOrderGiftList != null && merchantOrderGiftList.Count > 0) { for (int index = 0; index < merchantOrderGiftList.Count; index++) { var Gift = merchantOrderGiftList[index]; var itemGroupList = productList.FindAll(m => m.MerchantSysNo == merchantOrderGiftList[index].MerchantSysNo && m.PackageChecked); if (itemGroupList.Count > 0 && itemGroupList != null) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(merchantOrderGiftList[index].ProductSysNo); merchantOrderGiftList[index].TotalInventory = giftSalesInfo.OnlineQty; if (merchantOrderGiftList[index].UnitQuantity * merchantOrderGiftList[index].ParentCount > merchantOrderGiftList[index].TotalInventory) { errorMsg = LanguageHelper.GetText("赠品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, merchantOrderGiftList[index].ProductName); return(false); } } } } } } else if (itemGroup.PackageType == 0) { foreach (OrderProductItem item in itemGroup.ProductItemList) { if (item.ProductChecked) { #region 1.商品状态检查 if (!item["ProductStatus"].ToString().Equals(((int)ECommerce.Enums.ProductStatus.Show).ToString())) { errorMsg = LanguageHelper.GetText("商品【{0}】未上架!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"]); return(false); } #endregion #region 2.商品库存检查 //if (itemGroup.Quantity * item.UnitQuantity > item.TotalInventory) //{ // errorMsg = LanguageHelper.GetText("商品【{0}】库存不足!", order.LanguageCode); // errorMsg = string.Format(errorMsg, item["ProductTitle"]); // return false; //} #endregion #region 3.每单限购最小数量检查 int minCountPerOrder = 0; int.TryParse(item["MinCountPerOrder"].ToString(), out minCountPerOrder); if (itemGroup.Quantity * item.UnitQuantity < minCountPerOrder) { errorMsg = LanguageHelper.GetText("商品【{0}】每单限购数量{1}-{2}!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"], item["MinCountPerOrder"], item["MaxCountPerOrder"]); return(false); } #endregion #region 4.每单限购最大数量检查 int maxCountPerOrder = 0; int.TryParse(item["MaxCountPerOrder"].ToString(), out maxCountPerOrder); if (itemGroup.Quantity * item.UnitQuantity > maxCountPerOrder) { errorMsg = LanguageHelper.GetText("商品【{0}】每单限购数量{1}-{2}!", order.LanguageCode); errorMsg = string.Format(errorMsg, item["ProductTitle"], item["MinCountPerOrder"], item["MaxCountPerOrder"]); return(false); } #endregion //赠品 List <OrderGiftItem> giftList = null; if (order.GiftItemList != null && order.GiftItemList.Count > 0) { giftList = order.GiftItemList.FindAll(m => m.ParentPackageNo == itemGroup.PackageNo && m.MerchantSysNo == item.MerchantSysNo && m.ParentProductSysNo == item.ProductSysNo); } if (giftList == null) { giftList = new List <OrderGiftItem>(); } //非赠品池赠品 var normalGiftList = giftList.FindAll(m => !m.IsGiftPool); foreach (var gift in normalGiftList) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(gift.ProductSysNo); gift.TotalInventory = giftSalesInfo.OnlineQty; if (gift.UnitQuantity * gift.ParentCount > gift.TotalInventory) { errorMsg = LanguageHelper.GetText("赠品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, gift.ProductName); return(false); } } //订单级别用户选择的赠品(包含非赠品池删除后保留的赠品和赠品池选择的赠品) List <OrderGiftItem> orderGiftList = new List <OrderGiftItem>(); if (order.GiftItemList != null) { orderGiftList = order.GiftItemList.FindAll(m => m.ParentPackageNo.Equals(0) && m.ParentProductSysNo.Equals(0) && ((m.IsGiftPool && m.IsSelect) || !m.IsGiftPool)); } var productList = order.OrderItemGroupList.FindAll(m => m.MerchantSysNo == item.MerchantSysNo); var merchantOrderGiftList = orderGiftList.FindAll(m => m.MerchantSysNo == item.MerchantSysNo); if (merchantOrderGiftList != null && merchantOrderGiftList.Count > 0) { for (int index = 0; index < merchantOrderGiftList.Count; index++) { var Gift = merchantOrderGiftList[index]; var itemGroupList = productList.FindAll(m => m.MerchantSysNo == merchantOrderGiftList[index].MerchantSysNo && m.PackageChecked); if (itemGroupList.Count > 0 && itemGroupList != null) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(merchantOrderGiftList[index].ProductSysNo); merchantOrderGiftList[index].TotalInventory = giftSalesInfo.OnlineQty; if (merchantOrderGiftList[index].UnitQuantity * merchantOrderGiftList[index].ParentCount > merchantOrderGiftList[index].TotalInventory) { errorMsg = LanguageHelper.GetText("赠品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, merchantOrderGiftList[index].ProductName); return(false); } } } } } } } } } #region 优惠促销库存检查 if (order.AttachmentItemList != null) { foreach (OrderAttachment attachment in order.AttachmentItemList) { ProductSalesInfo attachmentSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(attachment.ProductSysNo); attachment.TotalInventory = attachmentSalesInfo.OnlineQty; if (attachment.UnitQuantity * attachment.ParentCount > attachment.TotalInventory) { errorMsg = LanguageHelper.GetText("附件【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, attachment.ProductName); return(false); } } } if (order.GiftItemList != null) { foreach (OrderGiftItem gift in order.GiftItemList) { if (gift.IsSelect) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(gift.ProductSysNo); gift.TotalInventory = giftSalesInfo.OnlineQty; if (gift.UnitQuantity * gift.ParentCount > gift.TotalInventory) { errorMsg = LanguageHelper.GetText("赠品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, gift.ProductName); return(false); } } } } if (order.PlusPriceItemList != null) { foreach (OrderGiftItem gift in order.PlusPriceItemList) { if (gift.IsSelect) { ProductSalesInfo giftSalesInfo = PipelineDA.GetProductSalesInfoBySysNo(gift.ProductSysNo); gift.TotalInventory = giftSalesInfo.OnlineQty; if (gift.UnitQuantity > gift.TotalInventory) { errorMsg = LanguageHelper.GetText("加购商品【{0}】库存不足!", order.LanguageCode); errorMsg = string.Format(errorMsg, gift.ProductName); return(false); } } } } #endregion errorMsg = null; return(true); }
/// <summary> /// 加够商品转换为主商品 /// </summary> /// <param name="productSysNo">商品编号</param> /// <param name="customerSysNo">用户编号</param> /// <returns></returns> private OrderItemGroup PlusPriceConvertToProduct(OrderGiftItem plusPrice, int customerSysNo) { OrderItemGroup result = new OrderItemGroup(); OrderProductItem productItem = new OrderProductItem(); productItem.ProductSysNo = plusPrice.ProductSysNo; //商品基础信息 ProductBasicInfo basicInfo = PipelineDA.GetProductBasicInfoBySysNo(productItem.ProductSysNo); //商品备案信息 ProductEntryInfo entryInfo = PipelineDA.GetProductEntryInfoBySysNo(productItem.ProductSysNo); basicInfo.ProductEntryInfo = entryInfo; productItem["ProductStoreType"] = (int)entryInfo.ProductStoreType; //商品备货时间 productItem["LeadTimeDays"] = basicInfo.ProductEntryInfo.LeadTimeDays; //商品销售信息 ProductSalesInfo salesInfo = PipelineDA.GetProductSalesInfoBySysNo(productItem.ProductSysNo); productItem.ProductID = basicInfo.Code; productItem.ProductName = basicInfo.ProductName; productItem.Weight = basicInfo.Weight; productItem["ProductTitle"] = basicInfo.ProductTitle; productItem.DefaultImage = basicInfo.DefaultImage; productItem.UnitMarketPrice = salesInfo.MarketPrice; productItem.UnitCostPrice = salesInfo.UnitCostPrice; productItem.UnitSalePrice = plusPrice.UnitSalePrice; productItem.UnitRewardedPoint = 0; //productItem["TariffRate"] = basicInfo.ProductEntryInfo.TariffRate; productItem.TotalInventory = salesInfo.OnlineQty; productItem.MerchantSysNo = basicInfo.VendorSysno; productItem.MerchantName = basicInfo.VendorInfo.VendorName; result.MerchantSysNo = basicInfo.VendorSysno; result.MerchantName = basicInfo.VendorInfo.VendorName; productItem["ProductStatus"] = (int)basicInfo.ProductStatus; productItem["Warranty"] = basicInfo.Warranty; productItem.WarehouseNumber = plusPrice.WarehouseNumber; productItem.WarehouseName = plusPrice.WarehouseName; productItem.WarehouseCountryCode = plusPrice.WarehouseCountryCode; salesInfo.MinCountPerOrder = salesInfo.OnlineQty < productItem.UnitQuantity ? salesInfo.OnlineQty : productItem.UnitQuantity; salesInfo.MaxCountPerOrder = salesInfo.OnlineQty < productItem.UnitQuantity ? salesInfo.OnlineQty : productItem.UnitQuantity; productItem["MinCountPerOrder"] = productItem.UnitQuantity; productItem["MaxCountPerOrder"] = productItem.UnitQuantity; result.MinCountPerSO = productItem.UnitQuantity; result.MaxCountPerSO = productItem.UnitQuantity; result.MerchantSysNo = productItem.MerchantSysNo; result.MerchantName = productItem.MerchantName; result.PackageNo = 0; result.PackageType = 0; result.Quantity = 1; //商品分组属性 List <ProductSplitGroupProperty> splitGroupProperty = PipelineDA.GetProductSplitGroupPropertyList(productItem.ProductSysNo); if (splitGroupProperty != null && splitGroupProperty.Count > 0) { productItem.SplitGroupPropertyDescList = new List <KeyValuePair <string, string> >(); foreach (ProductSplitGroupProperty property in splitGroupProperty) { productItem.SplitGroupPropertyDescList.Add(new KeyValuePair <string, string>(property.PropertyDescription, property.ValueDescription)); } } result.ProductItemList = new List <OrderProductItem>(); result.ProductItemList.Add(productItem); return(result); }
/// <summary> /// 获取商品详情 /// </summary> /// <param name="id">系统编号</param> /// <param name="isGroupBuy">0--标识id为商品系统编号,1--标识id为团购活动系统编号</param> /// <returns></returns> public ProductDetailModel GetProductDetails(int id, int isGroupBuy) { int productSysNo = 0; GroupBuyingInfo groupBuyInfo = null; if (isGroupBuy == 1) { groupBuyInfo = GroupBuyingFacade.GetGroupBuyingInfoBySysNo(id); if (groupBuyInfo == null) { //提示团购活动找不到 throw new BusinessException("团购活动找不到啦,请选购其它商品,谢谢。"); } productSysNo = groupBuyInfo.ProductSysNo; } else { productSysNo = id; } //商品基本信息 ProductBasicInfo basicInfo = ProductFacade.GetProductBasicInfoBySysNo(productSysNo); //商品销售信息 ProductSalesInfo salesInfo = ProductFacade.GetProductSalesInfoBySysNo(productSysNo); if (basicInfo == null || salesInfo == null) { //提示商品找不到 throw new BusinessException("商品找不到啦,请选购其它商品,谢谢。"); } //如果是不展示或下架 if (basicInfo.ProductStatus == ProductStatus.NotShow || basicInfo.ProductStatus == ProductStatus.Abandon) { //提示商品状态已下架或已作废 throw new BusinessException("商品已下架或已作废,请选购其它商品,谢谢。"); } //商品组信息 List <ProductPropertyView> propertyView = ProductFacade.GetProductPropetyView(productSysNo, basicInfo.ProductCommonInfoSysNo); //商品附件 List <ProductItemInfo> attachmentList = ProductFacade.GetProductAttachmentList(productSysNo); //商品配件 List <ProductAccessories> accessoriesList = ProductFacade.GetProductAccessoriesList(productSysNo); //商家信息 StoreBasicInfo storeinfo = StoreFacade.QueryStoreBasicInfo(basicInfo.VendorSysno); //商品促销信息 ProductPromotionInfo promotionInfo = Nesoft.ECWeb.Facade.Product.ProductFacade.GetProductPromotionInfo(productSysNo); //商品组图片信息 List <ProductImage> productImages = ProductFacade.GetProductImages(basicInfo.ProductCommonInfoSysNo); //商品内容(商品详情,规格参数,售后服务,购买须知等) List <ProductContent> contentList = ProductFacade.GetProductContentList(basicInfo); ProductDetailModel result = new ProductDetailModel(); //基本信息 result.BasicInfo = TransformBasicInfo(basicInfo); //商品销售(价格,库存等)信息 result.SalesInfo = TransformSalesInfo(basicInfo, salesInfo); //商品图片列表 result.ImageList = TransformImageList(productImages); //商品描述信息 result.DescInfo = TransformDescInfo(contentList); //if (result.DescInfo != null && basicInfo != null) // result.DescInfo.Performance = basicInfo.Performance; //分组属性 result.GroupPropertyInfo = TransformGroupProperty(propertyView); //附件信息 result.AttachmentInfo = TransformAttachmentInfo(attachmentList); //配件信息 result.AccessoryList = TransformAccessoryInfo(accessoriesList); //商家信息 result.StoreBasicInfo = Transformstoreinfo(storeinfo); //限时抢购,赠品,套餐等促销信息 result.PromoInfo = TransformPromoInfo(promotionInfo); //如果是团购商品进一步加载团购详情 if (promotionInfo != null && promotionInfo.GroupBuySysNo > 0) { if (groupBuyInfo == null) { groupBuyInfo = GroupBuyingFacade.GetGroupBuyingInfoBySysNo(promotionInfo.GroupBuySysNo); } if (groupBuyInfo == null) { result.PromoInfo.GroupBuyingSysNo = 0; } else { //团购图片特殊处理,用活动设置的图片 result.BasicInfo.DefaultImageUrl = groupBuyInfo.GroupBuyingPicUrl; result.ImageList.Clear(); ProductImageModel groupBuyImage = new ProductImageModel(); groupBuyImage.ImageUrlBig = groupBuyInfo.GroupBuyingPicUrl; groupBuyImage.ImageUrlHuge = groupBuyInfo.GroupBuyingPicUrl; result.ImageList.Add(groupBuyImage); //海外团购商品,算税 if (groupBuyInfo.GroupBuyingTypeSysNo == 0) { result.SalesInfo.TariffPrice = salesInfo.CurrentPrice * salesInfo.TariffRate; if (result.SalesInfo.TariffPrice <= ConstValue.TariffFreeLimit) { result.SalesInfo.FreeEntryTax = true; result.SalesInfo.TotalPrice = salesInfo.CurrentPrice; } else { result.SalesInfo.FreeEntryTax = false; result.SalesInfo.TotalPrice = salesInfo.CurrentPrice + result.SalesInfo.TariffPrice; } decimal snapShotTariffPrice = groupBuyInfo.SnapShotCurrentPrice * salesInfo.TariffRate; if (snapShotTariffPrice <= ConstValue.TariffFreeLimit) { snapShotTariffPrice = 0; } result.SalesInfo.BasicPrice = groupBuyInfo.SnapShotCurrentPrice + groupBuyInfo.SnapShotCashRebate + snapShotTariffPrice; } else { result.SalesInfo.BasicPrice = groupBuyInfo.SnapShotCurrentPrice + groupBuyInfo.SnapShotCashRebate; result.SalesInfo.TotalPrice = salesInfo.CurrentPrice; result.SalesInfo.TariffPrice = 0; result.SalesInfo.FreeEntryTax = false; } groupBuyInfo.MarketPrice = result.SalesInfo.BasicPrice; result.GroupBuyInfo = MapGroupBuyInfo(groupBuyInfo); } } if (promotionInfo != null && promotionInfo.Countdown != null) { //限时抢购重算市场价 decimal snapShotTariffPrice = promotionInfo.Countdown.SnapShotCurrentPrice * salesInfo.TariffRate; if (snapShotTariffPrice <= ConstValue.TariffFreeLimit) { snapShotTariffPrice = 0; } result.SalesInfo.BasicPrice = promotionInfo.Countdown.SnapShotCurrentPrice + promotionInfo.Countdown.SnapShotCashRebate + snapShotTariffPrice; } result.ActionInfo = MapActionInfo(result); return(result); }
public List <Product> ReadFromDB() { List <Product> products = new List <Product>(); try { string sql = "SELECT Name, Number, Model, PurchasePrice, SalesPrice, Location, Dimensions, Description, AmountInStock, AmountInStore, IsActive, AmountRequested FROM product"; MySqlCommand cmd = new MySqlCommand(sql, conn); string sqlSalesInfo = "SELECT Number, SoldAmount, Year, Month FROM productsalesinfo;"; MySqlCommand cmdSalesInfo = new MySqlCommand(sqlSalesInfo, conn); conn.Open(); MySqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { string name = dr[0].ToString(); int number = Convert.ToInt32(dr[1]); string model = dr[2].ToString(); double purchasePrice = Convert.ToDouble(dr[3]); double salesPrice = Convert.ToDouble(dr[4]); Location location = (Location)Enum.Parse(typeof(Location), dr[5].ToString()); string dimensions = dr[6].ToString(); string description = dr[7].ToString(); int amountInStock = Convert.ToInt32(dr[8]); int amountInStore = Convert.ToInt32(dr[9]); //Product product = new Product(name, number, model, purchasePrice, salesPrice, location, dimensions, // description); //product.AddAmountStock(amountInStock); //product.AddAmountStore(amountInStore); //product.IsActive = Convert.ToBoolean(dr[10]); bool isActive = Convert.ToBoolean(dr[10]); int amountRequested = Convert.ToInt32(dr[11]); Product product = new Product(name, number, model, purchasePrice, salesPrice, location, dimensions, description, amountInStore, amountInStock, isActive, amountRequested); products.Add(product); } dr.Close(); MySqlDataReader drSalesInfo = cmdSalesInfo.ExecuteReader(); List <ProductSalesInfo> allsalesinfo = new List <ProductSalesInfo>(); while (drSalesInfo.Read()) { ProductSalesInfo info = new ProductSalesInfo(Convert.ToInt32(drSalesInfo[0]), Convert.ToInt32(drSalesInfo[1]), drSalesInfo[3].ToString(), Convert.ToInt32(drSalesInfo[2])); allsalesinfo.Add(info); } drSalesInfo.Close(); foreach (ProductSalesInfo psi in allsalesinfo) { foreach (Product p in products) { if (p.Number == psi.ProductNum) { p.InitializeSalesInfo(psi); } } } } catch (MySqlException ex) { throw ex; } finally { if (conn != null) { conn.Close(); } } return(products); }
public void Initialize(ref OrderInfo order) { int currencySysno; int.TryParse(ConstValue.CurrencySysNo, out currencySysno); decimal exchangeRate = PipelineDA.GetCurrencyExchangeRate(currencySysno); order["CurrencySysNo"] = currencySysno; order["ExchangeRate"] = exchangeRate; foreach (OrderItemGroup itemGroup in order.OrderItemGroupList) { int minCountPerOrder = 0; int maxCountPerOrder = 0; foreach (OrderProductItem item in itemGroup.ProductItemList) { //商品基础信息 ProductBasicInfo basicInfo = PipelineDA.GetProductBasicInfoBySysNo(item.ProductSysNo); //商品备案信息 //ProductEntryInfo entryInfo = PipelineDA.GetProductEntryInfoBySysNo(item.ProductSysNo); //basicInfo.ProductEntryInfo = entryInfo; //item["ProductStoreType"] = (int)entryInfo.ProductStoreType; //商品备货时间 //item["LeadTimeDays"] = basicInfo.ProductEntryInfo.LeadTimeDays; //会员价格信息 ProductCustomerRankPrice rankPrice = null; if (order.Customer != null && order.Customer.SysNo > 0) { rankPrice = ECommerce.DataAccess.Product.ProductDA.GetProductCustomerRankPrice(order.Customer.SysNo, item.ProductSysNo); } //商品销售信息 ProductSalesInfo salesInfo = PipelineDA.GetProductSalesInfoBySysNo(item.ProductSysNo); item.ProductID = basicInfo.Code; item.ProductName = basicInfo.ProductName; item.Weight = basicInfo.Weight; item["ProductTitle"] = basicInfo.ProductTitle; item.DefaultImage = basicInfo.DefaultImage; item.UnitMarketPrice = salesInfo.MarketPrice; item.UnitCostPrice = salesInfo.UnitCostPrice; //套餐不享受会员价格 if (itemGroup.PackageNo > 0 && itemGroup.PackageType == 1) { item.UnitSalePrice = salesInfo.CurrentPrice; } else { item.UnitSalePrice = rankPrice != null && rankPrice.RankPrice < salesInfo.CurrentPrice ? rankPrice.RankPrice : salesInfo.CurrentPrice; } item.UnitRewardedPoint = salesInfo.Point; //由calculators计算 //item.UnitTaxFee = salesInfo.EntryTax.HasValue ? salesInfo.EntryTax.Value : 0m; //item["TariffRate"] = basicInfo.ProductEntryInfo.TariffRate; item.TotalInventory = salesInfo.OnlineQty; item.MerchantSysNo = basicInfo.VendorSysno; item.MerchantName = basicInfo.VendorInfo.VendorName; itemGroup.MerchantSysNo = basicInfo.VendorSysno; itemGroup.MerchantName = basicInfo.VendorInfo.VendorName; item["ProductStatus"] = (int)basicInfo.ProductStatus; item["Warranty"] = basicInfo.Warranty; salesInfo.MinCountPerOrder = salesInfo.OnlineQty < salesInfo.MinCountPerOrder ? salesInfo.OnlineQty : salesInfo.MinCountPerOrder; salesInfo.MaxCountPerOrder = salesInfo.OnlineQty < salesInfo.MaxCountPerOrder ? salesInfo.OnlineQty : salesInfo.MaxCountPerOrder; item["MinCountPerOrder"] = salesInfo.MinCountPerOrder; item["MaxCountPerOrder"] = salesInfo.MaxCountPerOrder; //每单限购计算,套餐则以套餐内商品最小限购数量为准 if (minCountPerOrder < salesInfo.MinCountPerOrder / item.UnitQuantity) { minCountPerOrder = salesInfo.MinCountPerOrder / item.UnitQuantity; } if (maxCountPerOrder.Equals(0) || maxCountPerOrder > salesInfo.MaxCountPerOrder / item.UnitQuantity) { maxCountPerOrder = salesInfo.MaxCountPerOrder / item.UnitQuantity; } decimal price = GetProductStepPrice(item.UnitSalePrice, item.ProductSysNo, itemGroup.Quantity); item.UnitSalePrice = price; //商品分组属性 List <ProductSplitGroupProperty> splitGroupProperty = PipelineDA.GetProductSplitGroupPropertyList(item.ProductSysNo); if (splitGroupProperty != null && splitGroupProperty.Count > 0) { item.SplitGroupPropertyDescList = new List <KeyValuePair <string, string> >(); foreach (ProductSplitGroupProperty property in splitGroupProperty) { item.SplitGroupPropertyDescList.Add(new KeyValuePair <string, string>(property.PropertyDescription, property.ValueDescription)); } } } itemGroup.MinCountPerSO = minCountPerOrder; itemGroup.MaxCountPerSO = maxCountPerOrder; //套餐名称 if (itemGroup.PackageType.Equals(1)) { var combo = PromotionDA.GetComboByComboSysNo(itemGroup.PackageNo); if (combo != null) { itemGroup["PackageName"] = combo.SaleRuleName; } } } }