/// <summary> /// 图片添加 /// </summary> /// <param name="images">商品分类实体</param> /// <returns>返回操作是否成功 true:成功 false:不成功</returns> /// <remarks>2013-07-23 苟治国 创建</remarks> public bool AddProductImage(IList <PdProductImage> images) { int result = 0; int productSysNo = 0; foreach (var imageItem in images) { if (!string.IsNullOrEmpty(imageItem.ImageUrl)) { var list = IPdProductImageDao.Instance.GetProductImg(imageItem.ProductSysNo); if (list.Count >= 5) { continue; } var productImage = new PdProductImage(); productSysNo = imageItem.ProductSysNo; productImage.ProductSysNo = imageItem.ProductSysNo; productImage.ImageUrl = imageItem.ImageUrl; productImage.Status = (int)Hyt.Model.WorkflowStatus.ProductStatus.商品图片状态.隐藏; result = IPdProductImageDao.Instance.Insert(productImage); } } if (result > 0) { Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, string.Format("商品{0}添加图片", productSysNo), LogStatus.系统日志目标类型.商品图片, productSysNo, AdminAuthenticationBo.Instance.Current.Base.SysNo); return(true); } else { Log.SysLog.Instance.Error(LogStatus.系统日志来源.后台, string.Format("商品{0}添加图片失败", productSysNo), LogStatus.系统日志目标类型.商品图片, productSysNo, AdminAuthenticationBo.Instance.Current.Base.SysNo); return(false); } }
/// <summary> /// 设置排序 /// </summary> /// <param name="images">商品图片实体</param> /// <returns>返回操作是否成功 true:成功 false:不成功</returns> /// <remarks>2013-09-16 苟治国 创建</remarks> /// <remarks>2013-11-7 邵斌 添加日志记录</remarks> public bool DisplayOrder(IList <PdProductImage> images) { int result = 0; int productSysNo = 0; for (int i = 0; i < images.Count; i++) { PdProductImage productImage = GetModel(images[i].SysNo); productImage.DisplayOrder = images[i].DisplayOrder; productSysNo = productImage.ProductSysNo; result = Update(productImage); } if (result > 0) { //用户操作日志 Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, string.Format("商品{0}图片调整顺序", productSysNo), LogStatus.系统日志目标类型.商品图片排序, productSysNo, AdminAuthenticationBo.Instance.Current.Base.SysNo); return(true); } else { //用户操作日志 Log.SysLog.Instance.Error(LogStatus.系统日志来源.后台, string.Format("商品{0}图片调整顺序失败", productSysNo), LogStatus.系统日志目标类型.商品图片排序, productSysNo, AdminAuthenticationBo.Instance.Current.Base.SysNo); return(false); } }
/// <summary> /// 入库个别商品信息 /// </summary> /// <param name="supplyCode">供应链代码</param> /// <param name="sysNos">商品系统编号,逗号分隔</param> /// <returns></returns> /// <remarks>2016-4-22 王耀发 创建</remarks> public override Result <string> StockInSupplyProduct(string sysNos) { var result = new Result <string>() { Status = false, StatusCode = -1, Message = "未知错误" }; lock (lockHelper)//防止多人同时操作造成产品重复添加 { try { //是否有仓库 WhWarehouse Warehouse = BLL.Warehouse.WhWarehouseBo.Instance.GetAllWarehouseList().FirstOrDefault(w => w.Supply == (int)Code && w.Status == (int)Model.WorkflowStatus.WarehouseStatus.仓库状态.启用); if (Warehouse == null) { result.Message = string.Format("尚未创建{0}专用仓库,如果已创建请更新后台缓存!", Code.ToString()); return(result); } string[] sysNoArray = sysNos.Split(','); int UserSysNo = AdminAuthenticationBo.Instance.Current.Base.SysNo; for (var i = 0; i < sysNoArray.Length; i++) { int SysNo = int.Parse(sysNoArray[i]); ScProduct Product = IScProductDao.Instance.GetScProductInfo(SysNo); //未入库的商品可入库 if (Product.ProductSysNo == 0) { using (var tran = new System.Transactions.TransactionScope()) { var jsonObject = JObject.Parse(Product.Receipt); //PdProductList PdData = new PdProductList(); string ErpCode = jsonObject["SkuId"].ToString(); string ProductName = jsonObject["Name"].ToString(); string EasName = jsonObject["Name"].ToString(); string DefaultImage = jsonObject["DefaultImage"].ToString(); string Remark = jsonObject["Remark"].ToString(); //商品类目 var CategoryName = jsonObject["CategoryName"].ToString(); PdCategorySql PdCmodel = new PdCategorySql(); PdCmodel.ParentSysNo = 0; PdCmodel.CategoryName = CategoryName; PdCmodel.Code = ""; PdCmodel.SeoTitle = CategoryName; PdCmodel.SeoKeyword = CategoryName; PdCmodel.SeoDescription = CategoryName; PdCmodel.TemplateSysNo = 0; PdCmodel.IsOnline = 1; PdCmodel.Status = 1; PdCmodel.CreatedBy = 1; PdCmodel.CreatedDate = DateTime.Now; PdCmodel.LastUpdateBy = 1; PdCmodel.LastUpdateDate = DateTime.Now; PdCategoryAssociation PdCAmodel = new PdCategoryAssociation(); PdCAmodel.IsMaster = 1; PdCAmodel.CreatedBy = 1; PdCAmodel.CreatedDate = DateTime.Now; PdCAmodel.LastUpdateBy = 1; PdCAmodel.LastUpdateDate = DateTime.Now; //品牌 //品牌 int BrandSysNo; var BrandName = jsonObject["BrandName"].ToString(); PdBrand pEnity = PdBrandBo.Instance.GetEntityByName(BrandName); //判断商品品牌是否存在 if (pEnity != null) { BrandSysNo = pEnity.SysNo; } else { var pmodel = new PdBrand(); pmodel.Name = BrandName; pmodel.Status = 1; BrandSysNo = IPdBrandDao.Instance.Create(pmodel); } string GrosWeight = jsonObject["Weight"].ToString(); string Price = jsonObject["Price"].ToString(); var prmodel = SetPriceModel(Decimal.Parse(Price), (int)Hyt.Model.WorkflowStatus.ProductStatus.产品价格来源.基础价格, 0); // new PdPrice(); var sprmodel = SetPriceModel(Decimal.Parse(Price), (int)Hyt.Model.WorkflowStatus.ProductStatus.产品价格来源.会员等级价, 1); // new PdPrice(); var sspmodel = SetPriceModel(Decimal.Parse(Price), (int)Hyt.Model.WorkflowStatus.ProductStatus.产品价格来源.门店销售价, 0); // new PdPrice(); //绑定原产地 var orginSysNo = 0; var orginName = "其他"; Origin Origin = BLL.Basic.OriginBo.Instance.GetEntityByName(orginName); orginSysNo = Origin != null ? Origin.SysNo : DataAccess.Basic.IOriginDao.Instance.Insert(new Origin() { Origin_Name = orginName, CreatedBy = UserSysNo, CreatedDate = DateTime.Now, LastUpdateBy = UserSysNo, LastUpdateDate = DateTime.Now }); var currentInfo = BLL.Authentication.AdminAuthenticationBo.Instance.Current; int agentSysNo = 1; int dealerSysNo = 0; if (currentInfo.Dealer != null) { dealerSysNo = currentInfo.Dealer.SysNo; agentSysNo = currentInfo.DealerCreatedBy; } int TradeMode = 0; switch (jsonObject["TradeMode"].ToString()) { case "3": TradeMode = (int)Model.WorkflowStatus.ProductStatus.商品类型.完税商品; break; case "2": TradeMode = (int)Model.WorkflowStatus.ProductStatus.商品类型.直邮商品; break; default: TradeMode = (int)Model.WorkflowStatus.ProductStatus.商品类型.普通商品; break; } //创建商品 var excellst = new List <PdProductList>(); var model = new PdProductList { ErpCode = ErpCode, //商品编号 ProductName = ProductName, //商品名称 EasName = EasName, //商品名称 BrandSysNo = BrandSysNo, //品牌 ProductType = TradeMode, //商品类型(模式) OriginSysNo = orginSysNo, //国家 Barcode = "", GrosWeight = Decimal.Parse(GrosWeight), //重量 Tax = "0", PriceRate = 0M, PriceValue = 0M, TradePrice = 0M, PdPrice = prmodel, PdSalePrice = sprmodel, PdStoreSalePrice = sspmodel, PdCategorySql = PdCmodel, PdCategoryAssociation = PdCAmodel, DealerSysNo = dealerSysNo, AgentSysNo = agentSysNo,//默认为总部代理商 CreatedBy = 1, CreatedDate = DateTime.Now, LastUpdateBy = 1, LastUpdateDate = DateTime.Now, SalesMeasurementUnit = "g", ProductDesc = System.Web.HttpUtility.UrlEncode(Remark, System.Text.Encoding.GetEncoding("UTF-8")).Replace("+", " ")//描述 }; excellst.Add(model); try { //新增商品 IPdProductDao.Instance.CreatePdProduct(excellst); //根据编号获取商品 PdProduct Entity = IPdProductDao.Instance.GetEntityByErpCode(ErpCode); if (Entity != null) { List <string> imageslist = new List <string>(); string images = jsonObject["ImageList"].ToString(); imageslist = JsonConvert.DeserializeObject <List <string> >(images); for (var j = 0; j < imageslist.Count; j++) { if (j < 5) { var productImage = new PdProductImage(); productImage.ProductSysNo = Entity.SysNo; productImage.DisplayOrder = j; productImage.ImageUrl = imageslist[j].ToString(); if (j == 0) { productImage.Status = (int)Hyt.Model.WorkflowStatus.ProductStatus.商品图片状态.显示; } else { productImage.Status = (int)Hyt.Model.WorkflowStatus.ProductStatus.商品图片状态.隐藏; } int res = IPdProductImageDao.Instance.Insert(productImage); } } //更新商品临时表的ProductSysNo ScProductBo.Instance.UpdateProductSysNo(SysNo, Entity.SysNo); //创建商品库存 ScProductBo.Instance.ProCreateSupplyStock((int)Code, Entity.SysNo, decimal.Parse(jsonObject["StockQuantity"].ToString()), UserSysNo); } else { result.Message = "获取商品数据错误"; result.Status = false; return(result); } } catch (Exception ex) { result.Message = string.Format("数据错误:{0}", ex.Message); result.Status = false; return(result); } tran.Complete(); } } result.Status = true; } } catch (Exception ex) { result.Message = ex.Message; result.Status = false; result.StatusCode = -2; } return(result); } }
private void AddBaseTaskObjectToList(List <BaseTask> listObject) { BaseTask bsAT = new BsArea(); BaseTask bsDP = new BsDeliveryPayment(); BaseTask bsPT = new BsPaymentType(); BaseTask bsCode = new BsCode(); BaseTask bsOrganization = new BsOrganization(); BaseTask bsOrganizationWarehouse = new BsOrganizationWarehouse(); BaseTask crCustomer = new CrCustomer(); BaseTask crCL = new CrCustomerLevel(); BaseTask crCQ = new CrCustomerQuestion(); BaseTask crRA = new CrReceiveAddress(); BaseTask dsMallType = new DsMallType(); BaseTask dsDealerLevel = new DsDealerLevel(); BaseTask feArticle = new FeArticle(); BaseTask feAC = new FeArticleCategory(); BaseTask feCS = new FeCommentSupport(); BaseTask fepc = new FeProductComment(); BaseTask fePCI = new FeProductCommentImage(); BaseTask fePCR = new FeProductCommentReply(); BaseTask feSearchKeyword = new FeSearchKeyword(); BaseTask feadvertgroup = new FeAdvertGroup(); BaseTask feadvertitem = new FeAdvertItem(); BaseTask feproductgroup = new FeProductGroup(); BaseTask feproductitem = new FeProductItem(); BaseTask fnIT = new FnInvoiceType(); BaseTask fninvoice = new FnInvoice(); BaseTask fnpv = new FnReceiptVoucher(); BaseTask fnReceiptVoucherItem = new FnReceiptVoucherItem(); BaseTask fnop = new FnOnlinePayment(); BaseTask fnPaymentVoucher = new FnPaymentVoucher(); BaseTask fnPaymentVoucherItem = new FnPaymentVoucherItem(); BaseTask lgDelivery = new LgDelivery(); BaseTask lgDI = new LgDeliveryItem(); BaseTask lgDS = new LgDeliveryScope(); BaseTask lgDT = new LgDeliveryType(); BaseTask lgDUC = new LgDeliveryUserCredit(); BaseTask lgPT = new LgPickupType(); BaseTask lgsettlement = new LgSettlement(); BaseTask lgSI = new LgSettlementItem(); BaseTask lgDeliveryPrintTemplate = new LgDeliveryPrintTemplate(); BaseTask pdAttribute = new PdAttribute(); BaseTask pdAG = new PdAttributeGroup(); BaseTask pdAGA = new PdAttributeGroupAssociation(); BaseTask pdAO = new PdAttributeOption(); BaseTask pdBrand = new PdBrand(); BaseTask pdCGA = new PdCatAttributeGroupAso(); BaseTask pdCategory = new PdCategory(); BaseTask pdCA = new PdCategoryAssociation(); BaseTask pdPrice = new PdPrice(); BaseTask pdProduct = new PdProduct(); BaseTask pdPA = new PdProductAssociation(); BaseTask pdProductAttribute = new PdProductAttribute(); BaseTask pdPI = new PdProductImage(); BaseTask pdTemplate = new PdTemplate(); BaseTask pdProductStatistics = new PdProductStatistics(); BaseTask soOrder = new SoOrder(); BaseTask soOrderItem = new SoOrderItem(); BaseTask soRA = new SoReceiveAddress(); BaseTask SyUG = new SyUserGroup(); BaseTask syGU = new SyGroupUser(); BaseTask syMenu = new SyMenu(); BaseTask syMenuPrivilege = new SyMenuPrivilege(); BaseTask syPrivilege = new SyPrivilege(); BaseTask syRole = new SyRole(); BaseTask syRoleMenu = new SyRoleMenu(); BaseTask syRolePrivilege = new SyRolePrivilege(); BaseTask syPermission = new SyPermission(); BaseTask syUser = new SyUser(); BaseTask syUW = new SyUserWarehouse(); BaseTask syMyMenu = new SyMyMenu(); BaseTask spcombo = new SpCombo(); BaseTask spComboItem = new SpComboItem(); BaseTask spcopon = new spcoupon(); BaseTask sqpromotion = new SPpromotion(); BaseTask spromotiongift = new SPpromotiongift(); BaseTask sppromotionoverlay = new SPpromotionoverlay(); BaseTask sppromotionrule = new SPpromotionrule(); BaseTask sppromotionrulecondition = new SPpromotionrulecondition(); BaseTask sppromotionrulekeyvalue = new SPpromotionrulekeyvalue(); BaseTask syTaskConfig = new SyTaskConfig(); BaseTask whStockOut = new WhStockOut(); BaseTask whStockOutItem = new WhstockOutItem(); BaseTask whwarehouse = new WhWarehouse(); BaseTask whwa = new WHwarehousearea(); BaseTask whwdy = new WHwarehouseDeliveryType(); BaseTask whWPT = new WhWarehousePickupType(); BaseTask whstockin = new WhStockIn(); BaseTask whstockinItem = new WHStockinItem(); BaseTask rcReturn = new RCReturn(); BaseTask rcReturnItem = new RcReturnItem(); listObject.Add(bsAT); listObject.Add(bsDP); listObject.Add(bsPT); listObject.Add(bsCode); listObject.Add(bsOrganization); listObject.Add(bsOrganizationWarehouse); listObject.Add(crCustomer); listObject.Add(crCL); listObject.Add(crCQ); listObject.Add(crRA); listObject.Add(dsMallType); listObject.Add(dsDealerLevel); listObject.Add(feArticle); listObject.Add(feAC); listObject.Add(feCS); listObject.Add(fePCI); listObject.Add(fePCR); listObject.Add(fepc); listObject.Add(feSearchKeyword); listObject.Add(feadvertgroup); listObject.Add(feadvertitem); listObject.Add(feproductgroup); listObject.Add(feproductitem); listObject.Add(fnIT); listObject.Add(fnpv); listObject.Add(fnReceiptVoucherItem); listObject.Add(fnop); listObject.Add(fninvoice); listObject.Add(fnPaymentVoucher); listObject.Add(fnPaymentVoucherItem); listObject.Add(lgDelivery); listObject.Add(lgDI); listObject.Add(lgDS); listObject.Add(lgDT); listObject.Add(lgPT); listObject.Add(lgsettlement); listObject.Add(lgSI); listObject.Add(lgDeliveryPrintTemplate); listObject.Add(pdAttribute); listObject.Add(pdAG); listObject.Add(pdAGA); listObject.Add(pdAO); listObject.Add(pdBrand); listObject.Add(pdCGA); listObject.Add(pdCategory); listObject.Add(pdCA); listObject.Add(pdPrice); listObject.Add(pdProduct); listObject.Add(pdPA); listObject.Add(pdProductAttribute); listObject.Add(pdTemplate); listObject.Add(pdProductStatistics); listObject.Add(soOrder); listObject.Add(soOrderItem); listObject.Add(spcombo); listObject.Add(spComboItem); listObject.Add(spcopon); listObject.Add(sqpromotion); listObject.Add(spromotiongift); //listObject.Add(sppromotionoverlay); listObject.Add(sppromotionrule); listObject.Add(sppromotionrulecondition); listObject.Add(sppromotionrulekeyvalue); listObject.Add(syGU); listObject.Add(syUW); listObject.Add(SyUG); listObject.Add(syMenu); listObject.Add(syUser); listObject.Add(syPermission); listObject.Add(syMenuPrivilege); listObject.Add(syPrivilege); listObject.Add(syRole); listObject.Add(syRoleMenu); listObject.Add(syRolePrivilege); listObject.Add(syMyMenu); listObject.Add(syTaskConfig); listObject.Add(whStockOut); listObject.Add(whStockOutItem); listObject.Add(whwarehouse); listObject.Add(whwa); listObject.Add(whwdy); listObject.Add(whWPT); listObject.Add(whstockin); listObject.Add(whstockinItem); listObject.Add(rcReturn); listObject.Add(rcReturnItem); listObject.Add(lgDUC); listObject.Add(pdPI); listObject.Add(soRA); }