Пример #1
0
        /// <summary>
        /// 从本地数据读取IDOC数据,并解析成IDOC对象。
        /// </summary>
        /// <param name="pIdocNumber">IDOC编号</param>
        /// <param name="SystemName">此处的SAP系统名称用于本地数据库检索</param>
        /// <returns></returns>
        public Idoc ReadIdoc(string pIdocNumber, String SystemName)
        {
            try
            {
                idocHeader = new DataTable();
                idocItem = new DataTable();
                idocStatus = new DataTable();
                logicDb.DataTableFill(idocHeader, string.Format("select * from EDIDC where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                logicDb.DataTableFill(idocItem, string.Format("select * from EDID4 where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                logicDb.DataTableFill(idocStatus, string.Format("select * from EDIDS where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }

                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                if (idocHeader != null && idocItem != null)
                {
                    SAPINT.Idocs.Meta.IdocUtil idocUtil = new SAPINT.Idocs.Meta.IdocUtil();
                    SAPINT.Idocs.Idoc idoc = idocUtil.ProcessSingleIdocFromDataTable(idocHeader, idocItem);
                    return idoc;
                }
                else
                {
                    return null;
                }

            }
            catch (Exception exception)
            {

                throw new Exception(exception.Message);
            }

        }
Пример #2
0
        /// <summary>
        /// 从本地数据读取IDOC数据,并解析成IDOC对象。
        /// </summary>
        /// <param name="pIdocNumber">IDOC编号</param>
        /// <param name="SystemName">此处的SAP系统名称用于本地数据库检索</param>
        /// <returns></returns>
        public Idoc ReadIdoc(string pIdocNumber, String SystemName)
        {
            try
            {
                idocHeader = new DataTable();
                idocItem = new DataTable();
                idocStatus = new DataTable();
                logicDb.DataTableFill(idocHeader, string.Format("select * from EDIDC where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                logicDb.DataTableFill(idocItem, string.Format("select * from EDID4 where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                logicDb.DataTableFill(idocStatus, string.Format("select * from EDIDS where DOCNUM = '{0}' and SAPSYS = '{1}'", pIdocNumber, SystemName));
                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }

                if (!String.IsNullOrWhiteSpace(logicDb.ErrorMessage))
                {
                    throw new Exception(logicDb.ErrorMessage);
                }
                if (idocHeader != null && idocItem != null)
                {
                    SAPINT.Idocs.Meta.IdocUtil idocUtil = new SAPINT.Idocs.Meta.IdocUtil();
                    SAPINT.Idocs.Idoc idoc = idocUtil.ProcessSingleIdocFromDataTable(idocHeader, idocItem);
                    return idoc;
                }
                else
                {
                    return null;
                }

            }
            catch (Exception exception)
            {

                throw new Exception(exception.Message);
            }
        }