sigo-package 1.2.170 → 1.2.172

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,51 @@ 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
+ * Fotos requeridas para finalizar una orden Somacyl (estado Finalizada):
725
+ * las 4 fotos presentes, con coordenadas válidas, y coordenadas GPS del contador.
726
+ */
727
+ declare function verifyPhotosFinalizeSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
728
+ /**
729
+ * Fotos requeridas para marcar una orden Somacyl como No Finalizada: la foto antes.
730
+ */
731
+ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
732
+
733
+ /**
734
+ * Fecha de captura de una foto: [CAPTURE_DATE=...] en la observación o, en su defecto, Fecha_Archivo.
735
+ */
736
+ declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
737
+
693
738
  declare enum Position {
694
739
  left = "left",
695
740
  right = "right"
@@ -860,4 +905,4 @@ declare function verifyFiles(documentation: FilesDocDTO[], documentRequirement:
860
905
 
861
906
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
862
907
 
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 };
908
+ 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, 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,51 @@ 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
+ * Fotos requeridas para finalizar una orden Somacyl (estado Finalizada):
725
+ * las 4 fotos presentes, con coordenadas válidas, y coordenadas GPS del contador.
726
+ */
727
+ declare function verifyPhotosFinalizeSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
728
+ /**
729
+ * Fotos requeridas para marcar una orden Somacyl como No Finalizada: la foto antes.
730
+ */
731
+ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregablesDTO, BadRequestException?: ClassConstructor<Error>): void;
732
+
733
+ /**
734
+ * Fecha de captura de una foto: [CAPTURE_DATE=...] en la observación o, en su defecto, Fecha_Archivo.
735
+ */
736
+ declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
737
+
693
738
  declare enum Position {
694
739
  left = "left",
695
740
  right = "right"
@@ -860,4 +905,4 @@ declare function verifyFiles(documentation: FilesDocDTO[], documentRequirement:
860
905
 
861
906
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
862
907
 
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 };
908
+ 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, 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,
@@ -171,7 +175,11 @@ __export(index_exports, {
171
175
  validateNoLookup: () => validateNoLookup,
172
176
  validateUUIDv4Param: () => validateUUIDv4Param,
173
177
  verifyFiles: () => verifyFiles,
174
- verifyInventoryFinalize: () => verifyInventoryFinalize
178
+ verifyInventoryFinalize: () => verifyInventoryFinalize,
179
+ verifyInventoryFinalizeSomacyl: () => verifyInventoryFinalizeSomacyl,
180
+ verifyInventoryLimitsSomacyl: () => verifyInventoryLimitsSomacyl,
181
+ verifyPhotosFinalizeSomacyl: () => verifyPhotosFinalizeSomacyl,
182
+ verifyPhotosNotFinalizedSomacyl: () => verifyPhotosNotFinalizedSomacyl
175
183
  });
176
184
  module.exports = __toCommonJS(index_exports);
177
185
 
@@ -3795,7 +3803,7 @@ function obtenerTipoYCodigoMO(codigoOriginal) {
3795
3803
  if (!TipoMO) {
3796
3804
  throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
3797
3805
  }
3798
- CodigoMO = CodigoMO.split("_")[1];
3806
+ CodigoMO = CodigoMO.replace(/^[FT]\d+_/, "");
3799
3807
  }
3800
3808
  return {
3801
3809
  TipoMO,
@@ -17046,6 +17054,145 @@ function verifyInventoryFinalize(docs, UnprocessableEntityException) {
17046
17054
  }
17047
17055
  __name(verifyInventoryFinalize, "verifyInventoryFinalize");
17048
17056
 
17057
+ // src/Operativa/Somacyl/constants.ts
17058
+ var SOMACYL_CODIGO_CONTADOR_RETIRADO = "SOMACYL0000";
17059
+ var SOMACYL_PHOTO_POSITIONS = [
17060
+ {
17061
+ key: "foto_antes",
17062
+ label: "foto antes"
17063
+ },
17064
+ {
17065
+ key: "foto_despues",
17066
+ label: "foto despu\xE9s"
17067
+ },
17068
+ {
17069
+ key: "conjunto_medida_antes",
17070
+ label: "conjunto de medida antes"
17071
+ },
17072
+ {
17073
+ key: "conjunto_medida_despues",
17074
+ label: "conjunto de medida despu\xE9s"
17075
+ }
17076
+ ];
17077
+ function throwSomacylError(msg, Exception) {
17078
+ if (Exception) {
17079
+ throw new Exception(msg, true);
17080
+ }
17081
+ throw new Error(msg, {
17082
+ cause: "USER_MESSAGE"
17083
+ });
17084
+ }
17085
+ __name(throwSomacylError, "throwSomacylError");
17086
+
17087
+ // src/Operativa/Somacyl/verifyInventoryLimits.ts
17088
+ var LIMITES = {
17089
+ CONTADOR: 2,
17090
+ LLAVE: 2,
17091
+ VALVULA: 2,
17092
+ TES: 1,
17093
+ TAPON: 1
17094
+ };
17095
+ function verifyInventoryLimitsSomacyl(inventory, BadRequestException) {
17096
+ const conteo = {};
17097
+ for (const material of inventory) {
17098
+ const descripcion = material.descripcion.toUpperCase();
17099
+ for (const tipo of Object.keys(LIMITES)) {
17100
+ if (descripcion.includes(tipo)) {
17101
+ conteo[tipo] = (conteo[tipo] || 0) + material.cantidad;
17102
+ }
17103
+ }
17104
+ }
17105
+ const errores = Object.keys(LIMITES).filter((tipo) => (conteo[tipo] || 0) > LIMITES[tipo]).map((tipo) => `${tipo}: m\xE1ximo ${LIMITES[tipo]}, encontrado ${conteo[tipo]}`);
17106
+ if (errores.length) {
17107
+ throwSomacylError(`Se excedi\xF3 la cantidad m\xE1xima permitida ${errores.join(", ")}`, BadRequestException);
17108
+ }
17109
+ }
17110
+ __name(verifyInventoryLimitsSomacyl, "verifyInventoryLimitsSomacyl");
17111
+
17112
+ // src/Operativa/Somacyl/verifyInventoryFinalize.ts
17113
+ function verifyInventoryFinalizeSomacyl(inventory, BadRequestException) {
17114
+ const fail = /* @__PURE__ */ __name((msg) => throwSomacylError(msg, BadRequestException), "fail");
17115
+ if (inventory.length === 0) {
17116
+ fail("La orden no tiene inventario");
17117
+ }
17118
+ const contador = inventory.filter((e) => e.descripcion.includes("CONTADOR") && e.codigo !== SOMACYL_CODIGO_CONTADOR_RETIRADO);
17119
+ const contadorRetirado = inventory.filter((e) => e.codigo === SOMACYL_CODIGO_CONTADOR_RETIRADO);
17120
+ const valvulas = inventory.filter((e) => e.descripcion.includes("VALVULA"));
17121
+ const tes = inventory.filter((e) => e.descripcion.includes("TES"));
17122
+ const tapon = inventory.filter((e) => e.descripcion.includes("TAPON"));
17123
+ if (contador.length !== 1) {
17124
+ fail(`La orden debe tener un contador, se encontraron ${contador.length} contadores`);
17125
+ }
17126
+ if (contadorRetirado.length !== 1) {
17127
+ fail(`La orden debe tener ${SOMACYL_CODIGO_CONTADOR_RETIRADO}, se encontraron ${contadorRetirado.length} ${SOMACYL_CODIGO_CONTADOR_RETIRADO}`);
17128
+ }
17129
+ if (valvulas.length > 1) {
17130
+ fail(`La orden debe tener maximo 1 valvula, se encontraron ${valvulas.length} valvulas`);
17131
+ }
17132
+ if (tes.length > 1) {
17133
+ fail(`La orden debe tener maximo 1 tes, se encontraron ${tes.length} tes`);
17134
+ }
17135
+ if (tapon.length > 1) {
17136
+ fail(`La orden debe tener maximo 1 tapon, se encontraron ${tapon.length} tapones`);
17137
+ }
17138
+ if (tes.length === 1) {
17139
+ if (tapon.length === 1 && contador[0].cantidad !== 1) {
17140
+ fail(`La orden debe tener un tapon con cantidad 1 si se instala un TES, la cantidad del contador es ${contador[0].cantidad}`);
17141
+ } else if (tapon.length === 0) {
17142
+ fail("La orden debe tener un tapon si se instala un TES");
17143
+ }
17144
+ if (valvulas.length === 1 && valvulas[0].cantidad !== 1) {
17145
+ 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}`);
17146
+ }
17147
+ }
17148
+ if (tes.length === 0 && tapon.length === 1) {
17149
+ fail(`La orden no puede tener tapon si no tiene TES, se encontraron ${tapon.length} TAPON`);
17150
+ }
17151
+ if (valvulas.length === 1 && valvulas[0].cantidad > 2) {
17152
+ fail(`La orden no puede tener mas de 2 valvulas instaladas, se encontraron ${valvulas[0].cantidad} valvulas`);
17153
+ }
17154
+ }
17155
+ __name(verifyInventoryFinalizeSomacyl, "verifyInventoryFinalizeSomacyl");
17156
+
17157
+ // src/Operativa/Somacyl/verifyPhotos.ts
17158
+ var hasFile = /* @__PURE__ */ __name((file) => !!file && file.Posicion !== "", "hasFile");
17159
+ var hasInvalidCoordinates = /* @__PURE__ */ __name((file) => !file.Coordenadas || file.Coordenadas.X === "0" || file.Coordenadas.Y === "0", "hasInvalidCoordinates");
17160
+ function verifyPhotosFinalizeSomacyl(entregables, BadRequestException) {
17161
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17162
+ if (!hasFile(entregables[key])) {
17163
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
17164
+ }
17165
+ }
17166
+ if (!entregables.latitud || !entregables.longitud) {
17167
+ throwSomacylError("La orden no tiene coordenadas GPS v\xE1lidas (latitud o longitud en 0)", BadRequestException);
17168
+ }
17169
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
17170
+ if (hasInvalidCoordinates(entregables[key])) {
17171
+ throwSomacylError(`La ${label} tiene coordenadas inv\xE1lidas (latitud o longitud en 0)`, BadRequestException);
17172
+ }
17173
+ }
17174
+ }
17175
+ __name(verifyPhotosFinalizeSomacyl, "verifyPhotosFinalizeSomacyl");
17176
+ function verifyPhotosNotFinalizedSomacyl(entregables, BadRequestException) {
17177
+ if (!hasFile(entregables.foto_antes)) {
17178
+ throwSomacylError("La orden debe tener foto antes", BadRequestException);
17179
+ }
17180
+ }
17181
+ __name(verifyPhotosNotFinalizedSomacyl, "verifyPhotosNotFinalizedSomacyl");
17182
+
17183
+ // src/Operativa/Somacyl/getCaptureDate.ts
17184
+ function getCaptureDateSomacyl(file, BadRequestException) {
17185
+ const match = (file.Observacion ?? "").match(/\[CAPTURE_DATE=(.*?)\]/);
17186
+ if (match) {
17187
+ const fecha = new Date(match[1]);
17188
+ if (!isNaN(fecha.getTime())) return fecha;
17189
+ }
17190
+ const fechaArchivo = file.Fecha_Archivo ? new Date(file.Fecha_Archivo) : void 0;
17191
+ if (fechaArchivo && !isNaN(fechaArchivo.getTime())) return fechaArchivo;
17192
+ return throwSomacylError("No es posible obtener la fecha de captura", BadRequestException);
17193
+ }
17194
+ __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17195
+
17049
17196
  // src/constants/collections.ts
17050
17197
  var collections = Object.freeze({
17051
17198
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17315,6 +17462,8 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17315
17462
  ObtenerPrecioContratistaVigente,
17316
17463
  ObtenerZonaAsignada,
17317
17464
  SEGMENT_TY,
17465
+ SOMACYL_CODIGO_CONTADOR_RETIRADO,
17466
+ SOMACYL_PHOTO_POSITIONS,
17318
17467
  UpdateNodosDocDP,
17319
17468
  ValidarRelacionMOHijasAL04,
17320
17469
  ValorizacionHelper,
@@ -17380,6 +17529,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17380
17529
  formatPercentageV1,
17381
17530
  generateUniqueNumber,
17382
17531
  generateUniqueNumberArray,
17532
+ getCaptureDateSomacyl,
17383
17533
  getChannelName,
17384
17534
  getContainerName,
17385
17535
  getDBName,
@@ -17417,6 +17567,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17417
17567
  searchCurrentContractorSpecialtyPrice,
17418
17568
  setColModels,
17419
17569
  setContext,
17570
+ throwSomacylError,
17420
17571
  updatePriceContractorMOAL02,
17421
17572
  updatePriceContractorMOAL04,
17422
17573
  updatePriceMOAL02,
@@ -17427,5 +17578,9 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17427
17578
  validateNoLookup,
17428
17579
  validateUUIDv4Param,
17429
17580
  verifyFiles,
17430
- verifyInventoryFinalize
17581
+ verifyInventoryFinalize,
17582
+ verifyInventoryFinalizeSomacyl,
17583
+ verifyInventoryLimitsSomacyl,
17584
+ verifyPhotosFinalizeSomacyl,
17585
+ verifyPhotosNotFinalizedSomacyl
17431
17586
  });
package/dist/index.mjs CHANGED
@@ -3621,7 +3621,7 @@ function obtenerTipoYCodigoMO(codigoOriginal) {
3621
3621
  if (!TipoMO) {
3622
3622
  throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
3623
3623
  }
3624
- CodigoMO = CodigoMO.split("_")[1];
3624
+ CodigoMO = CodigoMO.replace(/^[FT]\d+_/, "");
3625
3625
  }
3626
3626
  return {
3627
3627
  TipoMO,
@@ -16872,6 +16872,145 @@ 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/verifyPhotos.ts
16976
+ var hasFile = /* @__PURE__ */ __name((file) => !!file && file.Posicion !== "", "hasFile");
16977
+ var hasInvalidCoordinates = /* @__PURE__ */ __name((file) => !file.Coordenadas || file.Coordenadas.X === "0" || file.Coordenadas.Y === "0", "hasInvalidCoordinates");
16978
+ function verifyPhotosFinalizeSomacyl(entregables, BadRequestException) {
16979
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
16980
+ if (!hasFile(entregables[key])) {
16981
+ throwSomacylError(`La orden no tiene ${label}`, BadRequestException);
16982
+ }
16983
+ }
16984
+ if (!entregables.latitud || !entregables.longitud) {
16985
+ throwSomacylError("La orden no tiene coordenadas GPS v\xE1lidas (latitud o longitud en 0)", BadRequestException);
16986
+ }
16987
+ for (const { key, label } of SOMACYL_PHOTO_POSITIONS) {
16988
+ if (hasInvalidCoordinates(entregables[key])) {
16989
+ throwSomacylError(`La ${label} tiene coordenadas inv\xE1lidas (latitud o longitud en 0)`, BadRequestException);
16990
+ }
16991
+ }
16992
+ }
16993
+ __name(verifyPhotosFinalizeSomacyl, "verifyPhotosFinalizeSomacyl");
16994
+ function verifyPhotosNotFinalizedSomacyl(entregables, BadRequestException) {
16995
+ if (!hasFile(entregables.foto_antes)) {
16996
+ throwSomacylError("La orden debe tener foto antes", BadRequestException);
16997
+ }
16998
+ }
16999
+ __name(verifyPhotosNotFinalizedSomacyl, "verifyPhotosNotFinalizedSomacyl");
17000
+
17001
+ // src/Operativa/Somacyl/getCaptureDate.ts
17002
+ function getCaptureDateSomacyl(file, BadRequestException) {
17003
+ const match = (file.Observacion ?? "").match(/\[CAPTURE_DATE=(.*?)\]/);
17004
+ if (match) {
17005
+ const fecha = new Date(match[1]);
17006
+ if (!isNaN(fecha.getTime())) return fecha;
17007
+ }
17008
+ const fechaArchivo = file.Fecha_Archivo ? new Date(file.Fecha_Archivo) : void 0;
17009
+ if (fechaArchivo && !isNaN(fechaArchivo.getTime())) return fechaArchivo;
17010
+ return throwSomacylError("No es posible obtener la fecha de captura", BadRequestException);
17011
+ }
17012
+ __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17013
+
16875
17014
  // src/constants/collections.ts
16876
17015
  var collections = Object.freeze({
16877
17016
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17140,6 +17279,8 @@ export {
17140
17279
  ObtenerPrecioContratistaVigente,
17141
17280
  ObtenerZonaAsignada,
17142
17281
  SEGMENT_TY,
17282
+ SOMACYL_CODIGO_CONTADOR_RETIRADO,
17283
+ SOMACYL_PHOTO_POSITIONS,
17143
17284
  UpdateNodosDocDP,
17144
17285
  ValidarRelacionMOHijasAL04,
17145
17286
  ValorizacionHelper,
@@ -17205,6 +17346,7 @@ export {
17205
17346
  formatPercentageV1,
17206
17347
  generateUniqueNumber,
17207
17348
  generateUniqueNumberArray,
17349
+ getCaptureDateSomacyl,
17208
17350
  getChannelName,
17209
17351
  getContainerName,
17210
17352
  getDBName,
@@ -17242,6 +17384,7 @@ export {
17242
17384
  searchCurrentContractorSpecialtyPrice,
17243
17385
  setColModels,
17244
17386
  setContext,
17387
+ throwSomacylError,
17245
17388
  updatePriceContractorMOAL02,
17246
17389
  updatePriceContractorMOAL04,
17247
17390
  updatePriceMOAL02,
@@ -17252,5 +17395,9 @@ export {
17252
17395
  validateNoLookup,
17253
17396
  validateUUIDv4Param,
17254
17397
  verifyFiles,
17255
- verifyInventoryFinalize
17398
+ verifyInventoryFinalize,
17399
+ verifyInventoryFinalizeSomacyl,
17400
+ verifyInventoryLimitsSomacyl,
17401
+ verifyPhotosFinalizeSomacyl,
17402
+ verifyPhotosNotFinalizedSomacyl
17256
17403
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.170",
3
+ "version": "1.2.172",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",