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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 柜员/ATM长短款处理信息查询
    /// 根据相关要素，返回相应长短款处理状态信息列表
    /// </summary>
    public class QueryCountTellerATMLength : TFOutput
    {
        #region Output
        /// <summary>
        /// 数据列表
        /// 后台返回文件，内容包括：处理类型；处理状态；柜员号；柜员名称；金额；机构号；日期；序号；摘要
        /// </summary>
        public string SJLB { get; internal set; }

        /// <summary>
        /// 数据列表
        /// 后台返回文件，内容包括：处理类型；处理状态；柜员号；柜员名称；金额；机构号；日期；序号；摘要
        /// </summary>
        public List<E_SJLB> SJLBData { get; internal set; }

        /// <summary>
        /// 数据列表
        /// 后台返回文件，内容包括：处理类型；处理状态；柜员号；柜员名称；金额；机构号；日期；序号；摘要
        /// </summary>
        public class E_SJLB
        {
            /// <summary>
            /// 处理类型
            /// </summary>
            public string CLLX { get; set; }

            /// <summary>
            /// 处理状态
            /// </summary>
            public string CLZT { get; set; }

            /// <summary>
            /// 柜员号
            /// </summary>
            public string GYH { get; set; }

            /// <summary>
            /// 柜员名称
            /// </summary>
            public string GYMC { get; set; }

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

            /// <summary>
            /// 机构号
            /// </summary>
            public string JGH { get; set; }

            /// <summary>
            /// 日期
            /// </summary>
            public string RQ { get; set; }

            /// <summary>
            /// 序号
            /// </summary>
            public string XH { get; set; }

            /// <summary>
            /// 摘要
            /// </summary>
            public string ZY { get; set; }

        }

        #endregion

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

            /// <summary>
            /// 日期(终止) 0450
            /// (null) 
            /// </summary>
            public string RQZZ { get; set; }

            /// <summary>
            /// 处理类型 0670
            /// 0、长款 1、短款 空-全部 
            /// </summary>
            public string CLLX { get; set; }

            /// <summary>
            /// 机构号 0910
            /// (null) 
            /// </summary>
            public string JGH { get; set; }

            /// <summary>
            /// ATM柜员号/普通柜员号 0920
            /// (null) 
            /// </summary>
            public string ATMGYHPTGYH { get; set; }

            /// <summary>
            /// 状态 0680
            /// 0-登记 1-入帐 2-冲回 空-全部 
            /// </summary>
            public string ZT { get; set; }
            /// <summary>
            /// 是否是ATM长短款 标志
            /// Y是  只返回ATM长短款
            /// </summary>
            public string ATMBZ { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCountTellerATMLength();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd44 = RQQS;
                MessageData.Fd45 = RQZZ;
                MessageData.Fd67 = CLLX;
                MessageData.Fd91 = JGH;
                MessageData.Fd92 = ATMGYHPTGYH;
                MessageData.Fd128 = "0002";
                MessageData.Fd68 = ZT;
                MessageData.Fd70 = ATMBZ;
                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.SJLBData = AnilyzeFileData<E_SJLB>(MessageData.FileData,
                                            "处理类型|处理状态|柜员号|柜员名称|金额|机构号|日期|序号|摘要|",
                                            x =>
                                            {
                                                return new E_SJLB
                                                {
                                                    CLLX = x["处理类型"],
                                                    CLZT = x["处理状态"],
                                                    GYH = x["柜员号"],
                                                    GYMC = x["柜员名称"],
                                                    JE = x["金额"],
                                                    JGH = x["机构号"],
                                                    RQ = x["日期"],
                                                    XH = x["序号"],
                                                    ZY = x["摘要"]
                                                };
                                            });
                output.SJLB = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
