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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 根据抵质押编号查询抵质押品信息
    /// 通过抵质押编号查询抵质押品信息
    /// </summary>
    public class QueryCollateralInformationByCode : TFOutput
    {
        #region Output
        /// <summary>
        /// 户名 0250
        /// 
        /// </summary>
        public string HM { get; internal set; }

        /// <summary>
        /// 抵质押编号 0370
        /// 
        /// </summary>
        public string DZYBH { get; internal set; }

        /// <summary>
        /// 标志位 0730
        /// 标志位第一位cFlag[0]: 1 在库，2 未入库， 3 已出库（编号仍在库中，不能再用） 
        /// </summary>
        public string BZW { get; internal set; }

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

        /// <summary>
        /// 存单类型 096M
        /// 或介质类型
        /// </summary>
        public string CDLX { get; internal set; }

        /// <summary>
        /// 状态 1057
        /// 
        /// </summary>
        public string ZT { get; internal set; }

        /// <summary>
        /// 存单账号 1061
        /// 
        /// </summary>
        public string CDZH { get; internal set; }

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

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

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

        /// <summary>
        /// 质押存单余额 0410
        /// 
        /// </summary>
        public string ZYCDYE { get; internal set; }

        /// <summary>
        /// 质押存单户名 1038
        /// 
        /// </summary>
        public string ZYCDHM { get; internal set; }

        /// <summary>
        /// 抵质押序号 103D
        /// 
        /// </summary>
        public string DZYXH { get; internal set; }

        /// <summary>
        /// 所属模块 0210
        /// 01-贷款  02-承兑  03-贴现 04-保函
        /// </summary>
        public string SSMK { get; internal set; }


        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 抵质押编号 0370
            ///  
            /// </summary>
            public string DZYBH { get; set; }

            /// <summary>
            /// 抵质押序号 103D
            ///  
            /// </summary>
            public string DZYXH { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryCollateralInformationByCode();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K063";
                MessageData.Fd37 = DZYBH;
                MessageData.Fd103_D = DZYXH;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.HM = (MessageData.Fd25);
                output.DZYBH = (MessageData.Fd37);
                output.BZW = (MessageData.Fd73);
                output.DZYMC = (MessageData.Fd96_1);
                output.CDLX = (MessageData.Fd96_M);
                output.ZT = (MessageData.Fd105_7);
                output.CDZH = (MessageData.Fd106_1);
                output.DZYLX = (MessageData.Fd116_4);
                output.DZYJZ = (MessageData.Fd39);
                output.YGLJE = (MessageData.Fd40);
                output.ZYCDYE = (MessageData.Fd41);
                output.ZYCDHM = (MessageData.Fd103_8);
                output.DZYXH = (MessageData.Fd103_D);
                output.SSMK = (MessageData.Fd21);

                return output;
            }
        }
        #endregion
    }
}
