using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询存款证明明细表
    /// 根据止付日期和止付流水查询存款证明明细表
    /// </summary>
    public class QueryDepositRecordList : TFOutput
    {
        #region Output
        /// <summary>
        /// 明细列表
        /// ~止付日期|止付流水|凭证号码|状态|签发日期|签发流水|签发柜员|原凭证号|
        /// </summary>
        public string LB { get; internal set; }

        /// <summary>
        /// 明细列表
        /// ~止付日期|止付流水|凭证号码|状态|签发日期|签发流水|签发柜员|原凭证号|
        /// </summary>
        public List<E_LB> LBData { get; internal set; }

        /// <summary>
        /// 明细列表
        /// ~止付日期|止付流水|凭证号码|状态|签发日期|签发流水|签发柜员|原凭证号|
        /// </summary>
        public class E_LB
        {
            /// <summary>
            /// 止付日期
            /// </summary>
            public string ZFRQ { get; set; }

            /// <summary>
            /// 止付流水
            /// </summary>
            public string ZFLS { get; set; }

            /// <summary>
            /// 凭证号码
            /// </summary>
            public string PZHM { get; set; }

            /// <summary>
            /// 状态
            /// </summary>
            public string ZT { get; set; }

            /// <summary>
            /// 签发日期
            /// </summary>
            public string QFRQ { get; set; }

            /// <summary>
            /// 签发流水
            /// </summary>
            public string QFLS { get; set; }

            /// <summary>
            /// 签发柜员
            /// </summary>
            public string QFGY { get; set; }

            /// <summary>
            /// 原凭证号
            /// </summary>
            public string YPZH { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 止付日期 0440
            ///  
            /// </summary>
            public string ZFRQ { get; set; }

            /// <summary>
            /// 止付流水 1263
            ///  
            /// </summary>
            public string ZFLS { get; set; }

            /// <summary>
            /// 状态 0670
            /// 状态 0-正常 1-换发 2-撤销 3-补发 
            /// </summary>
            public string ZT { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryDepositRecordList();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd44 = ZFRQ;
                MessageData.Fd126_3 = ZFLS;
                MessageData.Fd128 = "0075";
                MessageData.Fd67 = ZT;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.LBData = AnilyzeFileData<E_LB>(MessageData.FileData,
                                            "止付日期|止付流水|凭证号码|状态|签发日期|签发流水|签发柜员|原凭证号|",
                                            x =>
                                            {
                                                return new E_LB
                                                {
                                                    ZFRQ = x["止付日期"],
                                                    ZFLS = x["止付流水"],
                                                    PZHM = x["凭证号码"],
                                                    ZT = x["状态"],
                                                    QFRQ = x["签发日期"],
                                                    QFLS = x["签发流水"],
                                                    QFGY = x["签发柜员"],
                                                    YPZH = x["原凭证号"]
                                                };
                                            });
                output.LB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
