diff --git a/Learun.Application.Web/AppApi/PlotBOMApiController.cs b/Learun.Application.Web/AppApi/PlotBOMApiController.cs index 56a34701..02b8c166 100644 --- a/Learun.Application.Web/AppApi/PlotBOMApiController.cs +++ b/Learun.Application.Web/AppApi/PlotBOMApiController.cs @@ -78,6 +78,8 @@ namespace Learun.Application.Web.AppApi #region 预处理每个位号,然后进行分组 foreach (ec_enginedataEntity tag in allTag) { + if(tag.TagNumber.Length==38&&tag.TagNumber.Contains("{")) + { continue; } var matchedTypes = new List(); var idx = 0; var GroupName = TrimTagNubmer(tag.TagNumber, out idx);// 如 A-B1,A-B2,取出来的group就是A-B,idx为0 @@ -102,8 +104,7 @@ namespace Learun.Application.Web.AppApi { //如照明下的。比如10个照明的灯,4个中文名称是“顶灯”,6个中文名称是“壁灯” BOMTagInfo.Name = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == GlobalObject.propName_NameCN)?.PropertyValue ?? ""; - - + } TagsInBOM.Add(BOMTagInfo); diff --git a/Learun.Application.Web/AppApi/PlotLayoutApiController.cs b/Learun.Application.Web/AppApi/PlotLayoutApiController.cs index de74eb8e..29b154e7 100644 --- a/Learun.Application.Web/AppApi/PlotLayoutApiController.cs +++ b/Learun.Application.Web/AppApi/PlotLayoutApiController.cs @@ -244,10 +244,9 @@ namespace Learun.Application.Web.AppApi area = "ERR", }; basePoint.Tags.Add(layoutTagInfoInvalid); - foreach (var item in EquipPropAll) + foreach (var item in EquipPropAll.Where(x=>x.EngineDataID== matchPointTagId)) { - if (matchPointTagIdSet.Contains(item.EngineDataID)) - item.Marker = true; + item.Marker = true; } continue; } @@ -266,6 +265,11 @@ namespace Learun.Application.Web.AppApi { strRoom = matchedRoom.DataItemName; } + if(matchedRoom==null && basePoint.RoomNo!=string.Empty)//这里基点也要判断下,只有是基点带ROOMNO值的才不统计 + { + //如果房间号没有匹配的,肋位号有,则不打标记,而且应该把该位号放到只有肋位号的基点上去,没有这种基点则不统计 + continue; + } var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue; var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue; @@ -365,10 +369,9 @@ namespace Learun.Application.Web.AppApi RoomNo = strRoom }; basePoint.Tags.Add(layoutTagInfo); - foreach (var item in EquipPropAll) + foreach (var item in EquipPropAll.Where(x => x.EngineDataID == matchPointTagId)) { - if (matchPointTagIdSet.Contains(item.EngineDataID)) - item.Marker = true; + item.Marker = true; } } #endregion diff --git a/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_objecttype/ec_objecttypeBLL.cs b/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_objecttype/ec_objecttypeBLL.cs index c825eba3..a13ae711 100644 --- a/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_objecttype/ec_objecttypeBLL.cs +++ b/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ZZDT_EC/ec_objecttype/ec_objecttypeBLL.cs @@ -340,7 +340,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC } } /// - /// 获取列表数据 + /// 获取列表数据 /// /// public IEnumerable GetTree(string queryJson) diff --git a/newFront/c#前端/SWS.CAD.Base/General.cs b/newFront/c#前端/SWS.CAD.Base/General.cs index 8df9cbb4..833261ed 100644 --- a/newFront/c#前端/SWS.CAD.Base/General.cs +++ b/newFront/c#前端/SWS.CAD.Base/General.cs @@ -15,6 +15,7 @@ using Path = System.IO.Path; using Color = Teigha.Colors.Color; using System.Security.Cryptography; using System.Threading.Tasks; +using SWS.Model; namespace SWS.CAD.Base { public static class General @@ -1131,7 +1132,7 @@ namespace SWS.CAD.Base } } if (idsToErase.Count > 0) - { + { foreach (ObjectId id in idsToErase) { Entity ent = (Entity)tr.GetObject(id, OpenMode.ForWrite); @@ -1948,7 +1949,7 @@ namespace SWS.CAD.Base doc = Application.DocumentManager.MdiActiveDocument; ed = doc.Editor; db = doc.Database; - var s=doc.Name; + var s = doc.Name; // 开启事务 using (Transaction tr = db.TransactionManager.StartTransaction()) { @@ -2019,7 +2020,7 @@ namespace SWS.CAD.Base #endregion #region 插入文本内容 - public static string InsertTextInfo(List listTextInfo) + public static string InsertTextInfo(List listTextInfo) { string res = string.Empty; try @@ -2154,7 +2155,246 @@ namespace SWS.CAD.Base } - #endregion + #endregion + + #region 材料表插入图标块 + /// + /// 读取元件块,插入图纸 + /// + /// 图元文件路径 + /// 块名 + /// 比例大小 + /// 坐标位置 + /// + public static ObjectId AddBomSymbolDWG(string filePath, string symbolName, double scale, Point3d position) + { + if (scale == 0) + { scale = 1; } + Document doc = Application.DocumentManager.MdiActiveDocument; + var ed = doc.Editor; + ObjectId oid = ObjectId.Null; + if (!File.Exists(filePath)) + { + ed.WriteMessage("\n 错误:图元文件不存在!\n"); + return oid; + } + // 获取当前数据库 + Database destDb = HostApplicationServices.WorkingDatabase; + using (Transaction tr = destDb.TransactionManager.StartTransaction()) + { + try + { + // 创建临时数据库读取外部DWG + using (Database sourceDb = new Database(false, true)) + { + sourceDb.ReadDwgFile(filePath, FileOpenMode.OpenForReadAndAllShare, false, null); + + // 生成唯一块名(避免重名) + string blockName = GetUniqueBlockName(destDb, symbolName); + // 将外部DWG转换为块定义 + ObjectId blockId = destDb.Insert(blockName, sourceDb, true); + // 创建块参照 + BlockReference br = new BlockReference( + Point3d.Origin, // 插入点(可修改) + blockId// bt[blockName] + ); + br.Position = position; + // 设置比例和旋转 + br.ScaleFactors = new Scale3d(scale); //比例因子 + br.Rotation = 0.0; // 旋转角度(弧度) + // 获取实时鼠标位置 + // 添加到当前模型空间 + BlockTableRecord btr = (BlockTableRecord)tr.GetObject( + SymbolUtilityServices.GetBlockModelSpaceId(destDb), + OpenMode.ForWrite + ); + + // 处理插入结果 + btr.AppendEntity(br); + tr.AddNewlyCreatedDBObject(br, true); + //创建位号属性 + //var attDef = AddAttributeDefinition(btr, "HKSK_TAG", tag); + //AttributeReference attRef = new AttributeReference(); + //attRef.SetAttributeFromBlock(attDef, br.BlockTransform); + //br.AttributeCollection.AppendAttribute(attRef); + //tr.AddNewlyCreatedDBObject(attRef, true); + tr.Commit(); + oid = br.Id; + } + + } + catch (Exception ex) + { + tr.Abort(); + ed.WriteMessage($"\n错误: {ex.Message}\n"); + } + } + return oid; + + + } + + #endregion + + #region 获取当前图纸的所有有标注信息的句柄 + /// + /// 获取当前图纸的所有有标注信息的句柄 ,XData第一个属性为(1001, "HKSK_LABEL") + /// + /// + public static List GetAllAnnotation() + { + doc = Application.DocumentManager.MdiActiveDocument; + ed = doc.Editor; + db = doc.Database; + + List listInfo = new List(); + try + { + // 开启事务 + using (Transaction tr = db.TransactionManager.StartTransaction()) + { + // 获取模型空间块表记录 + BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord; + + // 遍历模型空间中的所有实体 + foreach (ObjectId objId in btr) + { + if (objId.ObjectClass.Name == "AcDbBlockReference") + { + BlockReference blockRef = (BlockReference)tr.GetObject(objId, OpenMode.ForRead); + if (blockRef.XData != null) + { + ResultBuffer rb = blockRef.XData; + if (HasTargetXData(rb, "HKSK_LABEL")) + { + TypedValue[] xdata = rb.AsArray(); + for (int i = 1; i < xdata.Length; i++) + { + if (i + 1 >= xdata.Length) + { break; } + TypedValue data1 = xdata[i]; + TypedValue data2 = xdata[i + 1]; + if (data1.TypeCode == 1000 && data2.TypeCode == 1005) + { + listInfo.Add(new DtoTagAnnotation() + { + TagHandId = objId.Handle.ToString(), + Name = data1.Value.ToString(), + LabelHandId = data2.Value.ToString(), + }); + i++; + } + else { break; } + } + } + } + } + } + tr.Commit(); + } + + } + catch (System.Exception ex) + { + ed.WriteMessage($"\n错误: {ex.Message}"); + } + return listInfo; + } + private static bool HasTargetXData(ResultBuffer rb, string targetAppName) + { + if (rb == null) return false; + + TypedValue[] data = rb.AsArray(); + if (data.Length == 0) return false; + + // 检查第一个TypedValue是否为(1001, "HKSK_LABEL") + TypedValue firstValue = data[0]; + return firstValue.TypeCode == 1001 && + firstValue.Value.ToString() == targetAppName; + } + #endregion + + #region 获取当前图纸的所有Mtext + /// + /// 获取当前图纸的所有Mtext + /// + /// + public static List GetAllMText() + { + doc = Application.DocumentManager.MdiActiveDocument; + ed = doc.Editor; + db = doc.Database; + + List listMText = new List(); + try + { + // 开启事务 + using (Transaction tr = db.TransactionManager.StartTransaction()) + { + // 获取模型空间块表记录 + BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; + BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord; + + // 遍历模型空间中的所有实体 + foreach (ObjectId objId in btr) + { + Entity entity = tr.GetObject(objId, OpenMode.ForRead) as Entity; + if (entity is MText mtext) + { + listMText.Add(new DtoMText() { Text = mtext.Text, HandId = mtext.Handle.ToString() }); + } + } + tr.Commit(); + } + + } + catch (System.Exception ex) + { + ed.WriteMessage($"\n错误: {ex.Message}"); + } + return listMText; + } + #endregion + + #region 刷新文本信息 + /// + /// 刷新文本信息 + /// + /// + public static string RefreshMTextInfo(List keyValues) + { + doc = Application.DocumentManager.MdiActiveDocument; + ed = doc.Editor; + db = doc.Database; + try + { + using (Transaction tr = db.TransactionManager.StartTransaction()) + { + foreach (var item in keyValues) + { + Handle handleObj= new Handle(Convert.ToInt64(item.Key, 16)); + + // 通过句柄获取ObjectId + ObjectId objectId = db.GetObjectId(false, handleObj, 0); + + // 获取对象并检查是否为MText + DBObject dbObj = tr.GetObject(objectId, OpenMode.ForWrite); + if (dbObj is MText mtext) + { + mtext.Contents = item.Value; + } + } + tr.Commit(); + } + return ""; + } + catch (Exception ex) + { + return ex.Message; + } + } + #endregion } } diff --git a/newFront/c#前端/SWS.CAD.Base/Model/DtoMText.cs b/newFront/c#前端/SWS.CAD.Base/Model/DtoMText.cs new file mode 100644 index 00000000..9267c539 --- /dev/null +++ b/newFront/c#前端/SWS.CAD.Base/Model/DtoMText.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Teigha.Geometry; + +namespace SWS.CAD.Base +{ + public class DtoMText + { + /// + /// 文本内容,多行文本用\n 进行换行 + /// + public string Text { get; set; } + /// + /// 句柄Id + /// + public string HandId { get; set; } + } +} diff --git a/newFront/c#前端/SWS.CAD.Base/Model/DtoSymbolInfo.cs b/newFront/c#前端/SWS.CAD.Base/Model/DtoSymbolInfo.cs new file mode 100644 index 00000000..e6bb3b24 --- /dev/null +++ b/newFront/c#前端/SWS.CAD.Base/Model/DtoSymbolInfo.cs @@ -0,0 +1,25 @@ +using Teigha.Geometry; + +namespace SWS.Electrical +{ + public class DtoSymbolInfo + { + /// + /// 坐标 + /// + public Point3d Position { get; set; } + + /// + /// 图标上面部分显示内容 + /// + public string Upper_Text { set; get; } + /// + /// 图标下面部分显示内容 + /// + public string Lower_Text { set; get; } + /// + /// 比例 + /// + public double Scale { set; get; } + } +} diff --git a/newFront/c#前端/SWS.CAD.Base/Model/DtoTagAnnotation.cs b/newFront/c#前端/SWS.CAD.Base/Model/DtoTagAnnotation.cs new file mode 100644 index 00000000..02d2c2a9 --- /dev/null +++ b/newFront/c#前端/SWS.CAD.Base/Model/DtoTagAnnotation.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Teigha.Geometry; + +namespace SWS.CAD.Base +{ + public class DtoTagAnnotation + { + /// + /// 元件句柄Id + /// + public string TagHandId { get; set; } + /// + /// 属性名 + /// + public string Name { get; set; } + /// + /// 文本标注句柄Id + /// + public string LabelHandId { get; set; } + } +} diff --git a/newFront/c#前端/SWS.CAD.Base/Model/DtoCadTextInfo.cs b/newFront/c#前端/SWS.CAD.Base/Model/DtoTextInfo.cs similarity index 96% rename from newFront/c#前端/SWS.CAD.Base/Model/DtoCadTextInfo.cs rename to newFront/c#前端/SWS.CAD.Base/Model/DtoTextInfo.cs index 2ceebadb..9a419931 100644 --- a/newFront/c#前端/SWS.CAD.Base/Model/DtoCadTextInfo.cs +++ b/newFront/c#前端/SWS.CAD.Base/Model/DtoTextInfo.cs @@ -7,7 +7,7 @@ using Teigha.Geometry; namespace SWS.CAD.Base { - public class DtoCadTextInfo + public class DtoTextInfo { /// /// 坐标 diff --git a/newFront/c#前端/SWS.CAD.Base/SWS.CAD.Base.csproj b/newFront/c#前端/SWS.CAD.Base/SWS.CAD.Base.csproj index 9412e79b..110c60dd 100644 --- a/newFront/c#前端/SWS.CAD.Base/SWS.CAD.Base.csproj +++ b/newFront/c#前端/SWS.CAD.Base/SWS.CAD.Base.csproj @@ -52,7 +52,10 @@ - + + + + @@ -60,6 +63,10 @@ {9ac724f6-883d-4357-9422-602748f25b69} SWS.Commons + + {1995385B-D1B0-4C55-835E-D3E769972A6A} + SWS.Model + diff --git a/newFront/c#前端/SWS.CAD/GlobalObje.cs b/newFront/c#前端/SWS.CAD/GlobalObje.cs index 3e72df60..d10d09df 100644 --- a/newFront/c#前端/SWS.CAD/GlobalObje.cs +++ b/newFront/c#前端/SWS.CAD/GlobalObje.cs @@ -230,28 +230,8 @@ namespace SWS.CAD /// public static List designTree = new List(); #endregion - - public enum dialogPar - { - id, - textYes, - textNo, - title, - OK, - unitTypeId, - info, - unit, - para1, - para2 - } - //public static IUnityContainer container; - //public static IContainerExtension _prismContainer; - //public static HttpClient client; - //public static loginRes userInfo; - //public static List Users; - - public static bool isConfigIniCreateBySys = true; - //public static string drawingFileId; + + public static bool isConfigIniCreateBySys = true; public static ec_project curProject; public static DateTime preClickTime = DateTime.Now; public static Style TransparentComboBoxStyle; @@ -321,29 +301,7 @@ namespace SWS.CAD return path; } #endregion - - //#region 根据ID获取用户名称 - ///// - ///// 根据ID获取用户名称 - ///// - ///// - ///// - //public static string GetUserNameById(string id) - //{ - // if (string.IsNullOrEmpty(id)) - // { return ""; } - // var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id); - // if (user != null) - // { return user.F_RealName; } - // else - // { - // return ""; - // //user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id); - // //return user != null ? user.F_RealName : ""; - // } - //} - //#endregion - + #region 查找子控件 /// @@ -376,75 +334,6 @@ namespace SWS.CAD return null; } #endregion - - #region 判断是否是电缆 - /// - /// 判断是否是电缆 - /// - /// - public static bool IsCable(ec_objecttype obj) - { - if (obj == null) { return false; } - var flag = obj.ObjectTypeName.EndsWith("电缆"); - return flag; - } - #endregion - - #region 取字符串最后的一个或多个数字 - /// - /// 取字符串最后的一个或多个数字 - /// - /// 输入字符串 - /// 数字前的字符串 - /// 最后的数字 - /// - public static bool GetLastNumber(string input, ref string preInput, ref int num) - { - string pattern = @"(\d+)$"; // 正则表达式,匹配字符串末尾的一个或多个数字 - Match match = Regex.Match(input, pattern); - if (match.Success) - { - preInput = input.Substring(0, input.Length - match.Value.Length); - num = int.Parse(match.Value); - return true; - } - else - { - return false; - } - } - #endregion - - - /// - /// - /// - /// 包括命名空间 - /// - public static System.Windows.Media.ImageSource ImageSourceFromEmbeddedResourceStream(string resName) - { - System.Reflection.Assembly assy = System.Reflection.Assembly.GetExecutingAssembly(); - //foreach (string resource in assy.GetManifestResourceNames()) - //{ - // Console.WriteLine(resource);//遍历所有的内嵌资源 - //} - System.IO.Stream stream = assy.GetManifestResourceStream(resName); - if (stream == null) - return null; - System.Windows.Media.Imaging.BitmapImage img = new System.Windows.Media.Imaging.BitmapImage(); - img.BeginInit(); - img.StreamSource = stream; - img.EndInit(); - return img; - } - - public static string GetPCInfo() - { - string computerName = Environment.MachineName; // 获取计算机名称 - string userName = Environment.UserName; // 获取当前用户名称 - - return $"{computerName} 计算机{userName} 用户"; - } - + } } diff --git a/newFront/c#前端/SWS.CAD/Start.cs b/newFront/c#前端/SWS.CAD/Start.cs index 9557004b..98b35901 100644 --- a/newFront/c#前端/SWS.CAD/Start.cs +++ b/newFront/c#前端/SWS.CAD/Start.cs @@ -77,7 +77,7 @@ namespace SWS.CAD GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); GlobalObject._prismContainer.RegisterDialog(); - GlobalObject._prismContainer.RegisterDialog(); + GlobalObject._prismContainer.RegisterDialog(); } } } diff --git a/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs index c476f065..bc88265c 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/LeftPanelViewModel.cs @@ -432,6 +432,8 @@ namespace SWS.CAD.ViewModels { foreach (Model.TreeModel node in trees) { + if (node.NodeType == "0"||node.ChildNodes!=null&&node.ChildNodes.Any()) + { CheckInOutStatus(node.ChildNodes); } foreach (var item in node.ChildNodes) { ec_drawing_file dwgObj = JsonConvert.DeserializeObject(item.NodeExtData.ToString()); @@ -491,6 +493,7 @@ namespace SWS.CAD.ViewModels originDrawings = JsonConvert.DeserializeObject>(data.ToString()); Drawings = new ObservableCollection(originDrawings); Drawings = CheckInOutStatus(Drawings); + GlobalObject.AllDrawings= Drawings.ToList(); curProjName = "当前项目:" + GlobalObject.curProject.ProjectName; LoginOK = true; //放置元件列表树 @@ -756,7 +759,7 @@ namespace SWS.CAD.ViewModels /// 图纸 private async void onOpenDwg(Model.TreeModel model) { - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); var msg = string.Empty; var dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); if (dwgObj.IsPublish == 1) @@ -797,7 +800,7 @@ namespace SWS.CAD.ViewModels /// private async void OpenDwgByMyself(Model.TreeModel model) { - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); var dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); string msg = string.Empty; if (!string.IsNullOrEmpty(dwgObj.PCInfo) && !GlobalObject.GetPCInfo().Equals(dwgObj.PCInfo))//对比PCInfo @@ -848,7 +851,7 @@ namespace SWS.CAD.ViewModels private async void DownDwgByOpenReadOnly(Model.TreeModel model) { #region 下载文件,只读打开 - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); var msg = string.Empty; var dwgObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); if (File.Exists(filePath)) @@ -860,7 +863,7 @@ namespace SWS.CAD.ViewModels } //已有本地图纸文件移至备份文件夹 string now = DateTime.Now.ToString("yyyyMMddHHmmss");//加上当前时间,防止重名 - string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(), now + model.Text); + string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(model.ID), now + model.Text); File.Move(filePath, backFile); MessageBox.Show($"本地图纸文件已移至:{backFile} !"); } @@ -933,7 +936,7 @@ namespace SWS.CAD.ViewModels { try { - System.Diagnostics.Process.Start(GlobalObject.GetDwgFileFolder()); + System.Diagnostics.Process.Start(GlobalObject.GetDwgFileFolder(model.ID)); } catch (Exception ex) { @@ -955,7 +958,7 @@ namespace SWS.CAD.ViewModels return; } string msg = string.Empty; - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); #region 校验 if (!File.Exists(filePath)) @@ -1086,7 +1089,7 @@ namespace SWS.CAD.ViewModels ec_drawing_file dwgObj = model.dwgObj; List handles = model.handles; ec_drawing_syn syn = model.syn; - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.DrawingFileName); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.dwgObj.DrawingFileID), dwgObj.DrawingFileName); //预检入校验 var msg = await _dwgService.PreCheckInDrawingFile(dwgObj, handles); if (!string.IsNullOrEmpty(msg)) @@ -1155,7 +1158,7 @@ namespace SWS.CAD.ViewModels /// private async Task CheckOut(Model.TreeModel model) { - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); if (File.Exists(filePath)) { if (FileHelper.IsFileLocked(filePath)) @@ -1163,12 +1166,12 @@ namespace SWS.CAD.ViewModels MessageBox.Show($"本地图纸文件:{model.Text} 已存在并被打开,请关闭文件再检出"); return false; } - string backFolder = GlobalObject.GetBackupDwgFileFolder(); + string backFolder = GlobalObject.GetBackupDwgFileFolder(model.ID); if (MessageBoxResult.OK == MessageBox.Show($"本地图纸文件:{model.Text} 已存在,继续检出会把本地图纸移至:[{backFolder}]", "是否继续检出", MessageBoxButton.OKCancel, MessageBoxImage.Question)) { //本地图纸文件移至备份文件夹 string now = DateTime.Now.ToString("yyyyMMddHHmmss");//加上当前时间,防止重名 - string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(), now + model.Text); + string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(model.ID), now + model.Text); File.Move(filePath, backFile); } else @@ -1191,7 +1194,7 @@ namespace SWS.CAD.ViewModels return false; } //打开图纸文件 - filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); msg = General.OpenDwg(filePath); //更新图纸节点图标和字体颜色 @@ -1225,7 +1228,7 @@ namespace SWS.CAD.ViewModels var msg = await _dwgService.FreeDrawingFile(model.ID); if (!string.IsNullOrEmpty(msg)) { MessageBox.Show("释放失败,信息:" + msg); return; } - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); if (!FileHelper.IsFileLocked(filePath)) { File.Delete(filePath); }//删除本地图纸文件 MessageBox.Show("释放成功!"); @@ -1531,7 +1534,7 @@ namespace SWS.CAD.ViewModels { //下载文件 var dwgfileDto = await _annexesService.GetAnnexesFile(item.FolderId); - var filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), item.LibraryFileName + ".dwg"); + var filePath = Path.Combine(GlobalObject.GetDwgFileFolder(id), item.LibraryFileName + ".dwg"); if (File.Exists(filePath)) { File.Delete(filePath); } msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id); @@ -1543,7 +1546,7 @@ namespace SWS.CAD.ViewModels var img = General.GetDwgThumbnail(filePath); if (img != null) { - var imgPath = Path.Combine(GlobalObject.GetDwgFileFolder(), item.LibraryFileName + ".png"); + var imgPath = Path.Combine(GlobalObject.GetDwgFileFolder(id), item.LibraryFileName + ".png"); if (File.Exists(imgPath)) { File.Delete(imgPath); } img.Save(imgPath); @@ -1675,7 +1678,7 @@ namespace SWS.CAD.ViewModels { if (model == null) return; if (model.NodeType != "91") return; - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); var pixel = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); var dwgObj = await _dwgService.GetDrawingFile(pixel.DrawingFileID); //获取属性 @@ -1797,7 +1800,7 @@ namespace SWS.CAD.ViewModels GlobalObject.ListDwgOpened.Add(new DrawingOpened() { Id = dwgObj.DrawingFileID, - Path = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.DrawingFileName), + Path = Path.Combine(GlobalObject.GetDwgFileFolder(dwgObj.DrawingFileID), dwgObj.DrawingFileName), IsReadOnly = isReadOnly }); } @@ -1815,7 +1818,7 @@ namespace SWS.CAD.ViewModels GlobalObject.ListDwgOpened.Add(new DrawingOpened() { Id = dwgObj.ID, - Path = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.Text), + Path = Path.Combine(GlobalObject.GetDwgFileFolder(dwgObj.ID), dwgObj.Text), IsReadOnly = isReadOnly }); } @@ -2138,7 +2141,7 @@ namespace SWS.CAD.ViewModels private async void onReadOnlyOpenDwg(Model.TreeModel model) { #region 下载文件,只读打开 - string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text); + string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text); var msg = string.Empty; var dwgPublishObj = JsonConvert.DeserializeObject(model.NodeExtData.ToString()); if (File.Exists(filePath)) @@ -2214,7 +2217,7 @@ namespace SWS.CAD.ViewModels { string tagNum = string.Empty; var tagNumber = RES.Parameters.GetValue(GlobalObject.dialogPar.info.ToString()); - var dgwFilePath = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgLibrary.LibraryFileName + ".dwg"); + var dgwFilePath = Path.Combine(GlobalObject.GetDwgFileFolder(dwgFile.Id), dwgLibrary.LibraryFileName + ".dwg"); var objId = General.InsertExternalDWG(dgwFilePath, tagNumber, ref tagNum); #region 图纸上保存图元属性 if (!objId.IsNull) diff --git a/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs b/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs index ceb7e9b8..f2b54444 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/NewDrawingViewModel.cs @@ -353,7 +353,7 @@ namespace SWS.CAD.ViewModels //根据模板实体的FolderId,获取上传文件的实体 var dwgfileDto = await _annexesService.GetAnnexesFile(templatefileDto.FolderId); // 指定新 DWG 文件的保存路径 - string folderPath = GlobalObject.GetDwgFileFolder(); + string folderPath = GlobalObject.GetDwgFileFolder(dwgObj.DrawingCatalogueID); string filePath = Path.Combine(folderPath, dwgObj.DrawingFileName); var msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id); if (!string.IsNullOrEmpty(msg)) @@ -414,7 +414,7 @@ namespace SWS.CAD.ViewModels //旧图纸文件名和新图纸文件名不一致,则修改本地图纸文件名 if (oldDwgFileName != dwgObj.DrawingFileName) { - string folderPath = GlobalObject.GetDwgFileFolder(); + string folderPath = GlobalObject.GetDwgFileFolder(dwgObj.DrawingFileID); var oldFilePath = Path.Combine(folderPath, oldDwgFileName); if (FileHelper.IsFileLocked(oldFilePath)) { diff --git a/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs b/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs index 14555b53..a19352b7 100644 --- a/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs +++ b/newFront/c#前端/SWS.CAD/ViewModels/myViewModelBase/DialogBase.cs @@ -36,10 +36,7 @@ namespace SWS.CAD.ViewModels.myViewModelBase //Application.ShowModalDialog(Application.MainWindow,);// 用来显示WinForms对话框 Application.ShowModalWindow(Application.MainWindow.Handle, loginView);//用来显示WPF的对话框,任务栏里可以看到2个Windows - //if (GlobalObject.userInfo == null) - //{ - // CloseWindowAction?.Invoke();//依旧没登录上的话,放这里没用,因为这个时候,主体还没加载呢 - //} + } } if (GlobalObject.curProject == null) diff --git a/newFront/c#前端/SWS.CAD/Views/LeftPanel.xaml b/newFront/c#前端/SWS.CAD/Views/LeftPanel.xaml index b2b277ab..bcc94809 100644 --- a/newFront/c#前端/SWS.CAD/Views/LeftPanel.xaml +++ b/newFront/c#前端/SWS.CAD/Views/LeftPanel.xaml @@ -2,12 +2,12 @@ x:Class="SWS.CAD.Views.LeftPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Behaviors="clr-namespace:SWS.Commons.Helper.Behaviours;assembly=SWS.Commons" xmlns:converter="clr-namespace:SWS.CAD.Converter" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:local="clr-namespace:SWS.CAD.Views" xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model" - xmlns:Behaviors="clr-namespace:SWS.Commons.Helper.Behaviours;assembly=SWS.Commons" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Width="250" Loaded="UserControl_Loaded"> @@ -188,12 +188,12 @@ x:Name="radTreeView" Grid.Row="2" Grid.ColumnSpan="2" - Background="Transparent" Margin="-5,0,0,0" + Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectedNode, Mode=TwoWay}" + Background="Transparent" FontSize="11" ItemsSource="{Binding Drawings}" - PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown" - Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectedNode, Mode=TwoWay}"> + PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown"> + PreviewMouseRightButtonDown="treeDwgHistory_PreviewMouseRightButtonDown"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + public string TagNumber_Lower { get; set; } = ""; - + /// + /// 房间号 + /// + public string RoomNo { get; set; } /// /// 图元文件Id ///