Пример #1
0
 /// <summary>
 /// 添加和复制零件图号
 /// </summary>
 /// <param name="oldRoadComptCode"></param>
 /// <param name="rc"></param>
 /// <returns></returns>
 public int AddAndCopycomponent(string oldRoadComptCode, Road_Components rc)
 {
     if (CopyComponent(oldRoadComptCode, rc))
     {
         return 1;
     }
     else
     {
         return 0;
     }
 }
Пример #2
0
        /// <summary>
        /// 添加实体
        /// </summary>
        /// <param name="rc"></param>
        /// <returns></returns>
        public int AddRoadCompt(Road_Components rc)
        {
            rc.Stat = 0;
            //创建人
            rc.Comp_Creator = SessionConfig.UserCode;

            rc.Comp_CreatTime = DateTime.Now;

            //状态设置
            rc.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString();

            Verify_TemplateConfig model = auInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.Components_C001.ToString());

            if (model != null)
            {
                rc.AuditCurAudit = model.VT_VerifyNode_Code;

                auInstance.InsertNextAuditRecord(OperationTypeEnum.AuditTemplateEnum.Components_C001.ToString(), model.VT_VerifyNode_Code, rc.Comp_Code);
            }

            return Instance.Add(rc);

            //return 0;
        }
Пример #3
0
        /// <summary>
        /// 获取所有的零件图号信息 Road_Components对象(即:一条记录
        /// </summary>
        public List <Road_Components> GetAll()
        {
            List <Road_Components> ret = new List <Road_Components>();
            string        sql          = "SELECT  Comp_ID,Comp_Code,Comp_Name,Comp_Design,Comp_Bak,Comp_Stat,Comp_CatCode,Comp_CatName,Stat,Comp_Order,AuditStat,AuditCurAudit,Comp_CurNode,Comp_Creator,Comp_CreatTime,Comp_IsBusy,Comp_Udef1,Comp_Udef2 FROM Road_Components where 1=1 AND ((Stat is null) or (Stat=0) ) order by Comp_ID desc ";
            SqlDataReader dr           = null;

            try {
                dr = (SqlDataReader)idb.ReturnReader(sql);
                while (dr.Read())
                {
                    Road_Components road_Components = new Road_Components();
                    if (dr["Comp_ID"] != DBNull.Value)
                    {
                        road_Components.Comp_ID = Convert.ToInt64(dr["Comp_ID"]);
                    }
                    if (dr["Comp_Code"] != DBNull.Value)
                    {
                        road_Components.Comp_Code = Convert.ToString(dr["Comp_Code"]);
                    }
                    if (dr["Comp_Name"] != DBNull.Value)
                    {
                        road_Components.Comp_Name = Convert.ToString(dr["Comp_Name"]);
                    }
                    if (dr["Comp_Design"] != DBNull.Value)
                    {
                        road_Components.Comp_Design = Convert.ToString(dr["Comp_Design"]);
                    }
                    if (dr["Comp_Bak"] != DBNull.Value)
                    {
                        road_Components.Comp_Bak = Convert.ToString(dr["Comp_Bak"]);
                    }
                    if (dr["Comp_Stat"] != DBNull.Value)
                    {
                        road_Components.Comp_Stat = Convert.ToString(dr["Comp_Stat"]);
                    }
                    if (dr["Comp_CatCode"] != DBNull.Value)
                    {
                        road_Components.Comp_CatCode = Convert.ToString(dr["Comp_CatCode"]);
                    }
                    if (dr["Comp_CatName"] != DBNull.Value)
                    {
                        road_Components.Comp_CatName = Convert.ToString(dr["Comp_CatName"]);
                    }
                    if (dr["Stat"] != DBNull.Value)
                    {
                        road_Components.Stat = Convert.ToInt32(dr["Stat"]);
                    }
                    if (dr["Comp_Order"] != DBNull.Value)
                    {
                        road_Components.Comp_Order = Convert.ToInt32(dr["Comp_Order"]);
                    }
                    if (dr["AuditStat"] != DBNull.Value)
                    {
                        road_Components.AuditStat = Convert.ToString(dr["AuditStat"]);
                    }
                    if (dr["AuditCurAudit"] != DBNull.Value)
                    {
                        road_Components.AuditCurAudit = Convert.ToString(dr["AuditCurAudit"]);
                    }
                    if (dr["Comp_CurNode"] != DBNull.Value)
                    {
                        road_Components.Comp_CurNode = Convert.ToString(dr["Comp_CurNode"]);
                    }
                    if (dr["Comp_Creator"] != DBNull.Value)
                    {
                        road_Components.Comp_Creator = Convert.ToString(dr["Comp_Creator"]);
                    }
                    if (dr["Comp_CreatTime"] != DBNull.Value)
                    {
                        road_Components.Comp_CreatTime = Convert.ToDateTime(dr["Comp_CreatTime"]);
                    }
                    if (dr["Comp_IsBusy"] != DBNull.Value)
                    {
                        road_Components.Comp_IsBusy = Convert.ToInt32(dr["Comp_IsBusy"]);
                    }
                    if (dr["Comp_Udef1"] != DBNull.Value)
                    {
                        road_Components.Comp_Udef1 = Convert.ToString(dr["Comp_Udef1"]);
                    }
                    if (dr["Comp_Udef2"] != DBNull.Value)
                    {
                        road_Components.Comp_Udef2 = Convert.ToString(dr["Comp_Udef2"]);
                    }
                    ret.Add(road_Components);
                }
            }catch (System.Exception ex) { throw ex; }  finally { if (dr != null)
                                                                  {
                                                                      dr.Close();
                                                                  }
                                                                  if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open)
                                                                  {
                                                                      idb.GetConnection().Close();
                                                                  }
            }
            return(ret);
        }
Пример #4
0
        /// <summary>
        /// 获取指定的零件图号信息 Road_Components对象集合
        /// </summary>
        public List <Road_Components> GetListByWhere(string strCondition)
        {
            List <Road_Components> ret = new List <Road_Components>();
            string sql = "SELECT  Comp_ID,Comp_Code,Comp_Name,Comp_Design,Comp_Bak,Comp_Stat,Comp_CatCode,Comp_CatName,Stat,Comp_Order,AuditStat,AuditCurAudit,Comp_CurNode,Comp_Creator,Comp_CreatTime,Comp_IsBusy,Comp_Udef1,Comp_Udef2 FROM Road_Components WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";

            if (!string.IsNullOrEmpty(strCondition))
            {
                strCondition.Replace('\'', '"'); //防sql注入
                sql += strCondition;
            }
            sql += " ORDER BY Comp_ID DESC ";
            SqlDataReader dr = null;

            try {
                dr = (SqlDataReader)idb.ReturnReader(sql);
                while (dr.Read())
                {
                    Road_Components road_Components = new Road_Components();
                    if (dr["Comp_ID"] != DBNull.Value)
                    {
                        road_Components.Comp_ID = Convert.ToInt64(dr["Comp_ID"]);
                    }
                    if (dr["Comp_Code"] != DBNull.Value)
                    {
                        road_Components.Comp_Code = Convert.ToString(dr["Comp_Code"]);
                    }
                    if (dr["Comp_Name"] != DBNull.Value)
                    {
                        road_Components.Comp_Name = Convert.ToString(dr["Comp_Name"]);
                    }
                    if (dr["Comp_Design"] != DBNull.Value)
                    {
                        road_Components.Comp_Design = Convert.ToString(dr["Comp_Design"]);
                    }
                    if (dr["Comp_Bak"] != DBNull.Value)
                    {
                        road_Components.Comp_Bak = Convert.ToString(dr["Comp_Bak"]);
                    }
                    if (dr["Comp_Stat"] != DBNull.Value)
                    {
                        road_Components.Comp_Stat = Convert.ToString(dr["Comp_Stat"]);
                    }
                    if (dr["Comp_CatCode"] != DBNull.Value)
                    {
                        road_Components.Comp_CatCode = Convert.ToString(dr["Comp_CatCode"]);
                    }
                    if (dr["Comp_CatName"] != DBNull.Value)
                    {
                        road_Components.Comp_CatName = Convert.ToString(dr["Comp_CatName"]);
                    }
                    if (dr["Stat"] != DBNull.Value)
                    {
                        road_Components.Stat = Convert.ToInt32(dr["Stat"]);
                    }
                    if (dr["Comp_Order"] != DBNull.Value)
                    {
                        road_Components.Comp_Order = Convert.ToInt32(dr["Comp_Order"]);
                    }
                    if (dr["AuditStat"] != DBNull.Value)
                    {
                        road_Components.AuditStat = Convert.ToString(dr["AuditStat"]);
                    }
                    if (dr["AuditCurAudit"] != DBNull.Value)
                    {
                        road_Components.AuditCurAudit = Convert.ToString(dr["AuditCurAudit"]);
                    }
                    if (dr["Comp_CurNode"] != DBNull.Value)
                    {
                        road_Components.Comp_CurNode = Convert.ToString(dr["Comp_CurNode"]);
                    }
                    if (dr["Comp_Creator"] != DBNull.Value)
                    {
                        road_Components.Comp_Creator = Convert.ToString(dr["Comp_Creator"]);
                    }
                    if (dr["Comp_CreatTime"] != DBNull.Value)
                    {
                        road_Components.Comp_CreatTime = Convert.ToDateTime(dr["Comp_CreatTime"]);
                    }
                    if (dr["Comp_IsBusy"] != DBNull.Value)
                    {
                        road_Components.Comp_IsBusy = Convert.ToInt32(dr["Comp_IsBusy"]);
                    }
                    if (dr["Comp_Udef1"] != DBNull.Value)
                    {
                        road_Components.Comp_Udef1 = Convert.ToString(dr["Comp_Udef1"]);
                    }
                    if (dr["Comp_Udef2"] != DBNull.Value)
                    {
                        road_Components.Comp_Udef2 = Convert.ToString(dr["Comp_Udef2"]);
                    }
                    ret.Add(road_Components);
                }
            }catch (System.Exception ex) { throw ex; }  finally { if (dr != null)
                                                                  {
                                                                      dr.Close();
                                                                  }
                                                                  if (idb.GetConnection() != null && idb.GetConnection().State == ConnectionState.Open)
                                                                  {
                                                                      idb.GetConnection().Close();
                                                                  }
            }
            return(ret);
        }
Пример #5
0
        /// <summary>
        /// 更新零件图号信息 Road_Components对象(即:一条记录
        /// </summary>
        public int Update(Road_Components road_Components)
        {
            StringBuilder sbParameter = new StringBuilder();
            StringBuilder sb          = new StringBuilder();

            sb.Append(@"UPDATE       Road_Components       SET ");
            if (road_Components.Comp_Code_IsChanged)
            {
                sbParameter.Append("Comp_Code=@Comp_Code, ");
            }
            if (road_Components.Comp_Name_IsChanged)
            {
                sbParameter.Append("Comp_Name=@Comp_Name, ");
            }
            if (road_Components.Comp_Design_IsChanged)
            {
                sbParameter.Append("Comp_Design=@Comp_Design, ");
            }
            if (road_Components.Comp_Bak_IsChanged)
            {
                sbParameter.Append("Comp_Bak=@Comp_Bak, ");
            }
            if (road_Components.Comp_Stat_IsChanged)
            {
                sbParameter.Append("Comp_Stat=@Comp_Stat, ");
            }
            if (road_Components.Comp_CatCode_IsChanged)
            {
                sbParameter.Append("Comp_CatCode=@Comp_CatCode, ");
            }
            if (road_Components.Comp_CatName_IsChanged)
            {
                sbParameter.Append("Comp_CatName=@Comp_CatName, ");
            }
            if (road_Components.Stat_IsChanged)
            {
                sbParameter.Append("Stat=@Stat, ");
            }
            if (road_Components.Comp_Order_IsChanged)
            {
                sbParameter.Append("Comp_Order=@Comp_Order, ");
            }
            if (road_Components.AuditStat_IsChanged)
            {
                sbParameter.Append("AuditStat=@AuditStat, ");
            }
            if (road_Components.AuditCurAudit_IsChanged)
            {
                sbParameter.Append("AuditCurAudit=@AuditCurAudit, ");
            }
            if (road_Components.Comp_CurNode_IsChanged)
            {
                sbParameter.Append("Comp_CurNode=@Comp_CurNode, ");
            }
            if (road_Components.Comp_Creator_IsChanged)
            {
                sbParameter.Append("Comp_Creator=@Comp_Creator, ");
            }
            if (road_Components.Comp_CreatTime_IsChanged)
            {
                sbParameter.Append("Comp_CreatTime=@Comp_CreatTime, ");
            }
            if (road_Components.Comp_IsBusy_IsChanged)
            {
                sbParameter.Append("Comp_IsBusy=@Comp_IsBusy, ");
            }
            if (road_Components.Comp_Udef1_IsChanged)
            {
                sbParameter.Append("Comp_Udef1=@Comp_Udef1, ");
            }
            if (road_Components.Comp_Udef2_IsChanged)
            {
                sbParameter.Append("Comp_Udef2=@Comp_Udef2 ");
            }
            sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
            sb.Append(" WHERE 1=1 AND ((Stat is null) or (Stat=0))   and Comp_ID=@Comp_ID; ");
            string sql = sb.ToString();

            if (road_Components.Comp_Code_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Code))
                {
                    idb.AddParameter("@Comp_Code", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Code", road_Components.Comp_Code);
                }
            }
            if (road_Components.Comp_Name_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Name))
                {
                    idb.AddParameter("@Comp_Name", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Name", road_Components.Comp_Name);
                }
            }
            if (road_Components.Comp_Design_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Design))
                {
                    idb.AddParameter("@Comp_Design", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Design", road_Components.Comp_Design);
                }
            }
            if (road_Components.Comp_Bak_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Bak))
                {
                    idb.AddParameter("@Comp_Bak", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Bak", road_Components.Comp_Bak);
                }
            }
            if (road_Components.Comp_Stat_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Stat))
                {
                    idb.AddParameter("@Comp_Stat", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Stat", road_Components.Comp_Stat);
                }
            }
            if (road_Components.Comp_CatCode_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_CatCode))
                {
                    idb.AddParameter("@Comp_CatCode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_CatCode", road_Components.Comp_CatCode);
                }
            }
            if (road_Components.Comp_CatName_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_CatName))
                {
                    idb.AddParameter("@Comp_CatName", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_CatName", road_Components.Comp_CatName);
                }
            }
            if (road_Components.Stat_IsChanged)
            {
                if (road_Components.Stat == 0)
                {
                    idb.AddParameter("@Stat", 0);
                }
                else
                {
                    idb.AddParameter("@Stat", road_Components.Stat);
                }
            }
            if (road_Components.Comp_Order_IsChanged)
            {
                if (road_Components.Comp_Order == 0)
                {
                    idb.AddParameter("@Comp_Order", 0);
                }
                else
                {
                    idb.AddParameter("@Comp_Order", road_Components.Comp_Order);
                }
            }
            if (road_Components.AuditStat_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.AuditStat))
                {
                    idb.AddParameter("@AuditStat", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@AuditStat", road_Components.AuditStat);
                }
            }
            if (road_Components.AuditCurAudit_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.AuditCurAudit))
                {
                    idb.AddParameter("@AuditCurAudit", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@AuditCurAudit", road_Components.AuditCurAudit);
                }
            }
            if (road_Components.Comp_CurNode_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_CurNode))
                {
                    idb.AddParameter("@Comp_CurNode", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_CurNode", road_Components.Comp_CurNode);
                }
            }
            if (road_Components.Comp_Creator_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Creator))
                {
                    idb.AddParameter("@Comp_Creator", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Creator", road_Components.Comp_Creator);
                }
            }
            if (road_Components.Comp_CreatTime_IsChanged)
            {
                if (road_Components.Comp_CreatTime == DateTime.MinValue)
                {
                    idb.AddParameter("@Comp_CreatTime", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_CreatTime", road_Components.Comp_CreatTime);
                }
            }
            if (road_Components.Comp_IsBusy_IsChanged)
            {
                if (road_Components.Comp_IsBusy == 0)
                {
                    idb.AddParameter("@Comp_IsBusy", 0);
                }
                else
                {
                    idb.AddParameter("@Comp_IsBusy", road_Components.Comp_IsBusy);
                }
            }
            if (road_Components.Comp_Udef1_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Udef1))
                {
                    idb.AddParameter("@Comp_Udef1", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Udef1", road_Components.Comp_Udef1);
                }
            }
            if (road_Components.Comp_Udef2_IsChanged)
            {
                if (string.IsNullOrEmpty(road_Components.Comp_Udef2))
                {
                    idb.AddParameter("@Comp_Udef2", DBNull.Value);
                }
                else
                {
                    idb.AddParameter("@Comp_Udef2", road_Components.Comp_Udef2);
                }
            }

            idb.AddParameter("@Comp_ID", road_Components.Comp_ID);

            return(idb.ExeCmd(sql));
        }
Пример #6
0
        /// <summary>
        /// 添加零件图号信息 Road_Components对象(即:一条记录)
        /// </summary>
        public int Add(Road_Components road_Components)
        {
            string sql = "INSERT INTO Road_Components (Comp_Code,Comp_Name,Comp_Design,Comp_Bak,Comp_Stat,Comp_CatCode,Comp_CatName,Stat,Comp_Order,AuditStat,AuditCurAudit,Comp_CurNode,Comp_Creator,Comp_CreatTime,Comp_IsBusy,Comp_Udef1,Comp_Udef2) VALUES (@Comp_Code,@Comp_Name,@Comp_Design,@Comp_Bak,@Comp_Stat,@Comp_CatCode,@Comp_CatName,@Stat,@Comp_Order,@AuditStat,@AuditCurAudit,@Comp_CurNode,@Comp_Creator,@Comp_CreatTime,@Comp_IsBusy,@Comp_Udef1,@Comp_Udef2)";

            if (string.IsNullOrEmpty(road_Components.Comp_Code))
            {
                idb.AddParameter("@Comp_Code", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Code", road_Components.Comp_Code);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Name))
            {
                idb.AddParameter("@Comp_Name", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Name", road_Components.Comp_Name);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Design))
            {
                idb.AddParameter("@Comp_Design", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Design", road_Components.Comp_Design);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Bak))
            {
                idb.AddParameter("@Comp_Bak", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Bak", road_Components.Comp_Bak);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Stat))
            {
                idb.AddParameter("@Comp_Stat", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Stat", road_Components.Comp_Stat);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_CatCode))
            {
                idb.AddParameter("@Comp_CatCode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_CatCode", road_Components.Comp_CatCode);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_CatName))
            {
                idb.AddParameter("@Comp_CatName", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_CatName", road_Components.Comp_CatName);
            }
            if (road_Components.Stat == 0)
            {
                idb.AddParameter("@Stat", 0);
            }
            else
            {
                idb.AddParameter("@Stat", road_Components.Stat);
            }
            if (road_Components.Comp_Order == 0)
            {
                idb.AddParameter("@Comp_Order", 0);
            }
            else
            {
                idb.AddParameter("@Comp_Order", road_Components.Comp_Order);
            }
            if (string.IsNullOrEmpty(road_Components.AuditStat))
            {
                idb.AddParameter("@AuditStat", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@AuditStat", road_Components.AuditStat);
            }
            if (string.IsNullOrEmpty(road_Components.AuditCurAudit))
            {
                idb.AddParameter("@AuditCurAudit", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@AuditCurAudit", road_Components.AuditCurAudit);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_CurNode))
            {
                idb.AddParameter("@Comp_CurNode", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_CurNode", road_Components.Comp_CurNode);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Creator))
            {
                idb.AddParameter("@Comp_Creator", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Creator", road_Components.Comp_Creator);
            }
            if (road_Components.Comp_CreatTime == DateTime.MinValue)
            {
                idb.AddParameter("@Comp_CreatTime", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_CreatTime", road_Components.Comp_CreatTime);
            }
            if (road_Components.Comp_IsBusy == 0)
            {
                idb.AddParameter("@Comp_IsBusy", 0);
            }
            else
            {
                idb.AddParameter("@Comp_IsBusy", road_Components.Comp_IsBusy);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Udef1))
            {
                idb.AddParameter("@Comp_Udef1", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Udef1", road_Components.Comp_Udef1);
            }
            if (string.IsNullOrEmpty(road_Components.Comp_Udef2))
            {
                idb.AddParameter("@Comp_Udef2", DBNull.Value);
            }
            else
            {
                idb.AddParameter("@Comp_Udef2", road_Components.Comp_Udef2);
            }

            return(idb.ExeCmd(sql));
        }
Пример #7
0
        /// <summary>
        /// 更新实体
        /// </summary>
        /// <param name="rc"></param>
        /// <returns></returns>
        public int UpdateRoadCompt(Road_Components rc)
        {
            if (rc.AuditStat ==OperationTypeEnum.AudtiOperaTypeEnum.LastAudit.ToString())
            {
                var model = auInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.Components_C001.ToString());

                if (model != null)
                {
                    rc.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString();
                    rc.AuditCurAudit = model.VT_VerifyNode_Code;
                }
            }
            return Instance.Update(rc);
            //return 0;
        }
Пример #8
0
 public int RemoveCompt(Road_Components rc)
 {
     rc.Stat = 1;
     return Instance.Update(rc);
     //return this.DeleteCompt(rc);
 }
Пример #9
0
 /// <summary>
 /// 是否重复编码
 /// </summary>
 /// <param name="rc"></param>
 /// <returns></returns>
 public bool IsRepeatCode(Road_Components rc)
 {
     Road_Components dic = this.GetRoadComponentByCode(rc.Comp_Code);
     if (dic != null)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Пример #10
0
        /// <summary>
        /// 逻辑删除对应实体(慎用)
        /// </summary>
        /// <param name="rc"></param>
        /// <returns></returns>
        public int DeleteCompt(Road_Components rc)
        {
            //零件图号关联-->1、合同  2、库存  3、工艺路线模板和检测参数 4、生产

            int flag = 1;

            try
            {

                Instance.idb.BeginTransaction();
                RnInstance.idb.BeginTransaction(Instance.idb.GetTransaction());
                RtInstance.idb.BeginTransaction(Instance.idb.GetTransaction());

                rc.Stat = 1;

                Instance.Update(rc);
                //逻辑删除其对应的工艺节点及检测参数
                List<Road_Nodes> rnList = GetRoadNodesByComponents(rc.Comp_Code);
                foreach (Road_Nodes rn in rnList)
                {
                    rn.Stat = 1;

                    RnInstance.Update(rn);

                    List<Road_TestRef> rtList = GetTestRefListByNodeCode(rc.Comp_Code, rn.RNodes_Code);
                    foreach (Road_TestRef rt in rtList)
                    {
                        rt.Stat = 1;
                        RtInstance.Update(rt);
                    }
                }

                Instance.idb.CommitTransaction();
            }
            catch (Exception e)
            {
                flag = 0;
                Instance.idb.RollbackTransaction();
            }
            return flag;
        }
Пример #11
0
        /// <summary>
        /// 复制零件
        /// </summary>
        /// <param name="oldComptCode"></param>
        /// <param name="newCompt"></param>
        /// <returns></returns>
        public bool CopyComponent(string oldComptCode, Road_Components newCompt)
        {
            bool flag = false;

            try
            {

                //Instance.idb.BeginTransaction();
                //RnInstance.idb.BeginTransaction(Instance.idb.GetTransaction());
                //RtInstance.idb.BeginTransaction(Instance.idb.GetTransaction());
                //auInstance.instance.idb.BeginTransaction(Instance.idb.GetTransaction());

                //添加零件图号成功后才开始工艺路线和节点检测参数复制操作
                //设置节点进入第一个审核阶段
                //newCompt.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString();
                //newCompt.AuditCurAudit = auInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.Components_C001.ToString()).VT_VerifyNode_Code;
                ////创建人
                //newCompt.Comp_Creator = SessionConfig.UserID;
                //newCompt.Comp_CreatTime = DateTime.Now;
                var model=GetRoadComponentByCode(newCompt.Comp_Code);
                //if (AddRoadComptForCopy(newCompt) > 0)
                if(model!=null)
                {
                    List<Road_Nodes> rnList = GetRoadNodesByComponents(oldComptCode);

                    foreach (Road_Nodes rn in rnList)
                    {
                        //工艺路线模板对应零件图号更改为新图号
                        //rn.RNodes_PartCode = newCompt.Comp_Code;
                        //rn.RNodes_PartName = newCompt.Comp_Name;

                        rn.RNodes_PartCode = model.Comp_Code;
                        rn.RNodes_PartName = model.Comp_Name;

                        //为该零件图号添加工艺路线节点
                        RnInstance.Add(rn);

                        //List<Road_TestRef> rtList = GetTestRefListByNodeCode(oldComptCode, rn.RNodes_Code);

                        //foreach (Road_TestRef rt in rtList)
                        //{
                        //    //工艺节点检测参数对应零件图号更改为新图号
                        //    rt.TestRef_PartNo = newCompt.Comp_Code;
                        //    rt.TestRef_PartName = newCompt.Comp_Name;
                        //    //为该零件图号和工艺节点添加检测参数
                        //    RtInstance.Add(rt);
                        //}
                    }
                }
                flag = true;
                //Instance.idb.CommitTransaction();

            }
            catch (Exception e)
            {
                flag = false;
                Instance.idb.RollbackTransaction();
            }

            return flag;
        }
Пример #12
0
        /// <summary>
        /// 更新工序
        /// </summary>
        /// <param name="comp"></param>
        /// <param name="roads"></param>
        /// <returns></returns>
        public bool AddOrUpdateRoadNodes(Road_Components comp, List<Road_Nodes> roads)
        {
            bool flag = true;

            List<Road_Nodes> list = GetRoadNodesByComponents(comp.Comp_Code);
            foreach (Road_Nodes n in list)
            {
                var temp = roads.FirstOrDefault(o => o.RNodes_ID == n.RNodes_ID);
                if (temp != null)
                {
                    temp.RNodes_ID = n.RNodes_ID;
                    temp.RNodes_PartCode = comp.Comp_Code;
                    temp.RNodes_PartName = comp.Comp_Name;
                    UpdateRoadNode(temp);
                    roads.Remove(temp);
                }
                else
                {
                    DeleteRoadNode(n);
                }
            }

            foreach (Road_Nodes r in roads)
            {
                r.RNodes_PartCode = comp.Comp_Code;
                r.RNodes_PartName = comp.Comp_Name;
                r.RNodes_Dept_Code = GlobalConfiguration.ProdDept;
                r.RNodes_Dept_Name = GlobalConfiguration.ProdDeptName;
                AddRoadNode(r);
            }

            return flag;
        }