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
Dim pr As modelosgruas = gc.CurrentItem
Dim pr As productos = gc.CurrentItem
'If pr.Tipo = TipoProductoEnum.TRIBUNA Then
' FuncionesDinamicas.AbrirAP(New ucProductoTribuna(pr.idProducto), OtrosParametros)
'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
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)
Dim rs As List(Of modelosgruas)
Dim rs As List(Of productos)
Do
Dim iNumExc As Integer = 0
Try
@@ -136,7 +136,7 @@ Public Class ucModelosGruas
Public Async Sub ObtienemodelosgruasAsync(bd As tscGrupoSanchoToro, Background As Boolean)
Try
Dim rs As New List(Of modelosgruas)
Dim rs As New List(Of productos)
Dim Busqueda = tsEFCore8.Extensiones.ObjetoNothingAVacio(Me.teBusqueda.EditValue)
Dim IncluirBajas = Me.cbIncluirBajas.IsChecked
If Background Then
@@ -146,7 +146,7 @@ Public Class ucModelosGruas
End Sub)
Else
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)
End If

View File

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

View File

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

View File

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