using System; using System.Collections.Generic; using System.Linq; namespace TellmePdmsPluging.Models { public class ExportIfcRequest { public string ExecutionId { get; set; } public string execution_id { get { return ExecutionId; } set { ExecutionId = value; } } public string ExportPath { get; set; } public string FileName { get; set; } public string ExportSystem { get; set; } public string MdbName { get; set; } public bool? Overwrite { get; set; } public List Selections { get; set; } public List SelectionCommands { get; set; } public void ApplyDefaults() { if (string.IsNullOrEmpty(ExportPath)) { ExportPath = @"C:\temp"; } if (string.IsNullOrEmpty(FileName)) { FileName = string.Format("pdms_export_{0:yyyyMMdd_HHmmss}.rvm", DateTime.Now); } if (!Overwrite.HasValue) { Overwrite = true; } if (!string.IsNullOrEmpty(MdbName)) { MdbName = MdbName.Trim(); } } public string GetFullPath() { return System.IO.Path.Combine(ExportPath, FileName); } public List GetEffectiveSelections() { var raw = new List(); if (Selections != null && Selections.Count > 0) { raw.AddRange(Selections); } if (SelectionCommands != null && SelectionCommands.Count > 0) { raw.AddRange(SelectionCommands); } if (raw.Count == 0) { // 采用文档示例中的常见选择语句作为默认项 raw.Add("/EQUIP"); raw.Add("/PIPES"); } var normalized = new List(); foreach (var item in raw) { var text = (item ?? string.Empty).Trim(); if (string.IsNullOrEmpty(text)) { continue; } if (!text.StartsWith("EXPORT ", StringComparison.OrdinalIgnoreCase)) { text = "EXPORT " + text; } normalized.Add(text); } return normalized.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); } } public class ExportIfcResult { public bool Success { get; set; } public string Message { get; set; } public string FailureCategory { get; set; } public string ExportPath { get; set; } public string FileName { get; set; } public string FullPath { get; set; } public long FileSizeBytes { get; set; } public string ActiveMdbName { get; set; } public string RequestedMdbName { get; set; } public bool UsedRequestedMdb { get; set; } public bool BaseChecksPassed { get; set; } public string DriverMode { get; set; } public string RawError { get; set; } public List ExecutedCommands { get; set; } = new List(); public List Diagnostics { get; set; } = new List(); public DateTime StartedAt { get; set; } public DateTime CompletedAt { get; set; } public double DurationSeconds { get; set; } } }