sigo-package 1.2.181 → 1.2.183

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
@@ -940,6 +940,115 @@ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregables
940
940
  */
941
941
  declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
942
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
+
997
+ /**
998
+ * Firma del despacho de almacén desde el móvil (sigo-pwa), pedida por la web (DespachoAlmacenDetalle).
999
+ * Comunicación directa web ↔ PWA por wsSIGO, sin backend:
1000
+ * - web → PWA: canal firmaDespachoCanalSolicitud(Identificacion del personal) → SOLICITAR / CANCELAR
1001
+ * - PWA → web: canal firmaDespachoCanalRespuesta(requestId) → ACEPTADA / RECHAZADA / FIRMADA
1002
+ */
1003
+ declare const FIRMA_DESPACHO_ACCIONES: {
1004
+ readonly SOLICITAR: "SOLICITAR";
1005
+ readonly CANCELAR: "CANCELAR";
1006
+ readonly ACEPTADA: "ACEPTADA";
1007
+ readonly RECHAZADA: "RECHAZADA";
1008
+ readonly FIRMADA: "FIRMADA";
1009
+ };
1010
+ /** Tiempos de espera de la web (ms): para que la PWA acepte y, una vez aceptada, para que firme */
1011
+ declare const FIRMA_DESPACHO_TIEMPOS: {
1012
+ readonly ACEPTAR: number;
1013
+ readonly FIRMAR: number;
1014
+ };
1015
+ declare const firmaDespachoCanalSolicitud: (identificacion: string) => string;
1016
+ declare const firmaDespachoCanalRespuesta: (requestId: string) => string;
1017
+ interface FirmaDespachoResumenDetalle {
1018
+ Codigo: string;
1019
+ Descripcion: string;
1020
+ UnidadMedida: string;
1021
+ Cantidad: number;
1022
+ }
1023
+ /** Lo que la web envía para que el personal vea qué firma */
1024
+ interface FirmaDespachoResumen {
1025
+ ID_DespachoAlmacen: number;
1026
+ NroDocumento: string;
1027
+ Almacen: string;
1028
+ Delegacion: string;
1029
+ Fecha: string;
1030
+ SolicitadoPor: string;
1031
+ Detalle: FirmaDespachoResumenDetalle[];
1032
+ }
1033
+ type FirmaDespachoSolicitud = {
1034
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.SOLICITAR;
1035
+ requestId: string;
1036
+ resumen: FirmaDespachoResumen;
1037
+ };
1038
+ type FirmaDespachoMensajeSolicitud = FirmaDespachoSolicitud | {
1039
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.CANCELAR;
1040
+ requestId: string;
1041
+ };
1042
+ /** imagen: data URL PNG (data:image/png;base64,...) */
1043
+ type FirmaDespachoMensajeRespuesta = {
1044
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.ACEPTADA | typeof FIRMA_DESPACHO_ACCIONES.RECHAZADA;
1045
+ requestId: string;
1046
+ } | {
1047
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.FIRMADA;
1048
+ requestId: string;
1049
+ imagen: string;
1050
+ };
1051
+
943
1052
  declare enum Position {
944
1053
  left = "left",
945
1054
  right = "right"
@@ -1124,4 +1233,4 @@ declare function getCookieToken(req: Request<any>, webOrigins: string[]): string
1124
1233
 
1125
1234
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
1126
1235
 
1127
- 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, 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, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
1236
+ 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, FIRMA_DESPACHO_ACCIONES, FIRMA_DESPACHO_TIEMPOS, type FirmaDespachoMensajeRespuesta, type FirmaDespachoMensajeSolicitud, type FirmaDespachoResumen, type FirmaDespachoResumenDetalle, type FirmaDespachoSolicitud, 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, firmaDespachoCanalRespuesta, firmaDespachoCanalSolicitud, 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
@@ -940,6 +940,115 @@ declare function verifyPhotosNotFinalizedSomacyl(entregables: SomacylEntregables
940
940
  */
941
941
  declare function getCaptureDateSomacyl(file: Pick<FilesDocDTO, 'Observacion' | 'Fecha_Archivo'>, BadRequestException?: ClassConstructor<Error>): Date;
942
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
+
997
+ /**
998
+ * Firma del despacho de almacén desde el móvil (sigo-pwa), pedida por la web (DespachoAlmacenDetalle).
999
+ * Comunicación directa web ↔ PWA por wsSIGO, sin backend:
1000
+ * - web → PWA: canal firmaDespachoCanalSolicitud(Identificacion del personal) → SOLICITAR / CANCELAR
1001
+ * - PWA → web: canal firmaDespachoCanalRespuesta(requestId) → ACEPTADA / RECHAZADA / FIRMADA
1002
+ */
1003
+ declare const FIRMA_DESPACHO_ACCIONES: {
1004
+ readonly SOLICITAR: "SOLICITAR";
1005
+ readonly CANCELAR: "CANCELAR";
1006
+ readonly ACEPTADA: "ACEPTADA";
1007
+ readonly RECHAZADA: "RECHAZADA";
1008
+ readonly FIRMADA: "FIRMADA";
1009
+ };
1010
+ /** Tiempos de espera de la web (ms): para que la PWA acepte y, una vez aceptada, para que firme */
1011
+ declare const FIRMA_DESPACHO_TIEMPOS: {
1012
+ readonly ACEPTAR: number;
1013
+ readonly FIRMAR: number;
1014
+ };
1015
+ declare const firmaDespachoCanalSolicitud: (identificacion: string) => string;
1016
+ declare const firmaDespachoCanalRespuesta: (requestId: string) => string;
1017
+ interface FirmaDespachoResumenDetalle {
1018
+ Codigo: string;
1019
+ Descripcion: string;
1020
+ UnidadMedida: string;
1021
+ Cantidad: number;
1022
+ }
1023
+ /** Lo que la web envía para que el personal vea qué firma */
1024
+ interface FirmaDespachoResumen {
1025
+ ID_DespachoAlmacen: number;
1026
+ NroDocumento: string;
1027
+ Almacen: string;
1028
+ Delegacion: string;
1029
+ Fecha: string;
1030
+ SolicitadoPor: string;
1031
+ Detalle: FirmaDespachoResumenDetalle[];
1032
+ }
1033
+ type FirmaDespachoSolicitud = {
1034
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.SOLICITAR;
1035
+ requestId: string;
1036
+ resumen: FirmaDespachoResumen;
1037
+ };
1038
+ type FirmaDespachoMensajeSolicitud = FirmaDespachoSolicitud | {
1039
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.CANCELAR;
1040
+ requestId: string;
1041
+ };
1042
+ /** imagen: data URL PNG (data:image/png;base64,...) */
1043
+ type FirmaDespachoMensajeRespuesta = {
1044
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.ACEPTADA | typeof FIRMA_DESPACHO_ACCIONES.RECHAZADA;
1045
+ requestId: string;
1046
+ } | {
1047
+ Accion: typeof FIRMA_DESPACHO_ACCIONES.FIRMADA;
1048
+ requestId: string;
1049
+ imagen: string;
1050
+ };
1051
+
943
1052
  declare enum Position {
944
1053
  left = "left",
945
1054
  right = "right"
@@ -1124,4 +1233,4 @@ declare function getCookieToken(req: Request<any>, webOrigins: string[]): string
1124
1233
 
1125
1234
  declare function validateUUIDv4Param(BadRequestException: ClassConstructor<Error>, req: Request<any>, _res: Response, next: NextFunction): Promise<void>;
1126
1235
 
1127
- 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, 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, throwSomacylError, timeZoneCHILE9512, tituloFotoParteDiarioCHILE9512, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, updatePricePBBudgetAlemaniaAL02, updatePricePBBudgetAlemaniaAL04, uuidRegex, validarAsfaltoAL04, validateNoLookup, validateUUIDv4Param, verifyDetailsFinalizeSomacyl, verifyFiles, verifyInventoryFinalize, verifyInventoryFinalizeSomacyl, verifyInventoryLimitsSomacyl, verifyPhotosFinalizeSomacyl, verifyPhotosNotFinalizedSomacyl };
1236
+ 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, FIRMA_DESPACHO_ACCIONES, FIRMA_DESPACHO_TIEMPOS, type FirmaDespachoMensajeRespuesta, type FirmaDespachoMensajeSolicitud, type FirmaDespachoResumen, type FirmaDespachoResumenDetalle, type FirmaDespachoSolicitud, 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, firmaDespachoCanalRespuesta, firmaDespachoCanalSolicitud, 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,8 +43,12 @@ __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,
50
+ FIRMA_DESPACHO_ACCIONES: () => FIRMA_DESPACHO_ACCIONES,
51
+ FIRMA_DESPACHO_TIEMPOS: () => FIRMA_DESPACHO_TIEMPOS,
48
52
  FormatearErrorValidacionMOHijas: () => FormatearErrorValidacionMOHijas,
49
53
  GemeindeChangeNomenclatura: () => GemeindeChangeNomenclatura,
50
54
  GetCodigoFechaActual: () => GetCodigoFechaActual,
@@ -72,6 +76,7 @@ __export(index_exports, {
72
76
  buildReservaMOJobMajorProjectsAlemaniaAL02: () => buildReservaMOJobMajorProjectsAlemaniaAL02,
73
77
  buildReservaMOJobMajorProjectsAlemaniaAL04: () => buildReservaMOJobMajorProjectsAlemaniaAL04,
74
78
  buildTenantCollectionName: () => buildTenantCollectionName,
79
+ calcularSaldoStockPersonal: () => calcularSaldoStockPersonal,
75
80
  calcularTotalMaterialValorizacionPeru9112: () => calcularTotalMaterialValorizacionPeru9112,
76
81
  cantidadFijaMOAL04: () => cantidadFijaMOAL04,
77
82
  cantidadMaterialAL04: () => cantidadMaterialAL04,
@@ -143,6 +148,8 @@ __export(index_exports, {
143
148
  esParteDiarioEditableCHILE9512: () => esParteDiarioEditableCHILE9512,
144
149
  estadoRechazadaPorMetraje: () => estadoRechazadaPorMetraje,
145
150
  estadoRechazadaPorMetrajeAL04: () => estadoRechazadaPorMetrajeAL04,
151
+ firmaDespachoCanalRespuesta: () => firmaDespachoCanalRespuesta,
152
+ firmaDespachoCanalSolicitud: () => firmaDespachoCanalSolicitud,
146
153
  formatCurrencyV1: () => formatCurrencyV1,
147
154
  formatNumberSmart: () => formatNumberSmart,
148
155
  formatNumberV1: () => formatNumberV1,
@@ -200,6 +207,7 @@ __export(index_exports, {
200
207
  setColModels: () => setColModels,
201
208
  setContext: () => setContext,
202
209
  subMaterialesAL04: () => subMaterialesAL04,
210
+ throwDevolucionTRError: () => throwDevolucionTRError,
203
211
  throwSomacylError: () => throwSomacylError,
204
212
  timeZoneCHILE9512: () => timeZoneCHILE9512,
205
213
  tituloFotoParteDiarioCHILE9512: () => tituloFotoParteDiarioCHILE9512,
@@ -211,6 +219,7 @@ __export(index_exports, {
211
219
  updatePricePBBudgetAlemaniaAL04: () => updatePricePBBudgetAlemaniaAL04,
212
220
  uuidRegex: () => uuidRegex,
213
221
  validarAsfaltoAL04: () => validarAsfaltoAL04,
222
+ validarLineasDevolucionTR: () => validarLineasDevolucionTR,
214
223
  validateNoLookup: () => validateNoLookup,
215
224
  validateUUIDv4Param: () => validateUUIDv4Param,
216
225
  verifyDetailsFinalizeSomacyl: () => verifyDetailsFinalizeSomacyl,
@@ -218,6 +227,7 @@ __export(index_exports, {
218
227
  verifyInventoryFinalize: () => verifyInventoryFinalize,
219
228
  verifyInventoryFinalizeSomacyl: () => verifyInventoryFinalizeSomacyl,
220
229
  verifyInventoryLimitsSomacyl: () => verifyInventoryLimitsSomacyl,
230
+ verifyLineasDevolucionTR: () => verifyLineasDevolucionTR,
221
231
  verifyPhotosFinalizeSomacyl: () => verifyPhotosFinalizeSomacyl,
222
232
  verifyPhotosNotFinalizedSomacyl: () => verifyPhotosNotFinalizedSomacyl
223
233
  });
@@ -17494,6 +17504,121 @@ function getCaptureDateSomacyl(file, BadRequestException) {
17494
17504
  }
17495
17505
  __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17496
17506
 
17507
+ // src/Logistica/StockPersonal/calcularSaldoStockPersonal.ts
17508
+ function calcularSaldoStockPersonal(stock) {
17509
+ const saldo = (stock.Despacho || 0) - (stock.Devolucion || 0) - (stock.Liquidacion || 0) + (stock.DespachoTR || 0) - (stock.DevolucionTR || 0);
17510
+ return Math.round(saldo * 100) / 100;
17511
+ }
17512
+ __name(calcularSaldoStockPersonal, "calcularSaldoStockPersonal");
17513
+
17514
+ // src/Logistica/DevolucionTR/constants.ts
17515
+ var DEVOLUCION_TR_ESTADOS = {
17516
+ SOLICITADO: {
17517
+ ID_Estado: 1,
17518
+ Nombre: "SOLICITADO"
17519
+ },
17520
+ APROBADO: {
17521
+ ID_Estado: 3,
17522
+ Nombre: "APROBADO"
17523
+ },
17524
+ ANULADO: {
17525
+ ID_Estado: 10,
17526
+ Nombre: "ANULADO"
17527
+ }
17528
+ };
17529
+ var DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO = "CAMBIO_TURNO";
17530
+ function throwDevolucionTRError(msg, Exception) {
17531
+ if (Exception) {
17532
+ throw new Exception(msg, true);
17533
+ }
17534
+ throw new Error(msg, {
17535
+ cause: "USER_MESSAGE"
17536
+ });
17537
+ }
17538
+ __name(throwDevolucionTRError, "throwDevolucionTRError");
17539
+
17540
+ // src/Logistica/DevolucionTR/validarLineasDevolucionTR.ts
17541
+ function validarLineasDevolucionTR(lines, stock) {
17542
+ const errores = [];
17543
+ const vistos = /* @__PURE__ */ new Set();
17544
+ lines.forEach((line, index) => {
17545
+ const key = `${line.searchCode}|${line.keyCode}`;
17546
+ const item = stock.find((s) => s.CodigoBusqueda === line.searchCode && s.CodigoLlave === line.keyCode);
17547
+ const series = line.series ?? [];
17548
+ if (!item) {
17549
+ errores.push({
17550
+ index,
17551
+ message: `El material ${line.keyCode} no est\xE1 en tu stock`
17552
+ });
17553
+ return;
17554
+ }
17555
+ if (vistos.has(key)) {
17556
+ errores.push({
17557
+ index,
17558
+ message: `El material ${item.Nombre} est\xE1 repetido`
17559
+ });
17560
+ return;
17561
+ }
17562
+ vistos.add(key);
17563
+ if (line.quantity > item.SaldoSistema) {
17564
+ errores.push({
17565
+ index,
17566
+ message: `${item.Nombre}: la cantidad (${line.quantity}) supera el saldo (${item.SaldoSistema})`
17567
+ });
17568
+ }
17569
+ if (item.Series.length) {
17570
+ const invalidas = series.filter((s) => !item.Series.includes(s));
17571
+ if (invalidas.length) {
17572
+ errores.push({
17573
+ index,
17574
+ message: `${item.Nombre}: las series ${invalidas.join(", ")} no est\xE1n en tu stock`
17575
+ });
17576
+ }
17577
+ if (new Set(series).size !== series.length) {
17578
+ errores.push({
17579
+ index,
17580
+ message: `${item.Nombre}: hay series repetidas`
17581
+ });
17582
+ }
17583
+ if (series.length !== line.quantity) {
17584
+ errores.push({
17585
+ index,
17586
+ message: `${item.Nombre}: la cantidad (${line.quantity}) debe ser igual al n\xFAmero de series (${series.length})`
17587
+ });
17588
+ }
17589
+ } else if (series.length) {
17590
+ errores.push({
17591
+ index,
17592
+ message: `${item.Nombre}: el material no tiene series`
17593
+ });
17594
+ }
17595
+ });
17596
+ return errores;
17597
+ }
17598
+ __name(validarLineasDevolucionTR, "validarLineasDevolucionTR");
17599
+ function verifyLineasDevolucionTR(lines, stock, BadRequestException) {
17600
+ const errores = validarLineasDevolucionTR(lines, stock);
17601
+ if (errores.length) {
17602
+ throwDevolucionTRError(errores.map((e) => e.message).join(". "), BadRequestException);
17603
+ }
17604
+ }
17605
+ __name(verifyLineasDevolucionTR, "verifyLineasDevolucionTR");
17606
+
17607
+ // src/Logistica/FirmaDespacho/constants.ts
17608
+ var FIRMA_DESPACHO_ACCIONES = {
17609
+ SOLICITAR: "SOLICITAR",
17610
+ CANCELAR: "CANCELAR",
17611
+ ACEPTADA: "ACEPTADA",
17612
+ RECHAZADA: "RECHAZADA",
17613
+ FIRMADA: "FIRMADA"
17614
+ };
17615
+ var FIRMA_DESPACHO_TIEMPOS = {
17616
+ ACEPTAR: 60 * 1e3,
17617
+ FIRMAR: 5 * 60 * 1e3
17618
+ };
17619
+ var firmaDespachoCanalSolicitud = /* @__PURE__ */ __name((identificacion) => `FIRMA_LOGISTICA_${identificacion}`, "firmaDespachoCanalSolicitud");
17620
+ var firmaDespachoCanalRespuesta = /* @__PURE__ */ __name((requestId) => `FIRMA_LOGISTICA_RESP_${requestId}`, "firmaDespachoCanalRespuesta");
17621
+
17497
17622
  // src/constants/collections.ts
17498
17623
  var collections = Object.freeze({
17499
17624
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17767,8 +17892,12 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17767
17892
  CodsMapeoMO_Material_Arquertas,
17768
17893
  CompararFechas,
17769
17894
  CurrencyFormat,
17895
+ DEVOLUCION_TR_ESTADOS,
17896
+ DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO,
17770
17897
  DocumentacionReplanteo,
17771
17898
  EstadoEspecialidad9612,
17899
+ FIRMA_DESPACHO_ACCIONES,
17900
+ FIRMA_DESPACHO_TIEMPOS,
17772
17901
  FormatearErrorValidacionMOHijas,
17773
17902
  GemeindeChangeNomenclatura,
17774
17903
  GetCodigoFechaActual,
@@ -17796,6 +17925,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17796
17925
  buildReservaMOJobMajorProjectsAlemaniaAL02,
17797
17926
  buildReservaMOJobMajorProjectsAlemaniaAL04,
17798
17927
  buildTenantCollectionName,
17928
+ calcularSaldoStockPersonal,
17799
17929
  calcularTotalMaterialValorizacionPeru9112,
17800
17930
  cantidadFijaMOAL04,
17801
17931
  cantidadMaterialAL04,
@@ -17867,6 +17997,8 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17867
17997
  esParteDiarioEditableCHILE9512,
17868
17998
  estadoRechazadaPorMetraje,
17869
17999
  estadoRechazadaPorMetrajeAL04,
18000
+ firmaDespachoCanalRespuesta,
18001
+ firmaDespachoCanalSolicitud,
17870
18002
  formatCurrencyV1,
17871
18003
  formatNumberSmart,
17872
18004
  formatNumberV1,
@@ -17924,6 +18056,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17924
18056
  setColModels,
17925
18057
  setContext,
17926
18058
  subMaterialesAL04,
18059
+ throwDevolucionTRError,
17927
18060
  throwSomacylError,
17928
18061
  timeZoneCHILE9512,
17929
18062
  tituloFotoParteDiarioCHILE9512,
@@ -17935,6 +18068,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17935
18068
  updatePricePBBudgetAlemaniaAL04,
17936
18069
  uuidRegex,
17937
18070
  validarAsfaltoAL04,
18071
+ validarLineasDevolucionTR,
17938
18072
  validateNoLookup,
17939
18073
  validateUUIDv4Param,
17940
18074
  verifyDetailsFinalizeSomacyl,
@@ -17942,6 +18076,7 @@ __name(validateUUIDv4Param, "validateUUIDv4Param");
17942
18076
  verifyInventoryFinalize,
17943
18077
  verifyInventoryFinalizeSomacyl,
17944
18078
  verifyInventoryLimitsSomacyl,
18079
+ verifyLineasDevolucionTR,
17945
18080
  verifyPhotosFinalizeSomacyl,
17946
18081
  verifyPhotosNotFinalizedSomacyl
17947
18082
  });
package/dist/index.mjs CHANGED
@@ -17272,6 +17272,121 @@ function getCaptureDateSomacyl(file, BadRequestException) {
17272
17272
  }
17273
17273
  __name(getCaptureDateSomacyl, "getCaptureDateSomacyl");
17274
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
+
17375
+ // src/Logistica/FirmaDespacho/constants.ts
17376
+ var FIRMA_DESPACHO_ACCIONES = {
17377
+ SOLICITAR: "SOLICITAR",
17378
+ CANCELAR: "CANCELAR",
17379
+ ACEPTADA: "ACEPTADA",
17380
+ RECHAZADA: "RECHAZADA",
17381
+ FIRMADA: "FIRMADA"
17382
+ };
17383
+ var FIRMA_DESPACHO_TIEMPOS = {
17384
+ ACEPTAR: 60 * 1e3,
17385
+ FIRMAR: 5 * 60 * 1e3
17386
+ };
17387
+ var firmaDespachoCanalSolicitud = /* @__PURE__ */ __name((identificacion) => `FIRMA_LOGISTICA_${identificacion}`, "firmaDespachoCanalSolicitud");
17388
+ var firmaDespachoCanalRespuesta = /* @__PURE__ */ __name((requestId) => `FIRMA_LOGISTICA_RESP_${requestId}`, "firmaDespachoCanalRespuesta");
17389
+
17275
17390
  // src/constants/collections.ts
17276
17391
  var collections = Object.freeze({
17277
17392
  PERU_9112_ToaOrder: "PERU_9112_ToaOrder",
@@ -17544,8 +17659,12 @@ export {
17544
17659
  CodsMapeoMO_Material_Arquertas,
17545
17660
  CompararFechas,
17546
17661
  CurrencyFormat,
17662
+ DEVOLUCION_TR_ESTADOS,
17663
+ DEVOLUCION_TR_MOTIVO_CAMBIO_TURNO,
17547
17664
  DocumentacionReplanteo,
17548
17665
  EstadoEspecialidad9612,
17666
+ FIRMA_DESPACHO_ACCIONES,
17667
+ FIRMA_DESPACHO_TIEMPOS,
17549
17668
  FormatearErrorValidacionMOHijas,
17550
17669
  GemeindeChangeNomenclatura,
17551
17670
  GetCodigoFechaActual,
@@ -17573,6 +17692,7 @@ export {
17573
17692
  buildReservaMOJobMajorProjectsAlemaniaAL02,
17574
17693
  buildReservaMOJobMajorProjectsAlemaniaAL04,
17575
17694
  buildTenantCollectionName,
17695
+ calcularSaldoStockPersonal,
17576
17696
  calcularTotalMaterialValorizacionPeru9112,
17577
17697
  cantidadFijaMOAL04,
17578
17698
  cantidadMaterialAL04,
@@ -17644,6 +17764,8 @@ export {
17644
17764
  esParteDiarioEditableCHILE9512,
17645
17765
  estadoRechazadaPorMetraje,
17646
17766
  estadoRechazadaPorMetrajeAL04,
17767
+ firmaDespachoCanalRespuesta,
17768
+ firmaDespachoCanalSolicitud,
17647
17769
  formatCurrencyV1,
17648
17770
  formatNumberSmart,
17649
17771
  formatNumberV1,
@@ -17701,6 +17823,7 @@ export {
17701
17823
  setColModels,
17702
17824
  setContext,
17703
17825
  subMaterialesAL04,
17826
+ throwDevolucionTRError,
17704
17827
  throwSomacylError,
17705
17828
  timeZoneCHILE9512,
17706
17829
  tituloFotoParteDiarioCHILE9512,
@@ -17712,6 +17835,7 @@ export {
17712
17835
  updatePricePBBudgetAlemaniaAL04,
17713
17836
  uuidRegex,
17714
17837
  validarAsfaltoAL04,
17838
+ validarLineasDevolucionTR,
17715
17839
  validateNoLookup,
17716
17840
  validateUUIDv4Param,
17717
17841
  verifyDetailsFinalizeSomacyl,
@@ -17719,6 +17843,7 @@ export {
17719
17843
  verifyInventoryFinalize,
17720
17844
  verifyInventoryFinalizeSomacyl,
17721
17845
  verifyInventoryLimitsSomacyl,
17846
+ verifyLineasDevolucionTR,
17722
17847
  verifyPhotosFinalizeSomacyl,
17723
17848
  verifyPhotosNotFinalizedSomacyl
17724
17849
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.181",
3
+ "version": "1.2.183",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -27,4 +27,4 @@
27
27
  "overrides": {
28
28
  "esbuild": "^0.28.0"
29
29
  }
30
- }
30
+ }