public string GetSkuList(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetSkuListRP> >();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var rd = new GetSkuListRD();//返回值

            var propService = new JIT.CPOS.BS.BLL.PropService(loggingSessionInfo);
            //sku部分
            var SKUDomain      = "SKU";
            var skuPropService = new JIT.CPOS.BS.BLL.SkuPropServer(loggingSessionInfo);
            var skuList        = skuPropService.GetSkuPropList();//获取了所有的规格(T_SKU_PROPerty a  和  T_Prop关联有数据的),T_SKU_PROPerty只存T_Prop表里prop_type为2(即属性级别的)并且domain为sku的

            foreach (var sku in skuList)
            {
                sku.Children = propService.GetPropListByParentId(SKUDomain, sku.prop_id);//sku的明细项,暂时用不到就不要加上了。
                if (sku.Children != null && sku.Children.Count != 0)
                {
                    sku.SkuValues = "";
                    foreach (var child in sku.Children)
                    {
                        if (sku.SkuValues != "")
                        {
                            sku.SkuValues += ",";
                        }
                        sku.SkuValues += child.Prop_Name;
                    }
                }
            }
            rd.SKUPropList = skuList;

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
        public string GetItemBaseData(string pRequest)
        {
            var rp = pRequest.DeserializeJSONTo <APIRequest <GetItemBaseDataRP> >();
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            var rd = new GetItemBaseDataRD();//返回值
            /// Prop_Type属性类型 1=组,2=属性,3=属性明细';
            var propService = new JIT.CPOS.BS.BLL.PropService(loggingSessionInfo);
            var ItemDomain  = "ITEM";
            var grouplist   = propService.GetPropListFirstByDomain(ItemDomain);//获取商品属性组

            foreach (var group in grouplist)
            {
                var propList = propService.GetPropListByParentId(ItemDomain, group.Prop_Id);//获取属性
                //Prop_Default_Value,每个属性上有默认的属性值
                foreach (var prop in propList)
                {
                    var propDetailList = propService.GetPropListByParentId(ItemDomain, prop.Prop_Id);//获取属性明细 (即属性的选项值)
                    prop.Children = propDetailList;
                }

                if (propList == null)
                {
                    throw new APIException(string.Format("{0}不允许为null", "ItemNewHandler.GetItemBaseData.group.Children"))
                          {
                              ErrorCode = ERROR_CODES.INVALID_REQUEST_CAN_NOT_FIND_ACTION_HANDLER
                          };
                }

                group.Children = propList;
            }
            rd.ItemPropGroupList = grouplist;
            //sku部分
            var SKUDomain      = "SKU";
            var skuPropService = new JIT.CPOS.BS.BLL.SkuPropServer(loggingSessionInfo);
            var skuList        = skuPropService.GetSkuPropList();//获取了所有的规格(T_SKU_PROPerty a  和  T_Prop关联有数据的),T_SKU_PROPerty只存T_Prop表里prop_type为2(即属性级别的)并且domain为sku的

            foreach (var sku in skuList)
            {
                sku.Children = propService.GetPropListByParentId(SKUDomain, sku.prop_id);//sku的明细项
            }
            rd.SKUPropList = skuList;

            //获取价格类型
            var priceTypeService = new JIT.CPOS.BS.BLL.ItemPriceTypeService(loggingSessionInfo);
            var priceTypeList    = priceTypeService.GetItemPriceTypeList();

            rd.ItemPriceTypeList = priceTypeList;

            var rsp = new SuccessResponse <IAPIResponseData>(rd);

            return(rsp.ToJSON());
        }
Beispiel #3
0
        /// <summary>
        /// 品牌信息同步
        /// </summary>
        /// <param name="BrandId">品牌唯一码</param>
        /// <param name="BrandName">品牌名称</param>
        /// <param name="DataFrom">来源1=brandDetail,2=prop</param>
        /// <param name="IsDelete">是否删除1=是,0=否</param>
        /// <returns></returns>
        public bool SetBrandAndPropSyn(string BrandId, string BrandName, int DataFrom, int IsDelete, out string strError)
        {
            bool bReturn = true;

            try
            {
                #region
                if (BrandId == null || BrandId.Trim().Equals(""))
                {
                    strError = "品牌唯一码为空";
                    return(false);
                }
                if (BrandName == null || BrandName.Trim().Equals(""))
                {
                    strError = "品牌名称为空";
                    return(false);
                }
                #endregion
                #region 修改属性
                if (DataFrom == 1)
                {
                    PropService propService = new PropService(this.CurrentUserInfo);
                    PropInfo    propInfo    = new PropInfo();
                    propInfo = propService.GetPropInfoById(BrandId);
                    if (propInfo == null || propInfo.Prop_Id == null || propInfo.Prop_Id.Equals(""))
                    {
                        propInfo.Prop_Id        = BrandId;
                        propInfo.Prop_Code      = BrandName;
                        propInfo.Prop_Name      = BrandName;
                        propInfo.Prop_Eng_Name  = BrandName;
                        propInfo.Prop_Type      = "3";
                        propInfo.Parent_Prop_id = "F8823C2EBACF4965BA134D3B10BD0B9F";
                        propInfo.Prop_Level     = 3;
                        propInfo.Prop_Domain    = "ITEM";
                        propInfo.Prop_Status    = 1;
                        propInfo.Display_Index  = 10;
                        propInfo.Create_Time    = BaseService.NewGuidPub();
                        propInfo.Create_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        propInfo.Modify_Time    = BaseService.NewGuidPub();
                        propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        strError = "新建属性品牌信息出错";
                        bReturn  = propService.SaveProp(propInfo, ref strError);
                    }
                    else
                    {
                        propInfo.Prop_Code      = BrandName;
                        propInfo.Prop_Name      = BrandName;
                        propInfo.Prop_Eng_Name  = BrandName;
                        propInfo.Modify_Time    = BaseService.NewGuidPub();
                        propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id;
                        propInfo.Prop_Status    = 1;
                        bReturn = propService.UpdateProp(propInfo);
                    }
                }
                #endregion

                #region 修改品牌
                if (DataFrom == 2)
                {
                    BrandDetailEntity brandInfo = new BrandDetailEntity();
                    brandInfo = GetByID(BrandId);
                    if (brandInfo == null || brandInfo.BrandId == null || brandInfo.BrandId.Trim().Equals(""))
                    {
                        BrandDetailEntity brandInfo1 = new BrandDetailEntity();
                        brandInfo1.BrandId      = BrandId;
                        brandInfo1.BrandCode    = BrandName;
                        brandInfo1.BrandName    = BrandName;
                        brandInfo1.BrandEngName = BrandName;
                        brandInfo1.CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id;
                        Create(brandInfo1);
                    }
                    else
                    {
                        brandInfo.BrandCode    = BrandName;
                        brandInfo.BrandName    = BrandName;
                        brandInfo.BrandEngName = BrandName;
                        brandInfo.CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id;
                        Update(brandInfo, false);
                    }
                }
                #endregion

                strError = "成功";
                return(bReturn);
            }
            catch (Exception ex) {
                strError = ex.ToString();
                return(false);
            }
        }