コード例 #1
0
ファイル: OutbillitemBLL.cs プロジェクト: JerryForNet/wuye
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, OutbillitemEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
        /// <summary>
        /// 加库存的Sql
        /// </summary>
        /// <param name="entryList"></param>
        /// <param name="i"></param>
        /// <returns></returns>
        public StringBuilder AddGoodsRepertorySql(OutbillitemEntity item)
        {
            var strSqls = new StringBuilder();

            strSqls.AppendFormat(@" UPDATE  tb_wh_goodsinfo
                                    SET     fcount = ISNULL(fcount, 0) + {0} ,
                                            fmoney = ( ISNULL(fmoney, 0) + {1} ) ,
                                            fprice = ROUND(CONVERT(FLOAT, ( ISNULL(fmoney, 0) + {1} )) / ( ISNULL(fcount, 0) + {0} ), 2)
                                    WHERE   fgoodsid = '{2}'  ", item.fnumber, item.fmoney, item.fgoodsid);
            return(strSqls);
        }
コード例 #3
0
        //     [HandlerAuthorize(PermissionMode.Enforce)]
        public ActionResult SaveForm(string keyValue, OutbillitemEntity entity)
        {
            string count = outbillitembll.NuCounts(entity.fgoodsid);

            if (double.Parse(count) < entity.fnumber)
            {
                return(Error("数量不足。"));
            }
            else
            {
                outbillitembll.SaveForm(keyValue, entity);
                return(Success("操作成功。"));
            }
        }
コード例 #4
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, OutbillitemEntity entity)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         entity.Modify(keyValue);
         this.BaseRepository().Update(entity);
     }
     else
     {
         entity.fitemid = entity.foutbillid + "00" + modifyid(entity.foutbillid); //生成领用单物品信息编号
         entity.fprice  = decimal.Parse(price(entity.fgoodsid));
         entity.fmoney  = decimal.Parse(entity.fprice.ToString()) * decimal.Parse(entity.fnumber.ToString());
         this.BaseRepository().Insert(entity);
     }
 }
コード例 #5
0
        /// <summary>
        /// 减库存的Sql
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public StringBuilder RemoveGoodsRepertorySql(OutbillitemEntity item)
        {
            var strSqls = new StringBuilder();

            strSqls.AppendFormat(@" UPDATE  tb_wh_goodsinfo
                                    SET     fcount = ( CASE WHEN ( ISNULL(fcount, 0) - {0} ) <= 0 THEN 0
                                                        ELSE ISNULL(fcount, 0) - {0}
                                                    END ) ,
                                            fmoney = ( CASE WHEN (( ISNULL(fmoney, 0) - {1} ) <= 0 OR ( ISNULL(fcount, 0) - {0} ) <= 0) THEN 0
                                                        ELSE ( fmoney - {1} )
                                                    END ) ,
                                            fprice = ( CASE WHEN (( ISNULL(fmoney, 0) - {1} ) <= 0 OR ( ISNULL(fcount, 0) - {0} ) <= 0) THEN 0
                                                        ELSE ROUND(CONVERT(FLOAT, ( ISNULL(fmoney, 0) - {1} )) / CONVERT(FLOAT, ( fcount - {0} )), 2)
                                                    END )
                                    WHERE   fgoodsid = '{2}'  ", item.fnumber, item.fmoney, item.fgoodsid);
            return(strSqls);
        }
コード例 #6
0
ファイル: InbillItemService.cs プロジェクト: JerryForNet/wuye
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="keyValue">主键</param>
        /// <param name="type">inid 入库单  outid 出库单</param>
        public void RemoveForm(string keyValue, string type)
        {
            IRepository db = this.BaseRepository().BeginTrans();

            try
            {
                if (type == "inid")
                {
                    #region 入库单删除
                    InbillItemEntity ent = GetEntity(keyValue);
                    if (ent != null)
                    {
                        GoodsinfoIService dal_g = new GoodsinfoService();
                        GoodsinfoEntity   ent_g = dal_g.GetEntity(ent.fgoodsid);
                        if (ent_g != null)
                        {
                            double dbe = ent_g.fcount - ent.fnumber.ToDouble();
                            if (dbe < 0)
                            {
                                dbe = 0;
                            }
                            ent_g.fcount = dbe;
                            decimal dl = ent_g.fmoney - ent.fmoney;
                            if (dl < 0)
                            {
                                dl = 0;
                            }
                            ent_g.fmoney = dl;
                            db.Update(ent_g);
                        }
                    }
                    db.Delete <InbillItemEntity>(keyValue);
                    #endregion
                }
                else if (type == "outid")
                {
                    #region 出库单删除
                    OutbillitemIService dal = new OutbillitemService();
                    OutbillitemEntity   ent = dal.GetEntity(keyValue);
                    if (ent != null)
                    {
                        GoodsinfoIService dal_g = new GoodsinfoService();
                        GoodsinfoEntity   ent_g = dal_g.GetEntity(ent.fgoodsid);
                        if (ent_g != null)
                        {
                            ent_g.fcount = ent_g.fcount + ent.fnumber.ToDouble();
                            decimal dl = ent_g.fmoney + ent.fmoney.ToDecimal();
                            ent_g.fmoney = dl;
                            db.Update(ent_g);
                        }
                    }

                    db.Delete <OutbillitemEntity>(keyValue);
                    #endregion
                }
                db.Commit();
            }
            catch (System.Exception)
            {
                db.Rollback();
                throw;
            }
        }