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

namespace Core.XgMes.Server.JGKC.SteelPlateManager
{
	/// <summary>
	/// StuffRecevie 的摘要说明。
	/// </summary>
	public class StuffRecevie  : Core.Mes.ServerFrameWork.IComponent
	{
		public StuffRecevie()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		public override int maxValue
		{
			get
			{
				return 100;
			}
		}
		public override int minValue
		{
			get
			{
				return 50;
			}
		}

		/// <summary>
		/// 获取来料信息
		/// </summary>
		/// <param name="_Where">条件</param>
		/// <returns></returns>
		public ReturnObject GetSource(string _Where,string strName,string strlx)
		{
			string strOut = "";
            string sql = "";
            
                if (strlx == "1")
                {
                    sql = "SELECT * FROM (SELECT 'FALSE' FLAG,A.SERIALNUMBER BILLETID,'厚板线' PRODUCTLINE,A.ROLLNO ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERFORMNUMBER ORDERNO,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.WEIGHT THEORYWEIGHT,B.NAME_ FACEQUALITY, "

                     + "D.NAME_ DETERMINANTRESULT,A.STEELTYPE DETERMINANTCARDNUMBER,A.LISTNUMBER SOURCEID,A.PLANVEHICLEID,TO_CHAR(A.PICKSTORAGETIME,'YYYY-MM-DD') SENDTIME,G.NAME_ ATTESTATIONORGAN,A.ORDERBUYER,H.BUYERCODE BUYERNAME,H.PACTNO  "

                     + " FROM KCH_TURNOFFSENDLIST A," +
                     " SCM_BASE_INFO  B, " +
                     " SCM_BASE_INFO D," +
                     " SCM_BASE_INFO G,sel_pactdetail h  " +
                     " WHERE A.ISVALID='2'" +
                     " AND A.FACEQUALITY=B.ID_(+)" +
                     " AND A. DETERMINANTRESULT=D.ID_(+)" +
                     " AND H.CHECKORG =G.ID_(+)  and a.ORDERFORMNUMBER = h.ORDERNO(+) " +
                      _Where +
                      " UNION ALL  "
                      +" SELECT 'FALSE' FLAG,A.SERIALNUMBER BILLETID,'板加' PRODUCTLINE,A.ROLLNO ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERFORMNUMBER ORDERNO,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.WEIGHT THEORYWEIGHT,B.NAME_ FACEQUALITY, "

                     + "D.NAME_ DETERMINANTRESULT,A.STEELTYPE DETERMINANTCARDNUMBER,A.LISTNUMBER SOURCEID,A.PLANVEHICLEID,TO_CHAR(A.PICKSTORAGETIME,'YYYY-MM-DD') SENDTIME,G.NAME_ ATTESTATIONORGAN,A.ORDERBUYER,H.BUYERCODE BUYERNAME,H.PACTNO "

                     + " FROM KCJ_TURNOFFSENDLIST A," +
                     " SCM_BASE_INFO  B, " +
                     " SCM_BASE_INFO D," +
                     " SCM_BASE_INFO G,sel_pactdetail h  " +
                     " WHERE A.ISVALID='2'" +
                     " AND A.FACEQUALITY=B.ID_(+)" +
                     " AND A. DETERMINANTRESULT=D.ID_(+)" +
                     " AND H.CHECKORG =G.ID_(+)  and a.ORDERFORMNUMBER = h.ORDERNO(+) " +
                      _Where
                      +"UNION ALL "
                      + "SELECT 'FALSE' FLAG,A.SERIALNUMBER BILLETID,'中板线' PRODUCTLINE,A.ROLLNO ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERFORMNUMBER ORDERNO,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.WEIGHT THEORYWEIGHT,B.NAME_ FACEQUALITY,"

                     + "D.NAME_ DETERMINANTRESULT,A.STEELTYPE DETERMINANTCARDNUMBER,A.LISTNUMBER SOURCEID,A.PLANVEHICLEID,TO_CHAR(A.PICKSTORAGETIME,'YYYY-MM-DD') SENDTIME,G.NAME_ ATTESTATIONORGAN,A.ORDERBUYER,H.BUYERCODE BUYERNAME,H.PACTNO  "

                     + " FROM KCZ_TURNOFFSENDLIST A," +
                     " SCM_BASE_INFO  B, " +
                     " SCM_BASE_INFO D," +
                     " SCM_BASE_INFO G,sel_pactdetail h  " +
                     " WHERE A.ISVALID='2'" +
                     " AND A.FACEQUALITY=B.ID_(+)" +
                     " AND A. DETERMINANTRESULT=D.ID_(+)" +
                     " AND H.CHECKORG =G.ID_(+)  and a.ORDERFORMNUMBER = h.ORDERNO(+) " +
                      _Where+" )"

                     + " ORDER BY BILLETID ASC  ";
                }
           
                else
                {
                    sql = "SELECT * FROM (SELECT 'FALSE' FLAG,A.SERIALNUMBER BILLETID,CASE WHEN SUBSTR(A.SERIALNUMBER,1,1)='E' THEN '二线厂' WHEN SUBSTR(A.SERIALNUMBER,1,1)='Y' THEN '高棒厂' WHEN SUBSTR(A.SERIALNUMBER,1,1)='B' THEN '普棒厂' END PRODUCTLINE,A.ROLLNO ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERFORMNUMBER ORDERNO,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.WEIGHT THEORYWEIGHT,B.NAME_ FACEQUALITY,"

                     + "D.NAME_ DETERMINANTRESULT,A.STEELTYPE DETERMINANTCARDNUMBER,A.LISTNUMBER SOURCEID,A.PLANVEHICLEID,TO_CHAR(A.PICKSTORAGETIME,'YYYY-MM-DD') SENDTIME,G.NAME_ ATTESTATIONORGAN,'' ORDERBUYER,H.BUYERCODE BUYERNAME,H.PACTNO  "

                     + " FROM KCX_TURNOFFSENDLIST A," +
                     " SCM_BASE_INFO  B, " +
                     " SCM_BASE_INFO D," +
                     " SCM_BASE_INFO G,sel_pactdetail h  " +
                     " WHERE A.ISVALID='2'" +
                     " AND A.FACEQUALITY=B.ID_(+)" +
                     " AND A. DETERMINANTRESULT=D.ID_(+)" +
                     "  AND H.CHECKORG =G.ID_(+)  and a.ORDERFORMNUMBER = h.ORDERNO(+) " +
                        _Where +
                     " UNION ALL "
                     +  "SELECT 'FALSE' FLAG,A.SERIALNUMBER BILLETID,CASE WHEN SUBSTR(A.SERIALNUMBER,1,1)='E' THEN '二线厂' WHEN SUBSTR(A.SERIALNUMBER,1,1)='Y' THEN '高棒厂' WHEN SUBSTR(A.SERIALNUMBER,1,1)='B' THEN '普棒厂' END PRODUCTLINE,A.ROLLNO ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERFORMNUMBER ORDERNO,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.WEIGHT THEORYWEIGHT,B.NAME_ FACEQUALITY,"

                     + "D.NAME_ DETERMINANTRESULT,A.STEELTYPE DETERMINANTCARDNUMBER,A.LISTNUMBER SOURCEID,A.PLANVEHICLEID,TO_CHAR(A.PICKSTORAGETIME,'YYYY-MM-DD') SENDTIME,G.NAME_ ATTESTATIONORGAN,'' ORDERBUYER ,H.BUYERCODE BUYERNAME,H.PACTNO "

                     + " FROM KCJ_TURNOFFSENDLIST A," +
                     " SCM_BASE_INFO  B, " +
                     " SCM_BASE_INFO D," +
                     " SCM_BASE_INFO G,sel_pactdetail h  " +
                     " WHERE A.ISVALID='2'" +
                     " AND A.FACEQUALITY=B.ID_(+)" +
                     " AND A. DETERMINANTRESULT=D.ID_(+)" +
                     "  AND H.CHECKORG =G.ID_(+)  and a.ORDERFORMNUMBER = h.ORDERNO(+) " +
                        _Where

                       + " )ORDER BY BILLETID ASC  ";
                }
            
           
            
			try
			{
			
				DataSet ds = this.DBManager.ExecuteQuery(sql,out strOut);
				ds.Tables[0].TableName = "KCJ_SOURCE";
				return new ReturnObject(ds,strOut);
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,ex.ToString());
			}

		}


        /// <summary>
        /// 获取已导入来料信息
        /// </summary>
        /// <param name="_Where">条件</param>
        /// <returns></returns>
        public ReturnObject GetSourceImport(string strlx)
        {
            string strOut = "";
            string sql = "SELECT 'FALSE' FLAG,A.BILLETID,CASE WHEN SUBSTR(A.BILLETID,1,1)='H'THEN '厚板线' WHEN SUBSTR(A.BILLETID,1,1)='Z'THEN '中板线' WHEN SUBSTR(A.BILLETID,1,1)='B'THEN '棒材线' WHEN SUBSTR(A.BILLETID,1,1)='E'THEN '二线厂' WHEN SUBSTR(A.BILLETID,1,1)='Y'THEN '高棒厂' END PRODUCTLINE,A.ROLLNUMBER,A.STOVENO,A.PLANNO,A.ORDERNO,"
                         + "TO_NUMBER(A.PLY)PLY,TO_NUMBER(A.WIDTH)WIDTH,TO_NUMBER(A.LENGTH)LENGTH,TO_NUMBER(A.THEORYWEIGHT)THEORYWEIGHT,B.NAME_ FACEQUALITY, "
                         + "D.NAME_ DETERMINANTRESULT,A.DETERMINANTCARDNUMBER,A.SOURCEID,A.PLANVEHICLEID,TO_CHAR(SYSDATE,'YYYY-MM-DD') SENDTIME,''ATTESTATIONORGAN,''ORDERBUYER,BUYERNAME,PACTNO "
                         + "FROM KCJ_ZWIMPORT A,SCM_BASE_INFO  B,SCM_BASE_INFO D WHERE  A.FACEQUALITY=B.ID_(+) AND A. DETERMINANTRESULT=D.ID_(+)  ";
            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                ds.Tables[0].TableName = "KCJ_SOURCE";
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }


        /// <summary>
        /// 获取订单分配信息
        /// </summary>
        /// <param name="_Where">条件</param>
        /// <returns></returns>
        public ReturnObject GetOrderNoAllicat(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "SELECT BILLETID，ORDERNO，RECODER，TIME_ FROM KCH_STEEL_CHAGE"

                 
                  + _Where
                  + " AND STLYE='订单分配' AND Old_Steel='pszx'"
                  + " ORDER BY BILLETID ASC  ";
          

            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        /// <summary>
        /// 获取判定记录信息
        /// </summary>
        /// <param name="_Where">条件</param>
        /// <returns></returns>
        public ReturnObject GetJudgeRecoder(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "SELECT BILLETID,codes2names(PDJG)PDJG,PDR,TIME_,STEELNAME FROM ( "
                + "SELECT SLABNO BILLETID,JUDGERESULT PDJG,RECORDER PDR,RECORDTIME TIME_,STEELNAME FROM ZJZ_COLL_JUDGE WHERE SLABNO LIKE 'Z%' "
                + "UNION  "
                + "SELECT P_MB_CB_ID BILLETID,COLLRESULT PDJG,JUDGER PDR,JUDGETIME TIME_ ,JUDGESTEELNAME STEELNAME FROM ZJH_COLL_JUDGE WHERE P_MB_CB_ID LIKE 'H%') "


                  + _Where

                  + " ORDER BY BILLETID ASC  ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }





        public ReturnObject GetYLButress(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "select B.BUTTRESS,SUBSTR(a.orderno,1,LENGTH(A.ORDERNO)-3)ORDERNO,COUNT(A.BILLETID)NUMBER1,SUM(A.THEORYWEIGHT)WEIGHT from KCP_STORAGELIST A,KCJ_STORAGEBUTTRESSLIST B  WHERE A.BILLETID=B.BILLETID AND A.STORAGESTATUS='501002' "



                  + _Where

                  + " GROUP BY B.BUTTRESS,SUBSTR(a.orderno,1,LENGTH(A.ORDERNO)-3) ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        public ReturnObject GetYLButress_Detail(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "SELECT B.BUTTRESS, A.BILLETID,A.THEORYWEIGHT,A.DETERMINANTCARDNUMBER,A.PLY,A.WIDTH,A.LENGTH,A.ORDERNO,C.NAME_ DETERMINANTRESULT,D.NAME_ PRODUCT_NAME "
                  + "  FROM KCP_STORAGELIST A, KCJ_STORAGEBUTTRESSLIST B,SCM_BASE_INFO C ,SCM_BASE_INFO D  "
                  + " WHERE A.BILLETID = B.BILLETID AND A.DETERMINANTRESULT=C.ID_(+) AND A.PRODUCT_NAME=D.ID_(+) "
                  + " AND A.STORAGESTATUS = '501002' "



                  + _Where

                  + " ORDER BY A.BILLETID ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        public ReturnObject GetCPButress_Detail(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "SELECT B.BUTTRESS, A.BILLETID,A.THEORYWEIGHT,A.DETERMINANTCARDNUMBER,A.PLY,A.WIDTH,A.LENGTH,A.ORDERNO,C.NAME_ DETERMINANTRESULT,D.NAME_ PRODUCT_NAME "
                  + "  FROM KCJ_TURNOFFLIST A, KCJ_TURNOFFBUTTRESSLIST B,SCM_BASE_INFO C ,SCM_BASE_INFO D  "
                  + " WHERE A.BILLETID = B.BILLETID AND A.DETERMINANTRESULT=C.ID_(+) AND A.PRODUCT_NAME=D.ID_(+) "
                  + " AND A.STORAGESTATUS = '501602' "



                  + _Where

                  + " ORDER BY A.BILLETID ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        public ReturnObject GetCPButress(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "select B.BUTTRESS,SUBSTR(a.orderno,1,LENGTH(A.ORDERNO)-3)ORDERNO,COUNT(A.BILLETID)NUMBER1,SUM(A.THEORYWEIGHT)WEIGHT from KCJ_TURNOFFLIST A,KCJ_TURNOFFBUTTRESSLIST B  WHERE A.BILLETID=B.BILLETID AND A.STORAGESTATUS='501602' "
 



                  + _Where

                  + " GROUP BY B.BUTTRESS,SUBSTR(a.orderno,1,LENGTH(A.ORDERNO)-3) ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        public ReturnObject GetYLButress_XB(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "select B.BUTTRESS,A.PLY,A.LENGTH,COUNT(A.BILLETID)NUMBER1,SUM(A.THEORYWEIGHT)WEIGHT from KCP_STORAGELIST A,KCJ_STORAGEBUTTRESSLIST B  WHERE A.BILLETID=B.BILLETID AND A.STORAGESTATUS='501002' "



                  + _Where

                  + " GROUP BY B.BUTTRESS,A.PLY,A.LENGTH ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
        public ReturnObject GetCPButress_XB(string _Where)
        {
            string strOut = "";
            string sql = "";


            sql = "select B.BUTTRESS,A.PLY,A.LENGTH,COUNT(A.BILLETID)NUMBER1,SUM(A.THEORYWEIGHT)WEIGHT from KCJ_TURNOFFLIST A,KCJ_TURNOFFBUTTRESSLIST B  WHERE A.BILLETID=B.BILLETID AND A.STORAGESTATUS='501602' "




                  + _Where

                  + " GROUP BY B.BUTTRESS,A.PLY,A.LENGTH ";


            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }

        }
		/// <summary>
		/// 获取原料入库信息
		/// </summary>
		/// <param name=" _Where">条件</param>
		/// <returns></returns>
		public ReturnObject GetInStorage(string _Where)
		{
			string strOut = "";
            string sql = "";

             sql = "SELECT A.BILLETID ,(SELECT NAME_ FROM SCM_BASE_INFO F WHERE A.PRODUCTLINE = F.ID_)PRODUCTLINE,A.ROLLNUMBER,A.MOTHERBOARDNUMBER,A.STOVENO,A.PLANNO,A.ORDERNO,A.YPLANNO,A.YORDERNO,J.NAME_ ATTESTATIONORGAN,"

                + "A.PLY,A.WIDTH,A.LENGTH,A.THEORYWEIGHT,(SELECT NAME_ FROM SCM_BASE_INFO B WHERE A.FACEQUALITY = B.ID_)FACEQUALITY,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE A.BUGREASON = C.ID_)BUGREASON,A.DETERMINANTCARDNUMBER,(SELECT NAME_ FROM SCM_BASE_INFO D WHERE A.CLIPTYPEPROCESS = D.ID_)CLIPTYPEPROCESS, TO_CHAR(m.sendbegindate, 'YYYY-MM-DD') SENDBEGINDATE,"

                + " (SELECT NAME_ FROM SCM_BASE_INFO E WHERE A.DETERMINANTRESULT = E.ID_)DETERMINANTRESULT,A.SOURCEID,TO_CHAR(A.INTIME,'YYYY-MM-DD HH24:MI:SS') INTIME,A.CONDOLENUMBER,"

                + " A.CHECKOPERATOR,A.IN_MAN,(SELECT NAME_ FROM SCM_BASE_INFO G WHERE A.INCLASSORDER = G.ID_)INCLASSORDER,(SELECT NAME_ FROM SCM_BASE_INFO H WHERE A.INCLASSTEAM = H.ID_)INCLASSTEAM, I.BUTTRESS,A.REMARK,A.ORDERBUYER,a.BUYERNAME,a.PACTNO  "

                + "FROM  KCJ_STORAGELIST_ZW A, sel_pactdetail          m ,SCM_BASE_INFO           J ,KCJ_STORAGEBUTTRESSLIST_ZW I "

                + "WHERE  a.orderno = m.orderno(+) AND A.BILLETID = I.BILLETID(+) AND A.STORAGESTATUS = '501002' AND A.ISVALID = '1' AND M.CHECKORG = J.ID_(+) "

                + "  "

                + " "
				
				+_Where

				+" ORDER BY A.INTIME DESC";
            
			try
			{
			
				DataSet ds = this.DBManager.ExecuteQuery(sql,out strOut);
				ds.Tables[0].TableName = "KCJ_STORAGELIST";
				return new ReturnObject(ds,strOut);
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,"数据库连接错");
			}

        }
        #region "获取配送中心原料入库"
        /// <summary>
        /// 获取原料入库信息
        /// </summary>
        /// <param name=" _Where">条件</param>
        /// <returns></returns>
        public ReturnObject GetInStoragePS(string _Where,string strlx,string strRole)
        {
            string strOut = "";
            string sql = "";
            if (strlx == "2")
            {
                sql = "SELECT A.BILLETID ,(SELECT NAME_ FROM SCM_BASE_INFO F WHERE A.PRODUCTLINE = F.ID_)PRODUCTLINE,A.ROLLNUMBER,A.MOTHERBOARDNUMBER,A.STOVENO,A.PLANNO,A.ORDERNO,A.YPLANNO,A.YORDERNO,J.NAME_ ATTESTATIONORGAN,"

                  + "A.PLY,A.WIDTH,A.LENGTH,A.THEORYWEIGHT,(SELECT NAME_ FROM SCM_BASE_INFO B WHERE A.FACEQUALITY = B.ID_)FACEQUALITY,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE A.BUGREASON = C.ID_)BUGREASON,A.DETERMINANTCARDNUMBER,(SELECT NAME_ FROM SCM_BASE_INFO D WHERE A.CLIPTYPEPROCESS = D.ID_)CLIPTYPEPROCESS, TO_CHAR(m.sendbegindate, 'YYYY-MM-DD') SENDBEGINDATE,"

                  + " (SELECT NAME_ FROM SCM_BASE_INFO E WHERE A.DETERMINANTRESULT = E.ID_)DETERMINANTRESULT,A.SOURCEID,TO_CHAR(A.INTIME,'YYYY-MM-DD HH24:MI:SS') INTIME,A.CONDOLENUMBER,"

                  + " A.CHECKOPERATOR,A.IN_MAN,(SELECT NAME_ FROM SCM_BASE_INFO G WHERE A.INCLASSORDER = G.ID_)INCLASSORDER,(SELECT NAME_ FROM SCM_BASE_INFO H WHERE A.INCLASSTEAM = H.ID_)INCLASSTEAM, I.BUTTRESS,A.REMARK,A.ORDERBUYER,K.NAME_ BUSINESS_CATEGORY   "

                  + "FROM  KCP_STORAGELIST A, sel_pactdetail          m ,SCM_BASE_INFO           J ,KCJ_STORAGEBUTTRESSLIST I ,KCJ_BASEDATA K "

                  + "WHERE  a.orderno = m.orderno(+) AND A.BILLETID = I.BILLETID(+) AND A.STORAGESTATUS = '501002' AND A.ISVALID = '1' AND M.CHECKORG = J.ID_(+) AND A.BUSINESS_CATEGORY = K.ID_(+) "

                  + " AND (A.BILLETID LIKE 'Z%' OR A.BILLETID LIKE 'H%') "

                  + " "

                  + _Where

                  + " ORDER BY A.INTIME DESC";
            }
            else
            {
                if (strRole == "pszxck")
                {
                    sql = "SELECT A.BILLETID ,(SELECT NAME_ FROM SCM_BASE_INFO F WHERE A.PRODUCTLINE = F.ID_)PRODUCTLINE,A.ROLLNUMBER,A.MOTHERBOARDNUMBER,A.STOVENO,A.PLANNO,A.ORDERNO,A.YPLANNO,A.YORDERNO,J.NAME_ ATTESTATIONORGAN,"

                     + "A.PLY,A.WIDTH,A.LENGTH,A.THEORYWEIGHT,(SELECT NAME_ FROM SCM_BASE_INFO B WHERE A.FACEQUALITY = B.ID_)FACEQUALITY,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE A.BUGREASON = C.ID_)BUGREASON,A.DETERMINANTCARDNUMBER,(SELECT NAME_ FROM SCM_BASE_INFO D WHERE A.CLIPTYPEPROCESS = D.ID_)CLIPTYPEPROCESS, TO_CHAR(m.sendbegindate, 'YYYY-MM-DD') SENDBEGINDATE,"

                     + " (SELECT NAME_ FROM SCM_BASE_INFO E WHERE A.DETERMINANTRESULT = E.ID_)DETERMINANTRESULT,A.SOURCEID,TO_CHAR(A.INTIME,'YYYY-MM-DD HH24:MI:SS') INTIME,A.CONDOLENUMBER,"

                     + " A.CHECKOPERATOR,A.IN_MAN,(SELECT NAME_ FROM SCM_BASE_INFO G WHERE A.INCLASSORDER = G.ID_)INCLASSORDER,(SELECT NAME_ FROM SCM_BASE_INFO H WHERE A.INCLASSTEAM = H.ID_)INCLASSTEAM, I.BUTTRESS,A.REMARK,A.ORDERBUYER,K.NAME_ BUSINESS_CATEGORY   "

                     + "FROM  KCP_STORAGELIST A, sel_pactdetail          m ,SCM_BASE_INFO           J ,KCJ_STORAGEBUTTRESSLIST I ,KCJ_BASEDATA K "

                     + "WHERE  a.orderno = m.orderno(+) AND A.BILLETID = I.BILLETID(+) AND A.STORAGESTATUS = '501002' AND A.ISVALID = '1' AND M.CHECKORG = J.ID_(+) AND A.BUSINESS_CATEGORY = K.ID_(+) "

                     + "  AND (A.BILLETID LIKE 'E%' OR A.BILLETID LIKE 'Y%' OR A.BILLETID LIKE 'B%')"

                     + " "

                     + _Where

                     + " ORDER BY A.INTIME DESC";
                }
                else
                {
                    sql = "SELECT A.BILLETID ,(SELECT NAME_ FROM SCM_BASE_INFO F WHERE A.PRODUCTLINE = F.ID_)PRODUCTLINE,A.ROLLNUMBER,A.MOTHERBOARDNUMBER,A.STOVENO,A.PLANNO,A.ORDERNO,A.YPLANNO,A.YORDERNO,J.NAME_ ATTESTATIONORGAN,"

              + "A.PLY,A.WIDTH,A.LENGTH,A.THEORYWEIGHT,(SELECT NAME_ FROM SCM_BASE_INFO B WHERE A.FACEQUALITY = B.ID_)FACEQUALITY,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE A.BUGREASON = C.ID_)BUGREASON,A.DETERMINANTCARDNUMBER,(SELECT NAME_ FROM SCM_BASE_INFO D WHERE A.CLIPTYPEPROCESS = D.ID_)CLIPTYPEPROCESS, TO_CHAR(m.sendbegindate, 'YYYY-MM-DD') SENDBEGINDATE,"

              + " (SELECT NAME_ FROM SCM_BASE_INFO E WHERE A.DETERMINANTRESULT = E.ID_)DETERMINANTRESULT,A.SOURCEID,TO_CHAR(A.INTIME,'YYYY-MM-DD HH24:MI:SS') INTIME,A.CONDOLENUMBER,"

              + " A.CHECKOPERATOR,A.IN_MAN,(SELECT NAME_ FROM SCM_BASE_INFO G WHERE A.INCLASSORDER = G.ID_)INCLASSORDER,(SELECT NAME_ FROM SCM_BASE_INFO H WHERE A.INCLASSTEAM = H.ID_)INCLASSTEAM, I.BUTTRESS,A.REMARK,A.ORDERBUYER,K.NAME_ BUSINESS_CATEGORY   "

              + "FROM  KCJ_STORAGELIST A, sel_pactdetail          m ,SCM_BASE_INFO           J ,KCJ_STORAGEBUTTRESSLIST I ,KCJ_BASEDATA K "

              + "WHERE  a.orderno = m.orderno(+) AND A.BILLETID = I.BILLETID(+) AND A.STORAGESTATUS = '501002' AND A.ISVALID = '1' AND M.CHECKORG = J.ID_(+) AND A.BUSINESS_CATEGORY = K.ID_(+) "

              + "  AND (A.BILLETID LIKE 'E%' OR A.BILLETID LIKE 'Y%' OR A.BILLETID LIKE 'B%') "

              + " "

              + _Where

              + " ORDER BY A.INTIME DESC";
                }
            }

       

            try
            {

                DataSet ds = this.DBManager.ExecuteQuery(sql, out strOut);
                ds.Tables[0].TableName = "KCJ_STORAGELIST";
                return new ReturnObject(ds, strOut);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, "数据库连接错");
            }

        }
        #endregion
        #region "配送中心"

        /// <summary>
        /// 原料接收入库
        /// </summary>
        /// <param name="_BilletID ">板块序号信息</param>
        /// <param name="_OtherInfo ">入库信息</param>
        /// <returns></returns>
        public ReturnObject Stuff_Receive_PS(ArrayList _BilletID, ArrayList _OtherInfo,string strRole)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pBilletID.Direction = ParameterDirection.Input;
                pOtherInfo.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
                pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

                pBilletID.Value = _BilletID.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_BilletID.Count];
                for (int i = 0; i < _BilletID.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pBilletID.Size = _BilletID.Count;
                pBilletID.ArrayBindSize = OSizeInf;

                int[] NOSizeInf = new int[_OtherInfo.Count];
                for (int i = 0; i < _OtherInfo.Count; i++)
                {
                    NOSizeInf[i] = 200;
                }
                pOtherInfo.Size = _OtherInfo.Count;
                pOtherInfo.ArrayBindSize = NOSizeInf;
                pSuccessFlag.Size = 400;

                if (strRole == "pszxck")
                {
                    ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.STUFF_INSTORAGE_PS", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                }
                else
                {
                    ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.STUFF_INSTORAGE", CommandType.StoredProcedure,
                         new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                }
                if (Common.CheckNullStr(pSuccessFlag.Value).Length > 0 | Common.CheckNullStr(err).Length > 0)
                {
                    return new ReturnObject(null, 1, pSuccessFlag.Value.ToString() + err);
                }
                else
                {
                    return new ReturnObject('1');
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }

        /// <summary>
        /// 原料接收入库
        /// </summary>
        /// <param name="_BilletID ">板块序号信息</param>
        /// <param name="_OtherInfo ">入库信息</param>
        /// <returns></returns>
        public ReturnObject Stuff_Del_Recevie_PS(ArrayList _BilletID, ArrayList _OtherInfo,string strRole)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pBilletID.Direction = ParameterDirection.Input;
                pOtherInfo.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
                pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

                pBilletID.Value = _BilletID.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_BilletID.Count];
                for (int i = 0; i < _BilletID.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pBilletID.Size = _BilletID.Count;
                pBilletID.ArrayBindSize = OSizeInf;

                int[] NOSizeInf = new int[_OtherInfo.Count];
                for (int i = 0; i < _OtherInfo.Count; i++)
                {
                    NOSizeInf[i] = 200;
                }
                pOtherInfo.Size = _OtherInfo.Count;
                pOtherInfo.ArrayBindSize = NOSizeInf;
                pSuccessFlag.Size = 400;

                if (strRole == "pszxck")
                {
                    ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.STUFF_DEL_INSTORAGE_PS", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                }
                else
                {
                    ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.STUFF_DEL_INSTORAGE", CommandType.StoredProcedure,
                          new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                }
                if (Common.CheckNullStr(pSuccessFlag.Value).Length > 0 | Common.CheckNullStr(err).Length > 0)
                {
                    return new ReturnObject(null, 1, pSuccessFlag.Value.ToString() + err);
                }
                else
                {
                    return new ReturnObject('1');
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }
        #endregion
        /// <summary>
		/// 原料接收入库
		/// </summary>
		/// <param name="_BilletID ">板块序号信息</param>
		/// <param name="_OtherInfo ">入库信息</param>
		/// <returns></returns>
        /// 



        public ReturnObject HB_BZ(ArrayList _BilletID, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pBilletID.Direction = ParameterDirection.Input;
                pOtherInfo.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
                pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

                pBilletID.Value = _BilletID.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_BilletID.Count];
                for (int i = 0; i < _BilletID.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pBilletID.Size = _BilletID.Count;
                pBilletID.ArrayBindSize = OSizeInf;

                int[] NOSizeInf = new int[_OtherInfo.Count];
                for (int i = 0; i < _OtherInfo.Count; i++)
                {
                    NOSizeInf[i] = 200;
                }
                pOtherInfo.Size = _OtherInfo.Count;
                pOtherInfo.ArrayBindSize = NOSizeInf;
                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.HB_BZ", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                if (Common.CheckNullStr(pSuccessFlag.Value).Length > 0 | Common.CheckNullStr(err).Length > 0)
                {
                    return new ReturnObject(null, 1, pSuccessFlag.Value.ToString() + err);
                }
                else
                {
                    return new ReturnObject('1');
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }





        public ReturnObject Car_FuraceAdd(ArrayList _BilletID, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pBilletID.Direction = ParameterDirection.Input;
                pOtherInfo.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
                pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

                pBilletID.Value = _BilletID.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_BilletID.Count];
                for (int i = 0; i < _BilletID.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pBilletID.Size = _BilletID.Count;
                pBilletID.ArrayBindSize = OSizeInf;

                int[] NOSizeInf = new int[_OtherInfo.Count];
                for (int i = 0; i < _OtherInfo.Count; i++)
                {
                    NOSizeInf[i] = 200;
                }
                pOtherInfo.Size = _OtherInfo.Count;
                pOtherInfo.ArrayBindSize = NOSizeInf;
                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.Car_FurcaceAdd", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                if (Common.CheckNullStr(pSuccessFlag.Value).Length > 0 | Common.CheckNullStr(err).Length > 0)
                {
                    return new ReturnObject(null, 1, pSuccessFlag.Value.ToString() + err);
                }
                else
                {
                    return new ReturnObject('1');
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }


        public ReturnObject ProductStock_Add(ArrayList _BilletID, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pBilletID.Direction = ParameterDirection.Input;
                pOtherInfo.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
                pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

                pBilletID.Value = _BilletID.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_BilletID.Count];
                for (int i = 0; i < _BilletID.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pBilletID.Size = _BilletID.Count;
                pBilletID.ArrayBindSize = OSizeInf;

                int[] NOSizeInf = new int[_OtherInfo.Count];
                for (int i = 0; i < _OtherInfo.Count; i++)
                {
                    NOSizeInf[i] = 200;
                }
                pOtherInfo.Size = _OtherInfo.Count;
                pOtherInfo.ArrayBindSize = NOSizeInf;
                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_K.ProductStock_Add", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pBilletID, pOtherInfo, pSuccessFlag }, out err);
                if (Common.CheckNullStr(pSuccessFlag.Value).Length > 0 | Common.CheckNullStr(err).Length > 0)
                {
                    return new ReturnObject(null, 1, pSuccessFlag.Value.ToString() + err);
                }
                else
                {
                    return new ReturnObject('1');
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }

		public ReturnObject Stuff_Receive(ArrayList _BilletID,ArrayList _OtherInfo)
		{
			try
			{
				string err = "";
				Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				
				pBilletID.Direction = ParameterDirection.Input;
				pOtherInfo.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

				pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
				pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

				pBilletID.Value = _BilletID.ToArray(typeof(string));
				pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

				int []OSizeInf = new int[_BilletID.Count];
				for(int i =0;i< _BilletID.Count;i++)
				{
					OSizeInf[i ] = 200;
				}
				pBilletID.Size = _BilletID.Count;
				pBilletID.ArrayBindSize = OSizeInf;

				int []NOSizeInf = new int[_OtherInfo.Count];
				for(int i =0;i< _OtherInfo.Count;i++)
				{
					NOSizeInf[i ] = 200;
				}
				pOtherInfo.Size = _OtherInfo.Count;
				pOtherInfo.ArrayBindSize = NOSizeInf;
				pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_WX.STUFF_INSTORAGE", CommandType.StoredProcedure,
					new Oracle.DataAccess.Client.OracleParameter[]
					{pBilletID,pOtherInfo,pSuccessFlag}, out err);
				if(Common.CheckNullStr(pSuccessFlag.Value).Length>0 | Common.CheckNullStr(err).Length>0)
				{
					return new ReturnObject(null,1,pSuccessFlag.Value.ToString()+err);
				}
				else
				{
					return new ReturnObject('1');
				}
			}
			catch(System.Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,ex.ToString());
			}
		}
        public ReturnObject Storginist_Imp(System.Data.DataTable Tab_Imp, string MakeMan)
        {
            try
            {
                string Begin_MakeNO = "0";
                string err = "";
                string MakeTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");


                #region"导入Excel原始数据"
                err = "";
                string sSql = "DELETE from KCJ_ZWIMPORT";
                this.DBManager.ExecuteQuery(sSql, out err);
                string ESql = "SELECT BUYERNAME,PACTNO,ORDERNO,SOURCEID,ROLLNUMBER,BILLETID,DETERMINANTCARDNUMBER,PLY,WIDTH,LENGTH,THEORYWEIGHT,PLANNO,FACEQUALITY,DETERMINANTRESULT,USE,STANDARDNO,DETECTMAR,PLANVEHICLEID,STOVENO FROM KCJ_ZWIMPORT";
                System.Data.DataTable Tab_Commit = DealTab_Imp(Tab_Imp, MakeMan, MakeTime);
                this.DBManager.UpdateTable(Tab_Commit, ESql, out err);
                if (err.Length > 0)
                {
                    return new ReturnObject(null, err);
                }
                //string strPlan = Tab_Commit.Rows[0]["MAKETIME"].ToString();
                #endregion

                #region "处理原始数据 生成坯料设计主从表"
                //err = "";
                //Oracle.DataAccess.Client.OracleParameter pMakeMan = new Oracle.DataAccess.Client.OracleParameter("vMakeMan", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                //Oracle.DataAccess.Client.OracleParameter pMakeTime = new Oracle.DataAccess.Client.OracleParameter("vMakeTime", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                //pMakeMan.Direction = ParameterDirection.Input;
                //pMakeTime.Direction = ParameterDirection.Input;

                //pMakeMan.Value = MakeMan;

                //pMakeTime.Value = strPlan;

                //((STMes.DBManager)DBManagerList["ODPDB"]).ExecuteNonQuery_NoDBSever("Train_IMP_BJ", CommandType.StoredProcedure,
                //    new Oracle.DataAccess.Client.OracleParameter[] { pMakeMan, pMakeTime }, out err);
                //if (err.Length > 0)
                //{
                //    return new ReturnObject(null, 1, err);
                //}
                //else
                //{
                //    return new ReturnObject('1');
                //}
                return new ReturnObject('1');
                #endregion
            }
            catch (System.Exception ex)
            {
                return new ReturnObject(null, ex.ToString());
            }
        }
        #region "原料导入"
        private System.Data.DataTable DealTab_Imp(System.Data.DataTable Tab_Imp, string MakeMan, string MakeTime)
        {
            try
            {
                #region "临时变量"
                string MakeDate = System.DateTime.Now.ToString("yyyyMMdd");
                string ch = "";




                string Memo = "";
                #endregion

                #region "表架构设置"
                Tab_Imp.TableName = "KCJ_ZWIMPORT"; ;
                Tab_Imp.Columns[0].ColumnName = "BUYERNAME";
                Tab_Imp.Columns[1].ColumnName = "PACTNO";
                Tab_Imp.Columns[2].ColumnName = "ORDERNO";

                Tab_Imp.Columns[3].ColumnName = "SOURCEID";
                Tab_Imp.Columns[4].ColumnName = "ROLLNUMBER";

                Tab_Imp.Columns[5].ColumnName = "BILLETID";

                Tab_Imp.Columns[6].ColumnName = "DETERMINANTCARDNUMBER";


                Tab_Imp.Columns[7].ColumnName = "PLY";



                Tab_Imp.Columns[8].ColumnName = "WIDTH";


                //Tab_Imp.Columns.Add(new System.Data.DataColumn("WEIGHT", typeof(System.Double)));
                //Tab_Imp.Columns.Add(new System.Data.DataColumn("MONEY", typeof(System.Double)));
                //Tab_Imp.Columns.Add(new System.Data.DataColumn("PRICE", typeof(System.Double)));

                Tab_Imp.Columns[9].ColumnName = "LENGTH";
                Tab_Imp.Columns[10].ColumnName = "THEORYWEIGHT";
                Tab_Imp.Columns[11].ColumnName = "PLANNO";
                Tab_Imp.Columns[12].ColumnName = "FACEQUALITY";

                Tab_Imp.Columns[13].ColumnName = "DETERMINANTRESULT";




                Tab_Imp.Columns[14].ColumnName = "USE";
                Tab_Imp.Columns[15].ColumnName = "STANDARDNO";
                Tab_Imp.Columns[16].ColumnName = "DETECTMAR";
                Tab_Imp.Columns[17].ColumnName = "PLANVEHICLEID";
                Tab_Imp.Columns[18].ColumnName = "STOVENO";


                Tab_Imp.Columns.Add(new System.Data.DataColumn("INPUTPERSON", typeof(System.String)));
                Tab_Imp.Columns.Add(new System.Data.DataColumn("MAKETIME", typeof(System.String)));






                Tab_Imp.AcceptChanges();


                #endregion

                #region "处理数据"
                foreach (System.Data.DataRow row in Tab_Imp.Rows)
                {
                    if (row["BILLETID"].ToString() != "")
                    {
                        row.BeginEdit();
                        row["INPUTPERSON"] = MakeMan;
                        row["MAKETIME"] = MakeDate;

                    }







                    row.EndEdit();
                }
                #endregion

                #region "删除非法记录"
                for (int i = Tab_Imp.Rows.Count - 1; i >= 0; i--)
                {
                    if (Tab_Imp.Rows[i]["BILLETID"].GetType() == typeof(System.DBNull))
                    {
                        Tab_Imp.Rows[i].Delete();
                    }
                }
                Tab_Imp.AcceptChanges();
                #endregion

                #region "生成提交数据"
                System.Data.DataTable Tab_Commit = Tab_Imp.Clone();
                foreach (System.Data.DataRow row in Tab_Imp.Rows)
                {
                    System.Data.DataRow nrow = Tab_Commit.NewRow();

                    nrow.ItemArray = row.ItemArray;
                    Tab_Commit.Rows.Add(nrow);
                }
                #endregion

                return Tab_Commit;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return null;
            }
        }
        #endregion
        /// <summary>
		/// 原料接收入库
		/// </summary>
		/// <param name="_BilletID ">板块序号信息</param>
		/// <param name="_OtherInfo ">入库信息</param>
		/// <returns></returns>
		public ReturnObject Stuff_Del_Recevie(ArrayList _BilletID,ArrayList _OtherInfo)
		{
			try
			{
				string err = "";
				Oracle.DataAccess.Client.OracleParameter pBilletID = new Oracle.DataAccess.Client.OracleParameter("vBillet", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				Oracle.DataAccess.Client.OracleParameter pOtherInfo = new Oracle.DataAccess.Client.OracleParameter("vOtherInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				
				pBilletID.Direction = ParameterDirection.Input;
				pOtherInfo.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

				pBilletID.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;
				pOtherInfo.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

				pBilletID.Value = _BilletID.ToArray(typeof(string));
				pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

				int []OSizeInf = new int[_BilletID.Count];
				for(int i =0;i< _BilletID.Count;i++)
				{
					OSizeInf[i ] = 200;
				}
				pBilletID.Size = _BilletID.Count;
				pBilletID.ArrayBindSize = OSizeInf;

				int []NOSizeInf = new int[_OtherInfo.Count];
				for(int i =0;i< _OtherInfo.Count;i++)
				{
					NOSizeInf[i ] = 200;
				}
				pOtherInfo.Size = _OtherInfo.Count;
				pOtherInfo.ArrayBindSize = NOSizeInf;
				pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_WX.STUFF_DEL_INSTORAGE", CommandType.StoredProcedure,
					new Oracle.DataAccess.Client.OracleParameter[]
					{pBilletID,pOtherInfo,pSuccessFlag}, out err);
				if(Common.CheckNullStr(pSuccessFlag.Value).Length>0 | Common.CheckNullStr(err).Length>0)
				{
					return new ReturnObject(null,1,pSuccessFlag.Value.ToString()+err);
				}
				else
				{
					return new ReturnObject('1');
				}
			}
			catch(System.Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,ex.ToString());
			}
		}


	}
}
