using System;
using System.Data;
using Core.Mes.ServerFrameWork;
using Core.Mes.IBaseInterface;
using System.Collections;

namespace Core.XgMes.Server.JGKC.RollManager
{
	/// <summary>
	/// Query_YL 的摘要说明。
	/// </summary>
	public class Query_YL : Core.Mes.ServerFrameWork.IComponent
	{
		public Query_YL()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public override int maxValue
		{
			get
			{
				return 100;
			}
		}
		public override int minValue
		{
			get
			{
				return 50;
			}
		}

		public ReturnObject BuressQuery(string _Where,string _Type)
		{
			try
			{
				string strOut="";
				string strSql="SELECT A.CREATOR,TO_CHAR( A.CREATETIME,'YYYY-MM-DD HH24:MI:SS')CREATETIME,"+
							  "A.OLD_SAMPL_NO,A.NOW_BUTTRESS,A.OLD_BUTTRESS,"+
                              "B.NAME_ CLASSORDER,C.NAME_ CLASSTEAM,"+
                              "A.HANDLEMAN,A.HANDLEMODE,TO_CHAR( A.CREATETIME,'YYYY-MM-DD HH24:MI:SS')TIMENAME,"+
							  "A.REMARK FROM {0},SCM_BASE_INFO B ,SCM_BASE_INFO C "+
				              "WHERE A.CLASSORDER=B.ID_ AND A.CLASSTEAM=C.ID_"+_Where;
               
				switch(_Type)
				{
					case "YL":
						strSql=string.Format(strSql,new string[]{" KCJ3_STUFFMOVEBUTTRESSLIST_ZW A "});
						break;
					case "CP":
                        strSql = string.Format(strSql, new string[] { "KCJ3_TURNOFFMOVEBUTTRESSLIST_Z A" });
						break;
				}
				System.Data.DataSet ds = this.DBManager.ExecuteQuery(strSql,out strOut);
				if(ds!=null && ds.Tables.Count==1 && ds.Tables[0].Rows.Count>0)
				{
					ds.Tables[0].TableName = "KCJ_MOVEBUTTRESSLIST";
					return new ReturnObject(ds);
				}
				else
				{
					return new ReturnObject(null);
				}

			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,ex.ToString());
			}
		}
	}
}
