diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.cs index 727e728..e215582 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.cs @@ -176,133 +176,30 @@ public partial class MainViewModel : INotifyPropertyChanged ); return Task.FromResult(reportDatas.ToList()); } - - - - public void LoadReportData(IEnumerable data, List columns) - { - DataColumns = []; - //foreach (var column in columns) - //{ - // //Trace.WriteLine($"/// {column.Text}\r\n public string {column.ID} {{get;set;}} "); - - // DataColumns.Add(new DataGridTextColumn() - // { - // Header = column.Text, - // Binding = new System.Windows.Data.Binding(column.ID) - // }); - //} - - //DataColumns.Add(new DataGridTextColumn() - //{ - // Header = "变色管信息", - // Binding = new System.Windows.Data.Binding("DiscolorationDesc") - //}); - - //Data = []; - //var reportDatas = new ConcurrentBag(); - ////foreach (var entry in data) - //data.AsParallel().WithDegreeOfParallelism(8).ForAll(entry => - // { - // var obj = new ReportModel(); - // foreach (var column in columns) - // { - // if (!entry.Properties.ContainsKey(column.ColumnID)) continue; - // var value = entry.Properties[column.ColumnID].GetDisplayValue(); - // var property = typeof(ReportModel).GetProperty(column.ID); - // if (property != null) - // { - // property.SetValue(obj, value ?? ""); - // } - // } - // reportDatas.Add(obj); - // } - //); - //if (reportDatas != null && reportDatas.Any()) - //{ - // reportDatas.ToList().ForEach(Data.Add); - //} - //UpdateDataGridColumns([.. DataColumns], DataGridType.Originial); - //StuffedData = []; - //StuffData().ForEach(item => - //{ - // if (item != null) - // { - // StuffedData.Add(item); - // } - //}); - //OnPropertyChanged(nameof(StuffedDatas)); - - } - public async Task> StuffData(List data) { var datas = new ConcurrentBag(); - var isAllCe = true; - var isL1 = false; - var isL2 = false; - var isL3 = false; - var isPe = false; + //var isAllCe = true; + //var isL1 = false; + //var isL2 = false; + //var isL3 = false; + //var isPe = false; //foreach (var item in Data) data.AsParallel().WithDegreeOfParallelism(8).ForAll(item => { try { - - if (item == null) return; - //var data = item.MemoryClone(); - //new ReportModel - //{ - // Project = item.Project, - // Document = item.Document, - // CableName = item.CableName, - // PartNumber = item.PartNumber, - // ManufacturerCompany = item.ManufacturerCompany, - // Imprint = item.Imprint, - // Length = item.Length, - // OutsideDiameter = item.OutsideDiameter, - // CoreDiameter = item.CoreDiameter, - // ERPNr = item.ERPNr, - // DisplayColor = item.DisplayColor, - // DisplayStripeColor = item.DisplayStripeColor, - // WireName = item.WireName, - // WireTwisted = item.WireTwisted, - // ConnectorFrom = item.ConnectorFrom, - // ConnectorFromERPNr = item.ConnectorFromERPNr, - //}; var data = new StuffedDataModel(); - if (!string.IsNullOrEmpty(item.PartNumber)) - { - if (!item.PartNumber.Contains("-CE/")) - { - isAllCe = false; - } - } - if (!string.IsNullOrEmpty(item.Imprint)) - { - if (item.Imprint.StartsWith("L1")) - { - isL1 = true; - } - - if (item.Imprint.StartsWith("L2")) - { - isL2 = true; - } - - if (item.Imprint.StartsWith("L3")) - { - isL3 = true; - } - - if (item.Imprint.StartsWith("PE")) - { - isPe = true; - } - } + //if (!string.IsNullOrEmpty(item.PartNumber)) + //{ + // if (!item.PartNumber.Contains("-CE/")) + // { + // isAllCe = false; + // } + //} if (!string.IsNullOrEmpty(item.Imprint) && item.Imprint.Contains("&")) { var splitImprint = item.Imprint.Split('&'); @@ -396,10 +293,10 @@ public partial class MainViewModel : INotifyPropertyChanged }); - IsRequireCe = isAllCe; - IsUseDiscoloration = isL1 && isL2 && isL3 && isPe; - Trace.WriteLine($"isAllCE: {isAllCe}"); - Trace.WriteLine($"isSDIProject: {isL1 && isL2 && isL3 && isPe}"); + //IsRequireCe = isAllCe; + //IsUseDiscoloration = isL1 && isL2 && isL3 && isPe; + //Trace.WriteLine($"isAllCE: {isAllCe}"); + //Trace.WriteLine($"isSDIProject: {isL1 && isL2 && isL3 && isPe}"); return await Task.FromResult>([.. datas]); } ///