|
@@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
|
|
using NPOI.SS.UserModel;
|
|
using NPOI.SS.UserModel;
|
|
using SAGA.DotNetUtils.Extend;
|
|
using SAGA.DotNetUtils.Extend;
|
|
using SAGA.DotNetUtils.Others;
|
|
using SAGA.DotNetUtils.Others;
|
|
|
|
+using SAGA.MBI.Calc;
|
|
using SAGA.MBI.DataArrange;
|
|
using SAGA.MBI.DataArrange;
|
|
using SAGA.MBI.JsonConvert;
|
|
using SAGA.MBI.JsonConvert;
|
|
using SAGA.MBI.Model;
|
|
using SAGA.MBI.Model;
|
|
@@ -49,92 +50,85 @@ namespace SAGA.MBI.ToolsData.DataCheck
|
|
|
|
|
|
#region CheckMethod
|
|
#region CheckMethod
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 缓存建筑下的所有岗位信息
|
|
|
|
- /// </summary>
|
|
|
|
- /// <returns></returns>
|
|
|
|
- private List<MRevitEquipBase> CacheBuildingDutys()
|
|
|
|
- {
|
|
|
|
- return CommonConvert.CacheEqEc(this.Context.BuildingId);
|
|
|
|
- }
|
|
|
|
- /// <summary>
|
|
|
|
- /// 缓存 建筑下的所有资产
|
|
|
|
- /// </summary>
|
|
|
|
- /// <returns></returns>
|
|
|
|
- private List<MEquipFM> CacheBuildingFMs()
|
|
|
|
- {
|
|
|
|
- return MatchFMConvert.GetAllEquipFmFromScanBuilding(this.Context.BuildingId); ;
|
|
|
|
- }
|
|
|
|
- /// <summary>
|
|
|
|
/// 对比信息点是否一致
|
|
/// 对比信息点是否一致
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
/// <returns></returns>
|
|
private bool GetCheckResult()
|
|
private bool GetCheckResult()
|
|
- {
|
|
|
|
|
|
+ {
|
|
bool result = true;
|
|
bool result = true;
|
|
- string buildingId = this.Context.BuildingId;
|
|
|
|
- if (buildingId.IsNullOrEmptyExt())
|
|
|
|
|
|
+ var floors = DalProjectTree.GetSelectedFloors(true);
|
|
|
|
+ foreach (var mfloor in floors)
|
|
{
|
|
{
|
|
- result = false;
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
- var dutys = CacheBuildingDutys();
|
|
|
|
- var fms = CacheBuildingFMs();
|
|
|
|
- foreach (var duty in dutys) {
|
|
|
|
- while (true)
|
|
|
|
- {
|
|
|
|
- string fmid = duty.FMID;
|
|
|
|
- if (fmid.IsNullOrEmptyExt()) break;
|
|
|
|
- var fm = fms.FirstOrDefault(t => t.Id == fmid);
|
|
|
|
- if (fm == null) break;
|
|
|
|
- var rs = GetCheckResult(duty,fm);
|
|
|
|
- if (rs == null) break;
|
|
|
|
- Results.Add(rs);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ Results.AddRange(GetCheckResult(mfloor));
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- private DutyFMInfoCheckResult GetCheckResult(MRevitEquipBase duty, MEquipFM fm)
|
|
|
|
|
|
+ private List<MissDutyOrModeCheckResult> GetCheckResult(MFloor mFloor)
|
|
{
|
|
{
|
|
- DutyFMInfoCheckResult result = null;
|
|
|
|
|
|
+ List<MissDutyOrModeCheckResult> list = new List<MissDutyOrModeCheckResult>();
|
|
|
|
+
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- var dutyJObject = duty.CloundJObject;
|
|
|
|
- var fmJson = fm.FMJson;
|
|
|
|
- var fmJObject = JObject.Parse(fmJson);
|
|
|
|
|
|
+ var tuple = CorrectLossDuty.GetCheckResult(mFloor);
|
|
|
|
+ list.AddRange(GetCheckResult(tuple.Item1,true));
|
|
|
|
+ list.AddRange(GetCheckResult(tuple.Item2,false));
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e)
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
- PropertyDefineTb pdtb = PEPCodeConvert.GetPropertyDefineTb(duty.EquipClassCode);
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
- foreach (KeyValuePair<string, JToken> pair in dutyJObject)
|
|
|
|
|
|
+ private List<MissDutyOrModeCheckResult> GetCheckResult(CalcContext calcContext,bool isadd)
|
|
|
|
+ {
|
|
|
|
+ List<MissDutyOrModeCheckResult> list = new List<MissDutyOrModeCheckResult>();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ //if (isadd)
|
|
|
|
+ //{
|
|
|
|
+ // calcContext.OpenDocument();
|
|
|
|
+ //}
|
|
|
|
+ Action<List<MRevitEquipBase>, List<MissDutyOrModeCheckResult>> convetAction = (dutys, l) =>
|
|
{
|
|
{
|
|
- string key = pair.Key;
|
|
|
|
- string dutyValue = pair.Value.ToString();
|
|
|
|
- string fmValue = fmJObject.GetValueEx(key);
|
|
|
|
- if (dutyValue.IsNotNullEmptyExt() && fmValue.IsNotNullEmptyExt() && !dutyValue.Equals(fmValue))
|
|
|
|
|
|
+ foreach (var duty in dutys)
|
|
{
|
|
{
|
|
- var define = pdtb.PropertyDefineItems.FirstOrDefault(t => t.CodeName == key);
|
|
|
|
- sb.Append($"{define?.Name??key}、");
|
|
|
|
|
|
+ MissDutyOrModeCheckResult result = new MissDutyOrModeCheckResult();
|
|
|
|
+ result.FloorName = calcContext.MFloor.ToString();
|
|
|
|
+ result.IsRight = false;
|
|
|
|
+ if (isadd)
|
|
|
|
+ {
|
|
|
|
+ result.BIMID = duty.BimID.GetBIMID().ToString();
|
|
|
|
+ result.RMessage = "无岗位,在模型中有可识别构件";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ result.DutyId = duty.Id;
|
|
|
|
+ result.DutyName = duty.ToString();
|
|
|
|
+ result.RMessage = "有岗位,在模型中找不到对应构件";
|
|
|
|
+ }
|
|
|
|
+ l.Add(result);
|
|
}
|
|
}
|
|
- }
|
|
|
|
- result = new DutyFMInfoCheckResult();
|
|
|
|
- result.FloorName = DalProjectTree.GetFloorNameByFloorId(duty.FloorId);
|
|
|
|
- result.DutyId = duty.Id;
|
|
|
|
- result.DutyName = duty.ToString();
|
|
|
|
- result.BIMID = duty.BimID.GetBIMID().ToString();
|
|
|
|
- result.FMId = fm.Id;
|
|
|
|
- result.FMName = fm.ToString();
|
|
|
|
- result.IsRight = sb.Length == 0;
|
|
|
|
- result.RMessage = result.IsRight ? "" : $"值不一致的信息点有:{sb}";
|
|
|
|
|
|
+ };
|
|
|
|
+ convetAction(calcContext.MEquipments.ToList<MRevitEquipBase>(), list);
|
|
|
|
+ convetAction(calcContext.MEquipmentParts.ToList<MRevitEquipBase>(), list);
|
|
|
|
+ convetAction(calcContext.MBeacons.ToList<MRevitEquipBase>(), list);
|
|
|
|
+ convetAction(calcContext.MSpaces.ToList<MRevitEquipBase>(), list);
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
- return result;
|
|
|
|
|
|
+ Console.WriteLine(e);
|
|
}
|
|
}
|
|
- return result;
|
|
|
|
|
|
+ finally
|
|
|
|
+ {
|
|
|
|
+ //if (isadd)
|
|
|
|
+ //{
|
|
|
|
+ // calcContext.CloseDocument();
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
//[DataCheckProcessAspect]
|
|
//[DataCheckProcessAspect]
|
|
@@ -149,31 +143,16 @@ namespace SAGA.MBI.ToolsData.DataCheck
|
|
|
|
|
|
#region 添加数据
|
|
#region 添加数据
|
|
int index = 3;
|
|
int index = 3;
|
|
- //添加 共检查XXX条数据,未通过检查的如下 提示
|
|
|
|
- IRow rowTip = sheet.CreateRow(index - 1);
|
|
|
|
- rowTip.AddCell(0, $"总检查{Results.Count}条数据,未通过检查的如下", DataCheckNPOIStyle.Title);
|
|
|
|
- //IRow row4 = sheet.CreateRow(index);
|
|
|
|
- //row4.HeightInPoints = 15;
|
|
|
|
-
|
|
|
|
- //row4.AddCell(0, "楼层本地名称", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(1, "文件名", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(2, "文件地址", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(3, "族名称", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(4, "类型", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(5, "ID", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(6, "通过", DataCheckNPOIStyle.Title);
|
|
|
|
- //row4.AddCell(7, "备注(失败原因)", DataCheckNPOIStyle.Title);
|
|
|
|
- foreach (DutyFMInfoCheckResult result in Results)
|
|
|
|
|
|
+
|
|
|
|
+ foreach (MissDutyOrModeCheckResult result in Results)
|
|
{
|
|
{
|
|
//数量过多,只显示有问题的
|
|
//数量过多,只显示有问题的
|
|
- if (result.IsRight) continue;
|
|
|
|
|
|
+ //if (result.IsRight) continue;
|
|
index++;
|
|
index++;
|
|
IRow rowN = sheet.CreateRow(index);
|
|
IRow rowN = sheet.CreateRow(index);
|
|
DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
|
|
DataCheckNPOIStyle style = result.IsRight ? DataCheckNPOIStyle.Content : DataCheckNPOIStyle.Error;
|
|
int i = 0;
|
|
int i = 0;
|
|
rowN.AddCell(i++, result.FloorName, style);
|
|
rowN.AddCell(i++, result.FloorName, style);
|
|
- rowN.AddCell(i++, result.FMId, style);
|
|
|
|
- rowN.AddCell(i++, result.FMName, style);
|
|
|
|
rowN.AddCell(i++, result.DutyId, style);
|
|
rowN.AddCell(i++, result.DutyId, style);
|
|
rowN.AddCell(i++, result.DutyName, style);
|
|
rowN.AddCell(i++, result.DutyName, style);
|
|
rowN.AddCell(i++, result.BIMID, style);
|
|
rowN.AddCell(i++, result.BIMID, style);
|