sigo-package 1.2.2 → 1.2.4
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +64 -25
- package/dist/index.mjs +61 -25
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -265,6 +265,15 @@ declare const mapaReglaSopladoClientes: Map<string, ReglaSoplado[]>;
|
|
|
265
265
|
|
|
266
266
|
declare function updatePriceContractorMO(valorizaciones: Pick<ValorizacionDTO, 'Ultimo_Estado_Interno' | 'DetalleChile' | 'PrecioContrata' | 'TotalContrata' | 'Cantidad'>[], priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): void;
|
|
267
267
|
|
|
268
|
+
declare function updatePriceMO(valorizaciones: Pick<ValorizacionDTO, 'Ultimo_Estado_Interno' | 'DetalleChile' | 'Precio' | 'Total' | 'Cantidad'>[], priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): void;
|
|
269
|
+
|
|
270
|
+
declare function obtenerPrecioManoObra(CodigoMO: string, TipoMO: string | null, priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): number;
|
|
271
|
+
|
|
272
|
+
declare function obtenerTipoYCodigoMO(codigoOriginal: string): {
|
|
273
|
+
TipoMO: string | null;
|
|
274
|
+
CodigoMO: string;
|
|
275
|
+
};
|
|
276
|
+
|
|
268
277
|
declare const CalcularResumenLiquidaciones: Funcion$1;
|
|
269
278
|
interface Funcion$1 {
|
|
270
279
|
(trabajo: TrabajoType, trabajos: any[]): ResumenLiquidacionesTypeChile;
|
|
@@ -437,4 +446,4 @@ declare function getDateInTimeZone(timeZone: TimeZone): Date;
|
|
|
437
446
|
|
|
438
447
|
declare function generateUniqueNumber(): number;
|
|
439
448
|
|
|
440
|
-
export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, GetCodigoFechaActual, type IDocumentacion, type IMO, type IMaterial, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$1 as MatStockPersonalType, type MatUtilizadosType$1 as MatUtilizadosType, type MoUoType$1 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, SEGMENT_TY, type TARGET, UpdateNodosDocDP, codBalizaAL04, codClientes, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, paisMap, searchCurrentContractorSpecialtyPrice, updatePriceContractorMO, validateNoLookup };
|
|
449
|
+
export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, GetCodigoFechaActual, type IDocumentacion, type IMO, type IMaterial, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$1 as MatStockPersonalType, type MatUtilizadosType$1 as MatUtilizadosType, type MoUoType$1 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, SEGMENT_TY, type TARGET, UpdateNodosDocDP, codBalizaAL04, codClientes, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObra, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, updatePriceContractorMO, updatePriceMO, validateNoLookup };
|
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,15 @@ declare const mapaReglaSopladoClientes: Map<string, ReglaSoplado[]>;
|
|
|
265
265
|
|
|
266
266
|
declare function updatePriceContractorMO(valorizaciones: Pick<ValorizacionDTO, 'Ultimo_Estado_Interno' | 'DetalleChile' | 'PrecioContrata' | 'TotalContrata' | 'Cantidad'>[], priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): void;
|
|
267
267
|
|
|
268
|
+
declare function updatePriceMO(valorizaciones: Pick<ValorizacionDTO, 'Ultimo_Estado_Interno' | 'DetalleChile' | 'Precio' | 'Total' | 'Cantidad'>[], priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): void;
|
|
269
|
+
|
|
270
|
+
declare function obtenerPrecioManoObra(CodigoMO: string, TipoMO: string | null, priceContractorMO: Pick<PrecioContratistaMOAL02ENTITY, 'ManoObraGlobal' | 'Empresa'>): number;
|
|
271
|
+
|
|
272
|
+
declare function obtenerTipoYCodigoMO(codigoOriginal: string): {
|
|
273
|
+
TipoMO: string | null;
|
|
274
|
+
CodigoMO: string;
|
|
275
|
+
};
|
|
276
|
+
|
|
268
277
|
declare const CalcularResumenLiquidaciones: Funcion$1;
|
|
269
278
|
interface Funcion$1 {
|
|
270
279
|
(trabajo: TrabajoType, trabajos: any[]): ResumenLiquidacionesTypeChile;
|
|
@@ -437,4 +446,4 @@ declare function getDateInTimeZone(timeZone: TimeZone): Date;
|
|
|
437
446
|
|
|
438
447
|
declare function generateUniqueNumber(): number;
|
|
439
448
|
|
|
440
|
-
export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, GetCodigoFechaActual, type IDocumentacion, type IMO, type IMaterial, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$1 as MatStockPersonalType, type MatUtilizadosType$1 as MatUtilizadosType, type MoUoType$1 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, SEGMENT_TY, type TARGET, UpdateNodosDocDP, codBalizaAL04, codClientes, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, paisMap, searchCurrentContractorSpecialtyPrice, updatePriceContractorMO, validateNoLookup };
|
|
449
|
+
export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, GetCodigoFechaActual, type IDocumentacion, type IMO, type IMaterial, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoMOBOMAL04, MapeoMatBOMAL04, type MatRetiradosType, type MatStockAlmacenType, type MatStockPersonalType$1 as MatStockPersonalType, type MatUtilizadosType$1 as MatUtilizadosType, type MoUoType$1 as MoUoType, ModelDataFlujosDocumentacionReplanteo, ObtenerMONoReservada, ObtenerPrecioContratistaVigente, ObtenerZonaAsignada, type ResumenLiquidacionesType, type ResumenLiquidacionesTypeChile, SEGMENT_TY, type TARGET, UpdateNodosDocDP, codBalizaAL04, codClientes, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObra, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, updatePriceContractorMO, updatePriceMO, validateNoLookup };
|
package/dist/index.js
CHANGED
|
@@ -93,9 +93,12 @@ __export(index_exports, {
|
|
|
93
93
|
mapaReglaSopladoTroncal: () => mapaReglaSopladoTroncal,
|
|
94
94
|
obtenerDocumentacionClientes: () => obtenerDocumentacionClientes,
|
|
95
95
|
obtenerDocumentacionNoClientes: () => obtenerDocumentacionNoClientes,
|
|
96
|
+
obtenerPrecioManoObra: () => obtenerPrecioManoObra,
|
|
97
|
+
obtenerTipoYCodigoMO: () => obtenerTipoYCodigoMO,
|
|
96
98
|
paisMap: () => paisMap,
|
|
97
99
|
searchCurrentContractorSpecialtyPrice: () => searchCurrentContractorSpecialtyPrice,
|
|
98
100
|
updatePriceContractorMO: () => updatePriceContractorMO,
|
|
101
|
+
updatePriceMO: () => updatePriceMO,
|
|
99
102
|
validateNoLookup: () => validateNoLookup
|
|
100
103
|
});
|
|
101
104
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -5277,42 +5280,75 @@ var mapaReglaSopladoClientes = /* @__PURE__ */ new Map([
|
|
|
5277
5280
|
]
|
|
5278
5281
|
]);
|
|
5279
5282
|
|
|
5280
|
-
// src/Programados/Alemania/
|
|
5281
|
-
var
|
|
5283
|
+
// src/Programados/Alemania/obtenerTipoYCodigoMO.ts
|
|
5284
|
+
var switchTipo = {
|
|
5282
5285
|
"T": "Asphalt",
|
|
5283
5286
|
"F": "Trenching"
|
|
5284
5287
|
};
|
|
5285
|
-
function
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
if (!TipoMO) {
|
|
5294
|
-
throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
|
|
5295
|
-
}
|
|
5296
|
-
CodigoMO = CodigoMO.split("_")[1];
|
|
5288
|
+
function obtenerTipoYCodigoMO(codigoOriginal) {
|
|
5289
|
+
let CodigoMO = codigoOriginal;
|
|
5290
|
+
let TipoMO = null;
|
|
5291
|
+
if (CodigoMO.includes("_")) {
|
|
5292
|
+
const letraTipo = CodigoMO.split("_")[0].slice(0, 1);
|
|
5293
|
+
TipoMO = switchTipo[letraTipo];
|
|
5294
|
+
if (!TipoMO) {
|
|
5295
|
+
throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
|
|
5297
5296
|
}
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5297
|
+
CodigoMO = CodigoMO.split("_")[1];
|
|
5298
|
+
}
|
|
5299
|
+
return {
|
|
5300
|
+
TipoMO,
|
|
5301
|
+
CodigoMO
|
|
5302
|
+
};
|
|
5303
|
+
}
|
|
5304
|
+
__name(obtenerTipoYCodigoMO, "obtenerTipoYCodigoMO");
|
|
5305
|
+
|
|
5306
|
+
// src/Programados/Alemania/obtenerPrecioManoObra.ts
|
|
5307
|
+
function obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO) {
|
|
5308
|
+
const resultados = priceContractorMO.ManoObraGlobal.filter((e) => e.Codigo === CodigoMO && e.Estado.ID_Estado === 1);
|
|
5309
|
+
if (resultados.length !== 1) {
|
|
5310
|
+
throw new Error(`Hay ${resultados.length} resultados para precioContratista cod empresa: '${priceContractorMO.Empresa.Codigo}', cod mo: '${CodigoMO}'`);
|
|
5311
|
+
}
|
|
5312
|
+
const registro = resultados[0];
|
|
5313
|
+
if (TipoMO !== null) {
|
|
5314
|
+
const precioObj = registro.TipoMO?.find((e) => e.Tipo === TipoMO);
|
|
5315
|
+
if (!precioObj) {
|
|
5316
|
+
throw new Error(`No hay precioContratista cod empresa: '${priceContractorMO.Empresa.Codigo}', cod mo: '${CodigoMO}', TipoMO: '${TipoMO}'`);
|
|
5301
5317
|
}
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
}
|
|
5307
|
-
valorizacion.PrecioContrata = precio.Precio;
|
|
5308
|
-
} else {
|
|
5309
|
-
valorizacion.PrecioContrata = precioContratista[0].Precio;
|
|
5318
|
+
return precioObj.Precio;
|
|
5319
|
+
} else {
|
|
5320
|
+
if (registro.Precio === void 0) {
|
|
5321
|
+
throw new Error(`No se encontr\xF3 precio base para cod mo: '${CodigoMO}' sin TipoMO en empresa '${priceContractorMO.Empresa.Codigo}'`);
|
|
5310
5322
|
}
|
|
5323
|
+
return registro.Precio;
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5326
|
+
__name(obtenerPrecioManoObra, "obtenerPrecioManoObra");
|
|
5327
|
+
|
|
5328
|
+
// src/Programados/Alemania/updatePriceContractorMO.ts
|
|
5329
|
+
function updatePriceContractorMO(valorizaciones, priceContractorMO) {
|
|
5330
|
+
for (const valorizacion of valorizaciones) {
|
|
5331
|
+
if (valorizacion.Ultimo_Estado_Interno.Descripcion === "PRODUCCION") continue;
|
|
5332
|
+
const { TipoMO, CodigoMO } = obtenerTipoYCodigoMO(valorizacion.DetalleChile.ManoObra.Codigo);
|
|
5333
|
+
const precio = obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO);
|
|
5334
|
+
valorizacion.PrecioContrata = precio;
|
|
5311
5335
|
valorizacion.TotalContrata = valorizacion.PrecioContrata * valorizacion.Cantidad;
|
|
5312
5336
|
}
|
|
5313
5337
|
}
|
|
5314
5338
|
__name(updatePriceContractorMO, "updatePriceContractorMO");
|
|
5315
5339
|
|
|
5340
|
+
// src/Programados/Alemania/updatePriceMO.ts
|
|
5341
|
+
function updatePriceMO(valorizaciones, priceContractorMO) {
|
|
5342
|
+
for (const valorizacion of valorizaciones) {
|
|
5343
|
+
if (valorizacion.Ultimo_Estado_Interno.Descripcion === "PRODUCCION") continue;
|
|
5344
|
+
const { TipoMO, CodigoMO } = obtenerTipoYCodigoMO(valorizacion.DetalleChile.ManoObra.Codigo);
|
|
5345
|
+
const precio = obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO);
|
|
5346
|
+
valorizacion.Precio = precio;
|
|
5347
|
+
valorizacion.Total = valorizacion.Precio * valorizacion.Cantidad;
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
__name(updatePriceMO, "updatePriceMO");
|
|
5351
|
+
|
|
5316
5352
|
// src/Programados/BuscarZonaContratista.ts
|
|
5317
5353
|
function BuscarZonaContratista(EmpresaContratistaEnPrecioEspecialidad, Obra, ZonaAsignada) {
|
|
5318
5354
|
const zonaSearchMapping = {
|
|
@@ -5888,8 +5924,11 @@ __name(searchCurrentContractorSpecialtyPrice, "searchCurrentContractorSpecialtyP
|
|
|
5888
5924
|
mapaReglaSopladoTroncal,
|
|
5889
5925
|
obtenerDocumentacionClientes,
|
|
5890
5926
|
obtenerDocumentacionNoClientes,
|
|
5927
|
+
obtenerPrecioManoObra,
|
|
5928
|
+
obtenerTipoYCodigoMO,
|
|
5891
5929
|
paisMap,
|
|
5892
5930
|
searchCurrentContractorSpecialtyPrice,
|
|
5893
5931
|
updatePriceContractorMO,
|
|
5932
|
+
updatePriceMO,
|
|
5894
5933
|
validateNoLookup
|
|
5895
5934
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -5180,42 +5180,75 @@ var mapaReglaSopladoClientes = /* @__PURE__ */ new Map([
|
|
|
5180
5180
|
]
|
|
5181
5181
|
]);
|
|
5182
5182
|
|
|
5183
|
-
// src/Programados/Alemania/
|
|
5184
|
-
var
|
|
5183
|
+
// src/Programados/Alemania/obtenerTipoYCodigoMO.ts
|
|
5184
|
+
var switchTipo = {
|
|
5185
5185
|
"T": "Asphalt",
|
|
5186
5186
|
"F": "Trenching"
|
|
5187
5187
|
};
|
|
5188
|
-
function
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
if (!TipoMO) {
|
|
5197
|
-
throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
|
|
5198
|
-
}
|
|
5199
|
-
CodigoMO = CodigoMO.split("_")[1];
|
|
5188
|
+
function obtenerTipoYCodigoMO(codigoOriginal) {
|
|
5189
|
+
let CodigoMO = codigoOriginal;
|
|
5190
|
+
let TipoMO = null;
|
|
5191
|
+
if (CodigoMO.includes("_")) {
|
|
5192
|
+
const letraTipo = CodigoMO.split("_")[0].slice(0, 1);
|
|
5193
|
+
TipoMO = switchTipo[letraTipo];
|
|
5194
|
+
if (!TipoMO) {
|
|
5195
|
+
throw new Error(`No se pudo encontrar clave para la letra '${letraTipo}' en SwitchTipo`);
|
|
5200
5196
|
}
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5197
|
+
CodigoMO = CodigoMO.split("_")[1];
|
|
5198
|
+
}
|
|
5199
|
+
return {
|
|
5200
|
+
TipoMO,
|
|
5201
|
+
CodigoMO
|
|
5202
|
+
};
|
|
5203
|
+
}
|
|
5204
|
+
__name(obtenerTipoYCodigoMO, "obtenerTipoYCodigoMO");
|
|
5205
|
+
|
|
5206
|
+
// src/Programados/Alemania/obtenerPrecioManoObra.ts
|
|
5207
|
+
function obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO) {
|
|
5208
|
+
const resultados = priceContractorMO.ManoObraGlobal.filter((e) => e.Codigo === CodigoMO && e.Estado.ID_Estado === 1);
|
|
5209
|
+
if (resultados.length !== 1) {
|
|
5210
|
+
throw new Error(`Hay ${resultados.length} resultados para precioContratista cod empresa: '${priceContractorMO.Empresa.Codigo}', cod mo: '${CodigoMO}'`);
|
|
5211
|
+
}
|
|
5212
|
+
const registro = resultados[0];
|
|
5213
|
+
if (TipoMO !== null) {
|
|
5214
|
+
const precioObj = registro.TipoMO?.find((e) => e.Tipo === TipoMO);
|
|
5215
|
+
if (!precioObj) {
|
|
5216
|
+
throw new Error(`No hay precioContratista cod empresa: '${priceContractorMO.Empresa.Codigo}', cod mo: '${CodigoMO}', TipoMO: '${TipoMO}'`);
|
|
5204
5217
|
}
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
}
|
|
5210
|
-
valorizacion.PrecioContrata = precio.Precio;
|
|
5211
|
-
} else {
|
|
5212
|
-
valorizacion.PrecioContrata = precioContratista[0].Precio;
|
|
5218
|
+
return precioObj.Precio;
|
|
5219
|
+
} else {
|
|
5220
|
+
if (registro.Precio === void 0) {
|
|
5221
|
+
throw new Error(`No se encontr\xF3 precio base para cod mo: '${CodigoMO}' sin TipoMO en empresa '${priceContractorMO.Empresa.Codigo}'`);
|
|
5213
5222
|
}
|
|
5223
|
+
return registro.Precio;
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
__name(obtenerPrecioManoObra, "obtenerPrecioManoObra");
|
|
5227
|
+
|
|
5228
|
+
// src/Programados/Alemania/updatePriceContractorMO.ts
|
|
5229
|
+
function updatePriceContractorMO(valorizaciones, priceContractorMO) {
|
|
5230
|
+
for (const valorizacion of valorizaciones) {
|
|
5231
|
+
if (valorizacion.Ultimo_Estado_Interno.Descripcion === "PRODUCCION") continue;
|
|
5232
|
+
const { TipoMO, CodigoMO } = obtenerTipoYCodigoMO(valorizacion.DetalleChile.ManoObra.Codigo);
|
|
5233
|
+
const precio = obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO);
|
|
5234
|
+
valorizacion.PrecioContrata = precio;
|
|
5214
5235
|
valorizacion.TotalContrata = valorizacion.PrecioContrata * valorizacion.Cantidad;
|
|
5215
5236
|
}
|
|
5216
5237
|
}
|
|
5217
5238
|
__name(updatePriceContractorMO, "updatePriceContractorMO");
|
|
5218
5239
|
|
|
5240
|
+
// src/Programados/Alemania/updatePriceMO.ts
|
|
5241
|
+
function updatePriceMO(valorizaciones, priceContractorMO) {
|
|
5242
|
+
for (const valorizacion of valorizaciones) {
|
|
5243
|
+
if (valorizacion.Ultimo_Estado_Interno.Descripcion === "PRODUCCION") continue;
|
|
5244
|
+
const { TipoMO, CodigoMO } = obtenerTipoYCodigoMO(valorizacion.DetalleChile.ManoObra.Codigo);
|
|
5245
|
+
const precio = obtenerPrecioManoObra(CodigoMO, TipoMO, priceContractorMO);
|
|
5246
|
+
valorizacion.Precio = precio;
|
|
5247
|
+
valorizacion.Total = valorizacion.Precio * valorizacion.Cantidad;
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
__name(updatePriceMO, "updatePriceMO");
|
|
5251
|
+
|
|
5219
5252
|
// src/Programados/BuscarZonaContratista.ts
|
|
5220
5253
|
function BuscarZonaContratista(EmpresaContratistaEnPrecioEspecialidad, Obra, ZonaAsignada) {
|
|
5221
5254
|
const zonaSearchMapping = {
|
|
@@ -5790,8 +5823,11 @@ export {
|
|
|
5790
5823
|
mapaReglaSopladoTroncal,
|
|
5791
5824
|
obtenerDocumentacionClientes,
|
|
5792
5825
|
obtenerDocumentacionNoClientes,
|
|
5826
|
+
obtenerPrecioManoObra,
|
|
5827
|
+
obtenerTipoYCodigoMO,
|
|
5793
5828
|
paisMap,
|
|
5794
5829
|
searchCurrentContractorSpecialtyPrice,
|
|
5795
5830
|
updatePriceContractorMO,
|
|
5831
|
+
updatePriceMO,
|
|
5796
5832
|
validateNoLookup
|
|
5797
5833
|
};
|