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

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

		public ReturnObject StuffQuer(string _Where)
		{
			try
			{
				string strOut="";
				string Sql="SELECT 'FALSE'  FLAG,A.OLD_SAMPL_NO,A.SLAB_NO,A.ORD_NO,B.BUTTRESS,"+
					"A.ORD_SEQ,A.STL_GRD,A.COIL_INDIA,A.COIL_OUTDIA,"+
					"A.COIL_THK,COIL_WTH,A.STOVENO,(A.BAHCT_NUMBER||A.SERIAL_NUMBER)BAHCT_NUMBER,"+
					"CAL_WGT,A.ACT_WGT,A.TOT_DEC_GRD,SX_BIAOZHUN,"+
					"A.CRK_CD1,A.CRK_CD2,A.CRK_CD3,A.CRK_CD4,"+
					"A.CRK_CD5,A.ZLZS_NO,A.REM,A.DEVLMT_DTIME,"+
					"A.SHIP_INVNO,TRANS_CAR_NO,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE C.ID_= A.INCLASSORDER)INCLASSORDER,"+
					"(SELECT NAME_ FROM SCM_BASE_INFO D WHERE D.ID_=A.INCLASSTEAM)INCLASSTEAM,A.CREATETIME,A.CREATOR FROM KCJ3_STUFFLIST_ZW A ,KCJ3_STUFFBUTTRESSLIST_ZW B "+
                    "WHERE A.OLD_SAMPL_NO=B.OLD_SAMPL_NO AND A.STORAGESTATUS='501002' AND ISPLAN='0' AND A.ISVALID='1'  " + _Where;
				DataSet ds=this.DBManager.ExecuteQuery(Sql,out strOut);
				if(ds!=null&&ds.Tables.Count==1)
				{
					ds.Tables[0].TableName="KCJ3_STUFFLIST";
					return new ReturnObject(ds,strOut);
				}
				return new ReturnObject(null);
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,10004,ex.ToString());
			}

		}
		public ReturnObject Plan_Qery(string _Where)
		{
			try
			{
				string strOut="";
                string Sql = "SELECT 'FALSE'  FLAG, A.OLD_SAMPL_NO,A.SLAB_NO,A.ORD_NO,B.BUTTRESS,A.WORKORDER_ID," +
					"A.ORD_SEQ,A.STL_GRD,A.COIL_INDIA,A.COIL_OUTDIA,"+
					"A.COIL_THK,COIL_WTH,A.STOVENO,(A.BAHCT_NUMBER||SERIAL_NUMBER)BAHCT_NUMBER,"+
					"A.COIL_LEN,CAL_WGT,A.ACT_WGT,A.TOT_DEC_GRD,SX_BIAOZHUN,"+
			
                    "A.ZLZS_NO,A.REM,A.DEVLMT_DTIME,(SELECT NAME_ FROM KCJ_BASEDATA WHERE ID_=A.STOCKTYPE)STOCKTYPE,(SELECT NAME_ FROM KCJ_BASEDATA WHERE ID_=A.GYLX)GYLX," +
					"A.SHIP_INVNO,TRANS_CAR_NO,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE C.ID_= A.CLASSORDER)CLASSORDER,"+
					"(SELECT NAME_ FROM SCM_BASE_INFO D WHERE D.ID_=A.CLASSTEAM)CLASSTEAM,A.CREATETIME,A.CREATOR FROM KCJ3_ZY_PLAN_ZW A ,KCJ3_STUFFBUTTRESSLIST_ZW B "+
                    "WHERE A.OLD_SAMPL_NO=B.OLD_SAMPL_NO AND A.PLAN_FLAG='0'  AND A.DOWN_FLAG='0' " + _Where + " ORDER BY A.SCID ASC";
				DataSet ds=this.DBManager.ExecuteQuery(Sql,out strOut);
				if(ds!=null&&ds.Tables.Count==1)
				{
					ds.Tables[0].TableName="KCJ3_ZY_PLAN";
					return new ReturnObject(ds,strOut);
				}
				return new ReturnObject(null);
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,10004,ex.ToString());
			}

		}

		public ReturnObject Plan_XF_Qery(string _Where1,string _Where2)
		{
			try
			{
                string err = "";
                string Sql = "SELECT A.WORKORDER_ID,dbms_lob.substr(wmsys.wm_concat(DISTINCT A.OLD_SAMPL_NO)) OLD_SAMPL_NO,dbms_lob.substr(wmsys.wm_concat(DISTINCT A.SHIP_INVNO)) SHIP_INVNO, "
                          +"dbms_lob.substr(wmsys.wm_concat(DISTINCT A.PLAN_COIL_THK)) PLAN_COIL_THK,dbms_lob.substr(wmsys.wm_concat(DISTINCT A.PLAN_COIL_WTH)) PLAN_COIL_WTH, "
                          +"dbms_lob.substr(wmsys.wm_concat(DISTINCT A.PLAN_COIL_LEN)) PLAN_COIL_LEN,dbms_lob.substr(wmsys.wm_concat(DISTINCT A.STL_GRD)) STL_GRD,SUM(DISTINCT A.ACT_WGT) ACT_WGT, "
                          +"CASE WHEN MIN(A.XF_FLAG) = '0' THEN '未下发' WHEN MIN(A.XF_FLAG) = '1' THEN '已下发' END  XF_FLAG "
                          +"FROM kcj3_zy_plan_main A where 1=1 and isvalid <> '0' "
                          + _Where1 + " group by A.WORKORDER_ID ORDER BY A.WORKORDER_ID";
                DataSet ds = DBManager.ExecuteQuery(Sql, out err);
                ds.Tables[0].TableName = "PLAN_MAIN";

                string StrSQL_Detail = "";
                StrSQL_Detail = "select WORKORDER_ID,OLD_SAMPL_NO,COIL_THK,COIL_WTH,COIL_LEN,((COIL_THK*COIL_WTH*COIL_LEN*7.85)/1000000000) WEIGHT,COIL_NUM,STL_GRD,DETAIL_TIME,PLAN_CAR_NO,PLAN_BUTTRESS,REMARK, "
                               + " DETAIL_NAME,decode(XF_FLAG,'0','未下发','1','已下发') XF_FLAG,AREA,GUID from kcj3_zy_plan_detail where 1=1 and isvalid <> '0' AND WORKORDER_ID IN (SELECT  WORKORDER_ID FROM  kcj3_zy_plan_main A where 1=1 and isvalid <> '0' " + _Where2 + ") order by WORKORDER_ID,AREA,COIL_NUM ";
                DataSet ds_Detail = DBManager.ExecuteQuery(StrSQL_Detail, out err);
                ds_Detail.Tables[0].TableName = "PLAN_DETAIL";

                ds.Merge(ds_Detail);
                ds.Relations.Clear();
                ds.Relations.Add("PlateTable", ds.Tables["PLAN_MAIN"].Columns["WORKORDER_ID"], ds.Tables["PLAN_DETAIL"].Columns["WORKORDER_ID"]);	
                return new ReturnObject(ds, err);

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

		}
        public ReturnObject Plan_XFFT_Qery(string _Where)
        {
            try
            {

                string err = "";
                string Sql = "SELECT 'FALSE'  FLAG,A.WORKORDER_ID,A.OLD_SAMPL_NO,A.SLAB_NO,A.ORD_NO,B.BUTTRESS," +
                    "A.ORD_SEQ,A.STL_GRD,A.COIL_INDIA,A.COIL_OUTDIA,A.AFFIRLOG,A.DOWN_FLAG," +
                    "A.COIL_THK,COIL_WTH,A.STOVENO,A.BAHCT_NUMBER," +
                    "A.COIL_LEN,CAL_WGT,A.ACT_WGT,A.TOT_DEC_GRD,SX_BIAOZHUN," +
                    "A.CRK_CD1,A.CRK_CD2,A.CRK_CD3,A.CRK_CD4,(SELECT NAME_ FROM KCJ_BASEDATA WHERE ID_=A.STOCKTYPE)STOCKTYPE,(SELECT NAME_ FROM KCJ_BASEDATA WHERE ID_=A.GYLX)GYLX," +
                    "A.CRK_CD5,A.ZLZS_NO,A.REM,A.DEVLMT_DTIME," +
                    "A.SHIP_INVNO,TRANS_CAR_NO,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE C.ID_= A.CLASSORDER)CLASSORDER,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE C.ID_= A.STSJBC)STSJBC,(SELECT NAME_ FROM SCM_BASE_INFO C WHERE C.ID_= A.STSJBZ)STSJBZ,STTIME,STQRTIME," +
                    "(SELECT NAME_ FROM SCM_BASE_INFO D WHERE D.ID_=A.CLASSTEAM)CLASSTEAM,A.CREATETIME,A.CREATOR FROM KCJ3_ZY_PLAN_ZW A ,KCJ3_STUFFBUTTRESSLIST_ZW B " +
                    "WHERE A.OLD_SAMPL_NO=B.OLD_SAMPL_NO  AND A.WORKORDER_ID IN (SELECT C.WORKORDER_ID FROM KCJ3_ZY_PLAN_DETAIL C WHERE C.WORKORDER_ID=A.WORKORDER_ID) " + _Where + " ORDER BY A.WORKORDER_ID, A.SCID DESC";

                DataSet ds = DBManager.ExecuteQuery(Sql, out err);
               




                return new ReturnObject(ds, err);


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

        }
		public ReturnObject PLAN_Print(string _Where)
		{
			try
			{
				string strOut="";
				string Sql="SELECT B.BUTTRESS,A.STL_GRD,A.COIL_WTH AS WTH,A.ACT_WGT AS WGT, "+
                           "A.STOVENO,A.OLD_SAMPL_NO,A.SX_BIAOZHUN,A.ORD_NO,C.COIL_LEN,C.COIL_WTH,C.COIL_NUM,A.ACT_WGT,A.COIL_THK, " +
                           "(A.COIL_LEN*A.COIL_WTH*A.COIL_THK*0.00000785)DZ,A.REMARK,A.CREATOR,A.CREATETIME  "+
                           "FROM KCJ3_ZY_PLAN_ZW A,KCJ3_STUFFBUTTRESSLIST_ZW B,KCJ3_ZY_PLAN_DETAIL C  WHERE A.OLD_SAMPL_NO=B.OLD_SAMPL_NO  AND A.OLD_SAMPL_NO=C.OLD_SAMPL_NO " + _Where;
				DataSet ds=this.DBManager.ExecuteQuery(Sql,out strOut);
				if(ds!=null&&ds.Tables.Count==1)
				{
					ds.Tables[0].TableName="KCJ3_ZY_PLAN";
					return new ReturnObject(ds,strOut);
				}
				return new ReturnObject(null);
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.WriteLine(ex.ToString());
				return new ReturnObject(null,10004,ex.ToString());
			}

		}


		public ReturnObject Plan_Set(ArrayList _Ship_Invno,ArrayList _OtherInfo)
		{
			try
			{
				string err = "";
                Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);
				
				pShi_Invno.Direction = ParameterDirection.Input;
				pOtherInfo.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

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

				pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
				pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

				int []OSizeInf = new int[_Ship_Invno.Count];
				for(int i =0;i< _Ship_Invno.Count;i++)
				{
					OSizeInf[i ] = 200;
				}
				pShi_Invno.Size = _Ship_Invno.Count;
				pShi_Invno.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.SHIP_ADD", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pShi_Invno, 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 Plan_Del(ArrayList _Ship_Invno)
		{
			try
			{
				string err = "";
				Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);
				
				pShi_Invno.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

				pShi_Invno.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray;

				pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));

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

				pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_WX.SHIP_DEL", CommandType.StoredProcedure,
					new Oracle.DataAccess.Client.OracleParameter[]
					{pShi_Invno,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 Plan_Set_XF(ArrayList _Ship_Invno,ArrayList _OtherInfo)
		{
			try
			{
				string err = "";
				Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);
				
				pShi_Invno.Direction = ParameterDirection.Input;
				pOtherInfo.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

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

				pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
				pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

				int []OSizeInf = new int[_Ship_Invno.Count];
				for(int i =0;i< _Ship_Invno.Count;i++)
				{
					OSizeInf[i ] = 200;
				}
				pShi_Invno.Size = _Ship_Invno.Count;
				pShi_Invno.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.SHIP_XF", CommandType.StoredProcedure,
					new Oracle.DataAccess.Client.OracleParameter[]
					{pShi_Invno,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 Plan_Set_ZD(ArrayList _Ship_Invno, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);

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

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

                pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_Ship_Invno.Count];
                for (int i = 0; i < _Ship_Invno.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pShi_Invno.Size = _Ship_Invno.Count;
                pShi_Invno.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.SHIP_ZD", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pShi_Invno, 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 UPDATE_PLAN(string _GUID, string _PLAN_CAR_NO, string _PLAN_BUTTRESS)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pGUID = new Oracle.DataAccess.Client.OracleParameter("vGUID", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pPLAN_CAR_NO = new Oracle.DataAccess.Client.OracleParameter("vPLAN_CAR_NO", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pPLAN_BUTTRESS = new Oracle.DataAccess.Client.OracleParameter("vPLAN_BUTTRESS", Oracle.DataAccess.Client.OracleDbType.Varchar2);
                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                pGUID.Direction = ParameterDirection.Input;
                pPLAN_CAR_NO.Direction = ParameterDirection.Input;
                pPLAN_BUTTRESS.Direction = ParameterDirection.Input;
                pSuccessFlag.Direction = ParameterDirection.Output;

                pGUID.Value = _GUID;
                pPLAN_CAR_NO.Value = _PLAN_CAR_NO;
                pPLAN_BUTTRESS.Value = _PLAN_BUTTRESS;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_STORAGEMANAGER_WX.CAR_UPDATE", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pGUID, pPLAN_CAR_NO, pPLAN_BUTTRESS, 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 Plan_Set_FJXF(ArrayList _Ship_Invno, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);

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

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

                pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_Ship_Invno.Count];
                for (int i = 0; i < _Ship_Invno.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pShi_Invno.Size = _Ship_Invno.Count;
                pShi_Invno.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.SHIP_FJXF", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pShi_Invno, 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 Plan_Del_XF(ArrayList _Ship_Invno,ArrayList _OtherInfo)
		{
			try
			{
				string err = "";
				Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);
				
				pShi_Invno.Direction = ParameterDirection.Input;
				pOtherInfo.Direction = ParameterDirection.Input;
				pSuccessFlag.Direction = ParameterDirection.Output;

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

				pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
				pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

				int []OSizeInf = new int[_Ship_Invno.Count];
				for(int i =0;i< _Ship_Invno.Count;i++)
				{
					OSizeInf[i ] = 200;
				}
				pShi_Invno.Size = _Ship_Invno.Count;
				pShi_Invno.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.SHIP_XF_DEL", CommandType.StoredProcedure,
					new Oracle.DataAccess.Client.OracleParameter[]
					{pShi_Invno,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 Plan_ZD_Del(ArrayList _Ship_Invno, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);

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

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

                pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_Ship_Invno.Count];
                for (int i = 0; i < _Ship_Invno.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pShi_Invno.Size = _Ship_Invno.Count;
                pShi_Invno.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.SHIP_ZD_DEL", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pShi_Invno, 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 Plan_ZD_Edit(ArrayList _Ship_Invno, ArrayList _OtherInfo)
        {
            try
            {
                string err = "";
                Oracle.DataAccess.Client.OracleParameter pShi_Invno = new Oracle.DataAccess.Client.OracleParameter("vSHIP_INVNO", 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);

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

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

                pShi_Invno.Value = _Ship_Invno.ToArray(typeof(string));
                pOtherInfo.Value = _OtherInfo.ToArray(typeof(string));

                int[] OSizeInf = new int[_Ship_Invno.Count];
                for (int i = 0; i < _Ship_Invno.Count; i++)
                {
                    OSizeInf[i] = 200;
                }
                pShi_Invno.Size = _Ship_Invno.Count;
                pShi_Invno.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.SHIP_ZD_Edit", CommandType.StoredProcedure,
                    new Oracle.DataAccess.Client.OracleParameter[] { pShi_Invno, 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());
            }
        }



	}
}
