public string Download(int c3SysNo, string companyCode) { m_companyCode = companyCode; string c3Name = ExternalDomainBroker.GetCategory3Info(c3SysNo).CategoryName.Content; string fileName = BulidResponseFileName(c3Name); //生成模版 DataFeedTemplate template = BulidTemplate(c3SysNo, c3Name); //输出模版 return(GetTemplateUrl(template, fileName)); }
/// <summary> /// 获取优惠券所有信息,包含了组装好的其它Domain的描述、计算类信息,但是不Load优惠券代码信息 /// </summary> /// <param name="sysNo"></param> /// <returns></returns> public virtual CouponsInfo Load(int?sysNo) { CouponsInfo info = _processor.Load(sysNo); //在APPService中,Load 是为了Restful所调用,所以需要组装CouponsInfo中其它Domain中的描述类信息 #region 商品范围条件 if (info.ProductCondition != null) { //组装品牌的名称信息在UI上显示 if (info.ProductCondition.RelBrands != null && info.ProductCondition.RelBrands.BrandList != null && info.ProductCondition.RelBrands.BrandList.Count > 0) { foreach (SimpleObject obj in info.ProductCondition.RelBrands.BrandList) { obj.Name = ExternalDomainBroker.GetBrandInfoBySysNo(obj.SysNo.Value).BrandNameLocal.Content; } } //组装商品类别的名称信息在UI上显示 if (info.ProductCondition.RelCategories != null && info.ProductCondition.RelCategories.CategoryList != null && info.ProductCondition.RelCategories.CategoryList.Count > 0) { foreach (SimpleObject obj in info.ProductCondition.RelCategories.CategoryList) { obj.Name = ExternalDomainBroker.GetCategory3Info(obj.SysNo.Value).CategoryName.Content; } } //组装商品的ID、名称、毛利率在UI上显示 if (info.ProductCondition.RelProducts != null && info.ProductCondition.RelProducts.ProductList != null && info.ProductCondition.RelProducts.ProductList.Count > 0) { foreach (RelProductAndQty prd in info.ProductCondition.RelProducts.ProductList) { ProductInfo product = ExternalDomainBroker.GetProductInfo(prd.ProductSysNo.Value); prd.ProductName = product.ProductBasicInfo.ProductTitle.Content; prd.ProductID = product.ProductID; if (info.CouponChannelType == CouponsMKTType.MKTPM) { prd.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetCouponGrossMarginRateForPM(product, sysNo.Value); } else { prd.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetCouponGrossMarginRate(product); } } } } #endregion #region 客户范围条件 if (info.CustomerCondition != null) { //地区信息的名称在Portal端组装(因为客户端本身也要加载所有地区信息) //客户等级的名称在Portal端组装(因为客户端本身也要加载所有等级信息) //服务端组装Customer的基础信息 if (info.CustomerCondition.RelCustomers != null && info.CustomerCondition.RelCustomers.CustomerIDList != null && info.CustomerCondition.RelCustomers.CustomerIDList.Count > 0) { foreach (CustomerAndSend cas in info.CustomerCondition.RelCustomers.CustomerIDList) { } } } #endregion info.IsExistThrowInTypeCouponCode = _processor.CheckExistThisTypeCouponCode(info.SysNo, CouponCodeType.ThrowIn); return(info); }
/// <summary> /// 获取赠品所有信息 /// </summary> /// <param name="sysNo"></param> /// <returns></returns> public virtual SaleGiftInfo Load(int?sysNo) { SaleGiftInfo info = _processor.Load(sysNo); if (info.ProductCondition != null) { foreach (SaleGift_RuleSetting setting in info.ProductCondition) { if (setting.RelBrand != null && setting.RelBrand.SysNo.HasValue) { var brandName = ExternalDomainBroker.GetBrandInfoBySysNo(setting.RelBrand.SysNo.Value); if (brandName != null && brandName.BrandNameLocal != null) { setting.RelBrand.Name = brandName.BrandNameLocal.Content; } } if (setting.RelC3 != null && setting.RelC3.SysNo.HasValue) { var categoryName = ExternalDomainBroker.GetCategory3Info(setting.RelC3.SysNo.Value); if (categoryName != null && categoryName.CategoryName != null) { setting.RelC3.Name = categoryName.CategoryName.Content; } } if (setting.RelProduct != null && setting.RelProduct.ProductSysNo.HasValue) { ProductInfo product = ExternalDomainBroker.GetProductInfo(setting.RelProduct.ProductSysNo.Value); if (product != null) { setting.RelProduct.ProductName = product.ProductName; setting.RelProduct.ProductID = product.ProductID; //获取商品可用库存,代销库存,毛利率等接口 ProductInventoryInfo inventory = ExternalDomainBroker.GetProductTotalInventoryInfo(product.SysNo); setting.RelProduct.AvailableQty = inventory.AvailableQty; setting.RelProduct.ConsignQty = inventory.ConsignQty; setting.RelProduct.VirtualQty = inventory.VirtualQty; setting.RelProduct.UnitCost = product.ProductPriceInfo.UnitCost; setting.RelProduct.CurrentPrice = product.ProductPriceInfo.CurrentPrice; } } } foreach (SaleGift_RuleSetting setting in info.ProductCondition) { if (setting.RelProduct.ProductSysNo.HasValue) { ProductInfo product = ExternalDomainBroker.GetProductInfo(setting.RelProduct.ProductSysNo.Value); if (product != null) { int minBuyQty = setting.RelProduct.MinQty.HasValue ? (setting.RelProduct.MinQty.Value == 0 ? 1 : setting.RelProduct.MinQty.Value) : 1; setting.RelProduct.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetSaleGift_SaleItemGrossMarginRate(product, minBuyQty, sysNo.Value, info); } } } } if (info.GiftItemList != null) { foreach (RelProductAndQty giftItem in info.GiftItemList) { ProductInfo product = ExternalDomainBroker.GetProductInfo(giftItem.ProductSysNo.Value); if (product == null) { continue; } giftItem.ProductName = product.ProductName;; giftItem.ProductID = product.ProductID; //获取商品可用库存,代销库存,毛利率等接口 ProductInventoryInfo inventory = ExternalDomainBroker.GetProductTotalInventoryInfo(product.SysNo); if (inventory == null) { continue; } giftItem.AvailableQty = inventory.AvailableQty; giftItem.ConsignQty = inventory.ConsignQty; giftItem.VirtualQty = inventory.VirtualQty; giftItem.GrossMarginRate = ObjectFactory <GrossMarginProcessor> .Instance.GetSaleGift_GiftItemGrossMarginRate(product, info.DisCountType.Value); giftItem.UnitCost = product.ProductPriceInfo.UnitCost; giftItem.CurrentPrice = product.ProductPriceInfo.CurrentPrice; } } return(info); }