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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询委托收款汇票信息
    /// 根据输入的外行票据号码查询已登记的外行委托收款票据信息
    /// </summary>
    public class QueryDelegateBillInfomation : TFOutput
    {
        #region Output
        /// <summary>
        /// 机构编码 0020
        /// (null)
        /// </summary>
        public string DJJGBM { get; internal set; }

        /// <summary>
        /// 备注 1250
        /// (null)
        /// </summary>
        public string BZ { get; internal set; }

        /// <summary>
        /// 付款人全称 0260
        /// (null)
        /// </summary>
        public string FKRQC { get; internal set; }

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

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

        /// <summary>
        /// 付款人账号 0320
        /// (null)
        /// </summary>
        public string FKRZH { get; internal set; }

        /// <summary>
        /// ems 0370
        /// (null)
        /// </summary>
        public string EMS { get; internal set; }

        /// <summary>
        /// 退回ems 0380
        /// (null)
        /// </summary>
        public string THEMS { get; internal set; }

        /// <summary>
        /// 签发金额 0430
        /// (null)
        /// </summary>
        public string QFJE { get; internal set; }

        /// <summary>
        /// 申请日期 0440
        /// (null)
        /// </summary>
        public string SQRQ { get; internal set; }

        /// <summary>
        /// 到期日期 0450
        /// (null)
        /// </summary>
        public string DQRQ { get; internal set; }

        /// <summary>
        /// 接收委托日期 0460
        /// (null)
        /// </summary>
        public string JSWTRQ { get; internal set; }

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

        /// <summary>
        /// 是否存在记录 0660
        /// 0否1是
        /// </summary>
        public string SFCZJL { get; internal set; }

        /// <summary>
        /// 是否到期处理 0690
        /// 0：未到期处理；1：已到期处理
        /// </summary>
        public string SFDQCL { get; internal set; }

        /// <summary>
        /// 委托方式 0700
        /// 0-邮递 1-同城
        /// </summary>
        public string WTFS { get; internal set; }

        /// <summary>
        /// 退票标志 0710
        /// 0-否 1-是，如果承兑汇票审核不通过，需要将收到的汇票退回。
        /// </summary>
        public string TPBZ { get; internal set; }

        /// <summary>
        /// 付款行全称 0810
        /// (null)
        /// </summary>
        public string FKXQC { get; internal set; }

        /// <summary>
        /// 收款行全称 0820
        /// (null)
        /// </summary>
        public string SKXQC { get; internal set; }

        /// <summary>
        /// 退回备注 0950
        /// (null)
        /// </summary>
        public string THBZ { get; internal set; }

        /// <summary>
        /// 实际收款行行号 0860
        /// (null)
        /// </summary>
        public string SJSKXXH { get; internal set; }

        /// <summary>
        /// 付款行号 0870
        /// 
        /// </summary>
        public string FKHH { get; internal set; }


        /// <summary>
        /// 合同数目 0880
        /// 
        /// </summary>
        public string HTSM { get; internal set; }


        #endregion

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

            /// <summary>
            /// 查询标志 0670
            /// 6查询他行委托我行付款票据信息 2查询我行委托他行付款信息 
            /// </summary>
            public string CXBZ { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryDelegateBillInfomation();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K003";
                MessageData.Fd63 = WXCDHPHM;
                MessageData.Fd67 = CXBZ;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.DJJGBM = DelSpace(MessageData.Fd2);
                output.BZ = DelSpace(MessageData.Fd125);
                output.FKRQC = DelSpace(MessageData.Fd26);
                output.SKRQC = DelSpace(MessageData.Fd27);
                output.SKRZH = DelSpace(MessageData.Fd31);
                output.FKRZH = DelSpace(MessageData.Fd32);
                output.EMS = DelSpace(MessageData.Fd37);
                output.THEMS = DelSpace(MessageData.Fd38);
                output.QFJE = DelSpace(MessageData.Fd43);
                output.SQRQ = DelSpace(MessageData.Fd44);
                output.DQRQ = DelSpace(MessageData.Fd45);
                output.JSWTRQ = DelSpace(MessageData.Fd46);
                output.QFRQ = DelSpace(MessageData.Fd47);
                output.SFCZJL = DelSpace(MessageData.Fd66);
                output.SFDQCL = DelSpace(MessageData.Fd69);
                output.WTFS = DelSpace(MessageData.Fd70);
                output.TPBZ = DelSpace(MessageData.Fd71);
                output.FKXQC = DelSpace(MessageData.Fd81);
                output.SKXQC = DelSpace(MessageData.Fd82);
                output.THBZ = DelSpace(MessageData.Fd95);
                output.SJSKXXH = DelSpace(MessageData.Fd86);
                output.FKHH = (MessageData.Fd87);
                output.HTSM = DelSpace(MessageData.Fd88);

                return output;
            }
        }
        #endregion
    }
}
