105040 Clean code
This commit is contained in:
parent
1539afc65e
commit
5bcbacffd3
|
@ -189,7 +189,7 @@
|
|||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
ClipboardCopyMode="IncludeHeader"
|
||||
EnableColumnVirtualization="True"
|
||||
EnableColumnVirtualization="False"
|
||||
EnableRowVirtualization="True"
|
||||
ItemsSource="{Binding StuffedData, IsAsync=True}"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
|
@ -200,6 +200,7 @@
|
|||
<DataGrid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Click="IgnoreSelectedError_Click" Header="忽略选中项的异常" />
|
||||
<MenuItem Click="UnIgnoreSelectedError_Click" Header="取消忽略选中项的异常" />
|
||||
<MenuItem
|
||||
Click="Copy_Click"
|
||||
Header="复制导线名称"
|
||||
|
|
|
@ -40,7 +40,11 @@ public partial class MainWindow : Window
|
|||
ViewModel.StuffedData = [];
|
||||
ViewModel.ExportData = [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新列
|
||||
/// </summary>
|
||||
/// <param name="columns"></param>
|
||||
/// <param name="type"></param>
|
||||
public void UpdateDataGridColumnsByType(List<DataGridColumn> columns, DataGridType type)
|
||||
{
|
||||
try
|
||||
|
@ -101,12 +105,11 @@ public partial class MainWindow : Window
|
|||
LoadingMask.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
//private void GetDataBtn_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// var result = ExcelHelper.GetWireTerminalMappingTable();
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 生成模板数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GenTemplateBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
try
|
||||
|
@ -198,7 +212,11 @@ public partial class MainWindow : Window
|
|||
FlexMessageBox.Error($"{ex}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 忽略异常
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void IgnoreSelectedError_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ModelGenDataGrid.SelectedItems != null)
|
||||
|
@ -242,4 +260,24 @@ public partial class MainWindow : Window
|
|||
}
|
||||
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\ReportModel.cs" />
|
||||
<Compile Include="Models\StuffedDataModel.cs" />
|
||||
<Compile Include="Models\TerminalModel.cs" />
|
||||
<Compile Include="Utils\Consts.cs" />
|
||||
<Compile Include="Utils\DataGridType.cs" />
|
||||
<Compile Include="Utils\ExcelHelper.cs" />
|
||||
|
|
|
@ -342,7 +342,6 @@ public partial class MainViewModel : INotifyPropertyChanged
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
colorCode = displayColor switch
|
||||
{
|
||||
"红色" => "RD",
|
||||
|
@ -362,53 +361,11 @@ public partial class MainViewModel : INotifyPropertyChanged
|
|||
}
|
||||
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;
|
||||
|
||||
private void OnPropertyChanged(string 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");
|
||||
//foreach (var stuffedDataModel in StuffedData)
|
||||
StuffedData.AsParallel().WithDegreeOfParallelism(1).ForAll(stuffedDataModel =>
|
||||
|
||||
{
|
||||
//var numberTubeSpec = GetNumberTubeSpecification(stuffedDataModel.CrossSection, stuffedDataModel.WireColor);
|
||||
var exportModel = new ExportModel
|
||||
|
|
Loading…
Reference in New Issue