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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询账户计划扣划信息
    /// 通过账号查询账户计划扣划信息
    /// </summary>
    public class QueryAccountDeductInfo : TFOutput
    {
        #region Output
        /// <summary>
        /// 账户扣划信息
        /// 账户序号|冻结序号|扣划类型|扣划周期|起始日期|终止日期|固定扣划金额|计划扣划总额|已扣划总额|已扣划笔数|上次扣划日期|扣划机构|扣划柜员|备注|
        /// </summary>
        public string ZHKHXX { get; internal set; }

        /// <summary>
        /// 账户扣划信息
        /// 账户序号|冻结序号|扣划类型|扣划周期|起始日期|终止日期|固定扣划金额|计划扣划总额|已扣划总额|已扣划笔数|上次扣划日期|扣划机构|扣划柜员|备注|
        /// </summary>
        public List<E_ZHKHXX> ZHKHXXData { get; internal set; }

        /// <summary>
        /// 账户扣划信息
        /// 账户序号|冻结序号|扣划类型|扣划周期|起始日期|终止日期|固定扣划金额|计划扣划总额|已扣划总额|已扣划笔数|上次扣划日期|扣划机构|扣划柜员|备注|
        /// </summary>
        public class E_ZHKHXX
        {
            /// <summary>
            /// 账户序号
            /// </summary>
            public string ZHXH { get; set; }

            /// <summary>
            /// 冻结序号
            /// </summary>
            public string DJXH { get; set; }

            /// <summary>
            /// 扣划类型
            /// </summary>
            public string KHLX { get; set; }

            /// <summary>
            /// 扣划周期
            /// </summary>
            public string KHZQ { get; set; }

            /// <summary>
            /// 起始日期
            /// </summary>
            public string QSRQ { get; set; }

            /// <summary>
            /// 终止日期
            /// </summary>
            public string ZZRQ { get; set; }

            /// <summary>
            /// 固定扣划金额
            /// </summary>
            public string GDKHJE { get; set; }

            /// <summary>
            /// 计划扣划总额
            /// </summary>
            public string JHKHZE { get; set; }

            /// <summary>
            /// 已扣划总额
            /// </summary>
            public string YKHZE { get; set; }

            /// <summary>
            /// 已扣划笔数
            /// </summary>
            public string YKHBS { get; set; }

            /// <summary>
            /// 上次扣划日期
            /// </summary>
            public string SCKHRQ { get; set; }

            /// <summary>
            /// 扣划机构
            /// </summary>
            public string KHJG { get; set; }

            /// <summary>
            /// 扣划柜员
            /// </summary>
            public string KHGY { get; set; }

            /// <summary>
            /// 备注
            /// </summary>
            public string BZ { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 账号 0300
            /// (null) 
            /// </summary>
            public string ZH { get; set; }

            /// <summary>
            /// 账户序号 0340
            /// (null) 
            /// </summary>
            public string ZHXH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryAccountDeductInfo();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd30 = ZH;
                MessageData.Fd34 = ZHXH;
                MessageData.Fd128 = "0012";

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.ZHKHXXData = AnilyzeFileData<E_ZHKHXX>(MessageData.FileData,
                                            "账户序号|冻结序号|扣划类型|扣划周期|起始日期|终止日期|固定扣划金额|计划扣划总额|已扣划总额|已扣划笔数|上次扣划日期|扣划机构|扣划柜员|备注|",
                                            x =>
                                            {
                                                return new E_ZHKHXX
                                                {
                                                    ZHXH = x["账户序号"],
                                                    DJXH = x["冻结序号"],
                                                    KHLX = x["扣划类型"],
                                                    KHZQ = x["扣划周期"],
                                                    QSRQ = x["起始日期"],
                                                    ZZRQ = x["终止日期"],
                                                    GDKHJE = x["固定扣划金额"],
                                                    JHKHZE = x["计划扣划总额"],
                                                    YKHZE = x["已扣划总额"],
                                                    YKHBS = x["已扣划笔数"],
                                                    SCKHRQ = x["上次扣划日期"],
                                                    KHJG = x["扣划机构"],
                                                    KHGY = x["扣划柜员"],
                                                    BZ = x["备注"]
                                                };
                                            });
                output.ZHKHXX = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
