Пример #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                WHCalMethod entity = (WHCalMethod)p_BE;
                string      sql    = "SELECT Code FROM Enum_WHCalMethod WHERE Code=" + SysString.ToDBString(entity.Code);

                sql += " AND ID<>" + SysString.ToDBString(entity.ID);
                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("编码已经存在,请重新输入!");
                }
                sql  = "SELECT Name FROM Enum_WHCalMethod WHERE Name=" + SysString.ToDBString(entity.Name);
                sql += " AND ID<>" + SysString.ToDBString(entity.ID);
                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("名称已经存在,请重新输入!");
                }
                WHCalMethodCtl control = new WHCalMethodCtl(sqlTrans);

                control.Update(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);
                OP        entity = (OP)p_BE;
                string    sql    = "SELECT * FROM Data_OP WHERE OPID=" + SysString.ToDBString(entity.OPID);
                DataTable dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("员工编号已存在,请检查后重新输入");
                }
                sql = "SELECT * FROM Data_OP WHERE OPName=" + SysString.ToDBString(entity.OPName);
                dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("员工已存在,请检查后重新输入");
                }
                OPCtl control = new OPCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_OP, sqlTrans);
                control.AddNew(entity);

                FormNoControlRule fnrule = new FormNoControlRule();
                fnrule.RAddSort("Data_OP", "OPID", 0, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #3
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);
                SaleGroup entity = (SaleGroup)p_BE;

                string sql = string.Empty;
                sql = "select 1 from Enum_SaleGroup where Code = " + SysString.ToDBString(entity.Code);
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("该编码已存在,请重新输入");
                }
                sql = "select 1 from Enum_SaleGroup where Name = " + SysString.ToDBString(entity.Name);
                DataTable dt1 = sqlTrans.Fill(sql);
                if (dt1.Rows.Count != 0)
                {
                    throw new Exception("该组别已存在,请重新输入");
                }

                SaleGroupCtl control = new SaleGroupCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Enum_SaleGroup, sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #4
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);
         SOContext entity = (SOContext)p_BE;
         string    sql    = "SELECT * FROM Data_SOContext WHERE Code=" + SysString.ToDBString(entity.Code);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("合同内容编号已存在,请重新生成");
         }
         sql = "SELECT * FROM Data_SOContext WHERE Name=" + SysString.ToDBString(entity.Name);
         dt  = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("合同内容名称已存在,请重新生成");
         }
         SOContextCtl control = new SOContextCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_SOContext, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #5
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                Currency entity = (Currency)p_BE;
                string   sql    = string.Empty;
                sql  = " SELECT 1 FROM  Data_Currency WHERE Code= " + SysString.ToDBString(entity.Code);
                sql += " AND ID<> " + entity.ID;

                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("编码已经存在,请重新输入!");
                }
                sql  = " SELECT 1 FROM  Data_Currency WHERE Name= " + SysString.ToDBString(entity.Name);
                sql += " AND ID<> " + entity.ID;
                dt   = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("名称已经存在,请重新输入!");
                }
                CurrencyCtl control = new CurrencyCtl(sqlTrans);
                control.Update(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #6
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(CWDuiZhang p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                ///初始化对账标志
                string sql = "Select * From CaiWu_CWDuiZhangDts WHERE  1=1";
                sql += " AND MainID=" + SysString.ToDBString(p_Entity.ID);
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        sql  = "Update WH_IOFormDts Set DZFlag=0,DZTime=null,DZOPID='',DZNo='',DZQty=0";
                        sql += " WHERE 1=1 AND MainID=" + SysConvert.ToInt32(dt.Rows[i]["IOFormID"]);
                        sql += " AND Seq=" + SysConvert.ToInt32(dt.Rows[i]["IOFormSeq"]);
                        sqlTrans.ExecuteNonQuery(sql);
                    }
                }

                sql = "DELETE FROM CaiWu_CWDuiZhangDts WHERE MainID=" + p_Entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据
                for (int i = 0; i < p_BE.Length; i++)
                {
                    CWDuiZhangDts entitydts = (CWDuiZhangDts)p_BE[i];
                    sql              = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM CaiWu_CWDuiZhangDts WHERE MainID=" + p_Entity.ID.ToString();
                    entitydts.Seq    = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq
                    entitydts.MainID = p_Entity.ID;
                    this.RAdd(entitydts, sqlTrans);

                    ///处理对账标志
                    sql = "Update WH_IOFormDts Set DZFlag=1";
                    if (p_Entity.DZDate != SystemConfiguration.DateTimeDefaultValue)
                    {
                        sql += " ,DZTime=" + SysString.ToDBString(p_Entity.DZDate.Date);
                    }
                    else
                    {
                        sql += " ,DZTime=null";
                    }
                    sql += ",DZQty=" + SysString.ToDBString(p_Entity.DZQty);
                    sql += ",DZOPID=" + SysString.ToDBString(p_Entity.DZOPID);
                    sql += ",DZNo=" + SysString.ToDBString(p_Entity.Code);
                    sql += ",SinglePrice=" + SysString.ToDBString(entitydts.SinglePrice);
                    sql += ",Amount=" + SysString.ToDBString(entitydts.Amount);


                    sql += " WHERE 1=1 AND MainID=" + SysConvert.ToInt32(entitydts.IOFormID);
                    sql += " AND Seq=" + SysConvert.ToInt32(entitydts.IOFormSeq);
                    sqlTrans.ExecuteNonQuery(sql);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #7
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);
         Unit entity = (Unit)p_BE;
         //验证编码-名称是否重复输入
         string    sql = "SELECT * FROM Enum_Unit WHERE Code=" + SysString.ToDBString(entity.Code);
         DataTable dt  = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("计量单位编码已存在,请检查后重新输入");
         }
         sql  = "SELECT * FROM Enum_Unit WHERE Name=" + SysString.ToDBString(entity.Name);
         sql += " AND NameEn=" + SysString.ToDBString(entity.NameEN);
         dt   = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单位名称已存在,请检查后重新输入");
         }
         UnitCtl control = new UnitCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Enum_Unit, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #8
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);
                WHCaiWuType entity = (WHCaiWuType)p_BE;
                string      sql    = string.Empty;

                sql = " SELECT 1 FROM Enum_WHCaiWuType WHERE Code= " + SysString.ToDBString(entity.Code);

                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("编码已经存在,请重新输入!");
                }
                sql = " SELECT 1 FROM  Enum_WHCaiWuType WHERE Name= " + SysString.ToDBString(entity.Name);
                if (sqlTrans.Fill(sql).Rows.Count != 0)
                {
                    throw new Exception("名称已经存在,请重新输入!");
                }
                WHCaiWuTypeCtl control = new WHCaiWuTypeCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Enum_WHCaiWuType, sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #9
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         WHSpecialType entity = (WHSpecialType)p_BE;
         string        sql    = string.Empty;
         sql = " SELECT 1 FROM Enum_WHSpecialType WHERE Code= " + SysString.ToDBString(entity.Code) + " AND ID<>" + entity.ID;
         if (sqlTrans.Fill(sql).Rows.Count != 0)
         {
             throw new Exception("该编码已经存在,请重新输入!");
         }
         sql = " SELECT 1 FROM  Enum_WHSpecialType WHERE Name= " + SysString.ToDBString(entity.Name) + " AND ID<>" + entity.ID;
         if (sqlTrans.Fill(sql).Rows.Count != 0)
         {
             throw new Exception("该名称已经存在,请重新输入!");
         }
         WHSpecialTypeCtl control = new WHSpecialTypeCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #10
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                MLLB entity = (MLLB)p_BE;

                string    sql = "SELECT * FROM Data_MLLB WHERE Code=" + SysString.ToDBString(entity.Code) + " AND ID<>" + entity.ID;
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("编码已存在,请检查后重新输入!");
                }
                sql = "SELECT * FROM Data_MLLB WHERE Name=" + SysString.ToDBString(entity.Name) + " AND ID<>" + entity.ID;
                dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("名称已存在,请检查后重新输入!");
                }

                MLLBCtl control = new MLLBCtl(sqlTrans);
                control.Update(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #11
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave(Vendor p_Entity, BaseEntity[] p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Data_VendorAddress WHERE MainID=" + p_Entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据
                for (int i = 0; i < p_BE.Length; i++)
                {
                    VendorAddress entitydts = (VendorAddress)p_BE[i];
                    sql              = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Data_VendorAddress WHERE MainID=" + p_Entity.ID.ToString();
                    entitydts.Seq    = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());//找到最大的Seq
                    entitydts.MainID = p_Entity.ID;

                    sql = " SELECT Address FROM Data_VendorAddress WHERE MainID=" + SysString.ToDBString(p_Entity.ID) + " AND Address=" + SysString.ToDBString(entitydts.Address);
                    if (sqlTrans.Fill(sql).Rows.Count != 0 && SysConvert.ToString(sqlTrans.Fill(sql).Rows[0][0]) != "")
                    {
                        throw new Exception(" 地址已存在,请检查");
                    }

                    this.RAdd(entitydts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #12
0
        /// <summary>
        /// 资金核销关联
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="sqlTrans"></param>
        public void RHT(RecPay payEntity, RecPayHTDts htentity, IDBTransAccess sqlTrans)
        {
            ItemBuyCapExDts entityDts = new ItemBuyCapExDts();

            entityDts.ExCapName       = payEntity.FormNo;//存储付款单号
            entityDts.ExItemCode      = htentity.HTItemCode;
            entityDts.ExPayStepTypeID = payEntity.PayStepTypeID;
            entityDts.ExPayAmount     = htentity.HTAmount;
            entityDts.ExPayLimitDate  = payEntity.ExDate.Date;
            entityDts.ExRemark        = htentity.ID.ToString();//备注记录付款合同核销ID,便于关联检索

            string sql = string.Empty;

            sql = "SELECT ID FROM Buy_ItemBuyForm WHERE FormNo=" + SysString.ToDBString(htentity.HTNo);
            DataTable dt = sqlTrans.Fill(sql);

            if (dt.Rows.Count != 0)
            {
                entityDts.MainID = SysConvert.ToInt32(dt.Rows[0]["ID"]);
            }

            sql           = "SELECT ISNULL(MAX(Seq),0)+1 AS MSeq FROM Buy_ItemBuyCapExDts WHERE MainID=" + SysString.ToDBString(entityDts.MainID);
            entityDts.Seq = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0]["MSeq"]);

            this.RAdd(entityDts, sqlTrans);
        }
Пример #13
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);
         MLLB      entity = (MLLB)p_BE;
         string    sql    = "SELECT * FROM Data_MLLB WHERE Code=" + SysString.ToDBString(entity.Code);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("编码已存在,请检查后重新输入!");
         }
         sql = "SELECT * FROM Data_MLLB WHERE Name=" + SysString.ToDBString(entity.Name);
         dt  = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("名称已存在,请检查后重新输入!");
         }
         MLLBCtl control = new MLLBCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_MLLB, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #14
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);
                Currency entity = (Currency)p_BE;
                string   sql    = string.Empty;

                sql = " SELECT 1 FROM  Data_Currency WHERE Code= " + SysString.ToDBString(entity.Code);

                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("编码已经存在,请重新输入!");
                }
                sql = " SELECT 1 FROM  Data_Currency WHERE Name= " + SysString.ToDBString(entity.Name);
                dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("名称已经存在,请重新输入!");
                }
                CurrencyCtl control = new CurrencyCtl(sqlTrans);
                //entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Currency, sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #15
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd(BaseEntity p_BE, int p_ID, IDBTransAccess sqlTrans)
        {
            try
            {
                ItemGBRule rule   = new ItemGBRule();
                ItemGB     entity = (ItemGB)p_BE;
                string     sql    = "SELECT GBCode FROM Data_ItemGB WHERE GBCode=" + SysString.ToDBString(entity.GBCode);
                DataTable  dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("挂板条码已存在,请重新输入");
                }
                sql = "SELECT Max(Seq) Seq FROM Data_ItemGB WHERE MainID=" + SysString.ToDBString(p_ID);
                dt  = sqlTrans.Fill(sql);
                int seq = 1;
                if (dt.Rows.Count > 0)
                {
                    seq = SysConvert.ToInt32(dt.Rows[0][0]);
                }

                entity.MainID = p_ID;
                entity.Seq    = seq + 1;
                rule.RAdd(entity, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #16
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         Unit      entity = (Unit)p_BE;
         string    sql    = "SELECT * FROM Enum_Unit WHERE Code=" + SysString.ToDBString(entity.Code) + " AND ID<>" + entity.ID;
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("计量单位编码已存在,请检查后重新输入");
         }
         sql  = "SELECT * FROM Enum_Unit WHERE Name=" + SysString.ToDBString(entity.Name) + " AND ID<>" + entity.ID;
         sql += " AND NameEn=" + SysString.ToDBString(entity.NameEN);
         dt   = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("单位名称已存在,请检查后重新输入");
         }
         UnitCtl control = new UnitCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #17
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);
         KSType    entity = (KSType)p_BE;
         string    sql    = "SELECT Code FROM Enum_KSType WHERE Code=" + SysString.ToDBString(entity.Code);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("助记码已经存在,请重新输入");
         }
         sql = "SELECT Name FROM Enum_KSType WHERE Name=" + SysString.ToDBString(entity.Name);
         DataTable dt2 = sqlTrans.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("科室名称已经存在,请重新输入");
         }
         KSTypeCtl control = new KSTypeCtl(sqlTrans);
         //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Enum_KSType,sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #18
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         Brand  entity = (Brand)p_BE;
         string sql    = "SELECT BrandID FROM Data_Brand WHERE BrandID=" + SysString.ToDBString(entity.BrandID);
         sql += " AND ID <>" + entity.ID;
         DataTable dt = sqlTrans.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("此编码已存在,请重新生成");
         }
         sql  = "SELECT BrandAttn FROM Data_Brand WHERE BrandAttn=" + SysString.ToDBString(entity.BrandAttn);
         sql += " AND ID <>" + entity.ID;
         DataTable dt2 = sqlTrans.Fill(sql);
         if (dt2.Rows.Count != 0)
         {
             throw new Exception("此简称已存在,请重新生成");
         }
         BrandCtl control = new BrandCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #19
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);
         WH     entity  = (WH)p_BE;
         WHCtl  control = new WHCtl(sqlTrans);
         string sql     = string.Empty;
         sql = " SELECT 1 FROM  WH_WH WHERE WHID= " + SysString.ToDBString(entity.WHID);
         if (sqlTrans.Fill(sql).Rows.Count != 0)
         {
             throw new Exception("仓库编码已经存在,请重新输入!");
         }
         sql = " SELECT 1 FROM  WH_WH WHERE WHNM= " + SysString.ToDBString(entity.WHNM);
         if (sqlTrans.Fill(sql).Rows.Count != 0)
         {
             throw new Exception("仓库名称已经存在,请重新输入!");
         }
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.WH_WH, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #20
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);
         Follow    entity = (Follow)p_BE;
         string    sql    = "SELECT * FROM Data_Follow WHERE Sort=" + SysString.ToDBString(entity.Sort);
         DataTable dt     = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("流程序号已存在,请重新选择");
         }
         sql = "SELECT * FROM Data_Follow WHERE Name=" + SysString.ToDBString(entity.Name);
         dt  = sqlTrans.Fill(sql);
         if (dt.Rows.Count > 0)
         {
             throw new BaseException("流程已存在,请重新生成");
         }
         FollowCtl control = new FollowCtl(sqlTrans);
         entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Follow, sqlTrans);
         control.AddNew(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #21
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);
                Brand entity = (Brand)p_BE;

                string    sql = "SELECT BrandID FROM Data_Brand WHERE BrandID=" + SysString.ToDBString(entity.BrandID);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    throw new Exception("此编码已存在,请重新生成");
                }
                sql = "SELECT BrandAttn FROM Data_Brand WHERE BrandAttn=" + SysString.ToDBString(entity.BrandAttn);
                DataTable dt2 = sqlTrans.Fill(sql);
                if (dt2.Rows.Count != 0)
                {
                    throw new Exception("此简称已存在,请重新生成");
                }
                BrandCtl control = new BrandCtl(sqlTrans);
                //entity.ID=(int)EntityIDTable.GetID((long)SysEntity.Data_Brand,sqlTrans);
                control.AddNew(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #22
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="p_BE">要修改的实体</param>
 /// <param name="sqlTrans">事务类</param>
 public void RUpdate(BaseEntity p_BE, IDBTransAccess sqlTrans)
 {
     try
     {
         this.CheckCorrect(p_BE);
         KSType entity = (KSType)p_BE;
         string sql    = " SELECT Code FROM Enum_KSType WHERE Code=" + SysString.ToDBString(entity.Code);
         sql += " AND ID <> " + SysString.ToDBString(entity.ID);
         DataTable dt = sqlTrans.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("助记码已经存在,请重新输入");
         }
         sql  = " SELECT Name FROM Enum_KSType WHERE Name=" + SysString.ToDBString(entity.Name);
         sql += " AND ID <> " + SysString.ToDBString(entity.ID);
         DataTable dt2 = sqlTrans.Fill(sql);
         if (dt.Rows.Count != 0)
         {
             throw new Exception("科室名称已经存在,请重新输入");
         }
         KSTypeCtl control = new KSTypeCtl(sqlTrans);
         control.Update(entity);
     }
     catch (BaseException)
     {
         throw;
     }
     catch (Exception E)
     {
         throw new BaseException(E.Message);
     }
 }
Пример #23
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);
                Vendor entity = (Vendor)p_BE;


                string    sql = "SELECT ID FROM Data_Vendor WHERE VendorID=" + SysString.ToDBString(entity.VendorID);
                DataTable dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("客户编码已存在,请检查后重新输入");
                }
                sql = "SELECT ID FROM Data_Vendor WHERE VendorAttn=" + SysString.ToDBString(entity.VendorAttn);
                dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("客户简称已存在,请检查后重新输入");
                }
                sql = "SELECT ID FROM Data_Vendor WHERE VendorName=" + SysString.ToDBString(entity.VendorName);
                dt  = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("客户全称已存在,请检查后重新输入");
                }


                sql  = "SELECT ID FROM Data_Vendor WHERE QQ=" + SysString.ToDBString(entity.QQ);
                sql += " AND ISNULL(QQ,'')<>''";
                dt   = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("客户QQ已存在,请检查后重新输入");
                }
                sql  = "SELECT ID FROM Data_Vendor WHERE Address=" + SysString.ToDBString(entity.Address);
                sql += " AND ISNULL(Address,'')<>''";
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("客户地址已存在,请检查后重新输入");
                }


                VendorCtl control = new VendorCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Data_Vendor, sqlTrans);
                control.AddNew(entity);

                FormNoControlRule fnrule = new FormNoControlRule();
                fnrule.RAddSort("Data_Vendor", "VendorID", entity.VendorTypeID, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #24
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);
                CWInvoice    entity  = (CWInvoice)p_BE;
                CWInvoiceCtl control = new CWInvoiceCtl(sqlTrans);



                string sql = "Select * From CaiWu_CWInvoiceDts WHERE  1=1";
                sql += " AND MainID=" + SysString.ToDBString(entity.ID);
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count != 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        #region 处理对账和仓库开票的数据回填
                        //处理对账单中的对账标志
                        sql = "UPDATE CaiWu_CWDuiZhang Set DZFlag=0 WHERE Code=" + SysString.ToDBString(dt.Rows[i]["DZCode"].ToString());
                        sqlTrans.ExecuteNonQuery(sql);


                        sql  = "Select * From CaiWu_CWDuiZhangDts WHERE  1=1 ";
                        sql += " AND MainID=" + " (SELECT ID FROM CaiWu_CWDuiZhang WHERE Code=" + SysString.ToDBString(dt.Rows[i]["DZCode"].ToString()) + ")";
                        DataTable dt2 = sqlTrans.Fill(sql);
                        if (dt2.Rows.Count != 0)
                        {
                            for (int j = 0; j < dt2.Rows.Count; j++)
                            {
                                ///处理仓库发票标志

                                sql  = "Update WH_IOFormDts Set DtsInvoiceDelFlag=0,DtsInvoiceDelTime=null,DtsInvoiceDelOPID='',DtsInvoiceNo='',InvoiceQty=0";
                                sql += " WHERE 1=1 AND MainID=" + SysString.ToDBString(dt2.Rows[j]["IOFormID"].ToString());
                                sql += " AND Seq=" + SysString.ToDBString(dt2.Rows[j]["IOFormSeq"].ToString());
                                sqlTrans.ExecuteNonQuery(sql);
                            }
                        }
                    }
                    #endregion
                }

                sql = "DELETE FROM CaiWu_CWInvoiceDts WHERE MainID=" + entity.ID.ToString();
                sqlTrans.ExecuteNonQuery(sql);//删除原单据明细数据
                control.Delete(entity);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #25
0
        /// <summary>
        /// 保存(传入事务处理)
        /// </summary>
        /// <param name="p_Entity"></param>
        /// <param name="p_BE"></param>
        /// <param name="sqlTrans"></param>
        public void RSave2(InvoiceOperation p_Entity, BaseEntity[] p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                string sql = "DELETE FROM Finance_InvoiceOperationDts WHERE MainID=" + p_Entity.ID.ToString();
                sql += " AND ID NOT IN" + string.Format("({0})", GetIDExist(p_BE));
                sqlTrans.ExecuteNonQuery(sql);                                                                                       //删除原单据里应该删除的明细数据,即数据库里有但是UI里已经删除的数据
                sql = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Finance_InvoiceOperationDts WHERE MainID=" + p_Entity.ID.ToString(); ////找到最大的Seq    将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?)
                int MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());
                for (int i = 0; i < p_BE.Length; i++)
                {
                    InvoiceOperationDts entitydts = (InvoiceOperationDts)p_BE[i];
                    if (entitydts.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        this.RUpdate(entitydts, sqlTrans);
                    }
                    else
                    {
                        entitydts.Seq    = MSEQ;
                        entitydts.MainID = p_Entity.ID;
                        this.RAdd(entitydts, sqlTrans);

                        MSEQ++;//最大值加1
                    }
                }

                sql  = "SELECT ISNULL(MAX(Seq),0)+1 As MSEQ FROM Finance_InvoiceYOperationDts WHERE MainID=" + p_Entity.ID.ToString();////找到最大的Seq    将获得最大Seq的语句放到循环外更高效(多人操作时会有问题吗?)
                MSEQ = SysConvert.ToInt32(sqlTrans.Fill(sql).Rows[0][0].ToString());
                InvoiceYOperationDtsRule rule2 = new InvoiceYOperationDtsRule();
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    InvoiceYOperationDts entitydts2 = (InvoiceYOperationDts)p_BE2[i];
                    if (entitydts2.ID != 0)//ID不为0说明数据库中已经存在
                    {
                        rule2.RUpdate(entitydts2, sqlTrans);
                    }
                    else
                    {
                        entitydts2.Seq    = MSEQ;
                        entitydts2.MainID = p_Entity.ID;
                        rule2.RAdd(entitydts2, sqlTrans);

                        MSEQ++;//最大值加1
                    }
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #26
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>

        public void RSubmit(Custom p_BE, IDBTransAccess sqlTrans)
        {
            try
            {
                if (p_BE.SubmitFlag == 0)
                {
                    p_BE.SubmitFlag = 1;
                    RUpdate(p_BE, sqlTrans);

                    #region 自动产生清关文件
                    string    sql    = "SELECT MainID,Seq FROM Ship_CustomInvoiceDts WHERE MainID=" + p_BE.ID; //准备明细数据源
                    DataTable dtdts1 = sqlTrans.Fill(sql);                                                     //准备明细数据源

                    string    sqlcheck = "SELECT ID FROM Ship_Custom WHERE InvoiceNo=" + SysString.ToDBString(p_BE.InvoiceNo) + " AND CompanyTypeID=3";
                    DataTable dtcheck  = sqlTrans.Fill(sqlcheck); //检查是否已经自动产生了清关文件
                    if (dtcheck.Rows.Count == 0)                  //没有产生的情况下才执行
                    {
                        p_BE.CompanyTypeID = 3;
                        p_BE.ID            = 0;
                        RAdd(p_BE, sqlTrans);


                        foreach (DataRow dr in dtdts1.Rows)//增加发票明细
                        {
                            CustomInvoiceDts entitydts1 = new CustomInvoiceDts(sqlTrans);
                            entitydts1.MainID = SysConvert.ToInt32(dr["MainID"]);
                            entitydts1.Seq    = SysConvert.ToInt32(dr["Seq"]);
                            entitydts1.SelectByID();

                            entitydts1.MainID = p_BE.ID;

                            CustomInvoiceDtsRule ruledts1 = new CustomInvoiceDtsRule();
                            ruledts1.RAdd(entitydts1, sqlTrans);
                        }
                        //后面可以增加其他明细数据,代码和上面类似。。。
                    }

                    #endregion
                }
                else
                {
                    throw new Exception("单据不是未提交状态请检查!");
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #27
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="p_BE">要修改的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RUpdate2(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                InvoiceOperation entity = (InvoiceOperation)p_BE;
                string           sql    = "SELECT FormNo FROM Finance_InvoiceOperation WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                sql += " AND ID<>" + entity.ID;
                DataTable dt = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("单号已存在,异常操作,请联系管理员检查");
                }

                if (entity.InvoiceNO != "")
                {
                    sql  = "SELECT ID FROM Finance_InvoiceOperation WHERE InvoiceNO=" + SysString.ToDBString(entity.InvoiceNO);
                    sql += " AND ID<>" + entity.ID;
                    dt   = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        throw new BaseException("发票号已存在,请重新输入");
                    }
                }



                InvoiceOperationCtl control = new InvoiceOperationCtl(sqlTrans);
                control.Update(entity);

                sql = "DELETE Finance_InvoiceYOperationDts WHERE MainID=" + SysString.ToDBString(entity.ID);
                sqlTrans.ExecuteNonQuery(sql);
                for (int i = 0; i < p_BE2.Length; i++)
                {
                    InvoiceYOperationDtsRule rule      = new InvoiceYOperationDtsRule();
                    InvoiceYOperationDts     entityDts = (InvoiceYOperationDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    rule.RAdd(entityDts, sqlTrans);
                }
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #28
0
        /// <summary>
        /// 新增(传入事务处理)
        /// </summary>
        /// <param name="p_BE">要新增的实体</param>
        /// <param name="sqlTrans">事务类</param>
        public void RAdd2(BaseEntity p_BE, BaseEntity[] p_BE2, IDBTransAccess sqlTrans)
        {
            try
            {
                this.CheckCorrect(p_BE);
                InvoiceOperation entity = (InvoiceOperation)p_BE;
                string           sql    = "SELECT FormNo FROM Finance_InvoiceOperation WHERE FormNo=" + SysString.ToDBString(entity.FormNo);
                DataTable        dt     = sqlTrans.Fill(sql);
                if (dt.Rows.Count > 0)
                {
                    throw new BaseException("单号已存在,请重新生成");
                }

                if (entity.InvoiceNO != "")
                {
                    sql = "SELECT ID FROM Finance_InvoiceOperation WHERE InvoiceNO=" + SysString.ToDBString(entity.InvoiceNO);
                    dt  = sqlTrans.Fill(sql);
                    if (dt.Rows.Count > 0)
                    {
                        throw new BaseException("发票号已存在,请重新输入");
                    }
                }

                InvoiceOperationCtl control = new InvoiceOperationCtl(sqlTrans);
                entity.ID = (int)EntityIDTable.GetID((long)SysEntity.Finance_InvoiceOperation, sqlTrans);
                control.AddNew(entity);

                for (int i = 0; i < p_BE2.Length; i++)
                {
                    InvoiceYOperationDtsRule rule      = new InvoiceYOperationDtsRule();
                    InvoiceYOperationDts     entityDts = (InvoiceYOperationDts)p_BE2[i];
                    entityDts.MainID = entity.ID;
                    entityDts.Seq    = i + 1;
                    rule.RAdd(entityDts, sqlTrans);
                }

                FormNoControlRule rulest = new FormNoControlRule();
                rulest.RAddSort((int)FormNoControlEnum.发票单号, sqlTrans);
            }
            catch (BaseException)
            {
                throw;
            }
            catch (Exception E)
            {
                throw new BaseException(E.Message);
            }
        }
Пример #29
0
        /// <summary>
        /// 按传入的SQL语句查询后给属性赋值
        /// </summary>
        /// <param name="p_Sql">SQL语句</param>
        /// <returns>记录存在回true,不存在返回false</returns>
        protected override bool Select(string p_Sql)
        {
            DataTable MasterTable = new DataTable();

            if (!this.sqlTransFlag)
            {
                MasterTable = this.Fill(p_Sql);
            }
            else
            {
                MasterTable = sqlTrans.Fill(p_Sql);
            }

            if (MasterTable.Rows.Count > 0)
            {
                //查询主表记录
                m_ID      = SysConvert.ToInt32(MasterTable.Rows[0]["ID"]);
                m_MainID  = SysConvert.ToInt32(MasterTable.Rows[0]["MainID"]);
                m_Seq     = SysConvert.ToInt32(MasterTable.Rows[0]["Seq"]);
                m_SubSeq  = SysConvert.ToInt32(MasterTable.Rows[0]["SubSeq"]);
                m_PackNo  = SysConvert.ToString(MasterTable.Rows[0]["PackNo"]);
                m_BoxNo   = SysConvert.ToString(MasterTable.Rows[0]["BoxNo"]);
                m_Qty     = SysConvert.ToDecimal(MasterTable.Rows[0]["Qty"]);
                m_FactQty = SysConvert.ToDecimal(MasterTable.Rows[0]["FactQty"]);
                m_PDQty   = SysConvert.ToDecimal(MasterTable.Rows[0]["PDQty"]);
                m_Remark  = SysConvert.ToString(MasterTable.Rows[0]["Remark"]);
                MasterTable.Dispose();
                return(true);
            }
            else
            {
                MasterTable.Dispose();
                return(false);
            }
        }
Пример #30
0
        /// <summary>
        /// 按传入的SQL语句查询后给属性赋值
        /// </summary>
        /// <param name="p_Sql">SQL语句</param>
        /// <returns>记录存在回true,不存在返回false</returns>
        protected override bool Select(string p_Sql)
        {
            DataTable MasterTable = new DataTable();

            if (!this.sqlTransFlag)
            {
                MasterTable = this.Fill(p_Sql);
            }
            else
            {
                MasterTable = sqlTrans.Fill(p_Sql);
            }

            if (MasterTable.Rows.Count > 0)
            {
                //查询主表记录
                m_ID         = SysConvert.ToInt32(MasterTable.Rows[0]["ID"]);
                m_MainID     = SysConvert.ToInt32(MasterTable.Rows[0]["MainID"]);
                m_Seq        = SysConvert.ToInt32(MasterTable.Rows[0]["Seq"]);
                m_SampleNo   = SysConvert.ToString(MasterTable.Rows[0]["SampleNo"]);
                m_SampleDate = SysConvert.ToDateTime(MasterTable.Rows[0]["SampleDate"]);
                m_ItemCode   = SysConvert.ToString(MasterTable.Rows[0]["ItemCode"]);
                MasterTable.Dispose();
                return(true);
            }
            else
            {
                MasterTable.Dispose();
                return(false);
            }
        }