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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询贷款账号信息
    /// 通过贷款账号查询账户信息
    /// </summary>
    public class QueryLoanAccount : TFOutput
    {
        #region Output
        /// <summary>
        /// 开户机构 0020
        /// 
        /// </summary>
        public string KHJG { get; internal set; }

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

        /// <summary>
        /// 户名 0250
        /// 
        /// </summary>
        public string HM { get; internal set; }

        /// <summary>
        /// 借据号 0310
        /// 
        /// </summary>
        public string JJH { get; internal set; }

        /// <summary>
        /// 放款账号 0320
        /// 
        /// </summary>
        public string FKZH { get; internal set; }

        /// <summary>
        /// 还款账号1 0330
        /// 
        /// </summary>
        public string HKZH1 { get; internal set; }

        /// <summary>
        /// 贷款账户序号 0340
        /// 
        /// </summary>
        public string ZHXH { get; internal set; }

        /// <summary>
        /// 还款账号2 0370
        /// 
        /// </summary>
        public string HKZH2 { get; internal set; }

        /// <summary>
        /// 还款账号3 0380
        /// 
        /// </summary>
        public string HKZH3 { get; internal set; }

        /// <summary>
        /// 贷款现余额 0390
        /// 
        /// </summary>
        public string DKXYE { get; internal set; }

        /// <summary>
        /// 计划放款额 0400
        /// 
        /// </summary>
        public string JHFKE { get; internal set; }

        /// <summary>
        /// 放款余额 0410
        /// 
        /// </summary>
        public string FKYE { get; internal set; }

        /// <summary>
        /// 表内欠息 0420
        /// 
        /// </summary>
        public string BNQX { get; internal set; }

        /// <summary>
        /// 表外欠息 0430
        /// 
        /// </summary>
        public string BWQX { get; internal set; }

        /// <summary>
        /// 还款日 0440
        /// 
        /// </summary>
        public string HKR { get; internal set; }

        /// <summary>
        /// 担保方式 0660
        /// 3抵押  4信用 5保证 7委托 B质押
        /// </summary>
        public string DBFS { get; internal set; }

        /// <summary>
        /// 贷款类型 0670
        /// 1、普通贷款 2、按揭贷款 5、承兑垫款7、委托贷款 9、贴现 A、授信贷款 B、卡内融资、质押消费贷款
        /// </summary>
        public string DKLX { get; internal set; }

        /// <summary>
        /// 账户状态 0680
        /// 参考ln_mst中ac_sts字段
        /// </summary>
        public string ZHZT { get; internal set; }

        /// <summary>
        /// 活期账户状态 0690
        /// 参考dd_mst中ac_sts字段
        /// </summary>
        public string HQZHZT { get; internal set; }

        /// <summary>
        /// 活期账户冻结状态 0700
        /// 参考dd_mst中hold_sts字段
        /// </summary>
        public string HQZHDJZT { get; internal set; }

        /// <summary>
        /// 活期账户止付状态 0710
        /// 参考dd_mst中zf_sts字段
        /// </summary>
        public string HQZHZFZT { get; internal set; }

        /// <summary>
        /// 展期标志 0720
        /// 参考ln_mst中exp_ind字段
        /// </summary>
        public string ZQBZ { get; internal set; }

        /// <summary>
        /// 合同利率 0840
        /// 
        /// </summary>
        public string HTLL { get; internal set; }

        /// <summary>
        /// 合同利率浮动比 0850
        /// 
        /// </summary>
        public string HTLLFDB { get; internal set; }

        /// <summary>
        /// 开户机构号 0910
        /// 
        /// </summary>
        public string KHJGH { get; internal set; }

        /// <summary>
        /// 委托关联标志 0930
        /// 
        /// </summary>
        public string WTGLBZ { get; internal set; }

        /// <summary>
        /// 利率类型 0980
        /// Y-年利率，M-月利率
        /// </summary>
        public string LLLX { get; internal set; }

        /// <summary>
        /// 复利欠息 1001
        /// 
        /// </summary>
        public string FLQX { get; internal set; }

        /// <summary>
        /// 还息账号1 1011
        /// 
        /// </summary>
        public string HXZH1 { get; internal set; }

        /// <summary>
        /// 本期本金(按揭) 1013
        /// 本期本金(按揭)
        /// </summary>
        public string BQBJ { get; internal set; }

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

        /// <summary>
        /// 还息账号2 1021
        /// 
        /// </summary>
        public string HXZH2 { get; internal set; }

        /// <summary>
        /// 凭证种类 1023
        /// 
        /// </summary>
        public string PZZL { get; internal set; }

        /// <summary>
        /// 本期利息(按揭) 102F
        /// 本期利息(按揭)
        /// </summary>
        public string BQLX { get; internal set; }

        /// <summary>
        /// 贷款放款产品名称 102V
        /// 
        /// </summary>
        public string CPMC { get; internal set; }

        /// <summary>
        /// 还息账号3 102W
        /// 
        /// </summary>
        public string HXZH3 { get; internal set; }

        /// <summary>
        /// 开户日期 1053
        /// 
        /// </summary>
        public string KHRQ { get; internal set; }

        /// <summary>
        /// 到期日期 1054
        /// 
        /// </summary>
        public string DQRQ { get; internal set; }

        /// <summary>
        /// 客户级别 105H
        /// 0:普通级客户 1：银级客户 2：金级客户 3：白金级客户 4：钻石级客户
        /// </summary>
        public string KHJB { get; internal set; }

        /// <summary>
        /// 展期利率 105I
        /// 
        /// </summary>
        public string ZQLL { get; internal set; }

        /// <summary>
        /// 展期到期日 105J
        /// 
        /// </summary>
        public string ZQDQR { get; internal set; }

        /// <summary>
        /// 柜面还款顺序 107I
        /// B：先还本金；L：先还利息；A：不限制；
        /// </summary>
        public string GMHKSX { get; internal set; }

        /// <summary>
        /// 本金核销金额 1085
        /// 
        /// </summary>
        public string BJHXJE { get; internal set; }

        /// <summary>
        /// 利息核销金额 1086
        /// 
        /// </summary>
        public string LXHXJE { get; internal set; }

        /// <summary>
        /// 未结本金利息 1088
        /// 
        /// </summary>
        public string WJBJLX { get; internal set; }

        /// <summary>
        /// 未结复利利息 1089
        /// 
        /// </summary>
        public string WJFLLX { get; internal set; }

        /// <summary>
        /// 累计放款金额 1244
        /// 
        /// </summary>
        public string LJFKJE { get; internal set; }

        /// <summary>
        /// 基金户可用余额 1246
        /// 
        /// </summary>
        public string JJHKYYE { get; internal set; }

        /// <summary>
        /// 贷款状态 1024
        /// [空格表示没有查询相关数据]Bit[0]贷款四级(1-正常；2-逾期；3-呆滞；4-呆账) Bit[1]:贷款五级(1-正常 2-次级 3-关注 4-可疑 5-损失) Bit[2]:(0:未停息 1-停息) Bit[3]:(0-无还款计划 1-自定义还本计划 2-普通贷款按揭计划) Bit[4]:(0.正常 1.违约) BIT[5]:(0.未贴息 1.贴息) 
        /// </summary>
        public string DKZT { get; internal set; }

        /// <summary>
        /// 客户号 0280
        /// 
        /// </summary>
        public string KHH { get; internal set; }

        /// <summary>
        /// 标志位 0740
        /// [空格表示没有查询相关数据]bit[0]:是否还清标志(0-未还清  1-已还清)  bit[1]:客户类型(1-个人 2-对公)  bit[2]:计息类型(0-不计息；1-利随本清；2-按日计息；3-按月计息；4-按季计息；5-按半年计息；6-按年计息；7-按揭)  bit[3]:0-不能还本  1-可提前还本bit[4]:1-完全出库  2-未完全出库 bit[6]:还款账号介质状态 0-正常，非0-不正常 bit[7]:还款方式 bit[8]:收款账号介质状态 0-正常，非0-不正常
        /// </summary>
        public string BZW { get; internal set; }

        /// <summary>
        /// 授信到期日 0460
        /// 
        /// </summary>
        public string SXDQR { get; internal set; }

        /// <summary>
        /// 最早还本日期 0470
        /// 
        /// </summary>
        public string ZZHBRQ { get; internal set; }

        /// <summary>
        /// 合同号 1197
        /// 
        /// </summary>
        public string HTH { get; internal set; }

        /// <summary>
        /// 贷款产品名称 101F
        /// 
        /// </summary>
        public string DKCPMC { get; internal set; }

        /// <summary>
        /// 还款账号1序号 0350
        /// 
        /// </summary>
        public string HKZHXH { get; internal set; }

        /// <summary>
        /// 正常积数值 0560
        /// 
        /// </summary>
        public string ZCJSZ { get; internal set; }

        /// <summary>
        /// 逾期积数值 0570
        /// 
        /// </summary>
        public string YQJSZ { get; internal set; }

        /// <summary>
        /// 默认还款顺序 108J
        /// 
        /// </summary>
        public string MRHKSX { get; internal set; }

        /// <summary>
        /// 账号 0300
        /// 
        /// </summary>
        public string ZH { get; internal set; }

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

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

        /// <summary>
        /// 违约利率 0970
        /// 
        /// </summary>
        public string WYLL { get; internal set; }

        /// <summary>
        /// 委托编号 102A
        /// 
        /// </summary>
        public string WTBH { get; internal set; }

        /// <summary>
        /// 逾期利率 1123
        /// 
        /// </summary>
        public string YQLL { get; internal set; }

        /// <summary>
        /// 浮比浮点等 0810
        /// |浮动方式|浮动标志|浮动比例|浮动点数|贷款基准利率|
        /// </summary>
        public string FBFDD { get; internal set; }

        /// <summary>
        /// 欠款本金(按揭) 1002
        /// 
        /// </summary>
        public string QKBJ { get; internal set; }

        /// <summary>
        /// 欠款利息(按揭) 1003
        /// 
        /// </summary>
        public string QKLX { get; internal set; }
        /// <summary>
        /// 欠款罚息(按揭) 1004
        /// 
        /// </summary>
        public string QKFX { get; internal set; }
        /// <summary>
        ///  第一还本补贴比例或金额
        /// </summary>
        public string HBBTZ1 { get; internal set; }
        /// <summary>
        /// 第二还本补贴比例或金额
        /// </summary>
        public string HBBTZ2{ get; internal set; }
        /// <summary>
        /// 第三还本补贴比例或金额
        /// </summary>
        public string HBBTZ3 { get; internal set; }
        /// <summary>
        /// 第一还息补贴比例或金额
        /// </summary>
        public string HXBTZ1 { get; internal set; }
        /// <summary>
        /// 第二还息补贴比例或金额
        /// </summary>
        public string HXBTZ2 { get; internal set; }
        /// <summary>
        /// 第三还息补贴比例或金额
        /// </summary>
        public string HXBTZ3 { get; internal set; }
        /// <summary>
        /// 文件
        /// </summary>
        public string FILEDATA { get; internal set; }
        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 贷款账号 0300
            ///  
            /// </summary>
            public string DKZH { get; set; }

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

            /// <summary>
            /// 委托编号 0620
            ///  
            /// </summary>
            public string WTBH { get; set; }

            /// <summary>
            /// 借据号 0630
            ///  
            /// </summary>
            public string JJH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryLoanAccount();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K015";
                MessageData.Fd30 = DKZH;
                MessageData.Fd34 = ZHXH;
                MessageData.Fd62 = WTBH;
                MessageData.Fd63 = JJH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.KHJG = DelSpace(MessageData.Fd2);
                output.BZ = (MessageData.Fd21);
                output.HM = (MessageData.Fd25);
                output.JJH = (MessageData.Fd31);
                output.FKZH = (MessageData.Fd32);
                output.HKZH1 = (MessageData.Fd33);
                output.ZHXH = (MessageData.Fd34);
                output.HKZH2 = (MessageData.Fd37);
                output.HKZH3 = (MessageData.Fd38);
                output.DKXYE = (MessageData.Fd39);
                output.JHFKE = (MessageData.Fd40);
                output.FKYE = (MessageData.Fd41);
                output.BNQX = (MessageData.Fd42);
                output.BWQX = (MessageData.Fd43);
                output.HKR = (MessageData.Fd44);
                output.DBFS = (MessageData.Fd66);
                output.DKLX = (MessageData.Fd67);
                output.ZHZT = (MessageData.Fd68);
                output.HQZHZT = (MessageData.Fd69);
                output.HQZHDJZT = (MessageData.Fd70);
                output.HQZHZFZT = (MessageData.Fd71);
                output.ZQBZ = (MessageData.Fd72);
                output.HTLL = (MessageData.Fd84);
                output.HTLLFDB = (MessageData.Fd85);
                output.KHJGH = (MessageData.Fd91);
                output.WTGLBZ = (MessageData.Fd93);
                output.LLLX = (MessageData.Fd98);
                output.FLQX = (MessageData.Fd100_1);
                output.HXZH1 = (MessageData.Fd101_1);
                output.BQBJ = (MessageData.Fd101_3);
                output.ZY = (MessageData.Fd101_6);
                output.HXZH2 = (MessageData.Fd102_1);
                output.PZZL = (MessageData.Fd102_3);
                output.BQLX = (MessageData.Fd102_F);
                output.CPMC = (MessageData.Fd102_V);
                output.HXZH3 = (MessageData.Fd102_W);
                output.KHRQ = (MessageData.Fd105_3);
                output.DQRQ = (MessageData.Fd105_4);
                output.KHJB = (MessageData.Fd105_H);
                output.ZQLL = (MessageData.Fd105_I);
                output.ZQDQR = (MessageData.Fd105_J);
                output.HBBTZ1 = (MessageData.Fd107_4);
                output.HBBTZ2 = (MessageData.Fd107_7);
                output.HBBTZ3 = (MessageData.Fd107_E);
                output.GMHKSX = (MessageData.Fd107_I); 
                output.HXBTZ1 = (MessageData.Fd108_4);
                output.BJHXJE = (MessageData.Fd108_5);
                output.LXHXJE = (MessageData.Fd108_6);
                output.HXBTZ2 = (MessageData.Fd108_7);
                output.WJBJLX = (MessageData.Fd108_8);
                output.WJFLLX = (MessageData.Fd108_9);
                output.HXBTZ3 = (MessageData.Fd108_E);
                output.LJFKJE = (MessageData.Fd124_4);
                output.JJHKYYE = (MessageData.Fd124_6);
                output.DKZT = (MessageData.Fd102_4);
                output.KHH = (MessageData.Fd28);
                output.BZW = (MessageData.Fd74);
                output.SXDQR = (MessageData.Fd46);
                output.ZZHBRQ = (MessageData.Fd47);
                output.HTH = (MessageData.Fd119_7);
                output.DKCPMC = (MessageData.Fd101_F);
                output.HKZHXH = (MessageData.Fd35);
                output.ZCJSZ = (MessageData.Fd56);
                output.YQJSZ = (MessageData.Fd57);
                output.MRHKSX = (MessageData.Fd108_J);
                output.ZH = (MessageData.Fd30);
                output.ZJLX = (MessageData.Fd116_4);
                output.ZJHM = (MessageData.Fd116_5);
                output.WYLL = (MessageData.Fd97);
                output.WTBH = (MessageData.Fd102_A);
                output.YQLL = (MessageData.Fd112_3);
                output.FBFDD = (MessageData.Fd81);
                output.QKBJ = (MessageData.Fd100_2);
                output.QKLX = (MessageData.Fd100_3);
                output.QKFX = (MessageData.Fd100_4);
                output.FILEDATA = MessageData.FileData;
                return output;
            }
        }
        #endregion
    }
}
