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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 承兑保函查询抵质押品信息
    /// 承兑保函查询抵质押品信息
    /// </summary>
    public class QueryCDBHDZYP : TFOutput
    {
        #region Output
        /// <summary>
        /// 业务类型 0210
        /// 01贷款 02 承兑 04保函
        /// </summary>
        public string YWLX { get; internal set; }

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

        /// <summary>
        /// 抵质押名称 0260
        /// 
        /// </summary>
        public string DZYMC { get; internal set; }

        /// <summary>
        /// 抵质押认定价值 0390
        /// 
        /// </summary>
        public string DZYRDJZ { get; internal set; }

        /// <summary>
        /// 已关联总金额 0400
        /// 
        /// </summary>
        public string YGLZJE { get; internal set; }

        /// <summary>
        /// 编号下最大序号 0440
        /// 查询标志为1时返回
        /// </summary>
        public string ZDXH { get; internal set; }

        /// <summary>
        /// 抵质押类型 0680
        /// 1抵押2质押
        /// </summary>
        public string DZYLX { get; internal set; }

        /// <summary>
        /// 状态/是否存在标志 0690
        /// 0不存在，查询标志为1和2时是一条抵质押物的状态1入库2出库，查询表示为3时是关联状态1关联2取消
        /// </summary>
        public string ZT { get; internal set; }

        /// <summary>
        /// 所属机构 0910
        /// 业务发生机构
        /// </summary>
        public string SSJG { get; internal set; }

        /// <summary>
        /// 存单类型 096M
        /// 0001承兑汇票 0002外行存单 0008本行对公存单 0013本行个人存单 
        /// </summary>
        public string CDLX { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 抵质押序号 0440
            /// 查询标志为2的时候必须输入 
            /// </summary>
            public string DZYXH { get; set; }

            /// <summary>
            /// 抵质押编号/协议编号 0620
            /// 查询标志是1和2的时候表示抵质押品编号，查询标志是3的时候为关联的协议编号 
            /// </summary>
            public string DZYBH { get; set; }

            /// <summary>
            /// 操作类型 0670
            /// 1根据抵质押编号查询该编号下最大序号，如果已存在抵质押物则返回业务类型和入库机构 2根据抵质押编号和序号查询抵质押物信息 3查找关联状态的任意一条合同信息返回业务和机构 
            /// </summary>
            public string CZLX { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCDBHDZYP();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K067";
                MessageData.Fd44 = DZYXH;
                MessageData.Fd62 = DZYBH;
                MessageData.Fd67 = CZLX;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.YWLX = (MessageData.Fd21);
                output.HM = (MessageData.Fd25);
                output.DZYMC = (MessageData.Fd26);
                output.DZYRDJZ = (MessageData.Fd39);
                output.YGLZJE = (MessageData.Fd40);
                output.ZDXH = (MessageData.Fd44);
                output.DZYLX = (MessageData.Fd68);
                output.ZT = (MessageData.Fd69);
                output.SSJG = (MessageData.Fd91);
                output.CDLX = (MessageData.Fd96_M);

                return output;
            }
        }
        #endregion
    }
}
