using DataLinkMesWork1;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MisDataFunDll
{
    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="engineTypeID"></param>
        /// <param name="dt"></param>
        static public void ShaftPosition_Select_WorkingStep(string opName, int engineTypeID, out DataTable dt)
        {
            dt = null;

            string sql = "exec 电子看板_工位机型_质量数据测量位置_查询_工作顺序 '" + opName + "'," + engineTypeID.ToString();
            DataAccess.ExecuteDataTable(sql, out dt);
        }

        /// <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);
        }
    }
}
