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 BaseDataSystemMES
    {
        /// <summary>
        /// 电子看板_工作时间与班次_删除
        /// </summary>
        /// <param name="shiftNO">序号</param>
        static public bool WorkShift_Delete(int shiftNO)
        {
            string procedureName;
            procedureName = "电子看板_工作时间与班次_删除";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", shiftNO);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// 电子看板_工作时间与班次_修改
        /// </summary>
        /// <param name="shiftNO">序号</param>
        /// <param name="shiftStartTime">开始工作时间</param>
        /// <param name="shiftEndTime">结束工作时间</param>
        /// <param name="shiftWorkNo">班次代码</param>
        /// <param name="shiftIsWork">是否工作</param>
        static public bool WorkShift_Update(int shiftNO,string shiftStartTime,
            string shiftEndTime, int shiftWorkNo, int shiftIsWork)
        {
            string procedureName;
            procedureName = "电子看板_工作时间与班次_修改";
            SqlParameter[] thisParms = new SqlParameter[5];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", shiftNO);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@开始工作时间", shiftStartTime);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@结束工作时间", shiftEndTime);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@班次代码", shiftWorkNo);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@是否工作", shiftIsWork);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// 电子看板_工作时间与班次_增加
        /// </summary>
        /// <param name="shiftNO">序号</param>
        /// <param name="shiftStartTime">开始工作时间</param>
        /// <param name="shiftEndTime">结束工作时间</param>
        /// <param name="shiftWorkNo">班次代码</param>
        /// <param name="shiftIsWork">是否工作</param>
        static public bool WorkShift_Insert(int shiftNO, string shiftStartTime,
            string shiftEndTime, int shiftWorkNo, int shiftIsWork)
        {
            string procedureName;
            procedureName = "电子看板_工作时间与班次_增加";
            SqlParameter[] thisParms = new SqlParameter[5];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", shiftNO);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@开始工作时间", shiftStartTime);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@结束工作时间", shiftEndTime);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@班次代码", shiftWorkNo);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@是否工作", shiftIsWork);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// 电子看板_工作时间与班次_查询
        /// </summary>
        /// <param name="dt"></param>
        static public void WorkShift_Select(out DataTable dt)
        {
            string sql;
            sql = " exec 电子看板_工作时间与班次_查询";
            DataAccess.ExecuteDataTable(sql, out  dt);
        }
        /// <summary>
        /// MES_基本变量_基本机型_增加
        /// @基本机型 nvarchar(50),
        /// @机型代码 int
        /// </summary>
        static public bool EngineBasicType_Insert(string engineBasicType,
            int engineBasicTypeID, double maxWeight, double minWeight, double Vp, double tm)
        {
            string procedureName;
            procedureName = "MES_基本变量_基本机型_增加";
            SqlParameter[] thisParms = new SqlParameter[6];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@基本机型", engineBasicType);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@机型代码", engineBasicTypeID);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@重量差上限", maxWeight);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@重量差下限", minWeight);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@Vp", Vp);
            thisParms[5] = new System.Data.SqlClient.SqlParameter("@tm", tm);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// MES_基本变量_基本机型_修改
        /// @序号 int,
        /// @基本机型 nvarchar(50),
        /// @机型代码 int
        /// </summary>
        static public bool EngineBasicType_Update(int sn,string engineBasicType,
            int engineBasicTypeID, double maxWeight, double minWeight, double Vp, double tm)
        {
            string procedureName;
            procedureName = "MES_基本变量_基本机型_修改";
            SqlParameter[] thisParms = new SqlParameter[7];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", sn);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@基本机型", engineBasicType);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@机型代码", engineBasicTypeID);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@重量差上限", maxWeight);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@重量差下限", minWeight);
            thisParms[5] = new System.Data.SqlClient.SqlParameter("@Vp", Vp);
            thisParms[6] = new System.Data.SqlClient.SqlParameter("@tm", tm);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// MES_基本变量_基本机型_删除
        /// @序号 int
        /// </summary>
        static public bool EngineBasicType_Delete(int sn)
        {
            string procedureName;
            procedureName = "MES_基本变量_基本机型_删除";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", sn);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// MES_基本变量_机型代码_增加
        /// @发动机型号 nvarchar(50), 
        /// @发动机机型标志 int,
        /// @条码类型 int ,
        /// @流水号类型 int,
        /// @工厂编号 nvarchar(50),
        /// @装配线班组号 nvarchar(50),
        /// @壳体编号型号 nvarchar(50),
        /// @壳体编号型号带空格 nvarchar(50),
        /// @QR码读数标志 nvarchar(50),
        /// @QR码产品型号 nvarchar(50) 
        /// </summary>
        /// <param name="engineType">发动机型号</param>
        /// <param name="engineTypeID">发动机机型标志</param>
        /// <param name="barCodeID">条码类型</param>
        /// <param name="snNumberID">流水号类型</param>
        /// <param name="factoryID">工厂编号</param>
        /// <param name="shiftID">装配线班组号</param>
        /// <param name="shellCode">壳体编号型号</param>
        /// <param name="shellCode_Space">壳体编号型号带空格</param>
        /// <param name="QR_Code">QR码读数标志</param>
        /// <param name="QR_Type">QR码产品型号</param>
        /// <returns></returns>
        static public bool EngineType_Insert(string engineType, int engineTypeID,
            int barCodeID,int snNumberID,string factoryID,string shiftID,
            string shellCode, string shellCode_Space, string QR_Code, string QR_Type, string shellCode_downline)
        {
            string procedureName;
            procedureName = "MES_基本变量_机型代码_增加_new";
            SqlParameter[] thisParms = new SqlParameter[11];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@发动机型号", engineType);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机机型标志", engineTypeID);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@条码类型", barCodeID);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@流水号类型", snNumberID);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@工厂编号", factoryID);
            thisParms[5] = new System.Data.SqlClient.SqlParameter("@装配线班组号", shiftID);
            thisParms[6] = new System.Data.SqlClient.SqlParameter("@壳体编号型号", shellCode);
            thisParms[7] = new System.Data.SqlClient.SqlParameter("@壳体编号型号带空格", shellCode_Space);
            thisParms[8] = new System.Data.SqlClient.SqlParameter("@QR码读数标志", QR_Code);
            thisParms[9] = new System.Data.SqlClient.SqlParameter("@QR码产品型号", QR_Type);
            thisParms[10] = new System.Data.SqlClient.SqlParameter("@壳体编号型号条码", shellCode_downline);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// MES_基本变量_机型代码_修改
        /// @序号 int, 
        /// @发动机型号 nvarchar(50), 
        /// @发动机机型标志 int,
        /// @条码类型 int ,
        /// @流水号类型 int,
        /// @工厂编号 nvarchar(50),
        /// @装配线班组号 nvarchar(50),
        /// @壳体编号型号 nvarchar(50),
        /// @壳体编号型号带空格 nvarchar(50),
        /// @QR码读数标志 nvarchar(50),
        /// @QR码产品型号 nvarchar(50) 
        /// </summary>
        /// <param name="sn">序号</param>
        /// <param name="engineType">发动机型号</param>
        /// <param name="engineBasicTypeID">发动机机型标志</param>
        /// <param name="barCodeID">条码类型</param>
        /// <param name="snNumberID">流水号类型</param>
        /// <param name="factoryID">工厂编号</param>
        /// <param name="shiftID">装配线班组号</param>
        /// <param name="shellCode">壳体编号型号</param>
        /// <param name="shellCode_Space">壳体编号型号带空格</param>
        /// <param name="QR_Code">QR码读数标志</param>
        /// <param name="QR_Type">QR码产品型号</param>
        /// <returns></returns>
        static public bool EngineType_Update(int sn,string engineType, int engineBasicTypeID,
            int barCodeID, int snNumberID, string factoryID, string shiftID,
            string shellCode, string shellCode_Space, string QR_Code, string QR_Type,string  shellCode_downline)
        {
            string procedureName;
            procedureName = "MES_基本变量_机型代码_修改_new";
            SqlParameter[] thisParms = new SqlParameter[12];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", sn);
            thisParms[1] = new System.Data.SqlClient.SqlParameter("@发动机型号", engineType);
            thisParms[2] = new System.Data.SqlClient.SqlParameter("@发动机机型标志", engineBasicTypeID);
            thisParms[3] = new System.Data.SqlClient.SqlParameter("@条码类型", barCodeID);
            thisParms[4] = new System.Data.SqlClient.SqlParameter("@流水号类型", snNumberID);
            thisParms[5] = new System.Data.SqlClient.SqlParameter("@工厂编号", factoryID);
            thisParms[6] = new System.Data.SqlClient.SqlParameter("@装配线班组号", shiftID);
            thisParms[7] = new System.Data.SqlClient.SqlParameter("@壳体编号型号", shellCode);
            thisParms[8] = new System.Data.SqlClient.SqlParameter("@壳体编号型号带空格", shellCode_Space);
            thisParms[9] = new System.Data.SqlClient.SqlParameter("@QR码读数标志", QR_Code);
            thisParms[10] = new System.Data.SqlClient.SqlParameter("@QR码产品型号", QR_Type);
            thisParms[11] = new System.Data.SqlClient.SqlParameter("@壳体编号型号条码", shellCode_downline);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
        /// <summary>
        /// MES_基本变量_机型代码_删除
        /// @序号 int, 
        /// </summary>
        /// <param name="sn">序号</param>
        /// <returns></returns>
        static public bool EngineType_Delete(int sn)
        {
            string procedureName;
            procedureName = "MES_基本变量_机型代码_删除";
            SqlParameter[] thisParms = new SqlParameter[1];
            thisParms[0] = new System.Data.SqlClient.SqlParameter("@序号", sn);
            return DataAccess.ExecuteStoredProcedure(procedureName, ref thisParms);
        }
    }
}
