You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB
C#

using Mesnac.Basic;
using Mesnac.Codd.Session;
using Mesnac.Compressor.Unity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Mesnac.Compressor.Data
{
public class GetStatioPara
{
public DbHelper dbHelper;
private DataSourceFactory dsFactory=DataSourceFactory.Instance;
public DataBHandler localDB = new DataBHandler();
public GetStatioPara()
{
if (Common.Instance.ReadLocalDB)
{
return;
}
try
{
dbHelper = dsFactory.GetDbHelper("DataSource2");
}
catch
{
//ConnectShow();
throw;
}
}
public float GetD8Weight(string SemiBarcode)
{
if (dbHelper == null || Common.Instance.ReadLocalDB)
{
return localDB.GetD8Weight(SemiBarcode);
}
try
{
dbHelper.ClearParameter();
dbHelper.CommandType = CommandType.Text;
dbHelper.CommandText = "";
StringBuilder sb = new StringBuilder();
sb.Append("SELECT top(1) Para1 FROM dbo.T_RP_StationPara_D8d2 WHERE SemiBarcode='");
sb.Append(SemiBarcode).Append("'");
dbHelper.CommandText = sb.ToString();
return Convert.ToSingle(dbHelper.ToScalar());
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Info(string.Format(ex.ToString()));
return 0;
}
}
}
}