Ejemplo n.º 1
0
        /// <summary>
        /// 删除监测项目信息
        /// </summary>
        /// <param name="itemInfo">监测项目信息</param>
        /// <returns>删除个数</returns>
        public int Delete(InspectItemEntity itemInfo)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除监测项目信息
                    string sql = "DELETE FROM InspectItemInfo WHERE Id=@Id";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "Id", DataType = DbType.String, Value = itemInfo.Id
                    });

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 插入组织机构信息
        /// </summary>
        /// <param name="orga">组织机构信息</param>
        /// <returns>插入数</returns>
        public int Insert(Orgaization orga)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    orga.DelFlag = "0";
                    if (String.IsNullOrEmpty(orga.OrganParent))
                    {
                        orga.OrganParent = "0";
                    }
                    //插入基本信息
                    session.Insert <Orgaization>(orga);

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除用户信息信息
        /// </summary>
        /// <param name="user">用户信息信息</param>
        /// <returns>删除个数</returns>
        public int Delete(User user)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除用户所有角色信息
                    string sql = "DELETE from T_USERROLE WHERE USERID=@USERID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "USERID", DataType = DbType.String, Value = user.UserID
                    });

                    //删除用户信息信息
                    sql   = "DELETE from T_USER WHERE USERID=@USERID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "USERID", DataType = DbType.String, Value = user.UserID
                    });

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(SupplyInfo model)
        {
            int    count = 0;
            string sql   = "delete from T_FP_SUPPLYMATERIALINFO where SUPPLYID = @SUPPLYID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //更新BOM信息
                    count = session.Update <SupplyInfo>(model);
                    //删除BOM明细信息
                    session.ExecuteSql(sql, new DataParameter("SUPPLYID", model.PID));
                    foreach (SupplyMaterialInfo detail in model.Details)
                    {
                        detail.PID      = Guid.NewGuid().ToString();
                        detail.SUPPLYID = model.PID;
                        session.Insert <SupplyMaterialInfo>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(WHQualityCheck model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //插入基本信息
                    count = session.Insert <WHQualityCheck>(model);
                    foreach (WHQualityCheckResult detail in model.QualityCheckResults)
                    {
                        detail.ID      = Guid.NewGuid().ToString();
                        detail.CheckID = model.ID;
                        session.Insert <WHQualityCheckResult>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(ProduceBOM model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //插入基本信息
                    count = session.Insert <ProduceBOM>(model);
                    foreach (BOMDetail detail in model.Details)
                    {
                        detail.PID   = Guid.NewGuid().ToString();
                        detail.BOMID = model.PID;
                        session.Insert <BOMDetail>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 插入用户信息信息
        /// </summary>
        /// <param name="user">用户信息信息</param>
        /// <returns>插入数</returns>
        public int Insert(User user)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //插入基本信息
                    session.Insert <User>(user);

                    //插入用户角色信息
                    if (user.Roles != null)
                    {
                        foreach (UserRole ur in user.Roles)
                        {
                            ur.UserID = user.UserID;
                        }
                        //插入角色信息
                        session.Insert <UserRole>(user.Roles);
                    }

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(GoodInfo model)
        {
            int count = 0;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //插入基本信息
                    count = session.Insert <GoodInfo>(model);
                    string sql = "UPDATE T_FP_ProducePlan SET FactAmount = FactAmount+@OfflineNum WHERE PID =@PID";
                    parameters.Add(new DataParameter {
                        ParameterName = "OfflineNum", DataType = DbType.String, Value = model.OfflineNum
                    });
                    parameters.Add(new DataParameter {
                        ParameterName = "PID", DataType = DbType.String, Value = model.PLANID
                    });
                    count = session.ExecuteSql(sql, parameters.ToArray());

                    //产品组成批次号
                    sql = "update T_FP_GoodPackingForm set BatchNumber = @BatchNumber where GoodBarCode = @GoodBarCode";
                    session.ExecuteSql(sql, new DataParameter("BatchNumber", model.BatchNumber), new DataParameter("GoodBarCode", model.GoodBarCode));

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(ProduceBOM model)
        {
            int    count = 0;
            string sql   = "delete from T_FP_BOMDETAIL where BOMID = @BOMID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //更新BOM信息
                    count = session.Update <ProduceBOM>(model);
                    //删除BOM明细信息
                    session.ExecuteSql(sql, new DataParameter("BOMID", model.PID));
                    foreach (BOMDetail detail in model.Details)
                    {
                        detail.PID   = Guid.NewGuid().ToString();
                        detail.BOMID = model.PID;
                        session.Insert <BOMDetail>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(SupplyInfo model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //插入基本信息
                    count = session.Insert <SupplyInfo>(model);
                    foreach (SupplyMaterialInfo detail in model.Details)
                    {
                        detail.PID      = Guid.NewGuid().ToString();
                        detail.SUPPLYID = model.PID;
                        session.Insert <SupplyMaterialInfo>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 删除组织机构信息
        /// </summary>
        /// <param name="orga">组织机构信息</param>
        /// <returns>删除个数</returns>
        public int Delete(Orgaization orga)
        {
            int    count = 0;
            string sql   = null;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //先删除组织机构所有权限信息
                    sql   = "DELETE T_ORGAIZATIONAUTHORITY WHERE ORGANID=@ORGANID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ORGANID", DataType = DbType.String, Value = orga.OrganID
                    });



                    //删除组织机构信息
                    sql   = "UPDATE T_ORGANIZATION SET DELFLAG = '1' WHERE ORGANID=@ORGANID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ORGANID", DataType = DbType.String, Value = orga.OrganID
                    });


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(WHQualityCheck model)
        {
            int    count = 0;
            string sql   = "delete from T_WH_QualityCheckResult where CheckID = @CheckID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    count = session.Update <WHQualityCheck>(model);
                    session.ExecuteSql(sql, new DataParameter("CheckID", model.ID));

                    foreach (WHQualityCheckResult detail in model.QualityCheckResults)
                    {
                        detail.ID      = Guid.NewGuid().ToString();
                        detail.CheckID = model.ID;
                        session.Insert <WHQualityCheckResult>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(CheckStockBill info)
        {
            int    count = 0;
            string sql   = "";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    count = session.Delete <CheckStockBill>(info);

                    sql = "delete from T_WH_CheckStockDetail where BillID = @BillID";
                    session.ExecuteSql(sql, new DataParameter("BillID", info.ID));

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 插入角色
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <returns>插入数</returns>
        public int Insert(RoleInfo role)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //插入基本信息
                    session.Insert <RoleInfo>(role);
                    if (role.Powers != null)
                    {
                        foreach (RoleAuthority ra in role.Powers)
                        {
                            ra.RoleID = role.RoleID;
                        }
                        //插入权限信息
                        session.Insert <RoleAuthority>(role.Powers);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 15
0
 public void Insert(UseMatBill bill)
 {
     using (IDataSession session = AppDataFactory.CreateMainSession())
     {
         session.OpenTs();
         session.Insert <UseMatBill>(bill);
         session.Insert <UseMatAmount>(bill.Amounts);
         session.Insert <UseMatDetail>(bill.Details);
         session.CommitTs();
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 记录货品唯一识别码打印次数
        /// </summary>
        /// <param name="idCodeList">识别码列表</param>
        public void SignMatIDCodePrintCount(List <string> idCodeList)
        {
            string sql = "update T_WH_MatIDCode set PrintCount=PrintCount+1 where IDCode = ?IDCode";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                foreach (string idCode in idCodeList)
                {
                    session.ExecuteSql(sql, new DataParameter("IDCode", idCode));
                }

                session.CommitTs();
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 装箱
        /// </summary>
        /// <param name="list"></param>
        public void Packing(List <GoodPackingForm> list)
        {
            string sql = "delete from T_FP_GoodPackingForm where GoodBarCode = @GoodBarCode";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                //删除原装箱信息
                session.ExecuteSql(sql, new DataParameter("GoodBarCode", list[0].GoodBarCode));

                //添加装箱信息
                session.Insert <GoodPackingForm>(list);

                session.CommitTs();
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 新增盘点单
 /// </summary>
 /// <param name="info"></param>
 public void Insert(CheckStockBill info)
 {
     try
     {
         using (IDataSession session = AppDataFactory.CreateMainSession())
         {
             session.OpenTs();
             session.Insert <CheckStockBill>(info);
             session.Insert <CheckStockDetail>(info.Details);
             session.CommitTs();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 19
0
        /// <summary>
        /// 保存仓库权限
        /// </summary>
        /// <param name="userID">用户主键</param>
        /// <param name="powers">仓库权限</param>
        public void SaveWHPowers(string userID, List <WarehousePower> powers)
        {
            string sql = "delete from T_WH_WHPower where UserID = @UserID";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                //删除
                session.ExecuteSql(sql, new DataParameter("UserID", userID));

                //新增
                session.Insert <WarehousePower>(powers);

                session.CommitTs();
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 盘点确认
        /// </summary>
        /// <param name="info">盘点单</param>
        public void ConfirmCheck(CheckStockBill info)
        {
            CheckStockDAL dal  = new CheckStockDAL();
            StockDAL      sDal = new StockDAL();

            int seq = 1;

            foreach (CheckStockDetail detail in info.Details)
            {
                detail.ID     = Guid.NewGuid().ToString();
                detail.BillID = info.ID;
                detail.Seq    = seq;
                seq++;
            }

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                dal.Session  = session;
                sDal.Session = session;

                //更新盘点单信息
                info.IsConfirm = 1;
                dal.Update(info);

                foreach (CheckStockDetail detail in info.Details)
                {
                    //更新库存信息
                    WHMatAmount matStock = sDal.GetStock(new WHMatAmount()
                    {
                        Warehouse    = info.Warehouse
                        , SaveSite   = detail.SaveSite
                        , MatID      = detail.MatID
                        , MatBarCode = detail.IDCode
                    });

                    matStock.MainAmount    = matStock.MainAmount * detail.FactAmount / matStock.ProductAmount;
                    matStock.ProductAmount = detail.FactAmount;

                    sDal.Update(matStock);
                }

                session.CommitTs();
            }
        }
Ejemplo n.º 21
0
        public void Delete(UseMatBill bill)
        {
            string sql = null;

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();
                session.Delete <UseMatBill>(bill);

                sql = "delete from T_WH_UseMatAmount where USEID = @USEID";
                session.ExecuteSql(sql, new DataParameter("USEID", bill.PID));
                session.Insert <UseMatAmount>(bill.Amounts);

                sql = "delete from T_WH_UseMatDetail where USEID = @USEID";
                session.ExecuteSql(sql, new DataParameter("USEID", bill.PID));
                session.Insert <UseMatDetail>(bill.Details);
                session.CommitTs();
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 插入操作记录(列表)
        /// </summary>
        /// <param name="log">记录</param>
        /// <returns>插入数</returns>
        public int InsertList(List <SystemOperateLog> logList)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    session.Insert <SystemOperateLog>(logList);

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 库内移动
        /// </summary>
        /// <param name="bill">移动信息</param>
        public void InsideMoveStock(MoveStockBill bill)
        {
            MoveStockDAL msDal = new MoveStockDAL();
            StockDAL     sDal  = new StockDAL();

            bill.ID            = Guid.NewGuid().ToString();
            bill.BillNO        = this.GetNewBillNO();
            bill.FromWarehouse = bill.ToWarehouse;
            bill.FromWHHeader  = this.LoginUser.UserID;
            bill.ToWHHeader    = this.LoginUser.UserID;
            bill.MoveMode      = "1";
            bill.CREATEUSER    = this.LoginUser.UserID;
            bill.CREATETIME    = DateTime.Now;
            bill.UPDATEUSER    = bill.CREATEUSER;
            bill.UPDATETIME    = bill.CREATETIME;

            foreach (MoveStockDetail detail in bill.Details)
            {
                detail.ID           = Guid.NewGuid().ToString();
                detail.FromSaveSite = detail.ToSaveSite;
                detail.BillID       = bill.ID;
            }

            List <MoveStockRecord> records = bill.Details.Select(p => new MoveStockRecord()
            {
                IDCode = p.IDCode, MatID = p.MatID, ToSaveSite = p.ToSaveSite, ToWarehouse = bill.ToWarehouse
            }).ToList();

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();
                msDal.Session = session;
                sDal.Session  = session;

                msDal.Insert(bill);
                sDal.MoveStock(records);

                session.CommitTs();
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 更新组织机构
        /// </summary>
        /// <param name="orga">组织机构</param>
        /// <returns>更新个数</returns>
        public int Update(Orgaization orga)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //更新基本信息
                    count = session.Update <Orgaization>(orga);

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 25
0
        /// <summary>
        /// 插入监测项目信息
        /// </summary>
        /// <param name="itemInfo">监测项目信息</param>
        /// <returns>插入数</returns>
        public int Insert(InspectItemEntity itemInfo)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //插入基本信息
                    session.Insert <InspectItemEntity>(itemInfo);

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 更新角色
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <returns>更新个数</returns>
        public int Update(RoleInfo role)
        {
            int    count = 0;
            string sql   = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //更新基本信息
                    session.Update <RoleInfo>(role);

                    //更新权限信息
                    sql = "DELETE FROM T_ROLEAUTHORITY WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });

                    if (role.Powers != null)
                    {
                        session.Insert <RoleAuthority>(role.Powers);
                    }


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 删除角色信息
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <returns>删除个数</returns>
        public int Delete(RoleInfo role)
        {
            int    count = 0;
            string sql   = null;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除权限信息,子表
                    sql = "DELETE FROM T_ROLEAUTHORITY WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });

                    //删除基本信息,主表
                    sql.Remove(0, sql.Length);
                    sql = "DELETE FROM T_ROLE WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }