Esempio n. 1
0
        private List <dynamic> GetNewInstance(string tableName, RNANDCN rc, IDatabase db)
        {
            try
            {
                List <dynamic> lstqxEntity = GetQXInstance(tableName, rc, db);
                List <dynamic> lstsjEntity = new List <dynamic>();
                if (lstqxEntity == null)
                {
                    return(null);
                }
                Assembly pAssembly = Assembly.LoadFrom(SystemHandler.assPath);

                foreach (var item in lstqxEntity)
                {
                    dynamic SJEntity = pAssembly.CreateInstance("BDCSubmit.Business.SubmitModel." + tableName);
                    // Object SJEntity = tableName as Object;
                    if (SJEntity == null)
                    {
                        return(null);
                    }
                    // CopySameField(item, SJEntity);
                    SJEntity = item;
                    lstsjEntity.Add(SJEntity);
                }
                return(lstsjEntity);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// RNANDCN插入一条数据
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="rnandcn"></param>
        /// <param name="head"></param>
        public void InsertRNANDCN(string pid, RNANDCN rnandcn, Head head, ref DateTime?createtime)
        {
            RnandcnManager rm = new RnandcnManager();

            rnandcn.PID        = pid;
            rnandcn.REALEUNUM  = head.EstateNum;
            rnandcn.YWH        = head.RecFlowID;
            rnandcn.JRYWBM     = head.RecType;
            rnandcn.QXDM       = head.AreaCode;
            rnandcn.CREATETIME = head.CreateDate;
            createtime         = head.CreateDate;


            rm.Insert("RNANDCN", "PID", false, rnandcn);
        }
Esempio n. 3
0
        private int GetDataCounts(string tableName, RNANDCN rc)
        {
            int    count = 0;
            string sql   = "";

            sql = GetQuerySQL(tableName, rc, QueryType.count);
            if (sql == "")
            {
                return(count);
            }
            //var result = db.ExecuteAsync(sql);
            dynamic result = db.Fetch <dynamic>(sql);

            //int.TryParse(baseHelper.ExecuteScalar(provider, sql).toStringEX(), out count);
            int.TryParse(result.Count.ToString(), out count);
            return(count);
        }
Esempio n. 4
0
        /// <summary>
        /// 获取市中间库中满足条件数据数量
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="rc"></param>
        /// <returns></returns>
        //public int SJGetDataCounts(string tableName, RNANDCN rc)
        //{
        //    int count = 0;
        //    string sql = "";
        //    sql = GetQuerySQL(tableName, rc, QueryType.count);

        //    IBaseOperator SJbaseHelper = (SystemHandler.Instance.SJCommunicationContext as OracleContext).BaseHelper;
        //    IDbProvider SJprovider = new OracleProvider(SystemHandler.Instance.SJCommunicationconnectionstring);
        //    int.TryParse(SJbaseHelper.ExecuteScalar(SJprovider, sql).toStringEX(), out count);
        //    return count;
        //}


        public string GetQuerySQL(string tableName, RNANDCN rc, QueryType qt)
        {
            string sql = "";
            string qry = "PID";

            switch (qt)
            {
            case QueryType.count:
                qry = "PID";
                break;

            case QueryType.all:
                qry = " * ";
                break;

            default:
                break;
            }
            switch (tableName)
            {
            case "ZTT_GY_QLR":
                sql = string.Format("select " + qry + " from " + tableName + " where CASENUM='{0}'and BDCDYH='{1}'", rc.YWH, rc.REALEUNUM);
                break;

            case "QLF_QL_TDSYQ":
            case "QLF_FW_FDCQ_DZ_XM":
            case "KTT_GZW":
            case "ZH_K_105":
            case "KTT_FW_ZRZ":
            case "KTF_QT_MZDZW":
            case "KTF_QT_XZDZW":
            case "KTF_QT_DZDZW":
            case "QLF_QL_QTXGQL":
            case "ZTF_GY_QLR_GX":
            case "FW_K_103":
            case "QLT_QL_LQ":
                sql = string.Format("select " + qry + " from " + tableName + " where bdcdyh='{0}'", rc.REALEUNUM);
                break;

            case "KTT_ZDJBXX":
            case "KTF_ZDBHQK":
                sql = string.Format("select " + qry + " from " + tableName + " where zddm='{0}'", rc.REALEUNUM.Substring(0, 19));
                break;

            case "ZD_K_103":
                sql = string.Format("select " + qry + " from ZD_K_103 where substr(bdcdyh,0,19)='{0}'", rc.REALEUNUM.Substring(0, 19));
                break;

            case "DJT_DJ_SLSQ":
            case "DJF_DJ_SQR":
            case "QLF_QL_JSYDSYQ":
            case "QLT_FW_FDCQ_DZ":
            case "QLT_FW_FDCQ_YZ":
            case "QLF_FW_FDCQ_QFSYQ":
            case "QLF_QL_NYDSYQ":
            case "QLF_QL_HYSYQ":
            case "QLT_QL_GJZWSYQ":
            case "QLF_QL_ZXDJ":
            case "QLF_QL_YYDJ":
            case "QLF_QL_YGDJ":
            case "QLF_QL_DYAQ":
            case "QLF_QL_CFDJ":
            case "QLF_QL_DYIQ":
            case "FJ_F_100":
            case "DJF_DJ_SJ":
            case "DJF_DJ_SF":
            case "DJF_DJ_SH":
            case "DJF_DJ_SZ":
            case "DJF_DJ_FZ":
            case "DJF_DJ_GD":
                sql = string.Format("select " + qry + " from " + tableName + " where ywh='{0}'", rc.YWH);
                break;

            case "KTT_ZHJBXX":
            case "KTF_ZH_YHZK":
            case "KTF_ZHBHQK":
                sql = string.Format("select " + qry + " from " + tableName + " where zhdm='{0}'", rc.REALEUNUM.Substring(0, 19));
                break;

            case "KTF_ZH_YHYDZB":
            case "KTT_GY_JZX":
            case "KTT_GY_JZD":
                sql = string.Format("select " + qry + " from " + tableName + " where zhhddm='{0}'", rc.REALEUNUM.Substring(0, 19));
                break;

            case "KTT_FW_LJZ":
                KTT_FW_ZRZ zrz3 = db.Fetch <KTT_FW_ZRZ>(string.Format(" where bdcdyh='{0}'", rc.REALEUNUM).Substring(0, 28)).FirstOrDefault();
                if (zrz3 != null)
                {
                    sql = string.Format("select " + qry + " from KTT_FW_LJZ where ZRZPID='{0}'", zrz3.PID);
                }
                break;

            case "KTT_FW_C":

                KTT_FW_ZRZ zrz = db.Fetch <KTT_FW_ZRZ>(string.Format(" where bdcdyh='{0}'", rc.REALEUNUM).Substring(0, 28)).FirstOrDefault();
                if (zrz != null)
                {
                    sql = string.Format("select " + qry + " from KTT_FW_C where ZRZPID='{0}'", zrz.PID);
                }
                break;

            case "KTT_FW_H":

                // if ("371425".Equals(qxdm))
                // {
                KTT_FW_ZRZ zrz2 = db.Fetch <KTT_FW_ZRZ>(string.Format(" where bdcdyh='{0}' order by createtime desc ", rc.REALEUNUM.Substring(0, 24) + "0000")).FirstOrDefault();
                if (zrz2 != null)
                {
                    KTT_FW_C fwc = db.Fetch <KTT_FW_C>(string.Format(" where ZRZH='{0}' order by createtime desc ", zrz2.ZRZH)).FirstOrDefault();
                    if (fwc != null)
                    {
                        KTT_FW_H fwh = db.Fetch <KTT_FW_H>(string.Format(" where ZRZH='{0}' and CH='{1}'and BDCDYH='{2}' order by createtime desc ", fwc.ZRZH, fwc.CH, rc.REALEUNUM.Substring(0, 28))).FirstOrDefault();
                        //这里根据
                        if (fwh != null)
                        {
                            sql = string.Format("select " + qry + " from KTT_FW_H where ZRZH='{0}' and CH='{1}'and BDCDYH='{2}'and pid ='{3}' ", fwc.ZRZH, fwc.CH, rc.REALEUNUM.Substring(0, 28), fwh.PID); // 只获取一条最新的
                        }
                        else                                                                                                                                                                                //经过分析,现场数据库会出现一种层中最新的记录在户室表中不存在,此时我们根据单元号和户室表中的最新时间来匹配最新的一条
                        {
                            KTT_FW_H fwh2 = db.Fetch <KTT_FW_H>(string.Format(" where  BDCDYH='{0}' order by createtime desc ", rc.REALEUNUM.Substring(0, 28))).FirstOrDefault();
                            if (fwh2 != null)
                            {
                                sql = string.Format("select " + qry + " from KTT_FW_H where  BDCDYH='{0}'and  to_char(createtime,'yyyy/mm/dd,hh24:mi:ss') =  to_char(to_date('{1}','yyyy/mm/dd,hh24:mi:ss'),'yyyy/mm/dd,hh24:mi:ss') ", rc.REALEUNUM.Substring(0, 28), fwh2.CREATETIME);
                            }
                        }
                    }
                }

                // }
                //else
                //{
                //    KTT_FW_ZRZ zrz2 = curContext.GetList<KTT_FW_ZRZ>(string.Format(" where bdcdyh='{0}' ", rc.REALEUNUM.Substring(0,28))).FirstOrDefault();
                //    if (zrz2 != null)
                //    {
                //        KTT_FW_C fwc = curContext.GetList<KTT_FW_C>(string.Format(" where ZRZPID='{0}'", zrz2.PID)).FirstOrDefault();
                //        if (fwc != null)
                //        {
                //            sql = string.Format("select " + qry + " from KTT_FW_H where CPID='{0}'", fwc.PID);
                //        }
                //    }
                //}

                break;

            default:
                break;
            }
            return(sql);
        }
Esempio n. 5
0
        public List <dynamic> GetSJInstance(string tableName, RNANDCN rc, IDatabase db)
        {
            dynamic  entity    = null;
            string   sql       = CheckDataHandler.Instance.GetQuerySQL(tableName, rc, QueryType.all);
            Assembly pAssembly = Assembly.LoadFrom(SystemHandler.assPath);


            List <dynamic> lst     = db.Query <dynamic>(sql).ToList();
            List <dynamic> newList = new List <dynamic>();

            try
            {
                foreach (var item in lst)
                {
                    entity = pAssembly.CreateInstance("BDCSubmit.Business.SubmitModel." + tableName);
                    if (entity == null)
                    {
                        return(null);
                    }
                    PropertyInfo[] fields = entity.GetType().GetProperties();//获取指定对象的所有公共属性
                    List <object>  vs     = new List <object>();
                    var            values = item.Values;
                    //var keys = item.Keys;

                    //foreach (var val in keys)
                    //{
                    //    ks.Add(val);
                    //}
                    foreach (var val in values)
                    {
                        vs.Add(val);
                    }

                    for (int i = 0; i < vs.Count; i++)
                    {
                        //entity = vs[i];
                        object result = null;
                        if (vs[i] != null)
                        {
                            if (fields[i].PropertyType.FullName == "System.Int16")
                            {
                                result = Convert.ToDecimal(vs[i]);
                            }
                            else if (fields[i].PropertyType.FullName == "System.Double")
                            {
                                result = Convert.ToDecimal(vs[i]);
                            }
                            else if (fields[i].PropertyType.FullName == "System.Byte")
                            {
                                result = Convert.ToByte(vs[i]);
                            }
                            else if (fields[i].PropertyType.FullName == "System.Decimal")
                            {
                                result = Convert.ToDecimal(vs[i]);
                            }
                            else if (fields[i].PropertyType.FullName == "System.Int32")
                            {
                                result = Convert.ToInt32(vs[i]);
                            }
                            else
                            {
                                result = vs[i];
                            }
                        }



                        fields[i].SetValue(entity, result); // 给属性赋值
                    }



                    newList.Add(entity);
                }
                return(newList);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 6
0
        public Head ConstructHead(RNANDCN rc)
        {
            sjdb = new Database("sjsubmit");
            try
            {
                Head hd = new Head();
                //hd赋 值
                hd.ASID    = "AS100";
                hd.RecType = rc.JRYWBM;
                hd.RegType = rc.JRYWBM.Substring(0, 3);
                DateTime dtNow = DateTime.Now;
                hd.CreateDate = DateTime.Now;
                hd.RecFlowID  = rc.YWH;
                int qxdm = 0;
                int.TryParse(rc.QXDM, out qxdm);
                if (qxdm == 0)
                {
                    hd.BizMsgID = rc.QXDM + dtNow.Year.ToString().Substring(2).PadLeft(2, '0') + dtNow.Month.ToString().PadLeft(2, '0') + dtNow.Day.ToString().PadLeft(2, '0') + (rc.YWH.Length >= 6 ? rc.YWH.Substring(rc.YWH.Length - 6) : dtNow.Hour.ToString().PadLeft(2, '0') + dtNow.Minute.ToString().PadLeft(2, '0') + (dtNow.Second + dtNow.Millisecond).ToString().PadLeft(2, '0'));
                }
                else
                {
                    hd.BizMsgID = BIZMSGIDMANAGERHandler.Instance.GetBizMsgID(rc.QXDM, dtNow.Year.ToString().Substring(2).PadLeft(2, '0') + dtNow.Month.ToString().PadLeft(2, '0') + dtNow.Day.ToString().PadLeft(2, '0'));
                }


                hd.AreaCode     = rc.QXDM;
                hd.RegOrgID     = rc.QXDM;
                hd.ParcelID     = rc.REALEUNUM.Substring(0, 19);
                hd.EstateNum    = rc.REALEUNUM;
                hd.PreEstateNum = rc.REALEUNUM;
                if (!string.IsNullOrEmpty(rc.SCYWH))
                {
                    try
                    {
                        DJF_DJ_SZ sz = sjdb.Fetch <DJF_DJ_SZ>("YWH", rc.SCYWH).FirstOrDefault();
                        if (sz != null)
                        {
                            hd.PreCertID = string.IsNullOrEmpty(sz.SZZH) ? "" : sz.SZZH;
                        }
                        else
                        {
                            hd.PreCertID = "";
                        }
                    }
                    catch
                    {
                        hd.PreCertID = "";
                    }
                }
                else
                {
                    hd.PreCertID = "";
                }
                hd.CertCount  = "0";
                hd.ProofCount = "0";
                try
                {
                    KTT_ZDJBXX zd = sjdb.Fetch <KTT_ZDJBXX>("ZDDM", rc.REALEUNUM.Substring(0, 19)).FirstOrDefault();
                    if (zd != null)
                    {
                        hd.RightType = string.IsNullOrEmpty(zd.QLLX) ? "99" : zd.QLLX;
                    }
                    else
                    {
                        hd.RightType = "99";
                    }
                }
                catch
                {
                    hd.RightType = "99";
                }


                return(hd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 数据同步(只同步RNANDCN表中SFSB值为1(数据检查通过)的数据)
        /// </summary>
        /// <param name="qx"></param>
        public void DataExchange(QXType qx, ExcuteTaskType et)
        {
            if (qx == QXType.None)
            {
                return;
            }
            //ShowDialogForm sdf = null;
            try
            {
                switch (qx)
                {
                case QXType.QY:
                    db   = new Database("qysubmit");
                    qxdm = "371423";
                    break;

                case QXType.QH:
                    db   = new Database("qhsubmit");
                    qxdm = "371425";
                    break;

                case QXType.PY:
                    db   = new Database("pysubmit");
                    qxdm = "371426";
                    break;

                case QXType.XJ:
                    db   = new Database("xjsubmit");
                    qxdm = "371427";
                    break;

                default:
                    break;
                }
                int isfsb = (int)SFSBType.CheckSuccess;
                CheckBusinessTables cbt = XMLHelper.DeserializeByXmlFilePath <CheckBusinessTables>(SystemHandler.CheckBusinessTablesXMLFilePath);
                //查询通过检查的数据,才进行同步
                List <RNANDCN> lstRC = db.Fetch <RNANDCN>(" where qxdm='" + qxdm + "' and sfsb=" + isfsb + "").ToList();
                if (!string.IsNullOrEmpty(lcqxdm))
                {
                    if (lstRC != null)
                    {
                        List <RNANDCN> lstRC2 = db.Fetch <RNANDCN>(" where qxdm='" + lcqxdm + "' and sfsb=" + isfsb + "").ToList();
                        if (lstRC2 != null)
                        {
                            lstRC.AddRange(lstRC2);
                        }
                    }
                }
                if (lstRC != null && lstRC.Count > 0)
                {
                    int count = 1, total = lstRC.Count;
                    if (et == ExcuteTaskType.Show)
                    {
                        //sdf = new ShowDialogForm("提示", "正在同步数据...", "请稍候");
                        //sdf.SetProgress(total);
                    }
                    foreach (var rc in lstRC)
                    {
                        BusinessTypeClass btc            = cbt.Business.Where(p => rc.JRYWBM.Equals(p.BusinessCode)).FirstOrDefault();
                        List <TableClass> lstTables      = btc.检查表.Where(p => p.是否必选).ToList();
                        string            strExchangeErr = "";

                        try
                        {
                            sjdb = new Database("sjsubmit");

                            RNANDCN newRC = new RNANDCN();
                            //CopySameField(rc, newRC);
                            newRC      = rc;
                            newRC.SFSB = (int)SFSBType.ExchangeSuccess;
                            //市级库新增RNANDCN
                            int count1 = sjdb.Fetch <RNANDCN>(" where YWH='" + newRC.YWH + "' and QXDM='" + newRC.QXDM + "'").Count;
                            if (count1 == 0)
                            {
                                sjdb.Insert("RNANDCN", "PID", false, newRC);
                            }
                            else
                            {
                                RNANDCN sjRC = sjdb.Fetch <RNANDCN>(" where YWH='" + newRC.YWH + "' and QXDM='" + newRC.QXDM + "'").FirstOrDefault();
                                if (sjRC != null)
                                {
                                    //CopySameField(sjRC, newRC);
                                    sjRC      = newRC;
                                    sjRC.SFSB = newRC.SFSB;
                                    sjdb.Update(sjRC);
                                }
                            }
                            //市级库生成BizAndRep
                            BIZANDREP bar = new BIZANDREP();
                            bar.PID        = Guid.NewGuid().ToString("N");
                            bar.YWH        = rc.YWH;
                            bar.STATUS     = (int)STATUSType.DefaultValue;
                            bar.QXDM       = rc.QXDM;
                            bar.CREATETIME = DateTime.Now;
                            int count2 = sjdb.Fetch <BIZANDREP>(" where YWH='" + bar.YWH + "' and QXDM='" + bar.QXDM + "'").Count;
                            if (count2 == 0)
                            {
                                sjdb.Insert("BIZANDREP", "PID", false, bar);
                            }
                            else
                            {
                                BIZANDREP sjBar = sjdb.Fetch <BIZANDREP>(" where YWH='" + bar.YWH + "' and QXDM='" + bar.QXDM + "'").FirstOrDefault();
                                if (sjBar != null)
                                {
                                    sjBar.YWH    = rc.YWH;
                                    sjBar.STATUS = bar.STATUS;
                                    sjdb.Update(sjBar);
                                }
                            }
                            //县级库生成BizAndRep
                            //curContext.BeginTransaction();
                            int count3 = db.Fetch <BIZANDREP>(" where YWH='" + bar.YWH + "'").Count;
                            if (count3 == 0)
                            {
                                db.Insert("BIZANDREP", "PID", false, bar);
                            }
                            else
                            {
                                BIZANDREP xjBar = db.Fetch <BIZANDREP>(" where YWH='" + bar.YWH + "'").FirstOrDefault();
                                if (xjBar != null)
                                {
                                    xjBar.STATUS = bar.STATUS;
                                    db.Update(xjBar);
                                }
                            }
                            bool isError = false;
                            foreach (var item in lstTables)
                            {
                                List <dynamic> lstobj = GetNewInstance(item.表名, rc, db);



                                if (lstobj != null && lstobj.Count > 0)
                                {
                                    foreach (var sjobj in lstobj)
                                    {
                                        //if (true)
                                        //sjdb.Update(sjobj);
                                        sjdb.Insert(item.表名, "PID", false, sjobj);
                                        //else
                                        //{
                                        //    //UpdateSJobjInTransaction(sjobj);
                                        //    sjdb.Update(sjobj);
                                        //}
                                    }
                                }
                                //如果正常按程序执行,执行数据同步的数据肯定是通过数据检查的
                                //但万一有数据取不到的,写入CHECKMESSAGE
                                else
                                {
                                    if (string.IsNullOrEmpty(rc.CHECKMESSAGE))
                                    {
                                        rc.CHECKMESSAGE = "业务号:" + rc.YWH + "向市局同步失败,原因:" + item.表名 + "未取到数据";
                                    }
                                    else
                                    {
                                        rc.CHECKMESSAGE += ";" + rc.YWH + "向市局同步失败,原因:" + item.表名 + "未取到数据";
                                    }
                                    rc.SFSB = (int)SFSBType.CheckFailure;
                                    db.Update(rc);      // modify by cfl 2018年4月19日

                                    isError = true;
                                    break;
                                }
                            }
                            if (isError)
                            {
                                continue;
                            }
                            //更新区县库RNANDCN状态
                            rc.SFSB = (int)SFSBType.ExchangeSuccess;
                            db.Update(rc);


                            if (et == ExcuteTaskType.Show)
                            {
                            }
                            //sdf.SetMessage("业务号:" + rc.YWH + "相关数据同步成功。(" + count + "/" + total + ")");
                        }
                        catch (Exception ex)
                        {
                            try
                            {
                                strExchangeErr = ex.Message;

                                rc.SFSB = (int)SFSBType.ExchangeFailure;
                                if (string.IsNullOrEmpty(rc.CHECKMESSAGE))
                                {
                                    rc.CHECKMESSAGE = "业务号:" + rc.YWH + "向市局同步失败,原因:" + strExchangeErr;
                                }
                                else
                                {
                                    rc.CHECKMESSAGE += ";" + rc.YWH + "向市局同步失败,原因:" + strExchangeErr;
                                }
                                db.Update(rc);
                                if (et == ExcuteTaskType.Show)
                                {
                                }
                                //sdf.SetMessage("业务号:" + rc.YWH + "相关数据向市局同步失败。(" + count + "/" + total + ")");
                            }
                            catch
                            {
                                throw ex;
                            }
                        }

                        count++;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                //if (sdf != null)
                //{
                //    sdf.Close();
                //    sdf.Dispose();
                //}
            }
        }
        public void AnalysisBizFileToSubmit(string file, string pid)
        {
            DateTime?createtime = null; // 创建时间
            DateTime?djsj       = null; // 登记时间
            DateTime?slsj       = null; // 受理时间
            DateTime?zxsj       = null; // 注销时间
            string   ajzt       = null; // 案件状态
            string   qszt       = null; // 权属装填
            string   djxl       = null; // 登记类型名称



            Head                 head    = XMLHelper.GetBizHeadInfo(file);
            RNANDCN              rnandcn = new RNANDCN();
            MSGTIMERECORD        mtd     = new MSGTIMERECORD();
            RnandcnManager       rm      = new RnandcnManager();
            MsgmanageManager     mgr     = new MsgmanageManager(); // JK库的MSGMANAGE表
            MsgtimerecordManager mdr     = new MsgtimerecordManager();
            HolidayManager       hgr     = new HolidayManager();
            string               today   = head.CreateDate.ToString("yyyyMMddhhmmss");

            //string today2 = "20191018";
            ICollection <RNANDCN> list = rm.Query("select * from RNANDCN where realeunum = '" + head.PreEstateNum + "' and ywh='" + head.RecFlowID + "' and to_char(createtime,'yyyyMMddhhmiss') = '" + today + "' ");
            MSGMANAGE             msg  = mgr.Query("select * from MSGMANAGE WHERE ESTATENUM ='" + head.PreEstateNum + "' and recflowid = '" + head.RecFlowID + "' and to_char(CREATEDATE,'yyyyMMddhhmiss') = '" + today + "'").ToList().FirstOrDefault();

            if (msg != null)
            {
                mtd.UPTIME   = msg.UPTIME;                     //上传时间
                mtd.UPSTATUS = Convert.ToString(msg.UPSTATUS); //报文状态
            }

            if (list.Count == 0)
            {
                InsertRNANDCN(pid, rnandcn, head, ref createtime);
                List <dynamic> entities   = GetSmtInstance(file, head, ref djsj, ref slsj, ref zxsj, ref ajzt, ref qszt, ref djxl);
                string[]       entityName = GetBizDataSonNodeName(file).ToArray();
                int            index      = 0;
                foreach (var entity in entities)
                {
                    EntityManager em = new EntityManager();
                    em.Insert(entityName[index], "PID", false, entity);
                    index++;
                }
                mtd.DJSJ = djsj;
                mtd.SLSJ = slsj;
                mtd.ZXSJ = zxsj;
                mtd.AJZT = ajzt;
                mtd.QSZT = qszt;
                mtd.DJXL = djxl;
                //HOLIDAY holiday = hgr.Query("SELECT * FROM HOLIDAY WHERE TO_CHAR(DAY,'yyyyMMdd') = "+ today + "").FirstOrDefault();
                //if (holiday!=null)
                //{
                //    mtd.ISHOLIDAY = holiday.STATUS;
                //}
                if ("2".Equals(qszt) && slsj != null && zxsj != null)
                {
                    mtd.ISHOLIDAY = CompareDate((DateTime)slsj, (DateTime)zxsj, hgr)[0];
                    mtd.INTERVAL  = CompareDate((DateTime)slsj, (DateTime)zxsj, hgr)[1];
                    mtd.DVALUE    = CompareDate((DateTime)slsj, (DateTime)zxsj, hgr)[2];
                }
                else if (slsj != null && djsj != null)
                {
                    mtd.ISHOLIDAY = CompareDate((DateTime)slsj, (DateTime)djsj, hgr)[0];
                    mtd.INTERVAL  = CompareDate((DateTime)slsj, (DateTime)djsj, hgr)[1];
                    mtd.DVALUE    = CompareDate((DateTime)slsj, (DateTime)djsj, hgr)[2];
                }



                InsertMSGTIMERECORD(pid, mtd, head);
            }
            else
            {
                //根据JK库报文状态,实时更新。
                MSGTIMERECORD msgtd = mdr.Query("select * from MSGTIMERECORD WHERE BDCDYH ='" + head.PreEstateNum + "'and ywh = '" + head.RecFlowID + "' and to_char(CREATETIME,'yyyyMMddhhmiss') = '" + today + "'").ToList().FirstOrDefault();
                if (msgtd != null)
                {
                    msgtd.UPSTATUS = mtd.UPSTATUS;
                    UpdateMSGTIMERECORD(msgtd);
                }
            }
        }