sigo-package 1.2.171 → 1.2.173

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as sigo_entities from 'sigo-entities';
2
- import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, CodigoNombreUMDTO, PrecioContratistaMOAL04ENTITY, ManoObraGlobalENTITY, ValorizacionManoObraDTO, PrecioContratistaMOAL02ENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, TrabajoAlemaniaENTITY, ValorizacionAlemaniaDTO, ValorizacionDTO, StockPersonalENTITY, StockAlmacenENTITY, ConsumoMaterialAlemaniaENTITY, ValorizacionesDTO, PrecioContratistaMaterialENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY, DetalleChileValorizacionMODTO, PrecioMaterialENTITY, DocumentRequirementDto, AltasNVTOrderENTITY, CodigoNombreDTO, SystemOptionEntity, MenuDto, FilesDocDTO } from 'sigo-entities';
2
+ import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, CodigoNombreUMDTO, PrecioContratistaMOAL04ENTITY, ManoObraGlobalENTITY, ValorizacionManoObraDTO, PrecioContratistaMOAL02ENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, TrabajoAlemaniaENTITY, ValorizacionAlemaniaDTO, ValorizacionDTO, StockPersonalENTITY, StockAlmacenENTITY, ConsumoMaterialAlemaniaENTITY, ValorizacionesDTO, PrecioContratistaMaterialENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY, DetalleChileValorizacionMODTO, PrecioMaterialENTITY, DocumentRequirementDto, AltasNVTOrderENTITY, MaterialesSomacylDTO, SomacylEntregablesDTO, FilesDocDTO, CodigoNombreDTO, SystemOptionEntity, MenuDto } from 'sigo-entities';
3
3
  import { ClassConstructor } from 'class-transformer';
4
4
  import { Request, Response, NextFunction } from 'express';
5
5
 
@@ -690,6 +690,57 @@ declare const documentRequirementAltasNVT: DocumentRequirementDto[];
690
690
 
691
691
  declare function verifyInventoryFinalize(docs: AltasNVTOrderENTITY[], UnprocessableEntityException?: ClassConstructor<Error>): void;
692
692
 
693
+ /** Código del material "contador retirado" que se agrega como línea deinstall */
694
+ declare const SOMACYL_CODIGO_CONTADOR_RETIRADO = "SOMACYL0000";
695
+ /** Las 4 fotos obligatorias de una orden Somacyl (campos de entregables) */
696
+ declare const SOMACYL_PHOTO_POSITIONS: readonly [{
697
+ readonly key: "foto_antes";
698
+ readonly label: "foto antes";
699
+ }, {
700
+ readonly key: "foto_despues";
701
+ readonly label: "foto después";
702
+ }, {
703
+ readonly key: "conjunto_medida_antes";
704
+ readonly label: "conjunto de medida antes";
705
+ }, {
706
+ readonly key: "conjunto_medida_despues";
707
+ readonly label: "conjunto de medida después";
708
+ }];
709
+ type SomacylPhotoKey = typeof SOMACYL_PHOTO_POSITIONS[number]['key'];
710
+ declare function throwSomacylError(msg: string, Exception?: ClassConstructor<Error>): never;
711
+
712
+ /**
713
+ * Límites de materiales por orden (se valida al agregar inventario).
714
+ * @param inventory inventario resultante (existente + nuevo)
715
+ */
716
+ declare function verifyInventoryLimitsSomacyl(inventory: Pick<MaterialesSomacylDTO, 'descripcion' | 'cantidad'>[], BadRequestException?: ClassConstructor<Error>): void;
717
+
718
+ /**
719
+ * Reglas de materiales para finalizar una orden Somacyl (estado Finalizada).
720
+ */
721
+ declare function verifyInventoryFinalizeSomacyl(inventory: Pick<MaterialesSomacylDTO, 'codigo' | 'descripcion' | 'cantidad'>[], BadRequestException?: ClassConstructor<Error>): void;
722
+
723
+ /**
724
+ * Datos requeridos para finalizar una orden Somacyl (estado Finalizada):
725
+ * lecturas del contador retirado e instalado y observaciones.
726
+ */
727
+ declare function verifyDetailsFinalizeSomacyl(entregables: Pick<SomacylEntregablesDTO, 'lectura_contador_retirado' | 'lectura_contador_instalado' | 'observaciones'>, BadRequestException?: ClassConstructor<Error>): void;
728
+
729
+ /**
730
+ * Fotos requeridas para finalizar una orden Somacyl (estado Finalizada):
731
+ * las 4 fotos presentes, con coordenadas válidas, y coordenadas GPS del contador.
732
+ */
733
+ declare function verifyPhotosFinalizeSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
734
+ /**
735
+ * Fotos requeridas para marcar una orden Somacyl como No Finalizada: la foto antes.
736
+ */
737
+ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
738
+
739
+ /**
740
+ * Fecha de captura de una foto: [CAPTURE_DATE=...] en la observación o, en su defecto, Fecha_Archivo.
741
+ */
742
+ declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
743
+
693
744
  declare enum Position {
694
745
  left = "left",
695
746
  right = "right"
@@ -860,4 +911,4 @@ declare function verifyFiles(documentation: FilesDocDTO[], documentRequirement:
860
911
 
861
912
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
862
913
 
863
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, type TARGET, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL04, codClientes, codIssueByPeriodoAL02, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esCadenaFechaISOValida, esObjetoFecha, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getContainerName, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, newCodMOTroncalReglaLiquidacion1, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validateNoLookup, validateUUIDv4Param, verifyFiles, verifyInventoryFinalize };
914
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SomacylPhotoKey, type TARGET, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL04, codClientes, codIssueByPeriodoAL02, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esCadenaFechaISOValida, esObjetoFecha, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, newCodMOTroncalReglaLiquidacion1, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, throwSomacylError, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as sigo_entities from 'sigo-entities';
2
- import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, CodigoNombreUMDTO, PrecioContratistaMOAL04ENTITY, ManoObraGlobalENTITY, ValorizacionManoObraDTO, PrecioContratistaMOAL02ENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, TrabajoAlemaniaENTITY, ValorizacionAlemaniaDTO, ValorizacionDTO, StockPersonalENTITY, StockAlmacenENTITY, ConsumoMaterialAlemaniaENTITY, ValorizacionesDTO, PrecioContratistaMaterialENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY, DetalleChileValorizacionMODTO, PrecioMaterialENTITY, DocumentRequirementDto, AltasNVTOrderENTITY, CodigoNombreDTO, SystemOptionEntity, MenuDto, FilesDocDTO } from 'sigo-entities';
2
+ import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, CodigoNombreUMDTO, PrecioContratistaMOAL04ENTITY, ManoObraGlobalENTITY, ValorizacionManoObraDTO, PrecioContratistaMOAL02ENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, TrabajoAlemaniaENTITY, ValorizacionAlemaniaDTO, ValorizacionDTO, StockPersonalENTITY, StockAlmacenENTITY, ConsumoMaterialAlemaniaENTITY, ValorizacionesDTO, PrecioContratistaMaterialENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY, DetalleChileValorizacionMODTO, PrecioMaterialENTITY, DocumentRequirementDto, AltasNVTOrderENTITY, MaterialesSomacylDTO, SomacylEntregablesDTO, FilesDocDTO, CodigoNombreDTO, SystemOptionEntity, MenuDto } from 'sigo-entities';
3
3
  import { ClassConstructor } from 'class-transformer';
4
4
  import { Request, Response, NextFunction } from 'express';
5
5
 
@@ -690,6 +690,57 @@ declare const documentRequirementAltasNVT: DocumentRequirementDto[];
690
690
 
691
691
  declare function verifyInventoryFinalize(docs: AltasNVTOrderENTITY[], UnprocessableEntityException?: ClassConstructor<Error>): void;
692
692
 
693
+ /** Código del material "contador retirado" que se agrega como línea deinstall */
694
+ declare const SOMACYL_CODIGO_CONTADOR_RETIRADO = "SOMACYL0000";
695
+ /** Las 4 fotos obligatorias de una orden Somacyl (campos de entregables) */
696
+ declare const SOMACYL_PHOTO_POSITIONS: readonly [{
697
+ readonly key: "foto_antes";
698
+ readonly label: "foto antes";
699
+ }, {
700
+ readonly key: "foto_despues";
701
+ readonly label: "foto después";
702
+ }, {
703
+ readonly key: "conjunto_medida_antes";
704
+ readonly label: "conjunto de medida antes";
705
+ }, {
706
+ readonly key: "conjunto_medida_despues";
707
+ readonly label: "conjunto de medida después";
708
+ }];
709
+ type SomacylPhotoKey = typeof SOMACYL_PHOTO_POSITIONS[number]['key'];
710
+ declare function throwSomacylError(msg: string, Exception?: ClassConstructor<Error>): never;
711
+
712
+ /**
713
+ * Límites de materiales por orden (se valida al agregar inventario).
714
+ * @param inventory inventario resultante (existente + nuevo)
715
+ */
716
+ declare function verifyInventoryLimitsSomacyl(inventory: Pick<MaterialesSomacylDTO, 'descripcion' | 'cantidad'>[], BadRequestException?: ClassConstructor<Error>): void;
717
+
718
+ /**
719
+ * Reglas de materiales para finalizar una orden Somacyl (estado Finalizada).
720
+ */
721
+ declare function verifyInventoryFinalizeSomacyl(inventory: Pick<MaterialesSomacylDTO, 'codigo' | 'descripcion' | 'cantidad'>[], BadRequestException?: ClassConstructor<Error>): void;
722
+
723
+ /**
724
+ * Datos requeridos para finalizar una orden Somacyl (estado Finalizada):
725
+ * lecturas del contador retirado e instalado y observaciones.
726
+ */
727
+ declare function verifyDetailsFinalizeSomacyl(entregables: Pick<SomacylEntregablesDTO, 'lectura_contador_retirado' | 'lectura_contador_instalado' | 'observaciones'>, BadRequestException?: ClassConstructor<Error>): void;
728
+
729
+ /**
730
+ * Fotos requeridas para finalizar una orden Somacyl (estado Finalizada):
731
+ * las 4 fotos presentes, con coordenadas válidas, y coordenadas GPS del contador.
732
+ */
733
+ declare function verifyPhotosFinalizeSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
734
+ /**
735
+ * Fotos requeridas para marcar una orden Somacyl como No Finalizada: la foto antes.
736
+ */
737
+ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
738
+
739
+ /**
740
+ * Fecha de captura de una foto: [CAPTURE_DATE=...] en la observación o, en su defecto, Fecha_Archivo.
741
+ */
742
+ declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
743
+
693
744
  declare enum Position {
694
745
  left = "left",
695
746
  right = "right"
@@ -860,4 +911,4 @@ declare function verifyFiles(documentation: FilesDocDTO[], documentRequirement:
860
911
 
861
912
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
862
913
 
863
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, type TARGET, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL04, codClientes, codIssueByPeriodoAL02, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esCadenaFechaISOValida, esObjetoFecha, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getContainerName, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, newCodMOTroncalReglaLiquidacion1, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validateNoLookup, validateUUIDv4Param, verifyFiles, verifyInventoryFinalize };
914
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SomacylPhotoKey, type TARGET, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL04, codClientes, codIssueByPeriodoAL02, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esCadenaFechaISOValida, esObjetoFecha, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, newCodMOTroncalReglaLiquidacion1, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, throwSomacylError, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
package/dist/index.js CHANGED
@@ -59,6 +59,8 @@ __export(index_exports, {
59
59
  ObtenerPrecioContratistaVigente: () => ObtenerPrecioContratistaVigente,
60
60
  ObtenerZonaAsignada: () => ObtenerZonaAsignada,
61
61
  SEGMENT_TY: () => SEGMENT_TY,
62
+ SOMACYL_CODIGO_CONTADOR_RETIRADO: () => SOMACYL_CODIGO_CONTADOR_RETIRADO,
63
+ SOMACYL_PHOTO_POSITIONS: () => SOMACYL_PHOTO_POSITIONS,
62
64
  UpdateNodosDocDP: () => UpdateNodosDocDP,
63
65
  ValidarRelacionMOHijasAL04: () => ValidarRelacionMOHijasAL04,
64
66
  ValorizacionHelper: () => ValorizacionHelper,
@@ -124,6 +126,7 @@ __export(index_exports, {
124
126
  formatPercentageV1: () => formatPercentageV1,
125
127
  generateUniqueNumber: () => generateUniqueNumber,
126
128
  generateUniqueNumberArray: () => generateUniqueNumberArray,
129
+ getCaptureDateSomacyl: () => getCaptureDateSomacyl,
127
130
  getChannelName: () => getChannelName,
128
131
  getContainerName: () => getContainerName,
129
132
  getDBName: () => getDBName,
@@ -161,6 +164,7 @@ __export(index_exports, {
161
164
  searchCurrentContractorSpecialtyPrice: () => searchCurrentContractorSpecialtyPrice,
162
165
  setColModels: () => setColModels,
163
166
  setContext: () => setContext,
167
+ throwSomacylError: () => throwSomacylError,
164
168
  updatePriceContractorMOAL02: () => updatePriceContractorMOAL02,
165
169
  updatePriceContractorMOAL04: () => updatePriceContractorMOAL04,
166
170
  updatePriceMOAL02: () => updatePriceMOAL02,
@@ -170,8 +174,13 @@ __export(index_exports, {
170
174
  uuidRegex: () => uuidRegex,
171
175
  validateNoLookup: () => validateNoLookup,
172
176
  validateUUIDv4Param: () => validateUUIDv4Param,
177
+ verifyDetailsFinalizeSomacyl: () => verifyDetailsFinalizeSomacyl,
173
178
  verifyFiles: () => verifyFiles,
174
- verifyInventoryFinalize: () => verifyInventoryFinalize
179
+ verifyInventoryFinalize: () => verifyInventoryFinalize,
180
+ verifyInventoryFinalizeSomacyl: () => verifyInventoryFinalizeSomacyl,
181
+ verifyInventoryLimitsSomacyl: () => verifyInventoryLimitsSomacyl,
182
+ verifyPhotosFinalizeSomacyl: () => verifyPhotosFinalizeSomacyl,
183
+ verifyPhotosNotFinalizedSomacyl: () => verifyPhotosNotFinalizedSomacyl
175
184
  });
176
185
  module.exports = __toCommonJS(index_exports);
177
186
 
@@ -17046,6 +17055,169 @@ function verifyInventoryFinalize(docs, UnprocessableEntityException) {
17046
17055
  }
17047
17056
  __name(verifyInventoryFinalize, "verifyInventoryFinalize");
17048
17057
 
17058
+ // src/Operativa/Somacyl/constants.ts
17059
+ var SOMACYL_CODIGO_CONTADOR_RETIRADO = "SOMACYL0000";
17060
+ var SOMACYL_PHOTO_POSITIONS = [
17061
+ {
17062
+ key: "foto_antes",
17063
+ label: "foto antes"
17064
+ },
17065
+ {
17066
+ key: "foto_despues",
17067
+ label: "foto despu\xE9s"
17068
+ },
17069
+ {
17070
+ key: "conjunto_medida_antes",
17071
+ label: "conjunto de medida antes"
17072
+ },
17073
+ {
17074
+ key: "conjunto_medida_despues",
17075
+ label: "conjunto de medida despu\xE9s"
17076
+ }
17077
+ ];
17078
+ function throwSomacylError(msg, Exception) {
17079
+ if (Exception) {
17080
+ throw new Exception(msg, true);
17081
+ }
17082
+ throw new Error(msg, {
17083
+ cause: "USER_MESSAGE"
17084
+ });
17085
+ }
17086
+ __name(throwSomacylError, "throwSomacylError");
17087
+
17088
+ // src/Operativa/Somacyl/verifyInventoryLimits.ts
17089
+ var LIMITES = {
17090
+ CONTADOR: 2,
17091
+ LLAVE: 2,
17092
+ VALVULA: 2,
17093
+ TES: 1,
17094
+ TAPON: 1
17095
+ };
17096
+ function verifyInventoryLimitsSomacyl(inventory, BadRequestException) {
17097
+ const conteo = {};
17098
+ for (const material of inventory) {
17099
+ const descripcion = material.descripcion.toUpperCase();
17100
+ for (const tipo of Object.keys(LIMITES)) {
17101
+ if (descripcion.includes(tipo)) {
17102
+ conteo[tipo] = (conteo[tipo] || 0) + material.cantidad;
17103
+ }
17104
+ }
17105
+ }
17106
+ const errores = Object.keys(LIMITES).filter((tipo) => (conteo[tipo] || 0) > LIMITES[tipo]).map((tipo) => `${tipo}: m\xE1ximo ${LIMITES[tipo]}, encontrado ${conteo[tipo]}`);
17107
+ if (errores.length) {
17108
+ throwSomacylError(`Se excedi\xF3 la cantidad m\xE1xima permitida ${errores.join(", ")}`, BadRequestException);
17109
+ }
17110
+ }
17111
+ __name(verifyInventoryLimitsSomacyl, "verifyInventoryLimitsSomacyl");
17112
+
17113
+ // src/Operativa/Somacyl/verifyInventoryFinalize.ts
17114
+ function verifyInventoryFinalizeSomacyl(inventory, BadRequestException) {
17115
+ const fail = /* @__PURE__ */ __name((msg) => throwSomacylError(msg, BadRequestException), "fail");
17116
+ if (inventory.length === 0) {
17117
+ fail("La orden no tiene inventario");
17118
+ }
17119
+ const contador = inventory.filter((e) => e.descripcion.includes("CONTADOR") && e.codigo !== SOMACYL_CODIGO_CONTADOR_RETIRADO);
17120
+ const contadorRetirado = inventory.filter((e) => e.codigo === SOMACYL_CODIGO_CONTADOR_RETIRADO);
17121
+ const valvulas = inventory.filter((e) => e.descripcion.includes("VALVULA"));
17122
+ const tes = inventory.filter((e) => e.descripcion.includes("TES"));
17123
+ const tapon = inventory.filter((e) => e.descripcion.includes("TAPON"));
17124
+ if (contador.length !== 1) {
17125
+ fail(`La orden debe tener un contador, se encontraron ${contador.length} contadores`);
17126
+ }
17127
+ if (contadorRetirado.length !== 1) {
17128
+ fail(`La orden debe tener ${SOMACYL_CODIGO_CONTADOR_RETIRADO}, se encontraron ${contadorRetirado.length} ${SOMACYL_CODIGO_CONTADOR_RETIRADO}`);
17129
+ }
17130
+ if (valvulas.length > 1) {
17131
+ fail(`La orden debe tener maximo 1 valvula, se encontraron ${valvulas.length} valvulas`);
17132
+ }
17133
+ if (tes.length > 1) {
17134
+ fail(`La orden debe tener maximo 1 tes, se encontraron ${tes.length} tes`);
17135
+ }
17136
+ if (tapon.length > 1) {
17137
+ fail(`La orden debe tener maximo 1 tapon, se encontraron ${tapon.length} tapones`);
17138
+ }
17139
+ if (tes.length === 1) {
17140
+ if (tapon.length === 1 && contador[0].cantidad !== 1) {
17141
+ fail(`La orden debe tener un tapon con cantidad 1 si se instala un TES, la cantidad del contador es ${contador[0].cantidad}`);
17142
+ } else if (tapon.length === 0) {
17143
+ fail("La orden debe tener un tapon si se instala un TES");
17144
+ }
17145
+ if (valvulas.length === 1 && valvulas[0].cantidad !== 1) {
17146
+ fail(`La orden al instalar un TES y si se agrega una valvula, esta debe ser con cantidad 1, la cantidad de la valvula es ${valvulas[0].cantidad}`);
17147
+ }
17148
+ }
17149
+ if (tes.length === 0 && tapon.length === 1) {
17150
+ fail(`La orden no puede tener tapon si no tiene TES, se encontraron ${tapon.length} TAPON`);
17151
+ }
17152
+ if (valvulas.length === 1 && valvulas[0].cantidad > 2) {
17153
+ fail(`La orden no puede tener mas de 2 valvulas instaladas, se encontraron ${valvulas[0].cantidad} valvulas`);
17154
+ }
17155
+ }
17156
+ __name(verifyInventoryFinalizeSomacyl, "verifyInventoryFinalizeSomacyl");
17157
+
17158
+ // src/Operativa/Somacyl/verifyDetailsFinalize.ts
17159
+ function verifyDetailsFinalizeSomacyl(entregables, BadRequestException) {
17160
+ const required = [
17161
+ [
17162
+ "lectura_contador_retirado",
17163
+ "la lectura del contador retirado"
17164
+ ],
17165
+ [
17166
+ "lectura_contador_instalado",
17167
+ "la lectura del contador instalado"
17168
+ ],
17169
+ [
17170
+ "observaciones",
17171
+ "las observaciones"
17172
+ ]
17173
+ ];
17174
+ for (const [field, label] of required) {
17175
+ if (!entregables[field]?.trim()) {
17176
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
17177
+ }
17178
+ }
17179
+ }
17180
+ __name(verifyDetailsFinalizeSomacyl, "verifyDetailsFinalizeSomacyl");
17181
+
17182
+ // src/Operativa/Somacyl/verifyPhotos.ts
17183
+ var hasFile = /* @__PURE__ */ __name((file) => !!file && file.Posicion !== "", "hasFile");
17184
+ var hasInvalidCoordinates = /* @__PURE__ */ __name((file) => !file.Coordenadas || file.Coordenadas.X === "0" || file.Coordenadas.Y === "0", "hasInvalidCoordinates");
17185
+ function verifyPhotosFinalizeSomacyl(entregables, BadRequestException) {
17186
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17187
+ if (!hasFile(entregables[key])) {
17188
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
17189
+ }
17190
+ }
17191
+ if (!entregables.latitud || !entregables.longitud) {
17192
+ throwSomacylError("La orden no tiene coordenadas GPS v\xE1lidas (latitud o longitud en 0)", BadRequestException);
17193
+ }
17194
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17195
+ if (hasInvalidCoordinates(entregables[key])) {
17196
+ throwSomacylError(`La ${label} tiene coordenadas inv\xE1lidas (latitud o longitud en 0)`, BadRequestException);
17197
+ }
17198
+ }
17199
+ }
17200
+ __name(verifyPhotosFinalizeSomacyl, "verifyPhotosFinalizeSomacyl");
17201
+ function verifyPhotosNotFinalizedSomacyl(entregables, BadRequestException) {
17202
+ if (!hasFile(entregables.foto_antes)) {
17203
+ throwSomacylError("La orden debe tener foto antes", BadRequestException);
17204
+ }
17205
+ }
17206
+ __name(verifyPhotosNotFinalizedSomacyl, "verifyPhotosNotFinalizedSomacyl");
17207
+
17208
+ // src/Operativa/Somacyl/getCaptureDate.ts
17209
+ function getCaptureDateSomacyl(file, BadRequestException) {
17210
+ const match = (file.Observacion ?? "").match(/\[CAPTURE_DATE=(.*?)\]/);
17211
+ if (match) {
17212
+ const fecha = new Date(match[1]);
17213
+ if (!isNaN(fecha.getTime())) return fecha;
17214
+ }
17215
+ const fechaArchivo = file.Fecha_Archivo ? new Date(file.Fecha_Archivo) : void 0;
17216
+ if (fechaArchivo && !isNaN(fechaArchivo.getTime())) return fechaArchivo;
17217
+ return throwSomacylError("No es posible obtener la fecha de captura", BadRequestException);
17218
+ }
17219
+ __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17220
+
17049
17221
  // src/constants/collections.ts
17050
17222
  var collections = Object.freeze({
17051
17223
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17315,6 +17487,8 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17315
17487
  ObtenerPrecioContratistaVigente,
17316
17488
  ObtenerZonaAsignada,
17317
17489
  SEGMENT_TY,
17490
+ SOMACYL_CODIGO_CONTADOR_RETIRADO,
17491
+ SOMACYL_PHOTO_POSITIONS,
17318
17492
  UpdateNodosDocDP,
17319
17493
  ValidarRelacionMOHijasAL04,
17320
17494
  ValorizacionHelper,
@@ -17380,6 +17554,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17380
17554
  formatPercentageV1,
17381
17555
  generateUniqueNumber,
17382
17556
  generateUniqueNumberArray,
17557
+ getCaptureDateSomacyl,
17383
17558
  getChannelName,
17384
17559
  getContainerName,
17385
17560
  getDBName,
@@ -17417,6 +17592,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17417
17592
  searchCurrentContractorSpecialtyPrice,
17418
17593
  setColModels,
17419
17594
  setContext,
17595
+ throwSomacylError,
17420
17596
  updatePriceContractorMOAL02,
17421
17597
  updatePriceContractorMOAL04,
17422
17598
  updatePriceMOAL02,
@@ -17426,6 +17602,11 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17426
17602
  uuidRegex,
17427
17603
  validateNoLookup,
17428
17604
  validateUUIDv4Param,
17605
+ verifyDetailsFinalizeSomacyl,
17429
17606
  verifyFiles,
17430
- verifyInventoryFinalize
17607
+ verifyInventoryFinalize,
17608
+ verifyInventoryFinalizeSomacyl,
17609
+ verifyInventoryLimitsSomacyl,
17610
+ verifyPhotosFinalizeSomacyl,
17611
+ verifyPhotosNotFinalizedSomacyl
17431
17612
  });
package/dist/index.mjs CHANGED
@@ -16872,6 +16872,169 @@ function verifyInventoryFinalize(docs, UnprocessableEntityException) {
16872
16872
  }
16873
16873
  __name(verifyInventoryFinalize, "verifyInventoryFinalize");
16874
16874
 
16875
+ // src/Operativa/Somacyl/constants.ts
16876
+ var SOMACYL_CODIGO_CONTADOR_RETIRADO = "SOMACYL0000";
16877
+ var SOMACYL_PHOTO_POSITIONS = [
16878
+ {
16879
+ key: "foto_antes",
16880
+ label: "foto antes"
16881
+ },
16882
+ {
16883
+ key: "foto_despues",
16884
+ label: "foto despu\xE9s"
16885
+ },
16886
+ {
16887
+ key: "conjunto_medida_antes",
16888
+ label: "conjunto de medida antes"
16889
+ },
16890
+ {
16891
+ key: "conjunto_medida_despues",
16892
+ label: "conjunto de medida despu\xE9s"
16893
+ }
16894
+ ];
16895
+ function throwSomacylError(msg, Exception) {
16896
+ if (Exception) {
16897
+ throw new Exception(msg, true);
16898
+ }
16899
+ throw new Error(msg, {
16900
+ cause: "USER_MESSAGE"
16901
+ });
16902
+ }
16903
+ __name(throwSomacylError, "throwSomacylError");
16904
+
16905
+ // src/Operativa/Somacyl/verifyInventoryLimits.ts
16906
+ var LIMITES = {
16907
+ CONTADOR: 2,
16908
+ LLAVE: 2,
16909
+ VALVULA: 2,
16910
+ TES: 1,
16911
+ TAPON: 1
16912
+ };
16913
+ function verifyInventoryLimitsSomacyl(inventory, BadRequestException) {
16914
+ const conteo = {};
16915
+ for (const material of inventory) {
16916
+ const descripcion = material.descripcion.toUpperCase();
16917
+ for (const tipo of Object.keys(LIMITES)) {
16918
+ if (descripcion.includes(tipo)) {
16919
+ conteo[tipo] = (conteo[tipo] || 0) + material.cantidad;
16920
+ }
16921
+ }
16922
+ }
16923
+ const errores = Object.keys(LIMITES).filter((tipo) => (conteo[tipo] || 0) > LIMITES[tipo]).map((tipo) => `${tipo}: m\xE1ximo ${LIMITES[tipo]}, encontrado ${conteo[tipo]}`);
16924
+ if (errores.length) {
16925
+ throwSomacylError(`Se excedi\xF3 la cantidad m\xE1xima permitida ${errores.join(", ")}`, BadRequestException);
16926
+ }
16927
+ }
16928
+ __name(verifyInventoryLimitsSomacyl, "verifyInventoryLimitsSomacyl");
16929
+
16930
+ // src/Operativa/Somacyl/verifyInventoryFinalize.ts
16931
+ function verifyInventoryFinalizeSomacyl(inventory, BadRequestException) {
16932
+ const fail = /* @__PURE__ */ __name((msg) => throwSomacylError(msg, BadRequestException), "fail");
16933
+ if (inventory.length === 0) {
16934
+ fail("La orden no tiene inventario");
16935
+ }
16936
+ const contador = inventory.filter((e) => e.descripcion.includes("CONTADOR") && e.codigo !== SOMACYL_CODIGO_CONTADOR_RETIRADO);
16937
+ const contadorRetirado = inventory.filter((e) => e.codigo === SOMACYL_CODIGO_CONTADOR_RETIRADO);
16938
+ const valvulas = inventory.filter((e) => e.descripcion.includes("VALVULA"));
16939
+ const tes = inventory.filter((e) => e.descripcion.includes("TES"));
16940
+ const tapon = inventory.filter((e) => e.descripcion.includes("TAPON"));
16941
+ if (contador.length !== 1) {
16942
+ fail(`La orden debe tener un contador, se encontraron ${contador.length} contadores`);
16943
+ }
16944
+ if (contadorRetirado.length !== 1) {
16945
+ fail(`La orden debe tener ${SOMACYL_CODIGO_CONTADOR_RETIRADO}, se encontraron ${contadorRetirado.length} ${SOMACYL_CODIGO_CONTADOR_RETIRADO}`);
16946
+ }
16947
+ if (valvulas.length > 1) {
16948
+ fail(`La orden debe tener maximo 1 valvula, se encontraron ${valvulas.length} valvulas`);
16949
+ }
16950
+ if (tes.length > 1) {
16951
+ fail(`La orden debe tener maximo 1 tes, se encontraron ${tes.length} tes`);
16952
+ }
16953
+ if (tapon.length > 1) {
16954
+ fail(`La orden debe tener maximo 1 tapon, se encontraron ${tapon.length} tapones`);
16955
+ }
16956
+ if (tes.length === 1) {
16957
+ if (tapon.length === 1 && contador[0].cantidad !== 1) {
16958
+ fail(`La orden debe tener un tapon con cantidad 1 si se instala un TES, la cantidad del contador es ${contador[0].cantidad}`);
16959
+ } else if (tapon.length === 0) {
16960
+ fail("La orden debe tener un tapon si se instala un TES");
16961
+ }
16962
+ if (valvulas.length === 1 && valvulas[0].cantidad !== 1) {
16963
+ fail(`La orden al instalar un TES y si se agrega una valvula, esta debe ser con cantidad 1, la cantidad de la valvula es ${valvulas[0].cantidad}`);
16964
+ }
16965
+ }
16966
+ if (tes.length === 0 && tapon.length === 1) {
16967
+ fail(`La orden no puede tener tapon si no tiene TES, se encontraron ${tapon.length} TAPON`);
16968
+ }
16969
+ if (valvulas.length === 1 && valvulas[0].cantidad > 2) {
16970
+ fail(`La orden no puede tener mas de 2 valvulas instaladas, se encontraron ${valvulas[0].cantidad} valvulas`);
16971
+ }
16972
+ }
16973
+ __name(verifyInventoryFinalizeSomacyl, "verifyInventoryFinalizeSomacyl");
16974
+
16975
+ // src/Operativa/Somacyl/verifyDetailsFinalize.ts
16976
+ function verifyDetailsFinalizeSomacyl(entregables, BadRequestException) {
16977
+ const required = [
16978
+ [
16979
+ "lectura_contador_retirado",
16980
+ "la lectura del contador retirado"
16981
+ ],
16982
+ [
16983
+ "lectura_contador_instalado",
16984
+ "la lectura del contador instalado"
16985
+ ],
16986
+ [
16987
+ "observaciones",
16988
+ "las observaciones"
16989
+ ]
16990
+ ];
16991
+ for (const [field, label] of required) {
16992
+ if (!entregables[field]?.trim()) {
16993
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
16994
+ }
16995
+ }
16996
+ }
16997
+ __name(verifyDetailsFinalizeSomacyl, "verifyDetailsFinalizeSomacyl");
16998
+
16999
+ // src/Operativa/Somacyl/verifyPhotos.ts
17000
+ var hasFile = /* @__PURE__ */ __name((file) => !!file && file.Posicion !== "", "hasFile");
17001
+ var hasInvalidCoordinates = /* @__PURE__ */ __name((file) => !file.Coordenadas || file.Coordenadas.X === "0" || file.Coordenadas.Y === "0", "hasInvalidCoordinates");
17002
+ function verifyPhotosFinalizeSomacyl(entregables, BadRequestException) {
17003
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17004
+ if (!hasFile(entregables[key])) {
17005
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
17006
+ }
17007
+ }
17008
+ if (!entregables.latitud || !entregables.longitud) {
17009
+ throwSomacylError("La orden no tiene coordenadas GPS v\xE1lidas (latitud o longitud en 0)", BadRequestException);
17010
+ }
17011
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17012
+ if (hasInvalidCoordinates(entregables[key])) {
17013
+ throwSomacylError(`La ${label} tiene coordenadas inv\xE1lidas (latitud o longitud en 0)`, BadRequestException);
17014
+ }
17015
+ }
17016
+ }
17017
+ __name(verifyPhotosFinalizeSomacyl, "verifyPhotosFinalizeSomacyl");
17018
+ function verifyPhotosNotFinalizedSomacyl(entregables, BadRequestException) {
17019
+ if (!hasFile(entregables.foto_antes)) {
17020
+ throwSomacylError("La orden debe tener foto antes", BadRequestException);
17021
+ }
17022
+ }
17023
+ __name(verifyPhotosNotFinalizedSomacyl, "verifyPhotosNotFinalizedSomacyl");
17024
+
17025
+ // src/Operativa/Somacyl/getCaptureDate.ts
17026
+ function getCaptureDateSomacyl(file, BadRequestException) {
17027
+ const match = (file.Observacion ?? "").match(/\[CAPTURE_DATE=(.*?)\]/);
17028
+ if (match) {
17029
+ const fecha = new Date(match[1]);
17030
+ if (!isNaN(fecha.getTime())) return fecha;
17031
+ }
17032
+ const fechaArchivo = file.Fecha_Archivo ? new Date(file.Fecha_Archivo) : void 0;
17033
+ if (fechaArchivo && !isNaN(fechaArchivo.getTime())) return fechaArchivo;
17034
+ return throwSomacylError("No es posible obtener la fecha de captura", BadRequestException);
17035
+ }
17036
+ __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17037
+
16875
17038
  // src/constants/collections.ts
16876
17039
  var collections = Object.freeze({
16877
17040
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17140,6 +17303,8 @@ export {
17140
17303
  ObtenerPrecioContratistaVigente,
17141
17304
  ObtenerZonaAsignada,
17142
17305
  SEGMENT_TY,
17306
+ SOMACYL_CODIGO_CONTADOR_RETIRADO,
17307
+ SOMACYL_PHOTO_POSITIONS,
17143
17308
  UpdateNodosDocDP,
17144
17309
  ValidarRelacionMOHijasAL04,
17145
17310
  ValorizacionHelper,
@@ -17205,6 +17370,7 @@ export {
17205
17370
  formatPercentageV1,
17206
17371
  generateUniqueNumber,
17207
17372
  generateUniqueNumberArray,
17373
+ getCaptureDateSomacyl,
17208
17374
  getChannelName,
17209
17375
  getContainerName,
17210
17376
  getDBName,
@@ -17242,6 +17408,7 @@ export {
17242
17408
  searchCurrentContractorSpecialtyPrice,
17243
17409
  setColModels,
17244
17410
  setContext,
17411
+ throwSomacylError,
17245
17412
  updatePriceContractorMOAL02,
17246
17413
  updatePriceContractorMOAL04,
17247
17414
  updatePriceMOAL02,
@@ -17251,6 +17418,11 @@ export {
17251
17418
  uuidRegex,
17252
17419
  validateNoLookup,
17253
17420
  validateUUIDv4Param,
17421
+ verifyDetailsFinalizeSomacyl,
17254
17422
  verifyFiles,
17255
- verifyInventoryFinalize
17423
+ verifyInventoryFinalize,
17424
+ verifyInventoryFinalizeSomacyl,
17425
+ verifyInventoryLimitsSomacyl,
17426
+ verifyPhotosFinalizeSomacyl,
17427
+ verifyPhotosNotFinalizedSomacyl
17256
17428
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.171",
3
+ "version": "1.2.173",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,4 +27,4 @@
27
27
  "overrides": {
28
28
  "esbuild": "^0.28.0"
29
29
  }
30
- }
30
+ }