/// <summary> /// 更新商品请求 /// </summary> /// <param name="productID"> </param> /// <param name="categoryInfo"> </param> /// <returns></returns> public void ProductChangeCategory(string productID, CategoryInfo categoryInfo, UserInfo operateUser) { ProductProcessor productBp = new ProductProcessor(); ProductInfo product = productBp.GetProductInfoByID(productID); if (product == null) { //商品不存在 throw new BizException(ResouceManager.GetMessageString("IM.Product", "ProductIDNotExist")); } #region 类别处理 var group = _productGroupDA.GetProductGroup(product.SysNo); group.OperateUser = operateUser; product.OperateUser = operateUser; if (product.ProductBasicInfo.ProductCategoryInfo.SysNo != categoryInfo.SysNo) { if (product.ProductBasicInfo.ProductCategoryInfo.SysNo.HasValue) { if (_categoryPropertyDA.GetCategoryPropertyByCategorySysNo( product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(sourceCategoryProperty => !_categoryPropertyDA.GetCategoryPropertyByCategorySysNo( product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(p => p.Property.SysNo == sourceCategoryProperty.Property.SysNo))) { throw new BizException(ResouceManager.GetMessageString("IM.Category", "ProductChangeCategoryResult")); } product.ProductBasicInfo.ProductCategoryInfo = categoryInfo; productBp.UpdateGroupProductCategoryInfo(group, product); } } #endregion }