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>
        /// MES_基本变量_DB数据结构_查询
        /// </summary>
        public static DataTable MobyDataStructureSelect()
        {
            DataTable dt;
            string sql;
            sql = "SELECT * FROM MES_基本变量_DB数据结构 ORDER BY [序号] ";
            DataAccess.ExecuteDataTable(sql, out  dt);
            return dt;
        }

        /// <summary>
        /// MES_模拟MOBY数据_增加
        /// 增加一台发动机
        /// 返回该台发动机数据
        /// </summary>
        public static DataTable MobyInsert()
        {
            DataTable dt;
            string procedureName;
            procedureName = "MES_模拟MOBY数据_增加";
            DataAccess.ExecuteStoredProcedure(procedureName, out  dt);
            return dt;
        }

        /// <summary>
        /// MES_模拟MOBY数据_查询
        /// </summary>
        /// <param name="engineNumber">发动机号</param>
        /// <returns></returns>
        public static DataTable MobySelect(string engineNumber)
        {
            DataTable dt;
            string procedureName;
            procedureName = "MES_模拟MOBY数据_查询";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号", engineNumber);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out  dt);
            return dt;
        }

        /// <summary>
        /// MES_模拟MOBY数据_查询
        /// </summary>
        /// <param name="engineNumber">发动机号</param>
        /// <param name="number"></param>
        /// <param name="tagValue"></param>
        /// <returns></returns>
        public static void MobyUpdate(string engineNumber, int number, string tagValue)
        {
            string procedureName;
            procedureName = "MES_模拟MOBY数据_查询";
            SqlParameter[] thisParms = new SqlParameter[3];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号", engineNumber);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@序号", engineNumber);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@数值", engineNumber);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
            return;
        }
        /// <summary>
        /// MES_模拟MOBY数据_修改
        /// 序号 =27 ，工位代码
        /// </summary>
        /// <param name="engineNumber">发动机号</param>
        /// <param name="tagValue"></param>
        /// <returns></returns>
        public static void MobyUpdate(string engineNumber, string tagValue)
        {
            int number;

            number = 27;

            string procedureName;
            procedureName = "MES_模拟MOBY数据_修改";
            SqlParameter[] thisParms = new SqlParameter[3];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号", engineNumber);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@序号", number);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@数值", tagValue);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
            return;
        }
    }
}
