2026-01-27 03

This commit is contained in:
2026-01-27 13:51:55 +01:00
parent 328dc37571
commit a222729a6a
4 changed files with 30 additions and 26 deletions

View File

@@ -96,7 +96,7 @@ Public Class ucModelosGruas
Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar Private Sub ap_Enlazar(Celda As DevExpress.Xpf.Grid.EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
Dim pr As modelosgruas = gc.CurrentItem Dim pr As productos = gc.CurrentItem
'If pr.Tipo = TipoProductoEnum.TRIBUNA Then 'If pr.Tipo = TipoProductoEnum.TRIBUNA Then
' FuncionesDinamicas.AbrirAP(New ucProductoTribuna(pr.idProducto), OtrosParametros) ' FuncionesDinamicas.AbrirAP(New ucProductoTribuna(pr.idProducto), OtrosParametros)
'Else 'Else
@@ -107,11 +107,11 @@ Public Class ucModelosGruas
Private Sub ap_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, OpcionGuardado As Integer) Handles Me.AntesGuardar Private Sub ap_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, OpcionGuardado As Integer) Handles Me.AntesGuardar
End Sub End Sub
Public Function Obtienemodelosgruas(TextoBusqueda As String, IncluirBajas As Boolean) As List(Of modelosgruas) Public Function Obtienemodelosgruas(TextoBusqueda As String, IncluirBajas As Boolean) As List(Of productos)
Dim iqPr = bd.modelosgruas.AsQueryable Dim iqPr = bd.productos.AsQueryable
If IncluirBajas = False Then iqPr = iqPr.Where(Function(x) x.FechaBaja Is Nothing) If IncluirBajas = False Then iqPr = iqPr.Where(Function(x) x.FechaBaja Is Nothing)
Dim rs As List(Of modelosgruas) Dim rs As List(Of productos)
Do Do
Dim iNumExc As Integer = 0 Dim iNumExc As Integer = 0
Try Try
@@ -136,7 +136,7 @@ Public Class ucModelosGruas
Public Async Sub ObtienemodelosgruasAsync(bd As tscGrupoSanchoToro, Background As Boolean) Public Async Sub ObtienemodelosgruasAsync(bd As tscGrupoSanchoToro, Background As Boolean)
Try Try
Dim rs As New List(Of modelosgruas) Dim rs As New List(Of productos)
Dim Busqueda = tsEFCore8.Extensiones.ObjetoNothingAVacio(Me.teBusqueda.EditValue) Dim Busqueda = tsEFCore8.Extensiones.ObjetoNothingAVacio(Me.teBusqueda.EditValue)
Dim IncluirBajas = Me.cbIncluirBajas.IsChecked Dim IncluirBajas = Me.cbIncluirBajas.IsChecked
If Background Then If Background Then
@@ -146,7 +146,7 @@ Public Class ucModelosGruas
End Sub) End Sub)
Else Else
If DXSplashScreen.IsActive = False Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)() If DXSplashScreen.IsActive = False Then DXSplashScreen.Show(Of tsWPFCore.SplashScreenTecnosis)()
DXSplashScreen.SetState("Buscando modelosgruas ...") DXSplashScreen.SetState("Buscando Modelos de Grúas ...")
rs = Obtienemodelosgruas(Busqueda, IncluirBajas) rs = Obtienemodelosgruas(Busqueda, IncluirBajas)
End If End If

View File

@@ -22,35 +22,33 @@ namespace bdGrupoSanchoToro.Importaciones
dsprueba.ReadXml(new System.IO.MemoryStream(Fichero)); dsprueba.ReadXml(new System.IO.MemoryStream(Fichero));
int Ultimalinea = dsprueba.Tables["Datos"].Rows.Count; int Ultimalinea = dsprueba.Tables["Datos"].Rows.Count;
List<modelosgruas> lg = bd.modelosgruas.ToList(); var lp = bd.productos.ToList();
var lm = bd.marcasgruas.ToList(); var lm = bd.marcas.ToList();
var lv = bd.versionesgruas.ToList(); var lv = bd.versionesgruas.ToList();
var grs = dsprueba.Tables["Datos"].Rows.Cast<XSD.GRUASGC.DatosRow>().ToList().OrderBy(x=> OrdenGRUASGC(x)).ToList(); var grs = dsprueba.Tables["Datos"].Rows.Cast<XSD.GRUASGC.DatosRow>().ToList().OrderBy(x=> OrdenGRUASGC(x)).ToList();
foreach (XSD.GRUASGC.DatosRow gr in grs) foreach (XSD.GRUASGC.DatosRow gr in grs)
{ {
try try
{ {
productos pr;
var mar = lm.First(x => x.Marca == gr.CGMAR); var mar = lm.First(x => x.Marca == gr.CGMAR);
bdGrupoSanchoToro.db.modelosgruas n = lg.FirstOrDefault(x => x.idMarcaNavigation.Marca == mar.Marca && x.Modelo == gr.CGMDL); string sDescripcion = "GRÚA " + mar.Marca + " " + gr.CGMDL;
if (n == null) bdGrupoSanchoToro.db.productos pr = lp.FirstOrDefault(x => x.Descripcion== sDescripcion);
if (pr == null)
{ {
pr = new productos() pr = new productos()
{ {
idEmpresa = 1, idEmpresa = 1,
Codigo = "GR-" + gr.CGCOD, Codigo = "GR-" + gr.CGCOD,
Descripcion = "GRÚA " + mar.Marca + " " + gr.CGMDL Descripcion = sDescripcion,
idMarcaNavigation = mar,
FechaAlta = DateOnly.FromDateTime(DateTime.Now),
Modelo = gr.CGMDL,
Tipo = (int)productos.TipoProductoEnum.GRUA
}; };
bd.productos.Add(pr); lp.Add(pr);
n = new bdGrupoSanchoToro.db.modelosgruas();
bd.modelosgruas.Add(n);
n.idMarcaNavigation = mar;
n.idProductoNavigation = pr;
n.FechaAlta = DateTime.Now;
n.Modelo = gr.CGMDL;
bd.SaveChanges(); bd.SaveChanges();
lg.Add(n);
} }
VersionesGruasEnum ver; VersionesGruasEnum ver;
if (gr.CGVER != "") if (gr.CGVER != "")
@@ -93,13 +91,13 @@ namespace bdGrupoSanchoToro.Importaciones
ver = VersionesGruasEnum.EMPOTRADA; ver = VersionesGruasEnum.EMPOTRADA;
break; break;
} }
var vg = lv.FirstOrDefault(x => x.idModeloNavigation.Modelo == gr.CGMDL && x.idModeloNavigation.idMarcaNavigation.Marca == gr.CGMAR && x.Version == (int)ver); var vg = lv.FirstOrDefault(x => x.idProductoNavigation.Modelo == gr.CGMDL && x.idProductoNavigation.idMarcaNavigation.Marca == gr.CGMAR && x.Version == (int)ver);
if (vg == null) if (vg == null)
{ {
vg = new versionesgruas() vg = new versionesgruas()
{ {
Version = (int)ver, Version = (int)ver,
idModeloNavigation = n idProductoNavigation = pr
}; };
bd.versionesgruas.Add(vg); bd.versionesgruas.Add(vg);
lv.Add(vg); lv.Add(vg);

View File

@@ -23,7 +23,7 @@ public partial class productos
public string? ReferenciaFabrica { get; set; } public string? ReferenciaFabrica { get; set; }
public int? TipoProducto { get; set; } public int? Tipo { get; set; }
public string? CodigoBarras { get; set; } public string? CodigoBarras { get; set; }
@@ -49,6 +49,8 @@ public partial class productos
public double PrecioVenta { get; set; } public double PrecioVenta { get; set; }
public DateOnly FechaAlta { get; set; }
public DateTime? FechaBaja { get; set; } public DateTime? FechaBaja { get; set; }
public double? PorcentajeDescuento { get; set; } public double? PorcentajeDescuento { get; set; }

View File

@@ -43,8 +43,12 @@ namespace bdGrupoSanchoToro.db
public enum TipoProductoEnum public enum TipoProductoEnum
{ {
PRODUCTO = 0, GRUA = 0,
SERVICIO = 1 ELEMENTO_GRUA = 1,
REPUESTO =10,
OTRO_MATERIAL = 11,
MATERIAL_OFICINA = 12,
SERVICIO = 99,
} }
} }
} }