/// <summary> /// 更新标记 /// 更新打印标记,或者收费标记 /// </summary> /// <param name="p"></param> /// <param name="bill"></param> /// <returns></returns> public int UpdateChargeBill(EnumUpdateType p, Neusoft.HISFC.Models.Fee.Inpatient.ChargeBill bill) { if (p == EnumUpdateType.Print) { return(UpdatePrintFlag(bill)); } else if (p == EnumUpdateType.Charge) { return(UpdateChargeFlag(bill)); } return(0); }
//生成差异文件列表 static private void CreateDiffFilesList(uint nVer) { int nTotalSize = 0; EnumUpdateType emUpdateType = GetUpdateType(nVer); if (emUpdateType == EnumUpdateType.emUpdateType_Package) { uint nBeginVer = nVer; while (nBeginVer < m_nCurVer) { EnumUpdateType emType = GetUpdateType(nBeginVer); if (emType == EnumUpdateType.emUpdateType_Package) { int nSize = GetUpdateSize(nBeginVer); nTotalSize += nSize; nBeginVer++; } else { int nSize = GetUpdateSize(nBeginVer); nTotalSize += nSize; string strDownloadInfo = File.ReadAllText(mScanUrl + "/upgrade/single/downloadList_" + nBeginVer + ".txt"); string[] arr = strDownloadInfo.Split('\n'); nBeginVer = uint.Parse(arr[0]); } } //修改更新文件大小 UpdateSize(nVer, nTotalSize); return; } uint nCompareVer = m_nCurVer; for (uint i = nVer + 1; i < m_nCurVer; i++) { EnumUpdateType emType = GetUpdateType(i); if (emType == EnumUpdateType.emUpdateType_Package) { nCompareVer = i; break; } } if (nVer == nCompareVer) { return; } string strCurFilesInfo = File.ReadAllText(mScanUrl + "/md5/files_" + nVer + ".txt"); string strCompareFilesInfo = File.ReadAllText(mScanUrl + "/md5/files_" + nCompareVer + ".txt"); string[] fileArr = strCurFilesInfo.Split('\n'); Dictionary <string, string[]> dicCurFiles = new Dictionary <string, string[]>(); for (int i = 0; i < fileArr.Length; i++) { if (string.IsNullOrEmpty(fileArr[i])) { continue; } string[] fileData = fileArr[i].Split('|'); dicCurFiles.Add(fileData[0], new string[] { fileData[1], fileData[2] }); } fileArr = strCompareFilesInfo.Split('\n'); Dictionary <string, string[]> dicCompareFiles = new Dictionary <string, string[]>(); for (int i = 0; i < fileArr.Length; i++) { if (string.IsNullOrEmpty(fileArr[i])) { continue; } string[] fileData = fileArr[i].Split('|'); dicCompareFiles.Add(fileData[0], new string[] { fileData[1], fileData[2] }); } //生成差异文件列表 Dictionary <string, string[]> dicDiffFiles = new Dictionary <string, string[]>(); foreach (var pairs in dicCompareFiles) { if (dicCurFiles.ContainsKey(pairs.Key) == false) { dicDiffFiles.Add(pairs.Key, pairs.Value); } else { string[] arr = dicCurFiles[pairs.Key]; string strMd5 = arr[0]; if (strMd5.Equals(pairs.Value[0]) == false) { dicDiffFiles.Add(pairs.Key, pairs.Value); } } } nTotalSize = 0; //更新包大小(字节数) if (nCompareVer != m_nCurVer) { foreach (var pairs in dicDiffFiles) { //如果最新的版本中没有这个文件,则从差异列表中删除,避免更新无用文件 if (!mCurFileDic.ContainsKey(pairs.Key)) { dicDiffFiles.Remove(pairs.Key); continue; } //最新更新包中有这个资源,则从差异列表中删除,避免重复更新资源 if (dicCurDiffFiles.ContainsKey(pairs.Key)) { dicDiffFiles.Remove(pairs.Key); } } uint nBeginVer = nCompareVer; while (nBeginVer < m_nCurVer) { EnumUpdateType emType = GetUpdateType(nBeginVer); if (emType == EnumUpdateType.emUpdateType_Package) { int nSize = GetUpdateSize(nBeginVer); nTotalSize += nSize; nBeginVer++; } else { int nSize = GetUpdateSize(nBeginVer); nTotalSize += nSize; string strDownloadInfo = File.ReadAllText(mScanUrl + "/upgrade/single/downloadList_" + nBeginVer + ".txt"); string[] arr = strDownloadInfo.Split('\n'); nBeginVer = uint.Parse(arr[0]); } } } string strFileList = nCompareVer.ToString() + "\n"; foreach (var pairs in dicDiffFiles) { if (dicCurFiles.ContainsKey(pairs.Key) == false) { strFileList += (pairs.Key + "\n"); string[] arr = dicDiffFiles[pairs.Key]; int nSize = int.Parse(arr[1]); nTotalSize += nSize; } else { string[] arr = dicCurFiles[pairs.Key]; int nSize = int.Parse(arr[1]); string strMd5 = arr[0]; if (strMd5.Equals(pairs.Value[0]) == false) { strFileList += (pairs.Key + "\n"); nTotalSize += nSize; } } } //写文件 File.WriteAllText(mScanUrl + "/upgrade/single/downloadList_" + nVer + ".txt", strFileList); //修改更新文件大小 UpdateSize(nVer, nTotalSize); }
/// <summary> /// 联动更新函数 /// </summary> /// <param name="orgFea">参照要素</param> /// <param name="objFea">目标更新要素</param> /// <param name="pObjFeaClss">目标更新要素类</param> /// <param name="pObjWS">目标工作空间</param> /// <param name="fromDate">目标工作空间</param> /// <param name="pUpdateType">更新类型,新增、修改、删除</param> /// <param name="pError">异常</param> public static void UpdateFea(IMap pMap, IFeature orgFea, IFeature objFea, IFeatureClass pObjFeaClss, IWorkspace pObjWS, EnumUpdateType pUpdateType, out Exception pError) { pError = null; //异常 string pFeaClsName = ""; //更新要素类 名称 int pVersion = -1; //版本信息 pFeaClsName = (pObjFeaClss as IDataset).Name; //目标图层名 IWorkspaceEdit pWsEdit = pObjWS as IWorkspaceEdit; //目标编辑工作空间 if (pObjWS.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace) { //工作空间是SDE类型 //开启编辑 if (!pWsEdit.IsBeingEdited()) { try { pWsEdit.StartEditing(true); //开启编辑 pWsEdit.EnableUndoRedo(); pWsEdit.StartEditOperation(); //开启会话 } catch (Exception e) { //******************************************************************* //Exception Log if (ModData.SysLog == null) { ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog(); } ModData.SysLog.Write(e, null, DateTime.Now); //******************************************************************** pError = new Exception("不能编辑该工作空间,请检查是否为只读或被其它用户占用!"); return; } } //IFeatureDataset pFeaDataset = pObjFeaClss.FeatureDataset; //if (pFeaDataset != null) //{ // IVersionedObject pVerObj = pFeaDataset as IVersionedObject; // if (pVerObj.IsRegisteredAsVersioned) // { // //反注册 // pVerObj.RegisterAsVersioned(false); // } //} //获得版本信息 pVersion = GetVersion(pObjWS, out pError); if (pError != null) { return; } } DateTime fromDate = DateTime.Now; //更新时间 if (pUpdateType == EnumUpdateType.新增) { #region 新增操作 if (orgFea == null) { pError = new Exception("请选择参照要素"); return; } //在目标图层中创建一个新的要素 IFeature newFea = pObjFeaClss.CreateFeature(); //给创建的要素的几何字段赋值 newFea.Shape = orgFea.ShapeCopy; //给创建的要素的属性字段赋值 try { //保存要素 newFea.Store(); } catch (Exception pEx) { //******************************************************************* //Exception Log if (ModData.SysLog == null) { ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog(); } ModData.SysLog.Write(pEx, null, DateTime.Now); //******************************************************************** pError = new Exception("新增要素出错,\n原因:" + pEx.Message); return; } if (pObjWS.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace) { //停止编辑 pWsEdit.StartEditOperation(); pWsEdit.StopEditing(true); //更新历史、日志记录表 RecordLOG(pObjWS, newFea as IRow, 1, fromDate, pVersion, pFeaClsName, out pError); if (pError != null) { return; } } #endregion } else if (pUpdateType == EnumUpdateType.修改) { #region 修改操作 if (orgFea == null) { pError = new Exception("请选择参照要素"); return; } if (objFea == null) { pError = new Exception("请选择更新要素"); return; } //*********************************************************************** //guozheng added if (objFea.Shape.GeometryType != orgFea.Shape.GeometryType) { pError = new Exception("源要素与目标要素几何不一致,未能修改。"); return; } //*********************************************************************** //给几何字段赋值 objFea.Shape = orgFea.ShapeCopy; //给属性字段赋值,暂时未能实现 try { //对修改的要素进行存储 objFea.Store(); } catch (Exception pEx) { //******************************************************************* //Exception Log if (ModData.SysLog == null) { ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog(); } ModData.SysLog.Write(pEx, null, DateTime.Now); //******************************************************************** pError = new Exception("修改要素出错,\n原因:" + pEx.Message); return; } if (pObjWS.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace) { pWsEdit.StopEditOperation(); pWsEdit.StopEditing(true); //更新历史、日志记录表 RecordLOG(pObjWS, objFea as IRow, 2, fromDate, pVersion, pFeaClsName, out pError); if (pError != null) { return; } } #endregion } else { #region 除操作 if (objFea == null) { pError = new Exception("请选择要删除的要素"); return; } //删除要素 //查找要删除的要素 IQueryFilter pFilter = new QueryFilterClass(); pFilter.WhereClause = "OBJECTID=" + objFea.OID; ITable pTable = pObjFeaClss as ITable; try { //删除要素 pTable.DeleteSearchedRows(pFilter); } catch (Exception pEx) { //******************************************************************* //Exception Log if (ModData.SysLog == null) { ModData.SysLog = new SysCommon.Log.clsWriteSystemFunctionLog(); } ModData.SysLog.Write(pEx, null, DateTime.Now); //******************************************************************** pError = new Exception("删除要素出错,\n原因:" + pEx.Message); return; } if (pObjWS.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace) { pWsEdit.StopEditOperation(); pWsEdit.StopEditing(true); //更新历史库和日志记录表 RecordLOG(pObjWS, objFea.OID, fromDate, pVersion, pFeaClsName, out pError); if (pError != null) { return; } } #endregion } //更新版本信息 if (pObjWS.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace) { //更新版本信息 WriteDBVersion(pObjWS, pVersion, fromDate, out pError); } if (pError != null) { return; } }