示例#1
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="p_BE">要删除的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RDelete(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         PackBox    entity  = (PackBox)p_BE;
         PackBoxCtl control = new PackBoxCtl(sqlTrans);
         control.Delete(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
示例#2
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                PackBox    entity  = (PackBox)p_BE;
                PackBoxCtl control = new PackBoxCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_PackBox, sqlTrans);
                if (entity.BoxNo == string.Empty)//条码号不存在
                {
                    entity.CreateTime = DateTime.Now;

                    FormNoControlRule rulest = new FormNoControlRule();

                    //处理生成箱号
                    entity.BoxNo = rulest.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                    rulest.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                }
                else//已存在
                {
                    string sql = "SELECT BoxNo FROM WH_PackBox WHERE BoxNo=" + SysString.ToDBString(entity.BoxNo);
                    if (sqlTrans.Fill(sql).Rows.Count != 0)//条码号已存在,则生成新条码
                    {
                        entity.CreateTime = DateTime.Now;

                        FormNoControlRule rulest = new FormNoControlRule();

                        //处理生成箱号
                        entity.BoxNo = rulest.RGetFormNo((int)FormNoControlEnum.码单箱号, sqlTrans);
                        rulest.RAddSort((int)FormNoControlEnum.码单箱号, sqlTrans);
                    }
                }

                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }