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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询承兑汇票票据信息
    /// 根据输入的承兑汇票号码查询该票据信息
    /// </summary>
    public class QueryAcceptanceInformation : TFOutput
    {
        #region Output
        /// <summary>
        /// 签发编号 0170
        /// (null)
        /// </summary>
        public string QFBH { get; internal set; }

        /// <summary>
        /// 收款人名称 0270
        /// (null)
        /// </summary>
        public string SKRMC { get; internal set; }

        /// <summary>
        /// 协议编号 0310
        /// (null)
        /// </summary>
        public string XYBH { get; internal set; }

        /// <summary>
        /// 收到委托日期 0450
        /// (null)
        /// </summary>
        public string SDWTRQ { get; internal set; }

        /// <summary>
        /// 签发日期 0460
        /// (null)
        /// </summary>
        public string QFRQ { get; internal set; }

        /// <summary>
        /// 核销日期 0470
        /// (null)
        /// </summary>
        public string HXRQ { get; internal set; }

        /// <summary>
        /// 承兑汇票状态 0680
        /// 1：签发；2：核销；（状态为核销后才能兑付承兑）3：退票；4：托收 5:承兑汇票已入库；9：外行的承兑汇票过来质押。
        /// </summary>
        public string CDHPZT { get; internal set; }

        /// <summary>
        /// 到期处理标志 0700
        /// Y：到期；N：未到期
        /// </summary>
        public string DQCLBZ { get; internal set; }

        /// <summary>
        /// 是否有该票据 0720
        /// 0否1有
        /// </summary>
        public string SFYGPJ { get; internal set; }

        /// <summary>
        /// 收款人开户行行名 0810
        /// (null)
        /// </summary>
        public string SKRKHXXM { get; internal set; }

        /// <summary>
        /// 收款人账号 0830
        /// (null)
        /// </summary>
        public string SKRZH { get; internal set; }

        /// <summary>
        /// 签发机构 0910
        /// (null)
        /// </summary>
        public string QFJG { get; internal set; }

        /// <summary>
        /// 承兑汇票标志 0930
        /// 0：挂失；1：正常；2:止付
        /// </summary>
        public string CDHPBZ { get; internal set; }

        /// <summary>
        /// 票面金额 1001
        /// (null)
        /// </summary>
        public string PMJE { get; internal set; }

        /// <summary>
        /// 承兑汇票手续费
        /// </summary>
        public string CDHPSXF { get; internal set; }

        /// <summary>
        ///承兑汇票敞口费
        /// (null)
        /// </summary>
        public string CDHPCKF { get; internal set; }

        #endregion

        #region Input
        /// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 承兑汇票号码 0580
            /// (null) 
            /// </summary>
            public string CDHPHM { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryAcceptanceInformation();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
                MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K002";
                MessageData.Fd58 = CDHPHM;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }
                output.QFBH = DelSpace(MessageData.Fd17);
                output.SKRMC = DelSpace(MessageData.Fd27);
                output.XYBH = DelSpace(MessageData.Fd31);
                output.SDWTRQ = DelSpace(MessageData.Fd45);
                output.CDHPSXF = DelSpace(MessageData.Fd41);
                output.CDHPCKF = DelSpace(MessageData.Fd42);
                output.QFRQ = DelSpace(MessageData.Fd46);
                output.HXRQ = DelSpace(MessageData.Fd47);
                output.CDHPZT = DelSpace(MessageData.Fd68);
                output.DQCLBZ = DelSpace(MessageData.Fd70);
                output.SFYGPJ = DelSpace(MessageData.Fd72);
                output.SKRKHXXM = DelSpace(MessageData.Fd81);
                output.SKRZH = DelSpace(MessageData.Fd83);
                output.QFJG = DelSpace(MessageData.Fd91);
                output.CDHPBZ = DelSpace(MessageData.Fd93);
                output.PMJE = DelSpace(MessageData.Fd100_1);

                return output;
            }
        }
        #endregion
    }
}
