This commit is contained in:
2025-03-03 20:00:54 -07:00
2 changed files with 47 additions and 0 deletions

View File

@@ -11124,6 +11124,7 @@ Public Class ClsPaginas
#Region "Ordenes de Produccion"
PaginaDict.Add("/OP/CatConfiguracionProducto.aspx".ToUpper(), 790)
PaginaDict.Add("/OP/RepOS.aspx".ToUpper(), 791)
#End Region
'Antes de aquí.

View File

@@ -177,6 +177,52 @@ Namespace Extensiones
Dim dataTable As DataTable = New DataTable()
Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0)
' VALIDACIÓN DE COLUMNAS DUPLICADAS
Try
If firstRowHasHeaders Then
Dim columnNames As New List(Of String)()
For col As Integer = 0 To worksheet.Rows(curRow).AllocatedCells.Count - 1
Dim cellValue As Object = worksheet.Rows(curRow).Cells(col).Value
Dim colName As String = If(cellValue Is Nothing, $"Unnamed Column {col + 1}",
cellValue.ToString())
columnNames.Add(colName)
Next
Dim duplicates As New List(Of String)()
Dim dict As New Dictionary(Of String, Integer)(StringComparer.OrdinalIgnoreCase)
For Each name In columnNames
If dict.ContainsKey(name) Then
dict(name) += 1
Else
dict(name) = 1
End If
Next
For Each kvp In dict
If kvp.Value > 1 Then
duplicates.Add(kvp.Key)
End If
Next
If duplicates.Count > 0 Then
Alert(New Object, "El archivo de Excel contiene columnas duplicadas, las columnas duplicadas son: " & String.Join(", ", duplicates), TipoMensaje.MsgAdvertencia)
Return New DataTable
End If
End If
Catch ex As Exception
End Try
' FIN DE LA VALIDACIÓN
For cols = 0 To worksheet.Rows(curRow).AllocatedCells.Count - 1
If firstRowHasHeaders Then