180 lines
5.2 KiB
C#
180 lines
5.2 KiB
C#
|
|
|
|||
|
|
|
|||
|
|
using System.Text.RegularExpressions;
|
|||
|
|
|
|||
|
|
using Autodesk.Revit.DB;
|
|||
|
|
|
|||
|
|
using EPPlus.Core.Extensions.Attributes;
|
|||
|
|
|
|||
|
|
using Szmedi.RvKits.InfoManager.EAMTools;
|
|||
|
|
|
|||
|
|
namespace Szmedi.RvKits.InfoManager;
|
|||
|
|
/// <summary>
|
|||
|
|
/// EAM 设施及表头
|
|||
|
|
/// </summary>
|
|||
|
|
public class EAMFacility : ObservableValidator, IFacility
|
|||
|
|
{
|
|||
|
|
private bool? isMapped = false;
|
|||
|
|
[ExcelTableColumn("是否匹配", true)]
|
|||
|
|
public bool? IsMapped { get => isMapped; set => SetProperty(ref isMapped, value); }
|
|||
|
|
|
|||
|
|
public FamilyInstance Instance { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("序号")]
|
|||
|
|
public int Number { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("期别", true)]
|
|||
|
|
public string Phased { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("线路", true)]
|
|||
|
|
public string Route { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("工点", true)]
|
|||
|
|
public string WorkSite { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("专业", true)]
|
|||
|
|
public string Major { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("列1", true)]
|
|||
|
|
public string SubSystem { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("设备编码", true)]
|
|||
|
|
public string FacilityCode { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("资产编号", true)]
|
|||
|
|
public string AssetNumber { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("设备名称", true)]
|
|||
|
|
public string FacilityName { get; set; }
|
|||
|
|
|
|||
|
|
private string functionLocation;
|
|||
|
|
[ExcelTableColumn("功能位置")]
|
|||
|
|
public string FunctionLocation
|
|||
|
|
{
|
|||
|
|
get => functionLocation;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (SetProperty(ref functionLocation, value, true))
|
|||
|
|
{
|
|||
|
|
OnPropertyChanged(nameof(EAMCode));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private string facilitySystemCode;
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("设备系统代码")]
|
|||
|
|
public string FacilitySystemCode
|
|||
|
|
{
|
|||
|
|
get => facilitySystemCode;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (SetProperty(ref facilitySystemCode, value, true))
|
|||
|
|
{
|
|||
|
|
OnPropertyChanged(nameof(EAMCode));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("设备分类代码", true)]
|
|||
|
|
public string FacilityCategoryCode { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("固定资产名称", true)]
|
|||
|
|
public string FixedAssetsName { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("规格型号", true)]
|
|||
|
|
public string Specification { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("数量", true)]
|
|||
|
|
public string Count { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("单位", true)]
|
|||
|
|
public string Unit { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("责任部门编码", true)]
|
|||
|
|
public string DepartmentOfResponsibleCode { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("责任部门", true)]
|
|||
|
|
public string DepartmentOfResponsible { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("地理位置编码", true)]
|
|||
|
|
public string GeolocationCode { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("存放地点", true)]
|
|||
|
|
public string StorageLocation { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("存放地点(盘点使用)", true)]
|
|||
|
|
public string StorageLocationInventory { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("责任人", true)]
|
|||
|
|
public string Wilfulness { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("房间编号", true)]
|
|||
|
|
public string RoomNumber { get; set; }
|
|||
|
|
|
|||
|
|
//private string facilityNumber;
|
|||
|
|
[ExcelTableColumn("设备编号", true)]
|
|||
|
|
public string FacilityNumber
|
|||
|
|
{
|
|||
|
|
get
|
|||
|
|
{
|
|||
|
|
string pattern = @"[A-Z]+\d*((-)[A-Z]*\d*)*$";
|
|||
|
|
if (FacilityName != null && Regex.IsMatch(FacilityName, pattern))
|
|||
|
|
{
|
|||
|
|
Match match = Regex.Match(FacilityName, pattern);
|
|||
|
|
return match.Value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (FixedAssetsName != null && Regex.IsMatch(FixedAssetsName, pattern))
|
|||
|
|
{
|
|||
|
|
Match match = Regex.Match(FixedAssetsName, pattern);
|
|||
|
|
return match.Value;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return string.Empty;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string story;
|
|||
|
|
[ExcelTableColumn("楼层")]
|
|||
|
|
public string Story
|
|||
|
|
{
|
|||
|
|
get => story;
|
|||
|
|
set
|
|||
|
|
{
|
|||
|
|
if (SetProperty(ref story, value, true))
|
|||
|
|
{
|
|||
|
|
OnPropertyChanged(nameof(EAMCode));
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("班组", true)]
|
|||
|
|
public string Group { get; set; }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("备注", true)]
|
|||
|
|
public string Comment { get; set; }
|
|||
|
|
|
|||
|
|
|
|||
|
|
private string eamCode;
|
|||
|
|
[ExcelTableColumn("EAM编码", true)]
|
|||
|
|
public string EAMCode { get => eamCode; set => SetProperty(ref eamCode, value, true); }
|
|||
|
|
|
|||
|
|
[ExcelTableColumn("EAM编码错误", true)]
|
|||
|
|
public string ErrorMessage => Story == null
|
|||
|
|
? "所属楼层缺失"
|
|||
|
|
: string.IsNullOrEmpty(FunctionLocation) ? "功能位置缺失" : string.Empty;
|
|||
|
|
|
|||
|
|
private string mapErrorMessage;
|
|||
|
|
[ExcelTableColumn("匹配错误", true)]
|
|||
|
|
public string MapErrorMessage { get => mapErrorMessage; set => SetProperty(ref mapErrorMessage, value, true); }
|
|||
|
|
//public override string ToString()
|
|||
|
|
//{
|
|||
|
|
// return Story == null
|
|||
|
|
// ? throw new ArgumentException("所属楼层缺失", nameof(Story))
|
|||
|
|
// : FacilitySystemCode == null
|
|||
|
|
// ? throw new ArgumentException("设备系统代码缺失", nameof(FacilitySystemCode))
|
|||
|
|
// : FunctionLocation == null ? throw new ArgumentException("功能位置缺失", nameof(FunctionLocation)) : $"EAM-{Story}-{FacilitySystemCode}{FunctionLocation}";
|
|||
|
|
//}
|
|||
|
|
}
|