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

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 查询mo_fake表返回没收记录(文件)
    /// 查询mo_fake表返回没收记录
    /// </summary>
    public class QueryMoFakeRecord : TFOutput
    {
        #region Output
        /// <summary>
        /// 文件
        /// 没收凭证号|没收序号|客户姓名|版别|券别|冠字号码|张数|登记日期|状态|备注|
        /// </summary>
        public string WJ { get; internal set; }

        /// <summary>
        /// 文件
        /// 没收凭证号|没收序号|客户姓名|版别|券别|冠字号码|张数|登记日期|状态|备注|
        /// </summary>
        public List<E_WJ> WJData { get; internal set; }

        /// <summary>
        /// 文件
        /// 没收凭证号|没收序号|客户姓名|版别|券别|冠字号码|张数|登记日期|状态|备注|
        /// </summary>
        public class E_WJ
        {
            /// <summary>
            /// 没收凭证号
            /// </summary>
            public string MSPZH { get; set; }

            /// <summary>
            /// 没收序号
            /// </summary>
            public string MSXH { get; set; }

            /// <summary>
            /// 客户姓名
            /// </summary>
            public string KHXM { get; set; }

            /// <summary>
            /// 版别
            /// </summary>
            public string BB { get; set; }

            /// <summary>
            /// 券别
            /// </summary>
            public string QB { get; set; }

            /// <summary>
            /// 冠字号码
            /// </summary>
            public string GZHM { get; set; }

            /// <summary>
            /// 张数
            /// </summary>
            public string ZS { get; set; }

            /// <summary>
            /// 登记日期
            /// </summary>
            public string DJRQ { get; set; }

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

            /// <summary>
            /// 备注
            /// </summary>
            public string BZ { get; set; }

        }

        #endregion

        #region Input
		/// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 没收序号 0350
            ///  
            /// </summary>
            public string XH { get; set; }

            /// <summary>
            /// 没收凭证号 0580
            ///  
            /// </summary>
            public string PZH { get; set; }

            /// <summary>
            /// 现金管理员 0650
            ///  
            /// </summary>
            public string XJGLY { get; set; }

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

            /// <summary>
            /// 接收柜员 0730
            ///  
            /// </summary>
            public string JSGY { get; set; }

            /// <summary>
            /// 登记柜员 0920
            ///  
            /// </summary>
            public string DJGY { get; set; }


            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {
                //拉取数据                                  
                var output = new QueryMoFakeRecord();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
				MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "CXCL";
                MessageData.Fd35 = XH;
                MessageData.Fd58 = PZH;
                MessageData.Fd128 = "0098";
                MessageData.Fd65 = XJGLY;
                MessageData.Fd69 = ZT;
                MessageData.Fd73 = JSGY;
                MessageData.Fd92 = DJGY;

                PageData.TradeAPIs.CallServer(MessageData);
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }                
                output.WJData = AnilyzeFileData<E_WJ>(MessageData.FileData,
                                            "没收凭证号|没收序号|客户姓名|版别|券别|冠字号码|张数|登记日期|状态|备注|",
                                            x =>
                                            {
                                                return new E_WJ
                                                {
                                                    MSPZH = x["没收凭证号"],
                                                    MSXH = x["没收序号"],
                                                    KHXM = x["客户姓名"],
                                                    BB = x["版别"],
                                                    QB = x["券别"],
                                                    GZHM = x["冠字号码"],
                                                    ZS = x["张数"],
                                                    DJRQ = x["登记日期"],
                                                    ZT = x["状态"],
                                                    BZ = x["备注"]
                                                };
                                            });
                output.WJ = MessageData.FileData;

                return output;
            }
        }
        #endregion
    }
}
