using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using TellerSystem.ServiceProxy.Ext.ServiceHelper;
using TellerSystem.ServiceProxy.Ext;
using Platform.Common.RunningParameters;
using TellerSystem.Communication;
using TellerSystem.Library.Ext.Function;
using TellerSystem.Library.Ext.Variables;
using System.Windows;
using System.Windows.Controls;

namespace TellerSystem.Contract.Function
{
    /// <summary>
    /// 客户信息查询
    /// 根据客户号、账号、证件类型及号码查询并返回客户信息
    /// </summary>
    public class QueryCustomerInformation : TFOutput
    {
        #region Output
        /// <summary>
        /// 帐户状态 0200
        /// 按照号查询时输出；0：正常；1：挂失；2：挂失换证；3：正常换证；4：已经部提；5:撤销；*：销户；
        /// </summary>
        public string ZHZT { get; internal set; }

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

        /// <summary>
        /// 客户号 0280
        /// 
        /// </summary>
        public string KHH { get; internal set; }

        /// <summary>
        /// 有效起始日期 0440
        /// 
        /// </summary>
        public string YXQSRQ { get; internal set; }

        /// <summary>
        /// 有效到期日期 0450
        /// 
        /// </summary>
        public string YXDQRQ { get; internal set; }

        /// <summary>
        /// 指定卡类型卡开户张数 0480
        /// 
        /// </summary>
        public string KKHZS { get; internal set; }

        /// <summary>
        /// 预警次数 0490
        /// 
        /// </summary>
        public string YJCS { get; internal set; }

        /// <summary>
        /// 电话 0610
        /// 
        /// </summary>
        public string DH { get; internal set; }

        /// <summary>
        /// 客户级别 0660
        /// 
        /// </summary>
        public string KHJB { get; internal set; }

        /// <summary>
        /// 客户类型 0670
        /// 1：个人； 2：公司 ；3：机构（指政府机关等组织）； 4：金融机构；* 5：内部员工
        /// </summary>
        public string KHLX { get; internal set; }

        /// <summary>
        /// 客户当前状态 0680
        /// 1 正常 ；2：注销
        /// </summary>
        public string KHDQZT { get; internal set; }

        /// <summary>
        /// 收费黑名单类型 0690
        /// 0：黑名单1: 白名单
        /// </summary>
        public string SFHMDLX { get; internal set; }

        /// <summary>
        /// 客户黑名单状态 0700
        /// 1-有效 2-无效 第一位代表存款黑名单，第二位代表贷款黑名单。以后几位为预留。
        /// </summary>
        public string KHHMDZT { get; internal set; }

        /// <summary>
        /// 客户级别变更模式 0710
        /// 1.按日均余额自动变更2.手动变更
        /// </summary>
        public string KHJBBGMS { get; internal set; }

        /// <summary>
        /// 标志 0730
        /// [空格表示没有查询相关数据]第一位[0]开销户登记薄中有无记录(0.无1.有) 第二位[1]证件验证是否成功(0.身份证-否1.身份证-是2.代码证-否，3.代码证-是) 第三位[2]证件是否已建立客户ID(0.否1.是) 第四位[3]客户是否被列入黑名单(0.否1.是) 第五位[4]客户此种证件是否登记(0.否1.是) 第六位[5]客户授信记录是否存在(0.否1.是) 第七位[6]该客户在本机构是否开立基本户(0.否1.是) 第八位[7]该客户本机构是否开立一般户(0.否1.是) 第九位[8]客户是否登记收费黑白名单(0.否1.是) 第十位[9]客户本机构否已经开立临时户(0.否,1.是)
        /// </summary>
        public string BZ { get; internal set; }

        /// <summary>
        /// 地址 0810
        /// 
        /// </summary>
        public string DZ { get; internal set; }

        /// <summary>
        /// 收费黑名单备注 0820
        /// 
        /// </summary>
        public string SFHMDBZ { get; internal set; }

        /// <summary>
        /// 单位地址 0830
        /// 
        /// </summary>
        public string DWDZ { get; internal set; }

        /// <summary>
        /// 开销户登记簿中账户状态 0930
        /// 0：开户待确认；1：开户；2：销户； 3-开户确认退回； 4-开户确认退回销户（区别于2-销户）
        /// </summary>
        public string KXHDJBZZHZT { get; internal set; }

        /// <summary>
        /// 证件类型 1164
        /// 
        /// </summary>
        public string ZJLX { get; internal set; }

        /// <summary>
        /// 证件号码 1165
        /// 
        /// </summary>
        public string ZJHM { get; internal set; }

        /// <summary>
        /// 法定代理人名称 0270
        /// 
        /// </summary>
        public string FDDLRMC { get; internal set; }

        /// <summary>
        /// 法定代理人证件号码 0620
        /// 
        /// </summary>
        public string FDDLRZJHM { get; internal set; }

        /// <summary>
        /// 组织机构代码证 0630
        /// 
        /// </summary>
        public string ZZJGDMZ { get; internal set; }

        /// <summary>
        /// 法定代理人证件类型 0720
        /// 
        /// </summary>
        public string FDDLRZJLX { get; internal set; }

        /// <summary>
        /// 企业联系人 1166
        /// 
        /// </summary>
        public string QYLXR { get; internal set; }

        /// <summary>
        /// 传真 1167
        /// 
        /// </summary>
        public string CZ { get; internal set; }

        /// <summary>
        /// 邮编 1168
        /// 
        /// </summary>
        public string YB { get; internal set; }

        /// <summary>
        /// 电子邮箱 0250
        /// email
        /// </summary>
        public string DZYX { get; internal set; }

        /// <summary>
        /// 手机号 0860
        /// 
        /// </summary>
        public string SJH { get; internal set; }

        /// <summary>
        /// 营业执照 0870
        /// 没有时返回0
        /// </summary>
        public string YYZZ { get; internal set; }

        /// <summary>
        /// 客户开立机构 0910
        /// 
        /// </summary>
        public string KHKLJG { get; internal set; }

        /// <summary>
        /// 基本户数量 0500
        /// 全行已开设的基本户数量，用于控制全行只能一个基本户
        /// </summary>
        public string JBHSL { get; internal set; }

        /// <summary>
        /// 一般户数量 0510
        /// 
        /// </summary>
        public string YBHSL { get; internal set; }

        /// <summary>
        /// 临时户数量 0550
        /// 
        /// </summary>
        public string LSHSL { get; internal set; }

        /// <summary>
        /// 总开卡数 0360
        /// 
        /// </summary>
        public string ZKKS { get; internal set; }

        /// <summary>
        /// VIP卡数量 103H
        /// 该客户已开VIP卡的数量[白金卡、钻石卡]
        /// </summary>
        public string VIPS { get; internal set; }
        /// <summary>
        ///  1017二类账户开户数量：1超限、其他未超限
        /// 
        /// </summary>
        public string ELZHKHSL { get; internal set; }

        /// <summary>
        /// Fd101_6 客户信息标志位
        ///  
        /// </summary>
        public string MARK { get; internal set; }

        #endregion

        #region Input
        /// <summary>
        /// 参数清单
        /// </summary>
        public class Input : TFInput
        {
            /// <summary>
            /// 客户名称 0260
            ///  
            /// </summary>
            public string KHMC { get; set; }

            /// <summary>
            /// 客户号 0280
            ///  
            /// </summary>
            public string KHH { get; set; }

            /// <summary>
            /// 账号 0300
            ///  
            /// </summary>
            public string ZH { get; set; }

            /// <summary>
            /// 介质代码 1161
            ///  
            /// </summary>
            public string JZDM { get; set; }

            /// <summary>
            /// 证件类型 1164
            ///  
            /// </summary>
            public string ZJLX { get; set; }

            /// <summary>
            /// 证件号码 1165
            ///  
            /// </summary>
            public string ZJHM { get; set; }

            static string FLAG = TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("2ea3a7e6cfa04f89a335bf1e363295de");

            /// <summary>                 
            /// 定义业务逻辑              
            /// </summary>                
            /// <returns></returns>  
            public override TFOutput Raise()
            {                
                //拉取数据                                  
                var output = new QueryCustomerInformation();
                PageData.TradeAPIs.InitFd(MessageData);
                PageData.TradeAPIs.CommSend(MessageData);
                MessageData.Fd126_5 = MainCode;
                MessageData.Fd16 = "K018";
                MessageData.Fd26 = KHMC;
                MessageData.Fd28 = KHH;
                MessageData.Fd30 = ZH;
                MessageData.Fd116_1 = JZDM;
                MessageData.Fd116_4 = ZJLX;
                MessageData.Fd116_5 = ZJHM;
                
                PageData.TradeAPIs.CallServer(MessageData);

                if (ServiceSettings.GetConfig("restful.ecif", false))
                {
                    Message message = new Message();
                    PageData.TradeAPIs.InitFd(message);
                    PageData.TradeAPIs.CommSend(message);                    
                    message["custNo"] = KHH;
                    message["certType"] = UserVariable.EcifIdTypeChangeToCbs(ZJLX, "1");
                    message["certNo"] = ZJHM;
                    if (MessageData.Fd67 == "1")
                        PageData.CallEcif(message, "ECIFQ0513301");
                    else
                        PageData.CallEcif(message, "ECIFQ0513401");                    
                    if (message.Fd12 != "0000")
                    {
                        output.IsFailed = true;
                        output.FailureCause = message.CustomizeTransitEntry.Error;
                        
                    }
                    if ((string)message["custFlag"] == "N")
                    {
                        string dict = "";
                        foreach (Dictionary<string, object> item in message["errList"] as List<object>)
                        {
                            dict = dict + item["errorReason"].ToString().Replace("信息不全，需要补录", "") + "、";
                        }
                        dict = dict.TrimEnd('、') + "信息不全，需要补录;";
                        var codes = "2000|2300|2303|";
                        if (codes.Contains(this.TradeInfo.TradeCode))
                        {
                            IsShowWarning = false;
                            if (this.TradeAPIs.ShowQuestionMessageBox(new TextBlock { Text = "该客户：" + dict + '\n' + "需跳转到1026维护交易？", TextWrapping=TextWrapping.Wrap}) == MessageBoxResult.Yes)
                            {
                                var tPage = this.TradeAPIs.Page;
                                tPage.OpenPage("Trade.CustomerManager.T1026", new Dictionary<string, object>()
                                                            {
                                                                {"_open_path", "T"+this.TradeInfo.TradeCode},
                                                                {"_ID_NO", MessageData.Fd116_5},
                                                                {"_ID_TYPE", UserVariable.EcifIdTypeChangeToCbs(MessageData.Fd116_4, "1")},
                                                            });
                                output.IsFailed = true;
                                output.FailureCause = dict;
                            };
                           
                        }
                    }

                }
                if (MessageData.Fd12 != "0000")
                {
                    output.IsFailed = true;
                    output.FailureCause = PageData.TradeAPIs.GetError(MessageData);
                }
                output.ZHZT = (MessageData.Fd20);
                output.HM = (MessageData.Fd120_2);  //20150210  核心程序修改以前26域被占用了
                output.KHH = (MessageData.Fd28);
                output.YXQSRQ = (MessageData.Fd44);
                output.YXDQRQ = (MessageData.Fd45);
                output.KKHZS = (MessageData.Fd48);
                output.YJCS = (MessageData.Fd49);
                output.DH = (MessageData.Fd61);
                output.KHJB = (MessageData.Fd66);
                output.KHLX = (MessageData.Fd67);
                output.KHDQZT = (MessageData.Fd68);
                output.SFHMDLX = (MessageData.Fd69);
                output.KHHMDZT = (MessageData.Fd70);
                output.KHJBBGMS = (MessageData.Fd71);
                output.BZ = (MessageData.Fd73);
                output.DZ = (MessageData.Fd81);
                output.SFHMDBZ = (MessageData.Fd82);
                output.DWDZ = (MessageData.Fd83);
                //因地址长度不够，需要换域;注意，后续版本采用服务配置Temp_CustomerAddressLength进行判断
                if (FLAG == "V11" || FLAG == "V9" || FLAG == "V8" || FLAG == "V5" || FLAG == "V0" || FLAG == "V1" || FLAG == "V6" || FLAG == "V7" || (FLAG == "V2" && LoginUserInfo.KinbrNo.Substring(0, 3) == "152") || FLAG == "V2" || FLAG == "V12" || FLAG == "V3" || FLAG == "V19" || FLAG == "V21" || FLAG == "V22" || FLAG == "V23" || FLAG == "V24" || FLAG == "V10" || FLAG == "V13" || FLAG == "V14" || FLAG == "V16" || FLAG == "V17" || FLAG == "V18" || ServiceSettings.GetConfig("Temp_CustomerAddressLength", false))
                {
                    output.DZ = (MessageData.Fd109_3);//大石桥接口改造   20190723
                    output.DWDZ = (MessageData.Fd112_9);//大石桥接口改造  20190723
                }
                output.KXHDJBZZHZT = (MessageData.Fd93);
                output.ZJLX = (MessageData.Fd116_4);
                output.ZJHM = (MessageData.Fd116_5);
                output.FDDLRMC = (MessageData.Fd27);
                output.FDDLRZJHM = (MessageData.Fd62);
                output.ZZJGDMZ = (MessageData.Fd63);
                output.FDDLRZJLX = (MessageData.Fd72);
                output.QYLXR = (MessageData.Fd116_6);
                output.CZ = (MessageData.Fd116_7);
                output.YB = (MessageData.Fd116_8);
                output.DZYX = (MessageData.Fd25);
                output.SJH = (MessageData.Fd86);
                output.YYZZ = (MessageData.Fd87);
                output.KHKLJG = (MessageData.Fd91);
                output.JBHSL = (MessageData.Fd50);
                output.YBHSL = (MessageData.Fd51);
                output.LSHSL = (MessageData.Fd55);
                output.ZKKS = (MessageData.Fd36);
                output.VIPS = (MessageData.Fd103_H);
                output.ELZHKHSL = MessageData.Fd101_7;
                output.MARK = MessageData.Fd101_6;
                //是否当前柜员给自己办理业务
                if (TellerSystem.Library.Ext.TradeExtension.SystemSettingsHelper.Instance.IsTellerCustomer)
                {
                    var idCarNO = TellerSystem.Library.Ext.TradeExtension.LoginAuthentication.Instance.IdCarNO;
                    if (!string.IsNullOrEmpty(idCarNO) && output.ZJHM.Trim() == idCarNO.Trim())
                    {
                        output.IsFailed = true;
                        output.FailureCause = "当前柜员不能为自己办理业务！";
                    }
                }
                #region 阳光 客户信息改造
                if (FLAG == "V8")
                {
                    string kong = string.Empty;//数据为空
                    string format = string.Empty;//数据格式错误
                    string Inconsistent = string.Empty;//核心与ecif数据不一致
                    if (MessageData.Fd101_6.Substring(0, 1) == "N")//客户信息中存在空白或不正确项
                    {
                        if (output.KHLX == "1")
                        {
                            for (var k = 1; k < 24; k++)
                            {
                                #region//数据为空
                                if (MessageData.Fd101_6.Substring(k, 1) == "1")
                                {
                                    switch (k)
                                    {
                                        case 1:
                                            kong += "身份证有效期-起始日期、";
                                            break;
                                        case 2:
                                            kong += "身份证有效期-到期日期、";
                                            break;
                                        case 3:
                                            //kong += "出生日期、";
                                            break;
                                        case 4:
                                            kong += "职业分类、";
                                            break;
                                        case 5:
                                            kong += "职业、";
                                            break;
                                        case 6:
                                            kong += "性别、";
                                            break;
                                        case 7:
                                            kong += "国籍、";
                                            break;
                                        case 8:
                                            kong += "手机号码、";
                                            break;
                                        case 9:
                                            kong += "联系地址、";
                                            break;
                                        case 10:
                                            //kong += "邮编、";
                                            break;
                                        case 11:
                                            //kong += "单位地址、";
                                            break;
                                        case 12:
                                            //kong += "民族、";
                                            break;
                                        case 13:
                                            //kong += "学历、";
                                            break;
                                        case 14:
                                            //kong += "婚否、";
                                            break;
                                        case 15:
                                            //kong += "月收入、";
                                            break;
                                        case 16:
                                            //kong += "发证机关、";
                                            break;
                                        case 17:
                                            //kong += "地区编码、";
                                            break;
                                        case 18:
                                            //kong += "地区名称、";
                                            break;
                                        case 19:
                                            kong += "姓名、";
                                            break;
                                        case 20:
                                            kong += "证件类型、";
                                            break;
                                        case 21:
                                            kong += "证件号码";
                                            break;
                                        case 23:
                                            kong += "证件地址";
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                #endregion
                                #region//数据格式有误
                                //if (MessageData.Fd101_6.Substring(k, 1) == "2")
                                //{
                                //    switch (k)
                                //    {
                                //        case 1:
                                //            format += "身份证有效期-起始日期、";
                                //            break;
                                //        case 2:
                                //            format += "身份证有效期-到期日期、";
                                //            break;
                                //        case 3:
                                //            //format += "出生日期、";
                                //            break;
                                //        case 4:
                                //            format += "职业分类、";
                                //            break;
                                //        case 5:
                                //            format += "职业、";
                                //            break;
                                //        case 6:
                                //            format += "性别、";
                                //            break;
                                //        case 7:
                                //            format += "国籍、";
                                //            break;
                                //        case 8:
                                //            format += "手机号码、";
                                //            break;
                                //        case 9:
                                //            format += "联系地址、";
                                //            break;
                                //        case 10:
                                //            //format += "邮编、";
                                //            break;
                                //        case 11:
                                //            //format += "单位地址、";
                                //            break;
                                //        case 12:
                                //            //format += "民族、";
                                //            break;
                                //        case 13:
                                //            //format += "学历、";
                                //            break;
                                //        case 14:
                                //            //format += "婚否、";
                                //            break;
                                //        case 15:
                                //            //format += "月收入、";
                                //            break;
                                //        case 16:
                                //            //format += "发证机关、";
                                //            break;
                                //        case 17:
                                //            //format += "地区编码、";
                                //            break;
                                //        case 18:
                                //            //format += "地区名称、";
                                //            break;
                                //        case 19:
                                //            format += "姓名、";
                                //            break;
                                //        case 20:
                                //            format += "证件类型、";
                                //            break;
                                //        case 21:
                                //            format += "证件号码";
                                //            break;
                                //        default:
                                //            break;
                                //    }
                                //}
                                #endregion
                                #region//核心与ecif数据不一致
                                //if (MessageData.Fd101_6.Substring(k, 1) == "3")
                                //{
                                //    switch (k)
                                //    {
                                //        case 1:
                                //            Inconsistent += "身份证有效期-起始日期、";
                                //            break;
                                //        case 2:
                                //            Inconsistent += "身份证有效期-到期日期、";
                                //            break;
                                //        case 3:
                                //            //Inconsistent += "出生日期、";
                                //            break;
                                //        case 4:
                                //            Inconsistent += "职业分类、";
                                //            break;
                                //        case 5:
                                //            Inconsistent += "职业、";
                                //            break;
                                //        case 6:
                                //            Inconsistent += "性别、";
                                //            break;
                                //        case 7:
                                //            Inconsistent += "国籍、";
                                //            break;
                                //        case 8:
                                //            Inconsistent += "手机号码、";
                                //            break;
                                //        case 9:
                                //            Inconsistent += "联系地址、";
                                //            break;
                                //        case 10:
                                //            //Inconsistent += "邮编、";
                                //            break;
                                //        case 11:
                                //            //Inconsistent += "单位地址、";
                                //            break;
                                //        case 12:
                                //            //Inconsistent += "民族、";
                                //            break;
                                //        case 13:
                                //            //Inconsistent += "学历、";
                                //            break;
                                //        case 14:
                                //            //Inconsistent += "婚否、";
                                //            break;
                                //        case 15:
                                //            //Inconsistent += "月收入、";
                                //            break;
                                //        case 16:
                                //            //Inconsistent += "发证机关、";
                                //            break;
                                //        case 17:
                                //            //Inconsistent += "地区编码、";
                                //            break;
                                //        case 18:
                                //            //Inconsistent += "地区名称、";
                                //            break;
                                //        case 19:
                                //            Inconsistent += "姓名、";
                                //            break;
                                //        case 20:
                                //            Inconsistent += "证件类型、";
                                //            break;
                                //        case 21:
                                //            Inconsistent += "证件号码";
                                //            break;
                                //        default:
                                //            break;
                                //    }
                                //}
                                #endregion
                            }
                        }
                        else if (output.KHLX == "2")
                        {
                            for (var k = 1; k < 16; k++)
                            {
                                #region//数据为空
                                if (MessageData.Fd101_6.Substring(k, 1) == "1")
                                {
                                    switch (k)
                                    {
                                        case 1:
                                            kong += "证件有效期-起始日期、";
                                            break;
                                        case 2:
                                            kong += "证件有效期-到期日期、";
                                            break;
                                        case 3:
                                            kong += "联系电话、";
                                            break;
                                        case 4:
                                            kong += "地区编码、";
                                            break;
                                        case 5:
                                            kong += "姓名、";
                                            break;
                                        case 6:
                                            kong += "证件类型、";
                                            break;
                                        case 7:
                                            kong += "证件号码、";
                                            break;
                                        case 8:
                                            kong += "企业联系人、";
                                            break;
                                        case 9:
                                            kong += "经营项目、";
                                            break;
                                        case 10:
                                            kong += "注册地址、";
                                            break;
                                        case 11:
                                            kong += "公司联系地址、";
                                            break;
                                        case 12:
                                            kong += "法人证件类型、";
                                            break;
                                        case 13:
                                            kong += "法人证件号码、";
                                            break;
                                        case 14:
                                            kong += "法人证件有效期起始日、";
                                            break;
                                        case 15:
                                            kong += "法人证件有效期到期日、";
                                            break;
                                        default:
                                            break;
                                    }
                                }
                                #endregion
                                #region//数据格式有误
                                //if (MessageData.Fd101_6.Substring(k, 1) == "2")
                                //{
                                //    switch (k)
                                //    {
                                //        case 1:
                                //            format += "证件有效期-起始日期、";
                                //            break;
                                //        case 2:
                                //            format += "证件有效期-到期日期、";
                                //            break;
                                //        case 3:
                                //            format += "联系电话、";
                                //            break;
                                //        case 4:
                                //            format += "地区编码、";
                                //            break;
                                //        case 5:
                                //            format += "姓名、";
                                //            break;
                                //        case 6:
                                //            format += "证件类型、";
                                //            break;
                                //        case 7:
                                //            format += "证件号码、";
                                //            break;
                                //        case 8:
                                //            format += "企业联系人、";
                                //            break;
                                //        case 9:
                                //            format += "经营项目、";
                                //            break;
                                //        case 10:
                                //            format += "注册地址、";
                                //            break;
                                //        case 11:
                                //            format += "公司联系地址、";
                                //            break;
                                //        case 12:
                                //            format += "法人证件类型、";
                                //            break;
                                //        case 13:
                                //            format += "法人证件号码、";
                                //            break;
                                //        case 14:
                                //            format += "法人证件有效期起始日、";
                                //            break;
                                //        case 15:
                                //            format += "法人证件有效期到期日、";
                                //            break;
                                //        default:
                                //            break;
                                //    }
                                //}
                                #endregion
                                #region//核心与ecif数据不一致
                                //if (MessageData.Fd101_6.Substring(k, 1) == "3")
                                //{
                                //    switch (k)
                                //    {
                                //        case 1:
                                //            Inconsistent += "证件有效期-起始日期、";
                                //            break;
                                //        case 2:
                                //            Inconsistent += "证件有效期-到期日期、";
                                //            break;
                                //        case 3:
                                //            Inconsistent += "联系电话、";
                                //            break;
                                //        case 4:
                                //            Inconsistent += "地区编码、";
                                //            break;
                                //        case 5:
                                //            Inconsistent += "姓名、";
                                //            break;
                                //        case 6:
                                //            Inconsistent += "证件类型、";
                                //            break;
                                //        case 7:
                                //            Inconsistent += "证件号码、";
                                //            break;
                                //        case 8:
                                //            Inconsistent += "企业联系人、";
                                //            break;
                                //        case 9:
                                //            Inconsistent += "经营项目、";
                                //            break;
                                //        case 10:
                                //            Inconsistent += "注册地址、";
                                //            break;
                                //        case 11:
                                //            Inconsistent += "公司联系地址、";
                                //            break;
                                //        case 12:
                                //            Inconsistent += "法人证件类型、";
                                //            break;
                                //        case 13:
                                //            Inconsistent += "法人证件号码、";
                                //            break;
                                //        case 14:
                                //            Inconsistent += "法人证件有效期起始日、";
                                //            break;
                                //        case 15:
                                //            Inconsistent += "法人证件有效期到期日、";
                                //            break;
                                //        default:
                                //            break;
                                //    }
                                //}
                                #endregion
                            }
                        }

                    }
                    var codes = "2000|2300|2303|";
                    if (!string.IsNullOrEmpty(kong) && codes.Contains(this.TradeInfo.TradeCode))//|| !string.IsNullOrEmpty(format) || !string.IsNullOrEmpty(Inconsistent)
                    {
                        if (!string.IsNullOrEmpty(kong))
                        {
                            if (kong.EndsWith("、"))
                            {
                                kong = kong.Substring(0, kong.Length - 1);
                            }
                            kong += "数据为空!";
                            IsShowWarning = false;
                        }
                        //if (!string.IsNullOrEmpty(format))
                        //{
                        //    if (format.EndsWith("、"))
                        //    {
                        //        format = format.Substring(0, format.Length - 1);
                        //    }
                        //    format += "数据格式错误!";
                        //}
                        //if (!string.IsNullOrEmpty(Inconsistent))
                        //{
                        //    if (Inconsistent.EndsWith("、"))
                        //    {
                        //        Inconsistent = Inconsistent.Substring(0, Inconsistent.Length - 1);
                        //    }
                        //    Inconsistent += "数据不一致!";
                        //}
                        this.TradeAPIs.ShowInfoMessageBox("该客户：" + kong + '\n' + "需跳转到1002维护交易？");//'\n' + Inconsistent + '\n' + format + 
                        var tPage = this.TradeAPIs.Page;
                        tPage.OpenPage("Trade.CustomerManager.T1002", new Dictionary<string, object>()
                                                            {
                                                                {"_open_path", "T1002"},
                                                                {"_ID_NO", output.ZJHM},
                                                                {"CIF_TYPE", output.KHLX},
                                                                {"_ID_TYPE", output.ZJLX},
                                                            });
                        output.IsFailed = true;
                        output.FailureCause = "客户信息要素不全，需先做1002进行维护！";
                    }
                }
                #endregion
                #region 中牟 客户信息改造
                string tradeCode = "2000";
                if ((FLAG == "V0" && tradeCode.Contains(this.TradeInfo.TradeCode)) || (FLAG == "V2" && LoginUserInfo.KinbrNo.Substring(0, 3) == "122"))//
                {
                    //modify by hulei 20240110 核心想返回警告而不想再前台提示，核心白展瑞说这个核心这个短交易只有一种警告， 这里单独处理 如果是警告， 不提示
                    //警告信息,交易失败置为false; 避免客户信息缺失是提示两遍，一遍是柜面的，一遍是核心的，这两个可能同时会出现
                    //所以当出现警告时，去掉一个核心提示的
                    if (MessageData.Fd12 == "WARN")
                    {
                        IsShowWarning = false;
                        output.IsFailed = false;
                    }
                    if (MessageData.Fd101_6.Substring(0, 1) == "N")//客户信息中存在空白或不正确项
                    {
                        string kong = string.Empty;//数据为空
                        string zyfl = string.Empty;//职业分类
                        for (var k = 1; k < 22; k++)
                        {
                            #region
                            if (MessageData.Fd101_6.Substring(k, 1) == "1")//数据为空
                            {
                                switch (k)
                                {
                                    case 1:
                                        kong += "身份证有效期-起始日期、";
                                        break;
                                    case 2:
                                        kong += "身份证有效期-到期日期、";
                                        break;
                                    case 3:
                                        break;
                                    case 4:
                                        break;
                                    case 5:
                                        kong += "职业、";
                                        break;
                                    case 6:
                                        kong += "性别、";
                                        break;
                                    case 7:
                                        kong += "国籍、";
                                        break;
                                    case 8:
                                        kong += "手机号码、";
                                        break;
                                    case 9:
                                        kong += "联系地址、";
                                        break;
                                    case 10:
                                        break;
                                    case 11:
                                        break;
                                    case 12:
                                        break;
                                    case 13:
                                        break;
                                    case 14:
                                        break;
                                    case 15:
                                        break;
                                    case 16:
                                        break;
                                    case 17:
                                        break;
                                    case 18:
                                        break;
                                    case 19:
                                        kong += "姓名、";
                                        break;
                                    case 20:
                                        kong += "证件类型、";
                                        break;
                                    case 21:
                                        kong += "证件号码、";
                                        break;
                                    default:
                                        break;
                                }
                            }
                            #endregion
                        }
                        if (!string.IsNullOrEmpty(kong))
                        {
                            if (!string.IsNullOrEmpty(kong))
                            {
                                if (kong.EndsWith("、"))
                                {
                                    kong = kong.Substring(0, kong.Length - 1);
                                }
                                kong += "数据为空!";
                            }
                            if (this.TradeAPIs.ShowQuestionMessageBox("该客户：" + kong + '\n' + zyfl + '\n' + "是否跳转到1002维护交易？") == System.Windows.MessageBoxResult.Yes)
                            {
                                var tPage = this.TradeAPIs.Page;
                                tPage.OpenPage("Trade.CustomerManager.T1002", new Dictionary<string, object>()
                                                            {
                                                                {"_open_path", "T1002"},
                                                                {"_ID_NO", output.ZJHM},
                                                            });
                            }
                            else
                            {
                                var tPage = this.TradeAPIs.Page;
                                //if (FLAG == "V8" && !(tPage.TradeModel.Name.Contains("查询") || TradeManagerHandle.TT_SYSCONFIG_GetConfigValueByConfigID("SkipList").Contains(tPage.TradeModel.Code)))
                                //{
                                //    output.IsFailed = true;
                                //    output.FailureCause = "\n该客户：" + kong;
                                //}
                            }
                        }
                    }
                }
                #endregion
                return output;
            }
        }
        #endregion
    }
}
