电气前端提交

This commit is contained in:
CHEN-ZW\acer 2025-08-15 16:34:31 +08:00
parent ccec2b32c7
commit 45bd4860bc
920 changed files with 1451840 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bricscad.EditorInput;
using Teigha.DatabaseServices;
using Teigha.Geometry;
using Teigha.GraphicsInterface;
namespace SWS.CAD.CADFunc
{
// 自定义Jig类
public class BlockDragJig : DrawJig
{
private BlockReference _br;
private Bricscad.EditorInput.Editor _ed;
private Point3d _insertPoint;
public BlockDragJig(BlockReference br, Bricscad.EditorInput.Editor ed)
{
_br = br;
_ed = ed;
}
// 实时更新位置
protected override bool WorldDraw(WorldDraw draw)
{
draw.Geometry.Draw(_br);
return true;
}
// 处理鼠标移动
protected override SamplerStatus Sampler(JigPrompts prompts)
{
JigPromptPointOptions ppo = new JigPromptPointOptions("\n指定图元位置: ");
ppo.UserInputControls = UserInputControls.Accept3dCoordinates |
UserInputControls.NoZeroResponseAccepted |
UserInputControls.NoNegativeResponseAccepted;
PromptPointResult ppr = prompts.AcquirePoint(ppo);
if (ppr.Value != _insertPoint)
{
_insertPoint = ppr.Value;
_br.Position = _insertPoint;
return SamplerStatus.OK;
}
else
{
return SamplerStatus.NoChange;
}
}
// 获取最终插入点
public Point3d InsertPoint => _insertPoint;
}
}

View File

@ -0,0 +1,30 @@
using Bricscad.ApplicationServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teigha.Runtime;
namespace SWS.CAD.CADFunc.Editor
{
public class EditorHelper
{
/// <summary>
/// 写提示文字
/// </summary>
/// <param name="info"></param>
public static void WriteInfo(string info)
{
var editor = Application.DocumentManager.MdiActiveDocument?.Editor;// 获取当前文档的命令行编辑器对象。
if (editor != null)
{
editor.WriteMessage($"{GlobalObject.editorPre}{info}");
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class GetHandsIdEvent : PubSubEvent<List<string>>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class GetdwgFileIdEvent : PubSubEvent<string>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class IORelationEvent : PubSubEvent<bool>
{
}
}

View File

@ -0,0 +1,19 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Views.CustomControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
/// <summary>
/// 新增元件页面的失去焦点事件
/// </summary>
public class NewComponent_LostFocusEvent : PubSubEvent<propertyModel>
{
}
}

View File

@ -0,0 +1,19 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Views.CustomControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
/// <summary>
/// 选择电缆位号页面的选择变更事件
/// </summary>
public class NewPositional_SelectChangeEvent : PubSubEvent<propertyModel>
{
}
}

View File

@ -0,0 +1,10 @@
using System.Collections.Generic;
using Prism.Events;
using SWS.CAD.Models;
namespace SWS.CAD.Event
{
public class SelectProjectEvent : PubSubEvent<List<ec_notification>>
{
}
}

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Views.CustomControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class SelectionChangeEvent : PubSubEvent<propertyModel>
{
}
}

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Models.NoEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class checkInEvent : PubSubEvent<CheckInModel>
{
}
}

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Models.NoEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class checkInResultEvent : PubSubEvent<bool>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class drawingChangeEvent : PubSubEvent<ec_drawing_file>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class getPropertyEvent : PubSubEvent<List<string>>
{
}
}

View File

@ -0,0 +1,9 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
namespace SWS.CAD.Event
{
public class loginEvent: PubSubEvent<JToken>
{
}
}

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using SWS.CAD.Views.CustomControl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class propertyChangeEvent : PubSubEvent<propertyModel>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class selectPixelsEvent : PubSubEvent<string>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class tagChangeEvent : PubSubEvent<TreeModel>
{
}
}

View File

@ -0,0 +1,15 @@
using Newtonsoft.Json.Linq;
using Prism.Events;
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Event
{
public class treeNodeChangeEvent : PubSubEvent<TreeModel>
{
}
}

View File

@ -0,0 +1,455 @@
using IniParser;
using Prism.Ioc;
using SWS.CAD.Models;
using SWS.CAD.Models.NoEntity;
using SWS.CAD.Services;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Media;
using Unity;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
namespace SWS.CAD
{
public class GlobalObject
{
public static string templateForDrawing = "普通图框";
public static string editorPre = "DI_Electrical ";
public static string TemplateFile_Template = "普通图框";
public enum DBConst
{
/// <summary>
/// 图纸类型
/// </summary>
Be_DrawingType,
/// <summary>
/// 图纸阶段
/// </summary>
Be_DrawingStage,
/// <summary>
/// 图纸系统
/// </summary>
Be_DrawingSystem,
/// <summary>
/// 材料统计
/// </summary>
Be_MaterialCensus,
/// <summary>
/// 材料范围
/// </summary>
Be_MaterialRange
}
#region
static List<ec_dataitemdetail> _dwgType;
/// <summary>
/// 初始化图纸类型列表
/// </summary>
/// <returns></returns>
public static List<ec_dataitemdetail> DwgType()
{
var res0 = new ec_dataitem { DataItemName = "图纸类型", DataItemCode = DBConst.Be_DrawingType.ToString() };
if (_dwgType == null)
{
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingType.ToString()));
var res2 = res.Result;
return res2;
}
else
{
return _dwgType;
}
}
#endregion
#region
static List<ec_dataitemdetail> _dwgMaterialRange;
/// <summary>
/// 初始化材料材料范围
/// </summary>
/// <returns></returns>
public static List<ec_dataitemdetail> DwgMaterialRange()
{
var res0 = new ec_dataitem { DataItemName = "材料范围", DataItemCode = DBConst.Be_MaterialRange.ToString() };
if (_dwgMaterialRange == null)
{
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialRange.ToString()));
var res2 = res.Result;
return res2;
}
else
{
return _dwgMaterialRange;
}
}
#endregion
#region
static List<ec_dataitemdetail> _dwgMaterialCensus;
/// <summary>
/// 初始化材料统计列表
/// </summary>
/// <returns></returns>
public static List<ec_dataitemdetail> DwgMaterialCensus()
{
var res0 = new ec_dataitem { DataItemName = "材料统计", DataItemCode = DBConst.Be_MaterialCensus.ToString() };
if (_dwgMaterialCensus == null)
{
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialCensus.ToString()));
var res2 = res.Result;
return res2;
}
else
{
return _dwgMaterialCensus;
}
}
#endregion
#region
static List<ec_dataitemdetail> _dwgStage;
/// <summary>
/// 初始化图纸阶段列表
/// </summary>
/// <returns></returns>
public static List<ec_dataitemdetail> DwgStage()
{
var res0 = new ec_dataitem { DataItemName = "图纸阶段", DataItemCode = DBConst.Be_DrawingStage.ToString() };
if (_dwgStage == null)
{
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingStage.ToString()));
var res2 = res.Result;
return res2;
}
else
{
return _dwgStage;
}
}
#endregion
#region
static ObservableCollection<TreeModel> _dwgSystem;
/// <summary>
/// 初始化图纸系统列表
/// </summary>
/// <returns></returns>
public static ObservableCollection<TreeModel> DwgSystem()
{
var res0 = new ec_dataitem { DataItemName = "图纸系统", DataItemCode = DBConst.Be_DrawingSystem.ToString() };
if (_dwgSystem == null)
{
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingSystem.ToString()));
var res2 = res.Result;
var res3 = DataItemDetailsToTree(res2);
return res3;
}
else
{
return _dwgSystem;
}
}
#endregion
#region DataItemDetail列表转换成树形结果
/// <summary>
/// DataItemDetail列表转换成树形结果
/// </summary>
/// <param name="listData">列表数据</param>
/// <param name="isChildres">是否子节点遍历添加</param>
/// <returns></returns>
public static ObservableCollection<TreeModel> DataItemDetailsToTree(List<ec_dataitemdetail> listData, bool isChildres = false)
{
ObservableCollection<TreeModel> result = new ObservableCollection<TreeModel>();
List<ec_dataitemdetail> list = new List<ec_dataitemdetail>();
if (isChildres)
{ list = listData; }
else
{
//取所有第一级树
list = listData.Where(a => a.UpDataItemDetailID == "0").ToList();
}
foreach (var data in list)
{
//获取当前节点的所有子节点
var details = listData.Where(a => a.UpDataItemDetailID == data.DataItemDetailID).ToList();
if (details.Any())
{
//获取子节点
var childrens = DataItemDetailsToTree(details, true);
result.Add(new TreeModel
{
ID = data.DataItemDetailID,
Text = data.DataItemName,
ChildNodes = childrens
});
}
else
{
//没有子节点就添加当前节点Node
result.Add(new TreeModel
{
ID = data.DataItemDetailID,
Text = data.DataItemName,
});
}
}
return result;
}
#endregion
#region
/// <summary>
/// 对象类型树
/// </summary>
public static List<TreeModel> objectTypeTree = new List<TreeModel>();
#endregion
#region
/// <summary>
/// 设计浏览树
/// </summary>
public static List<TreeModel> designTree = new List<TreeModel>();
#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<User> Users;
public static bool isConfigIniCreateBySys = true;
//public static string drawingFileId;
public static ec_project curProject;
public static DateTime preClickTime = DateTime.Now;
public static Style TransparentComboBoxStyle;
public static Style WhiteStyle;
public static Unit UnitSelected;
public static List<ec_measuring_unit> Units;
/// <summary>
/// 打开的图纸名列表
/// </summary>
public static List<DrawingOpened> ListDwgOpened = new List<DrawingOpened>();
/// <summary>
/// 图纸树上的所有图纸名
/// </summary>
public static List<string> AllDwgName = new List<string>();
public static string currentTagNumber;
#region
static string _LocalFileDirectory;
/// <summary>
/// 获取本地目录文件夹
/// </summary>
/// <returns></returns>
public static string GetLocalFileDirectory()
{
if (string.IsNullOrEmpty(_LocalFileDirectory))
{
string path = Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Config.ini");
FileIniDataParser parser = new FileIniDataParser();
var data = parser.ReadFile(path);
_LocalFileDirectory = data["Profile"]["Directory"];
return _LocalFileDirectory;
}
else
{ return _LocalFileDirectory; }
}
/// <summary>
/// 设置本地目录文件夹
/// </summary>
/// <param name="dir">文件夹目录</param>
public static void SetLocalFileDirectory(string dir)
{ _LocalFileDirectory = dir; }
#endregion
#region
/// <summary>
/// 图纸文件所在文件夹
/// </summary>
/// <returns></returns>
public static string GetDwgFileFolder()
{
string path = Path.Combine(GetLocalFileDirectory(), curProject.ProjectIndex.ToString());
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
return path;
}
#endregion
#region
/// <summary>
/// 图纸文件备份文件夹
/// </summary>
/// <returns></returns>
public static string GetBackupDwgFileFolder()
{
string path = Path.Combine(GetDwgFileFolder(), "Backup");
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
return path;
}
#endregion
#region ID获取用户名称
/// <summary>
/// 根据ID获取用户名称
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
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
/// <summary>
/// 查找子控件
/// </summary>
/// <typeparam name="T">子控件的类型</typeparam>
/// <param name="obj">要找的是obj的子控件</param>
/// <param name="name">想找的子控件的Name属性</param>
/// <returns>目标子控件</returns>
public static T GetChildObject<T>(DependencyObject obj, string name) where T : FrameworkElement
{
DependencyObject child = null;
T grandChild = null;
for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
{
child = VisualTreeHelper.GetChild(obj, i);
if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
{
return (T)child;
}
else
{
// 在下一级中没有找到指定名字的子控件,就再往下一级找
grandChild = GetChildObject<T>(child, name);
if (grandChild != null)
return grandChild;
}
}
return null;
}
#endregion
#region
/// <summary>
/// 判断是否是电缆
/// </summary>
/// <returns></returns>
public static bool IsCable(ec_objecttype obj)
{
if (obj == null) { return false; }
var flag = obj.ObjectTypeName.EndsWith("电缆");
return flag;
}
#endregion
#region
/// <summary>
/// 取字符串最后的一个或多个数字
/// </summary>
/// <param name="input">输入字符串</param>
/// <param name="preInput">数字前的字符串</param>
/// <param name="num">最后的数字</param>
/// <returns></returns>
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
/// <summary>
///
/// </summary>
/// <param name="resName">包括命名空间</param>
/// <returns></returns>
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} 用户";
}
}
}

View File

@ -0,0 +1,51 @@
using Microsoft.Xaml.Behaviors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Telerik.Windows.Controls;
namespace SWS.CAD.Helper
{
public class PasswordBoxBehavior : Behavior<RadPasswordBox>
{
public static readonly DependencyProperty PasswordProperty =
DependencyProperty.Register(nameof(Password), typeof(string), typeof(PasswordBoxBehavior),
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnPasswordChanged));
public string Password
{
get { return (string)GetValue(PasswordProperty); }
set { SetValue(PasswordProperty, value); }
}
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.PasswordChanged += OnPasswordChanged;
}
protected override void OnDetaching()
{
base.OnDetaching();
AssociatedObject.PasswordChanged -= OnPasswordChanged;
}
private void OnPasswordChanged(object sender, RoutedEventArgs e)
{
Password = AssociatedObject.Password;
}
private static void OnPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is PasswordBoxBehavior behavior)
{
behavior.AssociatedObject.Password = e.NewValue as string ?? string.Empty;
}
}
}
}

View File

@ -0,0 +1,107 @@
using IniParser;
using SWS.CAD.Services;
using System;
using System.IO;
using System.Windows.Media.Animation;
namespace SWS.CAD.Helper
{
public class ConfigService
{
public string path = Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Config.ini");
public FileIniDataParser parser = new FileIniDataParser();
public HttpService _httpService;
/// <summary>
/// config.ini 给默认值,且创建出来
/// </summary>
void SetDefaultConfigValue()
{
if (!File.Exists(path))
{//默认值
var data = parser.Parser.Parse("");
data["Profile"]["Address"] = "1.117.161.11";
data["Profile"]["Port"] = "8080";
string userProfilePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
data["Profile"]["Directory"] = $"{userProfilePath}\\AppData\\Roaming\\SWS";
Directory.CreateDirectory(Path.GetDirectoryName(path));
parser.WriteFile(path, data);
GlobalObject.isConfigIniCreateBySys = true;
}
else
{
GlobalObject.isConfigIniCreateBySys = false;
}
}
public ConfigService(HttpService httpService)
{
_httpService = httpService;
SetDefaultConfigValue();
string address;
int port;
string locDrawingPath;
Read(out address, out port,out locDrawingPath);
_httpService.Init(address, port);
}
public void Read(out string address, out int port, out string directory)
{
var data = parser.ReadFile(path);
address = data["Profile"]["Address"];
port = int.Parse(data["Profile"]["Port"]);
directory = data["Profile"]["Directory"];
}
/// <summary>
/// 查询某个
/// </summary>
/// <param name="keyName"></param>
/// <returns></returns>
public string Read(string keyName)
{
var data = parser.ReadFile(path);
return data["Profile"][keyName];
}
/// <summary>
/// 查询某个
/// </summary>
/// <param name="session">节点</param>
/// <param name="keyName">key名称</param>
/// <returns></returns>
public string Read(string session,string keyName)
{
try
{
var data = parser.ReadFile(path);
return data[session][keyName];
}
catch
{
return null;
}
}
/// <summary>
/// 保存某个
/// </summary>
/// <param name="keyName"></param>
/// <param name="value"></param>
public void Save(string keyName, string value)
{
var data = parser.ReadFile(path);
data["Profile"][keyName] = value;
parser.WriteFile(path, data);
}
/// <summary>
/// 保存某个值
/// </summary>
/// <param name="session">节点</param>
/// <param name="keyName">key名称</param>
/// <param name="value">值</param>
public void Save(string session, string keyName, string value)
{
var data = parser.ReadFile(path);
data[session][keyName] = value;
parser.WriteFile(path, data);
}
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;
using SWS.CAD.Models;
namespace SWS.CAD.Helper.Converter
{
public class CollectionToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
ObservableCollection<ec_dataitemdetail> WHCPUs = value as ObservableCollection<ec_dataitemdetail>;
if (WHCPUs != null)
{
string sWHCPU = "";
for (int i = 0; i < WHCPUs.Count; i++)
{
if (i!= WHCPUs.Count-1)
{
if (WHCPUs[i] != null)
{
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode + "|";
}
}
else
{
if (WHCPUs[i] != null)
{
sWHCPU = sWHCPU + WHCPUs[i].DataItemCode;
}
}
}
return sWHCPU;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Windows.Data;
using SWS.CAD.Models;
using static OfficeOpenXml.ExcelErrorValue;
namespace SWS.CAD.Helper.Converter
{
public class ComboBoxFilterConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
// 检查参数有效性
if (values == null || values.Length < 2)
return null;
// 获取当前行选中的值
var currentSelection = values[0] as string;
// 获取可用选项集合兼容C# 7.3的类型检查)
var availableOptions = values[1] as ObservableCollection<string>;
if (availableOptions == null)
return null;
var validOptions = new List<string>(availableOptions);
// 添加当前行已选值(允许取消选择)
if (!string.IsNullOrEmpty(currentSelection) && !validOptions.Contains(currentSelection))
{
validOptions.Add(currentSelection);
}
return validOptions;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace SWS.CAD.Converter
{
public class ExpandConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// 假设我们基于某个布尔属性来决定是否展开
return (bool)value; // 直接返回布尔值用于IsExpanded绑定
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value;
//throw new NotImplementedException(); // 不需要实现反向转换
}
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Windows.Media.Imaging;
using System.Windows;
using System.Windows.Data;
namespace SWS.CAD.Converter
{
public class ImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return DependencyProperty.UnsetValue;
var path = value.ToString();
BitmapImage image = new BitmapImage();
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
image.UriSource = new Uri(path, UriKind.Absolute);
image.EndInit();
return image;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace SWS.CAD.Converter
{
public class NotificationCheckFLGConverter : IValueConverter
{
/// <summary>
/// 源到目标
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// string ret = "";
if (value == null)
return "未读";
return value.ToString() == "0" ? "未读" : "已读";
}
/// <summary>
/// 目标到源
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using SWS.CAD.ViewModels;
namespace SWS.CAD.Helper.Converter
{
internal class RadGridViewRowToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SignalManagementInfo smif = value as SignalManagementInfo;
if (smif != null)
{
if (smif.Status.Equals("deleted") || smif.Status.Equals("Confirmed"))
{
return true;
}
if (smif.type.Equals("信号"))
{
switch (parameter.ToString())
{
case "关联的电缆信息":
case "关联的通道信息":
return true;
}
}
else
{
switch (parameter.ToString())
{
case "组别":
case "编码":
case "信号类型":
case "Min":
case "Max":
case "单位":
case "CODE":
case "设备名":
case "关联的电缆信息":
case "关联的通道信息":
return true;
}
}
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using SWS.CAD.Models;
using SWS.CAD.ViewModels;
using Teigha.GraphicsSystem;
namespace SWS.CAD.Helper.Converter
{
internal class SelectedItemToBoolConverter : IMultiValueConverter
{
object IMultiValueConverter.Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values[0] != null)
{
TreeModel c = (TreeModel)values[0];
dynamic dynamicObj = c.NodeExtData;
string PanelIDValue = dynamicObj.PanelID;
if (c.NodeType.Equals("0"))
{
switch (values[1].ToString())
{
case "新增位置":
return true;
case "新建端子排":
return false;
case "修改位置,端子排信息":
return true;
case "删除节点":
return true;
case "选择位号关联通道":
return false;
case "选择电缆关联通道":
return false;
case "解除电缆关联通道":
return false;
case "新增端子排通道":
return false;
case "删除端子排通道":
return false;
}
}
else if (c.NodeType.Equals("1") && c.ID.Equals(PanelIDValue))
{
switch (values[1].ToString())
{
case "新增位置":
return false;
case "新建端子排":
return true;
case "修改位置,端子排信息":
return false;
case "删除节点":
return false;
case "选择位号关联通道":
return false;
case "选择电缆关联通道":
return false;
case "解除电缆关联通道":
return false;
case "新增端子排通道":
return false;
case "删除端子排通道":
return false;
}
}
else if(c.NodeType.Equals("1") && c.parentId.Equals(PanelIDValue))
{
switch (values[1].ToString())
{
case "新增位置":
return false;
case "新建端子排":
return false;
case "修改位置,端子排信息":
return true;
case "删除节点":
return true;
case "选择位号关联通道":
return true;
case "选择电缆关联通道":
return true;
case "解除电缆关联通道":
return true;
case "新增端子排通道":
return true;
case "删除端子排通道":
return true;
}
}
}
else
{
return false;
}
return false;
}
object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using SWS.CAD.ViewModels;
namespace SWS.CAD.Helper.Converter
{
internal class StatusToColourConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
SignalManagementInfo smif = value as SignalManagementInfo;
if (smif != null)
{
return smif.Status;
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace SWS.CAD.Converter
{
public class YesNotConverter : IValueConverter
{
/// <summary>
/// 源到目标
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null)
return "";
return value.ToString() == "1" ? "是" : "否";
}
/// <summary>
/// 目标到源
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns></returns>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Helper
{
public static class FileHelper
{
/// <summary>
/// dwg等文件名是否合法。不带后缀
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public static bool IsValidFileName(string fileName)
{
if (string.IsNullOrEmpty(fileName))
{
return false;
}
// 获取 Windows 文件系统中不允许出现在文件名中的字符数组
char[] invalidChars = Path.GetInvalidFileNameChars();
// 检查文件名中是否包含非法字符
foreach (char c in invalidChars)
{
if (fileName.IndexOf(c) >= 0)
{
return false;
}
}
// 检查是否为保留文件名
string[] reservedNames = { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" };
string trimmedFileName = Path.GetFileNameWithoutExtension(fileName).Trim().ToUpper();
foreach (string reservedName in reservedNames)
{
if (trimmedFileName == reservedName)
{
return false;
}
}
// 检查文件名是否以空格或句点结尾
if (fileName.TrimEnd().Length != fileName.Length || fileName.TrimEnd('.').Length != fileName.Length)
{
return false;
}
return true;
}
public static string GetFileMD5(string filePath)
{
if (string.IsNullOrEmpty(filePath) || !File.Exists(filePath))
{
throw new ArgumentException("文件路径无效或文件不存在", nameof(filePath));
}
using (var md5 = MD5.Create()) // 创建 MD5 哈希算法实例
using (var stream = File.OpenRead(filePath)) // 打开文件流
{
// 计算文件的 MD5 值
byte[] hashBytes = md5.ComputeHash(stream);
// 将字节数组转换为十六进制字符串
StringBuilder sb = new StringBuilder();
foreach (var b in hashBytes)
{
sb.Append(b.ToString("x2")); // x2 格式化为两位小写十六进制数
}
return sb.ToString(); // 返回 MD5 值的字符串
}
}
#region
/// <summary>
/// 检查文件是否被其他进程占用
/// </summary>
public static bool IsFileLocked(string filePath)
{
try
{
// 尝试以独占模式打开文件
using (FileStream fs = File.Open(
filePath,
FileMode.Open,
FileAccess.ReadWrite,
FileShare.None)) // FileShare.None 表示禁止共享
{
return false; // 成功打开则未被占用
}
}
catch (IOException ex)
{
// 检查特定错误码
int errorCode = Marshal.GetHRForException(ex) & 0xFFFF;
return errorCode == 32 || errorCode == 33; // 32: 共享冲突, 33: 进程锁定
}
catch (UnauthorizedAccessException)
{
return true; // 无权限访问(可能被占用)
}
catch
{
return false; // 其他异常视为未被占用
}
}
#endregion
}
}

View File

@ -0,0 +1,144 @@
using System;
using System.IO;
using System.Reflection;
using Newtonsoft.Json.Linq;
namespace SWS.CAD.Helper
{
/// <summary>
/// nLog使用帮助类
/// </summary>
public class LoggerHelper
{
private static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo");
private static readonly log4net.ILog logerror = log4net.LogManager.GetLogger("logerror");
private static readonly log4net.ILog logdebug = log4net.LogManager.GetLogger("logdebug");
private static readonly log4net.ILog logwarn = log4net.LogManager.GetLogger("logwarn");
private static readonly log4net.ILog logfatal = log4net.LogManager.GetLogger("logfatal");
private static LoggerHelper _obj = null;
private static string logPath = string.Empty;
private LoggerHelper()
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
string dllPath = codeBase.Replace("file:///", "");
dllPath = Path.GetDirectoryName(dllPath);
logPath = Path.Combine(dllPath, "Logs\\");
var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config"));
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile);
}
/// <summary>
/// 获取当前的日志记录<see cref="LoggerHelper"/>对象。
/// </summary>
public static LoggerHelper Current
{
get => _obj ?? (new LoggerHelper());
set => _obj = value;
}
#region Debug
/// <summary>
/// 调试信息输出。
/// </summary>
/// <param name="msg">需要记录的信息。</param>
public void Debug(string msg)
{
logdebug.Debug(msg);
}
#endregion
#region Info
/// <summary>
/// 普通信息输出。
/// </summary>
/// <param name="msg">需要记录的信息。</param>
public void Info(string msg)
{
loginfo.Info(msg);
}
#endregion
#region Warn
/// <summary>
/// 警告级别信息输出。
/// </summary>
/// <param name="msg">需要记录的信息。</param>
public void Warn(string msg)
{
logwarn.Warn(msg);
}
#endregion
#region Error
/// <summary>
/// 错误级别信息输出。
/// </summary>
/// <param name="msg">需要记录的信息。</param>
public void Error(string msg)
{
logerror.Error("----------------------------Error BEGIN------------------------------");
logerror.Error(msg);
logerror.Error("-----------------------------Error END-------------------------------");
}
#endregion
#region Fatal,
/// <summary>
/// 致命错误级别信息输出。
/// </summary>
/// <param name="msg">需要记录的信息。</param>
/// <param name="err">需要记录的系统异常。</param>
public void Fatal(string msg)
{
logfatal.Fatal("----------------------------Fatal BEGIN------------------------------");
logerror.Fatal(msg);
logerror.Fatal("-----------------------------Fatal END-------------------------------");
}
#endregion
#region json日志
/// <summary>
/// 输出json日志
/// </summary>
/// <param name="funName">json方法名</param>
/// <param name="json">json数据</param>
public void WriteJson(string funName, string json)
{
try
{
//json路径文件名 Environment.ExpandEnvironmentVariables(@"%USERPROFILE%\AppData\Roaming\SWS\Logs\"
string filename = Path.Combine(logPath, funName + ".json");
//判断文件是否被打开占用
if (!FileHelper.IsFileLocked(filename))
{
File.Delete(filename);
string strJson = string.Empty;
if (json.StartsWith("["))
{
//格式化json数据 当前为组类型
JArray jobj = JArray.Parse(json);
strJson = jobj.ToString();
}
else if (json.StartsWith("{"))
{
//格式化json数据 当前为类类型
JObject jobj = JObject.Parse(json);
strJson = jobj.ToString();
}
//创建json文件并输出数据
FileStream fs = new FileStream(filename, FileMode.Append);
StreamWriter wr = null;
wr = new StreamWriter(fs);
wr.WriteLine(strJson);
wr.Close();
}
}
catch { }
}
#endregion
}
}

View File

@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SWS.CAD.Models;
namespace SWS.CAD.Helper
{
public class TreeHelper
{
#region
/// <summary>
/// 获取树节点
/// </summary>
public static TreeModel GetTreeModel(TreeModel node, string id)
{
// 如果根节点为空则返回null
if (node == null) return null;
// 如果找到当前节点,返回当前节点
if (node.ID == id) return node;
//没有子节点就返回null
if (node.ChildNodes == null) return null;
// 否则,递归地在子节点中查找
foreach (var child in node.ChildNodes)
{
var result = GetTreeModel(child, id);
if (result != null)
{
return result; // 找到后立即返回
}
}
// 如果在当前树中没有找到返回null
return null;
}
#endregion
#region
/// <summary>
/// 获取树节点
/// </summary>
public static TreeModel GetTreeModel(List<TreeModel> nodes, string id)
{
TreeModel node = null;
foreach (var dto in GlobalObject.objectTypeTree)
{
//获取节点下的图纸
node = TreeHelper.GetTreeModel(dto, id);
if (node != null)
{
break;
}
}
return node;
}
#endregion
#region
/// <summary>
/// 获取树节点所有图纸名
/// </summary>
public static void GetTreeText(TreeModel node)
{
// 如果根节点为空则返回null
if (node == null) return ;
//没有子节点就返回null
if (node.ChildNodes == null) return ;
// 否则,递归地在子节点中查找
foreach (var child in node.ChildNodes)
{
GetTreeText(child);
}
if (node.Text.ToLower().EndsWith(".dwg") && !GlobalObject.AllDwgName.Contains(node.Text))
{ GlobalObject.AllDwgName.Add(node.Text); }
// 如果在当前树中没有找到返回null
return ;
}
#endregion
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 963 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 786 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Windows.Controls;
namespace SWS.CAD.Models
{
public class CheckInLogNeedApproveModel: ViewModelBase
{
#region
/// <summary>
/// 图纸同步ID
/// </summary>
/// <returns></returns>
public string DrawingSynID { get; set; }
/// <summary>
/// 图纸文件ID。<see cref="ec_drawing_fileEntity.DrawingFileID"/>
/// </summary>
/// <returns></returns>
public string DrawingFileID { get; set; } = "";
/// <summary>
/// 版本
/// </summary>
/// <returns></returns>
public string FileVersion { get; set; } = "";
/// <summary>
/// 修改内容
/// </summary>
/// <returns></returns>
public string Remark { get; set; } = "";
/// <summary>
/// 附件文件夹ID
/// </summary>
/// <returns></returns>
public string FolderId { get; set; } = "";
/// <summary>
/// 图号
/// </summary>
public string DrawingNo { get; set; }
/// <summary>
/// 图名
/// </summary>
public string DrawingFile { get; set; }
/// <summary>
/// 相关页码
/// </summary>
public string PageNos { get; set; }
/// <summary>
/// 相关电缆
/// </summary>
public string Cables { get; set; }
/// <summary>
/// 是否影响填料函
/// </summary>
public int IsMaterial { get; set; }
/// <summary>
/// 修改类型(新增 删除 修改)
/// </summary>
public string Type { get; set; }
/// <summary>
/// 相关的云线句柄
/// </summary>
public string cloud { get; set; }
/// <summary>
/// 是否影响生产设计。1代表影响然后需要生产主管去确认。
/// </summary>
public int IsProcess { get; set; }
/// <summary>
/// 涉及的其他图纸ID或name。
/// </summary>
public string otherDwgIds { get; set; }
/// <summary>
/// 是否被生产主管确认
/// </summary>
public int ApproveByAdmin { get; set; } = 0;
/// <summary>
/// 创建人
/// </summary>
/// <returns></returns>
public string CreateUserID { get; set; }
/// <summary>
/// 创建时间
/// </summary>
/// <returns></returns>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
/// <returns></returns>
public string UpdateUserID { get; set; }
/// <summary>
/// 更新时间
/// </summary>
/// <returns></returns>
public DateTime? UpdateTime { get; set; }
#endregion
#region
/// <summary>
/// 创建人名称
/// </summary>
/// <returns></returns>
public string CreateUserName { get; set; }
#endregion
private bool _IsSelected;
/// <summary>
/// 是否选中
/// </summary>
public bool IsSelected
{
get { return _IsSelected; }
set { _IsSelected = value; OnPropertyChanged(nameof(IsSelected)); }
}
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Models
{
public class CheckInModel
{
public ec_drawing_file dwgObj { get; set; }
public List<string> handles { get; set; }
public ec_drawing_syn syn { get; set; }
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Models.NoEntity
{
public class ConfigIni
{
/// <summary>
/// 用户名
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 用户密码
/// </summary>
public string UserPs { get; set; }
/// <summary>
/// 项目id
/// </summary>
public string ProjectID { get; set; }
/// <summary>
/// 服务器ip
/// </summary>
public string Address { get; set; }
/// <summary>
/// 端口
/// </summary>
public string Port { get; set; }
/// <summary>
/// 设计元件 最近使用
/// </summary>
public string RecentObjectType { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Models.NoEntity
{
public class ContextOperationModel
{
public string Header { get; set; }
public string IconGlyph { get; set; }
/// <summary>
/// 大概率会直接在xaml里绑定command。如Setter Property="Command" Value="{Binding Command}"。
/// 带了一个object参数可以xaml里再绑定一个CommandParameter进去。
/// </summary>
public DelegateCommand<object> Command { get; set; }
public ContextOperationModel(string header, DelegateCommand<object> delegateCommand)
{
Header = header;
Command = delegateCommand;
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Models
{
/// <summary>
/// 已打开编辑的图纸信息
/// </summary>
public class DrawingOpened
{
/// <summary>
/// 图纸ID
/// </summary>
public string Id { get; set; }
/// <summary>
/// 图纸路径
/// </summary>
public string Path { get; set; }
/// <summary>
/// 是否只读
/// </summary>
public bool IsReadOnly { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using System;
namespace SWS.CAD.Models
{
[AttributeUsage(AttributeTargets.All | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method,
AllowMultiple = true, Inherited = true)]
public class GroupAttribute : Attribute
{
/// <summary>
/// 分组名称
/// </summary>
public string GroupName;
/// <summary>
/// 初始化
/// </summary>
/// <param name="groupName">分组名称</param>
public GroupAttribute(string groupName)
{
GroupName=groupName;
}
}
}

View File

@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace SWS.CAD.Models
{
public class PageModel<T>
{
public List<T> Rows { get; set; }
public int Total { get; set; }
public int Records { get; set; }
}
}

View File

@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SWS.CAD.Views.CustomControl;
using Telerik.Windows.Controls;
namespace SWS.CAD.Models
{
public class PropertyObjectModel : ViewModelBase
{
private List<string> _listHandels = new List<string>();
/// <summary>
/// 句柄ID
/// </summary>
public List<string> listHandels
{
get { return _listHandels; }
set { _listHandels = value; RaisePropertyChanged(nameof(listHandels)); }
}
private string _tagNumber;
/// <summary>
/// 位号
/// </summary>
public string tagNumber
{
get { return _tagNumber; }
set
{
_tagNumber = value;
RaisePropertyChanged(nameof(tagNumber));
}
}
private string _objectTypeName;
/// <summary>
/// 元件名称
/// </summary>
public string objectTypeName
{
get { return _objectTypeName; }
set
{
_objectTypeName = value;
RaisePropertyChanged(nameof(objectTypeName));
}
}
private string _CreateUserID;
/// <summary>
/// 元件创建者ID
/// </summary>
public string CreateUserID
{
get { return _CreateUserID; }
set
{
_CreateUserID = value;
RaisePropertyChanged(nameof(CreateUserID));
}
}
private string _EngineDataID;
/// <summary>
/// 元件ID
/// </summary>
public string EngineDataID
{
get
{
return _EngineDataID;
}
set
{
_EngineDataID = value;
OnPropertyChanged(nameof(EngineDataID));
}
}
/// <summary>
/// 显示名称
/// </summary>
public string objectDisplayName
{
get
{
if (listHandels.Count > 1)
{
return $"{_objectTypeName}(X{listHandels.Count})";
}
else
{
return _objectTypeName;
}
}
}
private ObservableCollection<propertyModel> _listProperty = new ObservableCollection<propertyModel>();
/// <summary>
/// 常用属性列表
/// </summary>
public ObservableCollection<propertyModel> listBasicTypeP
{
get { return _listProperty; }
set
{
_listProperty = value;
RaisePropertyChanged(nameof(listBasicTypeP));
}
}
//private ObservableCollection<propertyModel> _listNotBasicTypeP = new ObservableCollection<propertyModel>();
///// <summary>
///// 不常用属性列表
///// </summary>
//public ObservableCollection<propertyModel> listNotBasicTypeP
//{
// get { return _listNotBasicTypeP; }
// set { _listNotBasicTypeP = value; RaisePropertyChanged(nameof(listNotBasicTypeP)); }
//}
/// <summary>
/// 属性数据,修改属性值时进行比对是否有修改
/// </summary>
public List<ProtertyData> listData = new List<ProtertyData>();
}
public class ProtertyData
{
/// <summary>
/// 属性数据,修改属性值时进行比对是否有修改
/// </summary>
public List<ec_enginedata> listEnginedata = new List<ec_enginedata>();
}
}

View File

@ -0,0 +1,107 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Media;
using Telerik.Windows.Controls;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TreeView;
namespace SWS.CAD.Models
{
public class TreeModel : ViewModelBase, System.ICloneable
{
public string ID { get; set; }
private string _Text;
/// <summary>
/// 节点显示数据
/// </summary>
public string Text
{
get { return _Text; }
set
{
_Text = value;
if (_Text.ToLower().EndsWith(".dwg"))
{
Glyph = "&#xe912;";
}
OnPropertyChanged(nameof(Text));
}
}
/// <summary>
/// 父级节点ID。比如某个目录下有什么文件
/// </summary>
public string parentId { get; set; }
private bool _isexpand;
/// <summary>
/// 控制展开/折叠状态
/// </summary>
public bool isexpand
{
get { return _isexpand; }
set { _isexpand = value; OnPropertyChanged(nameof(isexpand)); }
}
/// <summary>
/// 节点类型
/// </summary>
public string NodeType { get; set; }
string _ToolTipText;
/// <summary>
/// 鼠标悬停提示词
/// </summary>
public string ToolTipText
{
get { return _ToolTipText; }
set { _ToolTipText = value; OnPropertyChanged(nameof(ToolTipText)); }
}
Brush _fontColor = new SolidColorBrush(Colors.White);
/// <summary>
/// 节点字体颜色
/// </summary>
public Brush FontColor
{
get { return _fontColor; }
set { _fontColor = value; OnPropertyChanged(nameof(FontColor)); }
}
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; }
/// <summary>
/// 状态 0:检入, 1:自己检出, 2:别人检出
/// </summary>
public int CheckInOutStatus { get; set; }
private ObservableCollection<TreeModel> _ChildNodes=new ObservableCollection<TreeModel>();
public ObservableCollection<TreeModel> ChildNodes
{
get { return _ChildNodes; }
set { _ChildNodes = value; RaisePropertyChanged(nameof(ChildNodes)); }
}
/// <summary>
/// 扩展数据。比如具体对象的实体类信息
/// </summary>
public object NodeExtData { get; set; }
string _Glyph = "&#xe900;";
/// <summary>
/// 节点图标
/// </summary>
public string Glyph
{
get { return _Glyph; }
set { _Glyph = value; OnPropertyChanged(nameof(Glyph)); }
}
/// <summary>
/// 克隆实体类
/// </summary>
/// <returns></returns>
public object Clone()
{
return this.MemberwiseClone();
}
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Windows.Controls;
namespace SWS.CAD.Models
{
public class Unit : ViewModelBase
{
private string _UnitId;
/// <summary>
/// Id
/// </summary>
public string UnitId
{
get { return _UnitId; }
set { _UnitId = value; RaisePropertyChanged(nameof(UnitId)); }
}
private string _UnitName;
/// <summary>
/// 单位
/// </summary>
public string UnitName
{
get { return _UnitName; }
set { _UnitName = value; RaisePropertyChanged(nameof(UnitName)); }
}
}
}

View File

@ -0,0 +1,13 @@
namespace SWS.CAD.Models
{
/// <summary>
/// learun mvc标准的http返回结果
/// </summary>
/// <typeparam name="T"></typeparam>
public class learunHttpRes<T>
{
public int code { get; set; }
public string info { get; set; }
public T data { get; set; }
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.CAD.Models.NoEntity
{
public class loginRes
{
public string token { get; set; }
public string loginMark { get; set; }
public string account { get; set; }
public string userId { get; set; }
public string RealName { get; set; }
public string userPs { get; set; }
public string IsIOModuleAdmin { get; set; }
public string isFirstLogin { get; set; }
public string Department { get; set; }
}
}

View File

@ -0,0 +1,77 @@

using System;
namespace SWS.CAD.Models
{
public class annexesfile
{
#region
/// <summary>
/// 文件主键
/// </summary>
/// <returns></returns>
public string F_Id { get; set; }
/// <summary>
/// 附件夹主键
/// </summary>
public string F_FolderId { get; set; }
/// <summary>
/// 文件名称
/// </summary>
/// <returns></returns>
public string F_FileName { get; set; }
/// <summary>
/// 文件路径
/// </summary>
/// <returns></returns>
public string F_FilePath { get; set; }
/// <summary>
/// 文件大小
/// </summary>
/// <returns></returns>
public string F_FileSize { get; set; } = "0";
/// <summary>
/// 文件后缀
/// </summary>
/// <returns></returns>
public string F_FileExtensions { get; set; }
/// <summary>
/// 文件类型
/// </summary>
/// <returns></returns>
public string F_FileType { get; set; }
/// <summary>
/// 下载次数
/// </summary>
/// <returns></returns>
public int? F_DownloadCount { get; set; }
/// <summary>
/// 创建日期
/// </summary>
/// <returns></returns>
public DateTime? F_CreateDate { get; set; }
/// <summary>
/// 创建用户主键
/// </summary>
/// <returns></returns>
public string F_CreateUserId { get; set; }
/// <summary>
/// 创建用户
/// </summary>
/// <returns></returns>
public string F_CreateUserName { get; set; }
/// <summary>
/// 缩略图路径
/// </summary>
/// <returns></returns>
public string F_ThumbnailImgPath { get; set; }
/// <summary>
/// WebFileID文件 祝幸 20191112
/// </summary>
/// <returns></returns>
public string F_WebFileID { get; set; }
#endregion
}
}

View File

@ -0,0 +1,114 @@
using SWS.CAD.Models;
using System;
using System.Collections.Generic;
namespace SWS.CAD.Models
{
/// <summary>
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
/// Copyright (c) 2013-2018 Hexagon PPM
/// 创 建:超级管理员
/// 日 期2022-06-21 15:32
/// 描 述:接线模块 - panel柜子
/// </summary>
public class ec_Cable
{
#region
/// <summary>
/// ID
/// </summary>
/// <returns></returns>
public string CableID { get; set; }
/// <summary>
/// Cable_Format
/// </summary>
/// <returns></returns>
public string Cable_Format { get; set; } = "";
/// <summary>
/// EngineerDataID。对应<see cref="ec_Archive_enginedata.EngineDataID"/>
/// </summary>
/// <returns></returns>
public string EngineerDataID { get; set; } = "";
/// <summary>
/// 是否为母线类型。如果是,里面走的信号也只能是通讯信号<see cref="ec_Wire_GroupEntity.CommunicationPoint"/>
/// conventional或homerun
/// </summary>
/// <returns></returns>
public string CableClass { get; set; } = "";
/// <summary>
/// 即里面走的信号的信号类型?<see cref="ec_Wire_GroupEntity.IO_Type"/>
/// RS485 RS422 TCP/IP MQTT(如果是通讯母线,通讯类型是什么。)
/// Digital 4-20mA Pulse Pt100(如果是非母线IO类型是什么。)
/// </summary>
public string PreAssignIOType { get; set; } = "";
/// <summary>
/// 电缆预分配时必须指定它应该在哪个IO柜子
/// </summary>
public string PanelID { get; set; }
/// <summary>
/// 创建人
/// </summary>
/// <returns></returns>
public string CreateUserID { get; set; }
/// <summary>
/// 创建时间
/// </summary>
/// <returns></returns>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新人
/// </summary>
/// <returns></returns>
public string UpdateUserID { get; set; }
/// <summary>
/// 更新时间
/// </summary>
/// <returns></returns>
public DateTime? UpdateTime { get; set; }
#endregion
#region
/// <summary>
///
/// </summary>
public List<ec_CableSet> Sets { set; get; }
/// <summary>
/// 平行电缆数据
/// </summary>
public List<ec_parallel_Cable> parallelCables { set; get; }
/// <summary>
/// 关联的通讯点
/// </summary>
public List<string> WireGroupIds { set; get; }
/// <summary>
/// 关联的通讯点
/// </summary>
public IEnumerable<ec_Wire_Group> WireGroups { set; get; }
/// <summary>
/// 对应到<see cref="ec_Archive_enginedata.TagNumber"/>
/// </summary>
public string TagNumber { set; get; }
/// <summary>
/// From连接处的工程位号信息
/// </summary>
public ec_Panel FromPanel { set; get; }
/// <summary>
/// From连接处的工程位号信息(
/// </summary>
public ec_Panel ToPanel { set; get; }
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More