public static int SetExchangePricePermission(GoodsGrantExt entity) { var res = 0; using (var trans = utity.BeginTransaction()) { try { string sql = "update GoodsGrant set ExchangePrice=@ExchangePrice,IsAllowExchange=@IsAllowExchange where BarId = @BarID and StoreID = @StoreID"; res = utity.ExecuteNonQuery(trans, CommandType.Text, sql, new System.Data.Common.DbParameter[] { new SqlParameter("@ExchangePrice", entity.ExchangePrice), new SqlParameter("@IsAllowExchange", entity.IsAllowExchange), new SqlParameter("@StoreID", entity.StoreID), new SqlParameter("@BarID", entity.BarID) } ); trans.Commit(); } catch (System.Exception ee) { trans.Rollback(); } } return(res); }
public static int SetDiscountPricePermission(GoodsGrantExt entity) { return(utity.ExecuteNonQuerySp("usp_SetDiscountPricePermission", new object[] { entity.DiscountPrice.ToString(), entity.GroupPrice.ToString(), entity.IsAllowDiscount?1:0, entity.BarID, entity.StoreID })); }
/// <summary> /// 商品换购 /// </summary> /// <param name="goodsGrantExt"></param> private void Fm_ExchangeEvent(GoodsGrantExt goodsGrantExt) { if (!(gvGoods.RowCount > 0)) { ShowMessage("至少需要购买一件以上商品才能进行换购!"); return; } if (null != goodsGrantExt) { FindAddGoods(goodsGrantExt.BarID, exchangeGoods: goodsGrantExt); gvGoods.RefreshData(); } }
public ActionResult SubmitExchangePrice(GoodsGrantExt entity) { PartialLog log = new PartialLog(); log.Description = $"商品换购:{entity.StoreID}门店,设置{entity.Name}换购价:{entity.ExchangePrice}"; log.ModuleName = "商品管理"; try { var res = GoodsBLL.instance.SetExchangePricePermission(entity); log.Result = res > 0 ? ResultType.success.ToString() : ResultType.error.ToString(); WriteLog(log); } catch (Exception ee) { log.Result = ResultType.error.ToString(); WriteLog(log); return(Error("商品换购!" + ee.Message)); } return(Success($"操作成功!")); }
public int SetExchangePricePermission(GoodsGrantExt entity) { return(GoodsDAL.SetExchangePricePermission(entity)); }
public int SetDiscountPricePermission(GoodsGrantExt entity) { return(GoodsDAL.SetDiscountPricePermission(entity)); }
/// <summary> /// 根据条码或商品名查找并添加合并到商品列表 /// </summary> /// <param name="goodsCodeOrName">条码</param> /// <param name="act">会掉函数</param> /// <param name="isSendGoods">是否赠品</param> /// <param name="exchangeGoods">换购商品信息</param> private void FindAddGoods(string goodsCodeOrName = "", Action act = null, bool isSendGoods = false, GoodsGrantExt exchangeGoods = null) { if (string.IsNullOrEmpty(goodsCodeOrName)) { return; } //库存充足 var entity = GoodsBLL.instance.GetGoodsListByCodeOrName(goodsCodeOrName, UserInfo.Instance.StoreID.ToString()); if (entity != null) { if (entity.Count > 1) { txtSearchGoods.Properties.Items.Clear(); txtSearchGoods.Properties.Items.AddRange(entity.Select(item => item.Name).ToArray()); txtSearchGoods.ShowPopup(); } else { if (entity[0].StockQuantity <= 0) { XtraMessageBox.Show("商品库存不足!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Mapper.Initialize(m => m.CreateMap <GoodsEntity, PosExt>()); var mapGoodsExt = Mapper.Map <PosExt>(entity[0]); var realPrice = 0.0m; if (isSendGoods) { realPrice = 0.0m; mapGoodsExt.PosDiscountPrice = 0.00m; mapGoodsExt.RetailPrice = 0.00m; } else if (exchangeGoods != null) { //换购价作为折扣销售价格 mapGoodsExt.PosDiscountPrice = exchangeGoods.ExchangePrice; realPrice = mapGoodsExt.PosDiscountPrice; } else { //单品折扣 GoodsGrantEntity goodsGrant = Marketing.DiscountGoodsItem(mapGoodsExt); realPrice = goodsGrant == null ? 0 : goodsGrant.DiscountPrice; mapGoodsExt.PosDiscountPrice = realPrice > 0 ? realPrice : mapGoodsExt.PosDiscountPrice; } if (PosGoodsList.Count > 0) { //var fitGoods = PosGoodsList.Find(item => item.BarID == mapGoodsExt.BarID&&item.RetailPrice== mapGoodsExt.RetailPrice); var fitGoods = PosGoodsList.Find(item => item.BarID == mapGoodsExt.BarID && item.RetailPrice == mapGoodsExt.RetailPrice && item.PosDiscountPrice == mapGoodsExt.PosDiscountPrice); if (fitGoods != null) { fitGoods.PosSalesCount += 1; fitGoods.PosSalesAmount = fitGoods.PosSalesCount * (realPrice > 0 ? realPrice : mapGoodsExt.RetailPrice);; } else { mapGoodsExt.PosSalesCount = 1; mapGoodsExt.PosSalesAmount = mapGoodsExt.PosSalesCount * (realPrice > 0 ? realPrice : mapGoodsExt.RetailPrice); PosGoodsList.Add(mapGoodsExt); } } else { //单品折扣价格生效则按照单品折扣价格计算 mapGoodsExt.PosSalesCount = 1; mapGoodsExt.PosSalesAmount = mapGoodsExt.PosSalesCount * (realPrice > 0 ? realPrice : mapGoodsExt.RetailPrice); var existData = grdGoods.DataSource as List <PosExt>; if (existData != null && existData.Any()) { PosGoodsList = existData; } PosGoodsList.Add(mapGoodsExt); } } } act?.Invoke(); }