using System;
using System.Collections.Generic;

namespace RGD.MdsAPI.WCS
{
    public class getWhEquipStatus : HouseBase
    {
        [Serializable]
        public class DETAIL
        {
            private string _device_no;
            private string _device_name;
            private string _cur_status;

            public string DEVICE_NO
            {
                get { return this._device_no; }
                set { this._device_no = value; }
            }

            public string DEVICE_NAME
            {
                get { return this._device_name; }
                set { this._device_name = value; }
            }

            public string CUR_STATUS
            {
                get { return this._cur_status; }
                set { this._cur_status = value; }
            }
        }

        /// <summary>
        /// 入参定义
        /// </summary>
        [Serializable]
        public class PARA
        {
            private string _wh_id;

            /// <summary>
            /// 库房编号
            /// </summary>
            public string WH_ID
            {
                get { return this._wh_id; }
                set { this._wh_id = value; }
            }
        }

        /// <summary>
        /// 出参定义
        /// </summary>
        [Serializable]
        public class DATA : Base.OutPara
        {
            private string _wh_id;
            private List<DETAIL> _detail_list;

            /// <summary>
            /// 库房编号
            /// </summary>
            public string WH_ID
            {
                get { return this._wh_id; }
                set { this._wh_id = value; }
            }

            public List<DETAIL> DETAIL_LIST
            {
                get { return this._detail_list; }
                set { this._detail_list = value; }
            }
        }

        /// <summary>
        /// 入参实体
        /// </summary>
        private PARA _inPara;

        /// <summary>
        /// 出参实体
        /// </summary>
        private DATA _outPara;

        /// <summary>
        /// 构造函数
        /// </summary>
        public getWhEquipStatus()
        {
            this._outPara = new DATA();
        }

        /// <summary>
        /// 通知
        /// </summary>
        /// <param name="sXmlIn">入参</param>
        /// <param name="sXmlOut">出参</param>
        /// <returns>执行结果</returns>
        public bool Notify(string sXmlIn, out string sXmlOut)
        {
            bool bResult = true;

            string sResult = string.Empty;

            sXmlOut = string.Empty;

            List<DETAIL> lsDETAIL_LIST = new List<DETAIL>();

            try
            {
                this._inPara = this.DeSerialize<PARA>(sXmlIn);

                bResult = null != this._inPara;

                if (!bResult)
                {
                    sResult = string.Format("入参错误（格式错误）");

                    return bResult;
                }
                bResult = this.GETWHEQUIPSTATUS(_inPara.WH_ID, out sResult, out lsDETAIL_LIST);
            }
            catch (Exception ex)
            {
                bResult = false;

                sResult = string.Format(ex.Message);
            }
            finally
            {
                if (bResult)
                {
                    this._outPara.RESULT_FLAG = Enum.RESULT_FLAG.Success.ToString("d");
                }
                else
                {
                    this._outPara.RESULT_FLAG = Enum.RESULT_FLAG.Fail.ToString("d");
                }

                this._outPara.ERROR_INFO = sResult;

                this._outPara.DETAIL_LIST = lsDETAIL_LIST;

                sXmlOut = this.Serializer<DATA>(this._outPara);
            }

            return bResult;
        }
    }
}