using System;
using System.Data;
using System.Data.SqlClient;

using System.Collections;
using System.Collections.Specialized;
//using SystemFramework;
using DataLinkMesWork;
namespace SystemFramework
{

}
namespace bizFacade
{
    /// <summary>
    /// 电子看板信息系统
    /// select 重量1,重量2,重量差,允许重量差,合格标志
    /// </summary>
    public partial class BaseDataSystemMES
    {
        
        /// <summary>
        /// 电子看板_发动机号_分线组件装配关系_增加
        /// </summary>
        /// <param name="engineID"></param>
        /// <param name="engineTypeID"></param>
        /// <param name="engineType"></param>
        /// <param name="engineID_SubLine"></param>
        static public void MailLineAndSubLineData_Insert(string engineID, int engineTypeID, string engineType, string engineID_SubLine)
        {
            string procedureName;
            procedureName = "电子看板_发动机号_分线组件装配关系_增加";
            SqlParameter[] thisParms = new SqlParameter[4];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机号_分线", engineID_SubLine);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@机型代码", engineTypeID);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@发动机型号", engineType);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// 电子看板_发动机号_线首工位_查询_根据发动机号
        /// select 工位号,订单号,发动机号,基本机型,机型代码,发动机型号,托盘号,
        /// 条码类型,零件流水号,零件流水号带空格,壳体编号型号,壳体编号型号带空格,QR码
        /// from dbo.电子看板_发动机号_线首工位
        /// where 发动机号=@发动机号 and 是否禁用=0
        /// </summary>
        /// <param name="opName"></param>
        /// <param name="engineID"></param>
        /// <param name="dt"></param>
        static public void GetEngineID_Select(string opName,string engineID, out DataTable dt)
        {
            string procedureName;
            procedureName = "电子看板_发动机号_线首工位_查询_根据发动机号";
            SqlParameter[] thisParms = new SqlParameter[2];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机号", engineID);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
        }

        /// <summary>
        /// 测量数据工位_监控系统_操作者工号_是否登录
        /// </summary>
        /// <param name="opName"></param>
        /// <param name="engineID"></param>
        /// <param name="dt"></param>
        static public void CheckUser_IsLogin(string opName, out DataTable dt)
        {
            string procedureName;
            procedureName = "测量数据工位_监控系统_操作者工号_是否登录";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
        }

        static public void SubLineLoadPartCountMatch_Update( string opName, int SubLineLoadPartCountMatch)
        {
            string procedureName;
            procedureName = "MES_计划BOM_工位与名称_工步属性修改";
            SqlParameter[] thisParms = new SqlParameter[2];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@工步属性", SubLineLoadPartCountMatch);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }


        static public void SubLineLoadPartCountMatch_Select(string opName, out int SubLineLoadPartCountMatch)
        {
            string procedureName;
            DataTable dt;
            procedureName = "MES_计划BOM_工位与名称_工步属性查询";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName);
            DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms, out dt);
            if(dt.Rows.Count>0)
            {
                SubLineLoadPartCountMatch = Convert.ToInt32(dt.Rows[0][0]);
            }
            else
            {
                SubLineLoadPartCountMatch = 0;
            }
        }

    }
}
