SensusOracle.Database.ReadOrderDetails( ) reads from vt_auft_zaehlernr_pd
This commit is contained in:
parent
352f2c1e28
commit
5797e97e0f
@ -17,12 +17,22 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
public DateTime Created;
|
||||
public DateTime DueDate;
|
||||
public string Remark;
|
||||
public int FirstSerialNr;
|
||||
public int LastSerialNr;
|
||||
public int CurrentSerialNr;
|
||||
public int FirstRadioAddress;
|
||||
public int LastRadioAddress;
|
||||
public string RadioAddressPrefix;
|
||||
public string RadioAddressSuffix;
|
||||
public int CurrentRadioAddress;
|
||||
|
||||
public Auftrag()
|
||||
{
|
||||
Prefix = string.Empty;
|
||||
Suffix = string.Empty;
|
||||
Remark = string.Empty;
|
||||
RadioAddressPrefix = string.Empty;
|
||||
RadioAddressSuffix = string.Empty;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
@ -1429,7 +1429,7 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
/// </summary>
|
||||
/// <param name="connection">Oracle DB connection</param>
|
||||
/// <returns>List of active purchase orders</returns>
|
||||
public IList<Auftrag> ReadOrderNumbersFromOracle()
|
||||
public IList<Auftrag> ReadOrderNumbers()
|
||||
{
|
||||
OracleConnection connection = ProductionDB;
|
||||
|
||||
@ -1554,5 +1554,62 @@ namespace TBF.BenchControl.Output.DB.SensusOracle
|
||||
|
||||
return orders;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read a list of valid purchase orders.
|
||||
/// </summary>
|
||||
/// <param name="connection">Oracle DB connection</param>
|
||||
/// <returns>List of active purchase orders</returns>
|
||||
public bool ReadOrderDetails(ref Auftrag auftrag)
|
||||
{
|
||||
if (dbCfg.DebugLevel == DebugMode.Normal)
|
||||
{
|
||||
OracleConnection connection = ProductionDB;
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
|
||||
OracleCommand cmd = new OracleCommand("SELECT erste_nummer, ltz_nummer, akt_nummer, erste_adresse, ltz_adresse," +
|
||||
" prefix_adresse, suffix_adresse, akt_adresse " +
|
||||
"FROM vt_auft_zaehlernr_pd " +
|
||||
"WHERE auftragsnummer=:1 AND anbid=:2", connection);
|
||||
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = auftrag.AuftragsNummer });
|
||||
cmd.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = Anbid_Producer });
|
||||
|
||||
OracleDataReader dr = cmd.ExecuteReader();
|
||||
|
||||
if (dr.Read())
|
||||
{
|
||||
int i = 0;
|
||||
auftrag.FirstSerialNr = dr.GetInt32(i++);
|
||||
auftrag.LastSerialNr = dr.GetInt32(i++);
|
||||
auftrag.CurrentSerialNr = dr.GetInt32(i++);
|
||||
auftrag.FirstRadioAddress = dr.GetInt32(i++);
|
||||
auftrag.LastRadioAddress = dr.GetInt32(i++);
|
||||
try { auftrag.RadioAddressPrefix = dr.GetString(i++); } catch { auftrag.RadioAddressPrefix = string.Empty; }
|
||||
try { auftrag.RadioAddressSuffix = dr.GetString(i++); } catch { auftrag.RadioAddressSuffix = string.Empty; }
|
||||
auftrag.CurrentRadioAddress = dr.GetInt32(i++);
|
||||
}
|
||||
dr.Close();
|
||||
|
||||
connection.Close();
|
||||
return true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
log.ErrorFormat("ERROR: Oracle DB query SELECT ... FROM vt_auft_zaehlernr_pd WHERE auftragsnummer={0} failed: {1}",
|
||||
auftrag.AuftragsNummer, exc.Message);
|
||||
if (connection != null) connection.Close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user