1.增加了启动时对redis的清理

2.优化检入时的速度
This commit is contained in:
xingheng 2025-09-15 20:28:38 +08:00
parent 28f0461113
commit 752f3d8668
21 changed files with 254 additions and 366 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

@ -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;
}
@ -630,12 +630,12 @@ namespace Learun.Application.Web.AppApi
//电缆from to
var CableConn = relBll.GetCableConn(tag.EngineDataID, projectId);
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();
@ -643,12 +643,12 @@ namespace Learun.Application.Web.AppApi
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();
@ -657,13 +657,13 @@ namespace Learun.Application.Web.AppApi
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;
@ -775,12 +775,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 +788,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 +804,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 +921,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

@ -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();
@ -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)
{

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

@ -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,7 +128,7 @@ 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();
@ -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,24 @@ 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.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中的某一个
}
}
#endregion
existPixel.Modify(existPixel.EngineDataPixelID);
existPixel.DeleteFlg = 0;
existPixel.EngineDataID = engineDataID;
@ -1858,102 +1851,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)

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)
{
@ -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;
}
@ -490,19 +490,19 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
//如果ec_enginedata_propety里面没有必填属性要求的这个属性就代表没有保存认为是没有填值为空
if (AllPropsOfEng.Where(x => x.EngineDataID == checkproperty.EngineDataID).Select(x => x.PropertyID).Contains(checkproperty.PropertyID))
{
var PropertyValue = AllPropsOfEng
.FirstOrDefault(x =>
x.EngineDataID == checkproperty.EngineDataID &&
x.PropertyID == checkproperty.PropertyID)
?.PropertyValue;
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;
}
{
errText = $"图面有对象【{checkproperty.TagNumber}】在即时更新阶段的必填属性【{checkproperty.PropertyName}】值为空,不能检入,请执行“属性检查”功能对图纸进行属性检查。";
return res = false;
}
//}
}
else
@ -525,7 +525,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),
@ -560,10 +560,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;
}
//}
}
@ -595,28 +595,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;
}
}
//}
}
}
@ -624,7 +624,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里面没有必填属性要求的这个属性就代表没有保存认为是没有填值为空
@ -639,10 +639,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))
{
@ -659,7 +659,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)
@ -812,7 +812,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
@ -826,11 +826,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;
}
@ -849,12 +849,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
@ -909,12 +909,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;
}
//}
}
}
@ -945,26 +945,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;
}
}
//}
}
}
@ -985,12 +985,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))
{
@ -1007,7 +1007,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)
@ -1032,7 +1032,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();
@ -1150,7 +1150,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.设备_电缆}\"}}")
@ -1212,7 +1212,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
// 筛选出“真实设备”这里排除OPC、通讯器等中转对象
var deviceTags = endpointInfo
.Where(x => !x.objectType?.Contains("OPC")??false)
.Where(x => !x.objectType?.Contains("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

@ -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

@ -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);
}
}
}