EPLAN_PROD_Plugin/Sinvo.EplanHpD.Plugin.WPFUI/View/WireCheck/MainWindow.xaml.cs

645 lines
24 KiB
C#
Raw Normal View History

using EPLAN.Harness.Common;
using EPLAN.Harness.Common.Extensions;
using EPLAN.Harness.Core.Common;
2024-10-24 18:01:26 +08:00
using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.Events;
using EPLAN.Harness.Core.Lampy;
2024-10-24 18:01:26 +08:00
using EPLAN.Harness.Core.Settings;
using EPLAN.Harness.IO;
using EPLAN.Harness.ProjectCore;
using EPLAN.Harness.ProjectCore.Occurrences;
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
2024-10-24 18:01:26 +08:00
using EPLAN.Harness.ProjectCore.Report;
using HandyControl.Controls;
2024-10-24 18:01:26 +08:00
using Microsoft.Win32;
2024-12-05 14:37:31 +08:00
using Sinvo.EplanHpD.Plugin.WPFUI.Enum;
using Sinvo.EplanHpD.Plugin.WPFUI.Extension;
2024-10-24 18:01:26 +08:00
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace Sinvo.EplanHpD.Plugin.WPFUI;
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : System.Windows.Window
2024-10-24 18:01:26 +08:00
{
private MainViewModel ViewModel;
2024-10-24 18:01:26 +08:00
public delegate void UpdateDataGridColumns(List<DataGridColumn> columns, DataGridType type);
private IEnumerable<BaseReportEntry> datas;
private List<ReportColumn> reportColumns;
private FlexReport _report;
public MainWindow(FlexReport report)
2024-10-24 18:01:26 +08:00
{
InitializeComponent();
_report = report;
Init();
Application.Current.SetMainWindow(this);
}
private void Init()
{
2024-10-24 18:01:26 +08:00
this.DataContext = ViewModel = new MainViewModel();
ViewModel.UpdateDataGridColumns = UpdateDataGridColumnsByType;
var columns = _report.Reporter.Formater.RepColumns;
var datas = _report.GetAllReportEntries();
2024-10-24 18:01:26 +08:00
this.datas = datas;
this.reportColumns = columns;
ViewModel.DataColumns = [];
ViewModel.Data = [];
ViewModel.StuffedData = [];
ViewModel.ExportData = [];
ViewModel.SearchedData = [];
2024-10-24 18:01:26 +08:00
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 更新列
/// </summary>
/// <param name="columns"></param>
/// <param name="type"></param>
2024-10-24 18:01:26 +08:00
public void UpdateDataGridColumnsByType(List<DataGridColumn> columns, DataGridType type)
{
try
{
//this.Dispatcher.BeginInvoke(delegate ()
//{
switch (type)
{
case DataGridType.Originial:
UpdateOriginialDataGridColumns(columns);
break;
case DataGridType.Import:
UpdateImportDataGridColumns(columns);
break;
default:
break;
}
//});
}
catch (System.Exception ex)
{
FlexMessageBox.Error($"{ex}");
}
}
public void UpdateOriginialDataGridColumns(List<DataGridColumn> columns)
{
OriginialDataGrid.Columns.Clear();
//var columns = ViewModel.DataColumns;
foreach (var column in columns)
{
OriginialDataGrid.Columns.Add(column);
}
}
public void UpdateImportDataGridColumns(List<DataGridColumn> columns)
{
ImportDataGrid.Columns.Clear();
//var columns = ViewModel.DataColumns;
foreach (var column in columns)
{
ImportDataGrid.Columns.Add(column);
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
DataTabControl.SelectedIndex = 1;
LoadingMask.Visibility = Visibility.Visible;
try
{
ViewModel.CheckAll(ViewModel.StuffedData);
2024-10-24 18:01:26 +08:00
}
catch (System.Exception ex)
{
Trace.WriteLine(ex.ToString());
}
LoadingMask.Visibility = Visibility.Collapsed;
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 生成模板数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-10-24 18:01:26 +08:00
private void GenTemplateBtn_Click(object sender, RoutedEventArgs e)
{
try
{
DataTabControl.SelectedIndex = 2;
ViewModel.GenExportData();
}
catch (System.Exception ex)
{
FlexMessageBox.Error($"{ex}");
}
}
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
Growl.Register("Message", GrowlParent);
2024-10-24 18:01:26 +08:00
LoadingMask.Visibility = Visibility.Visible;
await this.Dispatcher.BeginInvoke(async delegate ()
{
ExcelHelper.CheckAndGetCache(true);
await LoadDataAsync(datas, reportColumns);
});
2024-10-24 18:01:26 +08:00
}
catch (System.Exception ex)
{
FlexMessageBox.Error($"{ex}");
}
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 异步加载数据
/// </summary>
/// <param name="reportData"></param>
/// <param name="columns"></param>
/// <returns></returns>
2024-10-24 18:01:26 +08:00
public async Task LoadDataAsync(IEnumerable<BaseReportEntry> reportData, List<ReportColumn> columns)
{
var dataColumns = ViewModel.GetColumns(columns);
var data = ViewModel.LoadReportDataAsync(reportData, columns);
Task.WaitAll(dataColumns, data);
var stuffedData = ViewModel.StuffData(data.Result);
_ = stuffedData.ContinueWith(x =>
2024-10-24 18:01:26 +08:00
{
_ = this.Dispatcher.BeginInvoke(delegate ()
{
try
{
ViewModel.DataColumns?.Clear();
dataColumns.Result.Where(it => it != null).ForEach(ViewModel.DataColumns.Add);
ViewModel.Data?.Clear();
data.Result.Where(it => it != null).ForEach(ViewModel.Data.Add);
ViewModel.StuffedData?.Clear();
stuffedData.Result.Where(it => it != null).ForEach(ViewModel.StuffedData.Add);
UpdateDataGridColumnsByType([.. ViewModel.DataColumns], DataGridType.Originial);
ViewModel.SearchByWireName(null);
2024-10-24 18:01:26 +08:00
}
catch (Exception ex)
{
Trace.WriteLine($"{ex}");
}
LoadingMask.Visibility = Visibility.Collapsed;
});
});
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 导出报表数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-10-24 18:01:26 +08:00
private void ExportDataBtn_Click(object sender, RoutedEventArgs e)
{
try
{
if (ViewModel.ExportData == null || ViewModel.ExportData.Count <= 0)
{
2024-11-08 17:11:07 +08:00
FlexMessageBox.Info($"无数据可导出,请先点击上方生成导入模板数据!");
2024-10-24 18:01:26 +08:00
}
else
{
if (ViewModel.NameType == ExportFileNameType.ProjectNo && string.IsNullOrEmpty(ViewModel.ProjectNo))
2024-10-24 18:01:26 +08:00
{
FlexMessageBox.Warning($"请输入项目号!");
}
else
2024-10-24 18:01:26 +08:00
{
SaveFileDialog saveFileDialog = new()
{
Filter = "MS Excel (*.xlsx)|*.xlsx",//Singleton<LRS>.Instance["Report_ExpFilter", "Report_ExpFilter"],
FilterIndex = 1,
//FileName = $"{单芯线下单}{DateTime.Now:yyyy_MM_dd}.xlsx",
FileName = $"{GetFileName()}.xlsx",
AddExtension = true,
InitialDirectory = StudioSettings.Instance.ReportExport_Path,
CheckPathExists = true
};
if (saveFileDialog.ShowDialog() == true)
{
ExcelHelper.SaveByTemplate(ViewModel.ExportData, Path.Combine(FlexIOBase.GetParentPath(saveFileDialog.FileName), saveFileDialog.FileName));
FlexMessageBox.Info($"导出完成!");
}
2024-10-24 18:01:26 +08:00
}
}
}
catch (System.Exception ex)
{
FlexMessageBox.Error($"{ex}");
}
}
private string GetFileName()
{
if (ViewModel.NameType == ExportFileNameType.ProjectNo)
{
return $"{ViewModel.ProjectNo}";
}
if (ViewModel.NameType == ExportFileNameType.Mechanism)
{
return $"{ViewModel.MechanismNo}&{ViewModel.MechanismName}";
}
return $"{ViewModel.CustomFileName}";
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 忽略异常
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
2024-10-24 18:01:26 +08:00
private void IgnoreSelectedError_Click(object sender, RoutedEventArgs e)
{
bool isContinue = false;
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
"Report",
"忽略异常后在导出下单报表时,将不会再进行管控,是否继续?", false) == System.Windows.Forms.DialogResult.OK)
{
isContinue = true;
}
if (isContinue)
if (ModelGenDataGrid.SelectedItems != null)
2024-10-24 18:01:26 +08:00
{
var selectedRows = ModelGenDataGrid.SelectedItems;
foreach (var item in selectedRows)
2024-10-24 18:01:26 +08:00
{
if (item is StuffedDataModel model)
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
{
//var stuffedItem = ViewModel.StuffedData.Where(it => it.WireName == model.WireName).First();
if (model.IsError)
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
//stuffedItem.IsIgnore = true;
model.IsIgnore = true;
}
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
}
2024-10-24 18:01:26 +08:00
}
}
}
private void Copy_Click(object sender, RoutedEventArgs e)
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
try
2024-10-24 18:01:26 +08:00
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
if (sender is MenuItem item)
2024-10-24 18:01:26 +08:00
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
var selectItems = ModelGenDataGrid.SelectedItems;
if (item.Tag?.ToString() == "MNo")
{
var str = string.Join("\n", selectItems.Cast<StuffedDataModel>().Select(item => item.WireCode));
Clipboard.SetText(str);
}
if (item.Tag?.ToString() == "ErrMsg")
{
var str = string.Join("\n", selectItems.Cast<StuffedDataModel>().Select(item => item.CheckedMsg));
Clipboard.SetText(str);
}
if (item.Tag?.ToString() == "MNoAndErrMsg")
{
var str = string.Join("\n", selectItems.Cast<StuffedDataModel>().Select(item => $"{item.WireCode}\t{item.CheckedMsg}"));
Clipboard.SetText(str);
}
if (item.Tag?.ToString() == "WireName")
{
var str = string.Join("\n", selectItems.Cast<StuffedDataModel>().Select(item => $"{item.WireName}"));
Clipboard.SetText(str);
}
2024-10-24 18:01:26 +08:00
}
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
e.Handled = true;
}
catch (Exception ex)
{
FlexMessageBox.Error(ex.Message);
2024-10-24 18:01:26 +08:00
}
}
2024-10-26 14:40:46 +08:00
/// <summary>
/// 取消忽略异常
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void UnIgnoreSelectedError_Click(object sender, RoutedEventArgs e)
{
if (ModelGenDataGrid.SelectedItems != null)
{
var selectedRows = ModelGenDataGrid.SelectedItems;
foreach (var item in selectedRows)
{
if (item is StuffedDataModel model)
{
model.IsIgnore = false;
}
}
}
}
private void GoToSource()
{
var selectItems = ModelGenDataGrid.SelectedItems;
if (selectItems != null && selectItems.Count > 0)
//if (selectItems is List<StuffedDataModel> reportItems)
{
//foreach (ReportModel item in selectItems)
StuffedDataModel item = (StuffedDataModel)selectItems[0];
if (item != null)
{
var repoetEntry = datas.FirstOrDefault(it => it.ID == item.OccPartId);
_report.DataSources.GetSources();
if (repoetEntry.OrigDocIDs == null || repoetEntry.OrigDocIDs.Count == 0)
{
repoetEntry.OrigDocIDs = new List<string>();
foreach (IDataSource dataSource in _report.DataSources.GetSources())
{
IFlexStudioDocument documentByID = FlexProject.CurrentProject.GetDocumentByID(dataSource.ParentID);
FlexDesigner designer;
if ((designer = (documentByID as FlexDesigner)) != null)
{
FlexProject.CurrentProject.LoadDesignerMetadata(designer);
}
if (repoetEntry.OrigID != null && SelfControler<BaseOccurrence>.FindInstance(repoetEntry.OrigID) != null)
{
repoetEntry.OrigDocIDs.Add(documentByID.ID);
}
FlexProject.CurrentProject.CloseAllUsedDocuments();
}
}
foreach (string text in repoetEntry.OrigDocIDs.Distinct<string>())
{
FlexDesigner flexDesigner;
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
if (text != string.Empty && (flexDesigner = (SelfControler<FlexBaseOrganizer>.FindInstance(text) as FlexDesigner)) != null && (flexDesigner is not FlexWorkdesk || Lamparna.Instance.IsWorkdeskAvailable()) && (flexDesigner is not FlexWorkspace || Lamparna.Instance.IsWorkspaceAvailable()))
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
Singleton<EventProvider>.Instance.Invoke(NamedEvents.Open_Studio_Document, this._report,
[
flexDesigner
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
]);
if (flexDesigner.ReaderStatus != DataReaderStatus.Full)
{
break;
}
flexDesigner.SelectSet.Clear();
string origID = repoetEntry.OrigID;
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
List<BaseOccurrence> list = [];
BaseOccurrence baseOccurrence = SelfControler<BaseOccurrence>.FindInstance(origID);
if (baseOccurrence != null && flexDesigner.IsOccRegistered(baseOccurrence))
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
Singleton<EventProvider>.Instance.Invoke(NamedEvents.TreeView_BeginUpdate, this, []);
if (_report.Reporter is AggregatedBOMReporter)
{
using (List<string>.Enumerator enumerator3 = flexDesigner.GetOccurrencesWithSameLibID(new GUIDVerClass(baseOccurrence.LibID, baseOccurrence.LibVersion), false).GetEnumerator())
{
while (enumerator3.MoveNext())
{
string objID = enumerator3.Current;
list.Add(SelfControler<BaseOccurrence>.FindInstance(objID));
}
}
this.AddToDesignerSelectSet(flexDesigner, list);
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
Singleton<EventProvider>.Instance.Invoke(NamedEvents.TreeView_EndUpdate, this, []);
flexDesigner.FitToSelectSet();
continue;
}
if (baseOccurrence is OccSurfaceProtectionBase)
{
using (IEnumerator<IOccBundle> enumerator4 = (baseOccurrence as OccSurfaceProtectionBase).GetParentBundles().GetEnumerator())
{
while (enumerator4.MoveNext())
{
IOccBundle occBundle = enumerator4.Current;
list.Add(occBundle as BaseOccurrence);
}
}
this.AddToDesignerSelectSet(flexDesigner, list);
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
Singleton<EventProvider>.Instance.Invoke(NamedEvents.TreeView_EndUpdate, this, []);
flexDesigner.FitToSelectSet();
continue;
}
//if (_report.Reporter is AccessoryReporter && (baseOccurrence is OccAttachedPart || baseOccurrence is OccAttachedPartEC || baseOccurrence is BaseEncapsulatedOcc))
//{
// this.GoToSourceAttachedPart(baseOccurrence);
// Singleton<EventProvider>.Instance.Invoke(NamedEvents.TreeView_EndUpdate, this, Array.Empty<object>());
// break;
//}
list.Add(baseOccurrence);
this.AddToDesignerSelectSet(flexDesigner, list);
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
Singleton<EventProvider>.Instance.Invoke(NamedEvents.TreeView_EndUpdate, this, []);
flexDesigner.FitToSelectSet();
//flexDesigner.
flexDesigner.SelectSet.OnSelectionChanged();
}
}
}
}
}
}
private void AddToDesignerSelectSet(FlexDesigner designerDoc, List<BaseOccurrence> occurrences)
{
改进电缆数据处理和检查逻辑,更新版本号 在 `CheckTest.cs` 文件中,添加了多个测试方法,包括 `DPETerminalCheckTest`、`DPETerminalCrossSectionCheckTest` 和 `TerminalCheckTest`,用于检查不同端子的测试逻辑。 在 `AssemblyInfo.cs` 文件中,更新了程序集版本号和文件版本号。 在 `StuffTest.cs` 文件中,注释掉了一些断言语句,并添加了一个新的测试方法 `StuffedNameTubeTest`,用于测试号码管处理逻辑。 在 `LectotypeWindow.xaml` 文件中,添加了 `util` 命名空间引用,并定义了多个 `ControlTemplate` 模板和一个 `LectotypeLengthDataTemplateSelector` 模板选择器,用于根据线材类型选择不同的显示模板。同时,将 `DataGrid` 控件替换为 `ListView` 控件,并添加了上下文菜单和样式触发器。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `ToSourceMenuItem_Click` 方法,用于处理上下文菜单项的点击事件。 在 `MainWindow.xaml.cs` 文件中,重构了 `AddToDesignerSelectSet` 方法,添加了异常处理逻辑。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中,添加了 `LectotypeLengthDataTemplateSelector.cs` 文件的编译项。 在 `ExcelHelper.cs` 文件中,修改了 `GetWireTerminalMappingTable` 方法的过滤逻辑。 新增了 `LectotypeLengthDataTemplateSelector.cs` 文件,定义了 `LectotypeLengthDataTemplateSelector` 类,用于根据线材类型选择不同的数据模板。 在 `LectotypeViewModel.cs` 文件中: * 添加了对 `EPLAN.Harness.ProjectCore.Occurrences` 命名空间的引用。 * 添加了 `StuffedWires` 属性及其对应的私有字段 `_stuffedWires`。 * 在 `LoadData` 方法中,添加了对 `StuffData` 方法的调用,并将结果赋值给 `Wires`。 * 添加了 `StuffData` 方法,用于整理和合并电缆数据。 * 在 `ToSource` 方法中,添加了根据电缆名称获取设计器并设置可见性的逻辑。 * 修改了 `CableType` 的默认值从 "位置类型" 改为 "未知类型"。 在 `MainViewModel.Check.cs` 文件中: * 添加了 `CheckDPETerminals` 方法,用于检查地排端子。 * 修改了 `CheckTerminals` 方法,移除了对 `D-PE` 前缀的特殊处理逻辑。 * 修改了 `GetD_PECanUsedTerminal` 方法,注释掉了获取不包含前缀的端子的逻辑。 在 `DesignPluginEntry.cs` 文件中: * 注释掉了 `DesignPluginEntry` 类实现的 `IHpDPlugin` 接口。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.6` 更新到 `1.0.0.14`。
2024-11-08 08:34:20 +08:00
try
{
改进电缆数据处理和检查逻辑,更新版本号 在 `CheckTest.cs` 文件中,添加了多个测试方法,包括 `DPETerminalCheckTest`、`DPETerminalCrossSectionCheckTest` 和 `TerminalCheckTest`,用于检查不同端子的测试逻辑。 在 `AssemblyInfo.cs` 文件中,更新了程序集版本号和文件版本号。 在 `StuffTest.cs` 文件中,注释掉了一些断言语句,并添加了一个新的测试方法 `StuffedNameTubeTest`,用于测试号码管处理逻辑。 在 `LectotypeWindow.xaml` 文件中,添加了 `util` 命名空间引用,并定义了多个 `ControlTemplate` 模板和一个 `LectotypeLengthDataTemplateSelector` 模板选择器,用于根据线材类型选择不同的显示模板。同时,将 `DataGrid` 控件替换为 `ListView` 控件,并添加了上下文菜单和样式触发器。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `ToSourceMenuItem_Click` 方法,用于处理上下文菜单项的点击事件。 在 `MainWindow.xaml.cs` 文件中,重构了 `AddToDesignerSelectSet` 方法,添加了异常处理逻辑。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中,添加了 `LectotypeLengthDataTemplateSelector.cs` 文件的编译项。 在 `ExcelHelper.cs` 文件中,修改了 `GetWireTerminalMappingTable` 方法的过滤逻辑。 新增了 `LectotypeLengthDataTemplateSelector.cs` 文件,定义了 `LectotypeLengthDataTemplateSelector` 类,用于根据线材类型选择不同的数据模板。 在 `LectotypeViewModel.cs` 文件中: * 添加了对 `EPLAN.Harness.ProjectCore.Occurrences` 命名空间的引用。 * 添加了 `StuffedWires` 属性及其对应的私有字段 `_stuffedWires`。 * 在 `LoadData` 方法中,添加了对 `StuffData` 方法的调用,并将结果赋值给 `Wires`。 * 添加了 `StuffData` 方法,用于整理和合并电缆数据。 * 在 `ToSource` 方法中,添加了根据电缆名称获取设计器并设置可见性的逻辑。 * 修改了 `CableType` 的默认值从 "位置类型" 改为 "未知类型"。 在 `MainViewModel.Check.cs` 文件中: * 添加了 `CheckDPETerminals` 方法,用于检查地排端子。 * 修改了 `CheckTerminals` 方法,移除了对 `D-PE` 前缀的特殊处理逻辑。 * 修改了 `GetD_PECanUsedTerminal` 方法,注释掉了获取不包含前缀的端子的逻辑。 在 `DesignPluginEntry.cs` 文件中: * 注释掉了 `DesignPluginEntry` 类实现的 `IHpDPlugin` 接口。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.6` 更新到 `1.0.0.14`。
2024-11-08 08:34:20 +08:00
List<BaseOccurrence> list = new List<BaseOccurrence>();
foreach (BaseOccurrence baseOccurrence in occurrences)
{
改进电缆数据处理和检查逻辑,更新版本号 在 `CheckTest.cs` 文件中,添加了多个测试方法,包括 `DPETerminalCheckTest`、`DPETerminalCrossSectionCheckTest` 和 `TerminalCheckTest`,用于检查不同端子的测试逻辑。 在 `AssemblyInfo.cs` 文件中,更新了程序集版本号和文件版本号。 在 `StuffTest.cs` 文件中,注释掉了一些断言语句,并添加了一个新的测试方法 `StuffedNameTubeTest`,用于测试号码管处理逻辑。 在 `LectotypeWindow.xaml` 文件中,添加了 `util` 命名空间引用,并定义了多个 `ControlTemplate` 模板和一个 `LectotypeLengthDataTemplateSelector` 模板选择器,用于根据线材类型选择不同的显示模板。同时,将 `DataGrid` 控件替换为 `ListView` 控件,并添加了上下文菜单和样式触发器。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `ToSourceMenuItem_Click` 方法,用于处理上下文菜单项的点击事件。 在 `MainWindow.xaml.cs` 文件中,重构了 `AddToDesignerSelectSet` 方法,添加了异常处理逻辑。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中,添加了 `LectotypeLengthDataTemplateSelector.cs` 文件的编译项。 在 `ExcelHelper.cs` 文件中,修改了 `GetWireTerminalMappingTable` 方法的过滤逻辑。 新增了 `LectotypeLengthDataTemplateSelector.cs` 文件,定义了 `LectotypeLengthDataTemplateSelector` 类,用于根据线材类型选择不同的数据模板。 在 `LectotypeViewModel.cs` 文件中: * 添加了对 `EPLAN.Harness.ProjectCore.Occurrences` 命名空间的引用。 * 添加了 `StuffedWires` 属性及其对应的私有字段 `_stuffedWires`。 * 在 `LoadData` 方法中,添加了对 `StuffData` 方法的调用,并将结果赋值给 `Wires`。 * 添加了 `StuffData` 方法,用于整理和合并电缆数据。 * 在 `ToSource` 方法中,添加了根据电缆名称获取设计器并设置可见性的逻辑。 * 修改了 `CableType` 的默认值从 "位置类型" 改为 "未知类型"。 在 `MainViewModel.Check.cs` 文件中: * 添加了 `CheckDPETerminals` 方法,用于检查地排端子。 * 修改了 `CheckTerminals` 方法,移除了对 `D-PE` 前缀的特殊处理逻辑。 * 修改了 `GetD_PECanUsedTerminal` 方法,注释掉了获取不包含前缀的端子的逻辑。 在 `DesignPluginEntry.cs` 文件中: * 注释掉了 `DesignPluginEntry` 类实现的 `IHpDPlugin` 接口。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.6` 更新到 `1.0.0.14`。
2024-11-08 08:34:20 +08:00
bool? flag;
if (baseOccurrence == null)
{
flag = null;
}
else
{
FlexBaseOrganizer parentOrganizer = baseOccurrence.GetParentOrganizer();
flag = ((parentOrganizer != null) ? new bool?(parentOrganizer.IsOccRegistered(baseOccurrence)) : null);
}
if (flag ?? false)
{
baseOccurrence.SetVisibility(true, null);
list.Add(baseOccurrence);
}
}
改进电缆数据处理和检查逻辑,更新版本号 在 `CheckTest.cs` 文件中,添加了多个测试方法,包括 `DPETerminalCheckTest`、`DPETerminalCrossSectionCheckTest` 和 `TerminalCheckTest`,用于检查不同端子的测试逻辑。 在 `AssemblyInfo.cs` 文件中,更新了程序集版本号和文件版本号。 在 `StuffTest.cs` 文件中,注释掉了一些断言语句,并添加了一个新的测试方法 `StuffedNameTubeTest`,用于测试号码管处理逻辑。 在 `LectotypeWindow.xaml` 文件中,添加了 `util` 命名空间引用,并定义了多个 `ControlTemplate` 模板和一个 `LectotypeLengthDataTemplateSelector` 模板选择器,用于根据线材类型选择不同的显示模板。同时,将 `DataGrid` 控件替换为 `ListView` 控件,并添加了上下文菜单和样式触发器。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `ToSourceMenuItem_Click` 方法,用于处理上下文菜单项的点击事件。 在 `MainWindow.xaml.cs` 文件中,重构了 `AddToDesignerSelectSet` 方法,添加了异常处理逻辑。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中,添加了 `LectotypeLengthDataTemplateSelector.cs` 文件的编译项。 在 `ExcelHelper.cs` 文件中,修改了 `GetWireTerminalMappingTable` 方法的过滤逻辑。 新增了 `LectotypeLengthDataTemplateSelector.cs` 文件,定义了 `LectotypeLengthDataTemplateSelector` 类,用于根据线材类型选择不同的数据模板。 在 `LectotypeViewModel.cs` 文件中: * 添加了对 `EPLAN.Harness.ProjectCore.Occurrences` 命名空间的引用。 * 添加了 `StuffedWires` 属性及其对应的私有字段 `_stuffedWires`。 * 在 `LoadData` 方法中,添加了对 `StuffData` 方法的调用,并将结果赋值给 `Wires`。 * 添加了 `StuffData` 方法,用于整理和合并电缆数据。 * 在 `ToSource` 方法中,添加了根据电缆名称获取设计器并设置可见性的逻辑。 * 修改了 `CableType` 的默认值从 "位置类型" 改为 "未知类型"。 在 `MainViewModel.Check.cs` 文件中: * 添加了 `CheckDPETerminals` 方法,用于检查地排端子。 * 修改了 `CheckTerminals` 方法,移除了对 `D-PE` 前缀的特殊处理逻辑。 * 修改了 `GetD_PECanUsedTerminal` 方法,注释掉了获取不包含前缀的端子的逻辑。 在 `DesignPluginEntry.cs` 文件中: * 注释掉了 `DesignPluginEntry` 类实现的 `IHpDPlugin` 接口。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.6` 更新到 `1.0.0.14`。
2024-11-08 08:34:20 +08:00
designerDoc.SelectSet.Add(list);
}
catch (Exception ex)
{
FlexMessageBox.Error(ex.Message);
}
//designerDoc.
}
private void GoToSource_Click(object sender, RoutedEventArgs e)
{
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
try
{
//HideOthers();
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
GoToSource();
2024-11-13 13:39:06 +08:00
if (ViewModel.ToSourceAndMinSelf)
{
this.WindowState = WindowState.Minimized;
}
更新多个文件,添加新功能和修复bug 在 `CheckTest.cs` 文件中,添加了三个新的测试方法:`CheckWireErpNrTest`、`ChecImprintTest` 和 `CheckSizeTest`。 在 `AssemblyInfo.cs` 文件中,将程序集版本和文件版本从 `1.0.0.5` 更新为 `1.0.0.6`。 在 `StuffTest.cs` 文件中,添加了一个新的断言 `Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");`。 在 `LectotypeWindow.xaml` 文件中,添加了一个新的 `Window` 定义,包括资源字典、按钮和 `TabControl` 控件。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `LectotypeWindow` 类的定义和相关的事件处理方法。 在 `MainWindow.xaml` 文件中,移除了旧的样式定义,添加了新的资源字典引用,并更新了 `GroupBox` 为 `hc:Card` 控件,调整了按钮样式和 `DataGrid` 的样式。 在 `MainWindow.xaml` 文件中,更新了 `DataGrid` 的 `RowStyle` 和 `CellStyle`,并添加了新的触发器和样式设置。 在 `MainWindow.xaml` 文件中,更新了检查配置项的布局,使用 `hc:Card` 控件替换了 `GroupBox`,并调整了文本块的样式和布局。 在 `MainWindow.xaml.cs` 文件中: * 在 `MainWindow` 类中添加了对 `model.IsError` 的检查,如果为 `true`,则将 `model.IsIgnore` 设置为 `true`。 * 在 `Copy_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 在 `GoToSource_Click` 方法中添加了 `try-catch` 块来捕获异常,并在捕获到异常时显示错误消息。 * 将 `Array.Empty<object>()` 替换为 `[]`。 在 `CheckedModel.cs` 文件中: * 注释掉了 `SetProperty` 方法中对 `Equals` 方法的检查。 在 `LectotypeModel.cs` 文件中: * 新增了 `LectotypeModel` 类,包含多个属性和相应的 `OnPropertyChanged` 调用。 在 `LineSegmentModel.cs` 文件中: * 新增了 `LineSegmentModel` 类,包含 `LineAxisNo`、`LineType` 和 `LineParagraph` 属性。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.5` 更新到 `1.0.0.6`。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中: * 添加了对 `EPLAN.Harness.MathLib` 的引用。 * 添加了 `LectotypeWindow.xaml` 和 `TestWindow.xaml` 及其对应的代码文件。 * 添加了 `HandyControl` 包的引用。 在 `TestWindow.xaml` 文件中: * 新增了 `TestWindow` 窗口的 XAML 定义,包含一个 `DataGrid` 控件。 在 `TestWindow.xaml.cs` 文件中: * 新增了 `TestWindow` 类,包含加载数据的方法。 在 `ExcelHelper.cs` 文件中: * 修改了 `GetWireTerminalMappingTable` 方法,使其在 `Prefix` 为 `null` 时也能匹配。 * 新增了 `GetWireInfo` 方法,用于获取线材信息。 在 `LectotypeViewModel.cs` 文件中: * 新增了 `LectotypeViewModel` 类,包含加载数据的方法和多个辅助方法。 在 `MainViewModel.Check.cs` 文件中: * 在 `ValidateItem` 方法中添加了对 `CheckWireErpNr` 方法的调用。 * 新增了 `CheckWireErpNr` 方法,用于检查线材料号。 * 在 `CheckNumberTube` 方法中添加了对 `item.Imprint` 是否为空的检查。 将 `data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry =>` 修改为 `data.Where(it => it.OrigOcc == "OccWire" && !(it?.Properties["WireName"]?.GetDisplayValue()?.StartsWith("导线") ?? false)).AsParallel().WithDegreeOfParallelism(1).ForAll(entry =>`,以过滤出 `OrigOcc` 为 "OccWire" 且 `WireName` 不以 "导线" 开头的数据,并将并行度设置为 1。 将 `data.FrontTerminalModel = item.ConnectorFrom.Contains(":") ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom;` 修改为 `data.FrontTerminalModel = item.ConnectorFrom?.Contains(":") ?? false ? item.ConnectorFrom.Split(':')[0] : item.ConnectorFrom ?? "";`,以处理 `ConnectorFrom` 可能为 null 的情况。 将 `data.RearTerminalModel = item.ConnectorTo.Contains(":") ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo;` 修改为 `data.RearTerminalModel = item.ConnectorTo?.Contains(":") ?? false ? item.ConnectorTo.Split(':')[0] : item.ConnectorTo ?? "";`,以处理 `ConnectorTo` 可能为 null 的情况。 删除了 `if (insulationModels.Any()) { data.Insulation = insulationModels.First(); }` 语句块,简化了代码逻辑。 更新了 `GetWireColorCode` 方法中的注释,将原来的注释替换为更简洁的版本。
2024-11-07 12:14:44 +08:00
}
catch (Exception ex)
{
FlexMessageBox.Error(ex.Message);
}
}
private void OthersWireShow(bool show = false)
{
var selectItems = ModelGenDataGrid.SelectedItems;
if (selectItems != null && selectItems.Count > 0)
//if (selectItems is List<StuffedDataModel> reportItems)
{
//foreach (ReportModel item in selectItems)
StuffedDataModel item = (StuffedDataModel)selectItems[0];
if (item != null)
{
var reportEntry = datas.FirstOrDefault(it => it.Properties["WireName"].ValueString() == item.WireName);
_report.DataSources.GetSources();
if (reportEntry.OrigDocIDs == null || reportEntry.OrigDocIDs.Count == 0)
{
reportEntry.OrigDocIDs = new List<string>();
foreach (IDataSource dataSource in _report.DataSources.GetSources())
{
IFlexStudioDocument documentByID = FlexProject.CurrentProject.GetDocumentByID(dataSource.ParentID);
FlexDesigner designer;
if ((designer = (documentByID as FlexDesigner)) != null)
{
FlexProject.CurrentProject.LoadDesignerMetadata(designer);
}
if (reportEntry.OrigID != null && SelfControler<BaseOccurrence>.FindInstance(reportEntry.OrigID) != null)
{
reportEntry.OrigDocIDs.Add(documentByID.ID);
}
FlexProject.CurrentProject.CloseAllUsedDocuments();
}
}
if (reportEntry.OrigDocIDs != null && reportEntry.OrigDocIDs.Any())
{
var docId = reportEntry.OrigDocIDs.First();
var flexDesigner = SelfControler<FlexBaseOrganizer>.FindInstance(docId) as FlexDesigner;
if (flexDesigner != null)
{
var cables = flexDesigner.GetAllOccurrencesByLibID(true);
foreach (var cable in cables)
{
Debug.WriteLine("");
Debug.Write(cable.Key);
Debug.Write("-->");
//Debug.Write(string.Join(",", cable.Value));
Debug.WriteLine("");
cable.Value.ForEach(it =>
{
var occ = SelfControler<BaseOccurrence>.FindInstance(it);
if (occ is OccWire wire)
{
wire.SetVisibility(show, null);
Debug.WriteLine($"{wire.Name} SetVisibility {show}");
}
});
//Debug.Write("-->");
}
}
}
}
}
}
private void SearchBar_SearchStarted(object sender, HandyControl.Data.FunctionEventArgs<string> e)
{
Trace.WriteLine(e.Info.ToString());
ViewModel.SearchByWireName(e.Info);
}
private void RefreshReportDataBtn_Click(object sender, RoutedEventArgs e)
{
if (_report != null)
{
var isNeedUpdate = FlexReport.IsUpToDate(_report);
if (!isNeedUpdate)
{
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
"Report",
"是否更新报表数据?", false) == System.Windows.Forms.DialogResult.OK)
{
_report.UpdateReport();
Init();
try
{
LoadingMask.Visibility = Visibility.Visible;
this.Dispatcher.BeginInvoke(async delegate ()
{
ExcelHelper.CheckAndGetCache(true);
await LoadDataAsync(datas, reportColumns);
});
}
catch (System.Exception ex)
{
FlexMessageBox.Error($"{ex}");
}
}
}
else
{
try
{
Growl.Success("报表数据已是最新!", "Message");
}
catch (Exception)
{
}
}
}
}
private void ToSourceAndHideOthers_Click(object sender, RoutedEventArgs e)
{
try
{
OthersWireShow();
GoToSource();
if (ViewModel.ToSourceAndMinSelf)
{
this.WindowState = WindowState.Minimized;
}
}
catch (Exception ex)
{
FlexMessageBox.Error(ex.Message);
}
}
private void ShowAllWire_Click(object sender, RoutedEventArgs e)
{
OthersWireShow(true);
GoToSource();
}
2024-10-24 18:01:26 +08:00
}