Ejemplo n.º 1
0
        public DocScan(Prod_Pool item)
        {
            InitializeComponent();

            GModel = item;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(ProdIO_FormClosed);
            BindTopTool();
        }
Ejemplo n.º 2
0
        public ProdIO(Prod_Pool item, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            GModel = item;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(ProdIO_FormClosed);
            BindTopTool();
        }
Ejemplo n.º 3
0
        public ProdRepairOp(Prod_Pool item, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            GModel = new Prod_Maintain();
            GModel.PRM_ProdCode = item.PRP_ProdCode;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(ProdIO_FormClosed);
            BindTopTool();
        }
Ejemplo n.º 4
0
        public bool AddOrUpdateCDoc(Prod_Pool main,List<Prod_Doc> list)
        {
            bool flag = true;

            List<Prod_Doc> oldSIList = this.GetDocByProdCode(main.PRP_ProdCode);

            try
            {
                foreach (Prod_Doc r in oldSIList)
                {
                    var temp = list.FirstOrDefault(o => o.PRDQ_ID == r.PRDQ_ID);
                    //如果存在则更新
                    if (temp != null)
                    {
                        temp.CreateTime = DateTime.Now;
                        temp.UpdateTime = DateTime.Now;
                        temp.PRDQ_ID = r.PRDQ_ID;
                        PDocUpdate(temp);
                        list.Remove(temp);

                    }//不存在则删除
                    else
                    {
                        r.DeleteTime = DateTime.Now;
                        PDocDelete(r);
                    }
                }

                foreach (Prod_Doc detail in list)
                {
                    //如果有编码生成,则在此处完成

                    detail.CreateTime = DateTime.Now;
                    detail.UpdateTime = DateTime.Now;
                    detail.PRDQ_CompNo = main.PRP_ProdCode;
                    //detail.PRDQ_CompCode = main.PRDC_CompCode;
                    //detail.PRDQ_CompName = main.PRDC_CompName;
                    PDocInsert(detail);
                }
            }
            catch
            {
                flag = false;
            }
            return flag;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新Prod_Pool对象(即:一条记录
        /// </summary>
        public int Update(Prod_Pool prod_Pool)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Prod_Pool       SET ");
            if(prod_Pool.PRP_ProdCode_IsChanged){sbParameter.Append("PRP_ProdCode=@PRP_ProdCode, ");}
              if(prod_Pool.PRP_Type_IsChanged){sbParameter.Append("PRP_Type=@PRP_Type, ");}
              if(prod_Pool.PRP_Name_IsChanged){sbParameter.Append("PRP_Name=@PRP_Name, ");}
              if(prod_Pool.PRP_iType_IsChanged){sbParameter.Append("PRP_iType=@PRP_iType, ");}
              if(prod_Pool.PRP_IOwner_IsChanged){sbParameter.Append("PRP_IOwner=@PRP_IOwner, ");}
              if(prod_Pool.PRP_IDate_IsChanged){sbParameter.Append("PRP_IDate=@PRP_IDate, ");}
              if(prod_Pool.PRP_IBak_IsChanged){sbParameter.Append("PRP_IBak=@PRP_IBak, ");}
              if(prod_Pool.PRP_OOwner_IsChanged){sbParameter.Append("PRP_OOwner=@PRP_OOwner, ");}
              if(prod_Pool.PRP_OCust_IsChanged){sbParameter.Append("PRP_OCust=@PRP_OCust, ");}
              if(prod_Pool.PRP_ODate_IsChanged){sbParameter.Append("PRP_ODate=@PRP_ODate, ");}
              if(prod_Pool.PRP_OCust1_IsChanged){sbParameter.Append("PRP_OCust1=@PRP_OCust1, ");}
              if(prod_Pool.PRP_OBak_IsChanged){sbParameter.Append("PRP_OBak=@PRP_OBak, ");}
              if(prod_Pool.PRP_IsChange_IsChanged){sbParameter.Append("PRP_IsChange=@PRP_IsChange, ");}
              if(prod_Pool.Stat_IsChanged){sbParameter.Append("Stat=@Stat, ");}
              if(prod_Pool.Creator_IsChanged){sbParameter.Append("Creator=@Creator, ");}
              if(prod_Pool.CreateTime_IsChanged){sbParameter.Append("CreateTime=@CreateTime, ");}
              if(prod_Pool.UpdateTime_IsChanged){sbParameter.Append("UpdateTime=@UpdateTime, ");}
              if(prod_Pool.DeleteTime_IsChanged){sbParameter.Append("DeleteTime=@DeleteTime, ");}
              if(prod_Pool.PRP_Udef1_IsChanged){sbParameter.Append("PRP_Udef1=@PRP_Udef1, ");}
              if(prod_Pool.PRP_Udef2_IsChanged){sbParameter.Append("PRP_Udef2=@PRP_Udef2, ");}
              if(prod_Pool.PRP_Udef3_IsChanged){sbParameter.Append("PRP_Udef3=@PRP_Udef3 ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and PRP_ID=@PRP_ID; " );
              string sql=sb.ToString();
             if(prod_Pool.PRP_ProdCode_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_ProdCode))
             {
            idb.AddParameter("@PRP_ProdCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_ProdCode", prod_Pool.PRP_ProdCode);
             }
              }
             if(prod_Pool.PRP_Type_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_Type))
             {
            idb.AddParameter("@PRP_Type", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Type", prod_Pool.PRP_Type);
             }
              }
             if(prod_Pool.PRP_Name_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_Name))
             {
            idb.AddParameter("@PRP_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Name", prod_Pool.PRP_Name);
             }
              }
             if(prod_Pool.PRP_iType_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_iType))
             {
            idb.AddParameter("@PRP_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_iType", prod_Pool.PRP_iType);
             }
              }
             if(prod_Pool.PRP_IOwner_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_IOwner))
             {
            idb.AddParameter("@PRP_IOwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IOwner", prod_Pool.PRP_IOwner);
             }
              }
             if(prod_Pool.PRP_IDate_IsChanged)
             {
             if (prod_Pool.PRP_IDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRP_IDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IDate", prod_Pool.PRP_IDate);
             }
              }
             if(prod_Pool.PRP_IBak_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_IBak))
             {
            idb.AddParameter("@PRP_IBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IBak", prod_Pool.PRP_IBak);
             }
              }
             if(prod_Pool.PRP_OOwner_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_OOwner))
             {
            idb.AddParameter("@PRP_OOwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OOwner", prod_Pool.PRP_OOwner);
             }
              }
             if(prod_Pool.PRP_OCust_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_OCust))
             {
            idb.AddParameter("@PRP_OCust", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OCust", prod_Pool.PRP_OCust);
             }
              }
             if(prod_Pool.PRP_ODate_IsChanged)
             {
             if (prod_Pool.PRP_ODate == DateTime.MinValue)
             {
            idb.AddParameter("@PRP_ODate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_ODate", prod_Pool.PRP_ODate);
             }
              }
             if(prod_Pool.PRP_OCust1_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_OCust1))
             {
            idb.AddParameter("@PRP_OCust1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OCust1", prod_Pool.PRP_OCust1);
             }
              }
             if(prod_Pool.PRP_OBak_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_OBak))
             {
            idb.AddParameter("@PRP_OBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OBak", prod_Pool.PRP_OBak);
             }
              }
             if(prod_Pool.PRP_IsChange_IsChanged)
             {
             if (prod_Pool.PRP_IsChange == 0)
             {
            idb.AddParameter("@PRP_IsChange", 0);
             }
             else
             {
            idb.AddParameter("@PRP_IsChange", prod_Pool.PRP_IsChange);
             }
              }
             if(prod_Pool.Stat_IsChanged)
             {
             if (prod_Pool.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", prod_Pool.Stat);
             }
              }
             if(prod_Pool.Creator_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.Creator))
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", prod_Pool.Creator);
             }
              }
             if(prod_Pool.CreateTime_IsChanged)
             {
             if (prod_Pool.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", prod_Pool.CreateTime);
             }
              }
             if(prod_Pool.UpdateTime_IsChanged)
             {
             if (prod_Pool.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", prod_Pool.UpdateTime);
             }
              }
             if(prod_Pool.DeleteTime_IsChanged)
             {
             if (prod_Pool.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", prod_Pool.DeleteTime);
             }
              }
             if(prod_Pool.PRP_Udef1_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef1))
             {
            idb.AddParameter("@PRP_Udef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef1", prod_Pool.PRP_Udef1);
             }
              }
             if(prod_Pool.PRP_Udef2_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef2))
             {
            idb.AddParameter("@PRP_Udef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef2", prod_Pool.PRP_Udef2);
             }
              }
             if(prod_Pool.PRP_Udef3_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef3))
             {
            idb.AddParameter("@PRP_Udef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef3", prod_Pool.PRP_Udef3);
             }
              }

             idb.AddParameter("@PRP_ID", prod_Pool.PRP_ID);

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
            }            return Re;
Ejemplo n.º 6
0
 /// <summary>
 /// 获取指定的Prod_Pool对象集合
 /// </summary>
 public List<Prod_Pool> GetListByWhere(string strCondition)
 {
     List<Prod_Pool> ret = new List<Prod_Pool>();
      string sql = "SELECT  PRP_ID,PRP_ProdCode,PRP_Type,PRP_Name,PRP_iType,PRP_IOwner,PRP_IDate,PRP_IBak,PRP_OOwner,PRP_OCust,PRP_ODate,PRP_OCust1,PRP_OBak,PRP_IsChange,Stat,Creator,CreateTime,UpdateTime,DeleteTime,PRP_Udef1,PRP_Udef2,PRP_Udef3 FROM Prod_Pool WHERE 1=1 AND ((Stat is null) or (Stat=0) ) ";
      if(!string.IsNullOrEmpty(strCondition))
      {
     strCondition.Replace('\'','"'); //防sql注入
     sql += strCondition ;
      }
       SqlDataReader dr=null;
        try {
       dr=(SqlDataReader)idb.ReturnReader(sql);
      while(dr.Read())
      {
     Prod_Pool prod_Pool = new Prod_Pool();
     if (dr["PRP_ID"] != DBNull.Value) prod_Pool.PRP_ID = Convert.ToDecimal(dr["PRP_ID"]);
     if (dr["PRP_ProdCode"] != DBNull.Value) prod_Pool.PRP_ProdCode = Convert.ToString(dr["PRP_ProdCode"]);
     if (dr["PRP_Type"] != DBNull.Value) prod_Pool.PRP_Type = Convert.ToString(dr["PRP_Type"]);
     if (dr["PRP_Name"] != DBNull.Value) prod_Pool.PRP_Name = Convert.ToString(dr["PRP_Name"]);
     if (dr["PRP_iType"] != DBNull.Value) prod_Pool.PRP_iType = Convert.ToString(dr["PRP_iType"]);
     if (dr["PRP_IOwner"] != DBNull.Value) prod_Pool.PRP_IOwner = Convert.ToString(dr["PRP_IOwner"]);
     if (dr["PRP_IDate"] != DBNull.Value) prod_Pool.PRP_IDate = Convert.ToDateTime(dr["PRP_IDate"]);
     if (dr["PRP_IBak"] != DBNull.Value) prod_Pool.PRP_IBak = Convert.ToString(dr["PRP_IBak"]);
     if (dr["PRP_OOwner"] != DBNull.Value) prod_Pool.PRP_OOwner = Convert.ToString(dr["PRP_OOwner"]);
     if (dr["PRP_OCust"] != DBNull.Value) prod_Pool.PRP_OCust = Convert.ToString(dr["PRP_OCust"]);
     if (dr["PRP_ODate"] != DBNull.Value) prod_Pool.PRP_ODate = Convert.ToDateTime(dr["PRP_ODate"]);
     if (dr["PRP_OCust1"] != DBNull.Value) prod_Pool.PRP_OCust1 = Convert.ToString(dr["PRP_OCust1"]);
     if (dr["PRP_OBak"] != DBNull.Value) prod_Pool.PRP_OBak = Convert.ToString(dr["PRP_OBak"]);
     if (dr["PRP_IsChange"] != DBNull.Value) prod_Pool.PRP_IsChange = Convert.ToInt32(dr["PRP_IsChange"]);
     if (dr["Stat"] != DBNull.Value) prod_Pool.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Creator"] != DBNull.Value) prod_Pool.Creator = Convert.ToString(dr["Creator"]);
     if (dr["CreateTime"] != DBNull.Value) prod_Pool.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
     if (dr["UpdateTime"] != DBNull.Value) prod_Pool.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
     if (dr["DeleteTime"] != DBNull.Value) prod_Pool.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
     if (dr["PRP_Udef1"] != DBNull.Value) prod_Pool.PRP_Udef1 = Convert.ToString(dr["PRP_Udef1"]);
     if (dr["PRP_Udef2"] != DBNull.Value) prod_Pool.PRP_Udef2 = Convert.ToString(dr["PRP_Udef2"]);
     if (dr["PRP_Udef3"] != DBNull.Value) prod_Pool.PRP_Udef3 = Convert.ToString(dr["PRP_Udef3"]);
     ret.Add(prod_Pool);
      }
       }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;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取指定的Prod_Pool对象(即:一条记录
        /// </summary>
        public Prod_Pool GetByKey(decimal pRP_ID)
        {
            Prod_Pool prod_Pool = new Prod_Pool();
             string sql = "SELECT  PRP_ID,PRP_ProdCode,PRP_Type,PRP_Name,PRP_iType,PRP_IOwner,PRP_IDate,PRP_IBak,PRP_OOwner,PRP_OCust,PRP_ODate,PRP_OCust1,PRP_OBak,PRP_IsChange,Stat,Creator,CreateTime,UpdateTime,DeleteTime,PRP_Udef1,PRP_Udef2,PRP_Udef3 FROM Prod_Pool WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND PRP_ID=@PRP_ID ";
             idb.AddParameter("@PRP_ID", pRP_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["PRP_ID"] != DBNull.Value) prod_Pool.PRP_ID = Convert.ToDecimal(dr["PRP_ID"]);
            if (dr["PRP_ProdCode"] != DBNull.Value) prod_Pool.PRP_ProdCode = Convert.ToString(dr["PRP_ProdCode"]);
            if (dr["PRP_Type"] != DBNull.Value) prod_Pool.PRP_Type = Convert.ToString(dr["PRP_Type"]);
            if (dr["PRP_Name"] != DBNull.Value) prod_Pool.PRP_Name = Convert.ToString(dr["PRP_Name"]);
            if (dr["PRP_iType"] != DBNull.Value) prod_Pool.PRP_iType = Convert.ToString(dr["PRP_iType"]);
            if (dr["PRP_IOwner"] != DBNull.Value) prod_Pool.PRP_IOwner = Convert.ToString(dr["PRP_IOwner"]);
            if (dr["PRP_IDate"] != DBNull.Value) prod_Pool.PRP_IDate = Convert.ToDateTime(dr["PRP_IDate"]);
            if (dr["PRP_IBak"] != DBNull.Value) prod_Pool.PRP_IBak = Convert.ToString(dr["PRP_IBak"]);
            if (dr["PRP_OOwner"] != DBNull.Value) prod_Pool.PRP_OOwner = Convert.ToString(dr["PRP_OOwner"]);
            if (dr["PRP_OCust"] != DBNull.Value) prod_Pool.PRP_OCust = Convert.ToString(dr["PRP_OCust"]);
            if (dr["PRP_ODate"] != DBNull.Value) prod_Pool.PRP_ODate = Convert.ToDateTime(dr["PRP_ODate"]);
            if (dr["PRP_OCust1"] != DBNull.Value) prod_Pool.PRP_OCust1 = Convert.ToString(dr["PRP_OCust1"]);
            if (dr["PRP_OBak"] != DBNull.Value) prod_Pool.PRP_OBak = Convert.ToString(dr["PRP_OBak"]);
            if (dr["PRP_IsChange"] != DBNull.Value) prod_Pool.PRP_IsChange = Convert.ToInt32(dr["PRP_IsChange"]);
            if (dr["Stat"] != DBNull.Value) prod_Pool.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["Creator"] != DBNull.Value) prod_Pool.Creator = Convert.ToString(dr["Creator"]);
            if (dr["CreateTime"] != DBNull.Value) prod_Pool.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
            if (dr["UpdateTime"] != DBNull.Value) prod_Pool.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
            if (dr["DeleteTime"] != DBNull.Value) prod_Pool.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
            if (dr["PRP_Udef1"] != DBNull.Value) prod_Pool.PRP_Udef1 = Convert.ToString(dr["PRP_Udef1"]);
            if (dr["PRP_Udef2"] != DBNull.Value) prod_Pool.PRP_Udef2 = Convert.ToString(dr["PRP_Udef2"]);
            if (dr["PRP_Udef3"] != DBNull.Value) prod_Pool.PRP_Udef3 = Convert.ToString(dr["PRP_Udef3"]);
             }
              }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 prod_Pool;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 添加Prod_Pool对象(即:一条记录)
        /// </summary>
        public int Add(Prod_Pool prod_Pool)
        {
            string sql = "INSERT INTO Prod_Pool (PRP_ProdCode,PRP_Type,PRP_Name,PRP_iType,PRP_IOwner,PRP_IDate,PRP_IBak,PRP_OOwner,PRP_OCust,PRP_ODate,PRP_OCust1,PRP_OBak,PRP_IsChange,Stat,Creator,CreateTime,UpdateTime,DeleteTime,PRP_Udef1,PRP_Udef2,PRP_Udef3) VALUES (@PRP_ProdCode,@PRP_Type,@PRP_Name,@PRP_iType,@PRP_IOwner,@PRP_IDate,@PRP_IBak,@PRP_OOwner,@PRP_OCust,@PRP_ODate,@PRP_OCust1,@PRP_OBak,@PRP_IsChange,@Stat,@Creator,@CreateTime,@UpdateTime,@DeleteTime,@PRP_Udef1,@PRP_Udef2,@PRP_Udef3)";
             if (string.IsNullOrEmpty(prod_Pool.PRP_ProdCode))
             {
            idb.AddParameter("@PRP_ProdCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_ProdCode", prod_Pool.PRP_ProdCode);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_Type))
             {
            idb.AddParameter("@PRP_Type", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Type", prod_Pool.PRP_Type);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_Name))
             {
            idb.AddParameter("@PRP_Name", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Name", prod_Pool.PRP_Name);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_iType))
             {
            idb.AddParameter("@PRP_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_iType", prod_Pool.PRP_iType);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_IOwner))
             {
            idb.AddParameter("@PRP_IOwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IOwner", prod_Pool.PRP_IOwner);
             }
             if (prod_Pool.PRP_IDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRP_IDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IDate", prod_Pool.PRP_IDate);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_IBak))
             {
            idb.AddParameter("@PRP_IBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_IBak", prod_Pool.PRP_IBak);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_OOwner))
             {
            idb.AddParameter("@PRP_OOwner", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OOwner", prod_Pool.PRP_OOwner);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_OCust))
             {
            idb.AddParameter("@PRP_OCust", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OCust", prod_Pool.PRP_OCust);
             }
             if (prod_Pool.PRP_ODate == DateTime.MinValue)
             {
            idb.AddParameter("@PRP_ODate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_ODate", prod_Pool.PRP_ODate);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_OCust1))
             {
            idb.AddParameter("@PRP_OCust1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OCust1", prod_Pool.PRP_OCust1);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_OBak))
             {
            idb.AddParameter("@PRP_OBak", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_OBak", prod_Pool.PRP_OBak);
             }
             if (prod_Pool.PRP_IsChange == 0)
             {
            idb.AddParameter("@PRP_IsChange", 0);
             }
             else
             {
            idb.AddParameter("@PRP_IsChange", prod_Pool.PRP_IsChange);
             }
             if (prod_Pool.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", prod_Pool.Stat);
             }
             if (string.IsNullOrEmpty(prod_Pool.Creator))
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", prod_Pool.Creator);
             }
             if (prod_Pool.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", prod_Pool.CreateTime);
             }
             if (prod_Pool.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", prod_Pool.UpdateTime);
             }
             if (prod_Pool.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", prod_Pool.DeleteTime);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef1))
             {
            idb.AddParameter("@PRP_Udef1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef1", prod_Pool.PRP_Udef1);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef2))
             {
            idb.AddParameter("@PRP_Udef2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef2", prod_Pool.PRP_Udef2);
             }
             if (string.IsNullOrEmpty(prod_Pool.PRP_Udef3))
             {
            idb.AddParameter("@PRP_Udef3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRP_Udef3", prod_Pool.PRP_Udef3);
             }

            int Re = 0;
            //SQL日志记录
            var RunMethod = System.Reflection.MethodBase.GetCurrentMethod();
            System.Collections.Hashtable param = new System.Collections.Hashtable();
            string Ex = string.Empty;
            foreach (System.Collections.DictionaryEntry item in idb.GetParameters())
            {
                  param.Add(item.Key, item.Value);
            }

            try
            {
                Re = idb.ExeCmd(sql);
                Ex = Re.ToString();
            }
            catch (Exception ex)
            {
                Ex = ex.Message;
            }
            finally
            {
                SysRunLog.InsertRunSql(sql, param, RunMethod.DeclaringType +"." + RunMethod.Name,Ex);
             }            return Re;
        }
Ejemplo n.º 9
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string pre = txtPre.Text;
            int len = Common.Utils.TypeConverter.ObjectToInt(this.txtLen.Text);

            if (string.IsNullOrEmpty(this.txtStart.Text))
            {
                Alert.Show("请输入起始编号!");
                return;
            }
            if (string.IsNullOrEmpty(this.txtEnd.Text))
            {
                Alert.Show("请输入结束编号!");
                return;
            }

            bmHelper.BindControlToModel<Prod_Pool>(GModel, this.groupBox2.Controls, "");

            int start = Common.Utils.TypeConverter.ObjectToInt(txtStart.Text);
            int end = Common.Utils.TypeConverter.ObjectToInt(txtEnd.Text);
            List<Prod_Pool> list = compInstance.GetAllProdCompList();

            StringBuilder sb = new StringBuilder();

            for (int i = start; i <= end; i++)
            {
                string index = i.ToString();
                string result = string.Empty;
                if (len != 0)
                {
                    result = index.PadLeft(len, '0');
                }
                else
                {
                    result = index;
                }

                string compno = pre + result;

                if (list.FirstOrDefault(o => o.PRP_ProdCode==compno) != null)
                {
                    sb.Append(compno).Append(",");
                    continue;
                }
                Prod_Pool comp = new Prod_Pool();
                comp = GModel;
                comp.PRP_ProdCode = compno;
                comp.CreateTime = DateTime.Now;
                comp.UpdateTime = DateTime.Now;
                comp.PRP_IDate = DateTime.Now;
                //comp.PRDC_RecDate = DateTime.Now;
                comp.PRP_iType = ProdStat.In.ToString();
                compInstance.PCInsert(comp);
            }

            this.txtStart.Text = string.Empty;
            this.txtEnd.Text = string.Empty;
            if (sb.ToString().Length != 0)
            {

                //Alert.Show(string.Format("以下零件编号已经存在请确认后重新输入"));
                MsgBox msgBox = new MsgBox(string.Format("以下成品编号已存在请确认后重新输入:\n{0}", sb.ToString().Trim(',')));
                msgBox.Show();
            }
            else
            {
                Alert.Show("批量生成成功!");
            }
        }
Ejemplo n.º 10
0
 void Form_Load(object sender, EventArgs e)
 {
     GModel = new Prod_Pool();
     this.FormClosed += new FormClosedEventHandler(BatchComp_FormClosed);
     BindData();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 设置转储状态
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 public bool SetProdChange(Prod_Pool p)
 {
     p.PRP_IsChange = 1;
     return PCUpdate(p);
 }
Ejemplo n.º 12
0
        public bool PCUpdate(Prod_Pool model)
        {
            model.UpdateTime = DateTime.Now;

            if (ppInstance.Update(model) > 0)
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 13
0
        public bool PCInsert(Prod_Pool model)
        {
            model.CreateTime = DateTime.Now;

            model.UpdateTime = DateTime.Now;

            if (ppInstance.Add(model) > 0)
            {
                return true;
            }

            return false;
        }
Ejemplo n.º 14
0
        public void DeleteCompByProd(Prod_Pool prod)
        {
            string where=string.Format(" AND PRDC_ProdCode='{0}'",prod.PRP_ProdCode);

            List<Prod_Components> list = pcInstance.GetListByWhere(where);

            foreach (var c in list)
            {
                c.PRDC_ProdCode = "";

                PCompUpdate(c);

            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// 添加成品信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddProd(Prod_Pool model)
 {
     model.CreateTime = DateTime.Now;
     model.UpdateTime = DateTime.Now;
     var re = ppInstance.AddWithReturn(model);
     return TypeConverter.ObjectToInt(re);
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 添加成品关联零件信息
        /// </summary>
        /// <param name="main"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool AddOrUpdatePComponents(Prod_Pool main, List<Prod_Components> list)
        {
            bool flag = true;

            List<Prod_Components> oldSIList = GetPCompByProd(main.PRP_ProdCode);

            try
            {
                foreach (Prod_Components r in oldSIList)
                {
                    var temp = list.FirstOrDefault(o => o.PRDC_ID == r.PRDC_ID);
                    //如果存在则更新
                    if (temp != null)
                    {
                        temp.CreateTime = DateTime.Now;
                        temp.UpdateTime = DateTime.Now;
                        temp.PRDC_ID = r.PRDC_ID;
                        temp.PRDC_ProdCode = main.PRP_ProdCode;
                        PCompUpdate(temp);
                        list.Remove(temp);

                    }//不存在则删除
                    else
                    {
                        r.PRDC_ProdCode = "";
                        PCompUpdate(r);
                        //r.DeleteTime = DateTime.Now;
                        //PCompDelete(r);
                    }
                }

                foreach (Prod_Components detail in list)
                {
                    //如果有编码生成,则在此处完成

                    detail.CreateTime = DateTime.Now;
                    detail.UpdateTime = DateTime.Now;
                    detail.PRDC_ProdCode = main.PRP_ProdCode;
                    PCompUpdate(detail);
                }
            }
            catch
            {
                flag = false;
            }
            return flag;
        }