不知为何本地会有那么多staged,commit一下看看

This commit is contained in:
supercjj2023 2025-09-16 09:49:26 +08:00
commit 4d827a45be
60 changed files with 2449 additions and 637 deletions

View File

@ -406,57 +406,7 @@ namespace Learun.Application.Web.AppApi
return Fail(ex.Message);
}
}
/// <summary>
/// 检入图纸文件
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="drawingFileID">图纸文件ID</param>
/// <param name="remark">描述</param>
/// <param name="folderId">文件夹ID</param>
/// <param name="fileMD5">文件MD5</param>
/// <param name="UsersNotified">待通知的用户,逗号分隔</param>
/// <returns></returns>
[HttpPost]
[Obsolete]
public IHttpActionResult CheckInDrawingFile(string projectId, string drawingFileID, string remark, string folderId, string fileMD5, string UsersNotified)
{
//如何避免数据丢失
try
{
var httpContent = Request.Content;
var asyncContent = httpContent.ReadAsStringAsync().Result;
List<ec_enginedata_pixelEntity> entityList = asyncContent.ToList<ec_enginedata_pixelEntity>();
if (entityList == null || entityList.Count == 0)
{
//避免前端因频繁切换图纸造成检入时,一个都没有,而把数据库里的都清空了
XmlConfigurator.Configure();
var log = log4net.LogManager.GetLogger("INFO"); //参数就是config里logger节点的名字
log.Error($"★★★{DateTime.Now.ToString()}★★★Drawing Check In Only 0 Pixel【DrawingId:{drawingFileID}】★★★");
//return Success("检入成功!");
//entityList = new List<ec_enginedata_pixelEntity>();
}
else if (string.IsNullOrEmpty(folderId))
{
log4net.LogManager.GetLogger("ERROR").Error("检入图纸 - " + "无效的空白FolderId");
throw new Exception("检入图纸 - " + "无效的空白FolderId");
}
else
{
pixelBll.SavePixels(entityList, projectId, drawingFileID);
}
//换了下顺序先SaveMuliteEntity再CheckInDrawingFile。这样就算SaveMuliteEntity报错了但是图纸至少不会被检入免得出现之前数据丢失的问题
ec_drawing_fileIBLL.CheckInDrawingFile(drawingFileID, remark, folderId, fileMD5, projectId, UsersNotified);
return Success("检入成功!");
}
catch (Exception ex)
{
return Fail(ex.Message);
}
}
/// <summary>
/// 检入图纸文件(修改消息)
/// </summary>
/// <param name="projectId">项目ID</param>

View File

@ -62,7 +62,7 @@ namespace Learun.Application.Web.AppApi
{
List<TreeModelLite> res = new List<TreeModelLite>();
var ec_enginedata_pixelBLL = new ec_enginedata_pixelBLL();
var data = ec_enginedata_pixelBLL.GetList("{\"ProjectId\":\"" + projectId + "\",\"EngineDataID\":\"" + EngineDataID + "\"}");
var data = ec_enginedata_pixelBLL.GetList("{\"ProjectId\":\"" + projectId + "\",\"EngineDataID\":\"" + EngineDataID + "\"}",projectId);
return Success(data);
}

View File

@ -373,7 +373,7 @@ namespace Learun.Application.Web.AppApi
/// </summary>
/// <param name="projectId">项目ID</param>
/// <param name="drawingFileID">图纸文件ID</param>
/// <param name="pixelCodes">图元编号集合(用,连接)</param>
/// <param name="pixelCodes">图元编号集合(用,连接)。正常就1个</param>
/// <param name="caseID">工况ID</param>
/// <returns></returns>
[HttpGet]
@ -548,11 +548,11 @@ namespace Learun.Application.Web.AppApi
foreach (ec_enginedata_propertyEntity TagProp in tag.EngineDataProperty)
{
if (TagProp.PropertyName == "起始设备")
if (TagProp.PropertyName == GlobalObject.propName_From)
{
TagProp.PropertyValue = CableConn.End1Tag;
}
else if (TagProp.PropertyName == "终止设备")
else if (TagProp.PropertyName == GlobalObject.propName_To)
{
TagProp.PropertyValue = CableConn.End2Tag;
}
@ -591,79 +591,90 @@ namespace Learun.Application.Web.AppApi
var propTbName = ProjectSugar.TableName<ec_enginedata_propertyEntity>(projectId);
var allUser = SqlSugarHelper.Db.Queryable<UserEntity>().ToList();
var userDict = allUser.ToDictionary(x => x.F_UserId, x => x.F_RealName);
var pixelAll = SqlSugarHelper.Db.Queryable<ec_enginedata_pixelEntity>().AS(pixelTbName).Where(x => x.DrawingFileID == drawingFileID && x.DeleteFlg != 1).ToList();
var pixelDictByTag = pixelAll.GroupBy(x => x.EngineDataID).ToDictionary(x => x.Key, x => x.ToList());
var pixelObjs = pixelAll.Where(x => pixelCodes.Split(',').ToList().Contains(x.PixelCode)).ToList();
var tagIds = pixelObjs.Select(x => x.EngineDataID).Distinct().ToList();
var tagAll = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTbName).OrderBy(x => x.TagNumber).ToList();
// 提前分组按ObjectTypeID分组并为每个组预生成字典仅执行一次O(m)时间)
var preGrouped = tagAll
.GroupBy(tag => tag.ObjectTypeID)
.ToDictionary(
group => group.Key, // 键ObjectTypeID
group => group.ToDictionary( // 值该组内的EngineDataID→TagNumber字典
item => item.EngineDataID,
item => item.TagNumber
)
);
var tagObjs = tagAll.Where(x => tagIds.Contains(x.EngineDataID)).ToList();
var tagDictByType = tagObjs.GroupBy(x => x.ObjectTypeID).ToDictionary(x => x.Key, x => x.ToList());
var typeIds = tagObjs.Select(x => x.ObjectTypeID).Distinct().ToList();
var typeAll = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(typeTbName).ToList();
var typeObjs = typeAll.Where(x => typeIds.Contains(x.ObjectTypeID)).ToList();
var tagPropAll = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propTbName).Where(x => tagIds.Contains(x.EngineDataID)).ToList();
var tagPropDictByTag = tagPropAll.GroupBy(x => x.EngineDataID).ToDictionary(x => x.Key, x => x.ToList());
//所有类别的属性信息
var objectTypeProps2 = objectTypePBll.GetObjectTypePById(string.Join(",", typeIds), projectId, true);//最频繁的那个接口
var typePropDictByType = objectTypeProps2.GroupBy(x => x.ObjectTypeID).ToDictionary(g => g.Key, g => g.ToList());
try
{
foreach (var objectType in typeObjs)
{
//该类型下的属性信息
objectType.props = objectTypeProps2.Where(x => x.ObjectTypeID == objectType.ObjectTypeID).ToList();
objectType.props = typePropDictByType[objectType.ObjectTypeID];// objectTypeProps2.Where(x => x.ObjectTypeID == objectType.ObjectTypeID).ToList();
//该类型下的位号基础信息
objectType.tags = tagObjs.Where(x => x.ObjectTypeID == objectType.ObjectTypeID).ToList();
foreach (var item in objectType.tags)
{
item.CreateUserName = allUser.FirstOrDefault(x => x.F_UserId == item.CreateUserID)?.F_RealName;
}
objectType.tags = tagDictByType[objectType.ObjectTypeID]; // tagObjs.Where(x => x.ObjectTypeID == objectType.ObjectTypeID).ToList();
//每个位号的属性信息
foreach (var tag in objectType.tags)
{
tag.CreateUserName = userDict[tag.CreateUserID];// allUser.FirstOrDefault(x => x.F_UserId == item.CreateUserID)?.F_RealName;
tag.EngineDataID = tag.EngineDataID;
tag.EngineDataProperty = tagPropAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
tag.EngineDataProperty = tagPropDictByTag[tag.EngineDataID];// tagPropAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
tag.ObjectTypeName = objectType.ObjectTypeName;
if (objectType.ObjectTypeName.EndsWith("电缆"))
{
//电缆from to
var CableConn = relBll.GetCableConn(tag.EngineDataID, projectId);
var CableConn = relBll.GetCableConn(tag.EngineDataID, projectId);//此时就根据rel里的id拿到了新的tagNumber
if (!tag.EngineDataProperty.Any(X => X.PropertyName == "起始设备"))
if (!tag.EngineDataProperty.Any(X => X.PropertyName == GlobalObject.propName_From))
{
var newProp = new ec_enginedata_propertyEntity()
{
EngineDataID = tag.EngineDataID,
PropertyName = "起始设备",
PropertyName = GlobalObject.propName_From,
//CaseID = string.IsNullOrEmpty(caseID) ? tag.CaseID : caseID,
};
newProp.Create();
ec_enginedata_propertyBLL.InsertTagProp(projectId, tag.EngineDataID, newProp);
ec_enginedata_propertyBLL.InsertTagProp(projectId, tag.EngineDataID, newProp);//增加 起始设备
tag.EngineDataProperty.Add(newProp);
}
if (!tag.EngineDataProperty.Any(X => X.PropertyName == "终止设备"))
if (!tag.EngineDataProperty.Any(X => X.PropertyName == GlobalObject.propName_To))
{
var newProp = new ec_enginedata_propertyEntity()
{
EngineDataID = tag.EngineDataID,
PropertyName = "终止设备",
PropertyName = GlobalObject.propName_To,
//CaseID = string.IsNullOrEmpty(caseID) ? tag.CaseID : caseID,
};
newProp.Create();
ec_enginedata_propertyBLL.InsertTagProp(projectId, tag.EngineDataID, newProp);
ec_enginedata_propertyBLL.InsertTagProp(projectId, tag.EngineDataID, newProp);////增加 终止设备
tag.EngineDataProperty.Add(newProp);
}
var TagProp = tag.EngineDataProperty.FirstOrDefault(X => X.PropertyName == "起始设备");
var TagProp = tag.EngineDataProperty.FirstOrDefault(X => X.PropertyName == GlobalObject.propName_From);
if (TagProp != null)
{
TagProp.PropertyValue = CableConn.End1Tag;
}
TagProp = null;
TagProp = tag.EngineDataProperty.FirstOrDefault(X => X.PropertyName == "终止设备");
TagProp = tag.EngineDataProperty.FirstOrDefault(X => X.PropertyName == GlobalObject.propName_To);
if (TagProp != null)
{
TagProp.PropertyValue = CableConn.End2Tag;
@ -671,10 +682,10 @@ namespace Learun.Application.Web.AppApi
}
//查一下每个位号的图元信息
tag.EngineDataPixel = pixelAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
tag.EngineDataPixel = pixelDictByTag[tag.EngineDataID];// pixelAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
}
//taglist
objectType.tagsListDropDown = tagAll.Where(X => X.ObjectTypeID == objectType.ObjectTypeID).ToDictionary(x => x.EngineDataID, x => x.TagNumber);
objectType.tagsListDropDown = preGrouped[objectType.ObjectTypeID]; //tagAll.Where(X => X.ObjectTypeID == objectType.ObjectTypeID).ToDictionary(x => x.EngineDataID, x => x.TagNumber);
//该类型下的流水
if (objectType.IsSerialNumber == 1)
@ -775,12 +786,12 @@ namespace Learun.Application.Web.AppApi
tag.EngineDataProperty = engineDataProps.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
//BUG 1483
if (!tag.EngineDataProperty.Any(X => X.PropertyName == "起始设备"))
if (!tag.EngineDataProperty.Any(X => X.PropertyName == GlobalObject.propName_From))
{
var newProp = new ec_enginedata_propertyEntity()
{
EngineDataID = tag.EngineDataID,
PropertyName = "起始设备",
PropertyName = GlobalObject.propName_From,
//CaseID = string.IsNullOrEmpty(caseID) ? tag.CaseID : caseID,
};
newProp.Create();
@ -788,12 +799,12 @@ namespace Learun.Application.Web.AppApi
ec_enginedata_propertyIBLL.InsertTagProp(projectId, tag.EngineDataID, newProp);
tag.EngineDataProperty.Add(newProp);
}
if (!tag.EngineDataProperty.Any(X => X.PropertyName == "终止设备"))
if (!tag.EngineDataProperty.Any(X => X.PropertyName == GlobalObject.propName_To))
{
var newProp = new ec_enginedata_propertyEntity()
{
EngineDataID = tag.EngineDataID,
PropertyName = "终止设备",
PropertyName = GlobalObject.propName_To,
//CaseID = string.IsNullOrEmpty(caseID) ? tag.CaseID : caseID,
};
newProp.Create();
@ -804,11 +815,11 @@ namespace Learun.Application.Web.AppApi
foreach (ec_enginedata_propertyEntity TagProp in tag.EngineDataProperty)
{
if (TagProp.PropertyName == "起始设备")
if (TagProp.PropertyName == GlobalObject.propName_From)
{
TagProp.PropertyValue = CableConn.End1Tag;
}
else if (TagProp.PropertyName == "终止设备")
else if (TagProp.PropertyName == GlobalObject.propName_To)
{
TagProp.PropertyValue = CableConn.End2Tag;
}
@ -921,7 +932,7 @@ namespace Learun.Application.Web.AppApi
foreach (var DuplicatePixelData in data)
{
//先根据老的图例找出工程ID
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + DuplicatePixelData.oldPixelCode + "\",\"DrawingFileID\":\"" + oldDrawingID + "\"}").
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + DuplicatePixelData.oldPixelCode + "\",\"DrawingFileID\":\"" + oldDrawingID + "\"}", ProjectId).
Where(x => x.EngineDataID != "").
Select(x => x.EngineDataID).Distinct();
if (EngineDataIDs == null)

View File

@ -77,7 +77,7 @@ namespace Learun.Application.Web.AppApi
relData.RelEngineData2ID
};
}
ec_relDataBLL.SaveEntitys(ProjectId, relData.RelTypeID, relData.RelEngineData1ID, relData.End2IDs);
ec_relDataBLL.SaveEntitys(ProjectId, relData.RelTypeID, relData.RelEngineData1ID, relData.End2IDs,relData.OPCPixel);
}
@ -214,7 +214,7 @@ namespace Learun.Application.Web.AppApi
//根据句柄和图纸先把工程id查出来先
var drawingID = CablePixelID.DrawingID;
var pixelID = CablePixelID.CablePixelID;
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + pixelID + "\",\"DrawingFileID\":\"" + drawingID + "\"}").Distinct();
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + pixelID + "\",\"DrawingFileID\":\"" + drawingID + "\"}", ProjectId).Distinct();
if (EngineDataIDs != null && EngineDataIDs.Count() == 1)
{
var engineDataPixel = EngineDataIDs.First();
@ -487,7 +487,7 @@ namespace Learun.Application.Web.AppApi
}
}
relDataCol = relDataColNotOPC;
}
else
@ -509,9 +509,9 @@ namespace Learun.Application.Web.AppApi
}
//根据句柄和图纸先把工程id查出来先
//获取工程数据图元数据
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.TagPixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}").
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.TagPixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}", ProjectId).
Select(x => x.EngineDataID).Distinct();
var CableIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.CablePixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}").
var CableIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.CablePixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}", ProjectId).
Select(x => x.EngineDataID).Distinct();
if (EngineDataIDs != null && EngineDataIDs.Count() == 1 && CableIDs != null && CableIDs.Count() == 1)
{
@ -536,9 +536,9 @@ namespace Learun.Application.Web.AppApi
{
//根据句柄和图纸先把工程id查出来先
//获取工程数据图元数据
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.TagPixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}").
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.TagPixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}", ProjectId).
Select(x => x.EngineDataID).Distinct();
var CableIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.CablePixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}").
var CableIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + relData.CablePixelID + "\",\"DrawingFileID\":\"" + relData.DrawingID + "\"}", ProjectId).
Select(x => x.EngineDataID).Distinct();
if (EngineDataIDs != null && EngineDataIDs.Count() == 1 && CableIDs != null && CableIDs.Count() == 1)
{
@ -547,13 +547,13 @@ namespace Learun.Application.Web.AppApi
if (relData.IsEnd1)
if (relData.IsEnd1)//电缆的起始端连接信息设备在end1电缆在end2
{
ec_relDataBLL.SaveEntitys(ProjectId, RelTypeID, new List<string> { TagID }, CableID, true);
ec_relDataBLL.SaveEntitys(ProjectId, RelTypeID, new List<string> { TagID }, CableID, relData.TagPixelID, true);
}
else
{
ec_relDataBLL.SaveEntitys(ProjectId, RelTypeID, CableID, new List<string> { TagID }, true);
ec_relDataBLL.SaveEntitys(ProjectId, RelTypeID, CableID, new List<string> { TagID }, relData.TagPixelID, true);
}
}

View File

@ -55,7 +55,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
return View();
}
/// <summary>
/// 回收站
/// 图纸回收站
/// <summary>
/// <returns></returns>
[HttpGet]

View File

@ -40,7 +40,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
return View();
}
/// <summary>
/// 工程数据回收站
/// 工程数据Tag回收站
/// <summary>
/// <returns></returns>
[HttpGet]

View File

@ -32,17 +32,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
#region
/// <summary>
/// 获取列表数据
/// <summary>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetList(string queryJson)
{
var data = ec_enginedata_pixelIBLL.GetList(queryJson);
return Success(data);
}
/// <summary>
/// 获取工程数据图元表数据
/// <summary>

View File

@ -99,7 +99,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
public ActionResult SaveForm(string ProjectId, string RelTypeID, string RelEngineData1ID, string strEntity)
{
List<string> relEngineData2IDs = strEntity.ToList<string>();
ec_enginedata_relIBLL.SaveEntitys(ProjectId, RelTypeID, RelEngineData1ID, relEngineData2IDs);
ec_enginedata_relIBLL.SaveEntitys(ProjectId, RelTypeID, RelEngineData1ID, relEngineData2IDs,"");
return Success("保存成功!");
}
#endregion

View File

@ -1123,7 +1123,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
//电缆的from to是根据甲板号的order顺序来的高优先级的就属于from
int? FromOrder = -1; int? ToOrder = -1;
#region From
var cableFromId = relDatas?.FirstOrDefault(x => x?.RelEngineData2ID == cable?.EngineDataID && x?.RelEngDataObjType1?.Contains("OPC")==false)?.RelEngineData1ID;
var cableFromId = relDatas?.FirstOrDefault(x => x?.RelEngineData2ID == cable?.EngineDataID && x?.RelEngDataObjType1?.Contains(GlobalObject.objectType_OPC)==false)?.RelEngineData1ID;
if (!string.IsNullOrEmpty(cableFromId))
{
var cableFromObj = Equips.FirstOrDefault(x => x.EngineDataID == cableFromId);
@ -1174,7 +1174,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
}
#endregion
#region To
var cableEndId = relDatas?.FirstOrDefault(x => x?.RelEngineData1ID == cable?.EngineDataID && x?.RelEngDataObjType2?.Contains("OPC")==false)?.RelEngineData2ID;
var cableEndId = relDatas?.FirstOrDefault(x => x?.RelEngineData1ID == cable?.EngineDataID && x?.RelEngDataObjType2?.Contains(GlobalObject.objectType_OPC)==false)?.RelEngineData2ID;
if (!string.IsNullOrEmpty(cableEndId))
{
var cableEndObj = Equips.FirstOrDefault(x => x.EngineDataID == cableEndId);
@ -1570,8 +1570,8 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
(eep, ee, eo, edf, edc, edp) => eep.EngineDataID == edp.EngineDataID
)
.LeftJoin(subQuery, (eep, ee, eo, edf, edc, edp,dde)=> edp. == dde.DataItemName)
.WhereIF(selectModel == 0, (eep, ee, eo, edf, edc, edp, dde) => !eo.FullPathCN.EndsWith("电缆") && !eo.FullPathCN.EndsWith("图框") && !eo.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eo.FullPathCN.EndsWith("OPC") && eep.DeleteFlg == 0)
.WhereIF(selectModel == 1, (eep, ee, eo, edf, edc, edp, dde) => !eo.FullPathCN.EndsWith("电缆") && !eo.FullPathCN.EndsWith("图框") && !eo.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eo.FullPathCN.EndsWith("OPC") && dwgIdCos.Contains(eep.DrawingFileID) && eep.DeleteFlg == 0)
.WhereIF(selectModel == 0, (eep, ee, eo, edf, edc, edp, dde) => !eo.FullPathCN.EndsWith("电缆") && !eo.FullPathCN.EndsWith("图框") && !eo.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eo.FullPathCN.EndsWith(GlobalObject.objectType_OPC) && eep.DeleteFlg == 0)
.WhereIF(selectModel == 1, (eep, ee, eo, edf, edc, edp, dde) => !eo.FullPathCN.EndsWith("电缆") && !eo.FullPathCN.EndsWith("图框") && !eo.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eo.FullPathCN.EndsWith(GlobalObject.objectType_OPC) && dwgIdCos.Contains(eep.DrawingFileID) && eep.DeleteFlg == 0)
.GroupBy((eep, ee, eo, edf, edc, edp, dde) => new
{
edc.DrawingCatalogueNO,

View File

@ -1,5 +1,7 @@
using Learun.Application.Scheduler;
using Learun.Application.Web.Common;
using Learun.Cache.Base;
using Learun.Cache.Factory;
using System;
using System.Timers;
using System.Web;
@ -30,12 +32,17 @@ namespace Learun.Application.Web
GlobalConfiguration.Configure(WebApiConfig.Register);
RouteConfig.RegisterRoutes(RouteTable.Routes);
////一天执行一次备份
Timer timer = new Timer(86400000);
//timer.Elapsed += Timer_Elapsed;
//timer.Start();
#region redis清理
ICache redisObj = CacheFactory.CaChe();
redisObj.RemoveAll();
#endregion
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)

View File

@ -18,7 +18,7 @@
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>

View File

@ -986,7 +986,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
#region
var resourcePixelList = ec_enginedata_pixelService.GetList("{ProjectId:\"" + item.ProjectId + "\",DrawingFileID:\"" + item.DrawingFileID + "\"}").ToList();
var resourcePixelList = ec_enginedata_pixelService.GetList("{ProjectId:\"" + item.ProjectId + "\",DrawingFileID:\"" + item.DrawingFileID + "\"}",ProjectId).ToList();
if (resourcePixelList != null && resourcePixelList.Count() > 0)//不包含deleteflg的
{
//获取拷贝图纸所有的工程数据ID

View File

@ -2,6 +2,7 @@
using DocumentFormat.OpenXml.ExtendedProperties;
using DocumentFormat.OpenXml.Office2010.Excel;
using DocumentFormat.OpenXml.Office2013.Drawing.Chart;
using DocumentFormat.OpenXml.Office2021.DocumentTasks;
using DocumentFormat.OpenXml.Spreadsheet;
@ -87,7 +88,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var drawingInfo = Db.Queryable<ec_drawing_fileEntity>().AS(drawingfileTableName)
.LeftJoin<ec_dataitemdetailEntity>((edf, edid) => edf.DrawingSystem == edid.DataItemDetailID).AS<ec_dataitemdetailEntity>(dataitemdetailTableName)
.Where((edf, edid) => edf.DrawingFileID == drawingId)
.Select((edf, edid) => new {
.Select((edf, edid) => new
{
edid.DataItemName,
edf.DrawingFileName,
edid.UpDataItemDetailID
@ -126,10 +128,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
allTag = FilterEngineDataBySystemTopName(propertiesOfEnginedata, allTag, topDataItemDetailName, dataitemdetailTableName);
}
var allType = Db.Queryable<ec_objecttypeEntity>().AS(typeT).
Where(x => allTag.Select(y => y.ObjectTypeID).Contains(x.ObjectTypeID)
Where(x => allTag.Select(y => y.ObjectTypeID).Contains(x.ObjectTypeID)
&& !x.FullPathCN.EndsWith("图框")
&& !x.FullPathCN.EndsWith(GlobalObject.objectType_Base)
&& !x.FullPathCN.EndsWith("OPC")).Distinct().ToList();
&& !x.FullPathCN.EndsWith(GlobalObject.objectType_OPC)).Distinct().ToList();
var allPropDef = Db.Queryable<ec_propertyEntity>().AS(propT).ToList();
//var allObjectTypeP = Db.Queryable<ec_objecttypepEntity>().AS(objectTypeP_T).ToList();
var allObjectTypeP = new ec_objecttypepBLL().GetObjectTypePById("", projectId, true).ToList();
@ -226,8 +228,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
groupedProps[cableId] = props;
}
bool hasStart = props.Any(x => x.PropertyName == "起始设备");
bool hasEnd = props.Any(x => x.PropertyName == "终止设备");
bool hasStart = props.Any(x => x.PropertyName == GlobalObject.propName_From);
bool hasEnd = props.Any(x => x.PropertyName == GlobalObject.propName_To);
var cableTypeName = cableTypeMap.TryGetValue(cableId, out var typeName) ? typeName : "电缆";
if (!hasStart)
@ -236,12 +238,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
EngineDataID = cableId,
ObjectTypeName = cableTypeName,
PropertyName = "起始设备",
PropertyName = GlobalObject.propName_From,
PropertyValue = ""
};
props.Add(newStartProp);
allTagProps.Add(newStartProp); // ✅ 加入总集合
tagPropDict[(cableId, "起始设备")] = newStartProp; // ✅ 加入/覆盖字典
tagPropDict[(cableId, GlobalObject.propName_From)] = newStartProp; // ✅ 加入/覆盖字典
}
if (!hasEnd)
@ -250,18 +252,18 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
EngineDataID = cableId,
ObjectTypeName = cableTypeName,
PropertyName = "终止设备",
PropertyName = GlobalObject.propName_To,
PropertyValue = ""
};
props.Add(newEndProp);
allTagProps.Add(newEndProp); // ✅ 加入总集合
tagPropDict[(cableId, "终止设备")] = newEndProp; // ✅ 加入/覆盖字典
tagPropDict[(cableId, GlobalObject.propName_To)] = newEndProp; // ✅ 加入/覆盖字典
}
}
// 整合所有补全后的属性
var cableProperties = groupedProps.Values.SelectMany(g => g)
.Where(x => x.PropertyName == "起始设备" || x.PropertyName == "终止设备")
.Where(x => x.PropertyName == GlobalObject.propName_From || x.PropertyName == GlobalObject.propName_To)
.ToList();
// 一次性获取所有连接信息
@ -271,18 +273,18 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
if (cableRelDict.TryGetValue(changeprofromto.EngineDataID, out var conn))
{
if (changeprofromto.PropertyName == "起始设备")
if (changeprofromto.PropertyName == GlobalObject.propName_From)
{
changeprofromto.PropertyValue = conn.End1Tag;
}
else if (changeprofromto.PropertyName == "终止设备")
else if (changeprofromto.PropertyName == GlobalObject.propName_To)
{
changeprofromto.PropertyValue = conn.End2Tag;
}
}
}
foreach (var type in allType)
{
string sheetName = $"{seq}_{type.ObjectTypeName}";
@ -320,7 +322,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 4. 处理 `RequireIfRequired` 依赖项
foreach (var item in requireIfRequiredProps)
{
if (requiredProps.ContainsKey(item.trigger_property_id) && (item.IsRequired == -1 || item.IsRequired == null || item.IsRequired==0))//isrequired==0是因为历史遗留数据正常情况是没有0的
if (requiredProps.ContainsKey(item.trigger_property_id) && (item.IsRequired == -1 || item.IsRequired == null || item.IsRequired == 0))//isrequired==0是因为历史遗留数据正常情况是没有0的
{
//在必填的里面累加不必填的内容,但是需要处理依赖项的
allLinkedPropSet.Add(item);
@ -366,21 +368,21 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
curSheet.Cells[curRow, 1].Value = tag.TagNumber;
//var tagPropDict = allTagProps
//.GroupBy(x => (x.EngineDataID, x.PropertyName))
//.ToDictionary(g => g.Key, g => g.First());
//.GroupBy(x => (x.EngineDataID, x.PropertyName))
//.ToDictionary(g => g.Key, g => g.First());
var tagProp = tagPropDict.TryGetValue((tag.EngineDataID, propDef.PropertyName), out var propVal) ? propVal : null;
//var tagProp = allTagProps.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == propDef.PropertyName);
if (tagProp == null)
{
if (!string.IsNullOrEmpty(propDef.DefaultValue) && propDef.DefaultValue != "0")
{
curSheet.Cells[curRow, propCol].Value = propDef.DefaultValue;
}
else
{
CheckDependency(prop, allTagProps, tag, triggerProName, triggerOperator, triggerValue, curSheet, curRow, propCol, allLinkedPropId);
}
if (!string.IsNullOrEmpty(propDef.DefaultValue) && propDef.DefaultValue != "0")
{
curSheet.Cells[curRow, propCol].Value = propDef.DefaultValue;
}
else
{
CheckDependency(prop, allTagProps, tag, triggerProName, triggerOperator, triggerValue, curSheet, curRow, propCol, allLinkedPropId);
}
}
else if (string.IsNullOrEmpty(tagProp.PropertyValue) || tagProp.PropertyValue == "0")
{
@ -536,7 +538,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
curSheet.Cells[1, 1, totalRows, totalColumns].Style.Locked = false;
curSheet.Cells[1, 1, 1, totalColumns].Style.Locked = true; // 锁定第一行
curSheet.Cells[1, 1, totalRows, 1].Style.Locked = true; // 锁定第一列
curSheet.Protection.IsProtected = true;
curSheet.Protection.IsProtected = true;
curSheet.Protection.AllowFormatColumns = true; // 允许调整列宽
}
@ -596,7 +598,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
var isRequired = tagDepObjtypep.IsRequired;//上级的必填阶段值
//只有当前属性的必填阶段大于等于上级关联的必填阶段时才会去判断自身是不是要必填,不然都没有检查下去的必要
if(prop.IsRequired >= isRequired)
if (prop.IsRequired >= isRequired)
{
//取某个位号的工程数据属性
var tagDepProp = allTagProps.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == triggerProName);
@ -612,7 +614,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
}
}
}
else if (prop.dependency_type.Equals(dependency_type.RequireIfRequired))
@ -633,7 +635,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
else
{
//不依赖特定条件,且没有默认值,变色
SetCellColor(curSheet, curRow, propCol, prop.IsRequired, dependency_type.RequireNone,"");
SetCellColor(curSheet, curRow, propCol, prop.IsRequired, dependency_type.RequireNone, "");
}
}
/// <summary>
@ -643,7 +645,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <param name="row">行</param>
/// <param name="col">列</param>
/// <param name="isRequired">图纸阶段</param>
private void SetCellColor(ExcelWorksheet curSheet, int row, int col, int? isRequired, dependency_type deType, string strTriggerProName="", Dictionary<string, int> fillStyleCache = null)
private void SetCellColor(ExcelWorksheet curSheet, int row, int col, int? isRequired, dependency_type deType, string strTriggerProName = "", Dictionary<string, int> fillStyleCache = null)
{
curSheet.Cells[row, col].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
@ -808,7 +810,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
.Where((ed, edp, eo) =>
!SqlFunc.Contains(eo.ObjectTypeName, "%电缆") &&
!SqlFunc.Contains(eo.ObjectTypeName, "%图框") &&
!SqlFunc.Contains(eo.ObjectTypeName, "%"+ GlobalObject.objectType_Base) &&
!SqlFunc.Contains(eo.ObjectTypeName, "%" + GlobalObject.objectType_Base) &&
!SqlFunc.Contains(eo.ObjectTypeName, "%OPC") &&
validEngineDataIds.Contains(ed.EngineDataID)
)
@ -1165,7 +1167,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
#endregion
#region
public async Task LockTag(string projId, string enginedataId, string action)
public async System.Threading.Tasks.Task LockTag(string projId, string enginedataId, string action)
{
var data = LoginUserInfo.Get();
@ -1505,6 +1507,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var objectTypeTableName = TableName<ec_objecttypeEntity>(ProjectEntity.ProjectIndex.ToString());
var objectTypepTableName = TableName<ec_objecttypepEntity>(ProjectEntity.ProjectIndex.ToString());
var unitTableName = TableName<ec_measuring_unitEntity>(ProjectEntity.ProjectIndex.ToString());
var relTableName = TableName<ec_reltypeEntity>(ProjectEntity.ProjectIndex.ToString());
var reldataTableName = TableName<ec_enginedata_relEntity>(ProjectEntity.ProjectIndex.ToString());
var lookupBll = new ec_REFLOOKUPTABLEBLL();
@ -1715,10 +1719,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//db.UpdateByNoMap(curEnginedata, $"ec_enginedata_{ProjectEntity.ProjectIndex}", "EngineDataID");
Db.Updateable(curEnginedata).AS($"ec_enginedata_{ProjectEntity.ProjectIndex}").ExecuteCommand();
}
engineDataID = curEnginedata.EngineDataID;//更新位号时
engineDataID = curEnginedata.EngineDataID;//更新位号时
#endregion
}
else
@ -1774,37 +1778,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
validTagProps.Add(engineDataProp);
}
Db.Insertable(validTagProps).AS($"ec_enginedata_property_{ProjectEntity.ProjectIndex}").ExecuteCommand();
#endregion
#endregion
#region case
//foreach (var caseEntity in cases.Where(x => x.CaseID != caseID))
//{
// //把objectTypep里的一套和默认值带过来即可
// var enginedataProps = new List<ec_enginedata_propertyEntity>();
// Db.Queryable<ec_propertyEntity>().AS(propertyTableName)
// .InnerJoin<ec_objecttypepEntity>((a, b) => a.PropertyID == b.PropertyID)//&& !string.IsNullOrEmpty(a.DefaultValue)
// .AS<ec_objecttypepEntity>(objectTypepTableName)
// .InnerJoin<ec_objecttypeEntity>((a, b, c) => b.ObjectTypeID == c.ObjectTypeID && c.ObjectTypeID == entity.ObjectTypeID)
// .AS<ec_objecttypeEntity>(objectTypeTableName)
// .LeftJoin<ec_measuring_unitEntity>((a, b, c, d) => a.DefaultUnit == d.MeasuringUnitID)
// .AS<ec_measuring_unitEntity>(unitTableName)
// .Select((a, b, c, d) => new { a, d })
// .ToList().ForEach(x =>
// {
// var enginedataProp = new ec_enginedata_propertyEntity()
// {
// EngineDataID = engineDataID,
// PropertyName = x.a.PropertyName,
// PropertyValue = x.a.DefaultValue,
// MeasuringUnit = x.d.MeasuringUnitName,
// CaseID = caseEntity.CaseID,
// };
// enginedataProp.Create();
// enginedataProps.Add(enginedataProp);
// });
// Db.Insertable(enginedataProps).AS($"ec_enginedata_property_{ProjectEntity.ProjectIndex}").ExecuteCommand(); //231007
//}
#endregion
#region ec panel的记录
var objectType = new ec_objecttypeBLL().GetEntity(addEnginedata.ObjectTypeID, projectId);
if (objectType != null && !objectType.ObjectTypeName.EndsWith("电缆") && objectType.IsOOTB != 1)
@ -1830,6 +1805,43 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
First(x => x.DrawingFileID == pixel.DrawingFileID && x.PixelCode == pixel.PixelCode);
if (existPixel != null)
{
#region TASK #9476
//是否这个句柄换过位号换过的话更新为当前位号同时要更新相关电缆的from/to
var oldTagId = existPixel.EngineDataID;
var newTagId = engineDataID;
if (oldTagId != newTagId)
{
//句柄换位号主体了
//原本句柄相关的rel
var relObj = Db.Queryable<ec_reltypeEntity>().AS(relTableName).First(x => x.RelType == "0");
if (relObj != null) {
var existCableConns = Db.Queryable<ec_enginedata_relEntity>().AS(reldataTableName).
Where(x => x.RelTypeID == relObj.RelTypeID && x.OPCPixel == pixel.PixelCode && (x.RelEngineData1ID == oldTagId || x.RelEngineData2ID == oldTagId)).ToList();
//这里有问题。
//比如设备B在多个图上多有句柄P1 P2 P3且这些句柄都关联了多个电缆C1 C2 C3那么在rel表里就有3个B的记录
//这时如果进行提交,句柄P1的主体变为了设备BBB那么B的所有句柄P1 P2 P3都变为BBB了没有单独分离出来 C1 C2 C3中的某一个
//解决在进行saveconnection把设备的句柄存入
if (existCableConns != null)
{
//更新rel表
foreach (var existConn in existCableConns)
{
if (existConn.RelEngineData1ID == oldTagId)
{
existConn.RelEngineData1ID = newTagId;
}
else if (existConn.RelEngineData2ID == oldTagId)
{
existConn.RelEngineData2ID = newTagId;
}
}
//更新电缆属性里的 起始设备 和 终止设备
}
}
}
#endregion
existPixel.Modify(existPixel.EngineDataPixelID);
existPixel.DeleteFlg = 0;
existPixel.EngineDataID = engineDataID;
@ -1858,102 +1870,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
#region
//更新电缆规格
//var cableTableName = ProjectSugar.TableName<ec_CableEntity>(projectId);
//var enginedataTableName = ProjectSugar.TableName<ec_enginedataEntity>(projectId);
//var enginedataPropertyTableName = ProjectSugar.TableName<ec_enginedata_propertyEntity>(projectId);
//var cableFormat = SqlSugarHelper.Db.Queryable<ec_CableEntity>().AS<ec_CableEntity>(cableTableName)
// .InnerJoin<ec_enginedata_propertyEntity>((a, b) => a.EngineerDataID == b.EngineDataID).AS<ec_enginedata_propertyEntity>(enginedataPropertyTableName)
// .InnerJoin<ec_enginedataEntity>((a, b, c) => b.EngineDataID == c.EngineDataID).AS<ec_enginedataEntity>(enginedataTableName)
// .Where((a, b, c) => b.PropertyName == GlobalObject.propName_CableSpec && b.CaseID == caseID && c.TagNumber == entity.TagNumber)
// .Select((a, b, c) => new { a, b })
// .First();
//if (cableFormat != null)
//{
// var cableID = cableFormat.a.CableID;
// var start = cableFormat.b.PropertyValue.Split('*', 'x', 'X', '✖');
// if (start.Length >= 2)
// {
// int setCount;
// int wireCount;
// var b1 = int.TryParse(start[0], out setCount);
// var b2 = int.TryParse(start[1], out wireCount);
// if (b1 && b2)
// {
// var cableSetTableName = ProjectSugar.TableName<ec_CableSetEntity>(projectId);
// var cableSetWireTableName = ProjectSugar.TableName<ec_CableSetWireEntity>(projectId);
// var sets = SqlSugarHelper.Db.Queryable<ec_CableSetEntity>().AS(cableSetTableName).Where(x => x.CableID == cableID).ToList();
// var wires = SqlSugarHelper.Db.Queryable<ec_CableSetWireEntity>().AS(cableSetWireTableName).Where(x => sets.Select(Y => Y.CableSetID).Contains(x.CableSetID)).ToList();
// var setMax = Math.Max(setCount, sets.Count);
// var insSets = new List<ec_CableSetEntity>();
// var insWires = new List<ec_CableSetWireEntity>();
// var delSets = new List<ec_CableSetEntity>();
// var delWires = new List<ec_CableSetWireEntity>();
// for (int i = 0; i < setMax; i++)
// {
// var set = new ec_CableSetEntity();
// if (i <= setCount - 1 && i <= sets.Count - 1)
// {
// set = sets[i];
// }
// if (i > setCount - 1)
// {
// var delSet = sets[i];
// delSets.Add(delSet);
// delWires.AddRange(wires.Where(x => x.CableSetID == delSet.CableSetID).ToList());
// }
// if (i > sets.Count - 1)
// {
// set = new ec_CableSetEntity()
// {
// CableID = cableID,
// CableSetSeq = i + 1,
// CableSetName = $"Set{i + 1}",
// };
// set.Create();
// insSets.Add(set);
// }
// if (!string.IsNullOrEmpty(set.CableSetID))
// {
// var setWires = wires.Where(x => x.CableSetID == set.CableSetID).ToList();
// var wireMax = Math.Max(wireCount, setWires.Count);
// for (int j = 0; j < wireMax; j++)
// {
// if (j > wireCount - 1)
// {
// var delWire = setWires[j];
// delWires.Add(delWire);
// }
// if (j > setWires.Count - 1)
// {
// var wire = new ec_CableSetWireEntity()
// {
// //CableID = cableID,
// CableSetID = set.CableSetID,
// SetLevel = j,
// Wire_Tag = $"W{j + 1}"
// };
// wire.Create();
// insWires.Add(wire);
// }
// }
// }
// }
// SqlSugarHelper.Db.Insertable(insSets).AS(cableSetTableName).ExecuteCommand();
// SqlSugarHelper.Db.Insertable(insWires).AS(cableSetWireTableName).ExecuteCommand();
// SqlSugarHelper.Db.Deleteable(delWires).AS(cableSetWireTableName).ExecuteCommand();
// SqlSugarHelper.Db.Deleteable(delSets).AS(cableSetTableName).ExecuteCommand();
// }
// }
//}
#endregion
Db.CommitTran();
}
catch (Exception ex)
{
{
log4net.LogManager.GetLogger("ERROR").Error(ex.StackTrace + " || " + ex.Message);
Db.RollbackTran();
if (ex is ExceptionEx)
@ -2648,7 +2568,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 筛选出“真实设备”这里排除OPC、通讯器等中转对象
var deviceTags = endpointInfo
.Where(x => !x.objectType.Contains("OPC"))
.Where(x => !x.objectType.Contains(GlobalObject.objectType_OPC))
.Select(x => x.tagNumber)
.Distinct()
.Take(2) // 只取前两个设备

View File

@ -136,6 +136,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
UserInfo userInfo = LoginUserInfo.Get();
this.CreateUserID = userInfo.userId;
}
public void Modify()
{
this.UpdateTime = Time.MySqlTime;
UserInfo userInfo = LoginUserInfo.Get();
this.UpdateUserID = userInfo.userId;
}
/// <summary>
/// 编辑调用
/// </summary>

View File

@ -63,11 +63,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
WHERE t1.DataStatus != '00001' ");
if (queryParam["ProjectId"].IsEmpty())
{
strSql.Append(" AND (select count(1) from ec_enginedata_pixel st2 where st2.EngineDataID = t1.EngineDataID) = 0 ");
return new List<ec_enginedataEntity>();
}
else
{
strSql.Append($" AND (select count(1) from ec_enginedata_pixel_{ProjectEntity.ProjectIndex} st2 where st2.EngineDataID = t1.EngineDataID) = 0 ");
//strSql.Append($" AND (select count(1) from ec_enginedata_pixel_{ProjectEntity.ProjectIndex} st2 where st2.EngineDataID = t1.EngineDataID) = 0 ");
}
// 虚拟参数
@ -89,7 +89,22 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
strSql.Append(" AND t1.DataStatus = @DataStatus ");
}
//return this.BaseRepository().FindList<ec_enginedataEntity>(strSql.ToString(), dp, pagination);
return SqlSugarHelper.Db.SqlQueryable<ec_enginedataEntity>(strSql.ToString()).AddParameters(dp).ToPageList(pagination.page, pagination.rows);
var sql = strSql.ToString();
var res = SqlSugarHelper.Db.SqlQueryable<ec_enginedataEntity>(sql).AddParameters(dp).ToPageList(pagination.page, pagination.rows);
var allTagIds = res.Select(x => x.EngineDataID).Distinct().ToList();
var pixelTbName = ProjectSugar.TableName<ec_enginedata_pixelEntity>(ProjectEntity.ProjectId);
var allPixels = SqlSugarHelper.Db.Queryable<ec_enginedata_pixelEntity>().AS(pixelTbName)
.Where(x => allTagIds.Contains(x.EngineDataID) && x.DeleteFlg !=1)
.ToList();
var allTagIdsHavingPixel = allPixels.Select(x => x.EngineDataID).Distinct().ToList();
var TagNotHavingPixel = allTagIds.Except(allTagIdsHavingPixel).ToList();
var res2 = res.Where(x => TagNotHavingPixel.Contains(x.EngineDataID)).ToList();
return res2;
}
catch (Exception ex)
{
@ -215,7 +230,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
}
#endregion
@ -269,7 +284,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
SqlSugarHelper.Db.Deleteable(chs).AS($"ec_panel_channel_{ProjectEntity.ProjectIndex}").ExecuteCommand();
//SqlSugarHelper.Db.Ado.ExecuteCommand($@" DELETE FROM ec_panel_channel_{ProjectEntity.ProjectIndex} WHERE PanelID = '{panel.PanelID}'");
var wts = SqlSugarHelper.Db.Queryable<ec_WireTerminalEntity>().AS($"ec_wire_terminal_{ProjectEntity.ProjectIndex}").
Where(x => terms.Select(y=>y.TermID).Contains(x.TermID)).ToList();
Where(x => terms.Select(y => y.TermID).Contains(x.TermID)).ToList();
SqlSugarHelper.Db.Deleteable(wts).AS($"ec_wire_terminal_{ProjectEntity.ProjectIndex}").ExecuteCommand();
//SqlSugarHelper.Db.Ado.ExecuteCommand($@" DELETE FROM ec_wire_terminal_{ProjectEntity.ProjectIndex} WHERE PanelID = '{panel.PanelID}'");
}
@ -723,7 +738,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
/// <summary>
/// 更新工程数据属性默认值
/// </summary>

View File

@ -199,11 +199,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// 获取列表数据
/// <summary>
/// <returns></returns>
public IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson)
public IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson,string projId)
{
try
{
return ec_enginedata_pixelService.GetList(queryJson);
return ec_enginedata_pixelService.GetList(queryJson,projId);
}
catch (Exception ex)
{
@ -400,7 +400,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
.LeftJoin<ec_enginedataEntity>((edp, ede) => edp.EngineDataID == ede.EngineDataID).AS<ec_enginedataEntity>(enginedataTableName)
.LeftJoin<ec_objecttypeEntity>((edp, ede, eot) => ede.ObjectTypeID == eot.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
.Where((edp, ede, eot) => edp.DeleteFlg == 0 && edp.DrawingFileID == drawingFileID && pixelEntities.Select(y => y.PixelCode).Contains(edp.PixelCode)
&& !eot.FullPathCN.EndsWith("图框") && !eot.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eot.FullPathCN.EndsWith("OPC"))
&& !eot.FullPathCN.EndsWith("图框") && !eot.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eot.FullPathCN.EndsWith(GlobalObject.objectType_OPC))
.Select((edp, ede, eot) => edp.EngineDataID)
.Distinct()
.ToList();
@ -460,7 +460,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 获取所有需要处理的属性(只包含电缆对象,起始设备和终止设备)
var cableProperties = AllPropsOfEng
.Where(x => x.ObjectTypeName.Contains("电缆") &&
(x.PropertyName == "起始设备" || x.PropertyName == "终止设备"))
(x.PropertyName == GlobalObject.propName_From || x.PropertyName == GlobalObject.propName_To))
.ToList();
// 提取所有 CableID
@ -474,11 +474,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
if (cableRelDict.TryGetValue(changeprofromto.EngineDataID, out var conn))
{
if (changeprofromto.PropertyName == "起始设备")
if (changeprofromto.PropertyName == GlobalObject.propName_From)
{
changeprofromto.PropertyValue = conn.End1Tag;
}
else if (changeprofromto.PropertyName == "终止设备")
else if (changeprofromto.PropertyName == GlobalObject.propName_To)
{
changeprofromto.PropertyValue = conn.End2Tag;
}
@ -496,11 +496,20 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
var key = (checkproperty.EngineDataID, checkproperty.PropertyID);
if (propDict.TryGetValue(key, out var propertyValue))
{
if (string.IsNullOrEmpty(propertyValue) || propertyValue == "0")
{
errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
var PropertyValue = AllPropsOfEng
.FirstOrDefault(x =>
x.EngineDataID == checkproperty.EngineDataID &&
x.PropertyID == checkproperty.PropertyID)
?.PropertyValue;
//foreach (var property in AllPropsOfEng)
//{
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上且属性值为空或者NULL则认为没有填写
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//}
}
else
{
@ -545,7 +554,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
TagNumber = ee.TagNumber,
ObjectTypeID = ee.ObjectTypeID,
PropertyID = ote.PropertyID,
PropertyName=epe.PropertyName,
PropertyName = epe.PropertyName,
PropertyGID = epe.PropertyGID,
IsRequired = ote.IsRequired,
dependency_type = SqlFunc.IIF(SqlFunc.IsNullOrEmpty(ote.dependency_type), dependency_type.RequireNone, ote.dependency_type),
@ -580,10 +589,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//{
//判断当前属性的值是不是为空、为NULL还是为0如果是的话报错
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = $"图面有对象【{checkproperty.TagNumber}】,其前置属性设置了必填,所以属性【{checkproperty.PropertyName}】本身也必须填值,不然不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
{
errText = $"图面有对象【{checkproperty.TagNumber}】,其前置属性设置了必填,所以属性【{checkproperty.PropertyName}】本身也必须填值,不然不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//}
}
@ -615,28 +624,28 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//{
//先判断当前属性值是不是空或者0不是的话也就不用去进一步判断了如果是空或者0则去看她的前置属性
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
//取当前属性的上级联动属性值
var upPropertyValue = AllPropsOfEng?.Where(x =>
x?.EngineDataID != null
&& x.PropertyID != null
&& x.EngineDataID.Equals(checkproperty?.EngineDataID)
&& x.PropertyID.Equals(triggerPropertyId)).FirstOrDefault();
if (upPropertyValue == null)
{
//取当前属性的上级联动属性值
var upPropertyValue = AllPropsOfEng?.Where(x =>
x?.EngineDataID != null
&& x.PropertyID != null
&& x.EngineDataID.Equals(checkproperty?.EngineDataID)
&& x.PropertyID.Equals(triggerPropertyId)).FirstOrDefault();
if (upPropertyValue == null)
{
errText = $"图面对象【{checkproperty.TagNumber}】,其属性【{checkproperty.PropertyName}】的前置属性【{triggerPropertyId}】找不到。请管理员确认。";
return res = false;
}
//如果上级属性值符合条件那么同时根据上面的判断当前属性值不是空就是0那么需要报错
if ((triggerOperator == "=" && upPropertyValue.PropertyValue.ToUpper().Equals(triggerValue.ToUpper())) ||
(triggerOperator == ">" && double.Parse(upPropertyValue.PropertyValue) > double.Parse(triggerValue)) ||
(triggerOperator == "<" && double.Parse(upPropertyValue.PropertyValue) < double.Parse(triggerValue)) ||
(triggerOperator == "!=" && !upPropertyValue.PropertyValue.ToUpper().Equals(triggerValue.ToUpper())))
{
errText = $"图面有对象【{checkproperty.TagNumber}】,其前置属性【{upPropertyValue.PropertyName}】符合{triggerOperator}条件,所以属性本身【{checkproperty.PropertyName}】必须填值,不然不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
errText = $"图面对象【{checkproperty.TagNumber}】,其属性【{checkproperty.PropertyName}】的前置属性【{triggerPropertyId}】找不到。请管理员确认。";
return res = false;
}
//如果上级属性值符合条件那么同时根据上面的判断当前属性值不是空就是0那么需要报错
if ((triggerOperator == "=" && upPropertyValue.PropertyValue.ToUpper().Equals(triggerValue.ToUpper())) ||
(triggerOperator == ">" && double.Parse(upPropertyValue.PropertyValue) > double.Parse(triggerValue)) ||
(triggerOperator == "<" && double.Parse(upPropertyValue.PropertyValue) < double.Parse(triggerValue)) ||
(triggerOperator == "!=" && !upPropertyValue.PropertyValue.ToUpper().Equals(triggerValue.ToUpper())))
{
errText = $"图面有对象【{checkproperty.TagNumber}】,其前置属性【{upPropertyValue.PropertyName}】符合{triggerOperator}条件,所以属性本身【{checkproperty.PropertyName}】必须填值,不然不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
}
//}
}
}
@ -644,7 +653,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//最后看组内互斥,检入的话只检查即时更新版的
if (checkproperty.dependency_type == dependency_type.RequireMutually
&& checkproperty.ValueInGroup == false
&& checkproperty.IsRequired==1)
&& checkproperty.IsRequired == 1)
{
var PgID = string.Empty;
//如果ec_enginedata_propety里面没有必填属性要求的这个属性就代表没有保存认为是没有填值为空
@ -659,10 +668,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//{
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上也属于同一group且属性值为空或者NULL则认为没有填写
if (!string.IsNullOrEmpty(PropertyValue) && PropertyValue != "0")
{
PgID = checkproperty.PropertyGID;//获得有属性值的属性组ID
//break;
}
{
PgID = checkproperty.PropertyGID;//获得有属性值的属性组ID
//break;
}
//}
if (!string.IsNullOrEmpty(PgID))
{
@ -679,7 +688,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
var lstValueGroup = quaryNeedCheckPropertiesDependency.Where(x => x.dependency_type == dependency_type.RequireMutually && x.IsRequired== 1).Select(x => new { x.ValueInGroup, x.EngineDataID }).Distinct().ToList();
var lstValueGroup = quaryNeedCheckPropertiesDependency.Where(x => x.dependency_type == dependency_type.RequireMutually && x.IsRequired == 1).Select(x => new { x.ValueInGroup, x.EngineDataID }).Distinct().ToList();
foreach (var item in lstValueGroup)
{
if (item.ValueInGroup == false)
@ -773,7 +782,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
.LeftJoin<ec_enginedataEntity>((edp, ede) => edp.EngineDataID == ede.EngineDataID).AS<ec_enginedataEntity>(enginedataTableName)
.LeftJoin<ec_objecttypeEntity>((edp, ede, eot) => ede.ObjectTypeID == eot.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
.Where((edp, ede, eot) => edp.DeleteFlg == 0 && edp.DrawingFileID == drawingFileID
&& !eot.FullPathCN.EndsWith("图框") && !eot.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eot.FullPathCN.EndsWith("OPC"))
&& !eot.FullPathCN.EndsWith("图框") && !eot.FullPathCN.EndsWith(GlobalObject.objectType_Base) && !eot.FullPathCN.EndsWith(GlobalObject.objectType_OPC))
.Select((edp, ede, eot) => edp.EngineDataID)
.Distinct()
.ToList();
@ -832,7 +841,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 获取所有需要处理的属性(只包含电缆对象,起始设备和终止设备)
var cableProperties = quaryPropertiesOfEng
.Where(x => x.ObjectTypeName.Contains("电缆") &&
(x.PropertyName == "起始设备" || x.PropertyName == "终止设备"))
(x.PropertyName == GlobalObject.propName_From || x.PropertyName == GlobalObject.propName_To))
.ToList();
// 提取所有 CableID
@ -846,11 +855,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
if (cableRelDict.TryGetValue(changeprofromto.EngineDataID, out var conn))
{
if (changeprofromto.PropertyName == "起始设备")
if (changeprofromto.PropertyName == GlobalObject.propName_From)
{
changeprofromto.PropertyValue = conn.End1Tag;
}
else if (changeprofromto.PropertyName == "终止设备")
else if (changeprofromto.PropertyName == GlobalObject.propName_To)
{
changeprofromto.PropertyValue = conn.End2Tag;
}
@ -869,12 +878,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
?.PropertyValue;
//foreach (var property in quaryPropertiesOfEng)
//{
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上且属性值为空或者NULL则认为没有填写
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = "图面有对象在" + reversion + "阶段或者之前阶段的必填属性值为空,不能发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上且属性值为空或者NULL则认为没有填写
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = "图面有对象在" + reversion + "阶段或者之前阶段的必填属性值为空,不能发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//}
}
else
@ -929,12 +938,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
?.PropertyValue;
//foreach (var property in quaryPropertiesOfEng)
//{
//判断当前属性的值是不是为空、为NULL还是为0如果是的话报错
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = "图面有对象她的前置属性在" + reversion + "阶段或者再之前阶段设置了必填,所以她必须填值,不然不能发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//判断当前属性的值是不是为空、为NULL还是为0如果是的话报错
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
errText = "图面有对象她的前置属性在" + reversion + "阶段或者再之前阶段设置了必填,所以她必须填值,不然不能发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//}
}
}
@ -965,26 +974,26 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//进入循环了,证明能找到前置属性
//foreach (var property in quaryPropertiesOfEng)
//{
//先判断当前属性值是不是空或者0不是的话也就不用去进一步判断了如果是空或者0则去看她的前置属性
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
//先判断当前属性值是不是空或者0不是的话也就不用去进一步判断了如果是空或者0则去看她的前置属性
if (string.IsNullOrEmpty(PropertyValue) || PropertyValue == "0")
{
//取当前属性的上级联动属性值
var upPropertyValue = quaryPropertiesOfEng?.Where(x =>
x?.EngineDataID != null
&& x.PropertyID != null
&& x.EngineDataID.Equals(checkproperty?.EngineDataID)
&& x.PropertyID.Equals(triggerPropertyId))
.Select(x => x.PropertyValue).FirstOrDefault();
//如果上级属性值符合条件那么同时根据上面的判断当前属性值不是空就是0那么需要报错
if ((triggerOperator == "=" && upPropertyValue.ToUpper().Equals(triggerValue.ToUpper())) ||
(triggerOperator == ">" && double.Parse(upPropertyValue) > double.Parse(triggerValue)) ||
(triggerOperator == "<" && double.Parse(upPropertyValue) < double.Parse(triggerValue)) ||
(triggerOperator == "!=" && !upPropertyValue.ToUpper().Equals(triggerValue.ToUpper())))
{
//取当前属性的上级联动属性值
var upPropertyValue = quaryPropertiesOfEng?.Where(x =>
x?.EngineDataID != null
&& x.PropertyID != null
&& x.EngineDataID.Equals(checkproperty?.EngineDataID)
&& x.PropertyID.Equals(triggerPropertyId))
.Select(x => x.PropertyValue).FirstOrDefault();
//如果上级属性值符合条件那么同时根据上面的判断当前属性值不是空就是0那么需要报错
if ((triggerOperator == "=" && upPropertyValue.ToUpper().Equals(triggerValue.ToUpper())) ||
(triggerOperator == ">" && double.Parse(upPropertyValue) > double.Parse(triggerValue)) ||
(triggerOperator == "<" && double.Parse(upPropertyValue) < double.Parse(triggerValue)) ||
(triggerOperator == "!=" && !upPropertyValue.ToUpper().Equals(triggerValue.ToUpper())))
{
errText = "图面有对象她的前置属性符合某种条件,所以她必须填值,不然不能在" + reversion + "阶段发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
errText = "图面有对象她的前置属性符合某种条件,所以她必须填值,不然不能在" + reversion + "阶段发布,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
}
//}
}
}
@ -1005,12 +1014,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
?.PropertyValue;
//foreach (var property in quaryPropertiesOfEng)
//{
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上也属于同一group且属性值为空或者NULL则认为没有填写
if (!string.IsNullOrEmpty(PropertyValue) && PropertyValue != "0")
{
PgID = checkproperty.PropertyGID;//获得有属性值的属性组ID
//break;
}
//如果ec_enginedata_propety里面的EngineDataID等于需要检查对象的EngineDataID且属性ID也能对上也属于同一group且属性值为空或者NULL则认为没有填写
if (!string.IsNullOrEmpty(PropertyValue) && PropertyValue != "0")
{
PgID = checkproperty.PropertyGID;//获得有属性值的属性组ID
//break;
}
//}
if (!string.IsNullOrEmpty(PgID))
{
@ -1027,7 +1036,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
}
var lstValueGroup = quaryNeedCheckPropertiesDependency.Where(x => x.dependency_type == dependency_type.RequireMutually && x.IsRequired<=period).Select(x => x.ValueInGroup).Distinct().ToList();
var lstValueGroup = quaryNeedCheckPropertiesDependency.Where(x => x.dependency_type == dependency_type.RequireMutually && x.IsRequired <= period).Select(x => x.ValueInGroup).Distinct().ToList();
foreach (var item in lstValueGroup)
{
if (item == false)
@ -1052,7 +1061,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <param name="DtatTableName">表名</param>
/// <param name="strDataItemName">当前的DataItemName</param>
/// <returns>最上层的Name</returns>
public string GetTopParentDataItemDetail(string DtatTableName, string strDataItemName)
private string GetTopParentDataItemDetail(string DtatTableName, string strDataItemName)
{
// 先找到初始节点
var current = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(DtatTableName).Where(x => x.DataItemName == strDataItemName).First();
@ -1170,7 +1179,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <param name="cableIds">电缆IDLIST</param>
/// <param name="projectId">项目编号</param>
/// <returns>电缆连接信息</returns>
public List<CableConnRes> GetCableConnListBatch(List<string> cableIds, string projectId)
private List<CableConnRes> GetCableConnListBatch(List<string> cableIds, string projectId)
{
ec_enginedata_relBLL relbll = new ec_enginedata_relBLL();
var allRel = relbll.GetList($"{{ProjectId:\"{projectId}\", RelType:\"{(int)enum_RelType.设备_电缆}\"}}")
@ -1232,7 +1241,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 筛选出“真实设备”这里排除OPC、通讯器等中转对象
var deviceTags = endpointInfo
.Where(x => !x.objectType?.Contains("OPC")??false)
.Where(x => !x.objectType?.Contains(GlobalObject.objectType_OPC) ?? false)
.Select(x => x.tagNumber)
.Where(tag => !string.IsNullOrWhiteSpace(tag))
.Distinct()

View File

@ -19,7 +19,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// 获取列表数据
/// <summary>
/// <returns></returns>
IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson);
IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson,string projId);
/// <summary>
/// 获取工程数据图元表数据
/// <summary>

View File

@ -78,7 +78,7 @@ left JOIN ec_enginedata_{ProjectEntity.ProjectIndex} t3 ON t3.EngineDataID = t1.
/// <summary>
/// <param name="NeedDeleted">是否需要查询出被删的</param>
/// <returns></returns>
public IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson, bool NeedDeleted = false)
public IEnumerable<ec_enginedata_pixelEntity> GetList(string queryJson, string projId, bool NeedDeleted = false)
{
try
{
@ -93,7 +93,7 @@ left JOIN ec_enginedata_{ProjectEntity.ProjectIndex} t3 ON t3.EngineDataID = t1.
else
{
//var ProjectEntity = this.BaseRepository().FindEntity<ec_projectEntity>(queryParam["ProjectId"].ToString());
var ProjectEntity = new ec_projectBLL().GetEntity(queryParam["ProjectId"].ToString());
var ProjectEntity = new ec_projectBLL().GetEntity(projId);
strSql.Append($@" FROM ec_enginedata_pixel_{ProjectEntity.ProjectIndex} t1
JOIN ec_drawing_file_{ProjectEntity.ProjectIndex} t2 ON t2.DrawingFileID = t1.DrawingFileID
JOIN ec_enginedata_{ProjectEntity.ProjectIndex} t3 ON t3.EngineDataID = t1.EngineDataID
@ -553,8 +553,12 @@ left JOIN ec_enginedata_{ProjectEntity.ProjectIndex} t3 ON t3.EngineDataID = t1.
SqlSugarHelper.Db.BeginTran();
try
{
if (string.IsNullOrWhiteSpace(ProjectId))
{
return;
}
//获取某个图纸上的图元数据
var existPixels = this.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"DrawingFileID\":\"" + drawingFileID + "\"}", true).ToList();
var existPixels = this.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"DrawingFileID\":\"" + drawingFileID + "\"}", ProjectId, true).ToList();
ec_projectEntity ProjectEntity = new ec_projectEntity();
if (!string.IsNullOrWhiteSpace(ProjectId))
{
@ -583,32 +587,42 @@ left JOIN ec_enginedata_{ProjectEntity.ProjectIndex} t3 ON t3.EngineDataID = t1.
//存在
it.DeleteFlg = 0;
}
}
_enginedataPixelRepository.AsUpdateable(existPixels).AS($"ec_enginedata_pixel_{ProjectEntity.ProjectIndex}").ExecuteCommand();
if (string.IsNullOrWhiteSpace(ProjectId))
_enginedataPixelRepository.AsUpdateable(existPixels).AS($"ec_enginedata_pixel_{ProjectEntity.ProjectIndex}").ExecuteCommand();//batch commit
//db.ExecuteBySql($@"UPDATE ec_enginedata_{ ProjectEntity.ProjectIndex} T1
// SET DataStatus = '00001'
// WHERE (SELECT COUNT(*) FROM ec_enginedata_pixel_{ ProjectEntity.ProjectIndex} WHERE EngineDataID = T1.EngineDataID ) <= 0");
//db.ExecuteBySql($@"UPDATE ec_enginedata_{ProjectEntity.ProjectIndex} T1
// SET DataStatus = '00002'
// WHERE (SELECT COUNT(*) FROM ec_enginedata_pixel_{ProjectEntity.ProjectIndex} WHERE EngineDataID = T1.EngineDataID ) > 0 AND DataStatus != '00003'");
var tagTbName = TableName<ec_enginedataEntity>(ProjectId);
var tags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTbName).
Where(t => existPixels.Select(x => x.EngineDataID).Distinct().Contains(t.EngineDataID) && t.DataStatus != "00003").ToList();
foreach (var tag in tags)
{
tag.DataStatus = "00002";tag.Modify();
}
else
{
//db.ExecuteBySql($@"UPDATE ec_enginedata_{ ProjectEntity.ProjectIndex} T1
// SET DataStatus = '00001'
// WHERE (SELECT COUNT(*) FROM ec_enginedata_pixel_{ ProjectEntity.ProjectIndex} WHERE EngineDataID = T1.EngineDataID ) <= 0");
//db.ExecuteBySql($@"UPDATE ec_enginedata_{ProjectEntity.ProjectIndex} T1
// SET DataStatus = '00002'
// WHERE (SELECT COUNT(*) FROM ec_enginedata_pixel_{ProjectEntity.ProjectIndex} WHERE EngineDataID = T1.EngineDataID ) > 0 AND DataStatus != '00003'");
foreach (var EngineDataID in existPixels.Select(x => x.EngineDataID).Distinct())
{
if (EngineDataID != null)
{
SqlSugarHelper.Db.Ado.ExecuteCommand($@"UPDATE ec_enginedata_{ProjectEntity.ProjectIndex} T1
SET DataStatus = '00002'
WHERE DataStatus != '00003' and EngineDataID='{EngineDataID}'");
}
SqlSugarHelper.Db.Updateable(tags).AS(tagTbName).UpdateColumns(x => x.DataStatus).ExecuteCommand();
//foreach (var EngineDataID in existPixels.Select(x => x.EngineDataID).Distinct())
//{
// if (EngineDataID != null)
// {
// SqlSugarHelper.Db.Ado.ExecuteCommand($@"UPDATE ec_enginedata_{ProjectEntity.ProjectIndex} T1
// SET DataStatus = '00002'
// WHERE DataStatus != '00003' and EngineDataID='{EngineDataID}'");
// }
};
}
//}
//;
SqlSugarHelper.Db.CommitTran();
}

View File

@ -13,7 +13,7 @@ using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Threading.Tasks;
using static Learun.Application.TwoDevelopment.ZZDT_EC.ProjectSugar;
using static Learun.Util.SqlSugar.SqlSugarHelper;
@ -1348,7 +1348,7 @@ Select((a, b, c) => new
//根据句柄和图纸先把工程id查出来先
var drawingID = CablePixelID.DrawingID;
var pixelID = CablePixelID.CablePixelID;
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + pixelID + "\",\"DrawingFileID\":\"" + drawingID + "\"}").
var EngineDataIDs = pixelServ.GetList("{\"ProjectId\":\"" + ProjectId + "\",\"PixelCode\":\"" + pixelID + "\",\"DrawingFileID\":\"" + drawingID + "\"}", ProjectId).
Select(x => x.EngineDataID).Distinct();
if (EngineDataIDs != null && EngineDataIDs.Count() == 1)
{
@ -1395,7 +1395,19 @@ Select((a, b, c) => new
var End2 = new ec_enginedata_relEntity();
//查单一记录
var existRel = this.GetList("{ProjectId:\"" + ProjectId + "\",RelType:\"" + (int)enum_RelType._电缆 + "\",RelEngineDataID:\"" + CableID + "\"}").ToList();
if (existRel.Any(x => !string.IsNullOrEmpty(x.OPCPixel)))
//需要换判断了,现在所有东西都有存这个
var tagIds = existRel.Select(x => x.RelEngineData1ID).ToList();
tagIds.AddRange(existRel.Select(x => x.RelEngineData2ID).ToList());
tagIds = tagIds.Where(X => X != CableID).Distinct().ToList();
var tbName = ProjectSugar.TableName<ec_enginedataEntity>(ProjectId);
var typeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
var tags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tbName).
InnerJoin<ec_objecttypeEntity>((t, t2) => t.ObjectTypeID == t2.ObjectTypeID).AS<ec_objecttypeEntity>(typeTbName).
Where(t => tagIds.Contains(t.EngineDataID)).
Select((t, t2) => new { t.EngineDataID, t.TagNumber, t2.ObjectTypeName }).ToList();
if (tags.Any(x => x.ObjectTypeName == GlobalObject.objectType_OPC))
{
//OPC
var tb = ProjectSugar.TableName<ec_enginedata_pixelEntity>(ProjectId);
@ -1420,6 +1432,7 @@ Select((a, b, c) => new
}
else
{
//正常情况
existRel = existRel.Where(X => X.RelEngineData1ID != opcId.EngineDataID && X.RelEngineData2ID != opcId.EngineDataID).ToList();//排除opc的留下电缆的
}
}
@ -1444,11 +1457,11 @@ Select((a, b, c) => new
}
public class ec_enginedataEntity_2: ec_enginedataEntity
public class ec_enginedataEntity_2 : ec_enginedataEntity
{
}
public class ec_objecttypeEntity_2: ec_objecttypeEntity
public class ec_objecttypeEntity_2 : ec_objecttypeEntity
{
}
@ -1491,7 +1504,7 @@ Select((a, b, c) => new
.WhereIF(!string.IsNullOrEmpty(RelEngineData2ID), a => a.RelEngineData2ID == RelEngineData2ID)
.WhereIF(!string.IsNullOrEmpty(RelTypeName), (a, b) => b.RelTypeName == RelTypeName)
.WhereIF(!string.IsNullOrEmpty(RelType), (a, b) => b.RelType == RelType)
.Select((a, b, t1,t2,o1,o2) => new ec_enginedata_relEntity
.Select((a, b, t1, t2, o1, o2) => new ec_enginedata_relEntity
{
EngineDataRelID = a.EngineDataRelID,
RelTypeID = a.RelTypeID,
@ -1529,7 +1542,7 @@ Select((a, b, c) => new
// dataIds.Add(x.RelEngineData1ID);
// dataIds.Add(x.RelEngineData2ID);
//});
//dataIds.AddRange(list?.Select(x => x.RelEngineData1ID).Distinct());
//dataIds.AddRange(list?.Select(x => x.RelEngineData2ID).Distinct());
//dataIds = dataIds.Distinct().ToList();
@ -1633,7 +1646,7 @@ Select((a, b, c) => new
/// <param name="NeedRemove">是否移除已有的true的话基本就是确保一对一的这种rel关系</param>
/// <summary>
/// <returns></returns>
public void SaveEntitys(string ProjectId, string RelTypeID, string RelEngineData1ID, List<string> relEngineData2IDs, bool NeedRemove = false)
public void SaveEntitys(string ProjectId, string RelTypeID, string RelEngineData1ID, List<string> relEngineData2IDs, string tagPixelId, bool NeedRemove = false)
{
try
{
@ -1688,7 +1701,7 @@ Select((a, b, c) => new
}
//engineDataRelDel = engineDataRel.Except(engineDataRelExcept).ToList();
List<string> delEngineDataRelIDs = new List<string>(); //engineDataRelDel.Select(x => x.EngineDataRelID).ToList();
ec_enginedata_relService.SaveEntity(ProjectId, engineDataRelAdd, delEngineDataRelIDs);
ec_enginedata_relService.SaveEntity(ProjectId, engineDataRelAdd, delEngineDataRelIDs); //电缆在end1进行最后的保存
}
catch (Exception ex)
{
@ -1711,7 +1724,7 @@ Select((a, b, c) => new
/// <param name="RelEngineData1IDs"></param>
/// <param name="relEngineData2ID">电缆ID大概率</param>
/// <param name="NeedRemove"></param>
public void SaveEntitys(string ProjectId, string RelTypeID, List<string> RelEngineData1IDs, string relEngineData2ID, bool NeedRemove = false)
public void SaveEntitys(string ProjectId, string RelTypeID, List<string> RelEngineData1IDs, string relEngineData2ID, string tagPixelId, bool NeedRemove = false)
{
try
{
@ -1726,7 +1739,6 @@ Select((a, b, c) => new
foreach (var item in RelEngineData1IDs)
{
//判断下是否为OPC
if (NeedRemove)
{
@ -1759,6 +1771,7 @@ Select((a, b, c) => new
model.RelTypeID = RelTypeID;
model.RelEngineData1ID = item;
model.RelEngineData2ID = relEngineData2ID;
model.OPCPixel = tagPixelId;
engineDataRelAdd.Add(model);
continue;
}
@ -1775,7 +1788,7 @@ Select((a, b, c) => new
}
//engineDataRelDel = engineDataRel.Except(engineDataRelExcept).ToList();
List<string> delEngineDataRelIDs = new List<string>(); //engineDataRelDel.Select(x => x.EngineDataRelID).ToList();
ec_enginedata_relService.SaveEntity(ProjectId, engineDataRelAdd, delEngineDataRelIDs);
ec_enginedata_relService.SaveEntity(ProjectId, engineDataRelAdd, delEngineDataRelIDs);//电缆在end2进行最后的保存
}
catch (Exception ex)
{

View File

@ -35,10 +35,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <param name="keyValue">主键</param>
/// <summary>
/// <returns></returns>
void SaveEntitys(string ProjectId, string RelTypeID, string RelEngineData1ID, List<string> relEngineData2IDs, bool NeedRemove = false);
void SaveEntitys(string ProjectId, string RelTypeID, string RelEngineData1ID, List<string> relEngineData2IDs, string tagPixeId, bool NeedRemove = false);
void SaveEntitys(string ProjectId, string RelTypeID, List<string> RelEngineData1IDs, string relEngineData2ID, string tagPixeId, bool NeedRemove = false);
void SaveEntitys(string ProjectId, string RelTypeID, List<string> RelEngineData1IDs, string relEngineData2ID, bool NeedRemove = false);
#endregion

View File

@ -86,7 +86,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
if (dataType.Equals("2"))//2时才额外需要
{
listPixel = ec_enginedata_pixelBLL.GetList(queryJson).ToList();
listPixel = ec_enginedata_pixelBLL.GetList(queryJson,projectId).ToList();
listPixel = listPixel.Where(x => x.DeleteFlg != 1).ToList();
}
if (!string.IsNullOrEmpty(KeyWord))

View File

@ -116,29 +116,54 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
if (!string.IsNullOrEmpty(objectTypeID))
{
RES = RES.Where(X => objectTypeID.Split(',').ToList().Contains(X.ObjectTypeID)).ToList();
RES = RES.Where(X => objectTypeID.Split(',').Contains(X.ObjectTypeID)).ToList();
}
var propBll = new ec_propertyBLL();
var allProp = propBll.GetListRedis(ProjectId);
// 提前构建Dictionary键为PropertyID值为对应的AllProp对象
var allPropDict = allProp.ToDictionary(x => x.PropertyID);
var propGroupBll = new ec_propertygBLL();
var allGroup = propGroupBll.GetList("{ProjectId:\"" + ProjectId + "\"}");
var allGroupDict = allGroup.ToDictionary(x => x.PropertyGID);
var unitTypeBll = new ec_measuring_unittypeBLL();
var allUnitType = unitTypeBll.GetList("{ProjectId:\"" + ProjectId + "\"}");
var allUnitTypeDict = allUnitType.ToDictionary(x => x.MeasuringUnitTypeID);
var unitBll = new ec_measuring_unitBLL();
var allUnit = unitBll.GetListRedis(ProjectId);
var allUnitDict = allUnit.ToDictionary(x => x.MeasuringUnitID);
var detailBll = new ec_dataitemBLL();
var allDics = detailBll.GetList("{ProjectId:\"" + ProjectId + "\"}");
var allDetails = detailBll.GetDetailList("", "", ProjectId);
var detailsDictGrouped = allDetails.GroupBy(x => x.DataItemID).ToDictionary(g => g.Key, g => g.ToList());//按照DataItemID分组
//strSql.Append($" FROM ec_objecttypep_{ProjectEntity.ProjectIndex} t1 ");
if (isLoadExtraData)
{
foreach (var objectTypeProp in RES)
{
var t2 = allProp.FirstOrDefault(x => x.PropertyID == objectTypeProp.PropertyID);
if (t2 == null) { continue; }
var t3 = allGroup.FirstOrDefault(x => x.PropertyGID == t2.PropertyGID);
if (t3 == null) { continue; }
;
// 用TryGetValue快速查询O(1)时间)
if (allPropDict.TryGetValue(objectTypeProp.PropertyID, out var t2))
{
// 找到匹配项处理t2
}
else
{
// 未找到匹配项的处理逻辑
continue;
}
//var t2 = allProp.FirstOrDefault(x => x.PropertyID == objectTypeProp.PropertyID);
//if (t2 == null) { continue; }
if (allGroupDict.TryGetValue(t2.PropertyGID, out var t3))
{
// 找到匹配项处理t2
}
else
{
// 未找到匹配项的处理逻辑
continue;
}
//var t3 = allGroup.FirstOrDefault(x => x.PropertyGID == t2.PropertyGID);
//if (t3 == null) { continue; }
//;
objectTypeProp.PropertyName = t2.PropertyName;
objectTypeProp.PropertyNameEN = t2.PropertyNameEN;
objectTypeProp.PropertyType = t2.PropertyType;
@ -158,17 +183,26 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
objectTypeProp.PropertyGroupName = t3.PropertyGroupName;
objectTypeProp.PropertyGID = t3.PropertyGID;
if (allUnitTypeDict.TryGetValue(t2.MeasuringUnitTypeID, out var t4))
{
// 找到匹配项处理t2
objectTypeProp.MeasuringUnitTypeName = t4.MeasuringUnitTypeName;
objectTypeProp.MeasuringUnitTypeName = allUnitType.FirstOrDefault(x => x.MeasuringUnitTypeID == t2.MeasuringUnitTypeID)?.MeasuringUnitTypeName;
objectTypeProp.DefaultUnitName = allUnit.FirstOrDefault(x => x.MeasuringUnitID == t2.DefaultUnit)?.MeasuringUnitName;
}
if (allUnitDict.TryGetValue(t2.DefaultUnit, out var t5))
{
objectTypeProp.DefaultUnitName = t5.MeasuringUnitName;
}
if (!string.IsNullOrEmpty(t2.EnumData))
{
var Dic = allDics.FirstOrDefault(X => t2.EnumData == X.DataItemName || t2.EnumData == X.DataItemCode);
var Dic = allDics.FirstOrDefault(X => t2.EnumData == X.DataItemName || t2.EnumData == X.DataItemCode);//不是按照id来找
if (Dic != null)
{
foreach (var detail in allDetails.Where(x => x.DataItemID == Dic.DataItemID))
foreach (ec_dataitemdetailEntity detail in detailsDictGrouped[Dic.DataItemID])// allDetails.Where(x => x.DataItemID == Dic.DataItemID))
{
if (!string.IsNullOrEmpty(detail.DataItemNameEN) && Dic.ShowEN == 1)
{
@ -215,16 +249,19 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
var tObjectType = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
var tobjTypeAll = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(tObjectType).ToList();
var tobjTypeDict = tobjTypeAll.ToDictionary(x => x.ObjectTypeID);
foreach (var item in objectTypeID.Split(','))
{
var pObjectType = RES.Where(x => x.ObjectTypeID == item).ToList();
var tobjType = tobjTypeAll.First(x => x.ObjectTypeID == item);
var pObjectType = RES.Where(x => x.ObjectTypeID == item).ToList();//每种类型下的属性
var tobjType = tobjTypeDict[item];//每种类型的名字
// 提前提取所有PropertyName到HashSet仅需一次遍历
var propertyNames = new HashSet<string>(pObjectType.Select(x => x.PropertyName));//每种类型下的属性的名字
if (tobjType.ObjectTypeName.EndsWith("电缆"))
{
if (!pObjectType.Any(X => X.PropertyName == GlobalObject.propName_parallelCableCombineName))
if (!propertyNames.Any(X => X == GlobalObject.propName_parallelCableCombineName))
{
ec_objecttypepEntity UDF_01 = new ec_objecttypepEntity();
UDF_01.ObjectTypePID = Guid.NewGuid().ToString();
@ -236,7 +273,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
RES.Add(UDF_01);
}
if (!pObjectType.Any(X => X.PropertyName == GlobalObject.propName_parallelCableList))
if (!propertyNames.Any(X => X == GlobalObject.propName_parallelCableList))
{
ec_objecttypepEntity UDF_02 = new ec_objecttypepEntity();
UDF_02.ObjectTypePID = Guid.NewGuid().ToString();

View File

@ -217,7 +217,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//创建工程数据图元表
baseDAL.Create<ec_enginedata_pixelEntity>(sqlitePath);
//添加工程数据图元表数据
baseDAL.Add(new ec_enginedata_pixelService().GetList(queryJson).ToList(), sqlitePath);
baseDAL.Add(new ec_enginedata_pixelService().GetList(queryJson,ProjectId).ToList(), sqlitePath);
continue;
}
if (table == "ec_enginedata")

View File

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

View File

@ -33,8 +33,7 @@ namespace Learun.Cache.Redis
if (expireTime == null)
{
expireTime = TimeSpan.FromHours(1); // 如果参数为null设置为1小时
}
}
// 先从Redis缓存中获取数据
var cachedData = redisCache.StringGet<T>(cacheKey);
if (cachedData != null)

View File

@ -591,7 +591,7 @@ WHERE
}
catch (Exception ex)
{
LogInfo(baseDirectory + logFileName, tableName + " 项目表更新出现问题," + ex.Message);
LogInfo(baseDirectory + logFileName, tableName +"_" + proj.ProjectIndex + " 项目表更新出现问题," + ex.Message);
}
}
}

View File

@ -58,6 +58,7 @@ namespace DI_Electrical
GlobalObject._prismContainer.RegisterDialog<DialogSignalPropertyhisAndLogs, DialogSignalPropertyhisAndLogsViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogSignalSelect, DialogSignalSelectViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAllOutputSignal, DialogAllOutputSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogInput, DialogInputViewModel>();
GlobalObject._prismContainer.Register<IDialogService, DialogService>();

View File

@ -24,6 +24,7 @@ using Panel = Bricscad.Windows.Panel;
using GlobalObject = SWS.Commons.GlobalObject;
using SWS.Model;
using SWS.Service;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
[assembly: CommandClass(typeof(Commands))]
@ -540,6 +541,8 @@ namespace SWS.CAD
//选择的元素返回的属性信息
var ResTagInfosByPixels = new Model.ec_objecttype();
var listPropertys = new List<propertyModel>();
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
// 持续选择直到获取有效电缆
bool isValidCable = false;
@ -564,7 +567,7 @@ namespace SWS.CAD
{
// 获取句柄Handle 是字符串类型)
var handId = (cable.Handle.ToString());
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
_objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
var res = await _objectTypeService.GetTagInfosByPixels(dwgFile.Id, handId);
if (res != null)
{
@ -600,8 +603,20 @@ namespace SWS.CAD
//Thread.Sleep(2000);
if (isValidCable)
{
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
var ResTagNumberById = await _objectTypeService.GetTagNumberById(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
var ObjectTypePListBy = await _objectTypeService.GetObjectTypePListByIds(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
string CableSpecification = ObjectTypePListBy.Where(q => q.PropertyName.Equals("电缆规格")).Select(s => s.EnumDataCode).FirstOrDefault();
CableSpecification = CableSpecification.Substring(0, CableSpecification.Length - 1);
var LatestSerialNumber = await _objectTypeService.GetLatestSerialNumber(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
//获取位号的电缆属性,判断是否设置电缆规格
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber)).FirstOrDefault();
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
{
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
}
var ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
//如果配置不存在
if (ResCableEngID == null)
@ -636,6 +651,7 @@ namespace SWS.CAD
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -645,6 +661,7 @@ namespace SWS.CAD
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -653,6 +670,20 @@ namespace SWS.CAD
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -663,12 +694,9 @@ namespace SWS.CAD
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = ResTagInfosByPixels.tags.FirstOrDefault().TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -705,6 +733,7 @@ namespace SWS.CAD
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -714,6 +743,7 @@ namespace SWS.CAD
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -722,6 +752,20 @@ namespace SWS.CAD
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -732,12 +776,9 @@ namespace SWS.CAD
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = ResTagInfosByPixels.tags.FirstOrDefault().TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -849,20 +890,305 @@ namespace SWS.CAD
btnCableSinal.ToolTip = "信号预分配";
btnCableSinal.Text = "信号预分配";
btnCableSinal.ButtonStyle = RibbonButtonStyle.SmallWithText;
btnCableSinal.CommandHandler = new DelegateCommand(x =>
btnCableSinal.CommandHandler = new DelegateCommand(async x =>
{
//打开窗体
var para = new Prism.Services.Dialogs.DialogParameters();
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogSignalPredistribution), para, (RES) =>
if (GlobalObject.userInfo == null || GlobalObject.curProject == null)
{
if (RES.Result == ButtonResult.Yes)
MessageBox.Show("请先登录系统并选择项目!");
return;
}
//在SWS系统内打开且不是只读的图纸才可
var dwgName = General.GetDwgName();
var dwgFile = GlobalObject.ListDwgOpened.FirstOrDefault(a => a.Path == dwgName && a.IsReadOnly == false);
if (dwgFile == null)
{ return; }
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
//选择的元素返回的属性信息
var ResTagInfosByPixels = new Model.ec_objecttype();
var listPropertys = new List<propertyModel>();
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
// 持续选择直到获取有效电缆
bool isValidCable = false;
try
{
#region
// 创建选择选项(禁用回车确认)
PromptEntityOptions options = new PromptEntityOptions("\n请单击选择电缆: ");
options.AllowNone = false; // 禁止空选
// 执行选择(直接单击生效)
PromptEntityResult resultEntity = ed.GetEntity(options);
//WindowVisibility = System.Windows.Visibility.Hidden;
while (resultEntity.Status == PromptStatus.OK)
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
// 获取选中的电缆实体
Entity cable = tr.GetObject(resultEntity.ObjectId, OpenMode.ForRead) as Entity;
//if (cable != null&&cable.XData != null)
if (cable != null)
{
// 获取句柄Handle 是字符串类型)
var handId = (cable.Handle.ToString());
var res = await _objectTypeService.GetTagInfosByPixels(dwgFile.Id, handId);
if (res != null)
{
if (res.Count == 1)
{
var item = res[0];
var objTypeName = item.ObjectTypeName;
if (objTypeName.Contains("电缆"))
{
ResTagInfosByPixels = item;
isValidCable = true; // 校验通过
ed.WriteMessage($"\n已选择电缆:{ResTagInfosByPixels.tags.FirstOrDefault().TagNumber}");
}
}
}
}
tr.Commit();
}
if (isValidCable)
{
break;
}
else
{
ed.WriteMessage($"\n已选择电缆:");
resultEntity = ed.GetEntity(options);
}
}
else if (RES.Result == ButtonResult.No)
{ }
});
#endregion
//Thread.Sleep(2000);
if (isValidCable)
{
var ResTagNumberById = await _objectTypeService.GetTagNumberById(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
var ObjectTypePListBy = await _objectTypeService.GetObjectTypePListByIds(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
string CableSpecification = ObjectTypePListBy.Where(q => q.PropertyName.Equals("电缆规格")).Select(s => s.EnumDataCode).FirstOrDefault();
CableSpecification = CableSpecification.Substring(0, CableSpecification.Length - 1);
var LatestSerialNumber = await _objectTypeService.GetLatestSerialNumber(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
//获取位号的电缆属性,判断是否设置电缆规格
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber)).FirstOrDefault();
if(string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
{
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
}
var ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
//如果配置不存在
if (ResCableEngID == null)
{
listPropertys = new List<propertyModel>();
System.Windows.MessageBoxResult result = System.Windows.MessageBox.Show($"是否为通讯母线?", "KunHengCAD", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Question);
if (result == System.Windows.MessageBoxResult.OK)
{
listPropertys = new List<propertyModel>();
Dictionary<string, string> pulldownlist;
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "1", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, });
pulldownlist = new Dictionary<string, string>();
pulldownlist.Add("数字", "数字");
pulldownlist.Add("字母", "字母");
pulldownlist.Add("电缆对序号", "电缆对序号");
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
pulldownlist = new Dictionary<string, string>();
pulldownlist.Add("按电缆编号", "按电缆编号");
pulldownlist.Add("按电缆对编号", "按电缆对编号");
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, });
//显示属性弹窗
var ReslistPro = ShowPropertyMessage("新建" + ResTagInfosByPixels.tags.FirstOrDefault().TagNumber + "电缆配置", listPropertys);
if (ReslistPro == null || ReslistPro.Count() == 0) return;
ec_Cable ec_Cable = new ec_Cable();
ec_Cable.CableClass = "homerun";//母线
ec_Cable.Cable_Format = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault();
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
ec_CableSet.CableSetName = ReslistPro.Where(p => p.DisplayText.Equals("电缆对编号前缀")).Select(p => p.PropertyValue).FirstOrDefault() + (i + 1);
ec_CableSet.CableSetSeq = i + 1;
ec_CableSet.Wires = new List<ec_CableSetWire>();
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
string a = ReslistPro.Where(p => p.DisplayText.Equals("电芯编号前缀")).Select(p => p.PropertyValue).FirstOrDefault();//组成线号名的前缀
string Tag = "";//线号名的中间部分
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + j);
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
}
ec_Cable.Sets.Add(ec_CableSet);
}
var httpres = await _iOModuleService.CreateCableByProfile(ec_Cable);
ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
}
else
{
listPropertys = new List<propertyModel>();
Dictionary<string, string> pulldownlist;
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "10", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, });
pulldownlist = new Dictionary<string, string>();
pulldownlist.Add("数字", "数字");
pulldownlist.Add("字母", "字母");
pulldownlist.Add("电缆对序号", "电缆对序号");
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
pulldownlist = new Dictionary<string, string>();
pulldownlist.Add("按电缆编号", "按电缆编号");
pulldownlist.Add("按电缆对编号", "按电缆对编号");
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, });
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, });
//显示属性弹窗
var ReslistPro = ShowPropertyMessage("新建" + ResTagInfosByPixels.tags.FirstOrDefault().TagNumber + "电缆配置", listPropertys);
if (ReslistPro == null || ReslistPro.Count() == 0) return;
ec_Cable ec_Cable = new ec_Cable();
ec_Cable.CableClass = "conventional";//常规电缆
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
ec_CableSet.CableSetName = ReslistPro.Where(p => p.DisplayText.Equals("电缆对编号前缀")).Select(p => p.PropertyValue).FirstOrDefault() + (i + 1);
ec_CableSet.CableSetSeq = i + 1;
ec_CableSet.Wires = new List<ec_CableSetWire>();
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
string a = ReslistPro.Where(p => p.DisplayText.Equals("电芯编号前缀")).Select(p => p.PropertyValue).FirstOrDefault();//组成线号名的前缀
string Tag = "";//线号名的中间部分
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号"://所有的电缆对中的电芯一起编号
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n-1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i+1)+"-"+ n.ToString();
}
break;
case "按电缆对编号"://一个电缆对中线号按顺序编号另一个电缆对中线号重新从1开始编号
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + j);
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i+1) + "-" + (j+1).ToString();
}
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
}
ec_Cable.Sets.Add(ec_CableSet);
}
var httpres = await _iOModuleService.CreateCableByProfile(ec_Cable);
ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
}
}
if (ResCableEngID != null)
{
IntPtr cadHandle = Bricscad.ApplicationServices.Application.MainWindow.Handle;
//打开窗体
var para = new Prism.Services.Dialogs.DialogParameters();
//para.Add(GlobalObject.dialogPar.para1.ToString(), "6e2919e4-28cd-4fb6-9035-10b2ff0e30fb");
para.Add(GlobalObject.dialogPar.info.ToString(), cadHandle);
para.Add(GlobalObject.dialogPar.para1.ToString(), ResCableEngID);
para.Add(GlobalObject.dialogPar.para2.ToString(), ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogSignalPredistribution), para, (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{
}
else if (RES.Result == ButtonResult.No)
{ }
});
}
}
}
catch (System.Exception ex)
{
ed.WriteMessage($"\n错误: {ex.Message}");
}
});
btnCableSinal.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CableSinal.png");
btnCableSinal.Id = "信号预分配";

View File

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

View File

@ -1,5 +1,6 @@
using IniParser;
using Prism.Ioc;
using SWS.Commons;
using SWS.Model;
using SWS.Service;
using System;
@ -59,7 +60,7 @@ namespace SWS.CAD
if (_dwgType == null)
{
var serv = GlobalObje.container.Resolve<DataItemService>();
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingType.ToString()));
var res2 = res.Result;
return res2;
@ -83,7 +84,7 @@ namespace SWS.CAD
if (_dwgMaterialRange == null)
{
var serv = GlobalObje.container.Resolve<DataItemService>();
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialRange.ToString()));
var res2 = res.Result;
return res2;
@ -107,7 +108,7 @@ namespace SWS.CAD
if (_dwgMaterialCensus == null)
{
var serv = GlobalObje.container.Resolve<DataItemService>();
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialCensus.ToString()));
var res2 = res.Result;
return res2;
@ -131,7 +132,7 @@ namespace SWS.CAD
if (_dwgStage == null)
{
var serv = GlobalObje.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;
@ -155,7 +156,7 @@ namespace SWS.CAD
if (_dwgSystem == null)
{
var serv = GlobalObje.container.Resolve<DataItemService>();
var serv = GlobalObject.container.Resolve<DataItemService>();
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingSystem.ToString()));
var res2 = res.Result;
var res3 = DataItemDetailsToTree(res2);
@ -243,11 +244,11 @@ namespace SWS.CAD
para1,
para2
}
public static IUnityContainer container;
public static IContainerExtension _prismContainer;
public static HttpClient client;
public static loginRes userInfo;
public static List<User> Users;
//public static IUnityContainer container;
//public static IContainerExtension _prismContainer;
//public static HttpClient client;
//public static loginRes userInfo;
//public static List<User> Users;
public static bool isConfigIniCreateBySys = true;
//public static string drawingFileId;
@ -321,27 +322,27 @@ namespace SWS.CAD
}
#endregion
#region ID获取用户名称
/// <summary>
/// 根据ID获取用户名称
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static string GetUserNameById(string id)
{
if (string.IsNullOrEmpty(id))
{ return ""; }
var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id);
if (user != null)
{ return user.F_RealName; }
else
{
return "";
//user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id);
//return user != null ? user.F_RealName : "";
}
}
#endregion
//#region 根据ID获取用户名称
///// <summary>
///// 根据ID获取用户名称
///// </summary>
///// <param name="id"></param>
///// <returns></returns>
//public static string GetUserNameById(string id)
//{
// if (string.IsNullOrEmpty(id))
// { return ""; }
// var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id);
// if (user != null)
// { return user.F_RealName; }
// else
// {
// return "";
// //user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id);
// //return user != null ? user.F_RealName : "";
// }
//}
//#endregion
#region

View File

@ -167,6 +167,7 @@
<Compile Include="Event\propertyChangeEvent.cs" />
<Compile Include="Event\IORelationEvent.cs" />
<Compile Include="Event\tagChangeEvent.cs" />
<Compile Include="Event\ScrollToItemEvent.cs" />
<Compile Include="Event\treeNodeChangeEvent.cs" />
<Compile Include="Event\SelectProjectEvent.cs" />
<Compile Include="Helper\Converter\ComboBoxFilterConverter.cs" />

View File

@ -55,6 +55,7 @@ namespace SWS.CAD
GlobalObject._prismContainer.RegisterDialog<DialogPublishRecord, DialogPublishRecordViewModel>();
GlobalObject._prismContainer.RegisterDialog<SWS.WPF.Views.DialogSignalManagement,SWS.WPF.ViewModels.DialogSignalManagementViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAllOutputSignal, DialogAllOutputSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogOperateRecord, DialogOperateRecordViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogPropertyHistory, DialogPropertyHistoryViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogSignalNotice, DialogSignalNoticeViewModel>();

View File

@ -10,6 +10,7 @@ using System.Windows.Threading;
using Bricscad.ApplicationServices;
using Bricscad.EditorInput;
using OfficeOpenXml;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
using Prism.Events;
using Prism.Ioc;
using Prism.Services.Dialogs;
@ -56,6 +57,8 @@ namespace SWS.CAD.ViewModels
RaisePropertyChanged(nameof(SelectedTreeNode));
UpdateChannelInfos();
var path = FindNodePath(PanelTreels, _SelectedTreeNode);
_eventAggregator.GetEvent<ScrollToItemEvent>().Publish(path);
}
}
@ -279,7 +282,7 @@ namespace SWS.CAD.ViewModels
{
ChannelInfo c = new ChannelInfo();
//电缆位号,电缆对,电缆线号,极性
foreach (var Term in child.Terms)
foreach (var Term in child.Terms.OrderBy(p => p.Term_Seq).ToList())
{
index++;
c.Index.Add(index.ToString());
@ -302,7 +305,8 @@ namespace SWS.CAD.ViewModels
c.Polaritys.Add(new ec_WireTerminal());
}
}
c.Terms.AddRange(child.Terms);
//端子号
c.Terms.AddRange(child.Terms.OrderBy(p => p.Term_Seq).ToList());
//关联信号
c.Signal = child.Signal;
if (child.Signal != null)
@ -333,14 +337,14 @@ namespace SWS.CAD.ViewModels
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
System.Windows.MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
finally
{
IsBusy = false;
}
}
#endregion
@ -523,6 +527,44 @@ namespace SWS.CAD.ViewModels
}
#endregion
#region
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
{
List<string> path = new List<string>();
FindNodePathRecursive(nodes, targetNode, path);
return path;
}
private bool FindNodePathRecursive(IEnumerable<TreeModel> nodes, TreeModel targetNode, List<string> currentPath)
{
foreach (var node in nodes)
{
currentPath.Add(node.Text);
if (node == targetNode) return true; // 找到目标节点返回True并结束搜索
if (node.ChildNodes.Count > 0 && FindNodePathRecursive(node.ChildNodes, targetNode, currentPath))
return true; // 在子节点中继续搜索并找到目标节点返回True并结束搜索
currentPath.RemoveAt(currentPath.Count - 1); // 回溯,尝试下一个兄弟节点或父节点的其他兄弟节点
}
return false; // 没有找到目标节点返回False
}
#endregion
#region id查找项
private TreeModel FindTreeModelById(IEnumerable<TreeModel> TreeModels, string id)
{
foreach (var Tree in TreeModels)
{
if (Tree.ID == id)
return Tree;
var foundInChildren = FindTreeModelById(Tree.ChildNodes, id);
if (foundInChildren != null)
return foundInChildren;
}
return null;
}
#endregion
#region
public ICommand MouseRightCmd => new DelegateCommand(MouseRight_Click);
@ -685,13 +727,14 @@ namespace SWS.CAD.ViewModels
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
};
var httpres = await _dataItemService.SaveDetailForm(ent);
if (httpres != null)
var httpres = await _dataItemService.SaveDetailForm(ent) as learunHttpRes<ec_dataitemdetail>;
if (httpres.code != 200)
{
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
PanelTreels.Clear();
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
SelectedTreeNode = FindNodeByNodeId(PanelTreels, httpres.data.DataItemID);
}
else if (RES.Result == ButtonResult.No)
{ }
@ -881,13 +924,15 @@ namespace SWS.CAD.ViewModels
}
#endregion
var httpres = await _iOModuleService.CreatePanelStripByProfile(e);
if (httpres != null)
var httpres = await _iOModuleService.CreatePanelStripByProfile(e) as learunHttpRes<ec_PanelStrip>;
if (httpres.code != 200)
{
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
PanelTreels.Clear();
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
SelectedTreeNode = FindTreeModelById(PanelTreels, httpres.data.StripID);
}
else if (RES.Result == ButtonResult.No)
{ }
@ -940,13 +985,14 @@ namespace SWS.CAD.ViewModels
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
};
var httpres = await _dataItemService.SaveDetailForm(ent);
if (httpres != null)
var httpres = await _dataItemService.SaveDetailForm(ent) as learunHttpRes<ec_dataitemdetail>;
if (httpres.code != 200)
{
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
PanelTreels.Clear();
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
SelectedTreeNode = FindNodeByNodeId(PanelTreels, httpres.info);
}
else if (RES.Result == ButtonResult.No)
{ }
@ -974,6 +1020,7 @@ namespace SWS.CAD.ViewModels
{
if (RES.Result == ButtonResult.Yes)
{
var tempID = SelectedTreeNode.ID;
var listPro = RES.Parameters.GetValue<ObservableCollection<propertyModel>>(GlobalObject.dialogPar.para1.ToString());
ec_PanelStrip ent = new ec_PanelStrip()
@ -985,12 +1032,13 @@ namespace SWS.CAD.ViewModels
StripID = StripIDValue,
};
var httpres = await _iOModuleService.SavePanelStrip(ent);
if (httpres != null)
if (httpres!= null)
{
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
PanelTreels.Clear();
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
SelectedTreeNode = FindNodeByNodeId(PanelTreels, tempID);
}
else if (RES.Result == ButtonResult.No)
{ }
@ -1017,7 +1065,15 @@ namespace SWS.CAD.ViewModels
MessageBoxResult result = System.Windows.MessageBox.Show($"确定删除[{SelectedTreeNode.Text}]节点以及子节点吗", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.OK)
{
var tempParentId = SelectedTreeNode.parentId;
var httpres = await _iOModuleService.DeletePanelStrip(SelectedTreeNode.ID);
if (httpres!=null)
{
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
}
PanelTreels.Clear();
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
SelectedTreeNode = FindTreeModelById(PanelTreels, tempParentId);
}
}
return;
@ -1069,7 +1125,8 @@ namespace SWS.CAD.ViewModels
//获取位号的电缆属性,判断是否设置电缆规格
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(selectTagNumberOB.TagNumber);
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(selectTagNumberOB.TagNumber)).FirstOrDefault();
if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
{
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
@ -1108,6 +1165,7 @@ namespace SWS.CAD.ViewModels
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -1117,6 +1175,7 @@ namespace SWS.CAD.ViewModels
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -1125,6 +1184,20 @@ namespace SWS.CAD.ViewModels
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -1135,12 +1208,9 @@ namespace SWS.CAD.ViewModels
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = selectTagNumberOB.TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -1177,6 +1247,7 @@ namespace SWS.CAD.ViewModels
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -1186,6 +1257,7 @@ namespace SWS.CAD.ViewModels
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -1194,6 +1266,20 @@ namespace SWS.CAD.ViewModels
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -1204,12 +1290,9 @@ namespace SWS.CAD.ViewModels
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = selectTagNumberOB.TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -1502,11 +1585,12 @@ namespace SWS.CAD.ViewModels
//获取位号的电缆属性,判断是否设置电缆规格
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(resTagNumberListByPixels.TagNumber);
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(resTagNumberListByPixels.TagNumber)).FirstOrDefault();
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
//{
// System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
{
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
//}
}
//获取电缆的配置,没有则创建新配置
var CableBy = await _iOModuleService.GetCableByEngID(resTagNumberListByPixels?.EngineDataID);
if (CableBy == null)
@ -1540,6 +1624,7 @@ namespace SWS.CAD.ViewModels
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -1549,6 +1634,7 @@ namespace SWS.CAD.ViewModels
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -1557,6 +1643,20 @@ namespace SWS.CAD.ViewModels
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -1567,12 +1667,9 @@ namespace SWS.CAD.ViewModels
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = resTagNumberListByPixels.TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -1609,6 +1706,7 @@ namespace SWS.CAD.ViewModels
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
ec_Cable.Sets = new List<ec_CableSet>();
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
int n = 0;
for (int i = 0; i < CableSetCount; i++)
{
ec_CableSet ec_CableSet = new ec_CableSet();
@ -1618,6 +1716,7 @@ namespace SWS.CAD.ViewModels
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
for (int j = 0; j < WireCount; j++)
{
n++;
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
ec_CableSetWire.SetLevel = j + 1;
@ -1626,6 +1725,20 @@ namespace SWS.CAD.ViewModels
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
{
case "按电缆编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = n.ToString();
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
{
Tag = Tag + (char)('A' + (n - 1));
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1) + "-" + n.ToString();
}
break;
case "按电缆对编号":
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
{
Tag = (j + 1).ToString();
@ -1636,12 +1749,9 @@ namespace SWS.CAD.ViewModels
}
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
{
Tag = (i + 1).ToString();
Tag = (i + 1) + "-" + (j + 1).ToString();
}
break;
case "按电缆对编号":
a = resTagNumberListByPixels.TagNumber;
break;
}
ec_CableSetWire.Wire_Tag = a + Tag;
ec_CableSet.Wires.Add(ec_CableSetWire);
@ -2055,7 +2165,7 @@ namespace SWS.CAD.ViewModels
if (result == MessageBoxResult.OK)
{
var httpres = await _iOModuleService.DeletePanelChannel(SelectedChannelInfo.ChannelID);
if (httpres!=null)
if (httpres != null)
{
System.Windows.MessageBox.Show(httpres, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
@ -2531,8 +2641,8 @@ namespace SWS.CAD.ViewModels
ent.Signals = new List<SWS.Model.ec_Wire_Group>();
ent.Signals.Add(SelectedChannelInfo.Signal);
//解除信号
var data = await _wireGroupService.SaveSignals(ent);
if (data != null)
var data = await _wireGroupService.SaveSignals(ent) as learunHttpRes<List<ec_Wire_Group>>;
if (data.code ==200)
{
ChannelInfos.Clear();
UpdateChannelInfos();

View File

@ -1,29 +1,208 @@

using Prism.Events;
using Prism.Ioc;
using Prism.Services.Dialogs;
using SWS.CAD.Event;
using SWS.CAD.ViewModels.myViewModelBase;
using SWS.CAD.Views;
using SWS.CAD.Views.CustomControl;
using SWS.Commons;
using SWS.Model;
using SWS.Service;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using Telerik.Windows.Controls;
using Unity;
using DelegateCommand = Prism.Commands.DelegateCommand;
namespace SWS.CAD.ViewModels
{
public class DialogSignalPredistributionViewModel : DialogBase, IDialogAware
{
private string objectTypeId;
#region
private ObservableCollection<Model.TreeModel> _PanelTreels = new ObservableCollection<Model.TreeModel>();
/// <summary>
/// 新建位号
/// 页面左侧树形结构数据
/// </summary>
public ICommand Command_NewTagNumber { get; set; }
public ObservableCollection<Model.TreeModel> PanelTreels
{
get { return _PanelTreels; }
set { _PanelTreels = value; RaisePropertyChanged(nameof(PanelTreels)); }
}
private Model.TreeModel _SelectedTreeNode;
/// <summary>
/// 当前选中的树形节点
/// </summary>
public Model.TreeModel SelectedTreeNode
{
get { return _SelectedTreeNode; }
set
{
_SelectedTreeNode = value;
RaisePropertyChanged(nameof(SelectedTreeNode));
var path= FindNodePath(PanelTreels, _SelectedTreeNode);
_eventAggregator.GetEvent<ScrollToItemEvent>().Publish(path);
}
}
private ObservableCollection<SignalPredistributionInfo> _SignalPredistributionInfos = new ObservableCollection<SignalPredistributionInfo>();
/// <summary>
/// 表格数据
/// </summary>
public ObservableCollection<SignalPredistributionInfo> SignalPredistributionInfos
{
get { return _SignalPredistributionInfos; }
set
{
_SignalPredistributionInfos = value;
RaisePropertyChanged(nameof(SignalPredistributionInfos));
}
}
private string _SelectedOption1;
/// <summary>
/// 是否通讯母线
/// </summary>
public string SelectedOption1
{
get { return _SelectedOption1; }
set
{
_SelectedOption1 = value;
RaisePropertyChanged(nameof(SelectedOption1));
}
}
private string _SelectedOption2;
/// <summary>
/// 选择的信号类型
/// </summary>
public string SelectedOption2
{
get { return _SelectedOption2; }
set
{
_SelectedOption2 = value;
SignalColumnName = value;
RaisePropertyChanged(nameof(SelectedOption2));
}
}
private string _SignalColumnName;
/// <summary>
/// 信号类型列的列名
/// </summary>
public string SignalColumnName
{
get { return _SignalColumnName; }
set
{
_SignalColumnName = value;
RaisePropertyChanged(nameof(SignalColumnName));
if (value.Equals("Digital"))
{
SignalTypeColumn = new ObservableCollection<string>() { "无公共端接线(断开报警NC)", "无公共端接线(闭合报警NO)", "带公共端接线(断开报警NC)", "带公共端接线(闭合报警NO)" };
}
else if (value.Equals("4-20mA"))
{
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
}
else if (value.Equals("-10V-10V"))
{
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
}
else if (value.Equals("PT100"))
{
SignalTypeColumn = new ObservableCollection<string>() { "量程100", "量程150", "量程200", "量程600" };
}
else if (value.Equals("Pulse"))
{
SignalTypeColumn = new ObservableCollection<string>() { "脉冲信号" };
}
}
}
private List<string> _CommunicationFormats = new List<string>() { "RS485", "RS482", "TCP/IP", "MQTT" };
/// <summary>
/// 通讯格式集合
/// </summary>
public List<string> CommunicationFormats
{
get { return _CommunicationFormats; }
set
{
_CommunicationFormats = value;
RaisePropertyChanged(nameof(CommunicationFormats));
}
}
private string _CommunicationFormat = "RS485";
/// <summary>
/// 通讯格式
/// </summary>
public string CommunicationFormat
{
get { return _CommunicationFormat; }
set
{
_CommunicationFormat = value;
RaisePropertyChanged(nameof(CommunicationFormat));
}
}
private ObservableCollection<string> _SignalTypeColumn;
/// <summary>
/// 信号类型列的下拉列表
/// </summary>
public ObservableCollection<string> SignalTypeColumn
{
get { return _SignalTypeColumn; }
set
{
_SignalTypeColumn = value;
RaisePropertyChanged(nameof(SignalTypeColumn));
if (SignalPredistributionInfos != null)
{
foreach (var item in SignalPredistributionInfos)
{
item.SignalType = _SignalTypeColumn.FirstOrDefault();
}
}
}
}
private List<string> _InorOuts = new List<string>() { "输出", "输入" };
/// <summary>
/// 输入/输出列的下拉列表
/// </summary>
public List<string> InorOuts
{
get { return _InorOuts; }
set
{
_InorOuts = value;
RaisePropertyChanged(nameof(InorOuts));
}
}
#endregion
IOModuleService _iOModuleService;
IEventAggregator _eventAggregator;
public DialogSignalPredistributionViewModel()
{
title = "电缆信号预分配";
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
}
public string Title => "";
@ -38,16 +217,157 @@ namespace SWS.CAD.ViewModels
{
}
public void OnDialogOpened(IDialogParameters parameters)
private ec_Cable CableBy;
public async void OnDialogOpened(IDialogParameters parameters)
{
//listTags = parameters.GetValue<ObservableCollection<KeyValueModel>>(GlobalObject.dialogPar.info.ToString());
objectTypeId = parameters.GetValue<string>(GlobalObject.dialogPar.id.ToString());
title = $"电缆信号({parameters.GetValue<string>(GlobalObject.dialogPar.para2.ToString())})预分配";
//树形结构数据
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
//电缆信息
CableBy = parameters.GetValue<ec_Cable>(GlobalObject.dialogPar.para1.ToString());
//是否母线
if (CableBy.CableClass.Equals("homerun"))
{
SelectedOption1 = "是";
}
else if (CableBy.CableClass.Equals("conventional") || CableBy.CableClass.Equals(""))
{
SelectedOption1 = "否";
}
//设置默认信号类型
if (string.IsNullOrEmpty(CableBy.PreAssignIOType))
{
SelectedOption2 = "Digital";
}
else
{
SelectedOption2 = CableBy.PreAssignIOType;
}
//设置表格数据
int index = 0;
foreach (var Set in CableBy.Sets)
{
SignalPredistributionInfo predistributionInfo = new SignalPredistributionInfo();
predistributionInfo.CablePair = Set.CableSetName;
foreach (var Wire in Set.Wires)
{
index++;
predistributionInfo.Index.Add(index.ToString());
predistributionInfo.CableWires.Add(Wire);
predistributionInfo.Polaritys.Add(Wire);
}
if (string.IsNullOrEmpty(Set.PreAssignIOTypeDetail))
{
predistributionInfo.SignalType = SignalTypeColumn.FirstOrDefault();
}
else
{
predistributionInfo.SignalType = Set.PreAssignIOTypeDetail;
}
predistributionInfo.ChineseDescription = Set.PreAssignGroup_Desc;
predistributionInfo.EnglishDescription = Set.PreAssignGroup_Desc_EN;
if (string.IsNullOrEmpty(Set.PreAssignInOrOut))
{
predistributionInfo.InorOut = InorOuts.FirstOrDefault();
}
else
{
predistributionInfo.InorOut = Set.PreAssignInOrOut;
}
predistributionInfo.SensorCode = Set.PreAssignSensorCode;
SignalPredistributionInfos.Add(predistributionInfo);
}
//是否预关联,有则选中节点
foreach (var Panel in PanelTreels)
{
if (!string.IsNullOrEmpty(Panel.ID))
{
if (Panel.ID.Equals(CableBy.PanelID))
{
SelectedTreeNode = Panel;
break;
}
}
foreach (var Child in Panel.ChildNodes)
{
if (!string.IsNullOrEmpty(Child.ID))
{
if (Child.ID.Equals(CableBy.PanelID))
{
SelectedTreeNode = Child;
break;
}
}
}
}
}
public override void ExecuteOKCommandAsync(object para)
public override async void ExecuteOKCommandAsync(object para)
{
//创建SaveCable接口实例
ec_Cable newCable = new ec_Cable();
if (SelectedOption1.Equals("是"))
{
newCable.CableClass = "homerun";
newCable.PreAssignIOType = CommunicationFormat;
}
else
{
newCable.CableClass = "conventional";
newCable.PreAssignIOType = SelectedOption2;
}
newCable.CableID = CableBy.CableID;
newCable.EngineerDataID = CableBy.EngineerDataID;
if (SelectedTreeNode != null)
{
newCable.PanelID = SelectedTreeNode.ID;
}
else
{
MessageBox.Show("请选择系统柜!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
newCable.UpdateUserID = GlobalObject.userInfo.userId;
newCable.Sets = new List<ec_CableSet>();
foreach (var CableBySet in CableBy.Sets)
{
ec_CableSet newCableSet = new ec_CableSet();
newCableSet.CableSetID = CableBySet.CableSetID;
newCableSet.CableSetName = CableBySet.CableSetName;
newCableSet.CableSetSeq = CableBySet.CableSetSeq;
newCableSet.IsConned = CableBySet.IsConned;
newCableSet.PreAssignGroup_Desc = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).ChineseDescription;
newCableSet.PreAssignGroup_Desc_EN = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).EnglishDescription;
newCableSet.PreAssignIOTypeDetail = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).SignalType;
newCableSet.PreAssignInOrOut = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).InorOut;
newCableSet.PreAssignSensorCode = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).SensorCode;
newCableSet.Wires = new List<ec_CableSetWire>();
foreach (var wire in CableBySet.Wires)
{
ec_CableSetWire newWire = new ec_CableSetWire();
newWire.Polarity = wire.Polarity;
newWire.SetLevel = 0;
newWire.WireID = wire.WireID;
newWire.Wire_Tag = wire.Wire_Tag;
newWire.Wire_Color_ID = wire.Wire_Color_ID;
newWire.PreAssignChannelTermNo = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).CableWires.FirstOrDefault(c => c.Wire_Tag.Equals(wire.Wire_Tag)).PreAssignChannelTermNo;
newCableSet.Wires.Add(newWire);
}
newCable.Sets.Add(newCableSet);
}
var httpres = await _iOModuleService.SaveCable(newCable);
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
//res.Add(GlobalObject.dialogPar.info.ToString(), TagNumber);
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
@ -65,8 +385,199 @@ namespace SWS.CAD.ViewModels
}
this.Dispose();
}
#region
public ICommand ButtonCmd => new DelegateCommand(Button_Click);
/// <summary>
/// 页面左侧按钮
/// </summary>
/// <param name="parameter"></param>
public virtual async void Button_Click(object parameter)
{
#region
if (parameter.ToString().Equals("清除配置"))
{
MessageBoxResult result = MessageBox.Show($"确定删除“{ CableBy.TagNumber}”电缆配置?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.OK)
{
var httpres = await _iOModuleService.DeleteCableProfile(CableBy.CableID);
if (httpres == null)
{
RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
this.Dispose();
}
}
return;
}
#endregion
#region
if (parameter.ToString().Equals("指定中英文"))
{
//SelectedTreeNode = PanelTreels[2].ChildNodes.LastOrDefault();
return;
}
#endregion
}
#region
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
{
List<string> path = new List<string>();
FindNodePathRecursive(nodes, targetNode, path);
return path;
}
private bool FindNodePathRecursive(IEnumerable<TreeModel> nodes, TreeModel targetNode, List<string> currentPath)
{
foreach (var node in nodes)
{
currentPath.Add(node.Text);
if (node == targetNode) return true; // 找到目标节点返回True并结束搜索
if (node.ChildNodes.Count > 0 && FindNodePathRecursive(node.ChildNodes, targetNode, currentPath))
return true; // 在子节点中继续搜索并找到目标节点返回True并结束搜索
currentPath.RemoveAt(currentPath.Count - 1); // 回溯,尝试下一个兄弟节点或父节点的其他兄弟节点
}
return false; // 没有找到目标节点返回False
}
#endregion
#endregion
}
public class SignalPredistributionInfo : DialogBase
{
#region
private ObservableCollection<string> _Index = new ObservableCollection<string>();
/// <summary>
/// 序号集合
/// </summary>
public ObservableCollection<string> Index
{
get { return _Index; }
set { _Index = value; }
}
private string _CablePair;
/// <summary>
/// 电缆对
/// </summary>
public string CablePair
{
get { return _CablePair; }
set { _CablePair = value; }
}
private ObservableCollection<ec_CableSetWire> _CableWires = new ObservableCollection<ec_CableSetWire>();
/// <summary>
/// 电缆线号
/// </summary>
public ObservableCollection<ec_CableSetWire> CableWires
{
get { return _CableWires; }
set { _CableWires = value; }
}
private ObservableCollection<ec_CableSetWire> _Polaritys = new ObservableCollection<ec_CableSetWire>();
/// <summary>
/// 极性
/// </summary>
public ObservableCollection<ec_CableSetWire> Polaritys
{
get { return _Polaritys; }
set
{
_Polaritys = value;
RaisePropertyChanged(nameof(Polaritys));
}
}
private string _SignalType;
/// <summary>
/// 信号类型
/// </summary>
public string SignalType
{
get { return _SignalType; }
set
{
_SignalType = value;
RaisePropertyChanged(nameof(SignalType));
}
}
private string _ChineseDescription;
/// <summary>
/// 中文描述
/// </summary>
public string ChineseDescription
{
get { return _ChineseDescription; }
set
{
_ChineseDescription = value;
RaisePropertyChanged(nameof(ChineseDescription));
}
}
private string _EnglishDescription;
/// <summary>
/// 英文描述
/// </summary>
public string EnglishDescription
{
get { return _EnglishDescription; }
set
{
_EnglishDescription = value;
RaisePropertyChanged(nameof(EnglishDescription));
}
}
private string _InorOut;
/// <summary>
/// 输入/输出
/// </summary>
public string InorOut
{
get { return _InorOut; }
set
{
_InorOut = value;
RaisePropertyChanged(nameof(InorOut));
}
}
private string _SensorCode;
/// <summary>
/// 传感器编号
/// </summary>
public string SensorCode
{
get { return _SensorCode; }
set
{
_SensorCode = value;
RaisePropertyChanged(nameof(SensorCode));
}
}
private ObservableCollection<ec_PanelStripTerm> _Terms = new ObservableCollection<ec_PanelStripTerm>();
/// <summary>
/// 端子号集合
/// </summary>
public ObservableCollection<ec_PanelStripTerm> Terms
{
get { return _Terms; }
set { _Terms = value; }
}
#endregion
}
}

View File

@ -248,7 +248,6 @@
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate1">
<!-- 使用ItemsControl垂直显示多个值 -->
<ItemsControl ItemsSource="{Binding Index}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@ -265,7 +264,6 @@
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate2">
<!-- 使用ItemsControl垂直显示多个值 -->
<ItemsControl ItemsSource="{Binding Terms}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@ -283,7 +281,6 @@
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate2">
<!-- 使用ItemsControl垂直显示多个值 -->
<ItemsControl ItemsSource="{Binding Terms}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@ -503,6 +500,7 @@
Margin="5" telerik:StyleManager.Theme="Office_Blue" AllowDrop="True"
AutoScrollToSelectedItem="True"
IsVirtualizing="True"
telerik:TextSearch.TextPath="Text"
>
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">

View File

@ -1,12 +1,17 @@

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Prism.Events;
using SWS.CAD.Event;
using SWS.CAD.ViewModels;
using SWS.Commons;
using Telerik.Windows.Controls;
using Unity;
namespace SWS.CAD.Views.Dialog
{
@ -15,10 +20,14 @@ namespace SWS.CAD.Views.Dialog
/// </summary>
public partial class DialogIODistribution : UserControl
{
IEventAggregator _eventAggregator;
public DialogIODistribution()
{
InitializeComponent();
DataContext = new DialogIODistributionViewModel();
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
_eventAggregator.GetEvent<ScrollToItemEvent>().Subscribe(ScrollToSelectedItem, ThreadOption.UIThread, true);
}
private void RadTreeView_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
@ -83,5 +92,13 @@ namespace SWS.CAD.Views.Dialog
return source as T;
}
// 滚动到选中项
private void ScrollToSelectedItem(object path)
{
var pathls = path as List<string>;
var ph = string.Join("\\", pathls);
treeView1.BringPathIntoView(ph);
}
}
}

View File

@ -6,8 +6,9 @@
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
Width="1000" Height="800"
Width="1000" Height="790"
mc:Ignorable="d" >
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
@ -27,11 +28,246 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SWS.WPF;component/Style/CustomStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- 转换器 -->
<cvt:RadioButtonValueConverter x:Key="RadioButtonValueCvt" />
<!-- GroupBox显示隐藏 -->
<Style x:Key="SecondGroupStyle1" TargetType="GroupBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=RadioButton1}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsChecked, ElementName=RadioButton1}" Value="False">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="SecondGroupStyle2" TargetType="GroupBox">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=RadioButton1}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsChecked, ElementName=RadioButton1}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
<!-- 树结构展开按钮样式 -->
<Style x:Key="ExpanderStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="IsEnabled" Value="True" />
<Setter Property="IsTabStop" Value="True" />
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<Grid x:Name="ButtonOver" Opacity="0" Margin="0,4,0,0"
HorizontalAlignment="Right" VerticalAlignment="Top"
Width="16" Height="16">
<Rectangle Stroke="#FF027BA6" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Width="Auto" Height="Auto"
RadiusX="3" RadiusY="3">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF00BCFF" Offset="0" />
<GradientStop Color="#FF027BA6" Offset="1" />
<GradientStop Color="#FF00A5E0" Offset="0.5" />
<GradientStop Color="#FF005674" Offset="0.501" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name="CollapsedVisualOver"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="2" Height="8" RadiusX="0" RadiusY="0"
Fill="#FFFFFFFF" Margin="7,4,0,0" />
<Rectangle RadiusX="0" RadiusY="0" Fill="#FFFFFFFF"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="8" Height="2" Margin="4,7,0,0" />
</Grid>
<Grid x:Name="Button" Margin="0,6,5.5,0" HorizontalAlignment="Right"
VerticalAlignment="Top" Width="10" Height="10">
<Rectangle Stroke="#ffc7defc" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Width="Auto" Height="Auto"
RadiusX="1" RadiusY="1" Fill="#ffc7defc">
</Rectangle>
<Rectangle x:Name="CollapsedVisual" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="2" Height="6" RadiusX="0"
RadiusY="0" Fill="#FF3C6AA3" Margin="4,2,0,0" />
<Rectangle RadiusX="0" RadiusY="0" Fill="#FF3C6AA3"
HorizontalAlignment="Left" Margin="2,3.5,0,0"
VerticalAlignment="Top" Width="6" Height="2" />
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="(UIElement.Opacity)" To="0"/>
<DoubleAnimation Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="(UIElement.Opacity)" To="0"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
<DoubleAnimation Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 树结构节点默认展开样式设置 -->
<Style x:Key="ExpandedTreeViewItemStyle" TargetType="telerik:RadTreeViewItem">
<Setter Property="IsExpanded" Value="True"/>
</Style>
<!-- GridViewCell样式 -->
<Style x:Key="CellTyle1" TargetType="telerik:GridViewCell" >
<Setter Property="Background" Value="#F8F9F1" />
</Style>
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate1">
<ItemsControl ItemsSource="{Binding Index}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
<TextBlock Text="{Binding}" TextAlignment="Center" Padding="4,2" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate1">
<ItemsControl ItemsSource="{Binding Index}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding}" TextAlignment="Center" Padding="4,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate2">
<ItemsControl ItemsSource="{Binding CableWires}">
<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 PreAssignChannelTermNo}" TextAlignment="Center" Padding="4,2" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate2">
<ItemsControl ItemsSource="{Binding CableWires}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding PreAssignChannelTermNo}" TextAlignment="Center" Padding="4,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate3">
<ItemsControl ItemsSource="{Binding CableWires}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
<TextBlock Text="{Binding Wire_Tag}" TextAlignment="Center" Padding="4,2" Width="auto"/>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate3">
<ItemsControl ItemsSource="{Binding CableWires}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Wire_Tag}" TextAlignment="Center" Padding="4,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<!-- 使用ItemsControl垂直显示多个值 -->
<DataTemplate x:Key="CellTemplate4">
<ItemsControl ItemsSource="{Binding Polaritys}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
<TextBlock Text="{Binding Polarity}" TextAlignment="Center" Padding="4,2" />
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
<DataTemplate x:Key="CellEditTemplate4">
<ItemsControl ItemsSource="{Binding Polaritys}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBox Text="{Binding Polarity}" TextAlignment="Center" Padding="4,2" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
<StackPanel Background="#f0f0f0">
<CustomControl:customWindowTitleBar x:Name="titleBar" />
<StackPanel Grid.Row="1" Orientation="Horizontal">
<GroupBox Margin="5,10,5,5"
@ -39,78 +275,197 @@
Header="通讯信号">
<StackPanel Orientation="Horizontal">
<TextBlock Text="是否通讯母线" Margin="5"/>
<RadioButton Content="是" GroupName="OptionGroup1" Margin="5"/>
<RadioButton x:Name="RadioButton1" Content="否" GroupName="OptionGroup1" Margin="5"/>
<TextBlock Text="通讯格式" Margin="5"/>
<ComboBox />
<RadioButton x:Name="RadioButton1"
Content="是"
GroupName="OptionGroup1"
Margin="5"
IsChecked="{Binding SelectedOption1 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=是}"/>
<RadioButton x:Name="RadioButton2"
Content="否"
GroupName="OptionGroup1"
Margin="5"
IsChecked="{Binding SelectedOption1 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=否}"/>
</StackPanel>
</GroupBox>
<GroupBox Margin="5,0,5,5"
VerticalAlignment="Bottom"
Header="信号类型">
Header="信号类型"
Style="{StaticResource SecondGroupStyle1}">
<StackPanel Orientation="Horizontal">
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="Digital" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="4-20mA" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="-10V-10V" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="PT100" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="Pulse" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=Digital}"
Content="Digital" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=4-20mA}"
Content="4-20mA" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=-10V-10V}"
Content="-10V-10V" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=PT100}"
Content="PT100" GroupName="OptionGroup2" Margin="5"/>
<RadioButton IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=Pulse}"
Content="Pulse" GroupName="OptionGroup2" Margin="5"/>
</StackPanel>
</GroupBox>
<GroupBox Margin="5,0,5,5"
VerticalAlignment="Bottom"
Header="通讯格式"
Style="{StaticResource SecondGroupStyle2}">
<StackPanel Orientation="Horizontal">
<RadioButton IsChecked="{Binding CommunicationFormat ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=RS485}"
Content="RS485" GroupName="OptionGroup3" Margin="5"/>
<RadioButton IsChecked="{Binding CommunicationFormat ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=RS482}"
Content="RS482" GroupName="OptionGroup3" Margin="5"/>
<RadioButton IsChecked="{Binding CommunicationFormat ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=TCP/IP}"
Content="TCP/IP" GroupName="OptionGroup3" Margin="5"/>
<RadioButton IsChecked="{Binding CommunicationFormat ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=MQTT}"
Content="MQTT" GroupName="OptionGroup3" Margin="5"/>
</StackPanel>
</GroupBox>
</StackPanel>
<GroupBox Margin="5,0,5,5"
Grid.Row="2"
VerticalAlignment="Bottom"
Header="电缆配置信息">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel>
<Border BorderThickness="0 0 0 1" Margin="10,0,0,0">
<TextBlock Text="选择系统柜" Foreground="Black" />
</Border>
<!-- 左侧树形结构 -->
<Border>
<telerik:RadTreeView x:Name="treeView1"
Height="660"
Background="White"
IsLineEnabled="True"
ItemsSource="{Binding PanelTreels}"
SelectedItem="{Binding SelectedTreeNode,Mode=TwoWay}"
Margin="5"
telerik:StyleManager.Theme="Office_Blue"
AllowDrop="True"
AutoScrollToSelectedItem="True"
IsVirtualizing="True"
>
<telerik:RadTreeView.ItemTemplate>
<StackPanel Orientation="Horizontal" Grid.Row="2">
<!-- 左侧树形结构 -->
<GroupBox Margin="5,0,5,0"
Height="auto"
Header="选择该电缆预分配系统柜">
<telerik:RadTreeView x:Name="treeView1"
Height="620"
Width="200"
Background="White"
IsLineEnabled="True"
ItemContainerStyle="{StaticResource ExpandedTreeViewItemStyle}"
ExpanderStyle="{StaticResource ExpanderStyle}"
ItemsSource="{Binding PanelTreels}"
SelectedItem="{Binding SelectedTreeNode,Mode=TwoWay}"
telerik:StyleManager.Theme="Office_Blue"
AllowDrop="True"
AutoScrollToSelectedItem="True"
IsVirtualizing="True"
telerik:TextSearch.TextPath="Text"
>
<telerik:RadTreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
<TextBlock Text="{Binding Text}">
</TextBlock>
<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
<TextBlock Text="{Binding Text}">
</TextBlock>
<TextBlock Text="{Binding Text}"/>
<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
<TextBlock Text="{Binding Text}"/>
<HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding PanelTreels}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}"/>
<TextBlock Text=" (" />
<TextBlock Text="{Binding NodeExtData.ChannelsSpared}" FontWeight="Bold" />
<TextBlock Text=")" />
</StackPanel>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding PanelTreels}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Text}"/>
<TextBlock Text=" (" />
<TextBlock Text="{Binding NodeExtData.ChannelsSpared}" FontWeight="Bold" />
<TextBlock Text=")" />
</StackPanel>
</HierarchicalDataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
</Border>
</StackPanel>
</Grid>
</GroupBox>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</telerik:RadTreeView.ItemTemplate>
</telerik:RadTreeView>
</GroupBox>
<GroupBox Margin="5,0,5,0"
Width="770"
Header="电缆配置信息">
<!-- 数据表格 -->
<Grid>
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="630"
AutoGenerateColumns="False" IsFilteringAllowed="False" Background="#a0a0a0"
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding SignalPredistributionInfos}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="序号" CellTemplate="{StaticResource CellTemplate1}" CellStyle="{StaticResource CellTyle1}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="电缆对" DataMemberBinding="{Binding CablePair}"/>
<telerik:GridViewDataColumn Header="电缆线芯" CellTemplate="{StaticResource CellTemplate3}" CellEditTemplate="{StaticResource CellEditTemplate3}"/>
<telerik:GridViewDataColumn Header="极性" CellTemplate="{StaticResource CellTemplate4}" CellEditTemplate="{StaticResource CellEditTemplate4}"/>
<telerik:GridViewComboBoxColumn Header="{Binding SignalColumnName,Mode=TwoWay}"
IsVisible="{Binding IsChecked,ElementName=RadioButton2}"
ItemsSource="{Binding DataContext.SignalTypeColumn, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
DataMemberBinding="{Binding SignalType}"
Width="120">
<telerik:GridViewComboBoxColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding SignalType}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding SignalType}"/>
</DataTemplate>
</telerik:GridViewComboBoxColumn.CellTemplate>
</telerik:GridViewComboBoxColumn>
<telerik:GridViewDataColumn Header="中文描述" DataMemberBinding="{Binding ChineseDescription}" Width="120">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ChineseDescription}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding ChineseDescription}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="英文描述" DataMemberBinding="{Binding EnglishDescription}" Width="120">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding EnglishDescription}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding EnglishDescription}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewComboBoxColumn Header="输入/输出"
ItemsSource="{Binding DataContext.InorOuts, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
DataMemberBinding="{Binding InorOut}"
Width="60">
</telerik:GridViewComboBoxColumn>
<telerik:GridViewDataColumn Header="传感器编号" DataMemberBinding="{Binding EnglishDescription}" Width="auto">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding SensorCode}"
TextTrimming="CharacterEllipsis"
ToolTip="{Binding SensorCode}"/>
</DataTemplate>
</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>
<telerik:GridViewDataColumn Header="端子号" Width="*" CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
</Grid>
</GroupBox>
</StackPanel>
<Grid>
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Left">
<telerik:RadButton Margin="0,0,20,0"
Width="100"
HorizontalAlignment="Right"
Style="{StaticResource sysBtn4}"
Command="{Binding ButtonCmd}"
CommandParameter="清除配置"
Content="清除配置" />
<telerik:RadButton Margin="0,0,0,0"
Width="100"
HorizontalAlignment="Right"
Style="{StaticResource sysBtn2}"
Command="{Binding ButtonCmd}"
CommandParameter="指定中英文"
Content="指定中英文" />
</StackPanel>
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
<telerik:RadButton Margin="0,0,20,0"
Width="100"
HorizontalAlignment="Right"
Style="{StaticResource sysBtn}"
Command="{Binding OKCommand}"
CommandParameter="确定"
Content="确定" />
<telerik:RadButton Margin="0,0,0,0"
Width="100"
HorizontalAlignment="Right"
Style="{StaticResource sysBtn2}"
Command="{Binding CloseCommand}"
CommandParameter="取消"
Content="取消" />
</StackPanel>
</Grid>
</StackPanel>
</telerik:RadBusyIndicator>
</UserControl>

View File

@ -12,6 +12,13 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using Prism.Events;
using SWS.CAD.Event;
using SWS.Commons;
using SWS.Model;
using Telerik.Windows.Controls;
using Unity;
namespace SWS.CAD.Views.Dialog
{
@ -20,9 +27,23 @@ namespace SWS.CAD.Views.Dialog
/// </summary>
public partial class DialogSignalPredistribution : UserControl
{
IEventAggregator _eventAggregator;
public DialogSignalPredistribution()
{
InitializeComponent();
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
_eventAggregator.GetEvent<ScrollToItemEvent>().Subscribe(ScrollToSelectedItem, ThreadOption.UIThread, true);
}
// 滚动到选中项
private void ScrollToSelectedItem(object path)
{
var pathls = path as List<string>;
var ph = string.Join("\\", pathls);
treeView1.BringPathIntoView(ph);
}
}
}

View File

@ -84,6 +84,7 @@ namespace SWS.Commons
public static List<TreeModel> designTree = new List<TreeModel>();
#endregion
public enum DBConst
{
/// <summary>

View File

@ -0,0 +1,36 @@
using System;
using System.Globalization;
using System.Windows.Data;
using SWS.Model;
namespace SWS.Commons.Helper.Converter
{
public class RadioButtonValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string isChecked)
{
if (isChecked.Equals(parameter.ToString()))
{
return true;
}
else
{
return false;
}
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isChecked)
{
return parameter.ToString();
}
return parameter.ToString();
}
}
}

View File

@ -106,6 +106,7 @@
<Compile Include="GlobalObject.cs" />
<Compile Include="Helper\Converter\CollectionToStringConverter.cs" />
<Compile Include="Helper\Converter\TimeSpanToColourValueConverter.cs" />
<Compile Include="Helper\Converter\RadioButtonValueConverter.cs" />
<Compile Include="Helper\Converter\TimeSpanValueConverter.cs" />
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
<Compile Include="Helper\Converter\ColumnValueConverter.cs" />

View File

@ -63,6 +63,7 @@ namespace SWS.Electrical
GlobalObject._prismContainer.RegisterDialog<DialogSignalPropertyhisAndLogs, DialogSignalPropertyhisAndLogsViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogSignalSelect, DialogSignalSelectViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAllOutputSignal, DialogAllOutputSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
GlobalObject._prismContainer.RegisterDialog<DialogAutoArrangeLayout, DialogAutoArrangeLayoutViewModel>();
}

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ABECE6D950BC12BD1A8DC30FBB96A86A4798DF4A77E402D6CDDD9CF497D2FC76"
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "55992553F782D436B236E9D0626B49AE48376927B5906F253898CDC4189B1D22"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -85,7 +85,7 @@ namespace SWS.Electrical.Views {
#line hidden
#line 219 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
#line 220 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag;

View File

@ -51,7 +51,9 @@ namespace SWS.Service
//directory = data["Profile"]["strLocalWorkDir"];
address = IniHelper.ReadValueFromIniFile("Profile", "strIPAddress");
port = int.Parse(IniHelper.ReadValueFromIniFile("Profile", "nPort"));
string portString = IniHelper.ReadValueFromIniFile("Profile", "nPort");
int.TryParse(portString?.Trim(), out port);
//port = int.Parse(IniHelper.ReadValueFromIniFile("Profile", "nPort"));
directory = IniHelper.ReadValueFromIniFile("Profile", "strLocalWorkDir");
}

View File

@ -50,16 +50,16 @@ namespace SWS.Service
public async Task<object> SaveDetailForm(ec_dataitemdetail entity)
{
var res = await this.PostBodyAsync<ec_dataitemdetail, ec_dataitemdetail>($"DataItemApi/SaveDetailForm?ProjectId={GlobalObject.curProject?.ProjectId}", entity);
if (res.code == 200)
{
//return res.info;
return null;
}
else
{
return res.info; // 返回错误信息
}
//if (res.code == 200)
//{
// //return res.info;
// return null;
//}
//else
//{
// return res.info; // 返回错误信息
//}
return res;
}
}
}

View File

@ -139,16 +139,16 @@ namespace SWS.Service
public async Task<object> CreatePanelStripByProfile(ec_PanelStrip entity)
{
var res = await this.PostBodyAsync<ec_PanelStrip, ec_PanelStrip>($"IOModuleApi/CreatePanelStripByProfile?projId={GlobalObject.curProject?.ProjectId}", entity);
if (res.code == 200)
{
//return res.info;
return null;
}
else
{
return res.info; // 返回错误信息
}
//if (res.code == 200)
//{
// //return res.info;
// return null;
//}
//else
//{
// return res.info; // 返回错误信息
//}
return res;
}
public async Task<string> DeletePanel(string PanelID)

View File

@ -126,6 +126,7 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\DialogInputViewModel.cs" />
<Compile Include="ViewModels\DialogSignalManagementVM\DialogAssociatedSignalViewModel.cs" />
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalManagementViewModel.cs" />
<Compile Include="ViewModels\DialogSignalManagementVM\DialogAllOutputSignalViewModel.cs" />
<Compile Include="ViewModels\DialogSignalManagementVM\DialogSignalNoticeViewModel.cs" />
@ -137,6 +138,9 @@
<Compile Include="Views\CustomDialogWindow.xaml.cs">
<DependentUpon>CustomDialogWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Views\DialogSignalManagements\DialogAssociatedSignal.xaml.cs">
<DependentUpon>DialogAssociatedSignal.xaml</DependentUpon>
</Compile>
<Compile Include="Views\DialogSignalManagements\DialogAllOutputSignal.xaml.cs">
<DependentUpon>DialogAllOutputSignal.xaml</DependentUpon>
</Compile>
@ -200,6 +204,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\DialogSignalManagements\DialogAssociatedSignal.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\DialogSignalManagements\DialogAllOutputSignal.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@ -0,0 +1,267 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Input;
using Prism.Services.Dialogs;
using Prism.Ioc;
using SWS.Commons;
using SWS.Model;
using SWS.Service;
using SWS.WPF.Views;
using Telerik.Windows.Controls;
using Unity;
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
using System.Windows;
namespace SWS.WPF.ViewModels
{
public class DialogAssociatedSignalViewModel : DialogBase, IDialogAware
{
#region
private ObservableCollection<SignalManagementInfo> _MySignals = new ObservableCollection<SignalManagementInfo>();
/// <summary>
/// 表格数据源
/// </summary>
public ObservableCollection<SignalManagementInfo> MySignals
{
get { return _MySignals; }
set { _MySignals = value; RaisePropertyChanged(nameof(MySignals)); }
}
private SignalManagementInfo _SelectedSignal;
/// <summary>
/// 选中行
/// </summary>
public SignalManagementInfo SelectedSignal
{
get { return _SelectedSignal; }
set { _SelectedSignal = value; RaisePropertyChanged(nameof(SelectedSignal)); }
}
private string _Info;
/// <summary>
/// 列表上方文字
/// </summary>
public string Info
{
get { return _Info; }
set { _Info = value; RaisePropertyChanged(nameof(Info)); }
}
private Visibility _IsVisibility = Visibility.Collapsed;
/// <summary>
/// 控制取消关联按钮是否可见
/// </summary>
public Visibility IsVisibility
{
get { return _IsVisibility; }
set
{
_IsVisibility = value;
RaisePropertyChanged(nameof(IsVisibility));
}
}
/// <summary>
/// 信号接口服务
/// </summary>
WireGroupService _wireGroupService;
public DialogSignalNotice SignalNoticeView { get; set; }
#endregion
public DialogAssociatedSignalViewModel()
{
_wireGroupService = GlobalObject.container.Resolve<WireGroupService>();
}
public string Title => "";
public event Action<IDialogResult> RequestClose;
public bool CanCloseDialog()
{
return true;
}
public void OnDialogClosed()
{
}
public async void OnDialogOpened(IDialogParameters parameters)
{
title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
Info = parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
var signals = parameters.GetValue<ObservableCollection<SignalManagementInfo>>(GlobalObject.dialogPar.para1.ToString());
foreach (var item in signals)
{
if (title.Equals("信号选择框"))
{
if (item.type.Equals("信号"))
{
MySignals.Add(item);
}
}
else if (title.Equals("信号关联列表"))
{
MySignals.Add(item);
IsVisibility = Visibility.Visible;
}
}
}
public override void ExecuteOKCommandAsync(object para)
{
IDialogParameters par = new DialogParameters();
if (title.Equals("信号选择框"))
{
if (SelectedSignal == null)
{
MessageBox.Show("请选择一个信号!");
return;
}
}
else if (title.Equals("信号关联列表"))
{
//如何是取消关联,则把取消的列表传回去
par.Add(GlobalObject.dialogPar.para2.ToString(), CancelAssociationls);
}
par.Add(GlobalObject.dialogPar.para1.ToString(), SelectedSignal);
DialogResult result = new DialogResult(ButtonResult.Yes, par);
RequestClose.Invoke(result);
}
public override void ExecuteCloseCommand(object parameter)
{
if (parameter as string == "ClickNo")
{
DialogResult result = new DialogResult(ButtonResult.No);
RequestClose.Invoke(result);
}
else
{
DialogResult result = new DialogResult(ButtonResult.Cancel);
RequestClose.Invoke(result);
}
this.Dispose();
}
//全局的取消关联列表
List<SignalManagementInfo> CancelAssociationls = new List<SignalManagementInfo>();
public ICommand CancelAssociationCmd => new DelegateCommand(CancelAssociation_Click);
/// <summary>
/// 取消关联按钮的点击事件
/// </summary>
/// <param name="parameter"></param>
public virtual void CancelAssociation_Click(object parameter)
{
CancelAssociationls.Add(SelectedSignal);
MySignals.Remove(SelectedSignal);
}
}
public class AssociatedSignalInfo : ViewModelBase
{
#region
private string _Group_Name;
/// <summary>
/// CH.NO
/// </summary>
public string Group_Name
{
get { return _Group_Name; }
set { _Group_Name = value; RaisePropertyChanged(nameof(Group_Name)); }
}
private string _Group_Desc_EN;
/// <summary>
/// 英文描述
/// </summary>
public string Group_Desc_EN
{
get { return _Group_Desc_EN; }
set { _Group_Desc_EN = value; RaisePropertyChanged(nameof(Group_Desc_EN)); }
}
private string _Group_Desc;
/// <summary>
/// 中文描述
/// </summary>
public string Group_Desc
{
get { return _Group_Desc; }
set { _Group_Desc = value; RaisePropertyChanged(nameof(Group_Desc)); }
}
private string _IO_Type;
/// <summary>
/// 信号类型
/// </summary>
public string IO_Type
{
get { return _IO_Type; }
set { _IO_Type = value; RaisePropertyChanged(nameof(IO_Type)); }
}
private string _Alarm_LL;
public string Alarm_LL
{
get { return _Alarm_LL; }
set { _Alarm_LL = value; RaisePropertyChanged(nameof(Alarm_LL)); }
}
private string _Alarm_L;
public string Alarm_L
{
get { return _Alarm_L; }
set { _Alarm_L = value; RaisePropertyChanged(nameof(Alarm_L)); }
}
private string _Alarm_H;
public string Alarm_H
{
get { return _Alarm_H; }
set { _Alarm_H = value; RaisePropertyChanged(nameof(Alarm_H)); }
}
private string _Alarm_HH;
public string Alarm_HH
{
get { return _Alarm_HH; }
set { _Alarm_HH = value; RaisePropertyChanged(nameof(Alarm_HH)); }
}
private string _SENSOR_CODE;
/// <summary>
/// 传感器编号
/// </summary>
public string SENSOR_CODE
{
get { return _SENSOR_CODE; }
set { _SENSOR_CODE = value; RaisePropertyChanged(nameof(SENSOR_CODE)); }
}
#endregion
public AssociatedSignalInfo(ec_Wire_Group ec_Wire_Group)
{
}
}
}

View File

@ -347,11 +347,11 @@ namespace SWS.WPF.ViewModels
}
}
private DateTime _ReviewTime;
private DateTime? _ReviewTime;
/// <summary>
/// 送审时间
/// </summary>
public DateTime ReviewTime
public DateTime? ReviewTime
{
get { return _ReviewTime; }
set { _ReviewTime = value;
@ -359,11 +359,11 @@ namespace SWS.WPF.ViewModels
}
}
private DateTime _ConstructionTime;
private DateTime? _ConstructionTime;
/// <summary>
/// 施工时间
/// </summary>
public DateTime ConstructionTime
public DateTime? ConstructionTime
{
get { return _ConstructionTime; }
set { _ConstructionTime = value;
@ -371,6 +371,33 @@ namespace SWS.WPF.ViewModels
}
}
private Visibility _IsReviewTimeVisibility = Visibility.Visible;
/// <summary>
/// 控制送审时间是否可见
/// </summary>
public Visibility IsReviewTimeVisibility
{
get { return _IsReviewTimeVisibility; }
set
{
_IsReviewTimeVisibility = value;
RaisePropertyChanged(nameof(IsReviewTimeVisibility));
}
}
private Visibility _IsConstructionTimeVisibility = Visibility.Visible;
/// <summary>
/// 控制施工时间是否可见
/// </summary>
public Visibility IsConstructionTimeVisibility
{
get { return _IsConstructionTimeVisibility; }
set
{
_IsConstructionTimeVisibility = value;
RaisePropertyChanged(nameof(IsConstructionTimeVisibility));
}
}
private readonly DispatcherTimer _timer = new DispatcherTimer();
@ -423,6 +450,10 @@ namespace SWS.WPF.ViewModels
//DateTime startTime = DateTime.Now;
//设置信号源
signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
if (signals == null)
{
signals = new List<ec_Wire_Group>();
}
//TimeSpan duration = DateTime.Now - startTime;
//System.Windows.MessageBox.Show($"Time taken: {duration.Seconds} milliseconds");
count = signals.Count().ToString();
@ -448,28 +479,29 @@ namespace SWS.WPF.ViewModels
IsAssociated = parameters.GetValue<ec_Wire_Group>(GlobalObject.dialogPar.info.ToString());
//获取送审时间和施工时间
ReviewTime = (DateTime)GlobalObject.curProject.IO_predicted_issue;
ConstructionTime = (DateTime)GlobalObject.curProject.IO_predicted_construct;
ReviewTime = GlobalObject.curProject.IO_predicted_issue;
ConstructionTime = GlobalObject.curProject.IO_predicted_issue;
if (ReviewTime == null) IsReviewTimeVisibility = Visibility.Collapsed;
if (ConstructionTime == null) IsConstructionTimeVisibility = Visibility.Collapsed;
// 获取当前时间
DateTime currentTime = DateTime.Now;
// 初始化倒计时时间
ReviewCountdown.TimeRemaining = (TimeSpan)(ReviewTime - currentTime);
ReviewCountdown.IsActive = true;
ReviewCountdown.TimeRemaining = ReviewTime==null? TimeSpan.Zero:(TimeSpan)(ReviewTime - currentTime);
ReviewCountdown.IsActive = ReviewTime == null ?false: true;
if (ReviewCountdown.TimeRemaining<= TimeSpan.Zero)
{
if ((DateTime)GlobalObject.curProject.IO_real_issue == null)
if (GlobalObject.curProject.IO_real_issue == null && GlobalObject.curProject.IO_predicted_issue!=null)
{
System.Windows.MessageBox.Show($"送审时间已过期: {ReviewCountdown.TimeRemaining:%d}天 {ReviewCountdown.TimeRemaining:hh\\:mm\\:ss}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
ConstructionCountdown.TimeRemaining = (TimeSpan)(ConstructionTime - currentTime);
ConstructionCountdown.TimeRemaining = ConstructionTime==null? TimeSpan.Zero:(TimeSpan)(ConstructionTime - currentTime);
ConstructionCountdown.IsActive = true;
ConstructionCountdown.IsActive = ConstructionTime == null ? false: true;
if (ConstructionCountdown.TimeRemaining <= TimeSpan.Zero)
{
if ((DateTime)GlobalObject.curProject.IO_real_construct == null)
if (GlobalObject.curProject.IO_real_construct == null&& GlobalObject.curProject.IO_predicted_issue!=null)
{
System.Windows.MessageBox.Show($"施工时间已过期: {ConstructionCountdown.TimeRemaining:%d}天 {ConstructionCountdown.TimeRemaining:hh\\:mm\\:ss}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
@ -1346,25 +1378,25 @@ namespace SWS.WPF.ViewModels
para.Add(GlobalObject.dialogPar.title.ToString(), "信号选择框");
para.Add(GlobalObject.dialogPar.info.ToString(), "请选择要关联的信号:");
para.Add(GlobalObject.dialogPar.para1.ToString(), smInfols);
_dialogService.ShowDialog(nameof(DialogSignalSelect), para, (RES) =>
_dialogService.ShowDialog(nameof(DialogAssociatedSignal), para, (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{
var signal = RES.Parameters.GetValue<Signal>(GlobalObject.dialogPar.para1.ToString());
var signal = RES.Parameters.GetValue<SignalManagementInfo>(GlobalObject.dialogPar.para1.ToString());
if (!string.IsNullOrEmpty(SelectedSmInfo.LinkedID))
{
var LinkedIDs = SelectedSmInfo.LinkedID.Split(',').ToList();
LinkedIDs.RemoveAll(item => string.IsNullOrEmpty(item));
if (!LinkedIDs.Contains(signal.SignalId))
if (!LinkedIDs.Contains(signal.Wire_Group_ID))
{
LinkedIDs.Add(signal.SignalId);
LinkedIDs.Add(signal.Wire_Group_ID);
}
SelectedSmInfo.LinkedID = string.Join(",", LinkedIDs);
}
else
{
SelectedSmInfo.LinkedID = signal.SignalId;
SelectedSmInfo.LinkedID = signal.Wire_Group_ID;
}
SelectedSmInfo.IsModified = true;
System.Windows.MessageBox.Show("关联成功", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
@ -1397,15 +1429,15 @@ namespace SWS.WPF.ViewModels
para.Add(GlobalObject.dialogPar.title.ToString(), "信号关联列表");
para.Add(GlobalObject.dialogPar.info.ToString(), "下面是信号关联列表");
para.Add(GlobalObject.dialogPar.para1.ToString(), sminfols);
_dialogService.ShowDialog(nameof(DialogSignalSelect), para, (RES) =>
_dialogService.ShowDialog(nameof(DialogAssociatedSignal), para, (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{
var signals = RES.Parameters.GetValue<List<Signal>>(GlobalObject.dialogPar.para2.ToString());
var signals = RES.Parameters.GetValue<List<SignalManagementInfo>>(GlobalObject.dialogPar.para2.ToString());
signals.ForEach(s =>
{
var signalid = s.SignalId;
var signalid = s.Wire_Group_ID;
if (LinkedIDs.Contains(signalid))
{
LinkedIDs.Remove(signalid);

View File

@ -0,0 +1,106 @@
<UserControl x:Class="SWS.WPF.Views.DialogAssociatedSignal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SWS.WPF.Views"
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
<!--最大化-->
<Setter Property="Width" Value="1000" />
<Setter Property="Height" Value="800" />
<Setter Property="SizeToContent" Value="WidthAndHeight" />
<Setter Property="WindowState" Value="Normal" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="ResizeMode" Value="NoResize" />
</Style>
</prism:Dialog.WindowStyle>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/SWS.WPF;component/Style/CustomStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
<StackPanel>
<CustomControl:customWindowTitleBar x:Name="titleBar" />
<TextBlock Margin="10,0" Text="{Binding Info}" />
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="500" Height="530"
AutoGenerateColumns="False" IsFilteringAllowed="False" Background="#a0a0a0"
IsReadOnly="True" RowIndicatorVisibility="Collapsed"
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding MySignals}" SelectedItem="{Binding SelectedSignal, Mode=TwoWay}">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Group_Name}"
Header="CH.NO"
IsFilterable="False"/>
<telerik:GridViewDataColumn Width="120"
DataMemberBinding="{Binding Group_Desc_EN}"
Header="英文描述"
IsFilterable="False" />
<telerik:GridViewDataColumn Width="120"
DataMemberBinding="{Binding Group_Desc}"
Header="中文描述"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding IO_Type}"
Header="信号类型"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Alarm_LL}"
Header="L.L"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Alarm_L}"
Header="L"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Alarm_H}"
Header="H"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Alarm_HH}"
Header="H.H"
IsFilterable="False" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding SENSOR_CODE}"
Header="CODE"
IsFilterable="False"
Width="*"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<Border Grid.Row="2"
Height="30"
Background="{StaticResource ColorPrimary}">
<DockPanel >
<StackPanel DockPanel.Dock="Left">
<telerik:RadButton Margin="5"
HorizontalAlignment="Left"
Command="{Binding CancelAssociationCmd}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="取消关联"
Visibility="{Binding IsVisibility}"
Style="{StaticResource sysBtn4}" />
</StackPanel>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<telerik:RadButton Margin="5"
Command="{Binding OKCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="确定"
Style="{StaticResource sysBtn}" />
<telerik:RadButton Margin="5"
Command="{Binding CloseCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}"
Content="取消"
Style="{StaticResource sysBtn2}" />
</StackPanel>
</DockPanel>
</Border>
</StackPanel>
</telerik:RadBusyIndicator>
</UserControl>

View File

@ -0,0 +1,28 @@
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;
namespace SWS.WPF.Views
{
/// <summary>
/// DialogAssociatedSignal.xaml 的交互逻辑
/// </summary>
public partial class DialogAssociatedSignal : UserControl
{
public DialogAssociatedSignal()
{
InitializeComponent();
}
}
}

View File

@ -224,7 +224,8 @@
Text="{Binding pojectName}" />
<!--送审时间倒计时-->
<Border Background="{Binding ReviewCountdown.TimeRemaining,Converter={StaticResource TimeSpanToColourCvt}}" CornerRadius="6"
Margin="50,1,0,1" Padding="1">
Visibility="{Binding IsReviewTimeVisibility}"
Margin="50,1,0,1" Padding="1">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" >
<TextBlock Text="送审时间"
FontSize="14" Foreground="White"
@ -242,7 +243,8 @@
<!--施工时间倒计时-->
<Border Background="{Binding ConstructionCountdown.TimeRemaining,Converter={StaticResource TimeSpanToColourCvt}}" CornerRadius="6"
Margin="25,1,0,1" Padding="1">
Visibility="{Binding IsConstructionTimeVisibility}"
Margin="25,1,0,1" Padding="1">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="施工时间"
FontSize="14" Foreground="White"

View File

@ -1,4 +1,4 @@
#pragma checksum "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7BBBAAC2D30DDCBE426FDE8827BDBF7527EEDC8C0F823DBAF3EBE2D35FF1D1F8"
#pragma checksum "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "D4B655A725F9DA5CEF801330CC2E000E8A952FC6E92D22159739897F8A32A6A6"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
@ -86,7 +86,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 232 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 233 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBlock txtReviewCountdown;
@ -94,7 +94,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 250 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 252 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.TextBlock txtConstructionCountdown;
@ -102,7 +102,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 306 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 308 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.IconButton PopupButton;
@ -110,7 +110,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 316 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 318 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.Primitives.Popup CustomPopup;
@ -118,7 +118,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 365 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 367 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.IconButton myButton;
@ -126,7 +126,7 @@ namespace SWS.WPF.Views {
#line hidden
#line 398 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
#line 400 "..\..\..\..\Views\DialogSignalManagements\DialogSignalManagement.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal Telerik.Windows.Controls.RadTreeListView RadGridView1;