Example #1
0
 /// <summary>
 /// 零件添加
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddComp(Prod_Components model)
 {
     model.CreateTime = DateTime.Now;
     model.UpdateTime = DateTime.Now;
     var re = pcInstance.AddWithReturn(model);
     return TypeConverter.ObjectToInt(re);
 }
Example #2
0
        public OtherCompOp(Prod_Components item, OperationTypeEnum op)
        {
            InitializeComponent();
            opType = op;

            GModel = item;

            this.Load += new EventHandler(Form_Load);
            this.FormClosed += new FormClosedEventHandler(CompOp_FormClosed);
            BindTopTool();
        }
Example #3
0
 /// <summary>
 /// 零件成品更新
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateComp(Prod_Components model)
 {
     return CompUpdate(model);
 }
Example #4
0
        /// <summary>
        /// 添加零件基本信息 Prod_Components对象(即:一条记录)
        /// </summary>
        public int Add(Prod_Components prod_Components)
        {
            string sql = "INSERT INTO Prod_Components (PRDC_CompNo,PRDC_CompCode,PRDC_CompName,PRDC_Raw,PRDC_Supp,PRDC_RecDate,PRDC_FinishDate,PRDC_SampleDate,PRDC_VerifyResult,PRDC_iType,PRDC_Tec1,PRDC_Tec2,PRDC_Tec3,PRDC_Tec4,PRDC_Tec5,PRDC_Tec6,PRDC_Tec7,PRDC_Tec8,PRDC_Tec9,PRDC_Tec10,PRDC_ProdCode,Stat,Creator,CreateTime,UpdateTime,DeleteTime) VALUES (@PRDC_CompNo,@PRDC_CompCode,@PRDC_CompName,@PRDC_Raw,@PRDC_Supp,@PRDC_RecDate,@PRDC_FinishDate,@PRDC_SampleDate,@PRDC_VerifyResult,@PRDC_iType,@PRDC_Tec1,@PRDC_Tec2,@PRDC_Tec3,@PRDC_Tec4,@PRDC_Tec5,@PRDC_Tec6,@PRDC_Tec7,@PRDC_Tec8,@PRDC_Tec9,@PRDC_Tec10,@PRDC_ProdCode,@Stat,@Creator,@CreateTime,@UpdateTime,@DeleteTime)";
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompNo))
             {
            idb.AddParameter("@PRDC_CompNo", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompNo", prod_Components.PRDC_CompNo);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompCode))
             {
            idb.AddParameter("@PRDC_CompCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompCode", prod_Components.PRDC_CompCode);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompName))
             {
            idb.AddParameter("@PRDC_CompName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompName", prod_Components.PRDC_CompName);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Raw))
             {
            idb.AddParameter("@PRDC_Raw", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Raw", prod_Components.PRDC_Raw);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Supp))
             {
            idb.AddParameter("@PRDC_Supp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Supp", prod_Components.PRDC_Supp);
             }
             if (prod_Components.PRDC_RecDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_RecDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_RecDate", prod_Components.PRDC_RecDate);
             }
             if (prod_Components.PRDC_FinishDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_FinishDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_FinishDate", prod_Components.PRDC_FinishDate);
             }
             if (prod_Components.PRDC_SampleDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_SampleDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_SampleDate", prod_Components.PRDC_SampleDate);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_VerifyResult))
             {
            idb.AddParameter("@PRDC_VerifyResult", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_VerifyResult", prod_Components.PRDC_VerifyResult);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_iType))
             {
            idb.AddParameter("@PRDC_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_iType", prod_Components.PRDC_iType);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec1))
             {
            idb.AddParameter("@PRDC_Tec1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec1", prod_Components.PRDC_Tec1);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec2))
             {
            idb.AddParameter("@PRDC_Tec2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec2", prod_Components.PRDC_Tec2);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec3))
             {
            idb.AddParameter("@PRDC_Tec3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec3", prod_Components.PRDC_Tec3);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec4))
             {
            idb.AddParameter("@PRDC_Tec4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec4", prod_Components.PRDC_Tec4);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec5))
             {
            idb.AddParameter("@PRDC_Tec5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec5", prod_Components.PRDC_Tec5);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec6))
             {
            idb.AddParameter("@PRDC_Tec6", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec6", prod_Components.PRDC_Tec6);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec7))
             {
            idb.AddParameter("@PRDC_Tec7", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec7", prod_Components.PRDC_Tec7);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec8))
             {
            idb.AddParameter("@PRDC_Tec8", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec8", prod_Components.PRDC_Tec8);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec9))
             {
            idb.AddParameter("@PRDC_Tec9", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec9", prod_Components.PRDC_Tec9);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec10))
             {
            idb.AddParameter("@PRDC_Tec10", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec10", prod_Components.PRDC_Tec10);
             }
             if (string.IsNullOrEmpty(prod_Components.PRDC_ProdCode))
             {
            idb.AddParameter("@PRDC_ProdCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_ProdCode", prod_Components.PRDC_ProdCode);
             }
             if (prod_Components.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", prod_Components.Stat);
             }
             if (prod_Components.Creator == DateTime.MinValue)
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", prod_Components.Creator);
             }
             if (prod_Components.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", prod_Components.CreateTime);
             }
             if (prod_Components.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", prod_Components.UpdateTime);
             }
             if (prod_Components.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", prod_Components.DeleteTime);
             }

            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;
        }
Example #5
0
        public Dictionary<string, List<Prod_Components>> GetCompDocByRefDoc(List<Prod_Doc> docList, string compno)
        {
            StringBuilder sb = new StringBuilder();
            foreach (var d in docList)
            {
                sb.Append("'" + d.PRDQ_Code + "'").Append(",");
            }
            string code = sb.ToString().TrimEnd(',');
            string where = string.Format(" AND PRDQ_Code in ({0}) AND PRDQ_CompNo!='{1}'", code, compno);
            List<Prod_Doc> list = docInstance.GetListByWhere(where);
            Dictionary<string, List<Prod_Components>> dic = new Dictionary<string, List<Prod_Components>>();
            foreach (var l in list.Select(o => o.PRDQ_Code).Distinct())
            {
                if (!dic.Keys.Contains(l))
                {
                    List<Prod_Doc> dlist = list.Where(o => o.PRDQ_Code == l).ToList();
                    if (dlist != null)
                    {
                        List<Prod_Components> tempList = new List<Prod_Components>();
                        foreach (var dd in dlist)
                        {
                            Prod_Components p = new Prod_Components();
                            p.PRDC_CompNo = dd.PRDQ_CompNo;
                            tempList.Add(p);
                        }
                        dic.Add(l, tempList);
                    }
                    else
                    {
                        dic.Add(l, new List<Prod_Components>());
                    }
                }
            }

            return dic;
        }
Example #6
0
 public bool InsertComp(Prod_Components model)
 {
     model.CreateTime = DateTime.Now;
     model.UpdateTime = DateTime.Now;
     var re = pcInstance.Add(model);
     if (re > 1)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #7
0
 public bool DeleteDoc(Prod_Doc doc, Prod_Components model)
 {
     List<Prod_Doc> oldSIList = GetPDocByComp(model.PRDC_CompNo);
     var temp = oldSIList.FirstOrDefault(o => o.PRDQ_Code == doc.PRDQ_Code);
     return PDocDelete(temp);
 }
Example #8
0
 public void DeleteDocByComp(Prod_Components comp)
 {
     var list = GetPDocByComp(comp.PRDC_CompNo);
     foreach (var d in list)
     {
         PDocDelete(d);
     }
 }
Example #9
0
        /// <summary>
        /// 更新零件基本信息 Prod_Components对象(即:一条记录
        /// </summary>
        public int Update(Prod_Components prod_Components)
        {
            StringBuilder sbParameter=new StringBuilder();
              StringBuilder sb=new StringBuilder();
              sb.Append(@"UPDATE       Prod_Components       SET ");
            if(prod_Components.PRDC_CompNo_IsChanged){sbParameter.Append("[email protected]_CompNo, ");}
              if(prod_Components.PRDC_CompCode_IsChanged){sbParameter.Append("[email protected]_CompCode, ");}
              if(prod_Components.PRDC_CompName_IsChanged){sbParameter.Append("[email protected]_CompName, ");}
              if(prod_Components.PRDC_Raw_IsChanged){sbParameter.Append("[email protected]_Raw, ");}
              if(prod_Components.PRDC_Supp_IsChanged){sbParameter.Append("[email protected]_Supp, ");}
              if(prod_Components.PRDC_RecDate_IsChanged){sbParameter.Append("[email protected]_RecDate, ");}
              if(prod_Components.PRDC_FinishDate_IsChanged){sbParameter.Append("[email protected]_FinishDate, ");}
              if(prod_Components.PRDC_SampleDate_IsChanged){sbParameter.Append("[email protected]_SampleDate, ");}
              if(prod_Components.PRDC_VerifyResult_IsChanged){sbParameter.Append("[email protected]_VerifyResult, ");}
              if(prod_Components.PRDC_iType_IsChanged){sbParameter.Append("[email protected]_iType, ");}
              if(prod_Components.PRDC_Tec1_IsChanged){sbParameter.Append("[email protected]_Tec1, ");}
              if(prod_Components.PRDC_Tec2_IsChanged){sbParameter.Append("[email protected]_Tec2, ");}
              if(prod_Components.PRDC_Tec3_IsChanged){sbParameter.Append("[email protected]_Tec3, ");}
              if(prod_Components.PRDC_Tec4_IsChanged){sbParameter.Append("[email protected]_Tec4, ");}
              if(prod_Components.PRDC_Tec5_IsChanged){sbParameter.Append("[email protected]_Tec5, ");}
              if(prod_Components.PRDC_Tec6_IsChanged){sbParameter.Append("[email protected]_Tec6, ");}
              if(prod_Components.PRDC_Tec7_IsChanged){sbParameter.Append("[email protected]_Tec7, ");}
              if(prod_Components.PRDC_Tec8_IsChanged){sbParameter.Append("[email protected]_Tec8, ");}
              if(prod_Components.PRDC_Tec9_IsChanged){sbParameter.Append("[email protected]_Tec9, ");}
              if(prod_Components.PRDC_Tec10_IsChanged){sbParameter.Append("[email protected]_Tec10, ");}
              if(prod_Components.PRDC_ProdCode_IsChanged){sbParameter.Append("[email protected]_ProdCode, ");}
              if(prod_Components.Stat_IsChanged){sbParameter.Append("[email protected], ");}
              if(prod_Components.Creator_IsChanged){sbParameter.Append("[email protected], ");}
              if(prod_Components.CreateTime_IsChanged){sbParameter.Append("[email protected], ");}
              if(prod_Components.UpdateTime_IsChanged){sbParameter.Append("[email protected], ");}
              if(prod_Components.DeleteTime_IsChanged){sbParameter.Append("[email protected] ");}
          sb.Append(sbParameter.ToString().Trim().TrimEnd(','));
              sb.Append(      " WHERE 1=1 AND ((Stat is null) or (Stat=0))   and [email protected]_ID; " );
              string sql=sb.ToString();
             if(prod_Components.PRDC_CompNo_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompNo))
             {
            idb.AddParameter("@PRDC_CompNo", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompNo", prod_Components.PRDC_CompNo);
             }
              }
             if(prod_Components.PRDC_CompCode_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompCode))
             {
            idb.AddParameter("@PRDC_CompCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompCode", prod_Components.PRDC_CompCode);
             }
              }
             if(prod_Components.PRDC_CompName_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_CompName))
             {
            idb.AddParameter("@PRDC_CompName", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_CompName", prod_Components.PRDC_CompName);
             }
              }
             if(prod_Components.PRDC_Raw_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Raw))
             {
            idb.AddParameter("@PRDC_Raw", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Raw", prod_Components.PRDC_Raw);
             }
              }
             if(prod_Components.PRDC_Supp_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Supp))
             {
            idb.AddParameter("@PRDC_Supp", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Supp", prod_Components.PRDC_Supp);
             }
              }
             if(prod_Components.PRDC_RecDate_IsChanged)
             {
             if (prod_Components.PRDC_RecDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_RecDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_RecDate", prod_Components.PRDC_RecDate);
             }
              }
             if(prod_Components.PRDC_FinishDate_IsChanged)
             {
             if (prod_Components.PRDC_FinishDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_FinishDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_FinishDate", prod_Components.PRDC_FinishDate);
             }
              }
             if(prod_Components.PRDC_SampleDate_IsChanged)
             {
             if (prod_Components.PRDC_SampleDate == DateTime.MinValue)
             {
            idb.AddParameter("@PRDC_SampleDate", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_SampleDate", prod_Components.PRDC_SampleDate);
             }
              }
             if(prod_Components.PRDC_VerifyResult_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_VerifyResult))
             {
            idb.AddParameter("@PRDC_VerifyResult", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_VerifyResult", prod_Components.PRDC_VerifyResult);
             }
              }
             if(prod_Components.PRDC_iType_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_iType))
             {
            idb.AddParameter("@PRDC_iType", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_iType", prod_Components.PRDC_iType);
             }
              }
             if(prod_Components.PRDC_Tec1_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec1))
             {
            idb.AddParameter("@PRDC_Tec1", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec1", prod_Components.PRDC_Tec1);
             }
              }
             if(prod_Components.PRDC_Tec2_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec2))
             {
            idb.AddParameter("@PRDC_Tec2", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec2", prod_Components.PRDC_Tec2);
             }
              }
             if(prod_Components.PRDC_Tec3_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec3))
             {
            idb.AddParameter("@PRDC_Tec3", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec3", prod_Components.PRDC_Tec3);
             }
              }
             if(prod_Components.PRDC_Tec4_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec4))
             {
            idb.AddParameter("@PRDC_Tec4", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec4", prod_Components.PRDC_Tec4);
             }
              }
             if(prod_Components.PRDC_Tec5_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec5))
             {
            idb.AddParameter("@PRDC_Tec5", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec5", prod_Components.PRDC_Tec5);
             }
              }
             if(prod_Components.PRDC_Tec6_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec6))
             {
            idb.AddParameter("@PRDC_Tec6", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec6", prod_Components.PRDC_Tec6);
             }
              }
             if(prod_Components.PRDC_Tec7_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec7))
             {
            idb.AddParameter("@PRDC_Tec7", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec7", prod_Components.PRDC_Tec7);
             }
              }
             if(prod_Components.PRDC_Tec8_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec8))
             {
            idb.AddParameter("@PRDC_Tec8", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec8", prod_Components.PRDC_Tec8);
             }
              }
             if(prod_Components.PRDC_Tec9_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec9))
             {
            idb.AddParameter("@PRDC_Tec9", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec9", prod_Components.PRDC_Tec9);
             }
              }
             if(prod_Components.PRDC_Tec10_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_Tec10))
             {
            idb.AddParameter("@PRDC_Tec10", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_Tec10", prod_Components.PRDC_Tec10);
             }
              }
             if(prod_Components.PRDC_ProdCode_IsChanged)
             {
             if (string.IsNullOrEmpty(prod_Components.PRDC_ProdCode))
             {
            idb.AddParameter("@PRDC_ProdCode", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@PRDC_ProdCode", prod_Components.PRDC_ProdCode);
             }
              }
             if(prod_Components.Stat_IsChanged)
             {
             if (prod_Components.Stat == 0)
             {
            idb.AddParameter("@Stat", 0);
             }
             else
             {
            idb.AddParameter("@Stat", prod_Components.Stat);
             }
              }
             if(prod_Components.Creator_IsChanged)
             {
             if (prod_Components.Creator == DateTime.MinValue)
             {
            idb.AddParameter("@Creator", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@Creator", prod_Components.Creator);
             }
              }
             if(prod_Components.CreateTime_IsChanged)
             {
             if (prod_Components.CreateTime == DateTime.MinValue)
             {
            idb.AddParameter("@CreateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@CreateTime", prod_Components.CreateTime);
             }
              }
             if(prod_Components.UpdateTime_IsChanged)
             {
             if (prod_Components.UpdateTime == DateTime.MinValue)
             {
            idb.AddParameter("@UpdateTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@UpdateTime", prod_Components.UpdateTime);
             }
              }
             if(prod_Components.DeleteTime_IsChanged)
             {
             if (prod_Components.DeleteTime == DateTime.MinValue)
             {
            idb.AddParameter("@DeleteTime", DBNull.Value);
             }
             else
             {
            idb.AddParameter("@DeleteTime", prod_Components.DeleteTime);
             }
              }

             idb.AddParameter("@PRDC_ID", prod_Components.PRDC_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;
Example #10
0
        public bool PCompDelete(Prod_Components model)
        {
            model.Stat = 1;

            model.DeleteTime = DateTime.Now;

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

            return false;
        }
Example #11
0
        /// <summary>
        /// 零件关联文档
        /// </summary>
        /// <param name="main"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool AddOrUpdateCDoc(Prod_Components main, List<Prod_Doc> list)
        {
            bool flag = true;

            List<Prod_Doc> oldSIList = GetPDocByComp(main.PRDC_CompNo);

            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.PRDC_CompNo;
                    detail.PRDQ_CompCode = main.PRDC_CompCode;
                    detail.PRDQ_CompName = main.PRDC_CompName;
                    PDocInsert(detail);
                }
            }
            catch
            {
                flag = false;
            }
            return flag;
        }
Example #12
0
        public bool CompInsert(Prod_Components model)
        {
            model.CreateTime = DateTime.Now;

            model.UpdateTime = DateTime.Now;

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

            return false;
        }
Example #13
0
        /// <summary>
        /// 多零件参考保存(最后)
        /// </summary>
        public void SaveDictionaryFinal()
        {
            if (OperationTypeEnum.Look == opType)
            {
                return;
            }

            UltraGridRow row = this.comGrid.ActiveRow;

            if (row != null)
            {
                Prod_Doc doc = row.ListObject as Prod_Doc;

                if (doc == null)
                {
                    return;
                }

                if (string.IsNullOrEmpty(doc.PRDQ_Code))
                {
                    //Alert.Show("请输入文档编号");
                    return;
                }

                List<Prod_Components> list = new List<Prod_Components>();
                foreach (var r in this.otherCompGrid.Rows)
                {
                    Prod_Components c = r.ListObject as Prod_Components;
                    if (c.PRDC_CompNo != GModel.PRDC_CompNo && list.FirstOrDefault(o => o.PRDC_CompNo == c.PRDC_CompNo) == null)
                    {
                        list.Add(c);

                        //如果关联的零件编号不存在则自动插入该零件
                        if (ExsistComponentSource.FirstOrDefault(o => o.PRDC_CompNo == c.PRDC_CompNo) == null)
                        {

                            var temp = compInstance.GetCompModel(c.PRDC_CompNo);
                            if (temp != null)
                            {
                                continue;
                            }
                            Prod_Components comp = new Prod_Components();
                            comp.PRDC_CompCode = GModel.PRDC_CompCode;
                            comp.PRDC_CompName = GModel.PRDC_CompName;
                            comp.CreateTime = DateTime.Now;
                            comp.PRDC_Tec1 = GModel.PRDC_Tec1;
                            comp.PRDC_Tec2 = GModel.PRDC_Tec2;
                            comp.PRDC_Tec3 = GModel.PRDC_Tec3;
                            comp.PRDC_CompNo = c.PRDC_CompNo;
                            comp.PRDC_iType = iTypeEnum.Comp.ToString();
                            comp.PRDC_RecDate = DateTime.Now;
                            var re = compInstance.InsertComp(comp);
                        }
                    }
                }

                //如果存在该该文档相关的信息则重新设置参考零件
                if (RefCompList.Keys.Contains(doc.PRDQ_Code))
                {
                    RefCompList[doc.PRDQ_Code] = list;
                }
                else
                {
                    RefCompList.Add(doc.PRDQ_Code, list);
                }
                //}
            }
        }
Example #14
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_Components>(GModel, this.groupBox2.Controls, "");

            int start = Common.Utils.TypeConverter.ObjectToInt(txtStart.Text);
            int end = Common.Utils.TypeConverter.ObjectToInt(txtEnd.Text);
            List<Prod_Components> list = compInstance.GetPComponentsList();
            List<string> newCompList = new List<string>();

            StringBuilder sb = new StringBuilder();
            //int successCount = 0;
            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.PRDC_CompNo == compno) != null)
                {
                    sb.Append(compno).Append(",");
                    continue;
                }

                Prod_Components comp = new Prod_Components();

                if (string.IsNullOrEmpty(compno))
                {
                    continue;
                }

                comp = GModel;
                comp.PRDC_CompNo = compno;
                comp.CreateTime = DateTime.Now;
                comp.UpdateTime = DateTime.Now;
                comp.PRDC_RecDate = DateTime.Now;
                comp.PRDC_iType = iTypeEnum.Comp.ToString();
                comp.PRDC_VerifyResult = "Check";

                compInstance.CompInsert(comp);

                newCompList.Add(compno);

            }

            this.txtStart.Text = string.Empty;
            this.txtEnd.Text = string.Empty;

            InsertDocument(newCompList);

            if (sb.ToString().Length != 0)
            {

                //Alert.Show(string.Format("以下零件编号已经存在请确认后重新输入"));
                MsgBox msgBox = new MsgBox(string.Format("成功生成{0}个,另外以下零件编号已存在请确认后重新输入:\n{1}", newCompList.Count,sb.ToString().Trim(',')));
                msgBox.Show();
            }
            else
            {
                Alert.Show("批量生成成功!");
            }
        }
Example #15
0
 void BatchComp_Load(object sender, EventArgs e)
 {
     Bll_Bse_Dict dictInstance = new Bll_Bse_Dict();
     DictList = dictInstance.GetDictByKey("DocType");
     GModel = new Prod_Components();
     this.FormClosed += new FormClosedEventHandler(BatchComp_FormClosed);
     BindData();
 }
Example #16
0
        /// <summary>
        /// 获取指定的零件基本信息 Prod_Components对象(即:一条记录
        /// </summary>
        public Prod_Components GetByKey(decimal pRDC_ID)
        {
            Prod_Components prod_Components = new Prod_Components();
             string sql = "SELECT  PRDC_ID,PRDC_CompNo,PRDC_CompCode,PRDC_CompName,PRDC_Raw,PRDC_Supp,PRDC_RecDate,PRDC_FinishDate,PRDC_SampleDate,PRDC_VerifyResult,PRDC_iType,PRDC_Tec1,PRDC_Tec2,PRDC_Tec3,PRDC_Tec4,PRDC_Tec5,PRDC_Tec6,PRDC_Tec7,PRDC_Tec8,PRDC_Tec9,PRDC_Tec10,PRDC_ProdCode,Stat,Creator,CreateTime,UpdateTime,DeleteTime FROM Prod_Components WHERE 1=1 AND ((Stat is null) or (Stat=0) )  AND [email protected]_ID ";
             idb.AddParameter("@PRDC_ID", pRDC_ID);

              SqlDataReader dr=null;
               try {
              dr=(SqlDataReader)idb.ReturnReader(sql);
             while(dr.Read())
             {
            if (dr["PRDC_ID"] != DBNull.Value) prod_Components.PRDC_ID = Convert.ToDecimal(dr["PRDC_ID"]);
            if (dr["PRDC_CompNo"] != DBNull.Value) prod_Components.PRDC_CompNo = Convert.ToString(dr["PRDC_CompNo"]);
            if (dr["PRDC_CompCode"] != DBNull.Value) prod_Components.PRDC_CompCode = Convert.ToString(dr["PRDC_CompCode"]);
            if (dr["PRDC_CompName"] != DBNull.Value) prod_Components.PRDC_CompName = Convert.ToString(dr["PRDC_CompName"]);
            if (dr["PRDC_Raw"] != DBNull.Value) prod_Components.PRDC_Raw = Convert.ToString(dr["PRDC_Raw"]);
            if (dr["PRDC_Supp"] != DBNull.Value) prod_Components.PRDC_Supp = Convert.ToString(dr["PRDC_Supp"]);
            if (dr["PRDC_RecDate"] != DBNull.Value) prod_Components.PRDC_RecDate = Convert.ToDateTime(dr["PRDC_RecDate"]);
            if (dr["PRDC_FinishDate"] != DBNull.Value) prod_Components.PRDC_FinishDate = Convert.ToDateTime(dr["PRDC_FinishDate"]);
            if (dr["PRDC_SampleDate"] != DBNull.Value) prod_Components.PRDC_SampleDate = Convert.ToDateTime(dr["PRDC_SampleDate"]);
            if (dr["PRDC_VerifyResult"] != DBNull.Value) prod_Components.PRDC_VerifyResult = Convert.ToString(dr["PRDC_VerifyResult"]);
            if (dr["PRDC_iType"] != DBNull.Value) prod_Components.PRDC_iType = Convert.ToString(dr["PRDC_iType"]);
            if (dr["PRDC_Tec1"] != DBNull.Value) prod_Components.PRDC_Tec1 = Convert.ToString(dr["PRDC_Tec1"]);
            if (dr["PRDC_Tec2"] != DBNull.Value) prod_Components.PRDC_Tec2 = Convert.ToString(dr["PRDC_Tec2"]);
            if (dr["PRDC_Tec3"] != DBNull.Value) prod_Components.PRDC_Tec3 = Convert.ToString(dr["PRDC_Tec3"]);
            if (dr["PRDC_Tec4"] != DBNull.Value) prod_Components.PRDC_Tec4 = Convert.ToString(dr["PRDC_Tec4"]);
            if (dr["PRDC_Tec5"] != DBNull.Value) prod_Components.PRDC_Tec5 = Convert.ToString(dr["PRDC_Tec5"]);
            if (dr["PRDC_Tec6"] != DBNull.Value) prod_Components.PRDC_Tec6 = Convert.ToString(dr["PRDC_Tec6"]);
            if (dr["PRDC_Tec7"] != DBNull.Value) prod_Components.PRDC_Tec7 = Convert.ToString(dr["PRDC_Tec7"]);
            if (dr["PRDC_Tec8"] != DBNull.Value) prod_Components.PRDC_Tec8 = Convert.ToString(dr["PRDC_Tec8"]);
            if (dr["PRDC_Tec9"] != DBNull.Value) prod_Components.PRDC_Tec9 = Convert.ToString(dr["PRDC_Tec9"]);
            if (dr["PRDC_Tec10"] != DBNull.Value) prod_Components.PRDC_Tec10 = Convert.ToString(dr["PRDC_Tec10"]);
            if (dr["PRDC_ProdCode"] != DBNull.Value) prod_Components.PRDC_ProdCode = Convert.ToString(dr["PRDC_ProdCode"]);
            if (dr["Stat"] != DBNull.Value) prod_Components.Stat = Convert.ToInt32(dr["Stat"]);
            if (dr["Creator"] != DBNull.Value) prod_Components.Creator = Convert.ToDateTime(dr["Creator"]);
            if (dr["CreateTime"] != DBNull.Value) prod_Components.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
            if (dr["UpdateTime"] != DBNull.Value) prod_Components.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
            if (dr["DeleteTime"] != DBNull.Value) prod_Components.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
             }
              }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_Components;
        }
Example #17
0
        /// <summary>
        /// 零件关联文档数据绑定
        /// </summary>
        /// <param name="comp"></param>
        public void BindDocData(Prod_Components comp)
        {
            if (comp != null)
            {
                var list = compInstance.GetProdDocByCompForProd(comp.PRDC_CompNo);
                BindingSource dataSource = new BindingSource();
                if (list != null)
                {
                    dataSource.DataSource = list;
                }
                else
                {
                    dataSource.DataSource = new List<Prod_Doc>();
                }

                DocGrid.DataSource = dataSource;
            }
        }
Example #18
0
 /// <summary>
 /// 获取指定的零件基本信息 Prod_Components对象集合
 /// </summary>
 public List<Prod_Components> GetListByWhere(string strCondition)
 {
     List<Prod_Components> ret = new List<Prod_Components>();
      string sql = "SELECT  PRDC_ID,PRDC_CompNo,PRDC_CompCode,PRDC_CompName,PRDC_Raw,PRDC_Supp,PRDC_RecDate,PRDC_FinishDate,PRDC_SampleDate,PRDC_VerifyResult,PRDC_iType,PRDC_Tec1,PRDC_Tec2,PRDC_Tec3,PRDC_Tec4,PRDC_Tec5,PRDC_Tec6,PRDC_Tec7,PRDC_Tec8,PRDC_Tec9,PRDC_Tec10,PRDC_ProdCode,Stat,Creator,CreateTime,UpdateTime,DeleteTime FROM Prod_Components 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_Components prod_Components = new Prod_Components();
     if (dr["PRDC_ID"] != DBNull.Value) prod_Components.PRDC_ID = Convert.ToDecimal(dr["PRDC_ID"]);
     if (dr["PRDC_CompNo"] != DBNull.Value) prod_Components.PRDC_CompNo = Convert.ToString(dr["PRDC_CompNo"]);
     if (dr["PRDC_CompCode"] != DBNull.Value) prod_Components.PRDC_CompCode = Convert.ToString(dr["PRDC_CompCode"]);
     if (dr["PRDC_CompName"] != DBNull.Value) prod_Components.PRDC_CompName = Convert.ToString(dr["PRDC_CompName"]);
     if (dr["PRDC_Raw"] != DBNull.Value) prod_Components.PRDC_Raw = Convert.ToString(dr["PRDC_Raw"]);
     if (dr["PRDC_Supp"] != DBNull.Value) prod_Components.PRDC_Supp = Convert.ToString(dr["PRDC_Supp"]);
     if (dr["PRDC_RecDate"] != DBNull.Value) prod_Components.PRDC_RecDate = Convert.ToDateTime(dr["PRDC_RecDate"]);
     if (dr["PRDC_FinishDate"] != DBNull.Value) prod_Components.PRDC_FinishDate = Convert.ToDateTime(dr["PRDC_FinishDate"]);
     if (dr["PRDC_SampleDate"] != DBNull.Value) prod_Components.PRDC_SampleDate = Convert.ToDateTime(dr["PRDC_SampleDate"]);
     if (dr["PRDC_VerifyResult"] != DBNull.Value) prod_Components.PRDC_VerifyResult = Convert.ToString(dr["PRDC_VerifyResult"]);
     if (dr["PRDC_iType"] != DBNull.Value) prod_Components.PRDC_iType = Convert.ToString(dr["PRDC_iType"]);
     if (dr["PRDC_Tec1"] != DBNull.Value) prod_Components.PRDC_Tec1 = Convert.ToString(dr["PRDC_Tec1"]);
     if (dr["PRDC_Tec2"] != DBNull.Value) prod_Components.PRDC_Tec2 = Convert.ToString(dr["PRDC_Tec2"]);
     if (dr["PRDC_Tec3"] != DBNull.Value) prod_Components.PRDC_Tec3 = Convert.ToString(dr["PRDC_Tec3"]);
     if (dr["PRDC_Tec4"] != DBNull.Value) prod_Components.PRDC_Tec4 = Convert.ToString(dr["PRDC_Tec4"]);
     if (dr["PRDC_Tec5"] != DBNull.Value) prod_Components.PRDC_Tec5 = Convert.ToString(dr["PRDC_Tec5"]);
     if (dr["PRDC_Tec6"] != DBNull.Value) prod_Components.PRDC_Tec6 = Convert.ToString(dr["PRDC_Tec6"]);
     if (dr["PRDC_Tec7"] != DBNull.Value) prod_Components.PRDC_Tec7 = Convert.ToString(dr["PRDC_Tec7"]);
     if (dr["PRDC_Tec8"] != DBNull.Value) prod_Components.PRDC_Tec8 = Convert.ToString(dr["PRDC_Tec8"]);
     if (dr["PRDC_Tec9"] != DBNull.Value) prod_Components.PRDC_Tec9 = Convert.ToString(dr["PRDC_Tec9"]);
     if (dr["PRDC_Tec10"] != DBNull.Value) prod_Components.PRDC_Tec10 = Convert.ToString(dr["PRDC_Tec10"]);
     if (dr["PRDC_ProdCode"] != DBNull.Value) prod_Components.PRDC_ProdCode = Convert.ToString(dr["PRDC_ProdCode"]);
     if (dr["Stat"] != DBNull.Value) prod_Components.Stat = Convert.ToInt32(dr["Stat"]);
     if (dr["Creator"] != DBNull.Value) prod_Components.Creator = Convert.ToDateTime(dr["Creator"]);
     if (dr["CreateTime"] != DBNull.Value) prod_Components.CreateTime = Convert.ToDateTime(dr["CreateTime"]);
     if (dr["UpdateTime"] != DBNull.Value) prod_Components.UpdateTime = Convert.ToDateTime(dr["UpdateTime"]);
     if (dr["DeleteTime"] != DBNull.Value) prod_Components.DeleteTime = Convert.ToDateTime(dr["DeleteTime"]);
     ret.Add(prod_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;
 }
Example #19
0
 private void BindComponentsRow(Prod_Components p, UltraGridRow row)
 {
     PropertyDescriptorCollection pp = TypeDescriptor.GetProperties(typeof(Prod_Components));
     foreach (UltraGridCell c in row.Cells)
     {
         if (pp[c.Column.Key].GetValue(p) != null)
         {
             c.Value = pp[c.Column.Key].GetValue(p);
         }
     }
 }
Example #20
0
 public void BindDocData(Prod_Components comp)
 {
     if (comp != null)
     {
         var list = compInstance.GetDocByComponents(comp.PRDC_CompNo);
         BindingSource dataSource = new BindingSource();
         dataSource.DataSource = list;
         DocGrid.DataSource = dataSource;
     }
 }
Example #21
0
        public bool CompUpdate(Prod_Components model)
        {
            model.UpdateTime = DateTime.Now;

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

            return false;
        }