using System;
using System.Data;
using System.Collections;
using Core.Mes.ServerFrameWork;
using Core.Mes.IBaseInterface;
using Core.XgMes.Server.JGKC.RollManager;
namespace Core.XgMes.Server.JGKC.MaterialManager
{
    public class Metarial : Core.Mes.ServerFrameWork.IComponent
    {
        /// <summary>
        ///物料代码新增
        /// </summary>
        /// <param name=" "></param>
        /// <returns></returns>
        public ReturnObject MetarilAdd(ArrayList MetarilInfo)
        {
            try
            {
                string err = "";
               
                Oracle.DataAccess.Client.OracleParameter pMetarilInfo = new Oracle.DataAccess.Client.OracleParameter("vMetarilInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pMetarilInfo.Direction = ParameterDirection.Input;
               
                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pMetarilInfo.Value = MetarilInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[MetarilInfo.Count];
                for (int i = 0; i < MetarilInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pMetarilInfo.Size = MetarilInfo.Count;
                pMetarilInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.MetarilManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pMetarilInfo, 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 EDIT_PRICE(string MATERIALCODE, string price, string total_price, string STOCK_INITIAL)
        {
            try
            {
                string strOut = "";
                string sqlstr = "update KCJ_STORESMAGNAGER1 set ";

                sqlstr = sqlstr + " PRICE = '" + price + "',TOTAL_PRICE = '" + total_price + "',STOCK_INITIAL = '" + STOCK_INITIAL+"'";
                sqlstr = sqlstr + " where MATERIALCODE = '" + MATERIALCODE + "' ";
                this.DBManager.ExecuteQuery(sqlstr, out strOut);
                if (strOut.Length == 0)
                {
                    return new ReturnObject("1");//success
                }
                else
                {
                    return new ReturnObject(strOut.ToString());//cuowu
                }

            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return new ReturnObject(null, ex.ToString());
            }
        }
        /// <summary>
        ///物料代码新增（新）
        /// </summary>
        /// <param name=" "></param>
        /// <returns></returns>
        public ReturnObject MetarilAddNew(ArrayList MetarilInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pMetarilInfo = new Oracle.DataAccess.Client.OracleParameter("vMetarilInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pMetarilInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pMetarilInfo.Value = MetarilInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[MetarilInfo.Count];
                for (int i = 0; i < MetarilInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pMetarilInfo.Size = MetarilInfo.Count;
                pMetarilInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.MetarilManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pMetarilInfo, pSuccessFlag }, out err);*/
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.MetarilManager", CommandType.StoredProcedure,
                       new Oracle.DataAccess.Client.OracleParameter[] { pMetarilInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject ProviderAdd(ArrayList MetarilInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pMetarilInfo = new Oracle.DataAccess.Client.OracleParameter("vMetarilInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pMetarilInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pMetarilInfo.Value = MetarilInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[MetarilInfo.Count];
                for (int i = 0; i < MetarilInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pMetarilInfo.Size = MetarilInfo.Count;
                pMetarilInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.ProviderManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pMetarilInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject DepotAdd(ArrayList DepotInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pDepotInfo = new Oracle.DataAccess.Client.OracleParameter("vDepotInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pDepotInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pDepotInfo.Value = DepotInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[DepotInfo.Count];
                for (int i = 0; i < DepotInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pDepotInfo.Size = DepotInfo.Count;
                pDepotInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.DepotManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pDepotInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject DepotAddNew(ArrayList DepotInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pDepotInfo = new Oracle.DataAccess.Client.OracleParameter("vDepotInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pDepotInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pDepotInfo.Value = DepotInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[DepotInfo.Count];
                for (int i = 0; i < DepotInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pDepotInfo.Size = DepotInfo.Count;
                pDepotInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.DepotManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pDepotInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject MAterIaLBAdd(ArrayList MetarilLBInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pMetarilLBInfo = new Oracle.DataAccess.Client.OracleParameter("vMetarilLBInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pMetarilLBInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pMetarilLBInfo.Value = MetarilLBInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[MetarilLBInfo.Count];
                for (int i = 0; i < MetarilLBInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pMetarilLBInfo.Size = MetarilLBInfo.Count;
                pMetarilLBInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.MetarilLBManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pMetarilLBInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject CheckerAdd(ArrayList CheckerInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pCheckerInfo = new Oracle.DataAccess.Client.OracleParameter("vCheckerInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pCheckerInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pCheckerInfo.Value = CheckerInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[CheckerInfo.Count];
                for (int i = 0; i < CheckerInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pCheckerInfo.Size = CheckerInfo.Count;
                pCheckerInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.CheckerManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pCheckerInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject ProcureAdd(ArrayList ProcureInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pProcureInfo = new Oracle.DataAccess.Client.OracleParameter("vProcureInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pProcureInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pProcureInfo.Value = ProcureInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[ProcureInfo.Count];
                for (int i = 0; i < ProcureInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pProcureInfo.Size = ProcureInfo.Count;
                pProcureInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.ProcureManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pProcureInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject AccpetSheetAdd(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);
                /*使用新的进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject AccpetSheetAddNew(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject AccpetSheetAddNewZK(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.SheetManagerZK", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject AccpetSheetAddNewVR(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.SheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.SheetManagerVR", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PickingSheetAdd(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);
                //使用新的存储过程进行测试
                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PickingSheetAddNew(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的存储过程进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PickingMIDInSheetAddNew(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的存储过程进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.MIDInPickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PickingMIDOutSheetAddNew(ArrayList SheetInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pSheetInfo = new Oracle.DataAccess.Client.OracleParameter("vSheetInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pSheetInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pSheetInfo.Value = SheetInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[SheetInfo.Count];
                for (int i = 0; i < SheetInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pSheetInfo.Size = SheetInfo.Count;
                pSheetInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, pSuccessFlag }, out err);*/
                //使用新的存储过程进行测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.MIDOutPickingSheetManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pSheetInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject StockAdd(ArrayList StockInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pStockInfo = new Oracle.DataAccess.Client.OracleParameter("vStockInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pStockInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pStockInfo.Value = StockInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[StockInfo.Count];
                for (int i = 0; i < StockInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pStockInfo.Size = StockInfo.Count;
                pStockInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.StockManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pStockInfo, pSuccessFlag }, out err);
                //使用新的测试
                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.StockManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pStockInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject StockAddNew(ArrayList StockInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pStockInfo = new Oracle.DataAccess.Client.OracleParameter("vStockInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pStockInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pStockInfo.Value = StockInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[StockInfo.Count];
                for (int i = 0; i < StockInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pStockInfo.Size = StockInfo.Count;
                pStockInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                /*((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.StockManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pStockInfo, pSuccessFlag }, out err);*/
                //使用新的测试
                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_SFCJL.StockManager", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pStockInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PlanSBAdd(ArrayList PlansbInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pPlanInfo = new Oracle.DataAccess.Client.OracleParameter("vPlanInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pPlanInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pPlanInfo.Value = PlansbInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[PlansbInfo.Count];
                for (int i = 0; i < PlansbInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pPlanInfo.Size = PlansbInfo.Count;
                pPlanInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PlanSB", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pPlanInfo, 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=" "></param>
        /// <returns></returns>
        public ReturnObject PlanSPAdd(ArrayList PlansbInfo)
        {
            try
            {
                string err = "";

                Oracle.DataAccess.Client.OracleParameter pPlanInfo = new Oracle.DataAccess.Client.OracleParameter("vPlanInfo", Oracle.DataAccess.Client.OracleDbType.Varchar2);

                Oracle.DataAccess.Client.OracleParameter pSuccessFlag = new Oracle.DataAccess.Client.OracleParameter("vSuccessFlag", Oracle.DataAccess.Client.OracleDbType.Varchar2);


                pPlanInfo.Direction = ParameterDirection.Input;

                pSuccessFlag.Direction = ParameterDirection.Output;


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


                pPlanInfo.Value = PlansbInfo.ToArray(typeof(string));





                int[] HSizeInf = new int[PlansbInfo.Count];
                for (int i = 0; i < PlansbInfo.Count; i++)
                {
                    HSizeInf[i] = 200;
                }
                pPlanInfo.Size = PlansbInfo.Count;
                pPlanInfo.ArrayBindSize = HSizeInf;

                pSuccessFlag.Size = 400;

                ((STMes.DBManager)DBManagerList["ODPDBZW"]).ExecuteNonQuery_NoDBSever("KCJ_METARILZW.PlanSP", CommandType.StoredProcedure,
                        new Oracle.DataAccess.Client.OracleParameter[] { pPlanInfo, 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());
            }
        }

    }
}
