/// <summary> /// 获得分厂ID和名字 /// </summary> /// <returns></returns> public string GetFactory() { ComplexQuery query = new ComplexQuery(); query.AddNeedField("Factory", "ID"); query.AddNeedField("Factory", "Name"); DataTable dt = dataFactory.Query(query); if (dt.Rows.Count == 0) throw new Exception("查无数据"); return ComboboxJsonParser.DataTableToJson(dt, "ID", "Name"); }
public string GetUserNameById(string id) { ComplexQuery cmquery = new ComplexQuery(); cmquery.AddNeedField("users", "USER_NAME"); cmquery.AddCriterion("USER_ID", id, CriteriaOperator.Equal); DataTable table = dataFactory.Query(cmquery); return table.Rows[0][0].ToString().Trim(); }
public string GetEletricalRoom(int factoryId) { try { string connString = ConnectionStringFactory.GetByFactoryId(factoryId); ISqlServerDataFactory factory = new SqlServerDataFactory(connString); ComplexQuery query = new ComplexQuery(); query.AddNeedField("ElectricalRoom", "ID"); query.AddNeedField("ElectricalRoom", "Name"); DataTable dt = factory.Query(query); return ComboboxJsonParser.DataTableToJson(dt, "ID", "Name"); } catch { return "[]"; } }
/// <summary> /// 获得视图中所有变量的Id值 /// </summary> /// <param name="viewName"></param> /// <returns></returns> public System.Collections.ArrayList GetVariableId(int productLineId, string viewName) { string connectionString = ConnectionStringFactory.GetConnectionStringByProductLineID(productLineId, DatabaseType.DCSSystemDatabase); ISqlServerDataFactory dataFactory = new SqlServerDataFactory(connectionString); ArrayList result = new ArrayList(); ComplexQuery cmpquery = new ComplexQuery(); cmpquery.AddNeedField("ContrastTable", "VariableName"); cmpquery.AddCriterion("ViewName", viewName, CriteriaOperator.Equal); DataTable data = dataFactory.Query(cmpquery); foreach (DataRow row in data.Rows) { result.Add(row["VariableName"].ToString().Trim()); } return result; }
/// <summary> /// 获得实时数据的table表 /// </summary> /// <param name="dataPathInfor"></param> /// <returns></returns> public DataTable GetDataItemTable(int productLineId, IEnumerable<DataPathInformation> dataPathInfor) { string connectionString = ConnectionStringFactory.NXJCConnectionString; ISqlServerDataFactory dataFactory = new SqlServerDataFactory(connectionString); ComplexQuery cmpquery = new ComplexQuery(); foreach (var item in dataPathInfor) { cmpquery.AddNeedField(item.TableName, item.FieldName, item.ViewId); } cmpquery.JoinCriterion = new JoinCriterion { DefaultJoinFieldName = "v_date", JoinType = JoinType.FULL_JOIN }; cmpquery.TopNumber = 1; //cmpquery.OrderByClause = new OrderByClause("realtime_line_data.v_date", true); DataTable table = dataFactory.Query(cmpquery); return table; }
private DataItem GetDataItem(DataSetInformation dataSetInformation) { DataItem result = new DataItem(); ComplexQuery cmpquery = new ComplexQuery(); cmpquery.AddNeedField(dataSetInformation.TableName, dataSetInformation.FieldName, dataSetInformation.FieldName); cmpquery.TopNumber = 1; cmpquery.AddOrderByClause("v_date", true); DataTable table = dataFactory.Query(cmpquery); foreach(DataRow item in table.Rows) { result = new DataItem { ID = dataSetInformation.ViewId, Value = item[dataSetInformation.FieldName].ToString().Trim() }; } return result; }
/// <summary> /// 获得视图中所有变量的Id值 /// </summary> /// <param name="viewName"></param> /// <returns></returns> private ArrayList GetParametorsId(string viewName) { ArrayList result = new ArrayList(); ComplexQuery cmpquery = new ComplexQuery(); cmpquery.AddNeedField("ContrastTable", "VariableName"); cmpquery.AddCriterion("ViewName", viewName, CriteriaOperator.Equal); DataTable data = dataFactory.Query(cmpquery); foreach (DataRow row in data.Rows) { result.Add(row["VariableName"].ToString().Trim()); } return result; }
/// <summary> /// 获得实时数据的table表 /// </summary> /// <param name="dataSetInformations"></param> /// <returns></returns> private DataTable GetDataItemTable(IEnumerable<DataSetInformation> dataSetInformations) { //DataItem result = new DataItem(); ComplexQuery cmpquery = new ComplexQuery(); foreach (var item in dataSetInformations) { cmpquery.AddNeedField(item.TableName, item.FieldName, item.ViewId); } cmpquery.JoinCriterion = new JoinCriterion { DefaultJoinFieldName = "v_date", JoinType = JoinType.FULL_JOIN }; cmpquery.TopNumber = 1; //cmpquery.OrderByClause = new OrderByClause("realtime_line_data.v_date", true); DataTable table = dataFactory.Query(cmpquery); return table; }
public string GetProductLineNameBy(int id) { ComplexQuery cmquery = new ComplexQuery(); cmquery.AddNeedField("ProductLine", "Name"); cmquery.AddCriterion("ID", id, CriteriaOperator.Equal); DataTable table = dataFactory.Query(cmquery); return table.Rows[0][0].ToString().Trim(); }