using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;
using System.Data.OleDb;
using System.Collections;

//using SystemFramework;

namespace bizFacade
{
    public partial class BaseDataSystemMES
    {
        ///// <summary>
        ///// 从Access配置表中读取程序配置信息
        ///// </summary>
        ///// <param name="opName"></param>
        //public static void InitConfig(string opName)
        //{
            
        //    DataTable dt;
        //    string sql;
        //    sql = " SELECT * FROM MES_计划BOM_工位与名称 WHERE 工位号='" + opName + "'";
        //    DataAccess.ExecuteDataTable_OleDb_Access(sql, out dt);
        //    if (dt == null) return;
        //    if (dt.Rows.Count < 1) return;
        //    try
        //    {
        //        //0032
        //        ApplicationConfig.ConnectionString_Access_OpNameMainLine = dt.Rows[0]["总线上线工位数据文件连接"].ToString();
        //    }
        //    catch { ApplicationConfig.ConnectionString_Access_OpNameMainLine = ""; }
        //    try
        //    {
        //        //0033
        //        ApplicationConfig.ConnectionString_Access_OpNameTraceCode = dt.Rows[0]["分线物料追踪工位数据文件连接"].ToString();
        //    }
        //    catch { ApplicationConfig.ConnectionString_Access_OpNameTraceCode = ""; }
        //    try
        //    {
        //        ApplicationConfig.OpNameGuid = dt.Rows[0]["指南工位号"].ToString();
        //    }
        //    catch { ApplicationConfig.OpNameGuid = ""; }
        //    //try
        //    //{
        //    //    //0051
        //    //    ApplicationConfig.OpNameOther = dt.Rows[0]["总线被监测工位"].ToString();
        //    //}
        //    //catch { ApplicationConfig.OpNameOther = ""; }
        //    try
        //    {
        //        //0052
        //        ApplicationConfig.OpNameMainLine = dt.Rows[0]["总线上线工位"].ToString();
        //    }
        //    catch { ApplicationConfig.OpNameMainLine = ""; }
        //    try
        //    {
        //        //0053
        //        ApplicationConfig.OpNameTraceCode = dt.Rows[0]["分线物料追踪工位"].ToString();
        //    }
        //    catch { ApplicationConfig.OpNameTraceCode = ""; }
        //    //try
        //    //{
        //    //    //0080
        //    //    ApplicationConfig.ScannerType = dt.Rows[0]["扫描枪类型"].ToString();
        //    //}
        //    //catch { ApplicationConfig.ScannerType = "0"; }
        //    try
        //    {
        //        //0081
        //        ApplicationConfig.MachineType = dt.Rows[0]["机床类型"].ToString();
        //    }
        //    catch { ApplicationConfig.MachineType = "S"; }
        //    try
        //    {
        //        //0090
        //        ApplicationConfig.OpType = dt.Rows[0]["工位类型"].ToString();
        //    }
        //    catch { ApplicationConfig.OpType = "P1"; }
        //    try
        //    {
        //        //0170
        //        ApplicationConfig.OpcServer = dt.Rows[0]["OpcServer"].ToString().Trim();
        //    }
        //    catch { ApplicationConfig.OpcServer = ""; }
        //    try
        //    {
        //        //0170
        //        ApplicationConfig.OpcServer_MIS = dt.Rows[0]["OpcServer_MIS"].ToString().Trim();
        //    }
        //    catch { ApplicationConfig.OpcServer_MIS = ""; }
        //    try
        //    {
        //        //0170
        //        ApplicationConfig.CycleTargetCycleTime = Convert.ToInt32(dt.Rows[0]["目标循环时间"]);
        //    }
        //    catch { ApplicationConfig.CycleTargetCycleTime = 0; }
        //    try
        //    {
        //        //0190
        //        ApplicationConfig.PartType = dt.Rows[0]["工件类型"].ToString();
        //    }
        //    catch { ApplicationConfig.PartType = ""; }
        //    try
        //    {
        //        //0190
        //        ApplicationConfig.Password = dt.Rows[0]["退出密码"].ToString();
        //    }
        //    catch { ApplicationConfig.Password = ""; } 
            
        //    try
        //    {
        //        //0190
        //        ApplicationConfig.LeaderCode = dt.Rows[0]["领班工号"].ToString();
        //    }
        //    catch { ApplicationConfig.LeaderCode = ""; } 
            
        //    if (ApplicationConfig.OpType == "F102")
        //    {
        //        sql = " SELECT * FROM MES_计划BOM_工位与名称 WHERE 工位号='" + ApplicationConfig.OpNameOther + "'";
        //        DataAccess.ExecuteDataTable_OleDb_Access(sql, out dt);
        //        if (dt != null)
        //        {
        //            if (dt.Rows.Count > 0)
        //            {
        //                try
        //                {
        //                    ApplicationConfig.OpcServerOther = dt.Rows[0]["OpcServer"].ToString();
        //                }
        //                catch { }
        //            }
        //        }
        //    }
        //}

        //private static void GetBarCodeCommand(out DataTable dt)
        //{
        //    string sql = " SELECT * FROM  [MES_基本数据_条码命令] ";
        //    DataAccess.ExecuteDataTable_OleDb_Access(sql, out dt);
        //}

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dt"></param>
        //public static void GetBarCodeCommand_RepareReason(out DataTable dt)
        //{
        //    string sql = " SELECT * FROM  [MES_基本数据_条码命令] WHERE 命令说明='返修原因'";
        //    DataAccess.ExecuteDataTable_OleDb_Access(sql, out dt);
        //}
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static Hashtable Get_hashtableBarCodeCommand()
        {
            DataTable dt = new DataTable();
            Hashtable hashtableBarCodeCommand;
            hashtableBarCodeCommand = new Hashtable();
            //GetBarCodeCommand(out  dt);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                hashtableBarCodeCommand.Add(dt.Rows[i]["命令条码"], dt.Rows[i]["命令代码"]);

            }

            return hashtableBarCodeCommand;



        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static Hashtable Get_hashtableBarCodeCommand_RepareReason()
        {
            DataTable dt = new DataTable ();
            Hashtable hashtableBarCodeCommand;
            hashtableBarCodeCommand = new Hashtable();
            //GetBarCodeCommand(out  dt);
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                hashtableBarCodeCommand.Add(dt.Rows[i]["命令代码"], dt.Rows[i]["命令功能"]);

            }

            return hashtableBarCodeCommand;



        }
    }
}
