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

namespace MesServerFunctions
{
    public class Db
    {
        /// <summary>
        /// 合力_转线_A92判断工件状态
        /// </summary>
        /// <param name="EngineTypeID"></param>
        /// <param name="EngineTypeID_QiaoKe"></param>
        /// <param name="EngineID"></param>
        /// <param name="OrderForm"></param>
        /// <param name="MatchResult"></param>
        /// <param name="MatchResultStr"></param>
        /// <returns></returns>
        public static bool OPA92_EngineGetOverCheckWorkType(string EngineID, out int MatchResult, out string MatchResultStr)
        {
            DataTable dt = new DataTable();
            MatchResult = 2;// 默认是报警 程序出错
            MatchResultStr = "默认是报警 程序出错";// 默认是报警 程序出错
            string produceName = "合力_转线_A92判断工件状态";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@轮毂总成号", EngineID);
            if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt))
            {
                if (dt.Rows.Count > 0)
                {
                    MatchResult = Convert.ToInt32(dt.Rows[0]["result"]);
                    MatchResultStr = dt.Rows[0]["msg"].ToString();
                    return true;
                }
            }
            return false;
        }

        /// <summary>
        /// 合力_转线_删除记录数据 同时保存 轮毂 桥壳 关系
        /// </summary>
        /// <param name="EngineID_QiaoKe"></param>
        public static void OPA92_DeleteLineData(string EngineID_QiaoKe,string EngineID_LunGu1,string EngineID_LunGu2)
        {
            DataTable dt = new DataTable();
            string produceName = "合力_转线_删除记录数据";
            SqlParameter[] thisParms = new SqlParameter[3];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@桥壳总成号", EngineID_QiaoKe);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@轮毂总成号1", EngineID_LunGu1);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@轮毂总成号2", EngineID_LunGu2);
            DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt);
        }
    }
}
