二室电缆册新增
This commit is contained in:
parent
c75b6dc23e
commit
fa315072e1
@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.Bibliography;
|
using ClosedXML.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||||
using DocumentFormat.OpenXml.ExtendedProperties;
|
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
@ -1311,6 +1312,9 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
break;
|
break;
|
||||||
|
case "电缆册":
|
||||||
|
CreateReportForCableOfDivision2(paramObj, workbook, ProjectId);
|
||||||
|
break;
|
||||||
case "云线备注清单":
|
case "云线备注清单":
|
||||||
#region 云线备注清单
|
#region 云线备注清单
|
||||||
int SelectModel;
|
int SelectModel;
|
||||||
@ -2007,6 +2011,499 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
|||||||
return DetailName.Substring(0, index);
|
return DetailName.Substring(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 专门帮2室做的电缆册抽取
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramObj"></param>
|
||||||
|
/// <param name="workbook"></param>
|
||||||
|
/// <param name="ProjectId"></param>
|
||||||
|
public void CreateReportForCableOfDivision2(JObject paramObj, IWorkbook workbook, string ProjectId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string dataItemDetailIDOrDwgCategoryID; int model;
|
||||||
|
dataItemDetailIDOrDwgCategoryID = paramObj.Value<string>("dataItemDetailIDOrDrawingCategoryID");// paramObj["dataItemDetailIDOrDwgCategoryID"].ToString();
|
||||||
|
model = paramObj.Value<int>("model");
|
||||||
|
|
||||||
|
|
||||||
|
ISheet sheetCable = workbook.CreateSheet("电缆清册");
|
||||||
|
ISheet sheetCable2 = workbook.CreateSheet("电缆清册(双星)");
|
||||||
|
#region 表头部分
|
||||||
|
IRow rowCable = sheetCable.CreateRow(0);
|
||||||
|
rowCable.CreateCell(0).SetCellValue("所属系统");
|
||||||
|
rowCable.CreateCell(1).SetCellValue("电缆编号");
|
||||||
|
rowCable.CreateCell(2).SetCellValue("电缆类型");
|
||||||
|
rowCable.CreateCell(3).SetCellValue("电缆规格");
|
||||||
|
rowCable.CreateCell(4).SetCellValue("起始设备代码");
|
||||||
|
rowCable.CreateCell(5).SetCellValue("起始" + "\n" + "FrDeck");
|
||||||
|
rowCable.CreateCell(6).SetCellValue("设备位置" + "\n" + "FrRoom");
|
||||||
|
rowCable.CreateCell(7).SetCellValue("设备名称" + "\n" + "FrEquip");
|
||||||
|
rowCable.CreateCell(8).SetCellValue("终止设备代码");
|
||||||
|
rowCable.CreateCell(9).SetCellValue("终止" + "\n" + "ToDeck");
|
||||||
|
rowCable.CreateCell(10).SetCellValue("设备位置" + "\n" + "ToRoom");
|
||||||
|
rowCable.CreateCell(11).SetCellValue("设备名称" + "\n" + "ToEquip");
|
||||||
|
rowCable.CreateCell(12).SetCellValue("是否变频");
|
||||||
|
rowCable.CreateCell(13).SetCellValue("是否本安");
|
||||||
|
rowCable.CreateCell(14).SetCellValue("是否独立屏蔽");
|
||||||
|
rowCable.CreateCell(15).SetCellValue("是否防火");
|
||||||
|
rowCable.CreateCell(16).SetCellValue("是否铠装");
|
||||||
|
|
||||||
|
IRow rowCable2 = sheetCable2.CreateRow(0);
|
||||||
|
rowCable2.CreateCell(0).SetCellValue("所属系统");
|
||||||
|
rowCable2.CreateCell(1).SetCellValue("电缆编号");
|
||||||
|
rowCable2.CreateCell(2).SetCellValue("电缆类型");
|
||||||
|
rowCable2.CreateCell(3).SetCellValue("电缆规格");
|
||||||
|
rowCable2.CreateCell(4).SetCellValue("起始设备代码");
|
||||||
|
rowCable2.CreateCell(5).SetCellValue("起始" + "\n" + "FrDeck");
|
||||||
|
rowCable2.CreateCell(6).SetCellValue("设备位置" + "\n" + "FrRoom");
|
||||||
|
rowCable2.CreateCell(7).SetCellValue("设备名称" + "\n" + "FrEquip");
|
||||||
|
rowCable2.CreateCell(8).SetCellValue("终止设备代码");
|
||||||
|
rowCable2.CreateCell(9).SetCellValue("终止" + "\n" + "ToDeck");
|
||||||
|
rowCable2.CreateCell(10).SetCellValue("设备位置" + "\n" + "ToRoom");
|
||||||
|
rowCable2.CreateCell(11).SetCellValue("设备名称" + "\n" + "ToEquip");
|
||||||
|
rowCable2.CreateCell(12).SetCellValue("是否变频");
|
||||||
|
rowCable2.CreateCell(13).SetCellValue("是否本安");
|
||||||
|
rowCable2.CreateCell(14).SetCellValue("是否独立屏蔽");
|
||||||
|
rowCable2.CreateCell(15).SetCellValue("是否防火");
|
||||||
|
rowCable2.CreateCell(16).SetCellValue("是否铠装");
|
||||||
|
#endregion
|
||||||
|
#region 表名区
|
||||||
|
var enginedataTableName = ProjectSugar.TableName<ec_enginedataEntity>(ProjectId);
|
||||||
|
var objectTypeTableName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
|
||||||
|
var relTypeTableName = ProjectSugar.TableName<ec_reltypeEntity>(ProjectId);
|
||||||
|
var PropertyTableName = ProjectSugar.TableName<ec_propertyEntity>(ProjectId);
|
||||||
|
var DataItemTableName = ProjectSugar.TableName<ec_dataitemEntity>(ProjectId);
|
||||||
|
var DataItemDetailTableName = ProjectSugar.TableName<ec_dataitemdetailEntity>(ProjectId);
|
||||||
|
var relTableName = ProjectSugar.TableName<ec_enginedata_relEntity>(ProjectId);
|
||||||
|
var propertyTableName = ProjectSugar.TableName<ec_enginedata_propertyEntity>(ProjectId);
|
||||||
|
var pixelTableName = ProjectSugar.TableName<ec_enginedata_pixelEntity>(ProjectId);
|
||||||
|
var dwgTableName = ProjectSugar.TableName<ec_drawing_fileEntity>(ProjectId);
|
||||||
|
var dwgCategoryTableName = ProjectSugar.TableName<ec_drawing_catalogueEntity>(ProjectId);
|
||||||
|
#endregion
|
||||||
|
#region 数据查询区,避免循环里查询
|
||||||
|
var pixels = SqlSugarHelper.Db.Queryable<ec_enginedata_pixelEntity>().AS(pixelTableName).Distinct().ToList();
|
||||||
|
pixels = pixels.Where(x => x.DeleteFlg != 1).ToList();
|
||||||
|
var dwgCategory = SqlSugarHelper.Db.Queryable<ec_drawing_catalogueEntity>().AS(dwgCategoryTableName).Distinct().ToList();
|
||||||
|
|
||||||
|
var allDwgs = SqlSugarHelper.Db.Queryable<ec_drawing_fileEntity>().AS(dwgTableName).ToList();
|
||||||
|
//var allProps = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propertyTableName).ToList();
|
||||||
|
var DeckProp = SqlSugarHelper.Db.Queryable<ec_propertyEntity>().AS(PropertyTableName).First(x => x.PropertyName == "甲板号");
|
||||||
|
List<ec_dataitemdetailEntity> allDecks = new List<ec_dataitemdetailEntity>();
|
||||||
|
List<ec_dataitemdetailEntity> allSystems = new List<ec_dataitemdetailEntity>();
|
||||||
|
List<string> validSystemIds = new List<string>(); // dataItemDetailID 以及 其下面所有的
|
||||||
|
if (DeckProp != null)
|
||||||
|
{
|
||||||
|
var DeckEnumList = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(DataItemTableName).First(x => x.DataItemName == DeckProp.EnumData);
|
||||||
|
if (DeckEnumList != null)
|
||||||
|
{
|
||||||
|
allDecks = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(DataItemDetailTableName).Where(x => x.DataItemID == DeckEnumList.DataItemID).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var SystemEnumList = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(DataItemTableName).First(x => x.DataItemCode == GlobalObject.enumlist_System);
|
||||||
|
if (SystemEnumList != null)
|
||||||
|
{
|
||||||
|
allSystems = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(DataItemDetailTableName).Where(x => x.DataItemID == SystemEnumList.DataItemID).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
var needPropsName = new List<string>() {
|
||||||
|
GlobalObject.propName_System, GlobalObject.propName_CableSpec,
|
||||||
|
"变频电缆","本安电缆","是否独立屏蔽","是否防火","是否铠装","电缆供货类型","平行电缆",
|
||||||
|
"甲板号","房间号","中文名称",GlobalObject.propName_Frame, GlobalObject.propName_cableTypeTest};
|
||||||
|
var allprops = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propertyTableName).
|
||||||
|
Where(x => needPropsName.Contains(x.PropertyName)).
|
||||||
|
ToList();
|
||||||
|
|
||||||
|
switch (model)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1://按系统
|
||||||
|
validSystemIds = new ec_dataitemBLL().GetChildNodes(ProjectId, dataItemDetailIDOrDwgCategoryID); break;
|
||||||
|
case 2://按图纸(可能选的是目录,也可能选的是图纸)
|
||||||
|
var folder = dwgCategory.FirstOrDefault(x => x.DrawingCatalogueID == dataItemDetailIDOrDwgCategoryID);
|
||||||
|
if (folder != null)
|
||||||
|
{
|
||||||
|
//选的是目录
|
||||||
|
validSystemIds = new ec_drawing_catalogueBLL().GetChildNodes(ProjectId, dataItemDetailIDOrDwgCategoryID); break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dwg = allDwgs.FirstOrDefault(x => x.DrawingFileID == dataItemDetailIDOrDwgCategoryID);
|
||||||
|
if (dwg != null)
|
||||||
|
{
|
||||||
|
//选的是文件
|
||||||
|
validSystemIds.Add(dwg.DrawingFileID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//ID 有些问题
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cableFromToRel = SqlSugarHelper.Db.Queryable<ec_reltypeEntity>().AS(relTypeTableName).ToList().FirstOrDefault(x => x.RelType == enum_RelType.设备_电缆);
|
||||||
|
if (cableFromToRel == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"查不到【{enum_RelType.设备_电缆.ToString()}】这个关联类型。");
|
||||||
|
}
|
||||||
|
var relDatas = SqlSugarHelper.Db.Queryable<ec_enginedata_relEntity>().AS(relTableName)
|
||||||
|
.LeftJoin<ec_enginedataEntity>((eere, eede1) => eere.RelEngineData1ID == eede1.EngineDataID).AS<ec_enginedataEntity>(enginedataTableName)
|
||||||
|
.LeftJoin<ec_objecttypeEntity>((eere, eede1, eote1) => eede1.ObjectTypeID == eote1.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.LeftJoin<ec_enginedataEntity2>((eere, eede1, eote1, eede2) => eere.RelEngineData2ID == eede2.EngineDataID).AS<ec_enginedataEntity2>(enginedataTableName)
|
||||||
|
.LeftJoin<ec_objecttypeEntity2>((eere, eede1, eote1, eede2, eote2) => eede2.ObjectTypeID == eote2.ObjectTypeID).AS<ec_objecttypeEntity2>(objectTypeTableName)
|
||||||
|
.Where((eere, eede1, eote1, eede2, eote2) => eere.RelTypeID == cableFromToRel.RelTypeID)
|
||||||
|
.Select((eere, eede1, eote1, eede2, eote2) => new {
|
||||||
|
eere.EngineDataRelID,
|
||||||
|
eere.RelTypeID,
|
||||||
|
eere.RelEngineData1ID,
|
||||||
|
RelEngDataObjType1 = eote1.ObjectTypeName,
|
||||||
|
eere.RelEngineData2ID,
|
||||||
|
RelEngDataObjType2 = eote2.ObjectTypeName,
|
||||||
|
eere.OPCPixel
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
var cables = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(enginedataTableName)
|
||||||
|
.InnerJoin<ec_objecttypeEntity>((a, b) => a.ObjectTypeID == b.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.InnerJoin<ec_enginedata_pixelEntity>((a, b, c) => a.EngineDataID == c.EngineDataID).AS<ec_enginedata_pixelEntity>(pixelTableName)
|
||||||
|
.Where((a, b, c) =>
|
||||||
|
b.ObjectTypeName.EndsWith("电缆") &&
|
||||||
|
!string.IsNullOrEmpty(a.TagNumber) &&
|
||||||
|
c.DeleteFlg != 1)
|
||||||
|
.OrderBy((a, b) => a.TagNumber)
|
||||||
|
.Select((a, b, c) => new ec_enginedataEntity
|
||||||
|
{
|
||||||
|
CaseID = a.CaseID,
|
||||||
|
EngineDataID = a.EngineDataID,
|
||||||
|
TagNumber = a.TagNumber,
|
||||||
|
ObjectTypeID = a.ObjectTypeID,
|
||||||
|
ObjectTypeName = b.ObjectTypeName,
|
||||||
|
DataStatus = a.DataStatus
|
||||||
|
})
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//24 4 2,过滤掉图面上不存在的
|
||||||
|
|
||||||
|
var Equips = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(enginedataTableName)
|
||||||
|
.InnerJoin<ec_objecttypeEntity>((a, b) => a.ObjectTypeID == b.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.Where((a, b) => !b.ObjectTypeName.EndsWith("电缆"))
|
||||||
|
.OrderBy((a, b) => a.TagNumber)
|
||||||
|
.ToList();
|
||||||
|
#endregion
|
||||||
|
int curRow = 1;
|
||||||
|
//对电缆编号排序
|
||||||
|
cables.Sort((x, y) => CommonHelper.Compare(x.TagNumber, y.TagNumber));
|
||||||
|
|
||||||
|
foreach (var cable in cables) //Where(x => x.TagNumber == "TEST-CABLE-001" || x.TagNumber == "1L11-7")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
bool RoutingType = false;//true时,代表**,会出现在第二个sheet里
|
||||||
|
rowCable = sheetCable.CreateRow(curRow++);
|
||||||
|
rowCable.CreateCell(0).SetCellValue("");
|
||||||
|
rowCable.CreateCell(1).SetCellValue("");
|
||||||
|
rowCable.CreateCell(2).SetCellValue("");
|
||||||
|
rowCable.CreateCell(3).SetCellValue("");
|
||||||
|
rowCable.CreateCell(4).SetCellValue("");
|
||||||
|
rowCable.CreateCell(5).SetCellValue("");
|
||||||
|
rowCable.CreateCell(6).SetCellValue("");
|
||||||
|
rowCable.CreateCell(7).SetCellValue("");
|
||||||
|
rowCable.CreateCell(8).SetCellValue("");
|
||||||
|
rowCable.CreateCell(9).SetCellValue("");
|
||||||
|
rowCable.CreateCell(10).SetCellValue("");
|
||||||
|
rowCable.CreateCell(11).SetCellValue("");
|
||||||
|
rowCable.CreateCell(12).SetCellValue("");
|
||||||
|
rowCable.CreateCell(13).SetCellValue("");
|
||||||
|
rowCable.CreateCell(14).SetCellValue("");
|
||||||
|
rowCable.CreateCell(15).SetCellValue("");
|
||||||
|
rowCable.CreateCell(16).SetCellValue("");
|
||||||
|
rowCable.CreateCell(17).SetCellValue("");
|
||||||
|
//rowCable.CreateCell(18).SetCellValue("");
|
||||||
|
|
||||||
|
//25 02 28,优化速速,估注释,搬到循环外
|
||||||
|
var TagProps = allprops.Where(x => x.EngineDataID == cable.EngineDataID)//&& (x.CaseID == "0" || string.IsNullOrEmpty(x.CaseID))
|
||||||
|
.ToList();//位号的所有属性
|
||||||
|
var PropValue = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 所属系统
|
||||||
|
var TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_System && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
PropValue = GetNameBeforeDoublePipe(PropValue);//双||的事情
|
||||||
|
|
||||||
|
if (!TagInRange(model, PropValue, cable, validSystemIds, ref pixels, ref allDwgs, ref allSystems))
|
||||||
|
{
|
||||||
|
curRow--;
|
||||||
|
continue;
|
||||||
|
} //判断是否在范围内
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(PropValue) && Regex.IsMatch(PropValue, "^[A-Za-z0-9]*$") && allSystems.Any(x => x.DataItemName == PropValue))
|
||||||
|
{
|
||||||
|
//换成枚举的描述
|
||||||
|
PropValue = allSystems.FirstOrDefault(x => x.DataItemName == PropValue).DataItemCode;
|
||||||
|
}
|
||||||
|
rowCable.Cells[0].SetCellValue(PropValue);//感觉这里保持默认好点
|
||||||
|
#endregion
|
||||||
|
#region 位号
|
||||||
|
rowCable.Cells[1].SetCellValue(cable.TagNumber);
|
||||||
|
if (cable.TagNumber.Contains("**"))
|
||||||
|
{
|
||||||
|
RoutingType = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_cableTypeTest && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[2].SetCellValue(PropValue);//电缆类型,信号、电力、本安、动力、随机
|
||||||
|
#region 电缆规格
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_CableSpec && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[3].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 电缆型号(CJ86)
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "变频电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[12].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "本安电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[13].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否独立屏蔽" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[14].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否防火" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[15].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否铠装" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[16].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
xxx:
|
||||||
|
#region 供货范围
|
||||||
|
//TagProp = TagProps.Where(x => x.PropertyName == "电缆供货类型" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
//PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//if (PropValue.Contains("**"))
|
||||||
|
//{
|
||||||
|
// RoutingType = true;
|
||||||
|
//}
|
||||||
|
//else if (PropValue.Contains("*"))
|
||||||
|
//{
|
||||||
|
// rowCable.Cells[2].SetCellValue("A");//电缆类型,信号、电力、本安、动力、随机
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// //根据前面的 CableTypeEnum 来
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
//电缆的from to是根据甲板号的order顺序来的,高优先级的就属于from
|
||||||
|
int? FromOrder = -1; int? ToOrder = -1;
|
||||||
|
#region From
|
||||||
|
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);
|
||||||
|
if (cableFromObj != null)
|
||||||
|
{
|
||||||
|
var EquipFromProps = allprops.Where(x => x.EngineDataID == cableFromObj.EngineDataID)
|
||||||
|
.ToList();
|
||||||
|
rowCable.Cells[4].SetCellValue(cableFromObj?.TagNumber);
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "甲板号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//转换
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
var frDeck = allDecks.FirstOrDefault(x => x.DataItemName == ec_dataitemService.GetNameBeforeDoublePipe(PropValue));
|
||||||
|
if (frDeck != null)
|
||||||
|
{
|
||||||
|
//找到匹配的enum,但是如果code为空,依旧使用自己原本的
|
||||||
|
PropValue = string.IsNullOrEmpty(frDeck.DataItemCode) ? PropValue : frDeck.DataItemCode;
|
||||||
|
FromOrder = frDeck.OrderID;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
rowCable.Cells[5].SetCellValue(PropValue);//没找到依旧用自己原本的
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "房间号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//没房间号,取肋位号
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == GlobalObject.propName_Frame && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//有房间号,取房间号
|
||||||
|
}
|
||||||
|
rowCable.Cells[6].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "中文名称" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[7].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region To
|
||||||
|
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);
|
||||||
|
if (cableEndObj != null)
|
||||||
|
{
|
||||||
|
var EquipToProps = allprops.Where(x => x.EngineDataID == cableEndObj.EngineDataID)
|
||||||
|
.ToList();
|
||||||
|
rowCable.Cells[8].SetCellValue(cableEndObj?.TagNumber);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "甲板号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//转换
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//目前属性寸的是name + || + nameEN,因为cad需要这样显示
|
||||||
|
//但是电缆表需要的是Code
|
||||||
|
var ToDeck = allDecks.FirstOrDefault(x => x.DataItemName == ec_dataitemService.GetNameBeforeDoublePipe(PropValue));
|
||||||
|
if (ToDeck != null)
|
||||||
|
{
|
||||||
|
//找到匹配的enum,但是如果code为空,依旧使用自己原本的
|
||||||
|
PropValue = string.IsNullOrEmpty(ToDeck.DataItemCode) ? PropValue : ToDeck.DataItemCode;
|
||||||
|
ToOrder = ToDeck.OrderID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rowCable.Cells[9].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "房间号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//没房间号,取肋位号
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == GlobalObject.propName_Frame && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//有房间号,取房间号
|
||||||
|
}
|
||||||
|
rowCable.Cells[10].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "中文名称" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[11].SetCellValue(PropValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
if (FromOrder != -1 && ToOrder != -1)
|
||||||
|
{
|
||||||
|
if (FromOrder > ToOrder)
|
||||||
|
{
|
||||||
|
//5678 9 10 11 12
|
||||||
|
var tempTag = rowCable.Cells[4].StringCellValue;
|
||||||
|
var tempDeck = rowCable.Cells[5].StringCellValue;
|
||||||
|
var tempRoom = rowCable.Cells[6].StringCellValue;
|
||||||
|
var tempName = rowCable.Cells[7].StringCellValue;
|
||||||
|
|
||||||
|
rowCable.Cells[4].SetCellValue(rowCable.Cells[8].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[5].SetCellValue(rowCable.Cells[9].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[6].SetCellValue(rowCable.Cells[10].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[7].SetCellValue(rowCable.Cells[11].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[8].SetCellValue(tempTag);
|
||||||
|
rowCable.Cells[9].SetCellValue(tempDeck);
|
||||||
|
rowCable.Cells[10].SetCellValue(tempRoom);
|
||||||
|
rowCable.Cells[11].SetCellValue(tempName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region 第二个sheet和平行电缆
|
||||||
|
if (RoutingType)
|
||||||
|
{
|
||||||
|
// 在目标工作表中创建新行
|
||||||
|
IRow newRow = sheetCable2.CreateRow(sheetCable2.LastRowNum + 1); // 将新行添加到目标工作表的末尾
|
||||||
|
|
||||||
|
// 复制源行的单元格数据到新行
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
ICell sourceCell = rowCable.GetCell(i);
|
||||||
|
ICell newCell = newRow.CreateCell(i);
|
||||||
|
|
||||||
|
if (sourceCell != null)
|
||||||
|
{
|
||||||
|
newCell.SetCellValue(sourceCell.StringCellValue); // 这里假设你的单元格都包含文本数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
rowCable.CreateCell(i).SetCellValue("");
|
||||||
|
}
|
||||||
|
curRow--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "平行电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
foreach (var pCable in PropValue.Split(','))
|
||||||
|
{
|
||||||
|
// 创建新行
|
||||||
|
IRow newRow = sheetCable.CreateRow(curRow++); // 将新行添加到目标工作表的末尾
|
||||||
|
|
||||||
|
// 复制源行的单元格数据到新行
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
ICell sourceCell = rowCable.GetCell(i);
|
||||||
|
ICell newCell = newRow.CreateCell(i);
|
||||||
|
|
||||||
|
if (sourceCell != null)
|
||||||
|
{
|
||||||
|
newCell.SetCellValue(sourceCell.StringCellValue); // 这里假设你的单元格都包含文本数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newRow.CreateCell(1).SetCellValue(pCable);
|
||||||
|
}
|
||||||
|
Console.Write(PropValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log4net.LogManager.GetLogger("ERROR").Error("导出电缆清册 - " + ex.Message + ex.StackTrace);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ var bootstrap = function ($, learun) {
|
|||||||
if (learun.checkrow(keyValue)) {
|
if (learun.checkrow(keyValue)) {
|
||||||
var folderId = $('#gridtable').jfGridValue('FolderId');
|
var folderId = $('#gridtable').jfGridValue('FolderId');
|
||||||
var reportFileName = $('#gridtable').jfGridValue('ReportFileName');
|
var reportFileName = $('#gridtable').jfGridValue('ReportFileName');
|
||||||
if (reportFileName == '电缆清册') {
|
if (reportFileName == '电缆清册' || reportFileName == '电缆册') {
|
||||||
learun.layerForm({
|
learun.layerForm({
|
||||||
id: 'systemselect',
|
id: 'systemselect',
|
||||||
title: '电缆清册 参数选择',
|
title: '电缆清册 参数选择',
|
||||||
|
@ -81,6 +81,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
public const string propName_YOff = "纵骨偏移量(mm)";
|
public const string propName_YOff = "纵骨偏移量(mm)";
|
||||||
public const string propName_TagNumber = "TagNumber";
|
public const string propName_TagNumber = "TagNumber";
|
||||||
public const string propName_Room = "房间号";
|
public const string propName_Room = "房间号";
|
||||||
|
public const string propName_cableTypeTest = "电缆类型(测试)";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region projSetting
|
#region projSetting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user