Esempio n. 1
0
        /// <summary>
        /// 增加数据
        /// </summary>
        /// <param name="e"></param>
        public void Add_Pack(My_GetTestData.UpDataEventArgs e)
        {
            DateTime dt         = DateTime.Now;
            int      _temRecord = 0;

            foreach (DataRow dr in e.TestData.Tables[0].Rows)
            {
                Maticsoft.Model.Pack_Exfo PK_Exfo = DataRowToModel_NotPack(dr);
                PK_Exfo.OrderID  = e.WorkOrder.OrderID;
                PK_Exfo.BatchNo  = e.BatchNo;
                PK_Exfo.ClientSN = e.ClientSN;
                PK_Exfo.PackDate = dt;
                dbs.Exists("delete from tb_Pack_Exfo WHERE SN ='" + PK_Exfo.SN + "' AND PartNumber= '" + PK_Exfo.PartNumber + "' AND Wave = '" + PK_Exfo.Wave + "'");
                if (!Add(PK_Exfo)) //返回更新结果
                {
                    ++_temRecord;
                }
            }

            /*
             * if (_temRecord != 0)
             * {
             *  e.Result = false;
             * }
             * else { e.Result = true; }
             */
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.Pack_Exfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Pack_Exfo(");
            strSql.Append("TestDate,PartNumber,SN,Result,Wave,IL_A,Refl_A,IL_B,Refl_B,ClientSN,OrderID,BatchNo,PackDate,CustomerName)");
            strSql.Append(" values (");
            strSql.Append("@TestDate,@PartNumber,@SN,@Result,@Wave,@IL_A,@Refl_A,@IL_B,@Refl_B,@ClientSN,@OrderID,@BatchNo,@PackDate,@CustomerName)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TestDate",     SqlDbType.VarChar,   25),
                new SqlParameter("@PartNumber",   SqlDbType.VarChar,   50),
                new SqlParameter("@SN",           SqlDbType.VarChar,   25),
                new SqlParameter("@Result",       SqlDbType.VarChar,   10),
                new SqlParameter("@Wave",         SqlDbType.VarChar,   10),
                new SqlParameter("@IL_A",         SqlDbType.VarChar,   10),
                new SqlParameter("@Refl_A",       SqlDbType.VarChar,   10),
                new SqlParameter("@IL_B",         SqlDbType.VarChar,   10),
                new SqlParameter("@Refl_B",       SqlDbType.VarChar,   10),
                new SqlParameter("@ClientSN",     SqlDbType.VarChar,   25),
                new SqlParameter("@OrderID",      SqlDbType.VarChar,   35),
                new SqlParameter("@BatchNo",      SqlDbType.VarChar,   35),
                new SqlParameter("@PackDate",     SqlDbType.DateTime),
                new SqlParameter("@CustomerName", SqlDbType.VarChar, 25)
            };

            parameters[0].Value  = model.TestDate;
            parameters[1].Value  = model.PartNumber;
            parameters[2].Value  = model.SN;
            parameters[3].Value  = model.Result;
            parameters[4].Value  = model.Wave;
            parameters[5].Value  = model.IL_A;
            parameters[6].Value  = model.Refl_A;
            parameters[7].Value  = model.IL_B;
            parameters[8].Value  = model.Refl_B;
            parameters[9].Value  = model.ClientSN;
            parameters[10].Value = model.OrderID;
            parameters[11].Value = model.BatchNo;
            parameters[12].Value = model.PackDate;
            parameters[13].Value = model.CustomerName;


            int rows = dbs.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 两码两标签 数据添加
        /// </summary>
        /// <param name="e"></param>
        public void Add_Pack_TwoSnTwoLab(My_GetTestData.UpDataEventArgs e)
        {
            DateTime dt         = DateTime.Now;
            int      _temRecord = 0;

            foreach (DataRow dr in e.TestData.Tables[0].Rows)
            {
                Maticsoft.Model.Pack_Exfo PK_Exfo = DataRowToModel_NotPack(dr);
                PK_Exfo.OrderID  = e.WorkOrder.OrderID;
                PK_Exfo.BatchNo  = e.BatchNo;
                PK_Exfo.ClientSN = dr["SN"].ToString();
                PK_Exfo.PackDate = dt;
                dbs.Exists("delete from tb_Pack_Exfo WHERE SN ='" + PK_Exfo.SN + "' AND Wave = '" + PK_Exfo.Wave + "'");
                if (!Add(PK_Exfo)) //返回更新结果
                {
                    ++_temRecord;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.Pack_Exfo GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TestDate,PartNumber,SN,Result,Wave,IL_A,Refl_A,IL_B,Refl_B,ClientSN,OrderID,BatchNo,PackDate,CustomerName,ID_Key from tb_Pack_Exfo ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            Maticsoft.Model.Pack_Exfo model = new Maticsoft.Model.Pack_Exfo();
            DataSet ds = dbs.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel_NotPack(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体 从已包装数据中
        /// </summary>
        public Maticsoft.Model.Pack_Exfo DataRowToModel_YetPack(DataRow row)
        {
            Maticsoft.Model.Pack_Exfo model = new Maticsoft.Model.Pack_Exfo();
            if (row != null)
            {
                if (row["TestDate"] != null)
                {
                    model.TestDate = row["TestDate"].ToString();
                }
                if (row["Name"] != null)
                {
                    model.PartNumber = row["Name"].ToString();
                }
                if (row["SN"] != null && row["SN"].ToString() != "")
                {
                    model.SN = row["SN"].ToString();
                }
                if (row["Result"] != null)
                {
                    model.Result = row["Result"].ToString();
                }
                if (row["Wave"] != null)
                {
                    model.Wave = row["Wave"].ToString();
                }
                if (row["IL_A"] != null)
                {
                    model.IL_A = row["IL_A"].ToString();
                }
                if (row["Refl_A"] != null)
                {
                    model.Refl_A = row["Refl_A"].ToString();
                }
                if (row["IL_B"] != null)
                {
                    model.IL_B = row["IL_B"].ToString();
                }
                if (row["Refl_B"] != null)
                {
                    model.Refl_B = row["Refl_B"].ToString();
                }

                /*
                 * if (row["ClientSN"] != null)
                 * {
                 *  model.Refl_B = row["ClientSN"].ToString();
                 * }
                 *              if(row["OrderID"]!=null)
                 *              {
                 *                      model.OrderID=row["OrderID"].ToString();
                 *              }
                 *              if(row["BatchNo"]!=null)
                 *              {
                 *                      model.BatchNo=row["BatchNo"].ToString();
                 *              }
                 *              if(row["PackDate"]!=null && row["PackDate"].ToString()!="")
                 *              {
                 *                      model.PackDate=DateTime.Parse(row["PackDate"].ToString());
                 *              }
                 *              if(row["CustomerName"]!=null)
                 *              {
                 *                      model.CustomerName=row["CustomerName"].ToString();
                 *              }
                 *              if(row["ID_Key"]!=null && row["ID_Key"].ToString()!="")
                 *              {
                 *                      model.ID_Key=decimal.Parse(row["ID_Key"].ToString());
                 *              }
                 */
            }
            return(model);
        }
Esempio n. 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.Pack_Exfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Pack_Exfo set ");
            strSql.Append("TestDate=@TestDate,");
            strSql.Append("PartNumber=@PartNumber,");
            strSql.Append("SN=@SN,");
            strSql.Append("Result=@Result,");
            strSql.Append("Wave=@Wave,");
            strSql.Append("IL_A=@IL_A,");
            strSql.Append("Refl_A=@Refl_A,");
            strSql.Append("IL_B=@IL_B,");
            strSql.Append("Refl_B=@Refl_B,");
            strSql.Append("ClientSN=@ClientSN,");
            strSql.Append("OrderID=@OrderID,");
            strSql.Append("BatchNo=@BatchNo,");
            strSql.Append("PackDate=@PackDate,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("ID_Key=@ID_Key");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TestDate",     SqlDbType.VarChar,   25),
                new SqlParameter("@PartNumber",   SqlDbType.VarChar,   50),
                new SqlParameter("@SN",           SqlDbType.VarChar,   25),
                new SqlParameter("@Result",       SqlDbType.VarChar,   10),
                new SqlParameter("@Wave",         SqlDbType.VarChar,   10),
                new SqlParameter("@IL_A",         SqlDbType.VarChar,   10),
                new SqlParameter("@Refl_A",       SqlDbType.VarChar,   10),
                new SqlParameter("@IL_B",         SqlDbType.VarChar,   10),
                new SqlParameter("@Refl_B",       SqlDbType.VarChar,   10),
                new SqlParameter("@ClientSN",     SqlDbType.VarChar,   25),
                new SqlParameter("@OrderID",      SqlDbType.VarChar,   35),
                new SqlParameter("@BatchNo",      SqlDbType.VarChar,   35),
                new SqlParameter("@PackDate",     SqlDbType.DateTime),
                new SqlParameter("@CustomerName", SqlDbType.VarChar,   25),
                new SqlParameter("@ID_Key",       SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.TestDate;
            parameters[1].Value  = model.PartNumber;
            parameters[2].Value  = model.SN;
            parameters[3].Value  = model.Result;
            parameters[4].Value  = model.Wave;
            parameters[5].Value  = model.IL_A;
            parameters[6].Value  = model.Refl_A;
            parameters[7].Value  = model.IL_B;
            parameters[8].Value  = model.Refl_B;
            parameters[9].Value  = model.ClientSN;
            parameters[10].Value = model.OrderID;
            parameters[11].Value = model.BatchNo;
            parameters[12].Value = model.PackDate;
            parameters[13].Value = model.CustomerName;
            parameters[14].Value = model.ID_Key;

            int rows = dbs.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Maticsoft.Model.Pack_Exfo model)
 {
     return(dal.Update(model));
 }
Esempio n. 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Maticsoft.Model.Pack_Exfo model)
 {
     return(dal.Add(model));
 }