54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
/**
|
|
* ConsumoObraService - Servicio de consumos de materiales
|
|
*
|
|
* Gestión de consumos de materiales por obra/lote.
|
|
*
|
|
* @module Inventory
|
|
*/
|
|
import { Repository } from 'typeorm';
|
|
import { ConsumoObra } from '../entities/consumo-obra.entity';
|
|
import { ServiceContext, PaginatedResult } from '../../../shared/services/base.service';
|
|
export interface CreateConsumoDto {
|
|
fraccionamientoId: string;
|
|
loteId?: string;
|
|
departamentoId?: string;
|
|
conceptoId?: string;
|
|
productId: string;
|
|
quantity: number;
|
|
unitCost?: number;
|
|
consumptionDate: Date;
|
|
notes?: string;
|
|
}
|
|
export interface ConsumoFilters {
|
|
fraccionamientoId?: string;
|
|
loteId?: string;
|
|
conceptoId?: string;
|
|
productId?: string;
|
|
dateFrom?: Date;
|
|
dateTo?: Date;
|
|
}
|
|
export interface ConsumoStats {
|
|
totalConsumos: number;
|
|
totalQuantity: number;
|
|
totalCost: number;
|
|
byProduct: {
|
|
productId: string;
|
|
quantity: number;
|
|
cost: number;
|
|
}[];
|
|
byConcepto: {
|
|
conceptoId: string;
|
|
quantity: number;
|
|
cost: number;
|
|
}[];
|
|
}
|
|
export declare class ConsumoObraService {
|
|
private readonly repository;
|
|
constructor(repository: Repository<ConsumoObra>);
|
|
findWithFilters(ctx: ServiceContext, filters?: ConsumoFilters, page?: number, limit?: number): Promise<PaginatedResult<ConsumoObra>>;
|
|
findById(ctx: ServiceContext, id: string): Promise<ConsumoObra | null>;
|
|
create(ctx: ServiceContext, dto: CreateConsumoDto): Promise<ConsumoObra>;
|
|
getStats(ctx: ServiceContext, fraccionamientoId: string): Promise<ConsumoStats>;
|
|
softDelete(ctx: ServiceContext, id: string): Promise<boolean>;
|
|
}
|
|
//# sourceMappingURL=consumo-obra.service.d.ts.map
|