sigo-package 1.2.180 → 1.2.182

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
@@ -884,7 +884,8 @@ declare function calcularTotalMaterialValorizacionPeru9112(valorizaciones: Pick<
884
884
 
885
885
  declare const mapeoZonasSimilares: Record<string, string[]>;
886
886
 
887
- declare const documentRequirementAltasNVT: DocumentRequirementDto[];
887
+ declare const documentRequirementAltasNVTUnifamiliar: DocumentRequirementDto[];
888
+ declare const documentRequirementAltasNVTMultifamiliar: DocumentRequirementDto[];
888
889
 
889
890
  declare function verifyInventoryFinalize(docs: AltasNVTOrderENTITY[], UnprocessableEntityException?: ClassConstructor<Error>): void;
890
891
 
@@ -939,6 +940,60 @@ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregables
939
940
  */
940
941
  declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
941
942
 
943
+ type SaldoStockPersonal = Pick<StockPersonalENTITY, 'Despacho' | 'Devolucion' | 'Liquidacion' | 'DespachoTR' | 'DevolucionTR'>;
944
+ /** Saldo de un StockPersonal: Despacho - Devolucion - Liquidacion + DespachoTR - DevolucionTR (redondeado a 2 decimales) */
945
+ declare function calcularSaldoStockPersonal(stock: SaldoStockPersonal): number;
946
+
947
+ /** Estados de la devolución TR (Logística) */
948
+ declare const DEVOLUCION_TR_ESTADOS: {
949
+ readonly SOLICITADO: {
950
+ readonly ID_Estado: 1;
951
+ readonly Nombre: "SOLICITADO";
952
+ };
953
+ readonly APROBADO: {
954
+ readonly ID_Estado: 3;
955
+ readonly Nombre: "APROBADO";
956
+ };
957
+ readonly ANULADO: {
958
+ readonly ID_Estado: 10;
959
+ readonly Nombre: "ANULADO";
960
+ };
961
+ };
962
+ /** Motivo de la devolución TR por cambio de turno entre cuadrillas pareja */
963
+ declare const DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO = "CAMBIO_TURNO";
964
+ declare function throwDevolucionTRError(msg: string, Exception?: ClassConstructor<Error>): never;
965
+
966
+ /** Stock del técnico que entrega, tal como se valida cada línea */
967
+ interface StockEntregableDevolucionTR {
968
+ CodigoBusqueda: string;
969
+ CodigoLlave: string;
970
+ Nombre: string;
971
+ SaldoSistema: number;
972
+ /** Series disponibles del técnico que entrega (vacío si el material no tiene series) */
973
+ Series: string[];
974
+ }
975
+ /** Línea enviada por la app (misma forma que ShiftTransferLineDto de sigo-entities) */
976
+ interface LineaDevolucionTR {
977
+ keyCode: string;
978
+ searchCode: string;
979
+ quantity: number;
980
+ series?: string[];
981
+ }
982
+ interface ErrorLineaDevolucionTR {
983
+ index: number;
984
+ message: string;
985
+ }
986
+ /**
987
+ * Valida las líneas de una devolución TR contra el stock del que entrega.
988
+ * - Cada línea debe existir en el stock (CodigoBusqueda + CodigoLlave) y no repetirse.
989
+ * - Cantidad ≤ SaldoSistema.
990
+ * - Materiales con series: las series deben ser del que entrega, sin repetir, y su número = cantidad.
991
+ * - Materiales sin series: no se envían series.
992
+ */
993
+ declare function validarLineasDevolucionTR(lines: LineaDevolucionTR[], stock: StockEntregableDevolucionTR[]): ErrorLineaDevolucionTR[];
994
+ /** Igual que validarLineasDevolucionTR pero lanza el error (backend) */
995
+ declare function verifyLineasDevolucionTR(lines: LineaDevolucionTR[], stock: StockEntregableDevolucionTR[], BadRequestException?: ClassConstructor<Error>): void;
996
+
942
997
  declare enum Position {
943
998
  left = "left",
944
999
  right = "right"
@@ -1123,4 +1178,4 @@ declare function getCookieToken(req: Request<any>, webOrigins: string[]): string
1123
1178
 
1124
1179
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
1125
1180
 
1126
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, type CantidadMaterialAL04, type CierresPreliquidarAL02, type CierresPreliquidarAL04, 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 MaterialRequeridoAL04, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, type ModoMaterialesAL04, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SomacylPhotoKey, type TARGET, type TipoPreliquidacionAL02, type TipoPreliquidacionAL04, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, cantidadFijaMOAL04, cantidadMaterialAL04, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL02, codBalizaAL04, codBalizaPreliquidarAL04, codBaremoUnicoDPAL04, codClientes, codIssueByPeriodoAL02, codMOAsfaltoHijasAL04, codMOAsfaltoMadreAL04, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOExcluidos, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMONoPreliquidablesAL04, codMOOcultosAL04, codMOPreliquidarTroncalAL02, codMOPreliquidarTroncalAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codMaterialesOcultosAL04, codNoCliente, codSopladoRD, codigoParteDiarioHoyCHILE9512, codigosBaremosSubcontrataAL02, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, codigosSopladoHP, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esAsignacionPreliquidableAL02, esAsignacionPreliquidableAL04, esCadenaFechaISOValida, esMaterialDuctoAL04, esObjetoFecha, esParteDiarioAprobadoCHILE9512, esParteDiarioEditableCHILE9512, estadoRechazadaPorMetraje, estadoRechazadaPorMetrajeAL04, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getCookieToken, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, getRequestOrigin, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, materialesAutomaticosAL04, materialesSeleccionablesAL04, modoMaterialesAL04, motivoConsumoAlmacenAL04, motivoConsumoMaterialAutomaticoDuctos, newCodMOTroncalReglaLiquidacion1, obtenerCodMOHomePass, obtenerCodMOHomePassAL04, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerEspecialidadesCerradas, obtenerEspecialidadesCerradasAL04, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, prorratearMaterialesAL04, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, subMaterialesAL04, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
1181
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, type CantidadMaterialAL04, type CierresPreliquidarAL02, type CierresPreliquidarAL04, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DEVOLUCION_TR_ESTADOS, DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO, DocumentacionReplanteo, type ErrorLineaDevolucionTR, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, type LineaDevolucionTR, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MaterialRequeridoAL04, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, type ModoMaterialesAL04, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SaldoStockPersonal, type SomacylPhotoKey, type StockEntregableDevolucionTR, type TARGET, type TipoPreliquidacionAL02, type TipoPreliquidacionAL04, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularSaldoStockPersonal, calcularTotalMaterialValorizacionPeru9112, cantidadFijaMOAL04, cantidadMaterialAL04, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL02, codBalizaAL04, codBalizaPreliquidarAL04, codBaremoUnicoDPAL04, codClientes, codIssueByPeriodoAL02, codMOAsfaltoHijasAL04, codMOAsfaltoMadreAL04, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOExcluidos, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMONoPreliquidablesAL04, codMOOcultosAL04, codMOPreliquidarTroncalAL02, codMOPreliquidarTroncalAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codMaterialesOcultosAL04, codNoCliente, codSopladoRD, codigoParteDiarioHoyCHILE9512, codigosBaremosSubcontrataAL02, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, codigosSopladoHP, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVTMultifamiliar, documentRequirementAltasNVTUnifamiliar, empresas, esAsignacionPreliquidableAL02, esAsignacionPreliquidableAL04, esCadenaFechaISOValida, esMaterialDuctoAL04, esObjetoFecha, esParteDiarioAprobadoCHILE9512, esParteDiarioEditableCHILE9512, estadoRechazadaPorMetraje, estadoRechazadaPorMetrajeAL04, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getCookieToken, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, getRequestOrigin, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, materialesAutomaticosAL04, materialesSeleccionablesAL04, modoMaterialesAL04, motivoConsumoAlmacenAL04, motivoConsumoMaterialAutomaticoDuctos, newCodMOTroncalReglaLiquidacion1, obtenerCodMOHomePass, obtenerCodMOHomePassAL04, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerEspecialidadesCerradas, obtenerEspecialidadesCerradasAL04, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, prorratearMaterialesAL04, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, subMaterialesAL04, throwDevolucionTRError, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validarLineasDevolucionTR, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyLineasDevolucionTR, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
package/dist/index.d.ts CHANGED
@@ -884,7 +884,8 @@ declare function calcularTotalMaterialValorizacionPeru9112(valorizaciones: Pick<
884
884
 
885
885
  declare const mapeoZonasSimilares: Record<string, string[]>;
886
886
 
887
- declare const documentRequirementAltasNVT: DocumentRequirementDto[];
887
+ declare const documentRequirementAltasNVTUnifamiliar: DocumentRequirementDto[];
888
+ declare const documentRequirementAltasNVTMultifamiliar: DocumentRequirementDto[];
888
889
 
889
890
  declare function verifyInventoryFinalize(docs: AltasNVTOrderENTITY[], UnprocessableEntityException?: ClassConstructor<Error>): void;
890
891
 
@@ -939,6 +940,60 @@ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregables
939
940
  */
940
941
  declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
941
942
 
943
+ type SaldoStockPersonal = Pick<StockPersonalENTITY, 'Despacho' | 'Devolucion' | 'Liquidacion' | 'DespachoTR' | 'DevolucionTR'>;
944
+ /** Saldo de un StockPersonal: Despacho - Devolucion - Liquidacion + DespachoTR - DevolucionTR (redondeado a 2 decimales) */
945
+ declare function calcularSaldoStockPersonal(stock: SaldoStockPersonal): number;
946
+
947
+ /** Estados de la devolución TR (Logística) */
948
+ declare const DEVOLUCION_TR_ESTADOS: {
949
+ readonly SOLICITADO: {
950
+ readonly ID_Estado: 1;
951
+ readonly Nombre: "SOLICITADO";
952
+ };
953
+ readonly APROBADO: {
954
+ readonly ID_Estado: 3;
955
+ readonly Nombre: "APROBADO";
956
+ };
957
+ readonly ANULADO: {
958
+ readonly ID_Estado: 10;
959
+ readonly Nombre: "ANULADO";
960
+ };
961
+ };
962
+ /** Motivo de la devolución TR por cambio de turno entre cuadrillas pareja */
963
+ declare const DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO = "CAMBIO_TURNO";
964
+ declare function throwDevolucionTRError(msg: string, Exception?: ClassConstructor<Error>): never;
965
+
966
+ /** Stock del técnico que entrega, tal como se valida cada línea */
967
+ interface StockEntregableDevolucionTR {
968
+ CodigoBusqueda: string;
969
+ CodigoLlave: string;
970
+ Nombre: string;
971
+ SaldoSistema: number;
972
+ /** Series disponibles del técnico que entrega (vacío si el material no tiene series) */
973
+ Series: string[];
974
+ }
975
+ /** Línea enviada por la app (misma forma que ShiftTransferLineDto de sigo-entities) */
976
+ interface LineaDevolucionTR {
977
+ keyCode: string;
978
+ searchCode: string;
979
+ quantity: number;
980
+ series?: string[];
981
+ }
982
+ interface ErrorLineaDevolucionTR {
983
+ index: number;
984
+ message: string;
985
+ }
986
+ /**
987
+ * Valida las líneas de una devolución TR contra el stock del que entrega.
988
+ * - Cada línea debe existir en el stock (CodigoBusqueda + CodigoLlave) y no repetirse.
989
+ * - Cantidad ≤ SaldoSistema.
990
+ * - Materiales con series: las series deben ser del que entrega, sin repetir, y su número = cantidad.
991
+ * - Materiales sin series: no se envían series.
992
+ */
993
+ declare function validarLineasDevolucionTR(lines: LineaDevolucionTR[], stock: StockEntregableDevolucionTR[]): ErrorLineaDevolucionTR[];
994
+ /** Igual que validarLineasDevolucionTR pero lanza el error (backend) */
995
+ declare function verifyLineasDevolucionTR(lines: LineaDevolucionTR[], stock: StockEntregableDevolucionTR[], BadRequestException?: ClassConstructor<Error>): void;
996
+
942
997
  declare enum Position {
943
998
  left = "left",
944
999
  right = "right"
@@ -1123,4 +1178,4 @@ declare function getCookieToken(req: Request<any>, webOrigins: string[]): string
1123
1178
 
1124
1179
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
1125
1180
 
1126
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, type CantidadMaterialAL04, type CierresPreliquidarAL02, type CierresPreliquidarAL04, 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 MaterialRequeridoAL04, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, type ModoMaterialesAL04, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SomacylPhotoKey, type TARGET, type TipoPreliquidacionAL02, type TipoPreliquidacionAL04, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularTotalMaterialValorizacionPeru9112, cantidadFijaMOAL04, cantidadMaterialAL04, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL02, codBalizaAL04, codBalizaPreliquidarAL04, codBaremoUnicoDPAL04, codClientes, codIssueByPeriodoAL02, codMOAsfaltoHijasAL04, codMOAsfaltoMadreAL04, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOExcluidos, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMONoPreliquidablesAL04, codMOOcultosAL04, codMOPreliquidarTroncalAL02, codMOPreliquidarTroncalAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codMaterialesOcultosAL04, codNoCliente, codSopladoRD, codigoParteDiarioHoyCHILE9512, codigosBaremosSubcontrataAL02, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, codigosSopladoHP, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVT, empresas, esAsignacionPreliquidableAL02, esAsignacionPreliquidableAL04, esCadenaFechaISOValida, esMaterialDuctoAL04, esObjetoFecha, esParteDiarioAprobadoCHILE9512, esParteDiarioEditableCHILE9512, estadoRechazadaPorMetraje, estadoRechazadaPorMetrajeAL04, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getCookieToken, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, getRequestOrigin, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, materialesAutomaticosAL04, materialesSeleccionablesAL04, modoMaterialesAL04, motivoConsumoAlmacenAL04, motivoConsumoMaterialAutomaticoDuctos, newCodMOTroncalReglaLiquidacion1, obtenerCodMOHomePass, obtenerCodMOHomePassAL04, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerEspecialidadesCerradas, obtenerEspecialidadesCerradasAL04, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, prorratearMaterialesAL04, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, subMaterialesAL04, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
1181
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenLiquidacionesColombia, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, AsignacionHelper, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenLiquidacionesColombia, CalcularResumenValorizacionesAlemania, type CantidadMaterialAL04, type CierresPreliquidarAL02, type CierresPreliquidarAL04, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DEVOLUCION_TR_ESTADOS, DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO, DocumentacionReplanteo, type ErrorLineaDevolucionTR, EstadoEspecialidad9612, FormatearErrorValidacionMOHijas, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDPContrato, type IDocumentacion, type ILineaValidacion, type IMOAndMaterialsRules, type IMORules, type IMateriales, type IResultadoValidacionMOHijas, type LineaDevolucionTR, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$2 as MatStockPersonalType, type MatUtilizadosType$2 as MatUtilizadosType, type MaterialRequeridoAL04, type MoUoType$2 as MoUoType, ModelDataFlujosDocumentacionReplanteo, type ModoMaterialesAL04, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, type ResumenLiquidacionesTypeColombia, SEGMENT_TY, SOMACYL_CODIGO_CONTADOR_RETIRADO, SOMACYL_PHOTO_POSITIONS, type SaldoStockPersonal, type SomacylPhotoKey, type StockEntregableDevolucionTR, type TARGET, type TipoPreliquidacionAL02, type TipoPreliquidacionAL04, UpdateNodosDocDP, ValidarRelacionMOHijasAL04, ValorizacionHelper, builSystemOption, buildDataMOFromMaterialRules, buildDataMaterialsRule, buildKeyMO, buildMenu, buildReservaMOJobMajorProjectsAlemaniaAL02, buildReservaMOJobMajorProjectsAlemaniaAL04, buildTenantCollectionName, calcularSaldoStockPersonal, calcularTotalMaterialValorizacionPeru9112, cantidadFijaMOAL04, cantidadMaterialAL04, checkAndBuildMaterialsFromStock, checkMaterialAvailability, codBalizaAL02, codBalizaAL04, codBalizaPreliquidarAL04, codBaremoUnicoDPAL04, codClientes, codIssueByPeriodoAL02, codMOAsfaltoHijasAL04, codMOAsfaltoMadreAL04, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOExcluidos, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMONoPreliquidablesAL04, codMOOcultosAL04, codMOPreliquidarTroncalAL02, codMOPreliquidarTroncalAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04Issue, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncalHistoricoAL02, codMOTroncal_ReglaLiquidacion1, codMaterialesOcultosAL04, codNoCliente, codSopladoRD, codigoParteDiarioHoyCHILE9512, codigosBaremosSubcontrataAL02, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, codigosSopladoHP, collections, consumirStockPersonal, convertDates, dataFlujosHomePass, db_default, db_root, documentRequirementAltasNVTMultifamiliar, documentRequirementAltasNVTUnifamiliar, empresas, esAsignacionPreliquidableAL02, esAsignacionPreliquidableAL04, esCadenaFechaISOValida, esMaterialDuctoAL04, esObjetoFecha, esParteDiarioAprobadoCHILE9512, esParteDiarioEditableCHILE9512, estadoRechazadaPorMetraje, estadoRechazadaPorMetrajeAL04, formatCurrencyV1, formatNumberSmart, formatNumberV1, formatPercentageV1, generateUniqueNumber, generateUniqueNumberArray, getCaptureDateSomacyl, getChannelName, getContainerName, getCookieToken, getDBName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Amap, getNextID_AsignacionValorizacion, getNextID_Valorizacion, getPrecioContratista, getPriceMaterial, getQueueName, getQueueNameSaveOneNotification, getRequestOrigin, hashCode, isValidDate, isValidPartialEntity, logTiempoProceso, mapaDPContratoPrecioFullAL02, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, mapeoZonasSimilares, materialesAutomaticosAL04, materialesSeleccionablesAL04, modoMaterialesAL04, motivoConsumoAlmacenAL04, motivoConsumoMaterialAutomaticoDuctos, newCodMOTroncalReglaLiquidacion1, obtenerCodMOHomePass, obtenerCodMOHomePassAL04, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerEspecialidadesCerradas, obtenerEspecialidadesCerradasAL04, obtenerPrecioContratistaMaterial, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, parseDuplicateKeyError, prorratearMaterialesAL04, roundNumber, searchCurrentContractorSpecialtyPrice, setColModels, setContext, subMaterialesAL04, throwDevolucionTRError, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validarLineasDevolucionTR, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyLineasDevolucionTR, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
package/dist/index.js CHANGED
@@ -43,6 +43,8 @@ __export(index_exports, {
43
43
  CodsMapeoMO_Material_Arquertas: () => CodsMapeoMO_Material_Arquertas,
44
44
  CompararFechas: () => CompararFechas,
45
45
  CurrencyFormat: () => CurrencyFormat,
46
+ DEVOLUCION_TR_ESTADOS: () => DEVOLUCION_TR_ESTADOS,
47
+ DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO: () => DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO,
46
48
  DocumentacionReplanteo: () => DocumentacionReplanteo,
47
49
  EstadoEspecialidad9612: () => EstadoEspecialidad9612,
48
50
  FormatearErrorValidacionMOHijas: () => FormatearErrorValidacionMOHijas,
@@ -72,6 +74,7 @@ __export(index_exports, {
72
74
  buildReservaMOJobMajorProjectsAlemaniaAL02: () => buildReservaMOJobMajorProjectsAlemaniaAL02,
73
75
  buildReservaMOJobMajorProjectsAlemaniaAL04: () => buildReservaMOJobMajorProjectsAlemaniaAL04,
74
76
  buildTenantCollectionName: () => buildTenantCollectionName,
77
+ calcularSaldoStockPersonal: () => calcularSaldoStockPersonal,
75
78
  calcularTotalMaterialValorizacionPeru9112: () => calcularTotalMaterialValorizacionPeru9112,
76
79
  cantidadFijaMOAL04: () => cantidadFijaMOAL04,
77
80
  cantidadMaterialAL04: () => cantidadMaterialAL04,
@@ -131,7 +134,8 @@ __export(index_exports, {
131
134
  dataFlujosHomePass: () => dataFlujosHomePass,
132
135
  db_default: () => db_default,
133
136
  db_root: () => db_root,
134
- documentRequirementAltasNVT: () => documentRequirementAltasNVT,
137
+ documentRequirementAltasNVTMultifamiliar: () => documentRequirementAltasNVTMultifamiliar,
138
+ documentRequirementAltasNVTUnifamiliar: () => documentRequirementAltasNVTUnifamiliar,
135
139
  empresas: () => empresas,
136
140
  esAsignacionPreliquidableAL02: () => esAsignacionPreliquidableAL02,
137
141
  esAsignacionPreliquidableAL04: () => esAsignacionPreliquidableAL04,
@@ -199,6 +203,7 @@ __export(index_exports, {
199
203
  setColModels: () => setColModels,
200
204
  setContext: () => setContext,
201
205
  subMaterialesAL04: () => subMaterialesAL04,
206
+ throwDevolucionTRError: () => throwDevolucionTRError,
202
207
  throwSomacylError: () => throwSomacylError,
203
208
  timeZoneCHILE9512: () => timeZoneCHILE9512,
204
209
  tituloFotoParteDiarioCHILE9512: () => tituloFotoParteDiarioCHILE9512,
@@ -210,6 +215,7 @@ __export(index_exports, {
210
215
  updatePricePBBudgetAlemaniaAL04: () => updatePricePBBudgetAlemaniaAL04,
211
216
  uuidRegex: () => uuidRegex,
212
217
  validarAsfaltoAL04: () => validarAsfaltoAL04,
218
+ validarLineasDevolucionTR: () => validarLineasDevolucionTR,
213
219
  validateNoLookup: () => validateNoLookup,
214
220
  validateUUIDv4Param: () => validateUUIDv4Param,
215
221
  verifyDetailsFinalizeSomacyl: () => verifyDetailsFinalizeSomacyl,
@@ -217,6 +223,7 @@ __export(index_exports, {
217
223
  verifyInventoryFinalize: () => verifyInventoryFinalize,
218
224
  verifyInventoryFinalizeSomacyl: () => verifyInventoryFinalizeSomacyl,
219
225
  verifyInventoryLimitsSomacyl: () => verifyInventoryLimitsSomacyl,
226
+ verifyLineasDevolucionTR: () => verifyLineasDevolucionTR,
220
227
  verifyPhotosFinalizeSomacyl: () => verifyPhotosFinalizeSomacyl,
221
228
  verifyPhotosNotFinalizedSomacyl: () => verifyPhotosNotFinalizedSomacyl
222
229
  });
@@ -17160,7 +17167,7 @@ var acceptedFileExtensions = [
17160
17167
  import_sigo_entities6.FileExtension.Jpeg,
17161
17168
  import_sigo_entities6.FileExtension.Png
17162
17169
  ];
17163
- var documentRequirementAltasNVT = [
17170
+ var documentRequirementAltasNVTComun = [
17164
17171
  {
17165
17172
  id: "roseta",
17166
17173
  label: "Roseta",
@@ -17177,7 +17184,7 @@ var documentRequirementAltasNVT = [
17177
17184
  acceptedFileExtensions,
17178
17185
  children: [],
17179
17186
  minFiles: 1,
17180
- maxFiles: 1,
17187
+ maxFiles: 5,
17181
17188
  requiresMetadata: true,
17182
17189
  maxFileSize: 2
17183
17190
  },
@@ -17187,7 +17194,7 @@ var documentRequirementAltasNVT = [
17187
17194
  acceptedFileExtensions,
17188
17195
  children: [],
17189
17196
  minFiles: 1,
17190
- maxFiles: 1,
17197
+ maxFiles: 5,
17191
17198
  requiresMetadata: true,
17192
17199
  maxFileSize: 2
17193
17200
  }
@@ -17208,7 +17215,7 @@ var documentRequirementAltasNVT = [
17208
17215
  acceptedFileExtensions,
17209
17216
  children: [],
17210
17217
  minFiles: 1,
17211
- maxFiles: 1,
17218
+ maxFiles: 5,
17212
17219
  requiresMetadata: true,
17213
17220
  maxFileSize: 2
17214
17221
  },
@@ -17218,7 +17225,7 @@ var documentRequirementAltasNVT = [
17218
17225
  acceptedFileExtensions,
17219
17226
  children: [],
17220
17227
  minFiles: 1,
17221
- maxFiles: 1,
17228
+ maxFiles: 5,
17222
17229
  requiresMetadata: true,
17223
17230
  maxFileSize: 2
17224
17231
  }
@@ -17245,7 +17252,7 @@ var documentRequirementAltasNVT = [
17245
17252
  acceptedFileExtensions,
17246
17253
  children: [],
17247
17254
  minFiles: 1,
17248
- maxFiles: 1,
17255
+ maxFiles: 5,
17249
17256
  requiresMetadata: true,
17250
17257
  maxFileSize: 2
17251
17258
  },
@@ -17255,7 +17262,7 @@ var documentRequirementAltasNVT = [
17255
17262
  acceptedFileExtensions,
17256
17263
  children: [],
17257
17264
  minFiles: 1,
17258
- maxFiles: 1,
17265
+ maxFiles: 5,
17259
17266
  requiresMetadata: true,
17260
17267
  maxFileSize: 2
17261
17268
  }
@@ -17271,7 +17278,7 @@ var documentRequirementAltasNVT = [
17271
17278
  acceptedFileExtensions,
17272
17279
  children: [],
17273
17280
  minFiles: 1,
17274
- maxFiles: 1,
17281
+ maxFiles: 5,
17275
17282
  requiresMetadata: true,
17276
17283
  maxFileSize: 2
17277
17284
  },
@@ -17281,17 +17288,23 @@ var documentRequirementAltasNVT = [
17281
17288
  acceptedFileExtensions,
17282
17289
  children: [],
17283
17290
  minFiles: 1,
17284
- maxFiles: 1,
17291
+ maxFiles: 5,
17285
17292
  requiresMetadata: true,
17286
17293
  maxFileSize: 2
17287
- },
17294
+ }
17295
+ ];
17296
+ var documentRequirementAltasNVTUnifamiliar = [
17297
+ ...documentRequirementAltasNVTComun
17298
+ ];
17299
+ var documentRequirementAltasNVTMultifamiliar = [
17300
+ ...documentRequirementAltasNVTComun,
17288
17301
  {
17289
17302
  id: "recorridoCanalizacion",
17290
17303
  label: "Recorrido de la canalizaci\xF3n",
17291
17304
  acceptedFileExtensions,
17292
17305
  children: [],
17293
17306
  minFiles: 1,
17294
- maxFiles: 1,
17307
+ maxFiles: 5,
17295
17308
  requiresMetadata: true,
17296
17309
  maxFileSize: 2
17297
17310
  }
@@ -17487,6 +17500,106 @@ function getCaptureDateSomacyl(file, BadRequestException) {
17487
17500
  }
17488
17501
  __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17489
17502
 
17503
+ // src/Logistica/StockPersonal/calcularSaldoStockPersonal.ts
17504
+ function calcularSaldoStockPersonal(stock) {
17505
+ const saldo = (stock.Despacho || 0) - (stock.Devolucion || 0) - (stock.Liquidacion || 0) + (stock.DespachoTR || 0) - (stock.DevolucionTR || 0);
17506
+ return Math.round(saldo * 100) / 100;
17507
+ }
17508
+ __name(calcularSaldoStockPersonal, "calcularSaldoStockPersonal");
17509
+
17510
+ // src/Logistica/DevolucionTR/constants.ts
17511
+ var DEVOLUCION_TR_ESTADOS = {
17512
+ SOLICITADO: {
17513
+ ID_Estado: 1,
17514
+ Nombre: "SOLICITADO"
17515
+ },
17516
+ APROBADO: {
17517
+ ID_Estado: 3,
17518
+ Nombre: "APROBADO"
17519
+ },
17520
+ ANULADO: {
17521
+ ID_Estado: 10,
17522
+ Nombre: "ANULADO"
17523
+ }
17524
+ };
17525
+ var DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO = "CAMBIO_TURNO";
17526
+ function throwDevolucionTRError(msg, Exception) {
17527
+ if (Exception) {
17528
+ throw new Exception(msg, true);
17529
+ }
17530
+ throw new Error(msg, {
17531
+ cause: "USER_MESSAGE"
17532
+ });
17533
+ }
17534
+ __name(throwDevolucionTRError, "throwDevolucionTRError");
17535
+
17536
+ // src/Logistica/DevolucionTR/validarLineasDevolucionTR.ts
17537
+ function validarLineasDevolucionTR(lines, stock) {
17538
+ const errores = [];
17539
+ const vistos = /* @__PURE__ */ new Set();
17540
+ lines.forEach((line, index) => {
17541
+ const key = `${line.searchCode}|${line.keyCode}`;
17542
+ const item = stock.find((s) => s.CodigoBusqueda === line.searchCode && s.CodigoLlave === line.keyCode);
17543
+ const series = line.series ?? [];
17544
+ if (!item) {
17545
+ errores.push({
17546
+ index,
17547
+ message: `El material ${line.keyCode} no est\xE1 en tu stock`
17548
+ });
17549
+ return;
17550
+ }
17551
+ if (vistos.has(key)) {
17552
+ errores.push({
17553
+ index,
17554
+ message: `El material ${item.Nombre} est\xE1 repetido`
17555
+ });
17556
+ return;
17557
+ }
17558
+ vistos.add(key);
17559
+ if (line.quantity > item.SaldoSistema) {
17560
+ errores.push({
17561
+ index,
17562
+ message: `${item.Nombre}: la cantidad (${line.quantity}) supera el saldo (${item.SaldoSistema})`
17563
+ });
17564
+ }
17565
+ if (item.Series.length) {
17566
+ const invalidas = series.filter((s) => !item.Series.includes(s));
17567
+ if (invalidas.length) {
17568
+ errores.push({
17569
+ index,
17570
+ message: `${item.Nombre}: las series ${invalidas.join(", ")} no est\xE1n en tu stock`
17571
+ });
17572
+ }
17573
+ if (new Set(series).size !== series.length) {
17574
+ errores.push({
17575
+ index,
17576
+ message: `${item.Nombre}: hay series repetidas`
17577
+ });
17578
+ }
17579
+ if (series.length !== line.quantity) {
17580
+ errores.push({
17581
+ index,
17582
+ message: `${item.Nombre}: la cantidad (${line.quantity}) debe ser igual al n\xFAmero de series (${series.length})`
17583
+ });
17584
+ }
17585
+ } else if (series.length) {
17586
+ errores.push({
17587
+ index,
17588
+ message: `${item.Nombre}: el material no tiene series`
17589
+ });
17590
+ }
17591
+ });
17592
+ return errores;
17593
+ }
17594
+ __name(validarLineasDevolucionTR, "validarLineasDevolucionTR");
17595
+ function verifyLineasDevolucionTR(lines, stock, BadRequestException) {
17596
+ const errores = validarLineasDevolucionTR(lines, stock);
17597
+ if (errores.length) {
17598
+ throwDevolucionTRError(errores.map((e) => e.message).join(". "), BadRequestException);
17599
+ }
17600
+ }
17601
+ __name(verifyLineasDevolucionTR, "verifyLineasDevolucionTR");
17602
+
17490
17603
  // src/constants/collections.ts
17491
17604
  var collections = Object.freeze({
17492
17605
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17760,6 +17873,8 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17760
17873
  CodsMapeoMO_Material_Arquertas,
17761
17874
  CompararFechas,
17762
17875
  CurrencyFormat,
17876
+ DEVOLUCION_TR_ESTADOS,
17877
+ DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO,
17763
17878
  DocumentacionReplanteo,
17764
17879
  EstadoEspecialidad9612,
17765
17880
  FormatearErrorValidacionMOHijas,
@@ -17789,6 +17904,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17789
17904
  buildReservaMOJobMajorProjectsAlemaniaAL02,
17790
17905
  buildReservaMOJobMajorProjectsAlemaniaAL04,
17791
17906
  buildTenantCollectionName,
17907
+ calcularSaldoStockPersonal,
17792
17908
  calcularTotalMaterialValorizacionPeru9112,
17793
17909
  cantidadFijaMOAL04,
17794
17910
  cantidadMaterialAL04,
@@ -17848,7 +17964,8 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17848
17964
  dataFlujosHomePass,
17849
17965
  db_default,
17850
17966
  db_root,
17851
- documentRequirementAltasNVT,
17967
+ documentRequirementAltasNVTMultifamiliar,
17968
+ documentRequirementAltasNVTUnifamiliar,
17852
17969
  empresas,
17853
17970
  esAsignacionPreliquidableAL02,
17854
17971
  esAsignacionPreliquidableAL04,
@@ -17916,6 +18033,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17916
18033
  setColModels,
17917
18034
  setContext,
17918
18035
  subMaterialesAL04,
18036
+ throwDevolucionTRError,
17919
18037
  throwSomacylError,
17920
18038
  timeZoneCHILE9512,
17921
18039
  tituloFotoParteDiarioCHILE9512,
@@ -17927,6 +18045,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17927
18045
  updatePricePBBudgetAlemaniaAL04,
17928
18046
  uuidRegex,
17929
18047
  validarAsfaltoAL04,
18048
+ validarLineasDevolucionTR,
17930
18049
  validateNoLookup,
17931
18050
  validateUUIDv4Param,
17932
18051
  verifyDetailsFinalizeSomacyl,
@@ -17934,6 +18053,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17934
18053
  verifyInventoryFinalize,
17935
18054
  verifyInventoryFinalizeSomacyl,
17936
18055
  verifyInventoryLimitsSomacyl,
18056
+ verifyLineasDevolucionTR,
17937
18057
  verifyPhotosFinalizeSomacyl,
17938
18058
  verifyPhotosNotFinalizedSomacyl
17939
18059
  });
package/dist/index.mjs CHANGED
@@ -16939,7 +16939,7 @@ var acceptedFileExtensions = [
16939
16939
  FileExtension.Jpeg,
16940
16940
  FileExtension.Png
16941
16941
  ];
16942
- var documentRequirementAltasNVT = [
16942
+ var documentRequirementAltasNVTComun = [
16943
16943
  {
16944
16944
  id: "roseta",
16945
16945
  label: "Roseta",
@@ -16956,7 +16956,7 @@ var documentRequirementAltasNVT = [
16956
16956
  acceptedFileExtensions,
16957
16957
  children: [],
16958
16958
  minFiles: 1,
16959
- maxFiles: 1,
16959
+ maxFiles: 5,
16960
16960
  requiresMetadata: true,
16961
16961
  maxFileSize: 2
16962
16962
  },
@@ -16966,7 +16966,7 @@ var documentRequirementAltasNVT = [
16966
16966
  acceptedFileExtensions,
16967
16967
  children: [],
16968
16968
  minFiles: 1,
16969
- maxFiles: 1,
16969
+ maxFiles: 5,
16970
16970
  requiresMetadata: true,
16971
16971
  maxFileSize: 2
16972
16972
  }
@@ -16987,7 +16987,7 @@ var documentRequirementAltasNVT = [
16987
16987
  acceptedFileExtensions,
16988
16988
  children: [],
16989
16989
  minFiles: 1,
16990
- maxFiles: 1,
16990
+ maxFiles: 5,
16991
16991
  requiresMetadata: true,
16992
16992
  maxFileSize: 2
16993
16993
  },
@@ -16997,7 +16997,7 @@ var documentRequirementAltasNVT = [
16997
16997
  acceptedFileExtensions,
16998
16998
  children: [],
16999
16999
  minFiles: 1,
17000
- maxFiles: 1,
17000
+ maxFiles: 5,
17001
17001
  requiresMetadata: true,
17002
17002
  maxFileSize: 2
17003
17003
  }
@@ -17024,7 +17024,7 @@ var documentRequirementAltasNVT = [
17024
17024
  acceptedFileExtensions,
17025
17025
  children: [],
17026
17026
  minFiles: 1,
17027
- maxFiles: 1,
17027
+ maxFiles: 5,
17028
17028
  requiresMetadata: true,
17029
17029
  maxFileSize: 2
17030
17030
  },
@@ -17034,7 +17034,7 @@ var documentRequirementAltasNVT = [
17034
17034
  acceptedFileExtensions,
17035
17035
  children: [],
17036
17036
  minFiles: 1,
17037
- maxFiles: 1,
17037
+ maxFiles: 5,
17038
17038
  requiresMetadata: true,
17039
17039
  maxFileSize: 2
17040
17040
  }
@@ -17050,7 +17050,7 @@ var documentRequirementAltasNVT = [
17050
17050
  acceptedFileExtensions,
17051
17051
  children: [],
17052
17052
  minFiles: 1,
17053
- maxFiles: 1,
17053
+ maxFiles: 5,
17054
17054
  requiresMetadata: true,
17055
17055
  maxFileSize: 2
17056
17056
  },
@@ -17060,17 +17060,23 @@ var documentRequirementAltasNVT = [
17060
17060
  acceptedFileExtensions,
17061
17061
  children: [],
17062
17062
  minFiles: 1,
17063
- maxFiles: 1,
17063
+ maxFiles: 5,
17064
17064
  requiresMetadata: true,
17065
17065
  maxFileSize: 2
17066
- },
17066
+ }
17067
+ ];
17068
+ var documentRequirementAltasNVTUnifamiliar = [
17069
+ ...documentRequirementAltasNVTComun
17070
+ ];
17071
+ var documentRequirementAltasNVTMultifamiliar = [
17072
+ ...documentRequirementAltasNVTComun,
17067
17073
  {
17068
17074
  id: "recorridoCanalizacion",
17069
17075
  label: "Recorrido de la canalizaci\xF3n",
17070
17076
  acceptedFileExtensions,
17071
17077
  children: [],
17072
17078
  minFiles: 1,
17073
- maxFiles: 1,
17079
+ maxFiles: 5,
17074
17080
  requiresMetadata: true,
17075
17081
  maxFileSize: 2
17076
17082
  }
@@ -17266,6 +17272,106 @@ function getCaptureDateSomacyl(file, BadRequestException) {
17266
17272
  }
17267
17273
  __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17268
17274
 
17275
+ // src/Logistica/StockPersonal/calcularSaldoStockPersonal.ts
17276
+ function calcularSaldoStockPersonal(stock) {
17277
+ const saldo = (stock.Despacho || 0) - (stock.Devolucion || 0) - (stock.Liquidacion || 0) + (stock.DespachoTR || 0) - (stock.DevolucionTR || 0);
17278
+ return Math.round(saldo * 100) / 100;
17279
+ }
17280
+ __name(calcularSaldoStockPersonal, "calcularSaldoStockPersonal");
17281
+
17282
+ // src/Logistica/DevolucionTR/constants.ts
17283
+ var DEVOLUCION_TR_ESTADOS = {
17284
+ SOLICITADO: {
17285
+ ID_Estado: 1,
17286
+ Nombre: "SOLICITADO"
17287
+ },
17288
+ APROBADO: {
17289
+ ID_Estado: 3,
17290
+ Nombre: "APROBADO"
17291
+ },
17292
+ ANULADO: {
17293
+ ID_Estado: 10,
17294
+ Nombre: "ANULADO"
17295
+ }
17296
+ };
17297
+ var DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO = "CAMBIO_TURNO";
17298
+ function throwDevolucionTRError(msg, Exception) {
17299
+ if (Exception) {
17300
+ throw new Exception(msg, true);
17301
+ }
17302
+ throw new Error(msg, {
17303
+ cause: "USER_MESSAGE"
17304
+ });
17305
+ }
17306
+ __name(throwDevolucionTRError, "throwDevolucionTRError");
17307
+
17308
+ // src/Logistica/DevolucionTR/validarLineasDevolucionTR.ts
17309
+ function validarLineasDevolucionTR(lines, stock) {
17310
+ const errores = [];
17311
+ const vistos = /* @__PURE__ */ new Set();
17312
+ lines.forEach((line, index) => {
17313
+ const key = `${line.searchCode}|${line.keyCode}`;
17314
+ const item = stock.find((s) => s.CodigoBusqueda === line.searchCode && s.CodigoLlave === line.keyCode);
17315
+ const series = line.series ?? [];
17316
+ if (!item) {
17317
+ errores.push({
17318
+ index,
17319
+ message: `El material ${line.keyCode} no est\xE1 en tu stock`
17320
+ });
17321
+ return;
17322
+ }
17323
+ if (vistos.has(key)) {
17324
+ errores.push({
17325
+ index,
17326
+ message: `El material ${item.Nombre} est\xE1 repetido`
17327
+ });
17328
+ return;
17329
+ }
17330
+ vistos.add(key);
17331
+ if (line.quantity > item.SaldoSistema) {
17332
+ errores.push({
17333
+ index,
17334
+ message: `${item.Nombre}: la cantidad (${line.quantity}) supera el saldo (${item.SaldoSistema})`
17335
+ });
17336
+ }
17337
+ if (item.Series.length) {
17338
+ const invalidas = series.filter((s) => !item.Series.includes(s));
17339
+ if (invalidas.length) {
17340
+ errores.push({
17341
+ index,
17342
+ message: `${item.Nombre}: las series ${invalidas.join(", ")} no est\xE1n en tu stock`
17343
+ });
17344
+ }
17345
+ if (new Set(series).size !== series.length) {
17346
+ errores.push({
17347
+ index,
17348
+ message: `${item.Nombre}: hay series repetidas`
17349
+ });
17350
+ }
17351
+ if (series.length !== line.quantity) {
17352
+ errores.push({
17353
+ index,
17354
+ message: `${item.Nombre}: la cantidad (${line.quantity}) debe ser igual al n\xFAmero de series (${series.length})`
17355
+ });
17356
+ }
17357
+ } else if (series.length) {
17358
+ errores.push({
17359
+ index,
17360
+ message: `${item.Nombre}: el material no tiene series`
17361
+ });
17362
+ }
17363
+ });
17364
+ return errores;
17365
+ }
17366
+ __name(validarLineasDevolucionTR, "validarLineasDevolucionTR");
17367
+ function verifyLineasDevolucionTR(lines, stock, BadRequestException) {
17368
+ const errores = validarLineasDevolucionTR(lines, stock);
17369
+ if (errores.length) {
17370
+ throwDevolucionTRError(errores.map((e) => e.message).join(". "), BadRequestException);
17371
+ }
17372
+ }
17373
+ __name(verifyLineasDevolucionTR, "verifyLineasDevolucionTR");
17374
+
17269
17375
  // src/constants/collections.ts
17270
17376
  var collections = Object.freeze({
17271
17377
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17538,6 +17644,8 @@ export {
17538
17644
  CodsMapeoMO_Material_Arquertas,
17539
17645
  CompararFechas,
17540
17646
  CurrencyFormat,
17647
+ DEVOLUCION_TR_ESTADOS,
17648
+ DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO,
17541
17649
  DocumentacionReplanteo,
17542
17650
  EstadoEspecialidad9612,
17543
17651
  FormatearErrorValidacionMOHijas,
@@ -17567,6 +17675,7 @@ export {
17567
17675
  buildReservaMOJobMajorProjectsAlemaniaAL02,
17568
17676
  buildReservaMOJobMajorProjectsAlemaniaAL04,
17569
17677
  buildTenantCollectionName,
17678
+ calcularSaldoStockPersonal,
17570
17679
  calcularTotalMaterialValorizacionPeru9112,
17571
17680
  cantidadFijaMOAL04,
17572
17681
  cantidadMaterialAL04,
@@ -17626,7 +17735,8 @@ export {
17626
17735
  dataFlujosHomePass,
17627
17736
  db_default,
17628
17737
  db_root,
17629
- documentRequirementAltasNVT,
17738
+ documentRequirementAltasNVTMultifamiliar,
17739
+ documentRequirementAltasNVTUnifamiliar,
17630
17740
  empresas,
17631
17741
  esAsignacionPreliquidableAL02,
17632
17742
  esAsignacionPreliquidableAL04,
@@ -17694,6 +17804,7 @@ export {
17694
17804
  setColModels,
17695
17805
  setContext,
17696
17806
  subMaterialesAL04,
17807
+ throwDevolucionTRError,
17697
17808
  throwSomacylError,
17698
17809
  timeZoneCHILE9512,
17699
17810
  tituloFotoParteDiarioCHILE9512,
@@ -17705,6 +17816,7 @@ export {
17705
17816
  updatePricePBBudgetAlemaniaAL04,
17706
17817
  uuidRegex,
17707
17818
  validarAsfaltoAL04,
17819
+ validarLineasDevolucionTR,
17708
17820
  validateNoLookup,
17709
17821
  validateUUIDv4Param,
17710
17822
  verifyDetailsFinalizeSomacyl,
@@ -17712,6 +17824,7 @@ export {
17712
17824
  verifyInventoryFinalize,
17713
17825
  verifyInventoryFinalizeSomacyl,
17714
17826
  verifyInventoryLimitsSomacyl,
17827
+ verifyLineasDevolucionTR,
17715
17828
  verifyPhotosFinalizeSomacyl,
17716
17829
  verifyPhotosNotFinalizedSomacyl
17717
17830
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.180",
3
+ "version": "1.2.182",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",