diff --git a/Source/Base/Controladores/uControllerBase.pas b/Source/Base/Controladores/uControllerBase.pas
index 259c76e5..9e825ab3 100644
--- a/Source/Base/Controladores/uControllerBase.pas
+++ b/Source/Base/Controladores/uControllerBase.pas
@@ -8,30 +8,27 @@ uses
type
ISujeto = interface;
- IObservador = interface(IInterface)
+ IObservador = interface (IInterface)
['{679D5CF2-D5DC-4A52-9FF3-04AD91402483}']
+ procedure AddSujeto(Sujeto: ISujeto);
+ procedure DeleteSujeto(Sujeto: ISujeto);
procedure RecibirAviso(ASujeto: ISujeto); overload;
procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); overload;
end;
- ISujeto = interface(IInterface)
+ ISujeto = interface (IInterface)
['{CDB691CD-D1D6-4F2E-AA34-93B1CD0E6030}']
procedure AddObservador(Observador: IObservador);
procedure DeleteObservador(Observador: IObservador);
end;
{ ******************* PARA PRUEBAS ******************************************}
- IMiInterface = interface(IInterface)
- ['{C4C3F81D-4318-457C-860A-6034617FE39E}']
- function GetRefCount : Integer;
- end;
-
TMiInterfacedObject = class(TObject, IInterface)
protected
FRefCount: Integer;
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
function _AddRef: Integer; stdcall;
- function _Release: Integer; stdcall;
+ function _Release: Integer; virtual; stdcall;
function GetRefCount : Integer;
public
procedure AfterConstruction; override;
@@ -40,16 +37,31 @@ type
property RefCount: Integer read FRefCount;
end;
- TMiInterfacedObject2 = class(TDataModule) //, IInterface)
- end;
{ ***************************************************************************}
- TObservador = class(TInterfacedObject, IObservador)
+ TObservador = class(TObject, IObservador)
+ private
+ fSujetos: IInterfaceList;
protected
+ FRefCount: Integer;
procedure RecibirAviso(ASujeto: ISujeto); overload; virtual;
procedure RecibirAviso(ASujeto: ISujeto; ADataTable: IDAStronglyTypedDataTable); overload; virtual; abstract;
+ function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
+ function _AddRef: Integer; stdcall;
+ function _Release: Integer; stdcall;
+ function GetRefCount : Integer;
+ public
+ constructor Create; virtual;
+ procedure AddSujeto(Sujeto: ISujeto);
+ procedure DeleteSujeto(Sujeto: ISujeto);
+ destructor Destroy; override;
+
+ procedure AfterConstruction; override;
+ procedure BeforeDestruction; override;
+ class function NewInstance: TObject; override;
+ property RefCount: Integer read FRefCount;
end;
TSujeto = class(TInterfacedObject, ISujeto)
@@ -100,8 +112,8 @@ end;
procedure TMiInterfacedObject.BeforeDestruction;
begin
- if RefCount <> 0 then
- Error(reInvalidPtr);
+// if RefCount <> 0 then
+// Error(reInvalidPtr);
end;
function TMiInterfacedObject.GetRefCount: Integer;
@@ -146,6 +158,7 @@ end;
procedure TSujeto.addObservador(Observador: IObservador);
begin
FObservadores.Add(Observador);
+ Observador.AddSujeto(Self);
end;
procedure TSujeto.AvisarObservadores;
@@ -196,7 +209,72 @@ begin
//
end;
+function TObservador._AddRef: Integer;
+begin
+ Result := InterlockedIncrement(FRefCount);
+// ShowMessage('_AddRef: ' + ClassName + ' - RefCount: ' + IntToStr(FRefCount));
+end;
+function TObservador._Release: Integer;
+begin
+ Result := InterlockedDecrement(FRefCount);
+// ShowMessage('_Release: ' + ClassName + ' - RefCount: ' + IntToStr(FRefCount));
+// if (Result = 0)
+ if (Assigned(fSujetos) and (fSujetos.Count = FRefCount)) then
+ Destroy;
+end;
+procedure TObservador.AddSujeto(Sujeto: ISujeto);
+begin
+ FSujetos.Add(Sujeto);
+end;
+
+procedure TObservador.AfterConstruction;
+begin
+// Release the constructor's implicit refcount
+ InterlockedDecrement(FRefCount);
+end;
+
+procedure TObservador.BeforeDestruction;
+begin
+// if RefCount <> 0 then
+// Error(reInvalidPtr);
+end;
+
+constructor TObservador.Create;
+begin
+ inherited;
+ FSujetos := TInterfaceList.Create;
+end;
+
+procedure TObservador.DeleteSujeto(Sujeto: ISujeto);
+begin
+ FSujetos.Remove(Sujeto);
+end;
+
+destructor TObservador.Destroy;
+begin
+ FSujetos := NIL;
+ inherited;
+end;
+
+function TObservador.GetRefCount: Integer;
+begin
+ Result := FRefCount;
+end;
+
+class function TObservador.NewInstance: TObject;
+begin
+ Result := inherited NewInstance;
+ TObservador(Result).FRefCount := 1;
+end;
+
+function TObservador.QueryInterface(const IID: TGUID; out Obj): HResult;
+begin
+ if GetInterface(IID, Obj) then
+ Result := 0
+ else
+ Result := E_NOINTERFACE;
+end;
end.
diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas
index 4c9b61ac..c802ca0b 100644
--- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas
+++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas
@@ -91,7 +91,7 @@ type
property ClienteController: IClientesController read GetClienteController write SetClienteController;
property DetallesController: IDetallesAlbaranClienteController read GetDetallesController write SetDetallesController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -363,6 +363,7 @@ end;
constructor TAlbaranesClienteController.Create;
begin
+ inherited;
AsignarDataModule;
FClienteController := TClientesController.Create;
diff --git a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas
index c96df0d1..78001007 100644
--- a/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas
+++ b/Source/Modulos/Albaranes de proveedor/Controller/uAlbaranesProveedorController.pas
@@ -84,7 +84,7 @@ type
property ProveedorController: IProveedoresController read GetProveedorController write SetProveedorController;
property DetallesController: IDetallesAlbaranProveedorController read GetDetallesController write SetDetallesController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -476,6 +476,7 @@ end;
constructor TAlbaranesProveedorController.Create;
begin
+ inherited;
AsignarDataModule;
FProveedorController := TProveedoresController.Create;
diff --git a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas
index 7eef4cb5..067bd912 100644
--- a/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas
+++ b/Source/Modulos/Almacenes/Controller/uAlmacenesController.pas
@@ -48,7 +48,7 @@ type
// procedure AsignarCodigo(AAlmacen: IBizAlmacen); virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -122,6 +122,7 @@ end;
constructor TAlmacenesController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Articulos/Controller/uArticulosController.pas b/Source/Modulos/Articulos/Controller/uArticulosController.pas
index 3411432c..ba2961a4 100644
--- a/Source/Modulos/Articulos/Controller/uArticulosController.pas
+++ b/Source/Modulos/Articulos/Controller/uArticulosController.pas
@@ -62,7 +62,7 @@ type
public
property ProveedoresController: IProveedoresController read GetProveedoresController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -301,6 +301,7 @@ end;
constructor TArticulosController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Comisiones/Controller/uComisionesController.pas b/Source/Modulos/Comisiones/Controller/uComisionesController.pas
index 304ef75b..2f2ed5ee 100644
--- a/Source/Modulos/Comisiones/Controller/uComisionesController.pas
+++ b/Source/Modulos/Comisiones/Controller/uComisionesController.pas
@@ -45,7 +45,7 @@ type
procedure AsignarDataModule; virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AComision : IBizComisiones): Boolean;
@@ -223,6 +223,7 @@ end;
constructor TComisionesController.Create;
begin
+ inherited;
AsignarDataModule;
FFacturasClienteController := TFacturasClienteController.Create;
end;
diff --git a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas
index 66c5fcf5..e9ee7d15 100644
--- a/Source/Modulos/Contactos/Controller/uGruposClienteController.pas
+++ b/Source/Modulos/Contactos/Controller/uGruposClienteController.pas
@@ -28,7 +28,7 @@ type
function ValidarGrupoCliente(AGrupoCliente: IBizGrupoCliente): Boolean;
procedure AsignarDataModule; virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AGrupoCliente : IBizGrupoCliente): Boolean;
@@ -68,6 +68,7 @@ end;
constructor TGruposClienteController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas b/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas
index 8cee84b7..8a98aba7 100644
--- a/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas
+++ b/Source/Modulos/Contactos/Controller/uGruposEmpleadoController.pas
@@ -28,7 +28,7 @@ type
function ValidarGrupoEmpleado(AGrupoEmpleado: IBizGrupoEmpleado): Boolean;
procedure AsignarDataModule; virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AGrupoEmpleado : IBizGrupoEmpleado): Boolean;
@@ -68,6 +68,7 @@ end;
constructor TGruposEmpleadoController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas
index ca0d4222..e201436a 100644
--- a/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas
+++ b/Source/Modulos/Contactos/Controller/uGruposProveedorController.pas
@@ -28,7 +28,7 @@ type
function ValidarGrupoProveedor(AGrupoProveedor: IBizGrupoProveedor): Boolean;
procedure AsignarDataModule; virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AGrupoProveedor : IBizGrupoProveedor): Boolean;
@@ -68,6 +68,7 @@ end;
constructor TGruposProveedorController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas
index 6625da92..9f290184 100644
--- a/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas
+++ b/Source/Modulos/Facturas de cliente/Controller/uFacturasClienteController.pas
@@ -75,7 +75,7 @@ type
property ClienteController: IClientesController read GetClienteController write SetClienteController;
property DetallesController: IDetallesFacturaClienteController read GetDetallesController write SetDetallesController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -493,6 +493,7 @@ end;
constructor TFacturasClienteController.Create;
begin
+ inherited;
FDataModule := TDataModuleFacturasCliente.Create(Nil);
FClienteController := TClientesController.Create;
FDetallesController := TDetallesFacturaClienteController.Create;
diff --git a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas
index bb0773fd..8cecfb06 100644
--- a/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas
+++ b/Source/Modulos/Facturas de proveedor/Controller/uFacturasProveedorController.pas
@@ -74,7 +74,7 @@ type
property ProveedorController: IProveedoresController read GetProveedorController write SetProveedorController;
property DetallesController: IDetallesFacturaProveedorController read GetDetallesController write SetDetallesController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(const ID : Integer): Boolean; overload;
@@ -485,6 +485,7 @@ end;
constructor TFacturasProveedorController.Create;
begin
+ inherited;
FDataModule := TDataModuleFacturasProveedor.Create(Nil);
FProveedorController := TProveedoresController.Create;
FDetallesController := TDetallesFacturaProveedorController.Create;
diff --git a/Source/Modulos/Familias/Controller/uFamiliasController.pas b/Source/Modulos/Familias/Controller/uFamiliasController.pas
index 26e42df5..58ff5397 100644
--- a/Source/Modulos/Familias/Controller/uFamiliasController.pas
+++ b/Source/Modulos/Familias/Controller/uFamiliasController.pas
@@ -36,7 +36,7 @@ type
procedure ValidarObjetos; virtual;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AFamilia : IBizFamilia): Boolean;
@@ -76,6 +76,7 @@ end;
constructor TFamiliasController.Create;
begin
+ inherited;
AsignarDataModule;
end;
diff --git a/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas b/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas
index 2311e525..ff4ff03d 100644
--- a/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas
+++ b/Source/Modulos/Formas de pago/Controller/uFormasPagoController.pas
@@ -33,7 +33,7 @@ type
procedure AsignarDataModule;
public
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Eliminar(AFormaPago : IBizFormaPago): Boolean;
@@ -99,6 +99,7 @@ end;
constructor TFormasPagoController.Create;
begin
+ inherited;
AsignarDataModule;
FPlazosController := TFormasPagoPlazosController.Create;
end;
diff --git a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas
index 30bfd7e2..5a828bdd 100644
--- a/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas
+++ b/Source/Modulos/Historico de movimientos/Controller/uHistoricoMovimientosController.pas
@@ -45,7 +45,7 @@ type
public
property AlmacenesController: IAlmacenesController read GetAlmacenesController write SetAlmacenesController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Buscar(const ID_ALMACEN: Integer): IBizHistoricoMovimientos;
@@ -86,6 +86,7 @@ end;
constructor THistoricoMovimientosController.Create;
begin
+ inherited;
AsignarDataModule;
FAlmacenesController := TAlmacenesController.Create;
end;
diff --git a/Source/Modulos/Historico de movimientos/HistoricoMovimientos_Group.groupproj b/Source/Modulos/Historico de movimientos/HistoricoMovimientos_Group.groupproj
new file mode 100644
index 00000000..8e85a000
--- /dev/null
+++ b/Source/Modulos/Historico de movimientos/HistoricoMovimientos_Group.groupproj
@@ -0,0 +1,124 @@
+
+
+ {a1786710-a18b-49b9-a107-aa4c807d0c03}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default.Personality
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Modulos/Inventario/Controller/uInventarioController.pas b/Source/Modulos/Inventario/Controller/uInventarioController.pas
index 5ef10f0d..66085990 100644
--- a/Source/Modulos/Inventario/Controller/uInventarioController.pas
+++ b/Source/Modulos/Inventario/Controller/uInventarioController.pas
@@ -93,7 +93,7 @@ type
property PresupuestosClienteController: IPresupuestosClienteController read GetPresupuestosClienteController write SetPresupuestosClienteController;
property PedidosProveedorController: IPedidosProveedorController read GetPedidosProveedorController write SetPedidosProveedorController;
- constructor Create; virtual;
+ constructor Create; override;
destructor Destroy; override;
function Trasladar(AInventario : IBizInventario; Todos: Boolean): Boolean;
@@ -280,6 +280,7 @@ end;
constructor TInventarioController.Create;
begin
+ inherited;
AsignarDataModule;
FArticulosController := TArticulosInventarioController.Create;
FAlmacenesController := TAlmacenesController.Create;
diff --git a/Source/Modulos/Inventario/Inventario_Group.groupproj b/Source/Modulos/Inventario/Inventario_Group.groupproj
new file mode 100644
index 00000000..754f2d37
--- /dev/null
+++ b/Source/Modulos/Inventario/Inventario_Group.groupproj
@@ -0,0 +1,134 @@
+
+
+ {4adf8c8b-c759-4f41-a122-af83878ceedc}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default.Personality
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Modulos/Pedidos a proveedor/Controller/PedidosProveedor_controller.dproj b/Source/Modulos/Pedidos a proveedor/Controller/PedidosProveedor_controller.dproj
index 0778ff54..2dc30f4f 100644
--- a/Source/Modulos/Pedidos a proveedor/Controller/PedidosProveedor_controller.dproj
+++ b/Source/Modulos/Pedidos a proveedor/Controller/PedidosProveedor_controller.dproj
@@ -48,10 +48,10 @@
MainSource
-
-
-
-
+
+
+
+
@@ -65,7 +65,6 @@
-