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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询卡申请登记簿信息
    /// 通过申请序号或卡号或证件信息查询卡申请登记簿
    /// </summary>
    public class QueryCardApplicationRregister : TFOutput
    {
        #region Output
        /// <summary>
        /// 申请人客户号 0280
        /// 
        /// </summary>
        public string SQRKHH { get; internal set; }

        /// <summary>
        /// 被申请人客户号 0290
        /// 
        /// </summary>
        public string BSQRKHH { get; internal set; }

        /// <summary>
        /// 申请卡号 0300
        /// 
        /// </summary>
        public string SQKH { get; internal set; }

        /// <summary>
        /// 主卡卡号 0310
        /// 
        /// </summary>
        public string ZKKH { get; internal set; }

        /// <summary>
        /// 原卡号 0380
        /// 
        /// </summary>
        public string YKH { get; internal set; }

        /// <summary>
        /// 申请序号 0540
        /// 
        /// </summary>
        public string SQXH { get; internal set; }

        /// <summary>
        /// 申通过请标志 0670
        /// 0通过 1不通过 2申请未审批
        /// </summary>
        public string STGQBZ { get; internal set; }

        /// <summary>
        /// 发卡标志(制卡状态) 0680
        /// 0申请 1记名卡已确认制卡 2非记名卡已确认制卡 3已制卡,待确认制卡完成 e申请错误
        /// </summary>
        public string FKBZZKZT { get; internal set; }

        /// <summary>
        /// 凭证是否入库 0690
        /// Y入库 N未入库
        /// </summary>
        public string PZSFRK { get; internal set; }

        /// <summary>
        /// 申请标志 1026
        /// 0主卡申请  1附卡申请 2换卡不换号申请(主卡) 3换卡换号申请(主卡) 4 E卡通申请 5附卡换卡不换 6附卡换卡换号 7机构不记名申请 8一户通换卡不换号 9一户通换卡换号
        /// </summary>
        public string SQBZ { get; internal set; }

        /// <summary>
        /// 申请人证件号码 102A
        /// 
        /// </summary>
        public string SQRZJHM { get; internal set; }

        /// <summary>
        /// 申请人证件类型 102G
        /// 
        /// </summary>
        public string SQRZJLX { get; internal set; }

        /// <summary>
        /// 制卡批次 102U
        /// 
        /// </summary>
        public string ZKPC { get; internal set; }

        /// <summary>
        /// 介质代码 1161
        /// 
        /// </summary>
        public string JZDM { get; internal set; }

        /// <summary>
        /// 申请人户名 0250
        /// 
        /// </summary>
        public string SQRHM { get; internal set; }

        /// <summary>
        /// 申请人与被申请人关系 0700
        /// 
        /// </summary>
        public string SQGX { get; internal set; }

        /// <summary>
        /// 启用方式 0710
        /// 
        /// </summary>
        public string QYFS { get; internal set; }

        /// <summary>
        /// 申请方式 0720
        /// 
        /// </summary>
        public string SQFS { get; internal set; }

        /// <summary>
        /// 领取方式 0730
        /// 
        /// </summary>
        public string LQFS { get; internal set; }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 卡号 0300
            ///  
            /// </summary>
            public string KH { get; set; }

            /// <summary>
            /// 申请序号 0540
            ///  
            /// </summary>
            public string SQXH { get; set; }

            /// <summary>
            /// 证件号码 102A
            ///  
            /// </summary>
            public string ZJHM { get; set; }

            /// <summary>
            /// 证件类型 102G
            ///  
            /// </summary>
            public string ZJLX { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCardApplicationRregister();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K038";
                MessageData.Fd30 = KH;
                MessageData.Fd54 = SQXH;
                MessageData.Fd102_A = ZJHM;
                MessageData.Fd102_G = ZJLX;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.SQRKHH = DelSpace(MessageData.Fd28);
                output.BSQRKHH = DelSpace(MessageData.Fd29);
                output.SQKH = DelSpace(MessageData.Fd30);
                output.ZKKH = DelSpace(MessageData.Fd31);
                output.YKH = DelSpace(MessageData.Fd38);
                output.SQXH = DelSpace(MessageData.Fd54);
                output.STGQBZ = DelSpace(MessageData.Fd67);
                output.FKBZZKZT = DelSpace(MessageData.Fd68);
                output.PZSFRK = DelSpace(MessageData.Fd69);
                output.SQBZ = DelSpace(MessageData.Fd102_6);
                output.SQRZJHM = DelSpace(MessageData.Fd102_A);
                output.SQRZJLX = DelSpace(MessageData.Fd102_G);
                output.ZKPC = DelSpace(MessageData.Fd102_U);
                output.JZDM = DelSpace(MessageData.Fd116_1);
                output.SQRHM = (MessageData.Fd25);
                output.SQGX = (MessageData.Fd70);
                output.QYFS = (MessageData.Fd71);
                output.SQFS = (MessageData.Fd72);
                output.LQFS = (MessageData.Fd73);
                return output;
            }
        }
        #endregion
    }
}
