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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 现金付出/接收调剂记录查询
    /// 根据相关要素，返回该柜员做过的现金付出调剂在途等待对方接收的调剂记录
    /// </summary>
    public class QueryCashPayReceiveRecords : TFOutput
    {
        #region Output
        /// <summary>
        /// 已付出调剂记录列表
        /// 后台返回文件，内容包括：调剂日期|付出柜员|付出柜员名称|接收柜员|接收柜员名称|币种|金额|
        /// </summary>
        public string YFCDJJLLB { get; internal set; }

        /// <summary>
        /// 已付出调剂记录列表
        /// 后台返回文件，内容包括：调剂日期|付出柜员|付出柜员名称|接收柜员|接收柜员名称|币种|金额|
        /// </summary>
        public List<E_YFCDJJLLB> YFCDJJLLBData { get; internal set; }

        /// <summary>
        /// 已付出调剂记录列表
        /// 后台返回文件，内容包括：调剂日期|付出柜员|付出柜员名称|接收柜员|接收柜员名称|币种|金额|
        /// </summary>
        public class E_YFCDJJLLB
        {
            /// <summary>
            /// 调剂日期
            /// </summary>
            public string DJRQ { get; set; }

            /// <summary>
            /// 付出柜员
            /// </summary>
            public string FCGY { get; set; }

            /// <summary>
            /// 付出柜员名称
            /// </summary>
            public string FCGYMC { get; set; }

            /// <summary>
            /// 接收柜员
            /// </summary>
            public string JSGY { get; set; }

            /// <summary>
            /// 接收柜员名称
            /// </summary>
            public string JSGYMC { get; set; }

            /// <summary>
            /// 币种
            /// </summary>
            public string BZ { get; set; }

            /// <summary>
            /// 金额
            /// </summary>
            public string JE { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 发生日期 0440
            /// (null) 
            /// </summary>
            public string FSRQ { get; set; }

            /// <summary>
            /// 机构号 0910
            /// 接收方查询通过该域传值 
            /// </summary>
            public string JGH { get; set; }

            /// <summary>
            /// 柜员号 0920
            /// 付出方查询通过该域传值 
            /// </summary>
            public string GYH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCashPayReceiveRecords();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd44 = FSRQ;
                MessageData.Fd91 = JGH;
                MessageData.Fd92 = GYH;
                MessageData.Fd128 = "0000";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.YFCDJJLLBData = AnilyzeFileData<E_YFCDJJLLB>(MessageData.FileData,
                                            "调剂日期|付出柜员|付出柜员名称|接收柜员|接收柜员名称|币种|金额|",
                                            x =>
                                            {
                                                return new E_YFCDJJLLB
                                                {
                                                    DJRQ = x["调剂日期"],
                                                    FCGY = x["付出柜员"],
                                                    FCGYMC = x["付出柜员名称"],
                                                    JSGY = x["接收柜员"],
                                                    JSGYMC = x["接收柜员名称"],
                                                    BZ = x["币种"],
                                                    JE = x["金额"]
                                                };
                                            });
                output.YFCDJJLLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
