private static void InsertLabelLB(long g3e_fid, string className, long newG3e_id, long newG3e_fid) { var labelTable = className.Replace("_sdogeom", ""); //标注符号表 if (string.IsNullOrEmpty(labelTable)) { return; } var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), labelTable); if (!xmlDBManager.Has(type)) { return; } var lb = xmlDBManager.GetEntity(type, g3e_fid); if (lb == null) { return; } var newObject_Label = lb.Clone() as ElectronBase; newObject_Label.G3E_ID = newG3e_id; newObject_Label.G3E_FID = newG3e_fid; newObject_Label.EntityState = EntityState.Insert; newObject_Label.SetValue("LTT_ID", (decimal)MapConfig.Instance.LTTID); DBManager.Instance.Insert(newObject_Label); }
/// <summary> /// 判断是否是增量Xml文件 /// </summary> /// <param name="xmlDBManager"></param> /// <returns></returns> private bool HasIncrement(XmlDBManager xmlDBManager) { try { var cadVersion = xmlDBManager.GetEntity <CadVersion>(o => o.G3E_FID == 1); if (cadVersion == null) { return(false); } return(true); } catch { return(false); } }
public string UpLoadAppend(string AppendFile, string GC_ID) { string ss = "TRUE"; int SjBVerion = 0; string smzq = ""; bool bbreval = false; string UserName = ""; string PassWord = ""; string QjPz = ""; CDBManger cdm = null; try { DateTime appenshiptime = DateTime.Now; CYZLog.writeLog("UpLoadAppend(" + AppendFile + "," + GC_ID + ")"); string gistick = ""; smzq = Smzq(GC_ID, ref gistick); if (smzq == "") { return("工单不存在。"); } bbreval = false; var xmldb = new XmlDBManager(); xmldb.FileName = Application["dataappendpath"] + GC_ID + "\\" + AppendFile.Substring(AppendFile.LastIndexOf("/") + 1, AppendFile.Length - AppendFile.LastIndexOf("/") - 1); xmldb.Initialize(); if (xmldb.Count() <= 0) { CYZLog.writeLog("数据格式不正确"); return("数据格式不正确请重新导出"); } int ZlVerion = -1; var CadV = xmldb.GetEntity <CadVersion>(o => o.G3E_FID == 1); //这个版本号是从增量文件得到的 ZlVerion = CadV.Version; //对比tickship里面的版本号 cdm = new CDBManger(); GetUserNamePwd(GC_ID, ref UserName, ref PassWord, ref QjPz); if (string.IsNullOrEmpty(UserName) || string.IsNullOrEmpty(PassWord) || string.IsNullOrEmpty(QjPz)) { CYZLog.writeLog("账号或密码不存在"); return("账号或密码不存在"); } var oracledb = new OracleDBManager { UserName = UserName, Password = PassWord }; //var oracledb = new OracleDBManager(); string str = "select VERSION from cadgis.appendship t where t.gcticket_id='" + GC_ID + "'"; DataTable tab = cdm.ExecuteTable(str); if (tab != null && tab.Rows.Count > 0) { SjBVerion = int.Parse(tab.Rows[0][0].ToString()); if (ZlVerion == 1 || SjBVerion == 1)//数据库的版本等于1是说明这个数据从来没有到过直接按原来的导入即使是导过一次版本都等于1也是要撤销重新导入的 { if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz)) { return("FALSE"); } OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); } else { if (ZlVerion <= SjBVerion) { if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz)) { return("FALSE"); } //发现增量文件版本低与tickship里面的版本号,就撤销工单. OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); } else//如果要导入的版本高于数据库的版本执行下面的导入 { TwoImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); } } } else { if (!TickHelper.qxtick1(GC_ID, UserName, PassWord, QjPz)) { return("FALSE"); } OnceImport(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); } if (cdm != null) { cdm.close(); } //增量的增删改 //更新公共属性表里面的从属关系 UploadEventHandler.COMMON_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新公共属性表里面的从属关系"); UploadEventHandler.GG_PD_GNWZMC_N(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新功能位置表"); //更新计量表坐标的 UploadEventHandler.UploadGg_jx_jlb_pt_sdogeom(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新计量表坐标的"); //更新户表坐标的 UploadEventHandler.UploadGg_jx_shbd_pt_sdogeom(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新户表坐标的"); // UploadEventHandler.UploadGg_gl_zxbz_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新杂项标注"); UploadEventHandler.UpLoadGg_gz_tj_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新杂项标注"); UploadEventHandler.UpLoadGg_pd_cbx_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新集抄所属变压器"); UploadEventHandler.UpGg_pd_dykg_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新低压开关所属变压器"); UploadEventHandler.UpGg_jc_pwy_n(oracledb, xmldb, GC_ID, smzq, appenshiptime, QjPz); CYZLog.writeLog("End 更新配网仪所属变压器"); //修改所有新增修改删除数据的版本 cdm = new CDBManger(); string strSql = "update cadgis.ticketship set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'"; string strSql2 = "update cadgis.appendship set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'"; string StrSql3 = "update cadgis.appendfidship set version=" + ZlVerion + " where gcticket_id='" + GC_ID + "'"; cdm.ExecuteNonQuery(strSql); cdm.ExecuteNonQuery(strSql2); cdm.ExecuteNonQuery(StrSql3); TickHelper.SxSj(smzq, QjPz, UserName, PassWord); string tzdz = Application["dataappendpath"] + GC_ID; string filename = null; GetAllDbFiles(tzdz, ref filename); //上传生产的增量 TZInterface.UpLoadTZData(gistick.ToString(), System.Web.HttpUtility.UrlEncode(Application["dataftppath"].ToString().Replace("export", "import") + GC_ID + "/" + filename, Encoding.UTF8).Replace("%", "<M>") ); } catch (Exception ex) { bbreval = false; ss = ex.ToString(); CYZLog.writeLog(ex.ToString()); } finally { if (cdm != null) { cdm.close(); } } CYZLog.writeLog("End UpLoadAppend"); return(ss); }