using System;

namespace RGD.MdsAPI.WMS
{
    public class getInOutCheckInfo : PlatformBase
    {
        /// <summary>入参定义
        /// 入参定义
        /// </summary>
        [Serializable]
        public class PARA : Base.InPara
        {
            private string _wh_id;

            private string _task_no;

            private string _oper_no;

            private string _io_flag;

            private string _box_bar_codes;

            private string _bar_codes;

            private string _loc_no;

            public string WH_ID
            {
                get { return this._wh_id; }
                set { this._wh_id = value; }
            }

            public string TASK_NO
            {
                get { return this._task_no; }
                set { this._task_no = value; }
            }

            public string OPER_NO
            {
                get { return this._oper_no; }
                set { this._oper_no = value; }
            }

            public string IO_FLAG
            {
                get { return this._io_flag; }
                set { this._io_flag = value; }
            }

            public string BOX_BAR_CODES
            {
                get { return this._box_bar_codes; }
                set { this._box_bar_codes = value; }
            }

            public string BAR_CODES
            {
                get { return this._bar_codes; }
                set { this._bar_codes = value; }
            }

            public string LOC_NO
            {
                get { return this._loc_no; }
                set { this._loc_no = getWMS_LOC_NO(value); }
            }
        }

        /// <summary>出参定义
        /// 出参定义
        /// </summary>
        [Serializable]
        public class DATA : Base.OutPara
        {
            private string _box_type;
            private string _is_lastbox;
            private string _is_restack;
            private string _is_det;
            private string _repick_num;
            private string _repick_array;
            private string _out_mode;
            private string _box_lable;
            private string _box_num;

            public string BOX_TYPE
            {
                get { return this._box_type; }
                set { this._box_type = value; }
            }

            public string IS_LASTBOX
            {
                get { return this._is_lastbox; }
                set { this._is_lastbox = value; }
            }

            public string IS_RESTACK
            {
                get { return this._is_restack; }
                set { this._is_restack = value; }
            }

            public string IS_DET
            {
                get { return this._is_det; }
                set { this._is_det = value; }
            }

            public string REPICK_NUM
            {
                get { return this._repick_num; }
                set { this._repick_num = value; }
            }

            public string REPICK_ARRAY
            {
                get { return this._repick_array; }
                set { this._repick_array = value; }
            }

            /// <summary>
            /// 1：整箱出库；2：整箱回库；3：拣选出库；4：贴标回库；5：贴标出库。
            /// </summary>
            public string OUT_MODE
            {
                get { return this._out_mode; }
                set { this._out_mode = value; }
            }

            public string BOX_LABLE
            {
                get { return this._box_lable; }
                set { this._box_lable = value; }
            }

            public string BOX_NUM
            {
                get { return this._box_num; }
                set { this._box_num = value; }
            }
        }

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

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

        public getInOutCheckInfo()
        {
            this._inPara = new PARA();
        }

        /// <summary>通知
        /// 通知
        /// </summary>
        /// <param name="IO_TASK_NO">任务单号</param>
        /// <param name="ePLAN_STATUS">任务状态</param>
        /// <param name="sResult">返回结果</param>
        /// <returns></returns>
        public bool Notify(string TASK_NO, string IO_FLAG, string LOC_NO, string BOX_BAR_CODES, string BAR_CODES, out string sResult)
        {
            bool bResult = true;

            sResult = string.Empty;

            string sXmlOut = string.Empty;

            try
            {
                this._inPara.WH_ID = GetWarehouseIndex();

                this._inPara.TASK_NO = TASK_NO;

                this._inPara.OPER_NO = GetOperNo();

                this._inPara.IO_FLAG = IO_FLAG;

                this._inPara.BOX_BAR_CODES = BOX_BAR_CODES;

                this._inPara.BAR_CODES = BAR_CODES;

                this._inPara.LOC_NO = LOC_NO;

                string sXmlIn = this.Serializer<PARA>(this._inPara);

                bResult = this.getInOutCheckInfo(sXmlIn, out sXmlOut);

                //调用服务成功
                if (bResult)
                {
                    this._outPara = this.DeSerialize<DATA>(sXmlOut);

                    bResult = this._outPara.RESULT_FLAG.Equals(Enum.RESULT_FLAG.Success.ToString("d"));

                    sResult = sXmlOut;
                }

                return bResult;
            }
            catch (Exception ex)
            {
                bResult = false;

                sResult = string.Format(ex.Message);
            }

            return bResult;
        }
    }
}