private string SelectDt(string MashineID)
        {
            string[]  arrField = new string[1];
            string[]  arrValue = new string[1];
            string    rtstr    = "error";
            DataTable dt;

            try
            {
                string tablename = "sfcdata.barautbind";
                OraDB  oraDB     = new OraDB(SQL_ora_server, SQL_ora_user, SQL_ora_pwd);
                if (oraDB.isConnect())
                {
                    arrField[0] = "BB01";
                    arrValue[0] = MashineID;
                    DataSet s = oraDB.selectSQLwithOrder(tablename.ToUpper(), arrField, arrValue);
                    dt = s.Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        rtstr = (string)dt.Rows[0]["BB01"] + ";" + (string)dt.Rows[0]["BB02"] + ";" + (string)dt.Rows[0]["BB03"] + ";" + (string)dt.Rows[0]["BB04"] + ";" + (string)dt.Rows[0]["BLUID"] + ";" + (string)dt.Rows[0]["BB06"] + ";" + (string)dt.Rows[0]["BB07"];
                    }
                }
                oraDB.disconnect();
            }
            catch (Exception ex)
            {
                Log.Default.Error("Class1.SelectDt", ex.Message);
            }
            return(rtstr);
        }
 private async Task <bool> Update_A_Row(DP6SQLROW row)
 {
     return(await((Func <Task <bool> >)(() =>
     {
         return Task.Run(() =>
         {
             try
             {
                 string[] arrField = new string[1];
                 string[] arrValue = new string[1];
                 OraDB oraDB = new OraDB("qwer", "sfcabar", "sfcabar*168");
                 string tablename = "sfcdata.barautbind";
                 if (oraDB.isConnect())
                 {
                     IsTCPConnect = true;
                     arrField[0] = "SCBARCODE";
                     arrValue[0] = row.Bar;
                     DataSet s = oraDB.selectSQL(tablename.ToUpper(), arrField, arrValue);
                     SinglDt = s.Tables[0];
                     if (SinglDt.Rows.Count == 0)
                     {
                         MsgText = AddMessage("未查询到 " + row.Bar + " 信息");
                         oraDB.disconnect();
                         return false;
                     }
                     else
                     {
                         string[,] arrFieldAndNewValue = { { "BLDATE", ("to_date('" + row.BLDATE + "', 'yyyy/mm/dd hh24:mi:ss')").ToUpper() }, { "BLID", row.BLID }, { "BLNAME", row.BLNAME }, { "BLUID", row.BLUID }, { "BLMID", row.BLMID } };
                         string[,] arrFieldAndOldValue = { { "SCBARCODE", row.Bar } };
                         oraDB.updateSQL2(tablename.ToUpper(), arrFieldAndNewValue, arrFieldAndOldValue);
                         s = oraDB.selectSQL(tablename.ToUpper(), arrField, arrValue);
                         SinglDt = s.Tables[0];
                         oraDB.disconnect();
                         MsgText = AddMessage("条码 " + row.Bar + " 已更新");
                         return true;
                     }
                 }
                 else
                 {
                     IsTCPConnect = false;
                     MsgText = AddMessage("数据库链接失败");
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 IsTCPConnect = false;
                 MsgText = AddMessage("数据插入失败: " + ex.Message);
                 Console.WriteLine(ex.Message);
                 return false;
             }
         }
                         );
     }))());
 }
Exemple #3
0
        private bool LookforDt(string barcode)
        {
            bool r = false;

            string[] arrField = new string[1];
            string[] arrValue = new string[1];
            try
            {
                string tablename = "FLUKE_DATA";
                OraDB  oraDB     = new OraDB("zdtdb", "ictdata", "ictdata*168");
                if (oraDB.isConnect())
                {
                    arrField[0] = "BARCODE";
                    arrValue[0] = barcode;
                    DataSet   s       = oraDB.selectSQL(tablename.ToUpper(), arrField, arrValue);
                    DataTable SinglDt = s.Tables[0];
                    if (SinglDt.Rows.Count < BarcodeItemNum)
                    {
                        ModelPrint("条码 " + barcode + " 记录 " + SinglDt.Rows.Count.ToString() + " < " + BarcodeItemNum.ToString() + " 合法");
                        r = true;
                    }
                    else
                    {
                        ModelPrint("条码 " + barcode + " 记录 " + SinglDt.Rows.Count.ToString() + " >= " + BarcodeItemNum.ToString() + " 非法");
                        r = false;
                    }
                }
                else
                {
                    ModelPrint("数据库连接失败");
                    r = true;
                }
                oraDB.disconnect();
            }
            catch (Exception ex)
            {
                ModelPrint(ex.Message);
                r = true;
            }
            return(r);
        }