/// <summary> /// 审核通过新品创建请求 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo ApproveProductRequest(SellerProductRequestInfo entity) { CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfo(entity); using (TransactionScope scope = new TransactionScope()) { if (entity.Type == SellerProductRequestType.ImageAndDescriptionUpdate) { //如果是图片与描述更新,则审批通过后状态变为‘处理中’ entity.Status = SellerProductRequestStatus.Processing; entity = _SellerProductRequestDA.UpdateSellerProductRequest(entity); } else { entity.Status = SellerProductRequestStatus.Approved; entity = _SellerProductRequestDA.SetSellerProductRequestStatus(entity); _SellerProductRequestDA.SetSellerProductRequestOtherStatus(entity); } int result = _SellerProductRequestDA.CallExternalSP(entity); if (result == 0) { throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerPortalCallExternalSPError")); } scope.Complete(); return(entity); } }
private List <ProductProperty> BuildProductPropertyList(SellerProductRequestInfo data) { var productProperties = new List <ProductProperty>(); data.SellerProductRequestPropertyList.ForEach(sellerProductProperty => { var property = new ProductProperty { PropertyGroup = new PropertyGroupInfo { SysNo = sellerProductProperty.GroupSysno }, Property = new PropertyValueInfo { SysNo = sellerProductProperty.ValueSysno, PropertyInfo = new PropertyInfo { SysNo = sellerProductProperty.PropertySysno } }, PersonalizedValue = new LanguageContent(sellerProductProperty.ManualInput), CompanyCode = data.CompanyCode, LanguageCode = data.LanguageCode }; productProperties.Add(property); }); return(productProperties); }
/// <summary> /// 转换分类视图和分类实体 /// </summary> /// <param name="data"></param> /// <returns></returns> private SellerProductRequestInfo CovertVMtoEntity(SellerProductRequestVM data) { SellerProductRequestInfo msg = data.ConvertVM <SellerProductRequestVM, SellerProductRequestInfo>(); msg.CategoryInfo = data.CategoryInfo.ConvertVM <CategoryVM, CategoryInfo>((v, t) => { t.CategoryName = new LanguageContent(v.CategoryName); }); msg.Brand = data.Brand.ConvertVM <BrandVM, BrandInfo>((v, t) => { t.BrandNameLocal = new LanguageContent(v.BrandNameLocal); }); msg.Manufacturer = data.Manufacturer.ConvertVM <ManufacturerVM, ManufacturerInfo>((v, t) => { t.ManufacturerNameLocal = new LanguageContent(v.ManufacturerNameLocal); }); msg.InUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.EditUser = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.Auditor = new UserInfo { SysNo = CPApplication.Current.LoginUser.userSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName }; msg.CompanyCode = CPApplication.Current.CompanyCode; msg.LanguageCode = data.LanguageCode; msg.SysNo = data.SysNo; return(msg); }
/// <summary> /// 在审核通过和退回时修改其它状态 /// </summary> /// <param name="entity"></param> public void SetSellerProductRequestOtherStatus(SellerProductRequestInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("SetSellerProductRequestOtherStatus"); cmd.SetParameterValue("@SysNo", entity.SysNo); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@CompanyCode", entity.CompanyCode); cmd.ExecuteNonQuery(); }
public int CallExternalSP(SellerProductRequestInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("CallExternalSP"); cmd.SetParameterValue("@SysNo", entity.SysNo); cmd.SetParameterValue("@VP_ProductSysno", entity.RequestSysno); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@Memo", entity.Memo); cmd.ExecuteNonQuery(); return((int)cmd.GetParameterValue("@IsSuccess")); }
/// <summary> /// 修改三级延保信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo SetSellerProductRequestStatus(SellerProductRequestInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("SetSellerProductRequestStatus"); cmd.SetParameterValue("@SysNo", entity.SysNo); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@Auditor", entity.Auditor.UserDisplayName); cmd.SetParameterValue("@CompanyCode", entity.CompanyCode); cmd.ExecuteNonQuery(); return(entity); }
/// <summary> /// 更新商品需求信息 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo UpdateSellerProductRequest(SellerProductRequestInfo entity) { DataCommand cmd = DataCommandManager.GetDataCommand("UpdateSellerProductRequest"); cmd.SetParameterValue("@SysNo", entity.SysNo); cmd.SetParameterValue("@CommonSKUNumber", entity.CommonSKUNumber); cmd.SetParameterValue("@ProductID", entity.ProductID); cmd.SetParameterValue("@Status", entity.Status); cmd.SetParameterValue("@EditUser", entity.EditUser.UserDisplayName); cmd.SetParameterValue("@CompanyCode", entity.CompanyCode); cmd.ExecuteNonQuery(); return(entity); }
/// <summary> /// 根据ProductIDo获取商家商品信息 /// </summary> /// <param name="productID"></param> /// <returns></returns> public virtual SellerProductRequestInfo GetSellerProductInfoByProductID(string productID) { //CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfoSysNo(sysNo); if (string.IsNullOrEmpty(productID)) { throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID")); } ProductProcessor productBp = new ProductProcessor(); ProductInfo productInfo = productBp.GetProductInfoByID(productID); if (productInfo == null) { throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID")); } var entity = new SellerProductRequestInfo(); entity.ProductID = productInfo.ProductID; entity.BriefName = productInfo.ProductBasicInfo.ProductBriefName; entity.ProductName = productInfo.ProductBasicInfo.ProductTitle.Content; entity.ProductLink = productInfo.ProductBasicInfo.ProductLink; entity.PackageList = productInfo.ProductBasicInfo.PackageList.Content; entity.Keywords = productInfo.ProductBasicInfo.Keywords.Content; entity.UPCCode = productInfo.ProductBasicInfo.UPCCode; entity.BriefName = productInfo.ProductBasicInfo.ProductBriefName; entity.IsTakePictures = (SellerProductRequestTakePictures)productInfo.ProductBasicInfo.IsTakePicture; entity.Attention = productInfo.ProductBasicInfo.Attention.Content; entity.Note = productInfo.ProductBasicInfo.Note; entity.PromotionTitle = productInfo.PromotionTitle.Content; //entity.HostWarrantyDay = productInfo.ProductWarrantyInfo.HostWarrantyDay; //entity.PartWarrantyDay = productInfo.ProductWarrantyInfo.PartWarrantyDay; //entity.Warranty = productInfo.ProductWarrantyInfo.Warranty.Content; entity.ServicePhone = productInfo.ProductWarrantyInfo.ServicePhone; entity.ServiceInfo = productInfo.ProductWarrantyInfo.ServiceInfo; // entity.IsOfferInvoice = productInfo.ProductWarrantyInfo.OfferVATInvoice== OfferVATInvoice.Yes? SellerProductRequestOfferInvoice.Yes: SellerProductRequestOfferInvoice.No; entity.Height = productInfo.ProductBasicInfo.ProductDimensionInfo.Height; entity.Weight = productInfo.ProductBasicInfo.ProductDimensionInfo.Weight; entity.Length = productInfo.ProductBasicInfo.ProductDimensionInfo.Length; entity.Width = productInfo.ProductBasicInfo.ProductDimensionInfo.Width; entity.MinPackNumber = productInfo.ProductPOInfo.MinPackNumber; entity.ProductDescLong = productInfo.ProductBasicInfo.LongDescription.Content; entity.SellerProductRequestPropertyList = _SellerProductRequestDA.GetSellerProductPropertyListByProductID(productID); return(entity); }
/// <summary> /// 检查商家商品实体 /// </summary> /// <param name="entity"></param> public static void CheckSellerProductRequestInfo(SellerProductRequestInfo entity) { if (entity == null) { //请求信息不存在 throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestSysNOIsNull")); } SellerProductRequestInfo oldEntity = _SellerProductRequestDA.GetSellerProductRequestInfoBySysNo(entity.SysNo.Value); if (oldEntity == null) { //请求信息不存在 throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestSysNOIsNull")); } //判断商品状态是否正确 if (oldEntity.Status != entity.Status) { //请求信息状态已变更请刷新再试! throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestStatusChange")); } }
/// <summary> /// 退回新品创建请求 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo DenyProductRequest(SellerProductRequestInfo entity) { CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfo(entity); using (TransactionScope scope = new TransactionScope()) { try { if (entity.Status == SellerProductRequestStatus.Approved) { entity.Status = SellerProductRequestStatus.WaitApproval; } else { entity.Status = SellerProductRequestStatus.UnApproved; } entity = _SellerProductRequestDA.SetSellerProductRequestStatus(entity); _SellerProductRequestDA.SetSellerProductRequestOtherStatus(entity); int result = _SellerProductRequestDA.CallExternalSP(entity); if (result == 0) { throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerPortalCallExternalSPError")); } } catch (Exception ex) { throw new BizException(ex.Message); } scope.Complete(); } return(entity); }
private ProductGroup BuildProductGroupInfo(SellerProductRequestInfo data) { var productGroup = new ProductGroup { SysNo = data.GroupSysno, ProductList = new List <ProductInfo>(), LanguageCode = data.LanguageCode }; var product = new ProductInfo(); product.CompanyCode = data.CompanyCode; product.LanguageCode = data.LanguageCode; product.PromotionTitle = new LanguageContent(data.PromotionTitle); product.ProductConsignFlag = data.IsConsign; product.ProductStatus = ProductStatus.InActive_UnShow; product.ProductPOInfo = new ProductPOInfo { MinPackNumber = data.MinPackNumber }; product.ProductPayType = ProductPayType.All; product.Merchant = new Merchant { SysNo = data.SellerSysNo }; product.OrginCode = data.OrginCode; product.ProductPriceInfo = new ProductPriceInfo { BasicPrice = data.BasicPrice, CashRebate = 0, CurrentPrice = data.CurrentPrice, DiscountAmount = 0, MaxCountPerDay = 1, MinCountPerOrder = 1, PayType = ProductPayType.All, Point = 0, ProductRankPrice = new List <ProductRankPriceInfo>(), ProductWholeSalePriceInfo = new List <ProductWholeSalePriceInfo>(), UnitCost = 999999, UnitCostWithoutTax = 999999, VirtualPrice = Math.Round(data.VirtualPrice, 2) }; product.ProductWarrantyInfo = new ProductWarrantyInfo { HostWarrantyDay = data.HostWarrantyDay, IsNoExtendWarranty = true, OfferVATInvoice = OfferVATInvoice.No, //CRL 21623 PartWarrantyDay = data.PartWarrantyDay, ServiceInfo = data.ServiceInfo, ServicePhone = data.ServicePhone, Warranty = new LanguageContent(data.Warranty), WarrantyShow = WarrantyShow.Yes }; product.ProductBasicInfo = new ProductBasicInfo { Attention = new LanguageContent(data.Attention), IsAccessoryShow = ProductIsAccessoryShow.No, IsTakePicture = ProductIsTakePicture.No, IsVirtualPic = ProductIsVirtualPic.No, Keywords = new LanguageContent(data.Keywords), LongDescription = new LanguageContent(data.ProductDescLong), Note = data.Note, PackageList = new LanguageContent(data.PackageList), Performance = String.Empty, PhotoDescription = new LanguageContent(String.Empty), ProductBrandInfo = data.Brand, ProductBriefTitle = new LanguageContent(data.BriefName), ProductBriefAddition = new LanguageContent(String.Empty), ProductCategoryInfo = data.CategoryInfo, ProductDimensionInfo = new ProductDimensionInfo { Height = data.Height, Length = data.Length, Weight = data.Weight, Width = data.Width }, ProductInfoFinishStatus = ProductInfoFinishStatus.No, ProductLink = data.ProductLink, ProductModel = new LanguageContent(data.ProductModel), ProductTitle = new LanguageContent(data.ProductName), ShortDescription = new LanguageContent(String.Empty), UPCCode = data.UPCCode, ProductType = ProductType.Normal, ProductProperties = BuildProductPropertyList(data) }; product.OperateUser = data.EditUser; product.CompanyCode = data.CompanyCode; product.LanguageCode = data.LanguageCode; productGroup.ProductList.Add(product); return(productGroup); }
/// <summary> /// 创建商品 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo CreateItemIDForNewProductRequest(SellerProductRequestInfo entity) { //判断请求类型是否正确 if (entity.Type != SellerProductRequestType.NewCreated) { //请求信息类型不为新品创建! throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestTypeNotNewCreated")); } CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfo(entity); //系统语言列表 List <Language> languageList = ExternalDomainBroker.GetAllLanguageList(); var defaultLanguage = languageList.FirstOrDefault(item => item.IsDefault == 1); using (TransactionScope scope = new TransactionScope()) { try { var productGroup = BuildProductGroupInfo(entity); productGroup.ProductList.ForEach(product => { product.ProductBasicInfo.LongDescription = new LanguageContent(); }); var dict = ObjectFactory <ProductProcessor> .Instance.ProductCreate(productGroup); if (!productGroup.LanguageCode.Equals(defaultLanguage.LanguageCode)) { ObjectFactory <ProductProcessor> .Instance.ProductLangCreate(productGroup);//写入商品多语言 } if (dict.Count > 0) { String exceptionMsg; if (dict.TryGetValue(productGroup.ProductList.First().GetHashCode(), out exceptionMsg)) { throw new BizException(exceptionMsg); } } int i = 0; foreach (SellerProductRequestFileInfo image in entity.SellerProductRequestFileList) { if (i == 0) { image.ImageName = productGroup.ProductList.First().ProductBasicInfo.CommonSkuNumber + ".jpg"; } else { image.ImageName = productGroup.ProductList.First().ProductBasicInfo.CommonSkuNumber + "_" + i.ToString().PadLeft(2, '0') + ".jpg"; } //设置Commonsku每张图片写上文件名 _SellerProductRequestDA.UpdateProductRequestImageName(image); i++; } entity.Status = SellerProductRequestStatus.Processing; entity.CommonSKUNumber = productGroup.ProductList.First().ProductBasicInfo.CommonSkuNumber; entity.ProductID = productGroup.ProductList.First().ProductID; entity = _SellerProductRequestDA.UpdateSellerProductRequest(entity); entity.Memo = entity.ProductID; _SellerProductRequestDA.CallExternalSP(entity); } catch (Exception ex) { throw new BizException(ex.Message); } scope.Complete(); } return(entity); }
/// <summary> /// 更新商品请求 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo UpdateProductRequest(SellerProductRequestInfo entity) { CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfo(entity); using (TransactionScope scope = new TransactionScope()) { try { ProductProcessor productBp = new ProductProcessor(); ProductInfo productInfo = productBp.GetProductInfoByID(entity.ProductID); if (productInfo == null) { //商品不存在 throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID")); } productInfo.CompanyCode = entity.CompanyCode; productInfo.LanguageCode = entity.LanguageCode; productInfo.ProductBasicInfo.ProductTitle.Content = entity.ProductName; productInfo.ProductBasicInfo.ProductLink = entity.ProductLink; productInfo.ProductBasicInfo.PackageList.Content = entity.PackageList; productInfo.ProductBasicInfo.Keywords.Content = entity.Keywords; productInfo.ProductBasicInfo.UPCCode = entity.UPCCode; productInfo.ProductBasicInfo.ProductBriefTitle.Content = entity.BriefName; productInfo.ProductBasicInfo.IsTakePicture = (ProductIsTakePicture)entity.IsTakePictures; productInfo.ProductBasicInfo.Attention.Content = entity.Attention; productInfo.ProductBasicInfo.Note = entity.Note; productInfo.PromotionTitle.Content = entity.PromotionTitle; //productInfo.ProductWarrantyInfo.HostWarrantyDay = entity.HostWarrantyDay; //productInfo.ProductWarrantyInfo.PartWarrantyDay = entity.PartWarrantyDay; //productInfo.ProductWarrantyInfo.Warranty.Content = entity.Warranty; productInfo.ProductWarrantyInfo.ServicePhone = entity.ServicePhone; productInfo.ProductWarrantyInfo.ServiceInfo = entity.ServiceInfo; // productInfo.ProductWarrantyInfo.OfferVATInvoice = entity.IsOfferInvoice== SellerProductRequestOfferInvoice.Yes? OfferVATInvoice.Yes: OfferVATInvoice.No; productInfo.ProductBasicInfo.ProductDimensionInfo.Height = entity.Height; productInfo.ProductBasicInfo.ProductDimensionInfo.Weight = entity.Weight; productInfo.ProductBasicInfo.ProductDimensionInfo.Length = entity.Length; productInfo.ProductBasicInfo.ProductDimensionInfo.Width = entity.Width; productInfo.ProductPOInfo.MinPackNumber = entity.MinPackNumber; //更新ProductCommonInfo _ProductCommonInfoDA.UpdateProductCommonInfoBasicInfo(productInfo, entity.EditUser); _ProductCommonInfoDA.UpdateProductCommonInfoDimensionInfo(productInfo, entity.EditUser); _ProductCommonInfoDA.UpdateProductCommonInfoWarrantyInfo(productInfo, entity.EditUser); _ProductCommonInfoDA.UpdateProductCommonInfoNote(productInfo, entity.EditUser); productInfo.OperateUser = entity.EditUser; _ProductDA.UpdateProductPurchaseInfo(productInfo); _ProductDA.UpdateProductBasicInfo(productInfo); if (entity.SellerProductRequestPropertyList.Count > 0) { foreach (SellerProductRequestPropertyInfo requestProperty in entity.SellerProductRequestPropertyList) { if (productInfo.ProductBasicInfo.ProductProperties != null && productInfo.ProductBasicInfo.ProductProperties.Count > 0) { var property = productInfo.ProductBasicInfo.ProductProperties.Where(p => p.Property.PropertyInfo.SysNo == requestProperty.PropertySysno && p.PropertyGroup.SysNo == requestProperty.GroupSysno).ToList(); if (property.Count > 0) { property.ForEach(p => productInfo.ProductBasicInfo.ProductProperties.Remove(p)); } } ProductProperty newProperty = new ProductProperty(); newProperty.Property = new PropertyValueInfo(); newProperty.PropertyGroup = new PropertyGroupInfo(); newProperty.Property.PropertyInfo = new PropertyInfo(); newProperty.PropertyGroup.SysNo = requestProperty.GroupSysno; newProperty.PropertyGroup.PropertyGroupName = new LanguageContent(requestProperty.GroupDescription); newProperty.Property.PropertyInfo.SysNo = requestProperty.PropertySysno; newProperty.Property.PropertyInfo.PropertyName = new LanguageContent(requestProperty.PropertyDescription); newProperty.Property.SysNo = requestProperty.ValueSysno; newProperty.Property.ValueDescription = new LanguageContent(requestProperty.ValueDescription); newProperty.PersonalizedValue = new LanguageContent(requestProperty.ManualInput); productInfo.ProductBasicInfo.ProductProperties.Add(newProperty); //更新请求属性信息 _SellerProductRequestDA.UpdateSellerProductRequestProperty(requestProperty, entity.EditUser.UserDisplayName); } } foreach (var p in productInfo.ProductBasicInfo.ProductProperties) { p.CompanyCode = entity.CompanyCode; p.LanguageCode = entity.LanguageCode; p.Property.SysNo = p.Property.SysNo ?? 0; } string result = productBp.UpdateProductPropertyInfo(productInfo); entity.Status = SellerProductRequestStatus.Finish; entity = _SellerProductRequestDA.SetSellerProductRequestStatus(entity); } catch (Exception ex) { throw new BizException(ex.Message); } scope.Complete(); } return(entity); }
public SellerProductRequestInfo DenyProductRequest(SellerProductRequestInfo request) { var entity = ObjectFactory <SellerProductRequestAppService> .Instance.DenyProductRequest(request); return(entity); }
/// <summary> /// 更新请求 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo UpdateProductRequest(SellerProductRequestInfo entity) { var result = ObjectFactory <SellerProductRequestProcessor> .Instance.UpdateProductRequest(entity); return(result); }
/// <summary> /// 创建商品 /// </summary> /// <param name="entity"></param> /// <returns></returns> public SellerProductRequestInfo CreateItemIDForNewProductRequest(SellerProductRequestInfo entity) { var result = ObjectFactory <SellerProductRequestProcessor> .Instance.CreateItemIDForNewProductRequest(entity); return(result); }
public SellerProductRequestInfo CreateItemIDForNewProductRequest(SellerProductRequestInfo request) { var entity = ObjectFactory <SellerProductRequestAppService> .Instance.CreateItemIDForNewProductRequest(request); return(entity); }