sigo-package 1.2.28 → 1.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ManoObraENTITY, ReservaENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, ManoObraGlobalENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, ValorizacionManoObraDTO, ValorizacionDTO, PrecioContratistaMOAL02ENTITY, StockPersonalENTITY, ItemDetalleLogisticaDTO, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY } from 'sigo-entities';
1
+ import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, ManoObraGlobalENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, ValorizacionManoObraDTO, ValorizacionDTO, PrecioContratistaMOAL02ENTITY, StockPersonalENTITY, StockAlmacenENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY } from 'sigo-entities';
2
2
 
3
3
  interface IenvSIGO$1 {
4
4
  SISTEMAS_VALORIZACION_MANO_OBRA: string[];
@@ -94,6 +94,16 @@ interface IMOAndMaterialsRules {
94
94
  ManoObra: Map<string, IMOAndMaterialsRules> | IMOAndMaterialsRules[];
95
95
  }
96
96
 
97
+ interface IMateriales {
98
+ id: string;
99
+ cantidad: number;
100
+ item: ItemDetalleLogisticaDTO;
101
+ material: IMOAndMaterialsRules;
102
+ stock: 'Personal' | 'Almacen';
103
+ ID: number;
104
+ lote: string;
105
+ }
106
+
97
107
  declare const mapaMOMaterialAL04: Map<string, IMOAndMaterialsRules>;
98
108
 
99
109
  declare const codMOTroncalAL02OC: never[];
@@ -306,19 +316,15 @@ declare function obtenerTipoYCodigoMO(codigoOriginal: string): {
306
316
  CodigoMO: string;
307
317
  };
308
318
 
309
- interface IMateriales {
310
- id: string;
311
- cantidad: number;
312
- item: ItemDetalleLogisticaDTO;
313
- material: IMOAndMaterialsRules;
314
- }
315
- declare function checkAndBuildMaterialsFromPersonalStock(Materiales: IMOAndMaterialsRules[], dataStockPersonal: StockPersonalENTITY[], id: string, Controller: any): IMateriales[];
319
+ declare function checkAndBuildMaterialsFromPersonalStock(Materiales: IMOAndMaterialsRules[], dataStockPersonal: StockPersonalENTITY[], dataStockAlmacen: StockAlmacenENTITY[], id: string, Controller: any): IMateriales[];
316
320
 
317
- declare function buildDataMaterialsRule(Materiales: Map<string, IMOAndMaterialsRules>, dataStockPersonal: Pick<StockPersonalENTITY, 'ID_StockPersonal' | 'Item' | 'Lote'>[]): {
321
+ declare function buildDataMaterialsRule(Materiales: Map<string, IMOAndMaterialsRules>, dataStockPersonal: Pick<StockPersonalENTITY, 'ID_StockPersonal' | 'Item' | 'Lote'>[], dataStockAlmacen: Pick<StockAlmacenENTITY, 'ID_StockAlmacen' | 'Item' | 'Lote'>[], Controller: any): {
318
322
  id: number;
319
323
  text: string;
320
324
  }[];
321
325
 
326
+ declare function consumirStockPersonal(codDelegacion: string, codigoMaterial: string): boolean;
327
+
322
328
  declare const CalcularResumenLiquidaciones: Funcion$1;
323
329
  interface Funcion$1 {
324
330
  (trabajo: TrabajoType, trabajos: any[]): ResumenLiquidacionesTypeChile;
@@ -507,4 +513,4 @@ declare function generateUniqueNumberArray(index: number): number;
507
513
 
508
514
  declare function setContext(this: any, modules: __WebpackModuleApi.RequireContext): void;
509
515
 
510
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDocumentacion, type IMOAndMaterialsRules, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, 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, buildDataMaterialsRule, checkAndBuildMaterialsFromPersonalStock, codBalizaAL04, codClientes, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Valorizacion, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, validateNoLookup };
516
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDocumentacion, type IMOAndMaterialsRules, type IMateriales, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, 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, buildDataMaterialsRule, checkAndBuildMaterialsFromPersonalStock, codBalizaAL04, codClientes, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, consumirStockPersonal, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Valorizacion, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, validateNoLookup };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ManoObraENTITY, ReservaENTITY, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, ManoObraGlobalENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, ValorizacionManoObraDTO, ValorizacionDTO, PrecioContratistaMOAL02ENTITY, StockPersonalENTITY, ItemDetalleLogisticaDTO, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY } from 'sigo-entities';
1
+ import { ManoObraENTITY, ReservaENTITY, ItemDetalleLogisticaDTO, HomePassDTO, FlujoDocDTO, NodoDocDTO, DocumentacionPEXENTITY, ManoObraGlobalENTITY, PrecioEspecialidadENTITY, ObraChile9512ENTITY, ValorizacionManoObraDTO, ValorizacionDTO, PrecioContratistaMOAL02ENTITY, StockPersonalENTITY, StockAlmacenENTITY, TrabajoENTITY, ActividadesDTO, PreciosVigentesDTO, ContratoOTENTITY } from 'sigo-entities';
2
2
 
3
3
  interface IenvSIGO$1 {
4
4
  SISTEMAS_VALORIZACION_MANO_OBRA: string[];
@@ -94,6 +94,16 @@ interface IMOAndMaterialsRules {
94
94
  ManoObra: Map<string, IMOAndMaterialsRules> | IMOAndMaterialsRules[];
95
95
  }
96
96
 
97
+ interface IMateriales {
98
+ id: string;
99
+ cantidad: number;
100
+ item: ItemDetalleLogisticaDTO;
101
+ material: IMOAndMaterialsRules;
102
+ stock: 'Personal' | 'Almacen';
103
+ ID: number;
104
+ lote: string;
105
+ }
106
+
97
107
  declare const mapaMOMaterialAL04: Map<string, IMOAndMaterialsRules>;
98
108
 
99
109
  declare const codMOTroncalAL02OC: never[];
@@ -306,19 +316,15 @@ declare function obtenerTipoYCodigoMO(codigoOriginal: string): {
306
316
  CodigoMO: string;
307
317
  };
308
318
 
309
- interface IMateriales {
310
- id: string;
311
- cantidad: number;
312
- item: ItemDetalleLogisticaDTO;
313
- material: IMOAndMaterialsRules;
314
- }
315
- declare function checkAndBuildMaterialsFromPersonalStock(Materiales: IMOAndMaterialsRules[], dataStockPersonal: StockPersonalENTITY[], id: string, Controller: any): IMateriales[];
319
+ declare function checkAndBuildMaterialsFromPersonalStock(Materiales: IMOAndMaterialsRules[], dataStockPersonal: StockPersonalENTITY[], dataStockAlmacen: StockAlmacenENTITY[], id: string, Controller: any): IMateriales[];
316
320
 
317
- declare function buildDataMaterialsRule(Materiales: Map<string, IMOAndMaterialsRules>, dataStockPersonal: Pick<StockPersonalENTITY, 'ID_StockPersonal' | 'Item' | 'Lote'>[]): {
321
+ declare function buildDataMaterialsRule(Materiales: Map<string, IMOAndMaterialsRules>, dataStockPersonal: Pick<StockPersonalENTITY, 'ID_StockPersonal' | 'Item' | 'Lote'>[], dataStockAlmacen: Pick<StockAlmacenENTITY, 'ID_StockAlmacen' | 'Item' | 'Lote'>[], Controller: any): {
318
322
  id: number;
319
323
  text: string;
320
324
  }[];
321
325
 
326
+ declare function consumirStockPersonal(codDelegacion: string, codigoMaterial: string): boolean;
327
+
322
328
  declare const CalcularResumenLiquidaciones: Funcion$1;
323
329
  interface Funcion$1 {
324
330
  (trabajo: TrabajoType, trabajos: any[]): ResumenLiquidacionesTypeChile;
@@ -507,4 +513,4 @@ declare function generateUniqueNumberArray(index: number): number;
507
513
 
508
514
  declare function setContext(this: any, modules: __WebpackModuleApi.RequireContext): void;
509
515
 
510
- export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDocumentacion, type IMOAndMaterialsRules, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, 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, buildDataMaterialsRule, checkAndBuildMaterialsFromPersonalStock, codBalizaAL04, codClientes, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Valorizacion, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, validateNoLookup };
516
+ export { ActualizarDataManoObra, ActualizarDataReserva, ActualizarDataResumenLiquidaciones, ActualizarDataResumenValorizacionesAlemania, ActualizarDataTrabajos, BuscarZonaContratista, CalcularResumenHPMOLiquidado, CalcularResumenLiquidaciones, CalcularResumenValorizacionesAlemania, CodigosMaterialDuctosAL02, CodigosMaterialDuctosAL04, CodigosMaterialSoplado, CodsMapeoMOMaterial, CodsMapeoMOMaterialNVT01, CodsMapeoMOMaterialSopladoClientes, CodsMapeoMOMaterialSopladoTroncal, CodsMapeoMO_Material_Arquertas, CompararFechas, CurrencyFormat, DocumentacionReplanteo, EstadoEspecialidad9612, GemeindeChangeNomenclatura, GetCodigoFechaActual, type IDocumentacion, type IMOAndMaterialsRules, type IMateriales, MOCantidadNVT01, MOHijasAL04, MOHijasDEPTH, MapeoEspecialidades9612, 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, buildDataMaterialsRule, checkAndBuildMaterialsFromPersonalStock, codBalizaAL04, codClientes, codMOClientesAL02, codMOClientesAL02Asfaltado, codMOClientesAL02OC, codMOClientesAL02Soplado, codMOClientes_ReglaLiquidacion1, codMODROPAL04, codMODROPAL04OC, codMODROPAL04Soplado, codMOFTTFAL04, codMONoClientesAL02, codMONoClientesAL02Asfaltado, codMONoClientesAL02OC, codMONoClientesAL02Soplado, codMONoClientes_ReglaLiquidacion1, codMOOcultosAL04, codMOPublico, codMOTroncalAL02, codMOTroncalAL02Asfaltado, codMOTroncalAL02OC, codMOTroncalAL02Soplado, codMOTroncalAL04, codMOTroncalAL04Asfaltado, codMOTroncalAL04OC, codMOTroncalAL04Soplado, codMOTroncal_ReglaLiquidacion1, codNoCliente, codSopladoRD, codigosMOT1_F2, codigosMaterialDuctos, codigosMaterialUGG, consumirStockPersonal, convertDates, dataFlujosHomePass, esCadenaFechaISOValida, esObjetoFecha, generateUniqueNumber, generateUniqueNumberArray, getChannelName, getDateInTimeZone, getKeyRedisSortedSet, getModelDataAdicional, getNextID_Valorizacion, getQueueName, getQueueNameSaveOneNotification, isValidDate, isValidPartialEntity, logTiempoProceso, mapaEstadoObraFaseAL02, mapaMOMaterialAL02, mapaMOMaterialAL04, mapaReglaSopladoClientes, mapaReglaSopladoTroncal, obtenerDocumentacionClientes, obtenerDocumentacionNoClientes, obtenerPrecioManoObraAL02, obtenerPrecioManoObraAL04, obtenerTipoYCodigoMO, paisMap, searchCurrentContractorSpecialtyPrice, setContext, updatePriceContractorMOAL02, updatePriceContractorMOAL04, updatePriceMOAL02, updatePriceMOAL04, validateNoLookup };
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ __export(index_exports, {
92
92
  codigosMOT1_F2: () => codigosMOT1_F2,
93
93
  codigosMaterialDuctos: () => codigosMaterialDuctos,
94
94
  codigosMaterialUGG: () => codigosMaterialUGG,
95
+ consumirStockPersonal: () => consumirStockPersonal,
95
96
  convertDates: () => convertDates,
96
97
  dataFlujosHomePass: () => dataFlujosHomePass,
97
98
  esCadenaFechaISOValida: () => esCadenaFechaISOValida,
@@ -5902,31 +5903,55 @@ function updatePriceMOAL04(valorizaciones, priceContractorMO) {
5902
5903
  }
5903
5904
  __name(updatePriceMOAL04, "updatePriceMOAL04");
5904
5905
 
5906
+ // src/Programados/Alemania/determinarConsumirStockPersonal.ts
5907
+ function consumirStockPersonal(codDelegacion, codigoMaterial) {
5908
+ switch (codDelegacion) {
5909
+ case "AL02":
5910
+ return !codigosMaterialUGG.includes(codigoMaterial);
5911
+ case "AL04":
5912
+ return CodigosMaterialDuctosAL04.includes(codigoMaterial);
5913
+ default:
5914
+ return true;
5915
+ }
5916
+ }
5917
+ __name(consumirStockPersonal, "consumirStockPersonal");
5918
+
5905
5919
  // src/Programados/Alemania/checkAndBuildMaterialsFromPersonalStock.ts
5906
- function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal, id, Controller) {
5920
+ function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal, dataStockAlmacen, id, Controller) {
5907
5921
  const errores = [];
5908
5922
  for (const element of Materiales) {
5909
- const exist = dataStockPersonal.find((e) => e.Item.Codigo === element.Codigo);
5923
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, element.Codigo);
5924
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5925
+ const exist = data.find((e) => e.Item.Codigo === element.Codigo);
5910
5926
  if (!exist) {
5911
- errores.push(element.Codigo);
5927
+ errores.push({
5928
+ codigo: element.Codigo,
5929
+ stock: stockPersonal ? "personal" : "almac\xE9n"
5930
+ });
5912
5931
  }
5913
5932
  }
5914
5933
  if (errores.length) {
5915
- throw new Controller.SigoError(`No se encontr\xF3 materiales ${errores.join(", ").trim()}, en el stock personal para este trabajo`);
5934
+ const mensaje = errores.map((e) => `No se encontr\xF3 material "${e.codigo}" en el stock ${e.stock}<br>`).join("");
5935
+ throw new Controller.SigoError(mensaje);
5916
5936
  }
5917
5937
  const materiales = [];
5918
5938
  for (const material of Materiales) {
5919
5939
  const { Codigo: codMaterial } = material;
5920
- const stocksPersonal = dataStockPersonal.find((e) => e.Item.Codigo === codMaterial);
5921
- if (!stocksPersonal) {
5940
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, codMaterial);
5941
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5942
+ const stock = data.find((e) => e.Item.Codigo === codMaterial);
5943
+ if (!stock) {
5922
5944
  throw new Controller.SigoError(`No se encontr\xF3 el material ${codMaterial} en el stock personal para este trabajo.`);
5923
5945
  }
5924
5946
  const cantidad = material.CantidadPadre ? 0 : material.CantidadFija ? material.Cantidad : 0;
5925
5947
  materiales.push({
5926
- item: stocksPersonal.Item,
5948
+ item: stock.Item,
5927
5949
  id,
5928
5950
  cantidad: cantidad * material.Factor,
5929
- material
5951
+ material,
5952
+ lote: stock.Lote,
5953
+ stock: stockPersonal ? "Personal" : "Almacen",
5954
+ ID: stockPersonal ? stock.ID_StockPersonal : stock.ID_StockAlmacen
5930
5955
  });
5931
5956
  break;
5932
5957
  }
@@ -5935,13 +5960,34 @@ function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal,
5935
5960
  __name(checkAndBuildMaterialsFromPersonalStock, "checkAndBuildMaterialsFromPersonalStock");
5936
5961
 
5937
5962
  // src/Programados/Alemania/buildDataMaterialsRule.ts
5938
- function buildDataMaterialsRule(Materiales, dataStockPersonal) {
5963
+ function buildDataMaterialsRule(Materiales, dataStockPersonal, dataStockAlmacen, Controller) {
5939
5964
  const codigosMaterial = Array.from(Materiales.keys());
5940
- const dataMaterialsRule = dataStockPersonal.filter((e) => codigosMaterial.includes(e.Item.Codigo)).map((e) => ({
5941
- id: e.ID_StockPersonal,
5942
- text: `${e.Item.Codigo} - ${e.Item.Nombre} ${e.Lote ? `(Lote: ${e.Lote})` : ""}`.trim()
5965
+ const dataMaterialsRule = [];
5966
+ codigosMaterial.forEach((el) => {
5967
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, el);
5968
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5969
+ const stocks = data.filter((e) => e.Item.Codigo === el);
5970
+ stocks.forEach((e) => {
5971
+ const material = Materiales.get(el);
5972
+ if (!material) {
5973
+ throw new Error("Error al obtener material");
5974
+ }
5975
+ const cantidad = material.CantidadPadre ? 0 : material.CantidadFija ? material.Cantidad : 0;
5976
+ dataMaterialsRule.push({
5977
+ cantidad,
5978
+ id: crypto.randomUUID(),
5979
+ item: e.Item,
5980
+ lote: e.Lote,
5981
+ material,
5982
+ stock: stockPersonal ? "Personal" : "Almacen",
5983
+ ID: stockPersonal ? e.ID_StockPersonal : e.ID_StockAlmacen
5984
+ });
5985
+ });
5986
+ });
5987
+ return dataMaterialsRule.map((e) => ({
5988
+ id: e.ID,
5989
+ text: `${e.item.Codigo} - ${e.item.Nombre} ${e.lote ? `(Lote: ${e.lote})` : ""}`.trim()
5943
5990
  }));
5944
- return dataMaterialsRule;
5945
5991
  }
5946
5992
  __name(buildDataMaterialsRule, "buildDataMaterialsRule");
5947
5993
 
@@ -6651,6 +6697,7 @@ var getNextID_Valorizacion = /* @__PURE__ */ __name((valorizaciones) => {
6651
6697
  codigosMOT1_F2,
6652
6698
  codigosMaterialDuctos,
6653
6699
  codigosMaterialUGG,
6700
+ consumirStockPersonal,
6654
6701
  convertDates,
6655
6702
  dataFlujosHomePass,
6656
6703
  esCadenaFechaISOValida,
package/dist/index.mjs CHANGED
@@ -5776,31 +5776,55 @@ function updatePriceMOAL04(valorizaciones, priceContractorMO) {
5776
5776
  }
5777
5777
  __name(updatePriceMOAL04, "updatePriceMOAL04");
5778
5778
 
5779
+ // src/Programados/Alemania/determinarConsumirStockPersonal.ts
5780
+ function consumirStockPersonal(codDelegacion, codigoMaterial) {
5781
+ switch (codDelegacion) {
5782
+ case "AL02":
5783
+ return !codigosMaterialUGG.includes(codigoMaterial);
5784
+ case "AL04":
5785
+ return CodigosMaterialDuctosAL04.includes(codigoMaterial);
5786
+ default:
5787
+ return true;
5788
+ }
5789
+ }
5790
+ __name(consumirStockPersonal, "consumirStockPersonal");
5791
+
5779
5792
  // src/Programados/Alemania/checkAndBuildMaterialsFromPersonalStock.ts
5780
- function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal, id, Controller) {
5793
+ function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal, dataStockAlmacen, id, Controller) {
5781
5794
  const errores = [];
5782
5795
  for (const element of Materiales) {
5783
- const exist = dataStockPersonal.find((e) => e.Item.Codigo === element.Codigo);
5796
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, element.Codigo);
5797
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5798
+ const exist = data.find((e) => e.Item.Codigo === element.Codigo);
5784
5799
  if (!exist) {
5785
- errores.push(element.Codigo);
5800
+ errores.push({
5801
+ codigo: element.Codigo,
5802
+ stock: stockPersonal ? "personal" : "almac\xE9n"
5803
+ });
5786
5804
  }
5787
5805
  }
5788
5806
  if (errores.length) {
5789
- throw new Controller.SigoError(`No se encontr\xF3 materiales ${errores.join(", ").trim()}, en el stock personal para este trabajo`);
5807
+ const mensaje = errores.map((e) => `No se encontr\xF3 material "${e.codigo}" en el stock ${e.stock}<br>`).join("");
5808
+ throw new Controller.SigoError(mensaje);
5790
5809
  }
5791
5810
  const materiales = [];
5792
5811
  for (const material of Materiales) {
5793
5812
  const { Codigo: codMaterial } = material;
5794
- const stocksPersonal = dataStockPersonal.find((e) => e.Item.Codigo === codMaterial);
5795
- if (!stocksPersonal) {
5813
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, codMaterial);
5814
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5815
+ const stock = data.find((e) => e.Item.Codigo === codMaterial);
5816
+ if (!stock) {
5796
5817
  throw new Controller.SigoError(`No se encontr\xF3 el material ${codMaterial} en el stock personal para este trabajo.`);
5797
5818
  }
5798
5819
  const cantidad = material.CantidadPadre ? 0 : material.CantidadFija ? material.Cantidad : 0;
5799
5820
  materiales.push({
5800
- item: stocksPersonal.Item,
5821
+ item: stock.Item,
5801
5822
  id,
5802
5823
  cantidad: cantidad * material.Factor,
5803
- material
5824
+ material,
5825
+ lote: stock.Lote,
5826
+ stock: stockPersonal ? "Personal" : "Almacen",
5827
+ ID: stockPersonal ? stock.ID_StockPersonal : stock.ID_StockAlmacen
5804
5828
  });
5805
5829
  break;
5806
5830
  }
@@ -5809,13 +5833,34 @@ function checkAndBuildMaterialsFromPersonalStock(Materiales, dataStockPersonal,
5809
5833
  __name(checkAndBuildMaterialsFromPersonalStock, "checkAndBuildMaterialsFromPersonalStock");
5810
5834
 
5811
5835
  // src/Programados/Alemania/buildDataMaterialsRule.ts
5812
- function buildDataMaterialsRule(Materiales, dataStockPersonal) {
5836
+ function buildDataMaterialsRule(Materiales, dataStockPersonal, dataStockAlmacen, Controller) {
5813
5837
  const codigosMaterial = Array.from(Materiales.keys());
5814
- const dataMaterialsRule = dataStockPersonal.filter((e) => codigosMaterial.includes(e.Item.Codigo)).map((e) => ({
5815
- id: e.ID_StockPersonal,
5816
- text: `${e.Item.Codigo} - ${e.Item.Nombre} ${e.Lote ? `(Lote: ${e.Lote})` : ""}`.trim()
5838
+ const dataMaterialsRule = [];
5839
+ codigosMaterial.forEach((el) => {
5840
+ const stockPersonal = consumirStockPersonal(Controller.Delegacion.Codigo, el);
5841
+ const data = stockPersonal ? dataStockPersonal : dataStockAlmacen;
5842
+ const stocks = data.filter((e) => e.Item.Codigo === el);
5843
+ stocks.forEach((e) => {
5844
+ const material = Materiales.get(el);
5845
+ if (!material) {
5846
+ throw new Error("Error al obtener material");
5847
+ }
5848
+ const cantidad = material.CantidadPadre ? 0 : material.CantidadFija ? material.Cantidad : 0;
5849
+ dataMaterialsRule.push({
5850
+ cantidad,
5851
+ id: crypto.randomUUID(),
5852
+ item: e.Item,
5853
+ lote: e.Lote,
5854
+ material,
5855
+ stock: stockPersonal ? "Personal" : "Almacen",
5856
+ ID: stockPersonal ? e.ID_StockPersonal : e.ID_StockAlmacen
5857
+ });
5858
+ });
5859
+ });
5860
+ return dataMaterialsRule.map((e) => ({
5861
+ id: e.ID,
5862
+ text: `${e.item.Codigo} - ${e.item.Nombre} ${e.lote ? `(Lote: ${e.lote})` : ""}`.trim()
5817
5863
  }));
5818
- return dataMaterialsRule;
5819
5864
  }
5820
5865
  __name(buildDataMaterialsRule, "buildDataMaterialsRule");
5821
5866
 
@@ -6524,6 +6569,7 @@ export {
6524
6569
  codigosMOT1_F2,
6525
6570
  codigosMaterialDuctos,
6526
6571
  codigosMaterialUGG,
6572
+ consumirStockPersonal,
6527
6573
  convertDates,
6528
6574
  dataFlujosHomePass,
6529
6575
  esCadenaFechaISOValida,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigo-package",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
4
4
  "description": "Funciones compartidas sigo",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",