增加了shared项目

This commit is contained in:
xingheng 2025-09-22 13:50:02 +08:00
commit ed968f39f9
109 changed files with 3952 additions and 1077 deletions

3
.gitignore vendored
View File

@ -1110,3 +1110,6 @@ newFront/c#前端/.vs/
/newFront/c#前端/.vs/SWS.CAD/FileContentIndex/f03e1583-e8e0-43b7-9dbb-a1896ce4b92d.vsidx
/newFront/c#前端/.vs/SWS.CAD/FileContentIndex/f2e37380-e651-406b-9320-af642620eee9.vsidx
/SWSDBSchemeUpgradeTool/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Oracle/obj/Debug/Learun.DataBase.Oracle.csproj.AssemblyReference.cache
/Learun.Framework.Module/Learun.Db/Learun.DataBase.EF.Sqlserver/obj/Debug/Learun.DataBase.SqlServer.csproj.AssemblyReference.cache
/Learun.Framework.Module/Learun.Db/Learun.DataBase.MySql/obj/Debug/Learun.DataBase.MySqlEx.csproj.AssemblyReference.cache

View File

@ -94,6 +94,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "04 Plugin", "04 Plugin", "{
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Department2", "Department2\Department2.csproj", "{74A88CCC-F53B-471C-B350-A2BB5804619C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.Share", "newFront\c#前端\SWS.Share\SWS.Share.csproj", "{87E71797-E60A-4637-BA32-C8B57154ABC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Android = Debug|Android
@ -806,6 +808,30 @@ Global
{74A88CCC-F53B-471C-B350-A2BB5804619C}.Release|Windows-x64.Build.0 = Release|Any CPU
{74A88CCC-F53B-471C-B350-A2BB5804619C}.Release|Windows-x86.ActiveCfg = Release|Any CPU
{74A88CCC-F53B-471C-B350-A2BB5804619C}.Release|Windows-x86.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Android.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Android.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|iOS.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|iOS.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-ARM.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-ARM.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-x64.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-x64.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-x86.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Windows-x86.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Android.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Android.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Any CPU.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|iOS.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|iOS.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-ARM.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-ARM.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-x64.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-x64.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-x86.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Windows-x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -848,10 +874,11 @@ Global
{56F9A112-FD96-4809-98F4-0D7C5DE0711B} = {D5BF3E92-22DA-4C1B-A736-B9E847A3DE27}
{A448AD52-CB49-4206-BBDC-E433574BB88F} = {27B3C269-FF3F-4E1C-9B92-A40F6B4857E0}
{74A88CCC-F53B-471C-B350-A2BB5804619C} = {E011739D-4EC0-4E88-B6D1-A86242FBE6B0}
{87E71797-E60A-4637-BA32-C8B57154ABC3} = {D5BF3E92-22DA-4C1B-A736-B9E847A3DE27}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
SolutionGuid = {968C278F-4142-4DFF-96B0-B3D70A649451}
EnterpriseLibraryConfigurationToolBinariesPath = packages\Unity.2.1.505.0\lib\NET35
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true

View File

@ -6,6 +6,7 @@ using NPOI.SS.Formula.PTG;
using NPOI.Util.Collections;
using OfficeOpenXml.Drawing.Vml;
using Pipelines.Sockets.Unofficial.Arenas;
using SWS.Share;
using System;
using System.Collections;
using System.Collections.Generic;
@ -31,7 +32,7 @@ namespace Learun.Application.Web.AppApi
/// <param name="drawingId"></param>
/// <returns></returns>
[HttpGet]
public IHttpActionResult GetBOMGroupInfo(string ProjectId = "c151f5d4-cbe1-4522-945c-501b1ad990d5", string drawingId = "277d883d-e271-45e4-990b-926585321fa8")
public IHttpActionResult GetBOMGroupInfo(string ProjectId = "403ee1e6-ca2e-4acc-9667-273afd4ea93c", string drawingId = "db834963-f62b-4c44-8180-1b9073819546")
{
var res = new List<BOMGroupInfo>();//声明结果
@ -77,7 +78,7 @@ namespace Learun.Application.Web.AppApi
#region
foreach (ec_enginedataEntity tag in allTag)
{
var matchedTypes = new List<string>();
var matchedTypes = new List<string>();
var idx = 0;
var GroupName = TrimTagNubmer(tag.TagNumber, out idx);// 如 A-B1,A-B2,取出来的group就是A-Bidx为0
var seq = tag.TagNumber.Substring(idx).Replace(GroupName, "");// 1,2
@ -127,19 +128,25 @@ namespace Learun.Application.Web.AppApi
{
List<BOMTagInfo> allTagsInThisGroup = group.ToList();
var GroupName = group.Key.Group; //A-ABC, 正常情况下A是system放下面B是tag放上面
string part1 = string.Empty;
string part0 = string.Empty;
if (!GroupName.Contains("-"))
{
continue;
{
part1 = GroupName;
}
var upper_text_Part1 = GroupName.Split('-')[1];//ABC
else
{
part0 = GroupName.Split('-')[0];
part1 = GroupName.Split('-')[1];//ABC
}
var upper_text_Part1 = part1;//ABC
var upper_text_Part2 = "";//seq
#region seq的不同情况
//得到每个位号下的seq
var allSeqText = allTagsInThisGroup.OrderBy(x => x.Seq).Select(x => x.Seq).ToList();
var allSeq = ExtractNumbers(allSeqText);//把1A 1B 这种情况也处理了变成1,1
if (allSeq.Distinct().Count() == 1)
if (allSeq.Distinct().Count() <= 1)
{
//TAG如果一样的就取这个TAG就行???
upper_text_Part2 = allSeqText.First();
@ -165,7 +172,7 @@ namespace Learun.Application.Web.AppApi
var BOMGroupInfo = new BOMGroupInfo
{
upper_text = upper_text_Part1 + upper_text_Part2,
lower_text = GroupName.Split('-')[0],//A
lower_text = part0,//A
Count = group.Count(),
Remark = group.Key.vendor,
Model = group.Key.Model,
@ -290,32 +297,5 @@ namespace Learun.Application.Web.AppApi
/// </summary>
public string Name { set; get; }
}
public class BOMGroupInfo
{
public string upper_text { set; get; }
public string lower_text { set; get; }
/// <summary>
/// 每一行用的symbol是什么
/// </summary>
public string FileId { set; get; }
/// <summary>
/// 个数
/// </summary>
public int Count { set; get; }
/// <summary>
/// 备注(由 厂商)
/// </summary>
public string Remark { set; get; }
/// <summary>
/// 规格(由 电制 额定功率 ip等级 防爆等级等属性拼接而成)
/// </summary>
public string Spec { set; get; }
/// <summary>
/// 型号
/// </summary>
public string Model { set; get; }
}
}

View File

@ -1,4 +1,6 @@
using Learun.Application.TwoDevelopment.ZZDT_EC;
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using Learun.Application.Base.SystemModule;
using Learun.Application.TwoDevelopment.ZZDT_EC;
using Learun.Util;
using Learun.Util.SqlSugar;
using SqlSugar;
@ -109,5 +111,25 @@ namespace Learun.Application.Web.AppApi
return Success(resAll);
}
/// <summary>
/// 获取项目信息
/// </summary>
/// <param name="projectId">项目ID</param>
/// <returns></returns>
[HttpGet]
[ResponseType(typeof(TwoDevelopment.ZZDT_EC.ec_projectEntity))]
public IHttpActionResult GetEntity(string projectId)
{
try
{
ec_projectIBLL ec_projectIBLL = new ec_projectBLL();
var entity = ec_projectIBLL.GetEntity(projectId);
return Success(entity);
}
catch (Exception ex)
{
return Fail(ex.Message);
}
}
}
}

View File

@ -3814,6 +3814,9 @@
<Content Include="Views\Home\AdminProjectManage.cshtml" />
<Content Include="Views\Home\AdminProjectPageIndex.cshtml" />
<Content Include="Views\UserCenter\PassWordUpdate.cshtml" />
<Content Include="XmlConfig\database.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
@ -3909,6 +3912,10 @@
<Project>{1d192591-b85a-41db-ae3a-4bf9765786c1}</Project>
<Name>Learun.Workflow.Engine</Name>
</ProjectReference>
<ProjectReference Include="..\newFront\c#前端\SWS.Share\SWS.Share.csproj">
<Project>{87e71797-e60a-4637-ba32-c8b57154abc3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>

View File

@ -1562,6 +1562,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var typeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(projectId);
var dwgTbName = ProjectSugar.TableName<ec_drawing_fileEntity>(projectId);
var pixelTbName = ProjectSugar.TableName<ec_enginedata_pixelEntity>(projectId);
var dataitemdetailTableName = TableName<ec_dataitemdetailEntity>(projectId);
var allType = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(typeTbName).ToList();
var systems = new ec_dataitemBLL().GetDetailList(GlobalObject.enumlist_System, "", projectId);
@ -1573,14 +1574,24 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
var cableSystemObj = entity.EngineDataProperty.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_System);
var cableSystem = cableSystemObj == null ? "" : systems.FirstOrDefault(x => x.DataItemName == cableSystemObj.PropertyValue)?.DataItemDetailID;
if (cableSystem != null)
string systemNameAfterDealWith = string.Empty;
var cableSystem =string.Empty;
var topDataItemDetailIDofDwg = string.Empty;
var topDataItemDetailIDofEng = string.Empty;
if (cableSystemObj != null)
{
if (dwgObj.DrawingSystem == cableSystem && !string.IsNullOrEmpty(dwgObj.DrawingSystem))
int index = cableSystemObj.PropertyValue.IndexOf("||");
systemNameAfterDealWith = index >= 0 ? cableSystemObj.PropertyValue.Substring(0, index) : cableSystemObj.PropertyValue;
cableSystem = systems.FirstOrDefault(x => x.DataItemName == systemNameAfterDealWith)?.DataItemDetailID;
//获取图纸系统的最上级ID
topDataItemDetailIDofDwg = GetTopParentDataItemDetailByID(dataitemdetailTableName, dwgObj.DrawingSystem);
//获取位号系统的最上级ID
topDataItemDetailIDofEng= GetTopParentDataItemDetailByID(dataitemdetailTableName, cableSystem);
if (topDataItemDetailIDofDwg == topDataItemDetailIDofEng && !string.IsNullOrEmpty(dwgObj.DrawingSystem))
{
//可以修改
}
else if (string.IsNullOrEmpty(cableSystem))
else if (string.IsNullOrEmpty(topDataItemDetailIDofEng))
{
//不可以
allowPropertyModify = false;
@ -1606,6 +1617,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
//var cableSystem = cableSystemObj == null ? "" : systems.FirstOrDefault(x => x.DataItemName == cableSystemObj.PropertyValue)?.DataItemDetailID;
//if (cableSystem != null)
//{
//}
}
else
{
@ -2412,6 +2429,38 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
return current.DataItemName;
}
/// <summary>
/// 找到最上级的DataItemDetailID
/// </summary>
/// <param name="DtatTableName">表名</param>
/// <param name="strDataItemName">当前的DataItemName</param>
/// <returns>最上层的Name</returns>
public string GetTopParentDataItemDetailByID(string DtatTableName, string strDataItemDetailID)
{
// 先找到初始节点
var current = Db.Queryable<ec_dataitemdetailEntity>().AS(DtatTableName).Where(x => x.DataItemDetailID == strDataItemDetailID).First();
// 如果找不到,直接返回 null
if (current == null)
return null;
// 循环向上查找
while (current.UpDataItemDetailID != "0")
{
// upDataItemDetailID是上级节点的DataItemDetailID
var parent = Db.Queryable<ec_dataitemdetailEntity>().AS(DtatTableName).Where(x => x.DataItemDetailID == current.UpDataItemDetailID).First();
// 如果找不到就返回 null防止死循环
if (parent == null)
return null;
current = parent;
}
// 返回最上层的 DataItemDetailID也就是 0对应的ID
return current.DataItemDetailID;
}
/// <summary>
/// 过滤掉与图纸系统最上层不一致的 EngineDataID
/// </summary>
@ -2583,5 +2632,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
return result;
}
}
}

View File

@ -0,0 +1,5 @@

FD:\陈进步\项目\009\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
FD:\陈进步\项目\009\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;

View File

@ -50,6 +50,7 @@ namespace DI_Electrical.ViewModels
}
public void onShowDialogTest(object o)
{
IDialogParameters par = new Prism.Services.Dialogs.DialogParameters();
par.Add(GlobalObject.dialogPar.para1.ToString(), "abc你我他");
_dialogService.ShowDialog(nameof(DialogTest), par, (result) =>

View File

@ -109,8 +109,10 @@ namespace SWS.CAD.Base
/// <summary>
/// 读取图块图纸插入当前文档
/// </summary>
/// <param name="blockName"></param>
public static ObjectId InsertBlock(string fileName, string blockName)
/// <param name="fileName">块图纸路径</param>
/// <param name="blockName">块名</param>
/// <param name="position">坐标位</param>
public static ObjectId InsertBlock(string fileName, string blockName, Point3d position)
{
ObjectId entity = ObjectId.Null;
@ -135,9 +137,10 @@ namespace SWS.CAD.Base
using (Transaction trans = db.TransactionManager.StartTransaction())
{
BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
ObjectId idBtr = doc.Database.Insert(blockName, blockName, blockDb, true);
ObjectId idBtr = doc.Database.Insert(blockName, blockName, blockDb, true);
BlockTableRecord curBtr = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
var block = new BlockReference(Point3d.Origin, idBtr);
block.Position = position;
curBtr.AppendEntity(block);
trans.AddNewlyCreatedDBObject(block, true);
entity = block.Id;
@ -721,6 +724,7 @@ namespace SWS.CAD.Base
}
#endregion
#region
/// <summary>
/// 读取元件块,插入图纸
@ -730,15 +734,15 @@ namespace SWS.CAD.Base
/// <param name="tag">位号值</param>
/// <param name="objTypeId">元件类型ID</param>
/// <param name="scale">比例大小</param>
/// <param name="tagPoint">坐标位置</param>
/// <param name="position">坐标位置</param>
/// <returns></returns>
public static ObjectId AddTagDWG(string filePath, string tagName, string tag, string objTypeId, double scale, Point3d tagPoint)
public static ObjectId AddTagDWG(string filePath, string tagName, string tag, string objTypeId, double scale, Point3d position)
{
if (scale == 0)
{ scale = 1; }
Document doc = Application.DocumentManager.MdiActiveDocument;
var ed = doc.Editor;
ObjectId oid = ObjectId.Null;
ObjectId oid = ObjectId.Null;
if (!File.Exists(filePath))
{
ed.WriteMessage("\n 错误:图元文件不存在!\n");
@ -754,7 +758,7 @@ namespace SWS.CAD.Base
using (Database sourceDb = new Database(false, true))
{
sourceDb.ReadDwgFile(filePath, FileOpenMode.OpenForReadAndAllShare, false, null);
// 生成唯一块名(避免重名)
string blockName = GetUniqueBlockName(destDb, tagName);
// 将外部DWG转换为块定义
@ -764,7 +768,7 @@ namespace SWS.CAD.Base
Point3d.Origin, // 插入点(可修改)
blockId// bt[blockName]
);
br.Position = tagPoint;
br.Position = position;
// 设置比例和旋转
br.ScaleFactors = new Scale3d(scale); //比例因子
br.Rotation = 0.0; // 旋转角度(弧度)
@ -948,18 +952,13 @@ namespace SWS.CAD.Base
/// <summary>
/// 保存图纸
/// </summary>
public static void SaveDwg(string filename)
public static void SaveAndCloseDwg(string filename)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
if (db.Filename.Equals(filename))
{
using (Transaction tr = doc.TransactionManager.StartTransaction())
{
// 操作数据库...
tr.Commit(); // 必须提交
}
doc.Database.Save();
doc.CloseAndSave(filename);
}
}
#endregion
@ -1013,6 +1012,7 @@ namespace SWS.CAD.Base
}
else { doc.CloseAndDiscard(); }
// 重新打开
Thread.Sleep(200);
Application.DocumentManager.Open(filePath, isReadOnly);
doc = Application.DocumentManager.MdiActiveDocument;
ed = doc.Editor;
@ -1996,6 +1996,144 @@ namespace SWS.CAD.Base
}
#endregion
#region
public static string InsertTextInfo(List<DtoCadTextInfo> listTextInfo)
{
string res = string.Empty;
try
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
// 开始事务处理
using (Transaction tr = db.TransactionManager.StartTransaction())
{
// 打开当前空间(模型空间或图纸空间)用于写入
BlockTableRecord currentSpace = (BlockTableRecord)tr.GetObject(
db.CurrentSpaceId, OpenMode.ForWrite);
foreach (var textInfo in listTextInfo)
{
if (textInfo.IsMText)
{
// 创建多行文字对象
MText mText = new MText();
mText.Contents = textInfo.Text;
mText.Location = textInfo.Position;
mText.TextHeight = textInfo.Height;
mText.Width = textInfo.Width; // 设置文本宽度,控制自动换行
if (textInfo.Align == 0)
{
mText.Attachment = AttachmentPoint.MiddleLeft; // 设置对齐居左
}
else if (textInfo.Align == 1)
{
mText.Attachment = AttachmentPoint.BaseCenter; // 设置对齐居中
}
// 将文字添加到当前空间
currentSpace.AppendEntity(mText);
tr.AddNewlyCreatedDBObject(mText, true);
}
else
{
// 创建单行文字对象
DBText dbText = new DBText();
dbText.TextString = textInfo.Text;
dbText.Position = textInfo.Position;
dbText.AlignmentPoint= textInfo.Position;
dbText.Height = textInfo.Height;
if (textInfo.Align == 0)
{
dbText.HorizontalMode = TextHorizontalMode.TextLeft; // 设置对齐居左
}
else if (textInfo.Align == 1)
{
dbText.HorizontalMode = TextHorizontalMode.TextCenter; // 设置对齐居中
}
// 将文字添加到当前空间
currentSpace.AppendEntity(dbText);
tr.AddNewlyCreatedDBObject(dbText, true);
}
}
// 提交事务
tr.Commit();
}
return res;
}
catch (Exception ex)
{
return ex.Message;
}
}
#endregion
#region
/// <summary>
/// 读取源图纸,插入当前图纸
/// </summary>
/// <param name="filePath">源图纸路径</param>
/// <param name="blockName">块名</param>
/// <param name="position">坐标位置</param>
/// <returns></returns>
public static ObjectId AddBlockDWG(string filePath, string blockName, Point3d position)
{
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, blockName);
// 将外部DWG转换为块定义
ObjectId blockId = destDb.Insert(blockName, sourceDb, true);
// 创建块参照
BlockReference br = new BlockReference(
Point3d.Origin, // 插入点(可修改)
blockId// bt[blockName]
);
br.Position = position;
// 设置比例和旋转
br.ScaleFactors = new Scale3d(1.0); //比例因子
br.Rotation = 0.0; // 旋转角度(弧度)
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(
SymbolUtilityServices.GetBlockModelSpaceId(destDb),
OpenMode.ForWrite
);
// 处理插入结果
btr.AppendEntity(br);
tr.AddNewlyCreatedDBObject(br, true);
tr.Commit();
oid = br.Id;
}
}
catch (Exception ex)
{
tr.Abort();
ed.WriteMessage($"\n错误: {ex.Message}\n");
}
}
return oid;
}
#endregion
}
}

View File

@ -0,0 +1,37 @@
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 DtoCadTextInfo
{
/// <summary>
/// 坐标
/// </summary>
public Point3d Position { get; set; }
/// <summary>
/// 是否为多行文本
/// </summary>
public bool IsMText { get; set; }
/// <summary>
/// 文本内容,多行文本用\n 进行换行
/// </summary>
public string Text { get; set; }
/// <summary>
/// 文本高度
/// </summary>
public double Height { get; set; }
/// <summary>
/// 文本宽度
/// </summary>
public double Width { get; set; }
/// <summary>
/// 文本对齐方式 0:居左对齐 1居中对齐
/// </summary>
public double Align { get; set; }
}
}

View File

@ -52,6 +52,7 @@
<Compile Include="BlockDragJig.cs" />
<Compile Include="General.cs" />
<Compile Include="Model\DtoBasePoint.cs" />
<Compile Include="Model\DtoCadTextInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.WPF", "SWS.WPF\SWS.WPF.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.CAD", "SWS.CAD\SWS.CAD.csproj", "{6BD9B3FC-7D55-4762-AF68-A50183342537}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SWS.Share", "SWS.Share\SWS.Share.csproj", "{87E71797-E60A-4637-BA32-C8B57154ABC3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -215,6 +217,22 @@ Global
{6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x64.Build.0 = Release|Any CPU
{6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.ActiveCfg = Release|Any CPU
{6BD9B3FC-7D55-4762-AF68-A50183342537}.Release|x86.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|ARM64.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|x64.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|x64.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|x86.ActiveCfg = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Debug|x86.Build.0 = Debug|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|Any CPU.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|ARM64.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|ARM64.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|x64.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|x64.Build.0 = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|x86.ActiveCfg = Release|Any CPU
{87E71797-E60A-4637-BA32-C8B57154ABC3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -132,7 +132,7 @@ namespace SWS.CAD
if (_dwgStage == null)
{
var serv =GlobalObject.container.Resolve<DataItemService>();
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingStage.ToString()));
var res2 = res.Result;
return res2;

View File

@ -58,27 +58,27 @@ namespace SWS.CAD.Helper
}
#endregion
#region
#region
/// <summary>
/// 获取树节点所有图纸名
/// </summary>
/// <summary>
/// 获取树节点所有图纸名
/// </summary>
public static void GetTreeText(Model.TreeModel node)
{
// 如果根节点为空则返回null
if (node == null) return ;
if (node == null) return;
//没有子节点就返回null
if (node.ChildNodes == null) return ;
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 ;
return;
}
#endregion
}

View File

@ -10,6 +10,9 @@ using SWS.CAD.Views.Dialog;
using Prism.Services.Dialogs;
using SWS.Commons;
using SWS.Model;
using System.Windows;
using SWS.Service;
using Unity;
namespace SWS.CAD.ViewModels
{
@ -30,6 +33,11 @@ namespace SWS.CAD.ViewModels
}
}
#endregion
IOModuleService _iOModuleService;
public DialogCablePreAssignPreviewViewModel()
{
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
}
public string Title => "";
@ -52,30 +60,95 @@ namespace SWS.CAD.ViewModels
_PreAssignCables = parameters.GetValue<ObservableCollection<PreAssignCable>>(GlobalObject.dialogPar.para1.ToString());
}
public override void ExecuteOKCommandAsync(object parameter)
public override async void ExecuteOKCommandAsync(object parameter)
{
if (PreAssignCables.Any(p => p.IsChecked == true))
bool isShowDialog = false;
List<string> cableids = new List<string>();
foreach (var preAssignCable in PreAssignCables)
{
//打开窗体
IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables);
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogCablePreAssignResult), para, async (RES) =>
if (preAssignCable.IsChecked)
{
if (RES.Result == ButtonResult.Yes)
{
}
else if (RES.Result == ButtonResult.No)
{ }
});
cableids.Add(preAssignCable.CableId);
}
}
if (cableids != null && cableids.Count() > 0)
{
bool AcceptNearbyPanel;
MessageBoxResult result = System.Windows.MessageBox.Show($"遇到I/O类型不合适的采集箱是否需要自动更换就近的采集箱", "KunHengCAD", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
AcceptNearbyPanel = true;
}
else
{
AcceptNearbyPanel = false;
}
var ResHttp = await _iOModuleService.AutoAssignCable2channel_step1(cableids, AcceptNearbyPanel) as learunHttpRes<object>;
if (ResHttp.code == 200)
{
isShowDialog = true;
}
else
{
if (AcceptNearbyPanel)
{
result = System.Windows.MessageBox.Show($"{ResHttp.info}", "KunHengCAD", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
return;
}
else
{
isShowDialog = true;
}
}
else
{
var info = ResHttp.info;
// 找到第一个句号的位置
int firstPeriodIndex = info.IndexOf('。');
if (firstPeriodIndex >= 0)
{
// 从第一个句号后开始找第二个句号
int secondPeriodIndex = info.IndexOf('。', firstPeriodIndex + 1);
if (secondPeriodIndex >= 0)
{
// 截取到第二个句号(包括句号)
info = info.Substring(0, secondPeriodIndex + 1);
}
}
System.Windows.MessageBox.Show($"{info}", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
}
if (isShowDialog)
{
//打开窗体
IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables);
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogCablePreAssignResult), para, async (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{
}
else if (RES.Result == ButtonResult.No)
{ }
});
}
}
else
{
System.Windows.MessageBox.Show("未勾选预分配电缆", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
//返回的结果
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
//IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
//res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo);
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
//RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
}
public override void ExecuteCloseCommand(object parameter)
{
@ -119,7 +192,7 @@ namespace SWS.CAD.ViewModels
}
return;
}
if(parameter.ToString().Equals("清空"))
if (parameter.ToString().Equals("清空"))
{
foreach (var item in PreAssignCables)
{
@ -133,9 +206,18 @@ namespace SWS.CAD.ViewModels
#endregion
}
public class PreAssignCable: DialogBase
public class PreAssignCable : DialogBase
{
#region
private string _CableId;
public string CableId
{
get { return _CableId; }
set { _CableId = value; }
}
private int _Index;
/// <summary>
/// 序号
@ -152,7 +234,9 @@ namespace SWS.CAD.ViewModels
public bool IsChecked
{
get { return _IsChecked; }
set { _IsChecked = value;
set
{
_IsChecked = value;
RaisePropertyChanged(nameof(IsChecked));
}
}
@ -196,14 +280,15 @@ namespace SWS.CAD.ViewModels
public PreAssignCable()
{
}
public PreAssignCable(ec_Cable ec_Cable)
{
CableId = ec_Cable.CableID;
TagNumber = ec_Cable.TagNumber;
PreAssignIOType = ec_Cable.PreAssignIOType;
CableClass =ec_Cable.CableClass.Equals("homerun") ? "是":"否";
ToPanel_TagNumber = ec_Cable.ToPanel!=null?ec_Cable.ToPanel.TagNumber:null;
CableClass = ec_Cable.CableClass.Equals("homerun") ? "是" : "否";
ToPanel_TagNumber = ec_Cable.ToPanel != null ? ec_Cable.ToPanel.TagNumber : null;
}
#endregion

View File

@ -7,17 +7,51 @@ using Telerik.Windows.Controls;
using Prism.Services.Dialogs;
using SWS.Commons;
using SWS.Model;
using SWS.Service;
using Unity;
using System.Linq;
using Telerik.Windows.Controls.MaskedInput.Tokens.Numeric;
namespace SWS.CAD.ViewModels
{
public class DialogCablePreAssignResultViewModel : DialogBase, IDialogAware
{
#region
private ObservableCollection<PreAssignCable> _PreAssignCables = new ObservableCollection<PreAssignCable>();
private ObservableCollection<PreAllocationResult> _PreAllocationResultls = new ObservableCollection<PreAllocationResult>();
/// <summary>
/// 端子排参数信息列表
/// 预分配结果表格源
/// </summary>
public ObservableCollection<PreAssignCable> PreAssignCables
public ObservableCollection<PreAllocationResult> PreAllocationResultls
{
get { return _PreAllocationResultls; }
set
{
_PreAllocationResultls = value;
RaisePropertyChanged(nameof(PreAllocationResultls));
}
}
private string _SuccessOrFailure = "分配成功";
/// <summary>
/// 选择成功还是选择失败
/// </summary>
public string SuccessOrFailure
{
get { return _SuccessOrFailure; }
set
{
_SuccessOrFailure = value;
RaisePropertyChanged(nameof(SuccessOrFailure));
UpdataPreAssignCables();
}
}
private ObservableCollection<ec_Cable> _PreAssignCables = new ObservableCollection<ec_Cable>();
/// <summary>
/// 左侧预分配电缆列表
/// </summary>
public ObservableCollection<ec_Cable> PreAssignCables
{
get { return _PreAssignCables; }
set
@ -27,90 +61,28 @@ namespace SWS.CAD.ViewModels
}
}
private StripParametersInfo _SelectedStripParametersInfo;
private ec_Cable _SelectedPreAssignCable;
/// <summary>
/// 当前选中的信号类型
/// 选择的预分配电缆
/// </summary>
public StripParametersInfo SelectedStripParametersInfo
public ec_Cable SelectedPreAssignCable
{
get { return _SelectedStripParametersInfo; }
get { return _SelectedPreAssignCable; }
set
{
_SelectedStripParametersInfo = value;
RaisePropertyChanged(nameof(SelectedStripParametersInfo));
}
}
private bool _IsReadOnly;
/// <summary>
/// 是否可编辑
/// </summary>
public bool IsReadOnly
{
get { return _IsReadOnly; }
set
{
_IsReadOnly = value;
RaisePropertyChanged(nameof(IsReadOnly));
}
}
#region
private List<string> _TermNamingType_ls = new List<string>() { "数字", "字母" };
/// <summary>
/// 端子编号类型
/// </summary>
public List<string> TermNamingType_ls
{
get { return _TermNamingType_ls; }
set
{
_TermNamingType_ls = value;
RaisePropertyChanged(nameof(TermNamingType_ls));
}
}
private List<string> _TermNamingRule_ls = new List<string>() { "按端子排全局编号", "按通道内端子编号", "按通道编号" };
/// <summary>
/// 端子编号规则
/// </summary>
public List<string> TermNamingRule_ls
{
get { return _TermNamingRule_ls; }
set
{
_TermNamingRule_ls = value;
RaisePropertyChanged(nameof(TermNamingRule_ls));
}
}
private List<string> _TermNamePrefix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
/// <summary>
/// 端子前缀
/// </summary>
public List<string> TermNamePrefix_ls
{
get { return _TermNamePrefix_ls; }
set
{
_TermNamePrefix_ls = value;
RaisePropertyChanged(nameof(TermNamePrefix_ls));
}
}
private List<string> _TermNameSuffix_ls = new List<string>() { "通道编号", "+,-,s", "无" };
/// <summary>
/// 端子后缀
/// </summary>
public List<string> TermNameSuffix_ls
{
get { return _TermNameSuffix_ls; }
set
{
_TermNameSuffix_ls = value;
RaisePropertyChanged(nameof(TermNameSuffix_ls));
_SelectedPreAssignCable = value;
RaisePropertyChanged(nameof(SelectedPreAssignCable));
UpdataPreAllocationResultls(_SelectedPreAssignCable);
}
}
#endregion
#endregion
IOModuleService _iOModuleService;
public DialogCablePreAssignResultViewModel()
{
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
}
public string Title => "";
public event Action<IDialogResult> RequestClose;
@ -124,18 +96,31 @@ namespace SWS.CAD.ViewModels
}
private List<ec_Cable> CablePreAssigns;
//全部预分配电缆
private List<ec_Cable> AllPreAssignCables;
public async void OnDialogOpened(IDialogParameters parameters)
{
//title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
title = "信号预分配结果";
_PreAssignCables = parameters.GetValue<ObservableCollection<PreAssignCable>>(GlobalObject.dialogPar.para1.ToString());
_IsReadOnly = parameters.GetValue<bool>(GlobalObject.dialogPar.para2.ToString());
AllPreAssignCables = await _iOModuleService.AutoAssignCable2channel_step2();
UpdataPreAssignCables();
}
public override void ExecuteOKCommandAsync(object para)
public override async void ExecuteOKCommandAsync(object para)
{
var Cables = new List<ec_Cable>();
if (AllPreAssignCables != null)
{
foreach (var PreAssignCable in AllPreAssignCables)
{
if (PreAssignCable.Sets != null && !string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
{
Cables.Add(PreAssignCable);
}
}
}
var resHttp = await _iOModuleService.AutoAssignCable2channel_step3(Cables);
//返回结果
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
//res.Add(GlobalObject.dialogPar.para1.ToString(), SelectedStripParametersInfo);
@ -156,6 +141,61 @@ namespace SWS.CAD.ViewModels
}
#region
/// <summary>
/// 修改预分配电缆列表,成功或者失败的电缆列表
/// </summary>
public void UpdataPreAssignCables()
{
PreAssignCables = new ObservableCollection<ec_Cable>();
if (AllPreAssignCables != null)
{
if (SuccessOrFailure.Equals("分配成功"))
{
foreach (var PreAssignCable in AllPreAssignCables)
{
if (PreAssignCable.Sets != null && !string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
{
PreAssignCables.Add(PreAssignCable);
}
}
}
else
{
foreach (var PreAssignCable in AllPreAssignCables)
{
if (PreAssignCable.Sets == null || string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
{
PreAssignCables.Add(PreAssignCable);
}
}
}
}
}
/// <summary>
/// 修改表格显示数据
/// </summary>
public void UpdataPreAllocationResultls(ec_Cable cable)
{
PreAllocationResultls = new ObservableCollection<PreAllocationResult>();
if (cable == null) return;
if (cable.Sets != null)
{
foreach (var Set in cable.Sets)
{
PreAllocationResult preAllocationResult = new PreAllocationResult();
preAllocationResult.CablePair = Set.CableSetName;
preAllocationResult.IOType = cable.PreAssignIOType;
preAllocationResult.ToPanel_TagNumber = cable.ToPanel == null ? "" : cable.ToPanel.TagNumber;
preAllocationResult.Panel_TagNumber = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[0].Split('')[1].Trim();
preAllocationResult.StripName = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[1].Split('')[1].Trim();
preAllocationResult.Terms = new ObservableCollection<ec_PanelStripTerm>(Set.AssignedTerms);
PreAllocationResultls.Add(preAllocationResult);
}
}
}
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
/// <summary>
/// 编辑结束事件
@ -168,7 +208,73 @@ namespace SWS.CAD.ViewModels
}
#endregion
}
/// <summary>
/// 预分配结果类
/// </summary>
public class PreAllocationResult : DialogBase
{
private string _CablePair;
/// <summary>
/// 电缆对
/// </summary>
public string CablePair
{
get { return _CablePair; }
set { _CablePair = value; }
}
private string _IOType;
/// <summary>
/// IO类型
/// </summary>
public string IOType
{
get { return _IOType; }
set { _IOType = value; }
}
private string _ToPanel_TagNumber;
/// <summary>
/// 预分配的系统柜
/// </summary>
public string ToPanel_TagNumber
{
get { return _ToPanel_TagNumber; }
set { _ToPanel_TagNumber = value; }
}
private string _Panel_TagNumber;
/// <summary>
/// 实际分配的系统柜
/// </summary>
public string Panel_TagNumber
{
get { return _Panel_TagNumber; }
set { _Panel_TagNumber = value; }
}
private string _StripName;
/// <summary>
/// 实际分配的端子排
/// </summary>
public string StripName
{
get { return _StripName; }
set { _StripName = value; }
}
private ObservableCollection<ec_PanelStripTerm> _Terms;
/// <summary>
/// 实际端子
/// </summary>
public ObservableCollection<ec_PanelStripTerm> Terms
{
get { return _Terms; }
set { _Terms = value; }
}
}
}

View File

@ -2706,12 +2706,17 @@ namespace SWS.CAD.ViewModels
//获取到所有预分配的电缆并设置到页面渲染对象中
IsBusy = true;
List<ec_Cable> CablePreAssigns = await _iOModuleService.GetCablePreAssignPreview();
if (CablePreAssigns==null)
{
CablePreAssigns = new List<ec_Cable>();
}
var PreAssignCables = new ObservableCollection<PreAssignCable>();
int index = 0;
foreach (var CablePreAssign in CablePreAssigns)
{
index++;
PreAssignCables.Add(new PreAssignCable(CablePreAssign) { Index = index });
PreAssignCables.Add(new PreAssignCable(CablePreAssign) { Index = index ,IsChecked=true});
}
IsBusy = false;
//打开窗体

View File

@ -11,8 +11,8 @@
AllowsTransparency="True"
Background="White"
Loaded="Window_Loaded"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
WindowStyle="None">
<Window.Resources>
<ResourceDictionary Source="pack://application:,,,/SWS.CAD;component/Views/Style/CustomStyles.xaml" />
@ -24,67 +24,115 @@
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="40"/>
<RowDefinition Height="40" />
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<local:customWindowTitleBar />
<Border
Grid.Row="1"
Height="30" >
<Border Grid.Row="1" Height="30">
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
<telerik:RadButton x:Name="btnReceive"
Command="{Binding Commad_Approve}"
Content="已审核列表" Click="btnReceive_Click"
Style="{StaticResource sysBtn3}" />
<telerik:RadButton x:Name="btnSend"
Command="{Binding Commad_NotApprove}"
Content="未审核列表" Click="btnSend_Click"
Style="{StaticResource sysBtn4}" />
<telerik:RadButton
Command="{Binding Commad_CheckedAll}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="全选" Width="80"
Style="{StaticResource sysBtn3}"/>
<telerik:RadButton
Command="{Binding Commad_ClearChecked}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="清空选择" Width="80"
Style="{StaticResource sysBtn3}" />
<telerik:RadButton
x:Name="btnReceive"
Click="btnReceive_Click"
Command="{Binding Commad_Approve}"
Content="已审核列表"
Style="{StaticResource sysBtn3}" />
<telerik:RadButton
x:Name="btnSend"
Click="btnSend_Click"
Command="{Binding Commad_NotApprove}"
Content="未审核列表"
Style="{StaticResource sysBtn4}" />
<telerik:RadButton
Width="80"
Command="{Binding Commad_CheckedAll}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="全选"
Style="{StaticResource sysBtn3}" />
<telerik:RadButton
Width="80"
Command="{Binding Commad_ClearChecked}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="清空选择"
Style="{StaticResource sysBtn3}" />
</StackPanel>
</Border>
<telerik:RadGridView
Grid.Row="2"
telerik:StyleManager.Theme="Windows7"
AutoGenerateColumns="False"
ItemsSource="{Binding listData}"
SelectionMode="Single" FilteringMode="Popup" IsFilteringAllowed="False"
AutoGenerateColumns="False"
FilteringMode="Popup"
IsFilteringAllowed="False"
ItemsSource="{Binding listData}"
SelectionMode="Single"
ShowGroupPanel="False">
<telerik:RadGridView.RowStyleSelector>
<telerik:ConditionalStyleSelector>
<telerik:StyleRule Condition="ApproveByAdmin = 1">
<Style TargetType="telerik:GridViewRow">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Green" />
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Green" />
</Style>
</telerik:StyleRule>
</telerik:ConditionalStyleSelector>
</telerik:RadGridView.RowStyleSelector>
<telerik:RadGridView.Columns>
<local:RowNumberColumn Width="40" IsReadOnly="True" Header="序号"/>
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsSelected}" IsReadOnly="{Binding ReadOnly}" Header="选择" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding DrawingFile}" IsReadOnly="True" Header="图名" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding PageNos}" IsReadOnly="True" Header="页码" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Cables}" IsReadOnly="True" Header="电缆位号" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding IsMaterial, Converter={StaticResource yesNotConver}}" IsReadOnly="True" Header="影响填料函?" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Remark}" IsReadOnly="True" Header="修改内容" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Type}" IsReadOnly="True" Header="修改属性" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding cloud}" IsReadOnly="True" Header="相关云线" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateTime,StringFormat='yyyy-MM-dd HH:mm:ss'}" IsReadOnly="True" Header="更新日期" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding CreateUserName}" IsReadOnly="True" Header="系统修改人" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding IsProcess, Converter={StaticResource yesNotConver}}" IsReadOnly="True" Header="影响生产设计?" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding otherDwgIds}" IsReadOnly="True" Header="涉及其他图纸名字" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding ApproveByAdmin, Converter={StaticResource yesNotConver}}" IsReadOnly="True" Header="需要生产主管确认?" />
<local:RowNumberColumn
Width="40"
Header="序号"
IsReadOnly="True" />
<telerik:GridViewCheckBoxColumn
DataMemberBinding="{Binding IsSelected}"
Header="选择"
IsReadOnly="{Binding ReadOnly}" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding DrawingFile}"
Header="图名"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding PageNos}"
Header="页码"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Cables}"
Header="电缆位号"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding IsMaterial, Converter={StaticResource yesNotConver}}"
Header="影响填料函?"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Remark}"
Header="修改内容"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding Type}"
Header="修改属性"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding cloud}"
Header="相关云线"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding CreateTime, StringFormat='yyyy-MM-dd HH:mm:ss'}"
Header="更新日期"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding CreateUserName}"
Header="系统修改人"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding IsProcess, Converter={StaticResource yesNotConver}}"
Header="影响生产设计?"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding otherDwgIds}"
Header="涉及其他图纸名字"
IsReadOnly="True" />
<telerik:GridViewDataColumn
DataMemberBinding="{Binding ApproveByAdmin, Converter={StaticResource yesNotConver}}"
Header="需要生产主管确认?"
IsReadOnly="True" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
@ -95,22 +143,23 @@
<Border
Grid.Row="3"
Height="30"
Background="{StaticResource ColorPrimary}">
Background="{StaticResource ColorPrimary}">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<telerik:RadButton
Margin="5"
Command="{Binding OKCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="批量审核" Visibility="{Binding IsShowApprove}"
Style="{StaticResource sysBtn}" />
Margin="5"
Command="{Binding OKCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="批量审核"
Style="{StaticResource sysBtn}"
Visibility="{Binding IsShowApprove}" />
<telerik:RadButton
Margin="5"
Command="{Binding CloseCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="关闭"
Style="{StaticResource sysBtn2}" />
</StackPanel>
</Border>
</Grid>

View File

@ -6,6 +6,7 @@
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SWS.CAD.Views.CustomControl"
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
@ -13,6 +14,41 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SWS.CAD;component/Views/Style/CustomStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- 转换器 -->
<cvt:RadioButtonValueConverter x:Key="RadioButtonValueCvt" />
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate2">
<ItemsControl ItemsSource="{Binding Terms}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="{Binding Term_No}" TextAlignment="Center" Padding="4,2" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate2">
<ItemsControl ItemsSource="{Binding Terms}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Term_No}" TextAlignment="Center" Padding="4,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Background="#5d6b99">
@ -23,22 +59,55 @@
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="10"/>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<Grid Width="400" Height="300" Background="White">
</Grid>
<TextBlock Text="分配成功" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
</StackPanel>
<StackPanel Grid.Column="2">
<Grid Width="400" Height="300" Background="White">
</Grid>
<TextBlock Text="分配失败" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
<StackPanel >
<StackPanel Orientation="Horizontal">
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配成功}" Content="分配成功" Foreground="White" GroupName="RadioButton1"/>
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配失败}" Content="分配失败" Foreground="White" GroupName="RadioButton1"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<GroupBox Margin="5,0,5,5"
Foreground="White"
VerticalAlignment="Bottom"
Header="预分配电缆列表">
<ListBox x:Name="treeView1" Width="120" Height="490" Background="White"
ItemsSource="{Binding PreAssignCables,Mode=TwoWay}" SelectedItem="{Binding SelectedPreAssignCable,Mode=TwoWay}"
Margin="5" telerik:StyleManager.Theme="Office_Blue"
>
<ListBox.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding PreAssignCables,Mode=TwoWay}">
<TextBlock Text="{Binding TagNumber}">
</TextBlock>
</HierarchicalDataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
<GroupBox Margin="5,0,5,5"
Foreground="White"
Header="预分配信息">
<Grid Width="450" Height="500" Background="White">
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="660"
AutoGenerateColumns="False" IsFilteringAllowed="False"
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding PreAllocationResultls}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}"
>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="电缆对" DataMemberBinding="{Binding CablePair}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="IO类型" DataMemberBinding="{Binding IOType}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="预分配箱子" DataMemberBinding="{Binding ToPanel_TagNumber}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="实际分配箱子" DataMemberBinding="{Binding Panel_TagNumber}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="实际分配端子排" DataMemberBinding="{Binding StripName}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="实际分配端子"
DataMemberBinding="{Binding Terms}"
Width="*" IsReadOnly="True"
CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</GroupBox>
</StackPanel>
<TextBlock Text="{Binding SuccessOrFailure}" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1">

View File

@ -2,16 +2,17 @@
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: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:converter="clr-namespace:SWS.CAD.Converter"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" Width="250"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Width="250"
Loaded="UserControl_Loaded">
<UserControl.Resources>
<UserControl.Resources>
<converter:ImageSourceConverter x:Key="imgConverter" />
<converter:ExpandConverter x:Key="expandConverter" />
<DataTemplate x:Key="Team">
@ -48,32 +49,35 @@
<Setter Property="Command" Value="{Binding Command}" />
<Setter Property="CommandParameter" Value="{Binding RelativeSource={RelativeSource Mode=Self}}" />
</Style>
<!-- ListBox样式 -->
<!-- ListBox样式 -->
<ItemsPanelTemplate x:Key="StackPanelItemsPanel">
<VirtualizingStackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</ItemsPanelTemplate>
<ItemsPanelTemplate x:Key="VirtualizingWrapPanelItemsPanel">
<telerik:VirtualizingWrapPanel
ItemWidth="70"
ItemHeight="70" />
</ItemsPanelTemplate>
<telerik:VirtualizingWrapPanel ItemHeight="70" ItemWidth="70" />
</ItemsPanelTemplate>
<DataTemplate x:Key="VirtualizingWrapPanelItemTemplate">
<Grid ToolTip="{Binding LibraryFileName}">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="Gray" >
<Image Source="{Binding ImagePath,Converter={StaticResource imgConverter}}" HorizontalAlignment="Stretch" Stretch="Fill"
Width="auto" Height="auto" />
</Grid>
<TextBlock Grid.Row="1"
Text="{Binding LibraryFileName}"
FontFamily="Segoe UI"
FontSize="12"
VerticalAlignment="Bottom"
Margin="2 0 0 0" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Background="Gray">
<Image
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"
Source="{Binding ImagePath, Converter={StaticResource imgConverter}}"
Stretch="Fill" />
</Grid>
<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
VerticalAlignment="Bottom"
FontFamily="Segoe UI"
FontSize="12"
Text="{Binding LibraryFileName}" />
</Grid>
</DataTemplate>
</UserControl.Resources>
@ -122,7 +126,7 @@
<!-- Tab 1: 工程文件 -->
<telerik:RadTabItem Header="工&#x0a;程&#x0a;文&#x0a;件">
<TabControl Background="Transparent">
<TabItem Header="文件目录" >
<TabItem Header="文件目录">
<Grid Background="Transparent">
<Grid.RowDefinitions>
@ -136,49 +140,79 @@
</Grid.ColumnDefinitions>
<telerik:RadGlyph Grid.Column="0" Glyph="&#xe13e;" />
<TextBox
Grid.Column="1"
Width="auto"
Margin="1,0,0,0"
HorizontalAlignment="Stretch"
Style="{StaticResource sysTextBox}"
Tag ="工程文件"
TextChanged="TextBox_TextChanged" />
<StackPanel Grid.Row="1" Grid.ColumnSpan="2" Orientation="Horizontal">
<telerik:RadGlyph Glyph="&#xe61f;" FontSize="10" Foreground="Yellow"/>
<TextBlock Text="未检出" FontSize="10" TextAlignment="Center" VerticalAlignment="Center" Foreground="Yellow"/>
<telerik:RadGlyph Glyph="&#xe00a;" FontSize="10" Foreground="LightBlue"/>
<TextBlock Text="自己检出" FontSize="10" TextAlignment="Center" VerticalAlignment="Center" Foreground="LightBlue"/>
<telerik:RadGlyph Glyph="&#xe113;" FontSize="10" Foreground="LightPink"/>
<TextBlock Text="别人检出" FontSize="10" TextAlignment="Center" VerticalAlignment="Center" Foreground="LightPink"/>
Grid.Column="1"
Width="auto"
Margin="1,0,0,0"
HorizontalAlignment="Stretch"
Style="{StaticResource sysTextBox}"
Tag="工程文件"
TextChanged="TextBox_TextChanged" />
<StackPanel
Grid.Row="1"
Grid.ColumnSpan="2"
Orientation="Horizontal">
<telerik:RadGlyph
FontSize="10"
Foreground="Yellow"
Glyph="&#xe61f;" />
<TextBlock
VerticalAlignment="Center"
FontSize="10"
Foreground="Yellow"
Text="未检出"
TextAlignment="Center" />
<telerik:RadGlyph
FontSize="10"
Foreground="LightBlue"
Glyph="&#xe00a;" />
<TextBlock
VerticalAlignment="Center"
FontSize="10"
Foreground="LightBlue"
Text="自己检出"
TextAlignment="Center" />
<telerik:RadGlyph
FontSize="10"
Foreground="LightPink"
Glyph="&#xe113;" />
<TextBlock
VerticalAlignment="Center"
FontSize="10"
Foreground="LightPink"
Text="别人检出"
TextAlignment="Center" />
</StackPanel>
<telerik:RadTreeView
x:Name="radTreeView"
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
FontSize="11"
ItemsSource="{Binding Drawings}"
PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown"
SelectedItem="{Binding selectedNode,Mode=TwoWay}">
x:Name="radTreeView"
Grid.Row="2"
Grid.ColumnSpan="2"
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
FontSize="11"
ItemsSource="{Binding Drawings}"
PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown"
SelectedItem="{Binding selectedNode, Mode=TwoWay}">
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
<StackPanel
Height="16"
Orientation="Horizontal"
ToolTip="{Binding ToolTipText}">
Height="16"
Orientation="Horizontal"
ToolTip="{Binding ToolTipText}">
<!-- 图标 -->
<telerik:RadGlyph FontSize="16" Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" Foreground="{Binding FontColor}"/>
<telerik:RadGlyph
FontSize="16"
Foreground="{Binding FontColor}"
Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" />
<!-- 文本 -->
<TextBlock
VerticalAlignment="Center"
Foreground="{Binding FontColor}"
Text="{Binding Text}" />
VerticalAlignment="Center"
Foreground="{Binding FontColor}"
Text="{Binding Text}" />
</StackPanel>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
<telerik:RadTreeView.ContextMenu>
<ContextMenu x:Name="TreeItemContextMenu">
<!-- 菜单项将会在后台动态填充 -->
@ -190,28 +224,32 @@
<TabItem Header="历史版次">
<Grid Background="Transparent">
<telerik:RadTreeView
x:Name="treeDwgHistory"
Margin="-5,0,0,0" Background="Transparent"
telerik:StyleManager.Theme="Green"
FontSize="11"
ItemsSource="{Binding historyDrawings}"
PreviewMouseRightButtonDown="treeDwgHistory_PreviewMouseRightButtonDown"
SelectedItem="{Binding selectedHistoryDwg,Mode=TwoWay}">
x:Name="treeDwgHistory"
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
Background="Transparent"
FontSize="11"
ItemsSource="{Binding historyDrawings}"
PreviewMouseRightButtonDown="treeDwgHistory_PreviewMouseRightButtonDown"
SelectedItem="{Binding selectedHistoryDwg, Mode=TwoWay}">
<telerik:RadTreeView.ItemContainerStyle>
<Style TargetType="telerik:RadTreeViewItem">
<Setter Property="IsExpanded" Value="{Binding isexpand ,Mode=TwoWay, Converter={StaticResource expandConverter}}" />
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
</Style>
</telerik:RadTreeView.ItemContainerStyle>
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
<StackPanel
Height="16"
Orientation="Horizontal"
ToolTip="{Binding ToolTipText}">
Height="16"
Orientation="Horizontal"
ToolTip="{Binding ToolTipText}">
<!-- 图标 -->
<telerik:RadGlyph FontSize="16" Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" Foreground="{Binding FontColor}"/>
<telerik:RadGlyph
FontSize="16"
Foreground="{Binding FontColor}"
Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" />
<!-- 文本 -->
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
</StackPanel>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
@ -231,7 +269,7 @@
<!-- Tab 2: Placeholder Content -->
<telerik:RadTabItem Header="设&#x0a;计&#x0a;元&#x0a;件">
<Grid>
<Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="18" />
<RowDefinition Height="auto" MaxHeight="150" />
<RowDefinition Height="4*" />
@ -242,10 +280,17 @@
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button Margin="10,0,0,0" Command="{Binding Command_Guanlian}" BorderBrush="{x:Null}" BorderThickness="0"
IsEnabled="{Binding isEnabledGuanlian}" ToolTip="元件关联图元" Width="16" Height="16">
<Button
Width="16"
Height="16"
Margin="10,0,0,0"
BorderBrush="{x:Null}"
BorderThickness="0"
Command="{Binding Command_Guanlian}"
IsEnabled="{Binding isEnabledGuanlian}"
ToolTip="元件关联图元">
<Button.Background>
<ImageBrush ImageSource="{Binding guanlianImage}" Stretch="Fill"/>
<ImageBrush ImageSource="{Binding guanlianImage}" Stretch="Fill" />
</Button.Background>
<Button.Style>
<Style TargetType="Button">
@ -255,7 +300,7 @@
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="White" BorderThickness="1">
<Image Source="{Binding guanlianImage}" Stretch="Fill"/>
<Image Source="{Binding guanlianImage}" Stretch="Fill" />
</Border>
</ControlTemplate>
</Setter.Value>
@ -266,7 +311,7 @@
<Setter.Value>
<ControlTemplate>
<Border BorderBrush="Black" BorderThickness="0">
<Image Source="{Binding guanlian2Image}" Stretch="Fill"/>
<Image Source="{Binding guanlian2Image}" Stretch="Fill" />
</Border>
</ControlTemplate>
</Setter.Value>
@ -278,8 +323,12 @@
</Button>
</StackPanel>
<telerik:RadGlyph Grid.Row="1" Grid.Column="0" Glyph="&#xe13e;" />
<TextBox Grid.Row="1"
<telerik:RadGlyph
Grid.Row="1"
Grid.Column="0"
Glyph="&#xe13e;" />
<TextBox
Grid.Row="1"
Grid.Column="1"
Width="auto"
Margin="1,0,0,0"
@ -293,14 +342,17 @@
Grid.ColumnSpan="2"
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
FontSize="11"
FontSize="11"
ItemsSource="{Binding objectTypeTree}"
SelectedItem="{Binding selectType,Mode=TwoWay}">
SelectedItem="{Binding selectType, Mode=TwoWay}">
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
<StackPanel Height="16" Orientation="Horizontal">
<!-- 图标 -->
<telerik:RadGlyph FontSize="16" Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" Foreground="{Binding FontColor}"/>
<telerik:RadGlyph
FontSize="16"
Foreground="{Binding FontColor}"
Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" />
<!-- 文本 -->
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
</StackPanel>
@ -308,36 +360,46 @@
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
<Grid Grid.Row="3" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<!--<telerik:RadListBox Background="BurlyWood" />-->
<telerik:RadListBox x:Name="tagListBox" Grid.Row="2"
BorderThickness="0"
ItemsSource="{Binding listLibrary}"
SelectedItem="{Binding selectedTag,Mode=TwoWay}"
ItemTemplate="{StaticResource VirtualizingWrapPanelItemTemplate}"
<telerik:RadListBox
x:Name="tagListBox"
Grid.Row="2"
BorderThickness="0"
ItemTemplate="{StaticResource VirtualizingWrapPanelItemTemplate}"
ItemsPanel="{StaticResource VirtualizingWrapPanelItemsPanel}"
ItemsSource="{Binding listLibrary}"
SelectedItem="{Binding selectedTag, Mode=TwoWay}"
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
VirtualizingPanel.ScrollUnit="Pixel"
VirtualizingPanel.VirtualizationMode="Recycling">
<i:Interaction.Triggers>
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
Command="{Binding Command_TagDoubleClick}"
CommandParameter="{Binding ElementName=tagListBox, Path=SelectedItem}"
PassEventArgsToCommand="True"/>
<i:InvokeCommandAction
Command="{Binding Command_TagDoubleClick}"
CommandParameter="{Binding ElementName=tagListBox, Path=SelectedItem}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<telerik:RadListBox.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel Height="30" Background="LightBlue" Margin="2">
<TextBlock Text="{Binding LibraryFileName}" FontFamily="Segoe UI Light" FontWeight="Bold" FontSize="16"
Margin="10 3 0 0" Foreground="Black"/>
<StackPanel
Height="30"
Margin="2"
Background="LightBlue">
<TextBlock
Margin="10,3,0,0"
FontFamily="Segoe UI Light"
FontSize="16"
FontWeight="Bold"
Foreground="Black"
Text="{Binding LibraryFileName}" />
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
@ -361,49 +423,53 @@
<!-- Tab 3: Placeholder Content -->
<telerik:RadTabItem Header="设&#x0a;计&#x0a;浏&#x0a;览">
<StackPanel Orientation="Vertical">
<TextBox Width="auto"
Margin="1,0,0,0"
HorizontalAlignment="Stretch"
Style="{StaticResource sysTextBox}"
Tag="设计浏览"
InputMethod.IsInputMethodEnabled="False"
TextChanged="TextBox_TextChanged" >
</TextBox>
<telerik:RadTreeView
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
FontSize="11" x:Name="designTreeView"
ItemsSource="{Binding designTree}"
SelectedItem="{Binding selectDesign,Mode=TwoWay}"
>
<TextBox
Width="auto"
Margin="1,0,0,0"
HorizontalAlignment="Stretch"
InputMethod.IsInputMethodEnabled="False"
Style="{StaticResource sysTextBox}"
Tag="设计浏览"
TextChanged="TextBox_TextChanged" />
<telerik:RadTreeView
x:Name="designTreeView"
Margin="-5,0,0,0"
telerik:StyleManager.Theme="Green"
FontSize="11"
ItemsSource="{Binding designTree}"
SelectedItem="{Binding selectDesign, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction
Command="{Binding Common_SelectedDesign}"
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
PassEventArgsToCommand="True"/>
<i:InvokeCommandAction
Command="{Binding Common_SelectedDesign}"
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction
Command="{Binding Common_DoubleClickDesign}"
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
PassEventArgsToCommand="True"/>
<i:InvokeCommandAction
Command="{Binding Common_DoubleClickDesign}"
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>
<telerik:RadTreeView.ItemContainerStyle>
<Style TargetType="telerik:RadTreeViewItem">
<Setter Property="IsExpanded" Value="{Binding isexpand ,Mode=TwoWay, Converter={StaticResource expandConverter}}" />
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
</Style>
</telerik:RadTreeView.ItemContainerStyle>
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}" >
<StackPanel Height="16" Orientation="Horizontal" ToolTip="{Binding ToolTipText}">
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
<StackPanel
Height="16"
Orientation="Horizontal"
ToolTip="{Binding ToolTipText}">
<!-- 图标 -->
<telerik:RadGlyph FontSize="16" Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}"
Foreground="{Binding FontColor}"/>
<telerik:RadGlyph
FontSize="16"
Foreground="{Binding FontColor}"
Glyph="{Binding Glyph, Converter={StaticResource StringToGlyphConverter1}}" />
<!-- 文本 -->
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
</StackPanel>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>

View File

@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@ -123,23 +124,23 @@ namespace SWS.Commons
para1,
para2
}
public static IContainerRegistry containerRegistry ;
public static IUnityContainer container;
public static IContainerExtension _prismContainer ;
public static IContainerRegistry containerRegistry;
public static IUnityContainer container;
public static IContainerExtension _prismContainer;
public static HttpClient client;
public static loginRes userInfo;
public static List<User> Users;
public static List<TreeModel> AllDrawings = new List<TreeModel>();//所有图纸
public static bool isConfigIniCreateBySys = true;
//public static string drawingFileId;
public static ec_project curProject;
public static DateTime preClickTime = DateTime.Now;
public static DateTime preClickTime = DateTime.Now;
public static Unit UnitSelected;
public static List<ec_measuring_unit> Units;
/// <summary>
/// 打开的图纸名列表
/// </summary>
public static List<DrawingOpened> ListDwgOpened = new List<DrawingOpened>();
public static List<DrawingOpened> ListDwgOpened = new List<DrawingOpened>();
/// <summary>
/// 图纸树上的所有图纸名
/// </summary>
@ -275,11 +276,51 @@ namespace SWS.Commons
}
#endregion
#region ID获取路径的存放路径
/// <summary>
///
/// 根据图纸ID获取路径的存放路径
/// </summary>
/// <param name="resName">包括命名空间</param>
/// <param name="dwgID"></param>
/// <returns></returns>
public static string GetDwgPath(string dwgID)
{
string fullpath = string.Empty;
if (!AllDrawings.Any())
{ return fullpath; }
fullpath = GetParentPath(dwgID);
return fullpath;
}
private static string GetParentPath(string dwgID)
{
string path = string.Empty;
var node = TreeHelper.GetTreeModel(AllDrawings, dwgID);
if (node.NodeType == "0")
{ path = node.Text + "\\" + path; }
if (node.parentId != "0")
{ path = GetParentPath(node.parentId) + path; }
return path;
}
#endregion
#region dll路径
/// <summary>
/// 本项目dll路径
/// </summary>
/// <returns></returns>
public static string GetDllPath()
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
string dllPath = codeBase.Replace("file:///", "");
dllPath = Path.GetDirectoryName(dllPath);
return dllPath;
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="resName">包括命名空间</param>
/// <returns></returns>
public static System.Windows.Media.ImageSource ImageSourceFromEmbeddedResourceStream(string resName)
{
string imgPath = $"SWS.Commons.Images.{resName}";

View File

@ -24,10 +24,12 @@ namespace SWS.Commons
/// <param name="def">默认值</param>
/// <param name="filePath">文件路径</param>
/// <returns>读出内容</returns>
public static string ReadValueFromIniFile(string Section, string Key, string def=null, string filePath= null)
public static string ReadValueFromIniFile(string Section, string Key, string def = null, string filePath = null)
{
if (def == null)
{ def = ""; }
{
def = "";
}
if (filePath == null)
{
filePath = GlobalObject.configPath;

View File

@ -20,13 +20,11 @@ namespace SWS.Commons
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\\");
logPath = Path.Combine(GlobalObject.GetDllPath(), "Logs\\");
if (!Directory.Exists(logPath))
{ Directory.CreateDirectory(logPath); }
var configFile = new FileInfo(Path.Combine(dllPath, "log4net.config"));
var configFile = new FileInfo(Path.Combine(GlobalObject.GetDllPath(), "log4net.config"));
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFile);
}
/// <summary>

View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SWS.Commons;
using SWS.Model;
namespace SWS.Commons
{
public class TreeHelper
{
#region
/// <summary>
/// 获取树节点
/// </summary>
public static Model.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 Model.TreeModel GetTreeModel(List<Model.TreeModel> nodes, string id)
{
Model.TreeModel node = null;
foreach (var dto in nodes)
{
//获取节点下的图纸
node = TreeHelper.GetTreeModel(dto, id);
if (node != null)
{
break;
}
}
return node;
}
#endregion
#region
/// <summary>
/// 获取树节点所有图纸名
/// </summary>
public static void GetTreeText(Model.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
}
}

View File

@ -115,6 +115,7 @@
<Compile Include="Helper\FileHelper.cs" />
<Compile Include="Helper\LoggerHelper.cs" />
<Compile Include="Helper\PasswordHelper.cs" />
<Compile Include="Helper\TreeHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,182 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Threading;
namespace SWS.CustomControl
{
public class MultiSelectComboBox : ListBox
{
private const string PART_Popup = "PART_Popup";
private const string PART_CheckBoxAll = "PART_CheckBoxAll";
public static readonly DependencyProperty IsDropDownOpenProperty =
DependencyProperty.Register("IsDropDownOpen", typeof(bool), typeof(MultiSelectComboBox),
new PropertyMetadata(false));
public static readonly DependencyProperty MaxDropDownHeightProperty
= DependencyProperty.Register("MaxDropDownHeight", typeof(double), typeof(MultiSelectComboBox),
new PropertyMetadata(SystemParameters.PrimaryScreenHeight / 3));
public static readonly DependencyProperty SelectAllContentProperty =
DependencyProperty.Register("SelectAllContent", typeof(object), typeof(MultiSelectComboBox),
new PropertyMetadata("全选"));
public static readonly DependencyProperty IsSelectAllActiveProperty =
DependencyProperty.Register("IsSelectAllActive", typeof(bool), typeof(MultiSelectComboBox),
new PropertyMetadata(false));
public static readonly DependencyProperty DelimiterProperty =
DependencyProperty.Register("Delimiter", typeof(string), typeof(MultiSelectComboBox),
new PropertyMetadata(";"));
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(string), typeof(MultiSelectComboBox),
new PropertyMetadata(string.Empty, OnTextChanged));
private bool _ignoreTextValueChanged;
private MultiSelectComboBoxItem _multiSelectComboBoxItem;
private Popup _popup;
public bool IsDropDownOpen
{
get => (bool)GetValue(IsDropDownOpenProperty);
set => SetValue(IsDropDownOpenProperty, value);
}
[Bindable(true)]
[Category("Layout")]
[TypeConverter(typeof(LengthConverter))]
public double MaxDropDownHeight
{
get => (double)GetValue(MaxDropDownHeightProperty);
set => SetValue(MaxDropDownHeightProperty, value);
}
public object SelectAllContent
{
get => GetValue(SelectAllContentProperty);
set => SetValue(SelectAllContentProperty, value);
}
public bool IsSelectAllActive
{
get => (bool)GetValue(IsSelectAllActiveProperty);
set => SetValue(IsSelectAllActiveProperty, value);
}
public string Delimiter
{
get => (string)GetValue(DelimiterProperty);
set => SetValue(DelimiterProperty, value);
}
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var MultiSelectComboBox = (MultiSelectComboBox)d;
if (!(bool)e.NewValue)
MultiSelectComboBox.Dispatcher.BeginInvoke(new Action(() => { Mouse.Capture(null); }),
DispatcherPriority.Send);
}
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is MultiSelectComboBoxItem;
}
protected override DependencyObject GetContainerForItemOverride()
{
return new MultiSelectComboBoxItem();
}
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
UpdateText();
base.OnSelectionChanged(e);
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_popup = GetTemplateChild(PART_Popup) as Popup;
_multiSelectComboBoxItem = GetTemplateChild(PART_CheckBoxAll) as MultiSelectComboBoxItem;
_multiSelectComboBoxItem.Selected += _MultiSelectComboBoxItem_Selected;
_multiSelectComboBoxItem.Unselected += _MultiSelectComboBoxItem_Unselected;
}
private void _MultiSelectComboBoxItem_Unselected(object sender, RoutedEventArgs e)
{
if (_ignoreTextValueChanged) return;
_ignoreTextValueChanged = true;
UnselectAll();
_ignoreTextValueChanged = false;
UpdateText();
}
private void _MultiSelectComboBoxItem_Selected(object sender, RoutedEventArgs e)
{
if (_ignoreTextValueChanged) return;
_ignoreTextValueChanged = true;
SelectAll();
_ignoreTextValueChanged = false;
UpdateText();
}
protected virtual void UpdateText()
{
if (_ignoreTextValueChanged) return;
var newValue = string.Join(Delimiter, SelectedItems.Cast<object>().Select(x => GetItemDisplayValue(x)));
if (string.IsNullOrWhiteSpace(Text) || !Text.Equals(newValue))
{
_ignoreTextValueChanged = true;
if (_multiSelectComboBoxItem != null)
_multiSelectComboBoxItem.SetCurrentValue(IsSelectedProperty, SelectedItems.Count == Items.Count);
SetCurrentValue(TextProperty, newValue);
_ignoreTextValueChanged = false;
}
}
protected object GetItemDisplayValue(object item)
{
if (string.IsNullOrWhiteSpace(DisplayMemberPath))
{
var property = item.GetType().GetProperty("Content");
if (property != null)
return property.GetValue(item, null);
}
var nameParts = DisplayMemberPath.Split('.');
if (nameParts.Length == 1)
{
var property = item.GetType().GetProperty(DisplayMemberPath);
if (property != null)
return property.GetValue(item, null);
}
return item;
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace SWS.CAD.Views.CustomControl
{
public class MultiSelectComboBoxItem : ListBoxItem
{
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Windows;
using System.Windows.Controls;
namespace SWS.CAD.Views.CustomControl
{
/// <summary>
/// 当不需要使用Grid的分行分列则可使用 SmallPanel
/// </summary>
public class SmallPanel : Panel
{
/// <summary>
/// Content measurement.
/// </summary>
/// <param name="constraint">Constraint</param>
/// <returns>Desired size</returns>
protected override Size MeasureOverride(Size constraint)
{
Size gridDesiredSize = new Size();
UIElementCollection children = InternalChildren;
for (int i = 0, count = children.Count; i < count; ++i)
{
UIElement child = children[i];
if (child != null)
{
child.Measure(constraint);
gridDesiredSize.Width = Math.Max(gridDesiredSize.Width, child.DesiredSize.Width);
gridDesiredSize.Height = Math.Max(gridDesiredSize.Height, child.DesiredSize.Height);
}
}
return (gridDesiredSize);
}
/// <summary>
/// Content arrangement.
/// </summary>
/// <param name="arrangeSize">Arrange size</param>
protected override Size ArrangeOverride(Size arrangeSize)
{
UIElementCollection children = InternalChildren;
for (int i = 0, count = children.Count; i < count; ++i)
{
UIElement child = children[i];
if (child != null)
{
child.Arrange(new Rect(arrangeSize));
}
}
return (arrangeSize);
}
}
}

View File

@ -50,6 +50,7 @@
<DependentUpon>customWindowTitleBar.xaml</DependentUpon>
</Compile>
<Compile Include="IconButton\IconButton.cs" />
<Compile Include="MultiSelectComboBox\MultiSelectComboBox.cs" />
<Compile Include="MultiSelectSearchComboBox\CollectionToStringConverter.cs" />
<Compile Include="MultiSelectSearchComboBox\DoubleUtil.cs" />
<Compile Include="MultiSelectSearchComboBox\ElementHelper.cs" />

View File

@ -49,7 +49,7 @@ namespace SWS.Electrical
{
try
{
// 记录异常信息到日志文件,这里简单打印到控制
// 记录异常信息到日志文件,这里简单打印到控制 ?
System.Exception ex = e.ExceptionObject as System.Exception;
Console.WriteLine($"发生未处理的异常: {ex.Message}");
Console.WriteLine($"异常堆栈跟踪: {ex.StackTrace}");
@ -57,13 +57,13 @@ namespace SWS.Electrical
// 关闭所有打开的对话框窗口
// 提示用户发生了错
MessageBox.Show("发生错误,请检查日志文件以获取更多信息", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
// 提示用户发生了错 ?
MessageBox.Show("发生错误,请检查日志文件以获取更多信息 ?", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (System.Exception innerEx)
{
// 如果在处理异常时又发生了异常,简单打印信
Console.WriteLine($"处理异常时发生错误: {innerEx.Message}");
// 如果在处理异常时又发生了异常,简单打印信 ?
Console.WriteLine($"处理异常时发生错 ? {innerEx.Message}");
}
}
@ -95,11 +95,11 @@ namespace SWS.Electrical
RibbonRowPanel ribbonRowPanel = new RibbonRowPanel();
#region buttons
RibbonButton btnSinalManage = new RibbonButton();
btnSinalManage.ToolTip = "测试绘图";
btnSinalManage.Text = "测试绘图";
btnSinalManage.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnSinalManage.CommandHandler = new DelegateCommand(async x =>
RibbonButton btnMenu = new RibbonButton();
btnMenu.ToolTip = "测试绘图";
btnMenu.Text = "测试绘图";
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnMenu.CommandHandler = new DelegateCommand(async x =>
{
//打开窗体
@ -132,9 +132,9 @@ namespace SWS.Electrical
}
});
btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("OpenProject.png");
btnSinalManage.Id = "选择项目";
ribbonRowPanel.Items.Add(btnSinalManage);
btnMenu.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("OpenProject.png");
btnMenu.Id = "选择项目";
ribbonRowPanel.Items.Add(btnMenu);
ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列
#endregion
dataSource.Items.Add(ribbonRowPanel);
@ -152,11 +152,11 @@ namespace SWS.Electrical
ribbonRowPanel = new RibbonRowPanel();
#region buttons
btnSinalManage = new RibbonButton();
btnSinalManage.ToolTip = "信号管理";
btnSinalManage.Text = "信号管理";
btnSinalManage.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnSinalManage.CommandHandler = new DelegateCommand(async x =>
btnMenu = new RibbonButton();
btnMenu.ToolTip = "信号管理";
btnMenu.Text = "信号管理";
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnMenu.CommandHandler = new DelegateCommand(async x =>
{
//打开窗体
@ -181,9 +181,9 @@ namespace SWS.Electrical
}
});
btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("SinalManage.png");
btnSinalManage.Id = "信号管理";
ribbonRowPanel.Items.Add(btnSinalManage);
btnMenu.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("SinalManage.png");
btnMenu.Id = "信号管理";
ribbonRowPanel.Items.Add(btnMenu);
ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列
#endregion
dataSource.Items.Add(ribbonRowPanel);
@ -201,11 +201,11 @@ namespace SWS.Electrical
ribbonRowPanel = new RibbonRowPanel();
#region buttons
btnSinalManage = new RibbonButton();
btnSinalManage.ToolTip = "布置图自动绘制";
btnSinalManage.Text = "布置图自动绘制";
btnSinalManage.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnSinalManage.CommandHandler = new DelegateCommand(async x =>
btnMenu = new RibbonButton();
btnMenu.ToolTip = "布置图自动绘制";
btnMenu.Text = "布置图自动绘制";
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnMenu.CommandHandler = new DelegateCommand(async x =>
{
//打开窗体
@ -230,13 +230,64 @@ namespace SWS.Electrical
}
});
btnSinalManage.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("SinalManage.png");
btnSinalManage.Id = "信号管理";
ribbonRowPanel.Items.Add(btnSinalManage);
btnMenu.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("PlaneLayout.png");
btnMenu.Id = "绘图管理";
ribbonRowPanel.Items.Add(btnMenu);
ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列
#endregion
dataSource.Items.Add(ribbonRowPanel);
#endregion
#region Ribbon
dataSource = new RibbonPanelSource();
dataSource.Title = "材料表管理";
dataSource.Id = "材料表管理";
dataPanel = new RibbonPanel();
dataPanel.Source = dataSource;
tab1.Panels.Add(dataPanel);
//垂直排列按钮panel
ribbonRowPanel = new RibbonRowPanel();
#region buttons
btnMenu = new RibbonButton();
btnMenu.ToolTip = "材料表自动生成";
btnMenu.Text = "材料表自动生成";
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnMenu.CommandHandler = new DelegateCommand(async x =>
{
//打开窗体
try
{
var flag = await GlobalObj.CheckLogin();
if (!flag)
{
MessageBox.Show("登录已过期,请重新登录!");
return;
}
var para = new DialogParameters();
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogGenerateBOM), para, (RES) =>
{
});
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
});
btnMenu.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream("CableSinal.png");
btnMenu.Id = "材料表管理";
ribbonRowPanel.Items.Add(btnMenu);
ribbonRowPanel.Items.Add(new RibbonRowBreak());//换行,这样可以使按钮多行排列
#endregion
dataSource.Items.Add(ribbonRowPanel);
#endregion
}
}

View File

@ -25,7 +25,7 @@ namespace SWS.Electrical
{
public class GlobalObj
{
public static List<TreeModel> treeDrawings=new List<TreeModel>();
public static List<TreeModel> treeDrawings = new List<TreeModel>();
//public static IUnityContainer container;
//public static IContainerExtension _prismContainer;
public static FileIniDataParser configIni = new FileIniDataParser();
@ -43,7 +43,7 @@ namespace SWS.Electrical
{
try
{
//var parser = new FileIniDataParser();
//var parser = new FileIniDataParser();
//string[] lines = File.ReadAllLines(GlobalObject.configPath);
//IniData data = parser.Parser.Parse(File.ReadAllText(GlobalObject.configPath));
//var data = configIni.ReadFile(GlobalObject.configPath);
@ -80,24 +80,32 @@ namespace SWS.Electrical
Timeout = TimeSpan.FromSeconds(120)
};
}
GlobalObject.client.DefaultRequestHeaders.Add("logintoken",token);
GlobalObject.client.DefaultRequestHeaders.Add("logintoken", token);
GlobalObject.client.DefaultRequestHeaders.Add("loginkey", loginkey);
var loginService = GlobalObject.container.Resolve<LoginService>();
var flag = await loginService.ValidateLogin(token, loginkey);
if (flag && GlobalObject.curProject == null)
if (flag && GlobalObject.curProject == null && !string.IsNullOrEmpty(curProjId))
{
//第一次要在后台初始化一些数据
Task.Factory.StartNew(async () => {
var projectService = GlobalObject.container.Resolve<ProjectService>();
var listProjects = (await projectService.GetProjects(1, 1000)).Rows;
var p= listProjects.FirstOrDefault(a=>a.ProjectId== curProjId);
GlobalObject.curProject = p;
var obj = await projectService.InitProjInfo(curProjId, "");
var treeData = obj.First(x => (string)x["Name"] == "图纸树(按目录)")["data"];
treeDrawings = JsonConvert.DeserializeObject<List<TreeModel>>(treeData.ToString());
GlobalObject.curProject = await projectService.GetEntity(curProjId);
if (GlobalObject.curProject == null)
{
Task.Factory.StartNew(async () =>
{
// var projectService = GlobalObject.container.Resolve<ProjectService>();
var listProjects = (await projectService.GetProjects(1, 1000)).Rows;
var p = listProjects.FirstOrDefault(a => a.ProjectId == curProjId);
GlobalObject.curProject = p;
var obj = await projectService.InitProjInfo(curProjId, "");
var treeData = obj.First(x => (string)x["Name"] == "图纸树(按目录)")["data"];
treeDrawings = JsonConvert.DeserializeObject<List<TreeModel>>(treeData.ToString());
});
});
}
}
if (GlobalObject.curProject == null)
{ GlobalObject.curProject = new ec_project() { ProjectId = curProjId }; }
return flag;
}
catch (System.Exception ex)

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SWS.Model;
using Telerik.Windows.Controls;
namespace SWS.Electrical.Models
{
public class DtoBomDrawings : DtoDrawing
{
private string _AutoDrawing;
/// <summary>
/// 已生成 未生成 已存在
/// </summary>
/// <returns></returns>
public string AutoGenerate
{
get { return _AutoDrawing; }
set { _AutoDrawing = value; RaisePropertyChanged(nameof(AutoGenerate)); }
}
}
}

View File

@ -134,12 +134,17 @@
<Compile Include="Commands.cs" />
<Compile Include="Control\ListBoxScrollToBottomBehavior.cs" />
<Compile Include="GlobalObj.cs" />
<Compile Include="Models\DtoBomDrawings.cs" />
<Compile Include="Models\DtoAutoPlotLayout.cs" />
<Compile Include="Models\DtoDrawing.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Start.cs" />
<Compile Include="ViewModels\DialogGenerateBOMViewModel.cs" />
<Compile Include="ViewModels\DialogAutoArrangeLayoutViewModel.cs" />
<Compile Include="ViewModels\DialogTest2ViewModel.cs" />
<Compile Include="Views\DialogGenerateBOM.xaml.cs">
<DependentUpon>DialogGenerateBOM.xaml</DependentUpon>
</Compile>
<Compile Include="Views\DialogAutoArrangeLayout.xaml.cs">
<DependentUpon>DialogAutoArrangeLayout.xaml</DependentUpon>
</Compile>
@ -153,6 +158,18 @@
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<Content Include="Template\BomConfig.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Template\材料表.dwg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Template\常规矩形两行图块.dwg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Template\常规矩形单行图块.dwg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="配置说明.docx" />
</ItemGroup>
<ItemGroup>
@ -176,6 +193,10 @@
<Project>{51cb6f5b-16e9-4ee0-baa4-144dd1ec8580}</Project>
<Name>SWS.Service</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87e71797-e60a-4637-ba32-c8b57154abc3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.WPF\SWS.WPF.csproj">
<Project>{7aff9117-78e7-4395-9f23-6dcfe09f9299}</Project>
<Name>SWS.WPF</Name>
@ -183,6 +204,14 @@
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Page Include="Style\CustomStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\DialogGenerateBOM.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\DialogAutoArrangeLayout.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@ -44,6 +44,8 @@ namespace SWS.Electrical
GlobalObject.container.RegisterSingleton<WireGroupService>();
GlobalObject.container.RegisterSingleton<LibraryFileService>();
GlobalObject.container.RegisterSingleton<PlotLayoutService>();
GlobalObject.container.RegisterSingleton<PlotBOMService>();
DryIoc.Rules DefaultRules = DryIoc.Rules.Default
.WithConcreteTypeDynamicRegistrations(null, DryIoc.Reuse.Transient)
@ -65,6 +67,8 @@ namespace SWS.Electrical
GlobalObject._prismContainer.RegisterDialog<DialogAllOutputSignal, DialogAllOutputSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAutoArrangeLayout, DialogAutoArrangeLayoutViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogGenerateBOM, DialogGenerateBOMViewModel>();
}
public static void AutoLogin()

View File

@ -0,0 +1,266 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<!-- 系统颜色 -->
<SolidColorBrush x:Key="ColorPrimary" Color="#026BE3" />
<SolidColorBrush x:Key="ColorSecond" Color="#02ADFF" />
<SolidColorBrush x:Key="ColorOther" Color="#DBE0E4" />
<!-- 多选 Combox Start -->
<ExponentialEase x:Key="ExponentialEaseOut" EasingMode="EaseOut" />
<DropShadowEffect
x:Key="PopupShadowDepth"
BlurRadius="12"
Opacity="0.1"
ShadowDepth="2"
Color="Transparent" />
<Geometry x:Key="ChevronDownGeometry" po:Freeze="True">M998 352c0 -8 -4 -17 -10 -23l-50 -50c-6 -6 -14 -10 -23 -10c-8 0 -17 4 -23 10l-393 393l-393 -393c-6 -6 -15 -10 -23 -10s-17 4 -23 10l-50 50c-6 6 -10 15 -10 23s4 17 10 23l466 466c6 6 15 10 23 10s17 -4 23 -10l466 -466c6 -6 10 -15 10 -23z</Geometry>
<ControlTemplate x:Key="ComboBoxTextBox" TargetType="{x:Type TextBox}">
<Border
HorizontalAlignment="Left"
Background="{TemplateBinding Background}"
Focusable="False">
<ScrollViewer
x:Name="PART_ContentHost"
Background="Transparent"
Focusable="False"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden" />
</Border>
</ControlTemplate>
<ControlTemplate x:Key="ComboBoxToggleButton1" TargetType="{x:Type ToggleButton}">
<Border
x:Name="PART_Border"
Padding="1,1.2"
BorderThickness="0"
SnapsToDevicePixels="true">
<Grid Background="Transparent">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.9*" />
<ColumnDefinition Width="0.1*" />
</Grid.ColumnDefinitions>
<Rectangle
Grid.Column="1"
Width="30"
Height="Auto"
Margin="0,1"
Fill="Transparent" />
<Path
x:Name="PART_Arrow"
Grid.Column="1"
Width="10"
Height="6"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M5,0 L10,10 L0,10 z"
Fill="#03ffea"
RenderTransformOrigin=".5,.5"
Stretch="Fill">
<Path.RenderTransform>
<RotateTransform Angle="180" />
</Path.RenderTransform>
</Path>
</Grid>
</Border>
</ControlTemplate>
<Style x:Key="DefaultMultiSelectComboBoxItem" TargetType="{x:Type local:MultiSelectComboBoxItem}">
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource RegularTextSolidColorBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Height" Value="34" />
<Setter Property="Margin" Value="1,0" />
<Setter Property="Padding" Value="6,0" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBoxItem}">
<Border
x:Name="PART_Border"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="true">
<CheckBox
Padding="{TemplateBinding Padding}"
HorizontalAlignment="Stretch"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ContentPresenter
x:Name="PART_ContentPresenter"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.Foreground="{TemplateBinding Foreground}" />
</CheckBox>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource DefaultBackgroundSolidColorBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type local:MultiSelectComboBox}">
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
<Setter Property="SelectionMode" Value="Multiple" />
<Setter Property="MinWidth" Value="120" />
<Setter Property="Height" Value="25" />
<Setter Property="ItemContainerStyle" Value="{StaticResource DefaultMultiSelectComboBoxItem}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="BorderBrush" Value="{DynamicResource BaseSolidColorBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{DynamicResource BackgroundSolidColorBrush}" />
<Setter Property="Padding" Value="14.5,3,30,3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:MultiSelectComboBox}">
<ControlTemplate.Resources>
<Storyboard x:Key="OpenStoryboard">
<DoubleAnimation
EasingFunction="{StaticResource ExponentialEaseOut}"
Storyboard.TargetName="PART_DropDown"
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
To="1"
Duration="00:00:.2" />
</Storyboard>
<Storyboard x:Key="CloseStoryboard">
<DoubleAnimation
EasingFunction="{StaticResource ExponentialEaseOut}"
Storyboard.TargetName="PART_DropDown"
Storyboard.TargetProperty="(Grid.RenderTransform).(ScaleTransform.ScaleY)"
To="0"
Duration="00:00:.2" />
</Storyboard>
</ControlTemplate.Resources>
<local:SmallPanel SnapsToDevicePixels="True">
<Border
Name="PART_Border"
Background="Transparent"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
SnapsToDevicePixels="True" />
<ToggleButton
x:Name="PART_ToggleButton"
ClickMode="Release"
Focusable="False"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Style="{x:Null}"
Template="{StaticResource ComboBoxToggleButton1}" />
<TextBox
Name="PART_EditableTextBox"
Width="auto"
Margin="0,0,30,0"
Padding="0"
HorizontalAlignment="Left"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="Left"
Background="Transparent"
Focusable="True"
Foreground="#6495ED"
IsReadOnly="True"
SelectionBrush="{DynamicResource WindowBorderBrushSolidColorBrush}"
Style="{x:Null}"
Template="{StaticResource ComboBoxTextBox}"
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
<Popup
x:Name="PART_Popup"
AllowsTransparency="True"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=PART_ToggleButton}"
StaysOpen="False">
<local:SmallPanel
x:Name="PART_DropDown"
MinWidth="{TemplateBinding FrameworkElement.ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}"
Margin="24,2,24,24"
RenderTransformOrigin=".5,0"
SnapsToDevicePixels="True">
<local:SmallPanel.RenderTransform>
<ScaleTransform ScaleY="0" />
</local:SmallPanel.RenderTransform>
<Border
Name="PART_DropDownBorder"
Background="#6495ED"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{Binding Path=(local:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}"
Effect="{StaticResource PopupShadowDepth}"
SnapsToDevicePixels="True"
UseLayoutRounding="True" />
<Grid Margin="0,8" ClipToBounds="False">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<local:MultiSelectComboBoxItem
x:Name="PART_CheckBoxAll"
Content="{TemplateBinding SelectAllContent}"
Style="{TemplateBinding ItemContainerStyle}"
Visibility="{TemplateBinding IsSelectAllActive}" />
<ScrollViewer
x:Name="DropDownScrollViewer"
Grid.Row="1"
ScrollViewer.VerticalScrollBarVisibility="Auto">
<ItemsPresenter
x:Name="ItemsPresenter"
KeyboardNavigation.DirectionalNavigation="Contained"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
</Grid>
</local:SmallPanel>
</Popup>
</local:SmallPanel>
<ControlTemplate.Triggers>
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard x:Name="BeginStoryboardOpenStoryboard" Storyboard="{StaticResource OpenStoryboard}" />
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="BeginStoryboardOpenStoryboard" />
</Trigger.ExitActions>
</Trigger>
<Trigger SourceName="PART_ToggleButton" Property="IsChecked" Value="False">
<Trigger.EnterActions>
<BeginStoryboard x:Name="BeginStoryboardCloseStoryboard" Storyboard="{StaticResource CloseStoryboard}" />
</Trigger.EnterActions>
<Trigger.ExitActions>
<StopStoryboard BeginStoryboardName="BeginStoryboardCloseStoryboard" />
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{DynamicResource PrimaryNormalSolidColorBrush}" />
</Trigger>
<Trigger SourceName="PART_Popup" Property="AllowsTransparency" Value="True">
<Setter TargetName="PART_DropDownBorder" Property="Margin" Value="0,2,0,0" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 多选 Combox End -->
</ResourceDictionary>

View File

@ -0,0 +1,31 @@
{
"Width": 230,
"Height": 320,
"RowPageCount": 5,
"RowCount": 6,
"RowHeight": 20,
"Column1X": 37,
"Column1Y": 245,
"Column1Width": 18,
"Column1Align": 1,
"Column2X": 60,
"Column2Y": 245,
"Column2Width": 22,
"Column2Align": 1,
"Column3X": 80,
"Column3Y": 245,
"Column3Width": 18,
"Column3Align": 1,
"Column4X": 115,
"Column4Y": 245,
"Column4Width": 50,
"Column4Align": 0,
"Column5X": 165,
"Column5Y": 245,
"Column5Width": 40,
"Column5Align": 0,
"Column6X": 195,
"Column6Y": 245,
"Column6Width": 22,
"Column6Align": 0
}

View File

@ -0,0 +1,49 @@
--------------- 19-09-2025 10:11:59 --------------- v21.2.04.0 ---------------
Exception:
ACCESS_VIOLATION (C0000005) in module ntdll.dll at 0033:00007FF9E5D49821
Registers:
RAX=lX RBX=lX RCX=lX RDX=lX RSI=lX RDI=lX RBP=lX RSP=lX RIP=lX EFL=00000000 CS=17E0000 DS=100000 SS=91BA ES=2EFEB970 FS=2EF80E90 GS=2EFEB970
Call stack (current) (main):
RtlDeleteBoundaryDescriptor()+0x0000000000000221, (0x00000000017E0000 0x000000002EFEB97F 0x000000002EFEB970 0x000000002EFEB980), ntdll.dll, 0x00007FF9E5D49821
RtlGetCurrentServiceSessionId()+0x0000000000001294, (0x000000002EFEB970 0x00000000017E0000 0x000000002F2EE640 0x0000000000000000), ntdll.dll, 0x00007FF9E5D4C374
RtlFreeHeap()+0x0000000000000051, (0x000000002F30CC20 0x0000000000000001 0x000000000171F838 0x000000002F2EE640), ntdll.dll, 0x00007FF9E5D4B041
free_base()+0x000000000000001B, (0x000000002F2D48E0 0x00007FF900000000 0x000000000171F838 0x000000002F2EE640), ucrtbase.dll, 0x00007FF9E2EB364B
OdString::freeData()+0x0000000000000027, (0x000000002F2F12E0 0x00007FF9E5D4B041 0x000000002F2F12D0 0x00000000017E0000), TD_Root_21.4_15.dll, 0x00000001800460F7
ut::ConfigNode::operator=()+0x00000000000000B5, (0x000000002F30C9E0 0x000000002F2D4260 0x000000002F2F13A0 0x000000002F2F12E0), bcutils.dll, 0x0000000180013615
ut::Config::resetProfile()+0x0000000000000810, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F13A0 0x00007FF9E5D4B041), bcutils.dll, 0x0000000180026010
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F1C60 0x000000000B3C6010), bcutils.dll, 0x000000018002D4C2
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F0D60 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F0660 0x000000002E351440), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2EE4A0 0x000000002F2EE640 0x000000002F2EFD60 0x000000002E351380), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2EE4A0 0x000000002F0E7080 0x000000002F2EEAA0 0x000000000A34EE50), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000000000000 0x000000002F2EE640 0x000000002F2EE620 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D315
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F2EE620 0x00007FF9E2EB364B 0x000000002F2EE640 0x000000002F2F3620), bcutils.dll, 0x000000018002C4C9
ut::Config::resetProfile()+0x0000000000000810, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2F3460 0x0000000000000101), bcutils.dll, 0x0000000180026010
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2EECE0 0x0000000013EE9240), bcutils.dll, 0x000000018002D4C2
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2EE3E0 0x00007FF9E5D4C3A0), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2E9220 0x00007FF9E5D4C3A0), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E6280 0x000000002F0E6DA0 0x0000000000000000), bcutils.dll, 0x000000018002D49F
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000000000060 0x000000002F0E7080 0x000000002F0E7060 0x00002B6C96C01301), bcutils.dll, 0x000000018002D315
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F0E7060 0x00007FF9E5D4C3A0 0x000000002F0E7080 0x00007FF900000072), bcutils.dll, 0x000000018002C4C9
ut::Config::resetProfile()+0x0000000000000810, (0x0000000031D8EAFF 0x000000002F0E6280 0x000000002F2F3860 0x0000000031BBADA0), bcutils.dll, 0x0000000180026010
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x0000000031B197A0 0x0000000031BAA1F8 0x000000002F0E6460 0x000000000A34EE50), bcutils.dll, 0x000000018002D4C2
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000031BAA1F8 0x000000002F0E6280 0x000000002F0E6260 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D315
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F0E6260 0x000000000A01CE32 0x000000002F0E6280 0x0000000000000000), bcutils.dll, 0x000000018002C4C9
ut::Config::resetProfile()+0x0000000000000810, (0x0000000031BA8070 0x0000000000000000 0x0000000031BA9DD8 0x0000000000000000), bcutils.dll, 0x0000000180026010
ut::ProfileManagerBase::~ProfileManagerBase()+0x000000000000009D, (0x000000000A6ACDF0 0x0000000031BA9DB8 0x000000000171FC08 0x0000000031BA8070), bcutils.dll, 0x000000018002ED5D
_sys_nerr()+0x00000000000002B3, (0x0000000000000000 0x000000000171FC08 0x000000000171FEE0 0x0000000000000001), ucrtbase.dll, 0x00007FF9E2EF3A93
o_free()+0x00000000000000DE, (0x0000000000000000 0x000000000A34E4BD 0x0000000000000000 0x000000000171FBF8), ucrtbase.dll, 0x00007FF9E2EC042E
execute_onexit_table()+0x000000000000003D, (0x000000000A6A58C8 0x0000000000000002 0x0000C76400000002 0x000000000171FBF0), ucrtbase.dll, 0x00007FF9E2EBDDDD
OdRibbonReactorMgrImpl::fireGUIPanelCreated()+0x000000000006FC2E, (0x0000000000000001 0x0000000000000000 0x0000000000000001 0x0000000000000000), cadapp.dll, 0x00000001803EECDE
OdRibbonReactorMgrImpl::fireGUIPanelCreated()+0x000000000006FD54, (0x0000000009F60000 0x0000000000000000 0x0000000000000001 0x000000007FFE0385), cadapp.dll, 0x00000001803EEE04
RtlActivateActivationContextUnsafeFast()+0x000000000000012F, (0x00000000017EE080 0x0000000009F60000 0x0000000000000000 0x0000000000232000), ntdll.dll, 0x00007FF9E5D38BCF
LdrShutdownProcess()+0x0000000000000176, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), ntdll.dll, 0x00007FF9E5D615D6
RtlExitUserProcess()+0x00000000000000AD, (0x0000000000070001 0x0000000000000000 0xFFFFFFFFFFFFFFFE 0xFFFFFFFFFFFFFFFF), ntdll.dll, 0x00007FF9E5D611CD
ExitProcess()+0x000000000000000B, (0x0000000000000000 0x0000000000000000 0x000000000171FEB0 0x0000000000000000), KERNEL32.DLL, 0x00007FF9E4767FCB
exit()+0x00000000000000B8, (0x0000000000000000 0x0000000000000000 0x0000000000000001 0x000000000171FEB0), ucrtbase.dll, 0x00007FF9E2EBBED8
exit()+0x0000000000000279, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000001), ucrtbase.dll, 0x00007FF9E2EBC099
dc::QWinWidget::focusNextPrevChild()+0x0000000000007F90, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), kunhengcad.exe, 0x000000014009EAF0
BaseThreadInitThunk()+0x000000000000001D, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), KERNEL32.DLL, 0x00007FF9E476259D
RtlUserThreadStart()+0x0000000000000028, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), ntdll.dll, 0x00007FF9E5D6AF78

View File

@ -214,11 +214,10 @@ namespace SWS.Electrical.ViewModels
ProjectSettingsService _ServiceProjectSettings;
DataItemService _ServiceDataItem;
List<string> listTagNumberSucc = new List<string>();
private bool isSearch = false;//是否正在查询
private bool isDrawing = false;//是否正在画图
private string dwgName = string.Empty;
private List<string> listLibraryTagName = new List<string>();//元件图纸上的位号属性名称,
private List<KeyValueModel> listDeck=new List<KeyValueModel>();//甲板号值列表
private List<KeyValueModel> listDeck = new List<KeyValueModel>();//甲板号值列表
private List<KeyValueModel> listArea = new List<KeyValueModel>();//区域值列表
private List<KeyValueModel> listSystem = new List<KeyValueModel>();//所属系统值列表
public DialogAutoArrangeLayoutViewModel()
@ -236,13 +235,13 @@ namespace SWS.Electrical.ViewModels
_ServiceEnginedata = GlobalObject.container.Resolve<EnginedataService>();
_ServiceObjectType = GlobalObject.container.Resolve<ObjectTypeService>();
_ServiceProjectSettings = GlobalObject.container.Resolve<ProjectSettingsService>();
_ServiceDataItem= GlobalObject.container.Resolve<DataItemService>();
_ServiceDataItem = GlobalObject.container.Resolve<DataItemService>();
listDrawings = new ObservableCollection<DtoDrawing>();
listBasePoint = new ObservableCollection<DtoAutoPlotLayout>();
listMsg = new ObservableCollection<TextBlock>();
var list = new ObservableCollection<KeyValueModel>();
list.Add(new KeyValueModel { Key = "甲板号", Value = "甲板号" });
list.Add(new KeyValueModel { Key = "区域", Value = "区域" });
//list.Add(new KeyValueModel { Key = "区域", Value = "区域" });
list.Add(new KeyValueModel { Key = "所属系统", Value = "所属系统" });
listRange = new ObservableCollection<KeyValueModel>(list);
listOperator = new ObservableCollection<KeyValueModel>()
@ -295,35 +294,37 @@ namespace SWS.Electrical.ViewModels
{
try
{
if (GlobalObj.treeDrawings.Any())
{
foreach (var model in GlobalObj.treeDrawings)
{
if (model.Text == "布置图")
{
foreach (var item in model.ChildNodes)
{
if (item.NodeType == "1")
{
listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
}
else
{
if (item.Text == "封面、目录、设计说明" || item.Text == "材料表")
{ continue; }
var list = GetChildNodes(item);
if (list.Any())
{
foreach (var dto in list)
{
listDrawings.Add(new DtoDrawing() { DrawingFileID = dto.ID, DrawingFileName = dto.Text });
}
}
}
}
}
}
}
//if (GlobalObj.treeDrawings.Any())
//{
// foreach (var model in GlobalObj.treeDrawings)
// {
// if (model.Text == "布置图")
// {
// foreach (var item in model.ChildNodes)
// {
// if (item.NodeType == "1")
// {
// listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
// }
// else
// {
// if (item.Text == "封面、目录、设计说明" || item.Text == "材料表")
// { continue; }
// var list = GetChildNodes(item);
// if (list.Any())
// {
// foreach (var dto in list)
// {
// listDrawings.Add(new DtoDrawing() { DrawingFileID = dto.ID, DrawingFileName = dto.Text });
// }
// }
// }
// }
// }
// }
//}
IsBusy = true;
BusyContent = "数据加载中...";
if (!listDrawings.Any())
{
AddMsg($"布置图列表加载中...");
@ -377,7 +378,7 @@ namespace SWS.Electrical.ViewModels
if (listDetail != null && listDetail.Any())
{
foreach (var item in listDetail)
{ listArea.Add(new KeyValueModel() { Key=item.DataItemName, Value=item.DataItemName }); }
{ listArea.Add(new KeyValueModel() { Key = item.DataItemName, Value = item.DataItemName }); }
}
//甲板号下拉框对应值列表
listDetail = await _ServiceDataItem.GetDetails("甲板号");
@ -394,9 +395,11 @@ namespace SWS.Electrical.ViewModels
{ listSystem.Add(new KeyValueModel() { Key = item.DataItemName, Value = item.DataItemName }); }
}
selectRange = listRange[0];
IsBusy = false;
}
catch (Exception ex)
{
IsBusy = false;
MessageBox.Show("DialogOpened异常" + ex.Message);
}
}
@ -409,8 +412,8 @@ namespace SWS.Electrical.ViewModels
inputValue = "";
if (model.Value == "甲板号")
{ listValue = new ObservableCollection<KeyValueModel>(listDeck); }
else if (model.Value == "区域")
{ listValue = new ObservableCollection<KeyValueModel>(listArea); }
//else if (model.Value == "区域")
//{ listValue = new ObservableCollection<KeyValueModel>(listArea); }
else if (model.Value == "所属系统")
{ listValue = new ObservableCollection<KeyValueModel>(listSystem); }
}
@ -420,9 +423,9 @@ namespace SWS.Electrical.ViewModels
/// <param name="o"></param>
public async void onGetBasePoint(object o)
{
if (isSearch)
if (isDrawing)
{
MessageBox.Show("正在查询基点元件信息中...");
MessageBox.Show("正在自动绘制元件中,请勿操作...");
return;
}
var listSelDwg = listDrawings.Where(a => a.IsSelected == true).ToList();
@ -435,7 +438,8 @@ namespace SWS.Electrical.ViewModels
try
{
isSearch = true;
IsBusy = true;
BusyContent = "数据加载中...";
AddMsg("开始查询布置图基点元件信息...");
List<DtoAutoPlotLayout> listDto = new List<DtoAutoPlotLayout>();
foreach (var dwg in listSelDwg)
@ -445,10 +449,14 @@ namespace SWS.Electrical.ViewModels
{ continue; }
foreach (var basePoint in list)
{
if (basePoint.area != null && basePoint.area.ToLower() == "err")
{ continue; }
if (basePoint.Tags.Any())
{
foreach (var tag in basePoint.Tags)
{
if (tag.area != null && tag.area.ToLower() == "err")
{ continue; }
listDto.Add(new DtoAutoPlotLayout()
{
IsSelected = true,
@ -477,13 +485,13 @@ namespace SWS.Electrical.ViewModels
}
listBasePoint = new ObservableCollection<DtoAutoPlotLayout>(listDto);
IsSelectAll = listBasePoint.Any() ? true : false;
isSearch = false;
AddMsg("布置图基点元件信息查询完成!");
IsBusy = false;
}
catch (Exception ex)
{
AddMsg("基点元件信息查询异常:" + ex.Message);
isSearch = false;
IsBusy = false;
}
}
public async void onStartDrawing(object o)
@ -506,8 +514,10 @@ namespace SWS.Electrical.ViewModels
{
isDrawing = true;
listMsg.Clear();
foreach (var basePoint in listDto)
for (int i = 0; i < listDto.Count; i++)
//foreach (var basePoint in listDto)
{
var basePoint = listDto[i];
if (basePoint.AutoDrawing == "已绘制")
{
AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{basePoint.TagNumber}]已绘制,跳至下一个元件");
@ -536,11 +546,6 @@ namespace SWS.Electrical.ViewModels
}
var tag = basePoint.Tag;
if (string.IsNullOrEmpty(tag.FileId))
{
AddMsg($"当前元件:{tag.TagNumber} 的元件ID为空不添加此元件跳至下一个", false);
continue;
}
var tagDto = listEntitys.FirstOrDefault(a => a.TagNumber == basePoint.TagNumber);
if (tagDto != null)
{
@ -549,26 +554,59 @@ namespace SWS.Electrical.ViewModels
basePoint.TagPixelOnDwg = tagDto.Handle;
continue;
}
var flag = basePoint.deck == tag.deck && basePoint.area == tag.area;
if (!flag)
{
AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{tag.TagNumber}] 的deck和area不一致不添加此元件跳至下一个元件", false);
continue;
}
//下载元件图纸文件
//var flag = basePoint.deck == tag.deck && basePoint.area == tag.area;
//if (!flag)
//{
// AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{tag.TagNumber}] 的deck和area不一致不添加此元件跳至下一个元件", false);
// continue;
//}
filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.TagNumber}.dwg");
var obj = await _ServiceLibraryFile.GetEntity(tag.FileId);
AddMsg($"元件图纸:{tag.TagNumber} 开始下载...");
msg = await _ServiceAnnexes.DownloadFile(filePath, obj.FolderId);
if (!string.IsNullOrEmpty(msg))
string blockName = string.Empty;
if (string.IsNullOrEmpty(tag.FileId))
{
AddMsg($"元件图纸下载失败,信息:" + msg, false);
continue;
//元件ID为空 用本地默认图块图纸
if (!string.IsNullOrEmpty(tag.TagNumber_Lower))
{
var blockDwgPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形两行图块.dwg");
if (!File.Exists(blockDwgPath))
{
AddMsg($"默认图块找不到:{blockDwgPath}", false);
continue;
}
//默认上下图块
blockName = "常规矩形两行图块";
File.Copy(blockDwgPath, filePath, true);
}
else
{
var blockDwgPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形单行图块.dwg");
if (!File.Exists(blockDwgPath))
{
AddMsg($"默认图块找不到:{blockDwgPath}", false);
continue;
}
//默认图块,只有中间部分
blockName = "常规矩形单行图块";
File.Copy(blockDwgPath, filePath, true);
}
}
else
{
//下载元件图纸文件
var obj = await _ServiceLibraryFile.GetEntity(tag.FileId);
blockName = obj.LibraryFileName;
AddMsg($"元件图纸:{tag.TagNumber} 开始下载...");
msg = await _ServiceAnnexes.DownloadFile(filePath, obj.FolderId);
if (!string.IsNullOrEmpty(msg))
{
AddMsg($"元件图纸下载失败,信息:" + msg, false);
continue;
}
AddMsg($"元件图纸:{tag.TagNumber} 下载成功");
}
AddMsg($"元件图纸:{tag.TagNumber} 下载成功");
//filePath = "D:\\BricsCAD\\Temp\\测试11.dwg";
//把元件的位号属性改成要绘制的位号值
flag = General.UpdateCableNo(filePath, listLibraryTagName, tag.TagNumber, tag.IsNotDefaultSymbol, tag.TagNumber_Lower, tag.TagNumber_Upper);
var flag = General.UpdateCableNo(filePath, listLibraryTagName, tag.TagNumber, tag.IsNotDefaultSymbol, tag.TagNumber_Upper, tag.TagNumber_Lower);
//X轴图上基点的坐标X +(接口数据元件的X + 接口数据元件的XOFF -接口数据基点的X-接口数据基点的Xoff*比例系数
//Y轴图上基点的坐标Y +(接口数据元件的Yoff-接口数据基点的Yoff*比例系数
@ -578,12 +616,20 @@ namespace SWS.Electrical.ViewModels
double z = entity.Z;
Point3d tagPoint = new Point3d(x, y, z);
AddMsg($"元件图纸:{tag.TagNumber} 开始添加进布置图中...");
msg = await AddBlock(basePoint, obj.LibraryFileName, filePath, tagPoint);
msg = await AddBlock(basePoint, blockName, filePath, tagPoint);
if (string.IsNullOrEmpty(msg))
{
AddMsg($"布置图:{basePoint.DrawingFileName},成功插入元件:" + tag.TagNumber);
basePoint.AutoDrawing = "已绘制";
General.SetDrawingReadOnly(dwgName, false);
//当下一个要画元件的图纸和当前图纸不一样时,保存图纸
if (i + 1 >= listDto.Count)
{ General.SetDrawingReadOnly(dwgName, false); }
else
{
var nextTag = listDto[i + 1];
if (basePoint.DrawingFileID != nextTag.DrawingFileID)
{ General.SetDrawingReadOnly(dwgName, false); }
}
}
else { AddMsg($"元件:{tag.TagNumber},绘制异常:{msg}"); }
@ -625,6 +671,10 @@ namespace SWS.Electrical.ViewModels
{
return dwgObj.DrawingFileName + ",图纸文件不存在,请先检出到本地!";
}
if (dwgObj.DrawingFileName == General.GetDwgName())
{
return res;
}
var listName = General.GetAllOpenDrawingNames();
if (!listName.Contains(fullpath))
{
@ -703,7 +753,7 @@ namespace SWS.Electrical.ViewModels
{
TagNumber = tagNumber,
DrawingFileID = dwgId,
LibraryFileID = dwgLibrary.LibraryFileID,
LibraryFileID = dwgLibrary == null ? "" : dwgLibrary.LibraryFileID,
PixelCode = handlid,
ObjectTypeID = objTypeId,
ObjectTypeName = objTypeName,

View File

@ -0,0 +1,618 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Bricscad.EditorInput;
using ImTools;
using Newtonsoft.Json;
using Prism.Services.Dialogs;
using SWS.CAD.Base;
using SWS.Commons;
using SWS.Electrical.Models;
using SWS.Model;
using SWS.Service;
using SWS.Share;
using SWS.WPF.ViewModels;
using Teigha.DatabaseServices;
using Teigha.Geometry;
using Teigha.GraphicsSystem;
using Telerik.Windows.Controls;
using Unity;
using Visibility = System.Windows.Visibility;
namespace SWS.Electrical.ViewModels
{
public class DialogGenerateBOMViewModel : DialogBase, IDialogAware
{
private ObservableCollection<TreeModel> _listDrawings = new ObservableCollection<TreeModel>();
/// <summary>
/// 图纸树
/// </summary>
public ObservableCollection<TreeModel> listDrawings
{
get { return this._listDrawings; }
set
{
if (value != this._listDrawings)
{
this._listDrawings = value;
RaisePropertyChanged(nameof(listDrawings));
}
}
}
private ObservableCollection<DtoBomDrawings> _listBomDrawings = new ObservableCollection<DtoBomDrawings>();
/// <summary>
/// 材料表列表
/// </summary>
public ObservableCollection<DtoBomDrawings> listBomDrawings
{
get { return this._listBomDrawings; }
set
{
if (value != this._listBomDrawings)
{
this._listBomDrawings = value;
RaisePropertyChanged(nameof(listBomDrawings));
}
}
}
private ObservableCollection<TextBlock> _listMsg = new ObservableCollection<TextBlock>();
/// <summary>
/// 信息列表
/// </summary>
public ObservableCollection<TextBlock> listMsg
{
get { return this._listMsg; }
set
{
if (value != this._listMsg)
{
this._listMsg = value;
RaisePropertyChanged(nameof(listMsg));
}
}
}
/// <summary>
/// 命令事件 生成材料表
/// </summary>
public ICommand Command_StartGenerate { get; set; }
/// <summary>
/// 命令事件 选择节点
/// </summary>
public ICommand Command_ChangeCheck { get; set; }
DrawingServce _ServiceDrawing;
AnnexesService _ServiceAnnexes;
DrawingCatalogueService _ServiceDrawingCatalogue;
PlotBOMService _ServicePlotBOM;
private bool isGenerate = false;//是否正在生成材料表
private string dwgName = string.Empty;
public DialogGenerateBOMViewModel()
{
Command_StartGenerate = new DelegateCommand(onStartGenerate);
Command_ChangeCheck = new DelegateCommand(onChangeCheck);
title = "材料表自动生成";
_ServiceDrawing = GlobalObject.container.Resolve<DrawingServce>();
_ServiceAnnexes = GlobalObject.container.Resolve<AnnexesService>();
_ServicePlotBOM = GlobalObject.container.Resolve<PlotBOMService>();
_ServiceDrawingCatalogue = GlobalObject.container.Resolve<DrawingCatalogueService>();
}
public string Title => "";
public event Action<IDialogResult> RequestClose;
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
#region
/// <summary>
/// 改变子节点选中状态
/// </summary>
private void ChangeChild(TreeModel model, bool isChecked)
{
if (model.ChildNodes != null && model.ChildNodes.Any())
{
foreach (var item in model.ChildNodes)
{
item.IsChecked = isChecked;
ChangeChild(item, isChecked);
}
}
}
/// <summary>
/// 改变父节点选中状态
/// </summary>
private void ChangeParent(TreeModel model, bool isChecked)
{
if (!string.IsNullOrEmpty(model.parentId) && model.parentId != "0")
{
var parentNode = TreeHelper.GetTreeModel(listDrawings.ToList(), model.parentId);
if (parentNode != null)
{
if (isChecked)
{
bool flag = true;
foreach (var child in parentNode.ChildNodes)
{
if (child.IsChecked != true)
{
flag = false;
break;
}
}
parentNode.IsChecked = flag;
ChangeParent(parentNode, flag);
}
else
{
parentNode.IsChecked = isChecked;
ChangeParent(parentNode, isChecked);
}
}
}
}
/// <summary>
/// 节点选中状态改变
/// </summary>
/// <param name="id"></param>
/// <param name="isChecked"></param>
public void ChangeChecked(string id, bool isChecked)
{
var node = TreeHelper.GetTreeModel(listDrawings.ToList(), id);
if (node == null)
{ return; }
if (isChecked) // 如果节点被选中
{
if (node.ChildNodes != null)
{
foreach (var item in node.ChildNodes)
{
ChangeChild(item, isChecked);
item.IsChecked = true;
}
}
if (!string.IsNullOrEmpty(node.parentId) && node.parentId != "0")
{
ChangeParent(node, isChecked);
}
}
else if (isChecked == false) // 如果节点未选中
{
if (node.ChildNodes != null)
{
foreach (var item in node.ChildNodes)
{
item.IsChecked = false;
ChangeChild(item, isChecked);
}
}
if (!string.IsNullOrEmpty(node.parentId) && node.parentId != "0")
{
ChangeParent(node, isChecked);
}
}
}
/// <summary>
/// 过滤文件夹:[材料表][封面、目录、设计说明]
/// </summary>
/// <param name="treeModel"></param>
private void FilterNodes(TreeModel treeModel)
{
if (treeModel.ChildNodes != null && treeModel.ChildNodes.Any())
{
List<TreeModel> nodes = new List<TreeModel>();
foreach (var item in treeModel.ChildNodes)
{
if (item.NodeType == "0" && (item.ChildNodes == null || !item.ChildNodes.Any()))
{ nodes.Add(item); }//过滤无图纸文件的文件
if (item.Text.Equals("材料表") || item.Text.Equals("封面、目录、设计说明"))
{
nodes.Add(item);
}
else
{
FilterNodes(item);
}
}
foreach (var item in nodes)
{
treeModel.ChildNodes.Remove(item);
}
return;
}
else
{
return;
}
}
/// <summary>
/// 获取子节点的图纸数量
/// </summary>
/// <param name="treeModel"></param>
/// <returns></returns>
private int GetChildCount(TreeModel treeModel)
{
int count = 0;
List<TreeModel> listModel = new List<TreeModel>();
if (treeModel.ChildNodes != null && treeModel.ChildNodes.Any())
{
foreach (var item in treeModel.ChildNodes)
{
if (item.Text.ToLower().EndsWith(".dwg"))
{
count++;
}
else
{
var sum = GetChildCount(item);
count += sum;
}
}
return count;
}
else
{
return count;
}
}
/// <summary>
/// 获取选中的图纸列表
/// </summary>
/// <returns></returns>
private List<TreeModel> GetDwgIsChecked(List<TreeModel> listTree)
{
List<TreeModel> listModel = new List<TreeModel>();
foreach (var item in listTree)
{
if (item.Text.ToLower().EndsWith(".dwg") && item.IsChecked)
{
listModel.Add(item);
continue;
}
if (item.ChildNodes != null && item.ChildNodes.Any())
{
var list = GetDwgIsChecked(item.ChildNodes.ToList());
if (list.Any())
{ listModel.AddRange(list); }
}
}
return listModel;
}
#endregion
public async void OnDialogOpened(IDialogParameters parameters)
{
try
{
IsBusy = true;
BusyContent = "数据加载中...";
AddMsg($"图纸数据加载中...");
List<TreeModel> listDwg = new List<TreeModel>();
var list = await _ServiceDrawing.GetDrawingCatalogue();
GlobalObject.AllDrawings = list.ToList();
foreach (var item in list)
{
if (GetChildCount(item) > 0)
{
//把文件夹的放在图纸前面
var childs = item.ChildNodes.OrderBy(a => a.NodeType).ToList();
item.ChildNodes = new ObservableCollection<TreeModel>(childs);
//过滤材料表文件夹,过滤:封面、目录、设计说明
FilterNodes(item);
listDwg.Add(item);
}
}
listDrawings = new ObservableCollection<TreeModel>(listDwg);
AddMsg($"图纸数据加载完成");
}
catch (Exception ex)
{
MessageBox.Show("DialogOpened异常" + ex.Message);
}
finally
{
IsBusy = false;
}
}
/// <summary>
///改变节点选中状态
/// </summary>
/// <param name="o"></param>
public void onChangeCheck(object o)
{
var checkbox = o as System.Windows.Controls.CheckBox;
var id = checkbox.Tag.ToString();
var isChecked = checkbox.IsChecked.Value;
var node = TreeHelper.GetTreeModel(listDrawings.ToList(), id);
if (node == null)
{ return; }
if (isChecked) // 如果节点被选中
{
if (node.ChildNodes != null)
{
foreach (var item in node.ChildNodes)
{
ChangeChild(item, isChecked);
item.IsChecked = true;
}
}
if (!string.IsNullOrEmpty(node.parentId) && node.parentId != "0")
{
ChangeParent(node, isChecked);
}
}
else if (isChecked == false) // 如果节点未选中
{
if (node.ChildNodes != null)
{
foreach (var item in node.ChildNodes)
{
item.IsChecked = false;
ChangeChild(item, isChecked);
}
}
if (!string.IsNullOrEmpty(node.parentId) && node.parentId != "0")
{
ChangeParent(node, isChecked);
}
}
}
/// <summary>
/// 自动生成材料表
/// </summary>
/// <param name="o"></param>
public async void onStartGenerate(object o)
{
if (isGenerate)
{
MessageBox.Show("正在生成材料表,请勿操作...");
return;
}
var msg = string.Empty;
try
{
//AddText();
//return;
var list = GetDwgIsChecked(listDrawings.ToList());
List<DtoBomDrawings> listBom = new List<DtoBomDrawings>();
foreach (var item in list)
{
listBom.Add(new DtoBomDrawings()
{
DrawingFileID = item.ID,
DrawingFileName = item.Text,
AutoGenerate = "等待中..."
});
}
listBomDrawings = new ObservableCollection<DtoBomDrawings>(listBom);
isGenerate = true;
listMsg.Clear();
foreach (var dwg in listBomDrawings)
{
if (dwg.AutoGenerate == "已生成")
{
AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已绘制,跳至下一个图纸");
continue;
}
if (dwg.AutoGenerate == "已存在")
{
AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸");
//continue;
}
if (dwg.AutoGenerate == "无材料信息")
{
AddMsg($"当前图纸[{dwg.DrawingFileName}]无材料信息,跳至下一个图纸");
continue;
}
string folderpath = GlobalObject.GetDwgPath(dwg.DrawingFileID);
string filepath = Path.Combine(GlobalObj.LocalWorkDir, GlobalObject.curProject.ProjectName, folderpath, $"材料表\\{dwg.DrawingFileName}");
if (File.Exists(filepath))
{
AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸", false);
dwg.AutoGenerate = "已存在";
//continue;
}
var listBomGroup = await _ServicePlotBOM.GetBOMGroupInfo(dwg.DrawingFileID);
dwg.AutoGenerate = "正在生成...";
AddMsg($"开始生成图纸[{dwg.DrawingFileName}]的材料表...");
if (listBomGroup == null || !listBomGroup.Any())
{
AddMsg($"当前图纸无材料分组信息,跳至下一个图纸");
dwg.AutoGenerate = "无材料信息";
continue;
}
msg = GenerateBOM(dwg, filepath, listBomGroup);
if (!string.IsNullOrEmpty(msg))
{
AddMsg($"材料表生成失败,信息:" + msg, false);
continue;
}
//下载图标图纸文件
//filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.TagNumber}.dwg");
//AddMsg($"元件图纸:{tag.TagNumber} 开始下载...");
//msg = await _ServiceAnnexes.DownloadFile(filePath, obj.FolderId);
//if (!string.IsNullOrEmpty(msg))
//{
// AddMsg($"元件图纸下载失败,信息:" + msg, false);
// continue;
//}
//AddMsg($"元件图纸:{tag.TagNumber} 下载成功");
//filePath = "D:\\BricsCAD\\Temp\\测试11.dwg";
dwg.AutoGenerate = "已生成";
AddMsg($"材料表生成成功!");
}
AddMsg("操作已完成!");
isGenerate = false;
}
catch (Exception ex)
{
MessageBox.Show("异常:" + ex.Message);
isGenerate = false;
}
}
/// <summary>
/// 生成BOM表图纸
/// </summary>
/// <param name="filepath">材料表文件路径</param>
/// <param name="listBomGroup">位号分组信息</param>
/// <returns></returns>
private string GenerateBOM(DtoBomDrawings dtoBOM, string filepath, List<BOMGroupInfo> listBomGroup)
{
string msg = string.Empty;
//1.创建材料表图纸文件
string folderpath = Path.GetDirectoryName(filepath);
string bomName = Path.Combine(folderpath, "BomTemp.dwg");
string dwgName = dtoBOM.DrawingFileName.Substring(0, dtoBOM.DrawingFileName.Length - 4);
var flag = General.CreateDwg(folderpath, dwgName);
if (!flag)
{
msg = $"材料表图纸创建失败,路径:{filepath}";
return msg;
}
//2.读取BOM表配置文件
string strJson = File.ReadAllText("Template\\BomConfig.json");
BomConfig bomComfig = JsonConvert.DeserializeObject<BomConfig>(strJson);
//3.判断位号分组信息需要分成几张材料表,分页生成材料表
List<DtoCadTextInfo> listTextInfo = new List<DtoCadTextInfo>();
decimal mod = (decimal)listBomGroup.Count / (decimal)bomComfig.RowCount;
var page = Math.Ceiling(mod);//总的A4表格页数 小数点向上取整数
for (int i = 0; i < page; i++)
{
listTextInfo = new List<DtoCadTextInfo>();
int count = (i + 1) == page ? (listBomGroup.Count % bomComfig.RowCount) : bomComfig.RowCount;
for (int j = 0; j < count; j++)
{
var index = i * bomComfig.RowCount + j;
var bomInfo = listBomGroup[index];
#region
var dto = new DtoCadTextInfo();
dto.Text = (j + 1).ToString();
dto.Position = new Point3d(bomComfig.Column1X, bomComfig.Column1Y - (j * bomComfig.RowHeight), 0);
dto.IsMText = false;
dto.Height = 4;
dto.Width = 20;
dto.Align = 1;
listTextInfo.Add(dto);
#endregion
#region
#endregion
#region
dto = new DtoCadTextInfo();
dto.Text = (bomInfo.Count).ToString();
dto.Position = new Point3d(bomComfig.Column3X, bomComfig.Column3Y - (j * bomComfig.RowHeight), 0);
dto.IsMText = false;
dto.Height = 4;
dto.Width = 20;
dto.Align = 1;
listTextInfo.Add(dto);
#endregion
#region
dto = new DtoCadTextInfo();
dto.Text = (bomInfo.Model).ToString();
dto.Position = new Point3d(bomComfig.Column4X, bomComfig.Column4Y - (j * bomComfig.RowHeight), 0);
dto.IsMText = false;
dto.Height = 4;
dto.Width = 20;
dto.Align = 1;
listTextInfo.Add(dto);
#endregion
#region
dto = new DtoCadTextInfo();
dto.Text = (bomInfo.Spec).ToString();
dto.Position = new Point3d(bomComfig.Column5X, bomComfig.Column5Y - (j * bomComfig.RowHeight), 0);
dto.IsMText = false;
dto.Height = 4;
dto.Width = 20;
dto.Align = 1;
listTextInfo.Add(dto);
#endregion
#region
dto = new DtoCadTextInfo();
dto.Text = (bomInfo.Remark).ToString();
dto.Position = new Point3d(bomComfig.Column6X, bomComfig.Column6Y - (j * bomComfig.RowHeight), 0);
dto.IsMText = false;
dto.Height = 4;
dto.Width = 20;
dto.Align = 1;
listTextInfo.Add(dto);
#endregion
}
#region
File.Copy("Template\\材料表.dwg", bomName, true);
General.OpenDwg(bomName);
General.InsertTextInfo(listTextInfo);
General.SaveAndCloseDwg(bomName);
General.OpenDwg(filepath);
//计算该页材料表是第几行第几列的
double x, y = 0;//坐标xy
decimal row = (decimal)i / (decimal)bomComfig.RowPageCount;//row表示行数在第几行
row = Math.Floor(row);
var column = i % bomComfig.RowPageCount;//column表示列数在第几列
x = column == 0 ? 0 : (double)column * bomComfig.Width;
y = row == 0 ? 0 : 0 - (double)row * bomComfig.Height;
var position = new Point3d(x, y, 0);
General.AddBlockDWG(bomName, $"材料表{i + 1}", position);
General.SaveAndCloseDwg(filepath);
#endregion
}
File.Delete(bomName);
General.OpenDwg(filepath);
return msg;
}
#region
/// <summary>
/// 添加提示信息
/// </summary>
/// <param name="msg">信息</param>
/// <param name="isSucc">是否成功</param>
private void AddMsg(string msg, bool isSucc = true)
{
try
{
TextBlock tb = new TextBlock();
tb.Text = DateTime.Now.ToString("HH:mm:ss") + "==>> " + msg;
tb.Foreground = isSucc ? Brushes.LightSeaGreen : Brushes.Red;
listMsg.Add(tb);
}
catch (Exception ex)
{
MessageBox.Show("添加提示信息异常:" + ex.Message);
}
}
#endregion
}
}

View File

@ -10,8 +10,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Width="750"
Height="590"
Width="900"
Height="700"
mc:Ignorable="d">
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
@ -26,6 +26,9 @@
</prism:Dialog.WindowStyle>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SWS.Electrical;component/Style/CustomStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="DataGrid">
<Setter Property="RowHeaderWidth" Value="0" />
<Setter Property="AutoGenerateColumns" Value="False" />
@ -102,136 +105,146 @@
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="350" />
<RowDefinition Height="220" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<CustomControl:customWindowTitleBar
x:Name="titleBar"
Grid.Row="0"
Grid.ColumnSpan="2" />
<DataGrid
Grid.Row="1"
Grid.Column="0"
MaxHeight="350"
AutoGenerateColumns="False"
CanUserAddRows="False"
HeadersVisibility="Column"
ItemsSource="{Binding listDrawings, Mode=TwoWay}"
RowHeight="22"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridCheckBoxColumn
Width="30"
Binding="{Binding IsSelected}"
Header=""
IsReadOnly="False" />
<DataGridTextColumn
Width="*"
Binding="{Binding DrawingFileName}"
Header="布置图"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1" Grid.Column="1">
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="250" />
</Grid.RowDefinitions>
<StackPanel
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<CustomControl:customWindowTitleBar
x:Name="titleBar"
Grid.Row="0"
Height="30"
Margin="30,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Width="auto"
Grid.ColumnSpan="2" />
<DataGrid
Grid.Row="1"
Grid.Column="0"
Height="auto"
AutoGenerateColumns="False"
CanUserAddRows="False"
HeadersVisibility="Column"
ItemsSource="{Binding listDrawings, Mode=TwoWay}"
RowHeight="22"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridCheckBoxColumn
Width="30"
Binding="{Binding IsSelected}"
Header=""
IsReadOnly="False" />
<DataGridTextColumn
Width="*"
Binding="{Binding DrawingFileName}"
Header="布置图"
IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
Height="30"
Margin="30,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Text="范围:" />
<ComboBox
Grid.Column="1"
Width="100"
Height="25"
DisplayMemberPath="Key"
FontSize="16"
ItemsSource="{Binding listRange}"
SelectedItem="{Binding selectRange, Mode=TwoWay}" />
<ComboBox
Grid.Column="1"
Width="60"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
ItemsSource="{Binding listOperator}"
SelectedItem="{Binding selectOperator, Mode=TwoWay}" />
<ComboBox
Grid.Column="1"
Width="200"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
IsEditable="True"
ItemsSource="{Binding listValue}"
Text="{Binding inputValue, Mode=TwoWay}" />
<!--<TextBox
Orientation="Horizontal">
<TextBlock
Width="auto"
VerticalAlignment="Center"
FontSize="16"
Text="范围:" />
<ComboBox
Grid.Column="1"
Width="120"
Height="25"
DisplayMemberPath="Key"
FontSize="16"
ItemsSource="{Binding listRange}"
SelectedItem="{Binding selectRange, Mode=TwoWay}" />
<ComboBox
Grid.Column="1"
Width="70"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
ItemsSource="{Binding listOperator}"
SelectedItem="{Binding selectOperator, Mode=TwoWay}" />
<CustomControl:MultiSelectComboBox
Grid.Column="1"
Width="250"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
ItemsSource="{Binding listValue}"
Text="{Binding inputValue, Mode=TwoWay}" />
<!--<ComboBox
Grid.Column="1"
Width="200"
Height="25"
Margin="5,0,0,0"
DisplayMemberPath="Key"
FontSize="16"
IsEditable="True"
ItemsSource="{Binding listValue}"
Text="{Binding inputValue, Mode=TwoWay}" />-->
<!--<TextBox
Width="200"
Height="25"
Margin="5,0,0,0"
FontSize="16"
Text="{Binding inputValue}" />-->
</StackPanel>
</StackPanel>
<StackPanel
Grid.Row="1"
Height="30"
Margin="30,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="140"
Margin="60,0,0,0"
Command="{Binding Command_GetBasePoint}"
Content="获取元件信息"
FontSize="16" />
<Button
Width="140"
Margin="10,0,0,0"
Command="{Binding Command_StartDrawing}"
Content="开始自动绘图"
FontSize="16" />
</StackPanel>
<DataGrid
x:Name="dgTag"
Grid.Row="2"
Grid.Column="0"
MaxHeight="250"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserResizeColumns="True"
HeadersVisibility="Column"
ItemsSource="{Binding listBasePoint, Mode=TwoWay}"
RowHeight="22"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
SelectionMode="Single">
<DataGrid.Columns>
<!--<DataGridCheckBoxColumn Binding="{Binding IsSelected, Mode=TwoWay}">
<StackPanel
Grid.Row="1"
Height="30"
Margin="30,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="160"
Margin="100,0,0,0"
Command="{Binding Command_GetBasePoint}"
Content="获取元件信息"
FontSize="16" />
<Button
Width="160"
Margin="20,0,0,0"
Command="{Binding Command_StartDrawing}"
Content="开始自动绘图"
FontSize="16" />
</StackPanel>
<DataGrid
x:Name="dgTag"
Grid.Row="2"
Grid.Column="0"
Height="auto"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserResizeColumns="True"
HeadersVisibility="Column"
ItemsSource="{Binding listBasePoint, Mode=TwoWay}"
LoadingRow="dgTag_LoadingRow"
RowHeight="22"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedItem="{Binding SelectedTag, Mode=TwoWay}"
SelectionMode="Single">
<DataGrid.Columns>
<!--<DataGridCheckBoxColumn Binding="{Binding IsSelected, Mode=TwoWay}">
<DataGridCheckBoxColumn.HeaderTemplate>
<DataTemplate>
<CheckBox
@ -242,89 +255,97 @@
</DataTemplate>
</DataGridCheckBoxColumn.HeaderTemplate>
</DataGridCheckBoxColumn>-->
<DataGridTemplateColumn Width="30">
<DataGridTemplateColumn.Header>
<CheckBox IsChecked="{Binding DataContext.IsSelectAll, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedAll, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<DataGridTemplateColumn Width="30">
<DataGridTemplateColumn.Header>
<CheckBox IsChecked="{Binding DataContext.IsSelectAll, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedTag, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" CommandParameter="{Binding TagNumber}" />
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedAll, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridCheckBoxColumn
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DataContext.Command_SelectedTag, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" CommandParameter="{Binding TagNumber}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="30" Header="序号">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Center" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGridRow}, Path=Header}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<!--<DataGridCheckBoxColumn
Width="30"
Binding="{Binding isChecked}"
Header=""
IsReadOnly="False" />-->
<DataGridTextColumn
Width="*"
Binding="{Binding DrawingFileName}"
Header="布置图"
IsReadOnly="True" />
<DataGridTextColumn
Width="*"
Binding="{Binding BasePointTagNumber}"
Header="基点"
IsReadOnly="True" />
<DataGridTextColumn
Width="110"
Binding="{Binding TagNumber}"
Header="元件位号"
IsReadOnly="True" />
<DataGridTextColumn
Width="60"
Binding="{Binding AutoDrawing}"
Header="绘制"
IsReadOnly="True" />
<DataGridTextColumn
Width="50"
Binding="{Binding TagPixelOnDwg}"
Header="句柄"
IsReadOnly="True" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding AutoDrawing}" Value="已绘制">
<Setter Property="Background" Value="LightGreen" />
</DataTrigger>
<DataTrigger Binding="{Binding AutoDrawing}" Value="已存在">
<Setter Property="Background" Value="LightYellow" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<DataGridTextColumn
Width="0.65*"
Binding="{Binding DrawingFileName}"
Header="布置图"
IsReadOnly="True" />
<DataGridTextColumn
Width="0.35*"
Binding="{Binding BasePointTagNumber}"
Header="基点"
IsReadOnly="True" />
<DataGridTextColumn
Width="110"
Binding="{Binding TagNumber}"
Header="元件位号"
IsReadOnly="True" />
<DataGridTextColumn
Width="60"
Binding="{Binding AutoDrawing}"
Header="绘制"
IsReadOnly="True" />
<DataGridTextColumn
Width="70"
Binding="{Binding TagPixelOnDwg}"
Header="句柄"
IsReadOnly="True" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding AutoDrawing}" Value="已绘制">
<Setter Property="Background" Value="LightGreen" />
</DataTrigger>
<DataTrigger Binding="{Binding AutoDrawing}" Value="已存在">
<Setter Property="Background" Value="LightYellow" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
</Grid>
<Grid
Grid.Row="2"
Grid.ColumnSpan="2"
Background="Black">
<ListBox
Background="Black"
ItemsSource="{Binding listMsg}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<i:Interaction.Behaviors>
<local:ListBoxScrollToBottomBehavior />
</i:Interaction.Behaviors>
</ListBox>
</Grid>
</Grid>
<Grid
Grid.Row="2"
Grid.ColumnSpan="2"
Background="Black">
<ListBox
Background="Black"
ItemsSource="{Binding listMsg}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<i:Interaction.Behaviors>
<local:ListBoxScrollToBottomBehavior />
</i:Interaction.Behaviors>
</ListBox>
</Grid>
</Grid>
</telerik:RadBusyIndicator>
</UserControl>

View File

@ -24,5 +24,10 @@ namespace SWS.Electrical.Views
{
InitializeComponent();
}
private void dgTag_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
}
}

View File

@ -0,0 +1,241 @@
<UserControl
x:Class="SWS.Electrical.Views.DialogGenerateBOM"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Custom="http://www.galasoft.ch/mvvmlight"
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SWS.Electrical"
xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Width="900"
Height="700"
Background="#2D3135"
mc:Ignorable="d">
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
<Setter Property="Width" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}" />
<Setter Property="Height" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}" />
<Setter Property="WindowState" Value="Normal" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="ResizeMode" Value="NoResize" />
</Style>
</prism:Dialog.WindowStyle>
<UserControl.Resources>
<ResourceDictionary>
<Style TargetType="DataGrid">
<Setter Property="RowHeaderWidth" Value="0" />
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="CanUserAddRows" Value="False" />
<Setter Property="CanUserResizeColumns" Value="False" />
<Setter Property="CanUserResizeRows" Value="False" />
<Setter Property="HorizontalGridLinesBrush" Value="LightGray" />
<Setter Property="VerticalGridLinesBrush" Value="LightGray" />
<Setter Property="IsReadOnly" Value="False" />
<Setter Property="BorderThickness" Value="1,0" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="RowHeight" Value="30" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
</Style>
<!-- DataGrid表头样式 -->
<Style TargetType="DataGridColumnHeader">
<Setter Property="FontSize" Value="13" />
<Setter Property="Background" Value="White" />
<Setter Property="BorderThickness" Value="1,1,1,1" />
<Setter Property="BorderBrush" Value="LightGray" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
<!-- DataGrid复选框样式 -->
<Style x:Key="VerticalCheckBox" TargetType="CheckBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<StackPanel Name="sp" HorizontalAlignment="Center">
<ContentPresenter Margin="2" HorizontalAlignment="Center" />
<Border
x:Name="bd"
Width="20"
Height="20"
BorderBrush="Gray"
BorderThickness="1.5">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.05" Color="LightGray" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</Border.Background>
<Path
Name="checkPath"
Width="18"
Height="16"
Stroke="Black"
StrokeThickness="2" />
</Border>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="checkPath" Property="Data" Value="M 1.5,5 L 7,13 17,0" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="LightGray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- DataGrid单元格选中样式 #6495ED -->
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="#6495ED" />
<Setter Property="BorderThickness" Value="0" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
<Grid>
<Grid.Resources>
<HierarchicalDataTemplate
x:Key="MyTreeItemTemplate"
DataType="{x:Type local2:TreeModel}"
ItemsSource="{Binding ChildNodes}">
<StackPanel
x:Name="My_SP"
Margin="2"
Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsChecked}" />
<ContentPresenter Margin="2,0" Content="{Binding Text}" />
</StackPanel>
</HierarchicalDataTemplate>
<Style x:Key="TreeViewItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="False" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="70" />
<RowDefinition Height="300" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*" />
<ColumnDefinition Width="0.6*" />
</Grid.ColumnDefinitions>
<CustomControl:customWindowTitleBar
x:Name="titleBar"
Grid.Row="0"
Grid.ColumnSpan="2" />
<TreeView
x:Name="dwgTree"
Grid.Row="1"
Grid.RowSpan="3"
Grid.Column="0"
Height="auto"
FontSize="14"
ItemContainerStyle="{StaticResource TreeViewItemStyle}"
ItemsSource="{Binding listDrawings, Mode=TwoWay}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
<StackPanel Orientation="Horizontal">
<CheckBox
HorizontalAlignment="Center"
Focusable="False"
IsChecked="{Binding Path=IsChecked}"
IsTabStop="False"
Tag="{Binding Path=ID}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DataContext.Command_ChangeCheck, RelativeSource={RelativeSource AncestorType=UserControl, AncestorLevel=1}}" CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=CheckBox}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</CheckBox>
<TextBlock HorizontalAlignment="Center" Text="{Binding Path=Text}" />
</StackPanel>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<StackPanel
Grid.Row="1"
Grid.Column="1"
Height="30"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
Width="140"
Margin="60,0,0,0"
HorizontalAlignment="Center"
Command="{Binding Command_StartGenerate}"
Content="生成材料表"
FontSize="16" />
</StackPanel>
<DataGrid
x:Name="dgTag"
Grid.Row="2"
Grid.Column="1"
Height="auto"
AutoGenerateColumns="False"
CanUserAddRows="False"
CanUserResizeColumns="True"
HeadersVisibility="Column"
ItemsSource="{Binding listBomDrawings, Mode=TwoWay}"
RowHeight="22"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn
Width="0.65*"
Binding="{Binding DrawingFileName}"
Header="图纸"
IsReadOnly="True" />
<DataGridTextColumn
Width="0.35*"
Binding="{Binding AutoGenerate}"
Header="生成材料表"
IsReadOnly="True" />
</DataGrid.Columns>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="Background" Value="White" />
<Style.Triggers>
<DataTrigger Binding="{Binding AutoGenerate}" Value="已生成">
<Setter Property="Background" Value="LightGreen" />
</DataTrigger>
<DataTrigger Binding="{Binding AutoGenerate}" Value="已存在">
<Setter Property="Background" Value="LightYellow" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>
</DataGrid>
<ListBox
Grid.Row="3"
Grid.Column="1"
Background="Black"
ItemsSource="{Binding listMsg}"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<i:Interaction.Behaviors>
<local:ListBoxScrollToBottomBehavior />
</i:Interaction.Behaviors>
</ListBox>
</Grid>
</telerik:RadBusyIndicator>
</UserControl>

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SWS.Electrical.ViewModels;
using SWS.Model;
namespace SWS.Electrical.Views
{
/// <summary>
/// DialogInput.xaml 的交互逻辑
/// </summary>
public partial class DialogGenerateBOM : UserControl
{
public DialogGenerateBOM()
{
InitializeComponent();
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
var check = sender as CheckBox;
var context = this.DataContext as DialogGenerateBOMViewModel;
context.ChangeChecked(check.Tag.ToString(),check.IsChecked.Value);
}
}
}

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "55992553F782D436B236E9D0626B49AE48376927B5906F253898CDC4189B1D22"
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D0C5F0216DF6BCDDDA98AFD5EEED25E2B5C8BB0236746F3B9CC6B583DD7624FD"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -77,7 +77,7 @@ namespace SWS.Electrical.Views {
public partial class DialogAutoArrangeLayout : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 119 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
#line 122 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.customWindowTitleBar titleBar;
@ -85,7 +85,7 @@ namespace SWS.Electrical.Views {
#line hidden
#line 220 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
#line 232 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag;
@ -127,6 +127,12 @@ namespace SWS.Electrical.Views {
return;
case 2:
this.dgTag = ((System.Windows.Controls.DataGrid)(target));
#line 241 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
this.dgTag.LoadingRow += new System.EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.dgTag_LoadingRow);
#line default
#line hidden
return;
}
this._contentLoaded = true;

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "55992553F782D436B236E9D0626B49AE48376927B5906F253898CDC4189B1D22"
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D0C5F0216DF6BCDDDA98AFD5EEED25E2B5C8BB0236746F3B9CC6B583DD7624FD"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -77,7 +77,7 @@ namespace SWS.Electrical.Views {
public partial class DialogAutoArrangeLayout : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 119 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
#line 122 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.customWindowTitleBar titleBar;
@ -85,7 +85,7 @@ namespace SWS.Electrical.Views {
#line hidden
#line 220 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
#line 232 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag;
@ -127,6 +127,12 @@ namespace SWS.Electrical.Views {
return;
case 2:
this.dgTag = ((System.Windows.Controls.DataGrid)(target));
#line 241 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
this.dgTag.LoadingRow += new System.EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.dgTag_LoadingRow);
#line default
#line hidden
return;
}
this._contentLoaded = true;

View File

@ -28,7 +28,7 @@ namespace SWS.Model
/// system
/// </summary>
public string TagNumber_Lower { get; set; } = "";
/// <summary>
/// 图元文件Id
/// </summary>
@ -48,23 +48,33 @@ namespace SWS.Model
/// <summary>
/// 肋位号 和 偏移量
/// </summary>
public double X { get; set; }
public string XOff { get; set; }
public double X { get; set; }
private string _XOff;
public string XOff
{
get { return string.IsNullOrEmpty(_XOff) ? "0" : _XOff; }
set { _XOff = value; }
}
/// <summary>
/// 纵骨号 偏移量
/// </summary>
public string YOff { get; set; }
private string _YOff;
public string YOff
{
get { return string.IsNullOrEmpty(_YOff) ? "0" : _YOff; }
set { _YOff = value; }
}
public string deck { get; set; }
public string deck { get; set; }
public string area { get; set; }
/// <summary>
/// 基点从属的、或者说附近的设备位号
/// </summary>
public List<LayoutTagInfoBrief> Tags { get; set; } = new List<LayoutTagInfoBrief>();
#endregion
}
}

View File

@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Model
{
/// <summary>
/// 材料表配置
/// 用于生成图纸的材料表
/// </summary>
public class BomConfig
{
/// <summary>
/// 材料表宽度
/// </summary>
public int Width { get; set; }
/// <summary>
/// 材料表高度
/// </summary>
public int Height { get; set; }
/// <summary>
/// 材料表一行有几页A4表格
/// </summary>
public int RowPageCount { get; set; }
/// <summary>
/// 行数量
/// </summary>
public int RowCount { get; set; }
/// <summary>
/// 行高度
/// </summary>
public int RowHeight { get; set; }
/// <summary>
/// 第1行第1列的X坐标
/// </summary>
public int Column1X { get; set; }
/// <summary>
/// 第1行第1列的Y坐标
/// </summary>
public int Column1Y { get; set; }
/// <summary>
/// 第1行第1列的宽度
/// </summary>
public int Column1Width { get; set; }
/// <summary>
/// 第1行第1列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column1Align { get; set; }
/// <summary>
/// 第1行第2列的X坐标
/// </summary>
public int Column2X { get; set; }
/// <summary>
/// 第1行第2列的Y坐标
/// </summary>
public int Column2Y { get; set; }
/// <summary>
/// 第1行第2列的宽度
/// </summary>
public int Column2Width { get; set; }
/// <summary>
/// 第1行第2列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column2Align { get; set; }
/// <summary>
/// 第1行第3列的X坐标
/// </summary>
public int Column3X { get; set; }
/// <summary>
/// 第1行第3列的Y坐标
/// </summary>
public int Column3Y { get; set; }
/// <summary>
/// 第1行第3列的宽度
/// </summary>
public int Column3Width { get; set; }
/// <summary>
/// 第1行第3列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column3Align { get; set; }
/// <summary>
/// 第1行第4列的X坐标
/// </summary>
public int Column4X { get; set; }
/// <summary>
/// 第1行第4列的Y坐标
/// </summary>
public int Column4Y { get; set; }
/// <summary>
/// 第1行第4列的宽度
/// </summary>
public int Column4Width { get; set; }
/// <summary>
/// 第1行第4列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column4Align { get; set; }
/// <summary>
/// 第1行第5列的X坐标
/// </summary>
public int Column5X { get; set; }
/// <summary>
/// 第1行第5列的Y坐标
/// </summary>
public int Column5Y { get; set; }
/// <summary>
/// 第1行第5列的宽度
/// </summary>
public int Column5Width { get; set; }
/// <summary>
/// 第1行第5列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column5Align { get; set; }
/// <summary>
/// 第1行第6列的X坐标
/// </summary>
public int Column6X { get; set; }
/// <summary>
/// 第1行第6列的Y坐标
/// </summary>
public int Column6Y { get; set; }
/// <summary>
/// 第1行第6列的宽度
/// </summary>
public int Column6Width { get; set; }
/// <summary>
/// 第1行第6列的对齐方式 0:居左对齐 1居中对齐
/// </summary>
public int Column6Align { get; set; }
}
}

View File

@ -1,10 +1,11 @@
using System.Collections.ObjectModel;
using System;
using System.Collections.ObjectModel;
using System.Windows.Media;
using Telerik.Windows.Controls;
namespace SWS.Model
{
public class TreeModel : ViewModelBase, System.ICloneable
public class TreeModel : ViewModelBase, System.ICloneable
{
public string ID { get; set; }
private string _Text;
@ -37,6 +38,17 @@ namespace SWS.Model
get { return _isexpand; }
set { _isexpand = value; OnPropertyChanged(nameof(isexpand)); }
}
private bool isChecked=false;
/// <summary>
/// 是否选中状态
/// </summary>
public bool IsChecked
{
get { return isChecked; }
set { isChecked = value; OnPropertyChanged(nameof(IsChecked));
}
}
/// <summary>
/// 节点类型
/// </summary>

View File

@ -116,6 +116,7 @@
<Compile Include="ec_wire_group_propertyhis.cs" />
<Compile Include="KeyValueModel.cs" />
<Compile Include="LayoutTagInfoBrief.cs" />
<Compile Include="NoEntity\BomConfig.cs" />
<Compile Include="NoEntity\CheckInLogNeedApproveModel.cs" />
<Compile Include="NoEntity\CheckInModel.cs" />
<Compile Include="NoEntity\ConfigIni.cs" />

View File

@ -117,6 +117,9 @@ namespace SWS.Model
/// 删除标记
/// </summary>
public bool DeleteFlg { set; get; } = false;
public List<ec_PanelStripTerm> AssignedTerms { set; get; }
#endregion
public ec_CableSet()

View File

@ -32,7 +32,7 @@ namespace SWS.Service
/// <summary>
/// 查询图纸目录树
/// </summary>
/// <param name="onlyFolderFlag">是否只查询文件夹。1代表只查询文件夹</param>
/// <param name="onlyFolderFlag">是否只查询文件夹。0:包含图纸文件的查询, 1代表只查询文件夹</param>
/// <returns></returns>
public async Task<ObservableCollection<TreeModel>> GetDrawingCatalogue(string onlyFolderFlag = "0")
{

View File

@ -333,6 +333,46 @@ namespace SWS.Service
return null;
}
public async Task<object> AutoAssignCable2channel_step1(List<string> CableIds ,bool AcceptNearbyPanel)
{
var res = await this.PostBodyAsync<object,List<string>>($"IOModuleApi/AutoAssignCable2Channel_step1?projId={GlobalObject.curProject?.ProjectId}&AcceptNearbyPanel={AcceptNearbyPanel}", CableIds);
//if (res.code == 200)
//{
// return res.data;
//}
//else
//{
//}
return res;
}
public async Task<List<ec_Cable>> AutoAssignCable2channel_step2()
{
var res = await this.PostBodyAsync<List<ec_Cable>, object>($"IOModuleApi/AutoAssignCable2Channel_step2?projId={GlobalObject.curProject?.ProjectId}", null);
if (res.code == 200)
{
return res.data;
}
else
{
}
return null;
}
public async Task<List<ec_Cable>> AutoAssignCable2channel_step3(List<ec_Cable> CableIds)
{
var res = await this.PostBodyAsync<List<ec_Cable>, object>($"IOModuleApi/AutoAssignCable2Channel_step3?projId={GlobalObject.curProject?.ProjectId}", CableIds);
if (res.code == 200)
{
return res.data;
}
else
{
}
return null;
}
/// <summary>
/// SaveConnections 专用
/// </summary>
@ -341,5 +381,7 @@ namespace SWS.Service
public string ID { get; set; }
public List<ec_WireTerminal> Conns { get; set; }
}
}
}

View File

@ -0,0 +1,32 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using SWS.Commons;
using SWS.Model;
using SWS.Share;
namespace SWS.Service
{
public class PlotBOMService : HttpService
{
public PlotBOMService() : base()
{
}
public async Task<List<BOMGroupInfo>> GetBOMGroupInfo(string drawingId)
{
var res = await this.GetAsync<List<BOMGroupInfo>>($"PlotBOMApi/GetBOMGroupInfo?drawingId={drawingId}&ProjectId={GlobalObject.curProject.ProjectId}");
if (res.code == 200)
{
return res.data;
}
else
{
}
return null;
}
}
}

View File

@ -10,7 +10,19 @@ namespace SWS.Service
{
}
public async Task<ec_project> GetEntity(string projectId)
{
var res = await this.GetAsync<ec_project>($"ProjectApi/GetEntity?projectId={projectId}");
if (res.code == 200)
{
return res.data;
}
else
{
}
return null;
}
public async Task<PageModel<ec_project>> GetProjects(int pageNo, int pageSize)
{

View File

@ -64,6 +64,7 @@
<Compile Include="NotificationService.cs" />
<Compile Include="ObjectTypeService.cs" />
<Compile Include="LibraryFileService.cs" />
<Compile Include="PlotBOMService.cs" />
<Compile Include="PlotLayoutService.cs" />
<Compile Include="ProjectService.cs" />
<Compile Include="ProjectSettingsService.cs" />
@ -82,6 +83,10 @@
<Project>{1995385b-d1b0-4c55-835e-d3e769972a6a}</Project>
<Name>SWS.Model</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87e71797-e60a-4637-ba32-c8b57154abc3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
/// <summary>
/// 材料表分组信息
/// </summary>
public class BOMGroupInfo
{
/// <summary>
/// 图标上面部分显示内容
/// </summary>
public string upper_text { set; get; }
/// <summary>
/// 图标下面部分显示内容
/// </summary>
public string lower_text { set; get; }
/// <summary>
/// 每一行用的symbol是什么
/// </summary>
public string FileId { set; get; }
/// <summary>
/// 个数
/// </summary>
public int Count { set; get; }
/// <summary>
/// 备注(由 厂商)
/// </summary>
public string Remark { set; get; }
/// <summary>
/// 规格(由 电制 额定功率 ip等级 防爆等级等属性拼接而成)
/// </summary>
public string Spec { set; get; }
/// <summary>
/// 型号
/// </summary>
public string Model { set; get; }
}
}

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