using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;

using SystemFramework;

namespace bizFacade
{
    public partial class BaseDataSystemMES
    {
        /// <summary>
        /// 发动机类型转换表
        /// SELECT  ID,发动机机型代码  FROM MES_计划BOM_发动机型号代码
        /// </summary>
        /// <returns></returns>
        public static DataTable BaseData_tagTable_QualityData_EngineTypeID()
        {
            DataTable dt;
            string sql;
            sql = "SELECT  ID,发动机机型代码  FROM MES_计划BOM_发动机型号代码 ";
            DataAccess.ExecuteDataTable(sql, out dt);
            return dt;
        }


        /// <summary>
        /// 测量合格标志
        /// 全部测量数据的测量工位
        /// </summary>
        /// <returns></returns>
        public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName_B5A()
        {
            DataTable dt;
            string sql;
            sql = "SELECT  distinct 工位号 "
                    + " FROM MES_基本变量_原始数据 "
                    + " where 变量特点 = 8 and 是否启用 = 1 "
                    + " and (监控属性代码 = '" + 1 + "')";
            DataAccess.ExecuteDataTable(sql, out dt);
            return dt;
        }

        /// <summary>
        /// 测量合格标志
        /// 全部测量数据的测量工位的数据来源
        /// </summary>
        /// <returns></returns>
        public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName)
        {
            DataTable dt;
            string sql;
            sql = "SELECT  TagID,工位号,数据来源 "
                    + " FROM MES_基本变量_原始数据 "
                    + " where OpcServer_OPNAME = '1'  and 是否启用 = 1 "
                    + " and 工位号='" + opName+"'"
                    + " and (监控属性代码 = '" + 1 + "')";
            DataAccess.ExecuteDataTable(sql, out dt);
            return dt;
        }

        /// <summary>
        /// 测量合格标志
        /// 全部测量数据的测量工位的数据来源的测量变量
        /// </summary>
        /// <returns></returns>
        public static DataTable BaseData_tagTable_QualityData_GoodBad_MIS_OpName(string opName,string opNameFrom)
        {
            DataTable dt;
            string sql;
            sql = "SELECT  TagID "
                    + " FROM MES_基本变量_原始数据 "
                    + " where OpcServer_OPNAME = '2'  and 是否启用 = 1 "
                    + " and 工位号='" + opName + "'"
                    + " and 数据来源='" + opNameFrom + "'"
                    + " and (监控属性代码 = '" + 1 + "')";
            DataAccess.ExecuteDataTable(sql, out dt);
            return dt;
        }
        
    }
}
