using System.Data;
using System.Data.SqlClient;
using DataLinkMesWork;
using System.Security.Cryptography;
//using SystemFramework;
using System.Text;

namespace bizFacade
{
    public class ando_load
    {
        /// <summary>
        /// 查询ando类型andoTypeSelect
        /// </summary>
        /// <returns></returns>
        public static bool andoTypeSelect(out DataTable dt)
        {
            string procedureName = "ANDON_类型_查询";
            return DataAccess.ExecuteStoredProcedure(procedureName, out dt);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public static bool andoDetailCount(out DataTable dt)
        {
            string procedureName = "ANDON_类型_查询";
            return DataAccess.ExecuteStoredProcedure(procedureName, out dt);
        }
        /// <summary>
        /// 初始化ando界面
        /// </summary>
        public static string ando_loading(string opname)
        { 
            System.Data.DataTable dt;
            dt=null;
            andoTypeSelect(out dt);
            string responsetext="";
            StringBuilder sb = new StringBuilder();

            for(int i=0;i<dt.Rows.Count;i++)
            {
                string andoTypeCode = dt.Rows[i]["安东类型代码"].ToString();
                switch (andoTypeCode)
                {
                    case "1":
                        responsetext = ando_matertial.CreateAndo_Material(opname, "1");
                        sb.Append(responsetext);
                        break;
                    case "2":
                        responsetext = ando_quality.CreateAndo_quality(opname, "2");
                        sb.Append(responsetext);
                        break;
                    case "3":
                        responsetext = ando_machine.CreateAndo_Machine(opname, "3");
                        sb.Append(responsetext);
                        break;
                    case "4":
                        //sb.Append(responsetext);
                        break;
                }
            }
            return sb.ToString();;
        }
    }
}
