using System;
using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;
using System.Collections;
using System.Collections.Specialized;
//using SystemFramework;

namespace bizFacade
{
    /// <summary>
    /// 电子看板信息系统
    /// </summary>
    public partial class  ShaftPosition
    {
        /// <summary>
        /// 测量数据合格_电子看板_质量数据_临时表_增加_返修工位
        /// @EngineID nvarchar(50)=null,
        /// @EngineType nvarchar(50)=null,
        /// @EngineTypeID int = null,
        /// @工位号 nvarchar(50)=null,
        /// @工位号返修工位 nvarchar(50)=null,
        /// @订单号 nvarchar(50)=null,
        /// @合格标志 int
        /// </summary>
        /// <param name="engineID">工件号</param>
        /// <param name="engineType">机型</param>
        /// <param name="engineTypeID">机型代码</param>
        /// <param name="opName">工位号（被返修的工位号）</param>
        /// <param name="opNameRepair">工位号返修工位</param>
        /// <param name="orderForm">订单号</param>
        /// <param name="isOK">合格标志</param>
        static public void ShaftPosition_Data_OpNameRepair_Insert(string engineID, string engineType, int engineTypeID, string opName, string opNameRepair,string orderForm, int isOK)
        {
            string procedureName;
            procedureName = "测量数据合格_电子看板_质量数据_临时表_增加_返修工位";
            SqlParameter[] thisParmsSql = new SqlParameter[7];
            thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
            thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
            thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID);
            thisParmsSql[3] = new SqlParameter("@工位号", opName);
            thisParmsSql[4] = new SqlParameter("@工位号返修工位", opNameRepair);
            thisParmsSql[5] = new SqlParameter("@订单号", orderForm);
            thisParmsSql[6] = new SqlParameter("@合格标志", isOK);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
        }
        /// <summary>
        /// 测量数据合格_电子看板_质量数据_临时表_增加
        /// @EngineID nvarchar(50)=null,
        /// @EngineType nvarchar(50)=null,
        /// @EngineTypeID int = null,
        /// @工位号 nvarchar(50)=null,
        /// @订单号 nvarchar(50)=null,
        /// @合格标志 int
        /// </summary>
        /// <param name="engineID">工件号</param>
        /// <param name="engineType">机型</param>
        /// <param name="engineTypeID">机型代码</param>
        /// <param name="opName">工位号</param>
        /// <param name="orderForm">订单号</param>
        /// <param name="isOK">合格标志</param>
        static public void ShaftPosition_Data_Insert(string engineID, string engineType, int engineTypeID, string opName, string orderForm, int isOK)
        {
            string procedureName;
            procedureName = "测量数据合格_电子看板_质量数据_临时表_增加";
            SqlParameter[] thisParmsSql = new SqlParameter[6];
            thisParmsSql[0] = new SqlParameter("@EngineID", engineID);
            thisParmsSql[1] = new SqlParameter("@EngineType", engineType);
            thisParmsSql[2] = new SqlParameter("@EngineTypeID", engineTypeID); 
            thisParmsSql[3] = new SqlParameter("@工位号", opName);
            thisParmsSql[4] = new SqlParameter("@订单号", orderForm);
            thisParmsSql[5] = new SqlParameter("@合格标志", isOK);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="opName"></param>
        /// <param name="shaftStep"></param>
        /// <param name="engineID"></param>
        /// <param name="engineType"></param>
        /// <param name="engineTypeID"></param>
        /// <param name="orderBy"></param>
        /// <param name="tagValue"></param>
        /// <param name="isOK"></param>
        static public void ShaftPosition_Data_Insert_RepairOpName(string opName, int shaftStep, string engineID, string engineType, int engineTypeID, int orderBy, string tagValue, int isOK)
        {
            string procedureName;
            procedureName = "电子看板_质量数据_临时表_增加_备用拧紧工位";
            SqlParameter[] thisParmsSql = new SqlParameter[8];
            thisParmsSql[0] = new SqlParameter("@工位号", opName);
            thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
            thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
            thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
            thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
            thisParmsSql[5] = new SqlParameter("@变量排序", orderBy);
            thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
            thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
        }
        /// <summary>
        /// 电子看板_质量数据_临时表_增加
        /// </summary>
        /// <param name="opName">工位号</param>
        /// <param name="shaftStep">序号</param>
        /// <param name="engineID">工件号</param>
        /// <param name="engineType">机型</param>
        /// <param name="engineTypeID">机型代码</param>
        /// <param name="tagID">变量代码</param>
        /// <param name="tagValue">变量值</param>
        /// <param name="isOK">合格标志</param>
        static public void ShaftPosition_Data_Insert(string opName,int shaftStep,  string engineID,string engineType, int engineTypeID, int tagID,string tagValue, int isOK)
        {
            string procedureName;
            procedureName = "电子看板_质量数据_临时表_增加";
            SqlParameter[] thisParmsSql = new SqlParameter[8];
            thisParmsSql[0] = new SqlParameter("@工位号", opName);
            thisParmsSql[1] = new SqlParameter("@序号", shaftStep);
            thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
            thisParmsSql[3] = new SqlParameter("@EngineType", engineType);
            thisParmsSql[4] = new SqlParameter("@EngineTypeID", engineTypeID);
            thisParmsSql[5] = new SqlParameter("@TagID", tagID);
            thisParmsSql[6] = new SqlParameter("@测量值", tagValue);
            thisParmsSql[7] = new SqlParameter("@合格标志", isOK);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
        }
        /// <summary>
        /// 电子看板_质量数据_临时表_增加 
        /// </summary>
        /// <param name="opName">工位号</param>
        /// <param name="shaftStep">序号</param>
        /// <param name="engineID">工件号</param>
        /// <param name="engineType">机型</param>
        /// <param name="engineTypeID">机型代码</param>
        /// <param name="tagID">变量代码</param>
        /// <param name="tagValue">变量值</param>
        /// <param name="isOK">合格标志</param>
        //static public void ShaftPosition_Data_Insert_Access(string opName, int shaftStep, string engineID, string engineType, 
        //    int engineTypeID, int tagID, string tagValue, int isOK)
        //{
        //    string sql;
        //    string sql_Delete;
        //    sql = "insert into 电子看板_质量数据_临时表(EngineID,EngineType,EngineTypeID,工位号,TagID,测量值,合格标志) ";
        //    sql = sql+" values(";
        //    sql = sql + "'" + engineID + "',";
        //    sql = sql + "'" + engineType + "',";
        //    sql = sql + "" + engineTypeID.ToString() + ",";
        //    sql = sql + "'" + opName + "',";
        //    sql = sql + "" + tagID.ToString() + ",";
        //    sql = sql + "'" + tagValue + "',";
        //    sql = sql + "" + isOK.ToString() + ")";

        //    sql_Delete = "delete from 电子看板_质量数据_临时表";
        //    sql_Delete = sql_Delete + " where tagID=" + tagID.ToString();
        //    DataAccess.ExecuteSQL_OleDb_Access(sql_Delete);
        //    DataAccess.ExecuteSQL_OleDb_Access(sql);
        //}
        /// <summary>
        /// 查询[电子看板_质量数据_临时表]数据
        /// </summary>
        /// <param name="opName">工位号</param>
        /// <param name="dt">合格标志</param>
        //static public void ShaftPosition_Data_Select_Access(string opName, out DataTable dt)
        //{
        //    string sql;
        //    sql = "select  EngineID,EngineType,EngineTypeID,工位号,TagID,测量值 as TagValue,合格标志 as IsGoodBad";
        //    sql=sql+" from 电子看板_质量数据_临时表 ";
        //    sql = sql+" where 工位号='"+opName+"'";
        //    DataAccess.ExecuteDataTable_OleDb_Access(sql, out dt);
        //}
        /// <summary>
        /// 删除[电子看板_质量数据_临时表]数据
        /// </summary>
        /// <param name="opName">工位号</param>
        //static public void ShaftPosition_Data_Delete_Access(string opName)
        //{
        //    string sql;
        //    sql = "delete from  电子看板_质量数据_临时表 ";
        //    sql = sql + " where 工位号='" + opName + "'";
        //    DataAccess.ExecuteSQL_OleDb_Access(sql);
        //}
        /// <summary>
        /// 电子看板_质量数据_临时表_删除    
        /// </summary>
        /// <param name="opName">工位号</param>
        /// <param name="shaftStep">列位置</param>
        /// <param name="engineID">EngineID</param>
        static public void ShaftPosition_Data_Delete(string opName, int shaftStep, string engineID)
        {
            string procedureName;
            procedureName = "电子看板_质量数据_临时表_删除";
            SqlParameter[] thisParmsSql = new SqlParameter[3];
            thisParmsSql[0] = new SqlParameter("@工位号", opName);
            thisParmsSql[1] = new SqlParameter("@列位置", shaftStep);
            thisParmsSql[2] = new SqlParameter("@EngineID", engineID);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParmsSql);
        }
    }
}
