diff --git a/Source/Modulos/Inventario/Controller/uInventarioController.pas b/Source/Modulos/Inventario/Controller/uInventarioController.pas index e7b31569..90ba48b1 100644 --- a/Source/Modulos/Inventario/Controller/uInventarioController.pas +++ b/Source/Modulos/Inventario/Controller/uInventarioController.pas @@ -18,7 +18,6 @@ type function Trasladar(AInventario : IBizInventario; Todos: Boolean): Boolean; // procedure RecibirArticulos(Const APedido: IBizPedidoProveedor; Const CodigoAlmacenDes: Integer); overload; // procedure RecibirPedidos(Const CodigoAlmacenDes: Integer); - procedure Reservar(AInventario: IBizInventario; Const CodigoAlmacenDestino: Integer); function Liberar(AInventario : IBizInventario): Boolean; function Ver(AArticulos: IBizInventario; AInventario : IBizInventario; APedido: IBizPedidoProveedor = Nil): Boolean; @@ -38,6 +37,7 @@ type procedure EntradaArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenDestino: Integer); procedure SalidaArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer); procedure TrasladarArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; Const CodigoAlmacenDestino: Integer); + procedure ReservarArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; Const CodigoAlmacenDestino: Integer); function EntradaPedido(AInventario: IBizInventario; APedido: IBizPedidoProveedor; ADetalles: IDAStronglyTypedDataTable; var ADetallesFinal: IBizInventario): Boolean; function SalidaAlbaran(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; ADetalles: IDAStronglyTypedDataTable): Boolean; @@ -65,7 +65,7 @@ type function GetPresupuestosClienteController: IPresupuestosClienteController; function GetPedidosProveedorController: IPedidosProveedorController; procedure SetAlmacenesController(const Value: IAlmacenesController); - procedure SetObrasController(const Value: IObrasController); + procedure SetObrasController(const Value: IObrasController); procedure SetArticulosController(const Value: IArticulosInventarioController); procedure SetPresupuestosClienteController(const Value: IPresupuestosClienteController); procedure SetPedidosProveedorController(const Value: IPedidosProveedorController); @@ -73,6 +73,7 @@ type function Liberar(AInventario : IBizInventario; Todos: Boolean): Boolean; overload; function EntradaSalidaArticulos(AArticulos, AInventario : IBizInventario; APedido: IBizPedidoProveedor = Nil): Boolean; overload; + function ReservarArticulos(AArticulos, AInventario : IBizInventario): Boolean; procedure Copiar(AArticulos: IBizInventario; ADetalles: IDAStronglyTypedDataTable; AInventario: IBizInventario); overload; function GuardarMovimientos(AArticulos : IBizInventario; const FechaMovimiento: TDateTime; const CausaMovimiento: String): Boolean; @@ -96,7 +97,7 @@ type public property AlmacenesController: IAlmacenesController read GetAlmacenesController write SetAlmacenesController; - property ObrasController: IObrasController read GetObrasController write SetObrasController; + property ObrasController: IObrasController read GetObrasController write SetObrasController; property ArticulosController: IArticulosInventarioController read GetArticulosController write SetArticulosController; property PresupuestosClienteController: IPresupuestosClienteController read GetPresupuestosClienteController write SetPresupuestosClienteController; property PedidosProveedorController: IPedidosProveedorController read GetPedidosProveedorController write SetPedidosProveedorController; @@ -124,9 +125,9 @@ type procedure EntradaArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenDestino: Integer); procedure SalidaArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer); procedure TrasladarArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; Const CodigoAlmacenDestino: Integer); + procedure ReservarArticulosLibre(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; Const CodigoAlmacenDestino: Integer); function EntradaPedido(AInventario: IBizInventario; APedido: IBizPedidoProveedor; ADetalles: IDAStronglyTypedDataTable; var ADetallesFinal: IBizInventario): Boolean; function SalidaAlbaran(AInventario: IBizInventario; Const CodigoAlmacenOrigen: Integer; ADetalles: IDAStronglyTypedDataTable): Boolean; - procedure Reservar(AInventario: IBizInventario; Const CodigoAlmacenDestino: Integer); procedure VerTodos(AInventario: IBizInventario; const pTipoInventario: String); function Ver(AArticulos: IBizInventario; AInventario : IBizInventario; APedido: IBizPedidoProveedor = Nil): Boolean; @@ -172,7 +173,7 @@ begin AArticulosSeleccionados := FArticulosController.ElegirArticulos(FArticulosController.BuscarInventariables, '', True); end; - tSalidaLibre, tTraslado: begin + tSalidaLibre, tTraslado, tReserva: begin //IBizInventario AArticulosSeleccionados := ElegirArticulos(Buscar(AArticulos.IDAlmacenOrigen), '', True); end; @@ -466,7 +467,7 @@ begin AArticulos.DataTable.Post; case AArticulos.TipoMovimiento of - tSalidaLibre, tSalidaAlbaranCliente, tTraslado: + tSalidaLibre, tSalidaAlbaranCliente, tTraslado, tReserva: begin Result := ValidarCantidades(AArticulos); if not Result then @@ -732,20 +733,37 @@ begin // end; -procedure TInventarioController.Reservar(AInventario: IBizInventario; const CodigoAlmacenDestino: Integer); +function TInventarioController.ReservarArticulos(AArticulos, AInventario: IBizInventario): Boolean; +begin + Result := False; + if not Assigned(AArticulos) then + Exit; + + if not AArticulos.DataTable.Active then + AArticulos.DataTable.Active := True; + + Result := Ver(AArticulos, AInventario); +end; + +procedure TInventarioController.ReservarArticulosLibre(AInventario: IBizInventario; const CodigoAlmacenOrigen, + CodigoAlmacenDestino: Integer); var AArticulos: IBizInventario; begin - try - AArticulos := Buscar(ID_NULO); + if (CodigoAlmacenOrigen <> CodigoAlmacenDestino) then + begin + try + AArticulos := Buscar(ID_NULO); - //Se queda en la clase de negocio para así todos y cada uno de los artículos que - //se agreguen se asigne automáticamente el codigo de almacen destino en OnNewRecord -// AArticulos.TipoMovimiento := tEntradaLibre; -// AArticulos.IDAlmacenDestino := CodigoAlmacenDestino; - EntradaSalidaArticulos(AArticulos, AInventario); - finally - AArticulos := Nil; + //Se queda en la clase de negocio para así todos y cada uno de los artículos que + //se agreguen se asigne automáticamente el codigo de almacen destino en OnNewRecord + AArticulos.TipoMovimiento := tReserva; + AArticulos.IDAlmacenOrigen := CodigoAlmacenOrigen; + AArticulos.IDAlmacenDestino := CodigoAlmacenDestino; + ReservarArticulos(AArticulos, AInventario); + finally + AArticulos := Nil; + end; end; end; @@ -870,17 +888,20 @@ procedure TInventarioController.TrasladarArticulosLibre(AInventario: IBizInventa var AArticulos: IBizInventario; begin - try - AArticulos := Buscar(ID_NULO); + if (CodigoAlmacenOrigen <> CodigoAlmacenDestino) then + begin + try + AArticulos := Buscar(ID_NULO); - //Se queda en la clase de negocio para así todos y cada uno de los artículos que - //se agreguen se asigne automáticamente el codigo de almacen destino en OnNewRecord - AArticulos.TipoMovimiento := tTraslado; - AArticulos.IDAlmacenOrigen := CodigoAlmacenOrigen; - AArticulos.IDAlmacenDestino := CodigoAlmacenDestino; - EntradaSalidaArticulos(AArticulos, AInventario); - finally - AArticulos := Nil; + //Se queda en la clase de negocio para así todos y cada uno de los artículos que + //se agreguen se asigne automáticamente el codigo de almacen destino en OnNewRecord + AArticulos.TipoMovimiento := tTraslado; + AArticulos.IDAlmacenOrigen := CodigoAlmacenOrigen; + AArticulos.IDAlmacenDestino := CodigoAlmacenDestino; + EntradaSalidaArticulos(AArticulos, AInventario); + finally + AArticulos := Nil; + end; end; end; @@ -1057,7 +1078,7 @@ begin ShowHourglassCursor; try case AArticulos.TipoMovimiento of - tEntradaLibre, tSalidaLibre, tTraslado: Result := GuardarMovimientos(AArticulos, FechaMovimiento, CausaMovimiento); + tEntradaLibre, tSalidaLibre, tTraslado, tReserva: Result := GuardarMovimientos(AArticulos, FechaMovimiento, CausaMovimiento); tSalidaAlbaranCliente : begin AArticulos.DataTable.CancelUpdates; Result := True; @@ -1097,6 +1118,10 @@ begin case AArticulos.TipoMovimiento of tEntradaLibre: AArticulos.TIPO := CTE_TIPO_ENTRADA; tSalidaLibre, tTraslado: AArticulos.TIPO := CTE_TIPO_SALIDA; + tReserva: begin + AArticulos.TIPO := CTE_TIPO_RESERVA; + AArticulos.ID_ALMACEN_RESERVA := AArticulos.IDAlmacenDestino; + end; end; Post; diff --git a/Source/Modulos/Inventario/Data/uDataModuleInventario.dfm b/Source/Modulos/Inventario/Data/uDataModuleInventario.dfm index 0416e48b..9bc63af2 100644 --- a/Source/Modulos/Inventario/Data/uDataModuleInventario.dfm +++ b/Source/Modulos/Inventario/Data/uDataModuleInventario.dfm @@ -244,6 +244,10 @@ inherited DataModuleInventario: TDataModuleInventario Size = 1 DisplayLabel = 'INVENTARIO_TIPO' DictionaryEntry = 'INVENTARIO_TIPO' + end + item + Name = 'ID_ALMACEN_RESERVA' + DataType = datInteger end> Params = <> StreamingOptions = [soDisableEventsWhileStreaming] diff --git a/Source/Modulos/Inventario/Inventario_Group.groupproj b/Source/Modulos/Inventario/Inventario_Group.groupproj index a1094801..3e38b3d2 100644 --- a/Source/Modulos/Inventario/Inventario_Group.groupproj +++ b/Source/Modulos/Inventario/Inventario_Group.groupproj @@ -9,6 +9,7 @@ + @@ -151,14 +152,23 @@ + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Inventario/Model/schInventarioClient_Intf.pas b/Source/Modulos/Inventario/Model/schInventarioClient_Intf.pas index af2a41c2..bdca467e 100644 --- a/Source/Modulos/Inventario/Model/schInventarioClient_Intf.pas +++ b/Source/Modulos/Inventario/Model/schInventarioClient_Intf.pas @@ -3,14 +3,14 @@ unit schInventarioClient_Intf; interface uses - Classes, DB, schBase_Intf, SysUtils, uROClasses, uDADataTable, FmtBCD, uROXMLIntf; + Classes, DB, SysUtils, uROClasses, uDADataTable, FmtBCD, uROXMLIntf; const { Data table rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_Inventario = '{EF34850B-0D51-4B0C-8CD5-4C9DD0CEA30A}'; - RID_DetalleReservas = '{B4EFAB5C-C1A7-4932-991F-C6641A5456CD}'; + RID_Inventario = '{D1DF74C9-3CDA-4909-AE85-3CE5B811364D}'; + RID_DetalleReservas = '{ECE1496D-C7C9-432E-955D-3034C7D1B03E}'; { Data table names } nme_Inventario = 'Inventario'; @@ -34,6 +34,7 @@ const fld_InventarioFECHA_MOVIMIENTO = 'FECHA_MOVIMIENTO'; fld_InventarioCAUSA = 'CAUSA'; fld_InventarioTIPO = 'TIPO'; + fld_InventarioID_ALMACEN_RESERVA = 'ID_ALMACEN_RESERVA'; { Inventario field indexes } idx_InventarioID_ALMACEN = 0; @@ -53,6 +54,7 @@ const idx_InventarioFECHA_MOVIMIENTO = 14; idx_InventarioCAUSA = 15; idx_InventarioTIPO = 16; + idx_InventarioID_ALMACEN_RESERVA = 17; { DetalleReservas fields } fld_DetalleReservasID_ALB = 'ID_ALB'; @@ -91,7 +93,7 @@ const type { IInventario } IInventario = interface(IDAStronglyTypedDataTable) - ['{42DB1B40-71E1-454F-93DC-E35E6FE3EEE1}'] + ['{A64740C9-B495-4BD6-880F-C09A714F35F9}'] { Property getters and setters } function GetID_ALMACENValue: Integer; procedure SetID_ALMACENValue(const aValue: Integer); @@ -161,6 +163,10 @@ type procedure SetTIPOValue(const aValue: String); function GetTIPOIsNull: Boolean; procedure SetTIPOIsNull(const aValue: Boolean); + function GetID_ALMACEN_RESERVAValue: Integer; + procedure SetID_ALMACEN_RESERVAValue(const aValue: Integer); + function GetID_ALMACEN_RESERVAIsNull: Boolean; + procedure SetID_ALMACEN_RESERVAIsNull(const aValue: Boolean); { Properties } @@ -198,10 +204,12 @@ type property CAUSAIsNull: Boolean read GetCAUSAIsNull write SetCAUSAIsNull; property TIPO: String read GetTIPOValue write SetTIPOValue; property TIPOIsNull: Boolean read GetTIPOIsNull write SetTIPOIsNull; + property ID_ALMACEN_RESERVA: Integer read GetID_ALMACEN_RESERVAValue write SetID_ALMACEN_RESERVAValue; + property ID_ALMACEN_RESERVAIsNull: Boolean read GetID_ALMACEN_RESERVAIsNull write SetID_ALMACEN_RESERVAIsNull; end; { TInventarioDataTableRules } - TInventarioDataTableRules = class(TIntfObjectDADataTableRules, IInventario) + TInventarioDataTableRules = class(TDADataTableRules, IInventario) private protected { Property getters and setters } @@ -273,6 +281,10 @@ type procedure SetTIPOValue(const aValue: String); virtual; function GetTIPOIsNull: Boolean; virtual; procedure SetTIPOIsNull(const aValue: Boolean); virtual; + function GetID_ALMACEN_RESERVAValue: Integer; virtual; + procedure SetID_ALMACEN_RESERVAValue(const aValue: Integer); virtual; + function GetID_ALMACEN_RESERVAIsNull: Boolean; virtual; + procedure SetID_ALMACEN_RESERVAIsNull(const aValue: Boolean); virtual; { Properties } property ID_ALMACEN: Integer read GetID_ALMACENValue write SetID_ALMACENValue; @@ -309,6 +321,8 @@ type property CAUSAIsNull: Boolean read GetCAUSAIsNull write SetCAUSAIsNull; property TIPO: String read GetTIPOValue write SetTIPOValue; property TIPOIsNull: Boolean read GetTIPOIsNull write SetTIPOIsNull; + property ID_ALMACEN_RESERVA: Integer read GetID_ALMACEN_RESERVAValue write SetID_ALMACEN_RESERVAValue; + property ID_ALMACEN_RESERVAIsNull: Boolean read GetID_ALMACEN_RESERVAIsNull write SetID_ALMACEN_RESERVAIsNull; public constructor Create(aDataTable: TDADataTable); override; @@ -318,7 +332,7 @@ type { IDetalleReservas } IDetalleReservas = interface(IDAStronglyTypedDataTable) - ['{BFD1131A-A0B0-4AA4-B8A0-84D8F5D873EF}'] + ['{1FB20B44-1A59-409F-A614-17754E6C10A9}'] { Property getters and setters } function GetID_ALBValue: Integer; procedure SetID_ALBValue(const aValue: Integer); @@ -416,7 +430,7 @@ type end; { TDetalleReservasDataTableRules } - TDetalleReservasDataTableRules = class(TIntfObjectDADataTableRules, IDetalleReservas) + TDetalleReservasDataTableRules = class(TDADataTableRules, IDetalleReservas) private protected { Property getters and setters } @@ -891,6 +905,27 @@ begin DataTable.Fields[idx_InventarioTIPO].AsVariant := Null; end; +function TInventarioDataTableRules.GetID_ALMACEN_RESERVAValue: Integer; +begin + result := DataTable.Fields[idx_InventarioID_ALMACEN_RESERVA].AsInteger; +end; + +procedure TInventarioDataTableRules.SetID_ALMACEN_RESERVAValue(const aValue: Integer); +begin + DataTable.Fields[idx_InventarioID_ALMACEN_RESERVA].AsInteger := aValue; +end; + +function TInventarioDataTableRules.GetID_ALMACEN_RESERVAIsNull: boolean; +begin + result := DataTable.Fields[idx_InventarioID_ALMACEN_RESERVA].IsNull; +end; + +procedure TInventarioDataTableRules.SetID_ALMACEN_RESERVAIsNull(const aValue: Boolean); +begin + if aValue then + DataTable.Fields[idx_InventarioID_ALMACEN_RESERVA].AsVariant := Null; +end; + { TDetalleReservasDataTableRules } constructor TDetalleReservasDataTableRules.Create(aDataTable: TDADataTable); diff --git a/Source/Modulos/Inventario/Model/schInventarioServer_Intf.pas b/Source/Modulos/Inventario/Model/schInventarioServer_Intf.pas index a1801879..a32c3b09 100644 --- a/Source/Modulos/Inventario/Model/schInventarioServer_Intf.pas +++ b/Source/Modulos/Inventario/Model/schInventarioServer_Intf.pas @@ -9,13 +9,13 @@ const { Delta rules ids Feel free to change them to something more human readable but make sure they are unique in the context of your application } - RID_InventarioDelta = '{44A696E0-2F61-4AFE-9226-6DC8AEC03305}'; - RID_DetalleReservasDelta = '{44070FBD-E2B5-4D2E-AE8F-5AA97849CBA6}'; + RID_InventarioDelta = '{1E24258E-A81B-4308-BBB0-A5E5B4C6F6E7}'; + RID_DetalleReservasDelta = '{6BD6D070-EEFF-4BA9-B4AE-9FDEAB2B569C}'; type { IInventarioDelta } IInventarioDelta = interface(IInventario) - ['{44A696E0-2F61-4AFE-9226-6DC8AEC03305}'] + ['{1E24258E-A81B-4308-BBB0-A5E5B4C6F6E7}'] { Property getters and setters } function GetOldID_ALMACENValue : Integer; function GetOldID_ARTICULOValue : Integer; @@ -34,6 +34,7 @@ type function GetOldFECHA_MOVIMIENTOValue : DateTime; function GetOldCAUSAValue : String; function GetOldTIPOValue : String; + function GetOldID_ALMACEN_RESERVAValue : Integer; { Properties } property OldID_ALMACEN : Integer read GetOldID_ALMACENValue; @@ -53,6 +54,7 @@ type property OldFECHA_MOVIMIENTO : DateTime read GetOldFECHA_MOVIMIENTOValue; property OldCAUSA : String read GetOldCAUSAValue; property OldTIPO : String read GetOldTIPOValue; + property OldID_ALMACEN_RESERVA : Integer read GetOldID_ALMACEN_RESERVAValue; end; { TInventarioBusinessProcessorRules } @@ -162,6 +164,12 @@ type function GetOldTIPOIsNull: Boolean; virtual; procedure SetTIPOValue(const aValue: String); virtual; procedure SetTIPOIsNull(const aValue: Boolean); virtual; + function GetID_ALMACEN_RESERVAValue: Integer; virtual; + function GetID_ALMACEN_RESERVAIsNull: Boolean; virtual; + function GetOldID_ALMACEN_RESERVAValue: Integer; virtual; + function GetOldID_ALMACEN_RESERVAIsNull: Boolean; virtual; + procedure SetID_ALMACEN_RESERVAValue(const aValue: Integer); virtual; + procedure SetID_ALMACEN_RESERVAIsNull(const aValue: Boolean); virtual; { Properties } property ID_ALMACEN : Integer read GetID_ALMACENValue write SetID_ALMACENValue; @@ -232,6 +240,10 @@ type property TIPOIsNull : Boolean read GetTIPOIsNull write SetTIPOIsNull; property OldTIPO : String read GetOldTIPOValue; property OldTIPOIsNull : Boolean read GetOldTIPOIsNull; + property ID_ALMACEN_RESERVA : Integer read GetID_ALMACEN_RESERVAValue write SetID_ALMACEN_RESERVAValue; + property ID_ALMACEN_RESERVAIsNull : Boolean read GetID_ALMACEN_RESERVAIsNull write SetID_ALMACEN_RESERVAIsNull; + property OldID_ALMACEN_RESERVA : Integer read GetOldID_ALMACEN_RESERVAValue; + property OldID_ALMACEN_RESERVAIsNull : Boolean read GetOldID_ALMACEN_RESERVAIsNull; public constructor Create(aBusinessProcessor: TDABusinessProcessor); override; @@ -241,7 +253,7 @@ type { IDetalleReservasDelta } IDetalleReservasDelta = interface(IDetalleReservas) - ['{44070FBD-E2B5-4D2E-AE8F-5AA97849CBA6}'] + ['{6BD6D070-EEFF-4BA9-B4AE-9FDEAB2B569C}'] { Property getters and setters } function GetOldID_ALBValue : Integer; function GetOldID_EMPRESAValue : Integer; @@ -984,6 +996,37 @@ begin BusinessProcessor.CurrentChange.NewValueByName[fld_InventarioTIPO] := Null; end; +function TInventarioBusinessProcessorRules.GetID_ALMACEN_RESERVAValue: Integer; +begin + result := BusinessProcessor.CurrentChange.NewValueByName[fld_InventarioID_ALMACEN_RESERVA]; +end; + +function TInventarioBusinessProcessorRules.GetID_ALMACEN_RESERVAIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_InventarioID_ALMACEN_RESERVA]); +end; + +function TInventarioBusinessProcessorRules.GetOldID_ALMACEN_RESERVAValue: Integer; +begin + result := BusinessProcessor.CurrentChange.OldValueByName[fld_InventarioID_ALMACEN_RESERVA]; +end; + +function TInventarioBusinessProcessorRules.GetOldID_ALMACEN_RESERVAIsNull: Boolean; +begin + result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_InventarioID_ALMACEN_RESERVA]); +end; + +procedure TInventarioBusinessProcessorRules.SetID_ALMACEN_RESERVAValue(const aValue: Integer); +begin + BusinessProcessor.CurrentChange.NewValueByName[fld_InventarioID_ALMACEN_RESERVA] := aValue; +end; + +procedure TInventarioBusinessProcessorRules.SetID_ALMACEN_RESERVAIsNull(const aValue: Boolean); +begin + if aValue then + BusinessProcessor.CurrentChange.NewValueByName[fld_InventarioID_ALMACEN_RESERVA] := Null; +end; + { TDetalleReservasBusinessProcessorRules } constructor TDetalleReservasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor); diff --git a/Source/Modulos/Inventario/Model/uBizInventario.pas b/Source/Modulos/Inventario/Model/uBizInventario.pas index b632c5fa..de58edae 100644 --- a/Source/Modulos/Inventario/Model/uBizInventario.pas +++ b/Source/Modulos/Inventario/Model/uBizInventario.pas @@ -15,11 +15,13 @@ const CTE_TIPO_ENTRADA = 'E'; CTE_TIPO_SALIDA = 'S'; + CTE_TIPO_RESERVA = 'R'; type TEnumTipoMovimiento = (tEntradaLibre, tSalidaLibre, tTraslado, + tReserva, tEntradaPedidoProveedor, tSalidaAlbaranCliente); @@ -143,7 +145,7 @@ begin //En función del tipo de operación vamos a coger el IDAlmacenOrigen o IDAlamcenDetino Case TipoMovimiento of tEntradaLibre, tEntradaPedidoProveedor : ID_ALMACEN := IDAlmacenDestino; - tSalidaLibre, tSalidaAlbaranCliente, tTraslado : ID_ALMACEN := IDAlmacenOrigen; + tSalidaLibre, tSalidaAlbaranCliente, tTraslado, tReserva : ID_ALMACEN := IDAlmacenOrigen; End; end; diff --git a/Source/Modulos/Inventario/Servidor/srvInventario_Impl.dfm b/Source/Modulos/Inventario/Servidor/srvInventario_Impl.dfm index 6525665b..3bc0a033 100644 --- a/Source/Modulos/Inventario/Servidor/srvInventario_Impl.dfm +++ b/Source/Modulos/Inventario/Servidor/srvInventario_Impl.dfm @@ -29,8 +29,9 @@ object srvInventario: TsrvInventario 'DE MOVIMIENTOS INDEPENDIENTE DEL INVENTARIO PERO POR FALTA'#10' D' + 'E TIEMPO Y FIABILIDAD YA QUE AHORA FUNCIONA TODO, CREAMOS ESTOS ' + 'CAMPOS FICTICIOS'#10' */'#10#10' 0 as ID, 0 as CANTIDAD, current_dat' + - 'e as FECHA_MOVIMIENTO, NULL as CAUSA, NULL as TIPO'#10#10#10'FROM V_INVE' + - 'NTARIO'#10'where {where}'#10'ORDER BY ID_ARTICULO'#10 + 'e as FECHA_MOVIMIENTO, NULL as CAUSA, NULL as TIPO,'#10' 0 as ID_' + + 'ALMACEN_RESERVA'#10#10#10'FROM V_INVENTARIO'#10'where {where}'#10'ORDER BY ID_AR' + + 'TICULO'#10 StatementType = stSQL ColumnMappings = < item @@ -43,7 +44,8 @@ object srvInventario: TsrvInventario end item DatasetField = 'ALMACEN' - TableField = 'ALMACEN' + TableField = '' + SQLOrigin = 'ALMACEN' end item DatasetField = 'ID_EMPRESA' @@ -77,29 +79,39 @@ object srvInventario: TsrvInventario DatasetField = 'PENDIENTE_RECEPCION' TableField = 'PENDIENTE_RECEPCION' end + item + DatasetField = 'TIPO_ALMACEN' + TableField = 'TIPO_ALMACEN' + end item DatasetField = 'ID' - TableField = 'ID' + TableField = '' + SQLOrigin = 'ID' end item DatasetField = 'CANTIDAD' - TableField = 'CANTIDAD' + TableField = '' + SQLOrigin = 'CANTIDAD' end item DatasetField = 'FECHA_MOVIMIENTO' - TableField = 'FECHA_MOVIMIENTO' + TableField = '' + SQLOrigin = 'FECHA_MOVIMIENTO' end item DatasetField = 'CAUSA' - TableField = 'CAUSA' + TableField = '' + SQLOrigin = 'CAUSA' end item DatasetField = 'TIPO' - TableField = 'TIPO' + TableField = '' + SQLOrigin = 'TIPO' end item - DatasetField = 'TIPO_ALMACEN' - TableField = 'TIPO_ALMACEN' + DatasetField = 'ID_ALMACEN_RESERVA' + TableField = '' + SQLOrigin = 'ID_ALMACEN_RESERVA' end> end> Name = 'Inventario' @@ -195,6 +207,10 @@ object srvInventario: TsrvInventario DataType = datString Size = 1 DictionaryEntry = 'INVENTARIO_TIPO' + end + item + Name = 'ID_ALMACEN_RESERVA' + DataType = datInteger end> end item @@ -369,45 +385,34 @@ object srvInventario: TsrvInventario DataType = datAutoInc GeneratorName = 'GEN_MOVIMIENTOS_ID' Value = '' - ParamType = daptInput end item Name = 'ID_ALMACEN' - DataType = datInteger Value = '' - ParamType = daptInput end item Name = 'ID_ARTICULO' - DataType = datInteger Value = '' - ParamType = daptInput end item Name = 'FECHA_MOVIMIENTO' - DataType = datDateTime Value = '' - ParamType = daptInput end item Name = 'TIPO' - DataType = datString - Size = 1 Value = '' - ParamType = daptInput end item Name = 'CANTIDAD' - DataType = datInteger Value = '' - ParamType = daptInput end item Name = 'CAUSA' - DataType = datString - Size = 2000 Value = '' - ParamType = daptInput + end + item + Name = 'ID_ALMACEN_RESERVA' + Value = '' end> Statements = < item @@ -415,8 +420,9 @@ object srvInventario: TsrvInventario TargetTable = 'MOVIMIENTOS' SQL = 'INSERT'#10' INTO MOVIMIENTOS'#10' (ID, ID_ALMACEN, ID_ARTICULO, FECH' + - 'A_MOVIMIENTO, TIPO, CANTIDAD, CAUSA)'#10' VALUES'#10' (:ID, :ID_ALMA' + - 'CEN, :ID_ARTICULO, :FECHA_MOVIMIENTO, :TIPO, :CANTIDAD, :CAUSA)' + 'A_MOVIMIENTO, TIPO, CANTIDAD, CAUSA, ID_ALMACEN_RESERVA)'#10' VALUE' + + 'S'#10' (:ID, :ID_ALMACEN, :ID_ARTICULO, :FECHA_MOVIMIENTO, :TIPO,' + + ' :CANTIDAD, :CAUSA, :ID_ALMACEN_RESERVA)'#10 StatementType = stSQL ColumnMappings = <> end> @@ -468,6 +474,10 @@ object srvInventario: TsrvInventario Name = 'CAUSA' Value = '' end + item + Name = 'ID_ALMACEN_RESERVA' + Value = '' + end item Name = 'OLD_ID' Value = '' @@ -480,7 +490,8 @@ object srvInventario: TsrvInventario 'UPDATE MOVIMIENTOS'#10' SET '#10' ID = :ID,'#10' ID_ALMACEN = :ID_ALM' + 'ACEN,'#10' ID_ARTICULO = :ID_ARTICULO,'#10' FECHA_MOVIMIENTO = :FE' + 'CHA_MOVIMIENTO,'#10' TIPO = :TIPO,'#10' CANTIDAD = :CANTIDAD,'#10' ' + - 'CAUSA = :CAUSA'#10' WHERE'#10' (ID = :OLD_ID)'#10 + 'CAUSA = :CAUSA,'#10' ID_ALMACEN_RESERVA = :ID_ALMACEN_RESERVA'#10' W' + + 'HERE'#10' (ID = :OLD_ID)'#10 StatementType = stSQL ColumnMappings = <> end> diff --git a/Source/Modulos/Inventario/Views/Inventario_view.dproj b/Source/Modulos/Inventario/Views/Inventario_view.dproj index c6dfc324..99ebdf9d 100644 --- a/Source/Modulos/Inventario/Views/Inventario_view.dproj +++ b/Source/Modulos/Inventario/Views/Inventario_view.dproj @@ -46,11 +46,11 @@ MainSource - - - - - + + + + +
fEditorDetalleReservas
TfEditorDetalleReservas diff --git a/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.dfm b/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.dfm index 4b3721b8..aca7e19d 100644 --- a/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.dfm +++ b/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.dfm @@ -208,7 +208,7 @@ inherited fEditorEntradaSalidaArticulos: TfEditorEntradaSalidaArticulos StyleHot.LookAndFeel.NativeStyle = True TabOrder = 1 Height = 21 - Width = 1086 + Width = 1727 end end object pnlEntradaPedido: TTBXDockablePanel @@ -356,10 +356,30 @@ inherited fEditorEntradaSalidaArticulos: TfEditorEntradaSalidaArticulos Width = 773 ExplicitWidth = 773 inherited txtFiltroTodo: TcxTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 676 Width = 676 end + inherited edtFechaIniFiltro: TcxDateEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + end + inherited edtFechaFinFiltro: TcxDateEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + end inherited eLista: TcxComboBox + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 380 Width = 380 end diff --git a/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.pas b/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.pas index 8fc0b902..508f879a 100644 --- a/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.pas +++ b/Source/Modulos/Inventario/Views/uEditorEntradaSalidaArticulos.pas @@ -262,6 +262,20 @@ begin FTitulo := FTitulo + '" hasta "' + AObraDestino.NOMBRE + '"'; actGuardarCerrar.Caption := 'Realizar el traslado de los artículos'; end; + tReserva: + begin + if AAlmacenOrigen.RecordCount > 0 then + FTitulo := 'Reserva de artículos de "' + AAlmacenOrigen.NOMBRE + else + FTitulo := 'Reserva de artículos de "' + AObraOrigen.NOMBRE; + + if AAlmacenDestino.RecordCount > 0 then + FTitulo := FTitulo + '" para "' + AAlmacenDestino.NOMBRE + '"' + else + FTitulo := FTitulo + '" para "' + AObraDestino.NOMBRE + '"'; + actGuardarCerrar.Caption := 'Realizar la reserva de los artículos'; + Label2.Caption := 'Fecha de la reserva:'; + end; end; finally AAlmacenOrigen := Nil; @@ -272,7 +286,7 @@ begin //Botones de añadir y eliminar case FArticulos.TipoMovimiento of - tEntradaLibre, tSalidaLibre, tTraslado : + tEntradaLibre, tSalidaLibre, tTraslado, tReserva : begin pnlMovimiento.Visible := True; eFechaMovimiento.Date := Date; diff --git a/Source/Modulos/Inventario/Views/uEditorInventario.dfm b/Source/Modulos/Inventario/Views/uEditorInventario.dfm index 8a345973..36368f51 100644 --- a/Source/Modulos/Inventario/Views/uEditorInventario.dfm +++ b/Source/Modulos/Inventario/Views/uEditorInventario.dfm @@ -50,7 +50,7 @@ inherited fEditorInventario: TfEditorInventario 000000180806000000E0773DF8000000017352474200AECE1CE9000000046741 4D410000B18F0BFC6105000000206348524D00007A26000080840000FA000000 80E8000075300000EA6000003A98000017709CBA513C00000009704859730000 - 17110000171101CA26F33F000002E249444154484BB596EF4B535118C7E7BBDE + 17100000171001186111DB000002E249444154484BB596EF4B535118C7E7BBDE F43F44D12B0982FE808892B437BDCB428B2CB04C4C1B16A312417AE10FCA5F69 12A5D39A59B417196413CD10225743A7A9ED8777FEDAD4E9DDA64DC7FCD5B73D C78ECD7BEE9C825D78B8EC9EBBCFE73CCF79CEBD370180E6BF1E4C706BE05024 @@ -210,21 +210,37 @@ inherited fEditorInventario: TfEditorInventario Width = 669 ExplicitWidth = 669 inherited txtFiltroTodo: TcxTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 572 Width = 572 end inherited edtFechaIniFiltro: TcxDateEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 246 Width = 246 end inherited edtFechaFinFiltro: TcxDateEdit Left = 350 + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitLeft = 350 ExplicitWidth = 205 Width = 205 end inherited eLista: TcxComboBox Left = 592 + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitLeft = 592 ExplicitWidth = 67 Width = 67 @@ -311,7 +327,6 @@ inherited fEditorInventario: TfEditorInventario object actReservar: TAction Category = 'Logistica' Caption = 'Reservar' - Enabled = False ImageIndex = 25 OnExecute = actReservarExecute end diff --git a/Source/Modulos/Inventario/Views/uEditorInventario.pas b/Source/Modulos/Inventario/Views/uEditorInventario.pas index 16b64d8b..322ced42 100644 --- a/Source/Modulos/Inventario/Views/uEditorInventario.pas +++ b/Source/Modulos/Inventario/Views/uEditorInventario.pas @@ -382,13 +382,22 @@ end; procedure TfEditorInventario.actReservarExecute(Sender: TObject); var - IDAlmacenDestino: Integer; + IDAlmacenOrigen, IDAlmacenDestino: Integer; + begin - IDAlmacenDestino := darIDAlmacenSeleccionado('Elija el almacén donde desea reservar el material'); - if IDAlmacenDestino <> -1 then + if (TipoInventario = CTE_INV_ALMACEN) then + IDAlmacenOrigen := DarIDAlmacenSeleccionado('Elija el almacén donde desea reservar el material') + else + IDAlmacenOrigen := DarIDObraSeleccionada('Elija la obra donde desea reservar el material'); + + if IDAlmacenOrigen <> -1 then begin - FController.EntradaArticulosLibre(FInventario, IDAlmacenDestino); - RefrescarInterno; + IDAlmacenDestino := Seleccionar('Elija el almacén/obra para el que desea reservar el material (donde irán los materiales)', tAlmacenObra); + if IDAlmacenDestino <> -1 then + begin + FController.ReservarArticulosLibre(FInventario, IDAlmacenOrigen, IDAlmacenDestino); + RefrescarInterno; + end; end; end; diff --git a/Source/Servidor/FactuGES_Server.dpr b/Source/Servidor/FactuGES_Server.dpr index c2754150..ceb926ec 100644 --- a/Source/Servidor/FactuGES_Server.dpr +++ b/Source/Servidor/FactuGES_Server.dpr @@ -112,8 +112,6 @@ uses schFacturasClienteServer_Intf in '..\Modulos\Facturas de cliente\Model\schFacturasClienteServer_Intf.pas', schAlmacenesClient_Intf in '..\Modulos\Almacenes\Model\schAlmacenesClient_Intf.pas', schAlmacenesServer_Intf in '..\Modulos\Almacenes\Model\schAlmacenesServer_Intf.pas', - schInventarioClient_Intf in '..\Modulos\Inventario\Model\schInventarioClient_Intf.pas', - schInventarioServer_Intf in '..\Modulos\Inventario\Model\schInventarioServer_Intf.pas', schAlbaranesProveedorClient_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorClient_Intf.pas', schAlbaranesProveedorServer_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorServer_Intf.pas', schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_Intf.pas', @@ -129,7 +127,9 @@ uses schUsuariosClient_Intf in '..\ApplicationBase\Usuarios\Model\schUsuariosClient_Intf.pas', srvGestorDocumentos_Impl in '..\Modulos\Gestion de documentos\Servidor\srvGestorDocumentos_Impl.pas' {srvGestorDocumentos: TDataAbstractService}, schPresupuestosClienteClient_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteClient_Intf.pas', - schPresupuestosClienteServer_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteServer_Intf.pas'; + schPresupuestosClienteServer_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteServer_Intf.pas', + schInventarioClient_Intf in '..\Modulos\Inventario\Model\schInventarioClient_Intf.pas', + schInventarioServer_Intf in '..\Modulos\Inventario\Model\schInventarioServer_Intf.pas'; {$R *.res} {$R ..\Servicios\RODLFile.res}