105040 Clean code
This commit is contained in:
parent
1539afc65e
commit
5bcbacffd3
|
@ -189,7 +189,7 @@
|
||||||
CanUserAddRows="False"
|
CanUserAddRows="False"
|
||||||
CanUserDeleteRows="False"
|
CanUserDeleteRows="False"
|
||||||
ClipboardCopyMode="IncludeHeader"
|
ClipboardCopyMode="IncludeHeader"
|
||||||
EnableColumnVirtualization="True"
|
EnableColumnVirtualization="False"
|
||||||
EnableRowVirtualization="True"
|
EnableRowVirtualization="True"
|
||||||
ItemsSource="{Binding StuffedData, IsAsync=True}"
|
ItemsSource="{Binding StuffedData, IsAsync=True}"
|
||||||
ScrollViewer.CanContentScroll="True"
|
ScrollViewer.CanContentScroll="True"
|
||||||
|
@ -200,6 +200,7 @@
|
||||||
<DataGrid.ContextMenu>
|
<DataGrid.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Click="IgnoreSelectedError_Click" Header="忽略选中项的异常" />
|
<MenuItem Click="IgnoreSelectedError_Click" Header="忽略选中项的异常" />
|
||||||
|
<MenuItem Click="UnIgnoreSelectedError_Click" Header="取消忽略选中项的异常" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Click="Copy_Click"
|
Click="Copy_Click"
|
||||||
Header="复制导线名称"
|
Header="复制导线名称"
|
||||||
|
|
|
@ -40,7 +40,11 @@ public partial class MainWindow : Window
|
||||||
ViewModel.StuffedData = [];
|
ViewModel.StuffedData = [];
|
||||||
ViewModel.ExportData = [];
|
ViewModel.ExportData = [];
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新列
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="columns"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
public void UpdateDataGridColumnsByType(List<DataGridColumn> columns, DataGridType type)
|
public void UpdateDataGridColumnsByType(List<DataGridColumn> columns, DataGridType type)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -101,12 +105,11 @@ public partial class MainWindow : Window
|
||||||
LoadingMask.Visibility = Visibility.Collapsed;
|
LoadingMask.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private void GetDataBtn_Click(object sender, RoutedEventArgs e)
|
/// <summary>
|
||||||
//{
|
/// 生成模板数据
|
||||||
// var result = ExcelHelper.GetWireTerminalMappingTable();
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
//}
|
/// <param name="e"></param>
|
||||||
|
|
||||||
private void GenTemplateBtn_Click(object sender, RoutedEventArgs e)
|
private void GenTemplateBtn_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -133,6 +136,12 @@ public partial class MainWindow : Window
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 异步加载数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reportData"></param>
|
||||||
|
/// <param name="columns"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public async Task LoadDataAsync(IEnumerable<BaseReportEntry> reportData, List<ReportColumn> columns)
|
public async Task LoadDataAsync(IEnumerable<BaseReportEntry> reportData, List<ReportColumn> columns)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -167,6 +176,11 @@ public partial class MainWindow : Window
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 导出报表数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void ExportDataBtn_Click(object sender, RoutedEventArgs e)
|
private void ExportDataBtn_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -198,7 +212,11 @@ public partial class MainWindow : Window
|
||||||
FlexMessageBox.Error($"{ex}");
|
FlexMessageBox.Error($"{ex}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 忽略异常
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
private void IgnoreSelectedError_Click(object sender, RoutedEventArgs e)
|
private void IgnoreSelectedError_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (ModelGenDataGrid.SelectedItems != null)
|
if (ModelGenDataGrid.SelectedItems != null)
|
||||||
|
@ -242,4 +260,24 @@ public partial class MainWindow : Window
|
||||||
}
|
}
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
/// <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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -113,6 +113,7 @@
|
||||||
<Compile Include="Models\InsulationModel.cs" />
|
<Compile Include="Models\InsulationModel.cs" />
|
||||||
<Compile Include="Models\ReportModel.cs" />
|
<Compile Include="Models\ReportModel.cs" />
|
||||||
<Compile Include="Models\StuffedDataModel.cs" />
|
<Compile Include="Models\StuffedDataModel.cs" />
|
||||||
|
<Compile Include="Models\TerminalModel.cs" />
|
||||||
<Compile Include="Utils\Consts.cs" />
|
<Compile Include="Utils\Consts.cs" />
|
||||||
<Compile Include="Utils\DataGridType.cs" />
|
<Compile Include="Utils\DataGridType.cs" />
|
||||||
<Compile Include="Utils\ExcelHelper.cs" />
|
<Compile Include="Utils\ExcelHelper.cs" />
|
||||||
|
|
|
@ -342,7 +342,6 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
colorCode = displayColor switch
|
colorCode = displayColor switch
|
||||||
{
|
{
|
||||||
"红色" => "RD",
|
"红色" => "RD",
|
||||||
|
@ -362,53 +361,11 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
}
|
}
|
||||||
return colorCode;
|
return colorCode;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 获取号码管规格
|
|
||||||
/// </summary>
|
|
||||||
//public string GetNumberTubeSpecification(string crossSection, string colorCode)
|
|
||||||
//{
|
|
||||||
// if (crossSection == "16")
|
|
||||||
// {
|
|
||||||
// if (colorCode == "YE") return "黄色热缩管φ12/定制";
|
|
||||||
// if (colorCode == "GN") return "绿色热缩管φ12/定制";
|
|
||||||
// if (colorCode == "RD") return "红色热缩管φ12/定制";
|
|
||||||
// if (colorCode == "BU") return "蓝色热缩管φ12/定制";
|
|
||||||
// if (colorCode == "GNYE") return "黄绿色热缩管φ12/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "0.3" || crossSection == "0.5" || crossSection == "0.75" || crossSection == "1")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ2.5/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "1.5")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ3/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "2.5")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ4/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "4")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ5/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "6")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ6/定制";
|
|
||||||
// }
|
|
||||||
// else if (crossSection == "10")
|
|
||||||
// {
|
|
||||||
// return "白色号码管φ8/定制";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return string.Empty;
|
|
||||||
//}
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
//new StudioSettings().Plugins.
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -430,7 +387,6 @@ public partial class MainViewModel : INotifyPropertyChanged
|
||||||
var nowDateStr = DateTime.Now.ToString("yyyy-MM-dd");
|
var nowDateStr = DateTime.Now.ToString("yyyy-MM-dd");
|
||||||
//foreach (var stuffedDataModel in StuffedData)
|
//foreach (var stuffedDataModel in StuffedData)
|
||||||
StuffedData.AsParallel().WithDegreeOfParallelism(1).ForAll(stuffedDataModel =>
|
StuffedData.AsParallel().WithDegreeOfParallelism(1).ForAll(stuffedDataModel =>
|
||||||
|
|
||||||
{
|
{
|
||||||
//var numberTubeSpec = GetNumberTubeSpecification(stuffedDataModel.CrossSection, stuffedDataModel.WireColor);
|
//var numberTubeSpec = GetNumberTubeSpecification(stuffedDataModel.CrossSection, stuffedDataModel.WireColor);
|
||||||
var exportModel = new ExportModel
|
var exportModel = new ExportModel
|
||||||
|
|
Loading…
Reference in New Issue