@zauru-sdk/utils 2.32.2 → 6.0.0

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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "2.32.2",
3
+ "version": "6.0.0",
4
4
  "description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "type": "module",
9
9
  "publishConfig": {
10
- "access": "public"
10
+ "access": "public",
11
+ "registry": "https://registry.npmjs.org/"
11
12
  },
12
13
  "scripts": {
13
14
  "build": "npm run build:esm",
@@ -24,11 +25,12 @@
24
25
  },
25
26
  "dependencies": {
26
27
  "@remix-run/node": "^2.8.1",
27
- "@zauru-sdk/common": "^2.32.2",
28
- "@zauru-sdk/config": "^2.32.0",
29
- "@zauru-sdk/graphql": "^2.32.0",
30
- "@zauru-sdk/services": "^2.32.2",
31
- "@zauru-sdk/types": "^2.32.2"
28
+ "@zauru-sdk/common": "^6.0.0",
29
+ "@zauru-sdk/config": "^6.0.0",
30
+ "@zauru-sdk/graphql": "^6.0.0",
31
+ "@zauru-sdk/services": "^6.0.0",
32
+ "@zauru-sdk/types": "^6.0.0",
33
+ "moment": "^2.30.1"
32
34
  },
33
- "gitHead": "a576adb455249b281fd063c8ff911a87ce60ae0b"
35
+ "gitHead": "32fe3db68a20bc4bfec9b59db37bd1bf221acc34"
34
36
  }
@@ -1,477 +0,0 @@
1
- import { getFormattedDate } from "@zauru-sdk/common";
2
- import { createNewAuthorizedPurchaseOrder, createNewReception, getDeliveryByBooking, getHeaders, getLoteByName, getPurchasesOrderByIdNumber, getSession, getVariablesByName, insertBookings, saveMotivosDeRechazoByPurchase, } from "@zauru-sdk/services";
3
- import { saveRechazoCanastas } from "./motivos-rechazo.utils.js";
4
- import { deleteQueueFormReceptionHistory, ESTADOS_COLA_RECEPCIONES, updateQueueFormReceptionHistory, } from "./4pinos-receptions-form-history.utils.js";
5
- /**
6
- * Flujo de la función register4pinosReception:
7
- *
8
- * 1. Recibe parámetros como cookie, idWebAppTable, agency_id, values y originApiResponses.
9
- * 2. Inicializa la sesión y los headers.
10
- * 3. Realiza una serie de llamadas API en orden, manejadas por apiResponses.apiCall:
11
- * - Actualiza el estado de la cola de recepción.
12
- * - Valida que no exista una orden de compra con el mismo número.
13
- * - Crea una nueva orden de compra autorizada.
14
- * - Crea una nueva recepción.
15
- * - Realiza un envío de canastas a la agencia.
16
- * - Recibe el envío de canastas.
17
- * - Si no es centro de acopio:
18
- * - Realiza un envío de canastas a control de calidad (si aplica).
19
- * - Recibe el envío de control de calidad.
20
- * - Guarda el rechazo de canastas directo (si aplica).
21
- * - Si es centro de acopio:
22
- * - Guarda los motivos de rechazo (si existen).
23
- * 4. Elimina el registro de la cola al finalizar.
24
- * 5. En caso de error en cualquier paso, actualiza el estado de la cola a ERROR.
25
- *
26
- * La función decide qué camino tomar basándose en:
27
- * - El valor de apiResponses.apiCall para determinar en qué paso está.
28
- * - Si es centro de acopio o no (esCentroDeAcopio).
29
- * - La existencia de canastas de control de calidad (qualityControlBaskets).
30
- * - La presencia de motivos de rechazo para centros de acopio.
31
- */
32
- export const register4pinosReception = async ({ cookie, idWebAppTable, agency_id, values, originApiResponses = {}, }) => {
33
- const session = await getSession(cookie);
34
- const headers = await getHeaders(cookie, session);
35
- let apiResponses = {
36
- apiCall: originApiResponses.apiCall ?? 1,
37
- ...originApiResponses,
38
- };
39
- try {
40
- if (apiResponses.apiCall === 1) {
41
- const responseUpdate = await updateQueueFormReceptionHistory(headers, session, {
42
- estado: ESTADOS_COLA_RECEPCIONES.EN_PROCESO,
43
- }, idWebAppTable);
44
- if (responseUpdate.error) {
45
- throw new Error("Error al intentar actualizar el estado de la cola: " +
46
- responseUpdate?.userMsg);
47
- }
48
- apiResponses.apiCall = apiResponses.apiCall + 1;
49
- }
50
- if (apiResponses.apiCall === 2) {
51
- //SI EL API CALL ES DIFERENTE DE 1 SIGNIFICA QUE SOLO VA A REINTENTAR DESDE DONDE FALLÓ
52
- //Validando que no exista ya una recepción con ese número:
53
- const responsePOSearch = await getPurchasesOrderByIdNumber(session, values?.idNumberInput);
54
- if (responsePOSearch.error || !responsePOSearch.data) {
55
- throw new Error(`No hay comunicación con la red para la validación de exists - Validate Exists: ${responsePOSearch?.userMsg}`);
56
- }
57
- const existentes = responsePOSearch?.data?.filter((x) => !x.voided);
58
- if (existentes?.length > 0) {
59
- throw new Error(`Ya existe una órden de compra con este número de contraseña asociado, revise el listado general. Peso: ${existentes[0].due}, Ingresado el: ${getFormattedDate(existentes[0].issue_date, false)}, Memo: ${existentes[0].memo}, Tipo: ${existentes[0].reference}`);
60
- }
61
- }
62
- const webapp_table_rejection = {
63
- Canastas: "int",
64
- Razon_primaria: "string",
65
- Razon_secundaria: "string",
66
- Razon_terciaria: "string",
67
- Otras_razones: "string",
68
- };
69
- const { recepciones_tag_id: tag_id, recepciones_vendor_agency_id: origin_agency, recepciones_my_quality_control_agency_id, } = await getVariablesByName(headers, session, [
70
- "recepciones_tag_id",
71
- "recepciones_vendor_agency_id",
72
- "recepciones_my_quality_control_agency_id",
73
- ]);
74
- // Remplaza los caracteres ':' por '":' y '{ ' por '{"', de esta manera las claves estarán entre comillas dobles
75
- const fixedString = recepciones_my_quality_control_agency_id
76
- .replace(/([a-zA-Z0-9_]+):/g, '"$1":')
77
- .replace("{ ", '{"');
78
- const hashRecepcionesQCAgency = JSON.parse(fixedString ?? "{}");
79
- const quality_control_agency = hashRecepcionesQCAgency[agency_id];
80
- //-------------------REACT SELECT VALUES-------------------------
81
- console.log("values", values);
82
- const vendor = values.vendor;
83
- const itemId = values.item;
84
- const purchaser = values.purchaser;
85
- const payeeType = values.rType;
86
- const idNumberInput = values.idNumberInput;
87
- const discountReason = values.discountReason;
88
- const issue_date = values.issue_date;
89
- const esCentroDeAcopio = values?.esCentroDeAcopio === "true";
90
- const singleBasketWeight = Number(values.singleBasketWeight);
91
- const recepciones_basket_item_id = Number(values?.recepciones_basket_item_id.toString());
92
- const rejections = JSON.parse(values.rejections.toString() ?? "[]");
93
- const provenance = values.selectedProvenance;
94
- const purchaseOrderGeneralInfo = JSON.parse(values?.purchaseOrderGeneralInfo?.toString() ?? "{}");
95
- let controlCalidadValues = {
96
- porcentajeRechazo: values.porcentajeRechazo,
97
- razonPrincipal: values.razonPrincipal,
98
- razonSecundaria: values.razonSecundaria,
99
- razonTerciaria: values.razonTerciaria,
100
- otrasRazones: values.otrasRazones,
101
- };
102
- let keys = Object.keys(values);
103
- let webapp_table_object = {};
104
- const netWeight = Number(values.netWgt);
105
- const total_baskets = Number(values.totalBaskets);
106
- const netWeightByBasket = Number(netWeight) / total_baskets;
107
- const pesoEnUnidades = values.stockInteger == "true";
108
- const buildArray = (keyIncludes, processValue) => {
109
- const regex = /\d/; // Expresión regular para buscar al menos un dígito.
110
- return keys
111
- .filter((key) => key.includes(keyIncludes) && regex.test(key))
112
- .map((key) => [
113
- key.substring(keyIncludes?.length, key?.length),
114
- processValue(values[key]),
115
- ])
116
- .filter(([key, value]) => Number(value) > 0)
117
- .map(([kv, val]) => `${val}-${kv}`);
118
- };
119
- const buildSimpleArray = (keyIncludes, processValue) => {
120
- const regex = /\d/; // Expresión regular para buscar al menos un dígito.
121
- return keys
122
- .filter((key) => key.includes(keyIncludes) && regex.test(key))
123
- .map((key) => processValue(values[key] === "" || values[key] === "NaN" ? 0 : values[key]));
124
- };
125
- const processValues = () => {
126
- const received_baskets = buildArray("rec", parseInt);
127
- const qualityControlBaskets = buildArray("qC", parseInt);
128
- const detail_baskets = buildSimpleArray("basket", parseInt);
129
- const detail_discounts = buildSimpleArray("discount", parseFloat);
130
- const detail_weights = buildSimpleArray("weight", parseFloat);
131
- Object.keys(webapp_table_rejection ?? {})?.forEach((value, index) => {
132
- const temp = index === 0
133
- ? values[value]?.toString()
134
- : rejections[index - 1]?.split(";").join(", ") || "";
135
- webapp_table_object[value] = temp;
136
- });
137
- return [
138
- received_baskets,
139
- qualityControlBaskets,
140
- detail_baskets,
141
- detail_discounts,
142
- detail_weights,
143
- ];
144
- };
145
- let [received_baskets, qualityControlBaskets, detail_baskets, detail_discounts, detail_weights,] = processValues();
146
- //========== PRIMERA LLAMADA DE API Y CAPTURA DE ERRORES
147
- if (apiResponses.apiCall === 2) {
148
- console.log("========================================>");
149
- console.log("paso 1: REGISTRANDO NUEVA ORDEN DE COMPRA AUTORIZADA...");
150
- //build net_weights
151
- const detail_netWeights = keys
152
- .filter((key) => key.includes("weight"))
153
- .map((key, index) => {
154
- const weight = Number(values[key]);
155
- const detail_basket = Number(detail_baskets[index]);
156
- const detail_discount = Number(detail_discounts[index]) ?? 0;
157
- const descuentoPesoCanasta = pesoEnUnidades
158
- ? 0
159
- : detail_basket * singleBasketWeight;
160
- return ((weight - descuentoPesoCanasta) * ((100 - detail_discount) / 100));
161
- });
162
- const newPurchaseOrderDetails = detail_baskets.map((x, index) => {
163
- return {
164
- reference: `${detail_weights[index]},${x},${detail_discounts[index]}`,
165
- item_id: Number(itemId),
166
- booked_quantity: detail_netWeights[index],
167
- unit_cost: 1,
168
- };
169
- });
170
- const newPurchaseOrderBody = {
171
- reference: payeeType,
172
- taxable: false,
173
- issue_date,
174
- shipping_date: issue_date,
175
- incoterm_id: purchaseOrderGeneralInfo?.incoterm_id,
176
- currency_id: purchaseOrderGeneralInfo?.currency_id,
177
- charge_term_id: purchaseOrderGeneralInfo?.charge_term_id,
178
- payee_id: vendor,
179
- agency_id,
180
- purchaser_id: Number(purchaser),
181
- import: false,
182
- tag_ids: ["", tag_id],
183
- memo: qualityControlBaskets + "",
184
- origin: netWeight?.toString(),
185
- purchase_order_details: newPurchaseOrderDetails,
186
- incoterm_destination: provenance.slice(0, 254),
187
- transport_type: discountReason,
188
- id_number: idNumberInput,
189
- ...(esCentroDeAcopio
190
- ? { discount: Number(controlCalidadValues.porcentajeRechazo) }
191
- : {}),
192
- };
193
- console.log("REGISTRANDO ORDEN DE COMPRA: ", JSON.stringify(newPurchaseOrderBody));
194
- const newAuthorizedPurchaseResponse = await createNewAuthorizedPurchaseOrder(headers, newPurchaseOrderBody, false);
195
- if (newAuthorizedPurchaseResponse?.error ||
196
- !newAuthorizedPurchaseResponse.data) {
197
- throw new Error("Error al intentar crear la órden de compra autorizada: " +
198
- newAuthorizedPurchaseResponse?.userMsg +
199
- " Body: " +
200
- JSON.stringify(newPurchaseOrderBody));
201
- }
202
- apiResponses.authorizedPO = newAuthorizedPurchaseResponse.data;
203
- apiResponses.apiCall = apiResponses.apiCall + 1;
204
- }
205
- if (apiResponses.apiCall === 3) {
206
- const createNewReceptionBodyFunction = () => {
207
- const receptionDetails = {};
208
- apiResponses.authorizedPO.purchase_order_details.forEach((pod, index) => (receptionDetails[index] = {
209
- item_id: `${pod.item_id}`,
210
- purchase_order_detail_id: `${pod.id}`,
211
- lot_delivered_quantity: [`${pod.booked_quantity}`],
212
- lot_name: [apiResponses.authorizedPO.id_number],
213
- lot_expire: [
214
- new Date(Date.now() + 12096e5).toISOString().split("T")[0],
215
- ],
216
- lot_description: [received_baskets.join(",")],
217
- }));
218
- const newReception = {
219
- reception: {
220
- agency_id,
221
- received_at: issue_date,
222
- purchase_order_id: apiResponses.authorizedPO.id + "",
223
- entity_id: apiResponses.authorizedPO.entity_id + "",
224
- needs_transit: "0",
225
- invoice_number: "",
226
- reception_details_attributes: receptionDetails,
227
- },
228
- };
229
- return newReception;
230
- };
231
- //first create reception and receive it with the basket shipment
232
- const newReception = createNewReceptionBodyFunction();
233
- console.log("========================================>");
234
- console.log("paso 2: CREANDO RECEPCION, ENVIO DE CANASTAS, WEBAPP TABLE DE RECHAZO DIRECTO");
235
- console.log("------------ CREANDO RECEPCIÓN.......");
236
- const responseNewReception = await createNewReception(headers, newReception, apiResponses.authorizedPO.id);
237
- if (responseNewReception.error || !responseNewReception.data) {
238
- throw new Error("Error al intentar crear la recepción: " +
239
- responseNewReception?.userMsg);
240
- }
241
- apiResponses.apiCall = apiResponses.apiCall + 1;
242
- }
243
- if (apiResponses.apiCall === 4) {
244
- console.log("------------- REALIZANDO ENVÍO DE CANASTAS A LA AGENCIA");
245
- const createBasketsShipmentBodyFunction = () => {
246
- const movementDetails = [];
247
- received_baskets.forEach((basket, index) => {
248
- movementDetails.push({
249
- item_id: recepciones_basket_item_id,
250
- lot_id: basket.split("-")[1],
251
- booked_quantity: basket.split("-")[0],
252
- });
253
- });
254
- const BasketShipment = {
255
- booker_id: Number(purchaser),
256
- reference: "Envio de canastas (De proveedor a agencia)",
257
- needs_transport: false,
258
- planned_delivery: issue_date,
259
- agency_from_id: Number(origin_agency),
260
- agency_to_id: agency_id,
261
- movements: movementDetails,
262
- };
263
- return BasketShipment;
264
- };
265
- const newBasketShipment = createBasketsShipmentBodyFunction();
266
- const newShipmentResponse = await insertBookings(headers, newBasketShipment, `${apiResponses.authorizedPO.id}`);
267
- if (newShipmentResponse.error || !newShipmentResponse.data) {
268
- throw new Error("Error al intentar crear el envío: " +
269
- newShipmentResponse?.userMsg +
270
- " Body: " +
271
- JSON.stringify(newBasketShipment));
272
- }
273
- apiResponses.apiCall = apiResponses.apiCall + 1;
274
- apiResponses.shipment = newShipmentResponse.data;
275
- }
276
- if (apiResponses.apiCall === 5) {
277
- console.log("------------- RECIBIENDO EL ENVÍO DE CANASTAS");
278
- const getShipmentResponse = await getDeliveryByBooking(headers, apiResponses.shipment.id);
279
- if (getShipmentResponse.error) {
280
- throw new Error("Error al intentar recibir el envío: " + getShipmentResponse?.userMsg);
281
- }
282
- apiResponses.apiCall = apiResponses.apiCall + 1;
283
- }
284
- if (!esCentroDeAcopio) {
285
- //Al momento de este comentario, un ejemplo es que sólo Planta Central no es centro de acopio
286
- //Ellos si envían canastas a control de calidad.
287
- //Si es de un centro de acopio, se salta esto...
288
- if (apiResponses.apiCall === 6 && qualityControlBaskets.length > 0) {
289
- console.log("------------- REALIZANDO ENVÍO DE CANASTAS A CONTROL DE CALIDAD");
290
- const total_qc_baskets = Number(values.totalQCBaskets);
291
- const lotResponse = await getLoteByName(session, apiResponses.authorizedPO.id_number);
292
- if (lotResponse.error || !lotResponse.data || !lotResponse.data.id) {
293
- throw new Error("Error al intentar obtener el lote por nombre: " +
294
- lotResponse?.userMsg);
295
- }
296
- const createQCBasketShipmentBody = async () => {
297
- const qcMovementDetails = qualityControlBaskets.map((basket) => {
298
- const booked_quantity = Number(basket.split("-")[0]);
299
- const lot_id = Number(basket.split("-")[1]);
300
- return {
301
- item_id: recepciones_basket_item_id,
302
- lot_id,
303
- booked_quantity,
304
- reference: "Canastas a control de calidad.",
305
- };
306
- });
307
- qcMovementDetails.push({
308
- item_id: apiResponses.authorizedPO.purchase_order_details[0].item_id,
309
- lot_id: Number(lotResponse.data?.id),
310
- //Si es por unidad, se redondea al entero más cercano, por ejemplo 12.3 quedaría como
311
- booked_quantity: pesoEnUnidades
312
- ? Math.round(total_qc_baskets * netWeightByBasket)
313
- : total_qc_baskets * netWeightByBasket,
314
- reference: "Verduras a control de calidad.",
315
- });
316
- const qcBasketShipment = {
317
- booker_id: Number(purchaser),
318
- reference: "Envio de canastas y verduras a CC",
319
- needs_transport: false,
320
- planned_delivery: issue_date,
321
- agency_from_id: agency_id,
322
- agency_to_id: quality_control_agency,
323
- movements: qcMovementDetails,
324
- };
325
- return qcBasketShipment;
326
- };
327
- const newQCBasketShipment = await createQCBasketShipmentBody();
328
- const new_qc_shipment_response = await insertBookings(headers, newQCBasketShipment, `${apiResponses.authorizedPO.id}`);
329
- if (!new_qc_shipment_response.data || new_qc_shipment_response.error) {
330
- console.log("Body: ", JSON.stringify(newQCBasketShipment));
331
- throw new Error("Error al intentar crear el envío a control de calidad: " +
332
- new_qc_shipment_response?.userMsg +
333
- " Body: " +
334
- JSON.stringify(newQCBasketShipment));
335
- }
336
- apiResponses.apiCall = apiResponses.apiCall + 1;
337
- apiResponses.qcShipment = new_qc_shipment_response.data;
338
- }
339
- if (apiResponses.apiCall === 7) {
340
- console.log("------------- RECIBIENDO ENVÍO DE CANASTAS A CONTROL DE CALIDAD");
341
- const getQCDeliveryResponse = await getDeliveryByBooking(headers, apiResponses.qcShipment.id);
342
- if (getQCDeliveryResponse.error) {
343
- throw new Error("Error al intentar recibir el envío de control de calidad: " +
344
- getQCDeliveryResponse?.userMsg +
345
- " Body: " +
346
- JSON.stringify(apiResponses.qcShipment));
347
- }
348
- apiResponses.apiCall = apiResponses.apiCall + 1;
349
- }
350
- if (apiResponses.apiCall === 8 || qualityControlBaskets.length === 0) {
351
- if (webapp_table_object.Canastas !== "" &&
352
- webapp_table_object.Canastas !== "0") {
353
- console.log("----------- Guardando rechazo de canastas directo...... -----------");
354
- const responseRechazo = await saveRechazoCanastas(headers, session, {
355
- temp_purchase_order_id: `${apiResponses.authorizedPO.id}`,
356
- webapp_row: {
357
- data: webapp_table_object,
358
- },
359
- });
360
- if (responseRechazo.error) {
361
- throw new Error("Error al intentar guardar el rechazo de canastas directo: " +
362
- responseRechazo?.userMsg);
363
- }
364
- apiResponses.apiCall = apiResponses.apiCall + 1;
365
- }
366
- }
367
- }
368
- else {
369
- //Si es centro de acopio, guardo los motivos de rechazo
370
- if (controlCalidadValues?.razonPrincipal ||
371
- controlCalidadValues?.razonSecundaria ||
372
- controlCalidadValues?.razonTerciaria ||
373
- controlCalidadValues?.otrasRazones) {
374
- if (apiResponses.apiCall === 6) {
375
- console.log("========================================>");
376
- console.log("paso 3: GUARDAR MOTIVOS DE RECHAZO");
377
- const saveMotivosResponse = await saveMotivosDeRechazoByPurchase(headers, session, {
378
- Razon_primaria: `${controlCalidadValues?.razonPrincipal ?? ""}`,
379
- Razon_secundaria: `${controlCalidadValues?.razonSecundaria ?? ""}`,
380
- Razon_terciaria: `${controlCalidadValues?.razonTerciaria ?? ""}`,
381
- Otras_razones: `${controlCalidadValues?.otrasRazones ?? ""}`,
382
- }, { temp_purchase_order_id: `${apiResponses.authorizedPO.id}` });
383
- if (saveMotivosResponse.error) {
384
- throw new Error("Error al intentar guardar los motivos de rechazo: " +
385
- saveMotivosResponse?.userMsg);
386
- }
387
- }
388
- }
389
- }
390
- console.log("========================================>");
391
- console.log("paso 4: ELIMINAR EL REGISTRO DE LA COLA");
392
- //ELIMINAR EL REGISTRO DE LA COLA
393
- await deleteQueueFormReceptionHistory(headers, session, idWebAppTable);
394
- }
395
- catch (e) {
396
- //SI OCURRE ALGÚN ERROR, SE INTENTA GUARDAR EL RETRY
397
- console.log("========================================>");
398
- console.log("paso -1: ACTUALIZAR EL REGISTRO DE LA COLA A ERROR");
399
- console.error(`Error: ${e?.toString()}, idWebAppTable: ${idWebAppTable}`);
400
- await updateQueueFormReceptionHistory(headers, session, {
401
- estado: ESTADOS_COLA_RECEPCIONES.ERROR,
402
- description: e?.toString(),
403
- apiResponses,
404
- }, idWebAppTable);
405
- }
406
- };
407
- export const retryPO = async (register, session, headers, hostname, cookie) => {
408
- console.log("REINTENTO DE REGISTRO DE ORDEN DE COMPRA =======================>");
409
- if (!register.data.apiResponses || register.data.apiResponses.apiCall === 1) {
410
- const responsePOSearch = await getPurchasesOrderByIdNumber(session, register.data?.formSubmited?.idNumberInput);
411
- if (responsePOSearch.error || !responsePOSearch.data) {
412
- console.error("Validate Exists: ", responsePOSearch.userMsg);
413
- return {
414
- error: true,
415
- title: "No se logró comunicar con la red.",
416
- type: "error",
417
- description: `No hay comunicación con la red para el reintento - Validate Exists: ${responsePOSearch.userMsg}`,
418
- };
419
- }
420
- const existentes = responsePOSearch?.data?.filter((x) => !x.voided);
421
- if (existentes?.length > 0) {
422
- const msg = `Ya existe una órden de compra con este número de contraseña asociado, revise el listado general. Peso: ${existentes[0].due}, Ingresado el: ${getFormattedDate(existentes[0].issue_date)}, Memo: ${existentes[0].memo}, Tipo: ${existentes[0].reference}`;
423
- console.error(msg);
424
- await updateQueueFormReceptionHistory(headers, session, {
425
- description: msg,
426
- estado: ESTADOS_COLA_RECEPCIONES.ERROR,
427
- }, register.id);
428
- return {
429
- error: true,
430
- title: "No se puede crear la órden de compra.",
431
- type: "error",
432
- description: msg,
433
- };
434
- }
435
- }
436
- const queueResponse = await updateQueueFormReceptionHistory(headers, session, {
437
- estado: ESTADOS_COLA_RECEPCIONES.REINTENTANDO,
438
- }, register.id);
439
- if (queueResponse.error || !queueResponse.data?.id) {
440
- return {
441
- error: true,
442
- title: "No se logró comunicar con la red.",
443
- type: "error",
444
- description: `No hay comunicación con la red para el reintento: ${queueResponse?.userMsg}`,
445
- };
446
- }
447
- if (hostname.includes("localhost")) {
448
- console.log("------- EJECUTANDO LOCALMENTE", ` para ${register.data?.formSubmited?.idNumberInput}`);
449
- register4pinosReception({
450
- values: register.data?.formSubmited,
451
- cookie,
452
- idWebAppTable: register.id,
453
- agency_id: register.data?.agency_id,
454
- originApiResponses: register.data?.apiResponses,
455
- });
456
- }
457
- else {
458
- console.log("------- ENVIANDO A EJECUTAR NETLIFY FUNCTION: 4pinosNewPurchaseOrder-background", ` para ${register.data?.formSubmited?.idNumberInput}`);
459
- fetch(`https://${hostname}/.netlify/functions/4pinosNewPurchaseOrder-background`, {
460
- method: "post",
461
- headers: { "Content-type": "application/json" },
462
- body: JSON.stringify({
463
- values: register.data?.formSubmited,
464
- cookie,
465
- idWebAppTable: register.id,
466
- agency_id: register.data?.agency_id,
467
- originApiResponses: register.data?.apiResponses,
468
- }),
469
- });
470
- }
471
- return {
472
- error: false,
473
- title: "Reintento iniciado con éxito.",
474
- type: "success",
475
- description: `Se está procesando el reintento de ingreso de recepción!.`,
476
- };
477
- };
@@ -1,94 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppRow, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
3
- export const ESTADOS_COLA_RECEPCIONES = {
4
- INICIADO: "Iniciado",
5
- EN_PROCESO: "En proceso",
6
- ERROR: "Con error",
7
- REINTENTANDO: "Reintentando",
8
- PENDIENTE_DE_REINTENTO: "Pendiente de reintento",
9
- OFFLINE: "Registro local",
10
- };
11
- /**
12
- * Get getQueueFormReceptionHistories from the web app table.
13
- * @param headers Request headers.
14
- * @param session Session object.
15
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
16
- */
17
- export const getQueueFormReceptionHistories = (headers, session) => {
18
- return handlePossibleAxiosErrors(async () => {
19
- const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
20
- "queue_form_recepcion_submited_web_app_table_id",
21
- ]);
22
- const response = await getWebAppTableRegisters(session, queue_form_recepcion_submited_web_app_table_id);
23
- if (response.error) {
24
- throw new Error(`Ocurrió un error al consultar el historial de colas: ${response.userMsg}`);
25
- }
26
- const history = response?.data ?? [];
27
- return history;
28
- });
29
- };
30
- /**
31
- * Get getQueueFormReceptionHistories from the web app table.
32
- * @param headers Request headers.
33
- * @param session Session object.
34
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
35
- */
36
- export const getQueueFormReceptionHistoryByID = (session, id) => {
37
- return handlePossibleAxiosErrors(async () => {
38
- const response = await getWebAppRow(session, Number(id));
39
- if (response.error) {
40
- throw new Error(`Ocurrió un error al consultar el historial de colas: ${response.userMsg}`);
41
- }
42
- const history = response?.data ?? null;
43
- return history;
44
- });
45
- };
46
- /**
47
- * Create a template in the web app table.
48
- * @param headers Request headers.
49
- * @param session Session object.
50
- * @param body QueueFormReceptionWebAppTable data to be created.
51
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable>.
52
- */
53
- export const createQueueFormReceptionHistory = (headers, session, body) => {
54
- return handlePossibleAxiosErrors(async () => {
55
- const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
56
- "queue_form_recepcion_submited_web_app_table_id",
57
- ]);
58
- //Esto es para simular el tiempo de carga de la API nunca subir a producción
59
- //await new Promise((resolve) => setTimeout(resolve, 7000));
60
- //throw new Error("Error al crear el historial de colas");
61
- const response = await createWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, body);
62
- return response;
63
- });
64
- };
65
- /**
66
- * Put updateQueueFormReception from the web app table.
67
- * @param headers Request headers.
68
- * @param session Session object.
69
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
70
- */
71
- export const updateQueueFormReceptionHistory = (headers, session, body, id_registro) => {
72
- return handlePossibleAxiosErrors(async () => {
73
- const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
74
- "queue_form_recepcion_submited_web_app_table_id",
75
- ]);
76
- const response = await updateWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, id_registro, { ...body });
77
- return response;
78
- });
79
- };
80
- /**
81
- * Delete QueueFormReceptionHistory from the web app table.
82
- * @param headers Request headers.
83
- * @param session Session object.
84
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
85
- */
86
- export const deleteQueueFormReceptionHistory = (headers, session, id) => {
87
- return handlePossibleAxiosErrors(async () => {
88
- const { queue_form_recepcion_submited_web_app_table_id } = await getVariablesByName(headers, session, [
89
- "queue_form_recepcion_submited_web_app_table_id",
90
- ]);
91
- const response = await deleteWebAppTableRegister(headers, queue_form_recepcion_submited_web_app_table_id, Number(id));
92
- return response;
93
- });
94
- };
@@ -1,136 +0,0 @@
1
- import { getHeaders, getSession, insertBookings, updateReceivedPurchaseOrder, } from "@zauru-sdk/services";
2
- import { deleteQueueShipmentsFormHistory, updateQueueShipmentsFormHistory, } from "./4pinos-shipments-form-history.utils.js";
3
- import { ESTADOS_COLA_RECEPCIONES } from "./4pinos-receptions-form-history.utils.js";
4
- export const register4pinosShipment = async ({ cookie, idWebAppTable, apiStep, shipment_id, values, }) => {
5
- const session = await getSession(cookie);
6
- const headers = await getHeaders(cookie, session);
7
- let proccess_step = apiStep ?? 1;
8
- let new_shipment_id = shipment_id ?? undefined;
9
- try {
10
- //TODO: VERIFICAR SI EL ENVIO YA EXISTE
11
- if (proccess_step === 1) {
12
- //PASO 1: CREAR EL ENVIO
13
- const shipmentBody = {
14
- memo: `ENVIO_MATERIA_PRIMA_${values?.memo || ""}`,
15
- reference: `Envío de materia prima entre agencias, con código: ${values.shipment_reference}, realizado desde la aplicación web de recepciones.`,
16
- agency_from_id: values.agency_from_id,
17
- agency_to_id: values.agency_to_id,
18
- booker_id: values.booker_id,
19
- id_number: values.shipment_reference,
20
- transporter_id: values.transporter_id,
21
- planned_delivery: values.planned_delivery,
22
- planned_shipping: values.planned_shipping,
23
- needs_transport: true,
24
- movements: values.purchase_orders.map((purchaseOrder) => ({
25
- lot_id: purchaseOrder.lot_id,
26
- booked_quantity: purchaseOrder.booked_quantity,
27
- item_id: purchaseOrder.item_id,
28
- delivered_quantity: purchaseOrder.booked_quantity,
29
- reference: `PO_ID_${purchaseOrder.id};PO_ID_NUMBER_${purchaseOrder.id_number}`,
30
- })),
31
- };
32
- console.log("========================================>");
33
- console.log("paso 1: CREAR EL ENVIO");
34
- console.log("Enviando: ", JSON.stringify(shipmentBody));
35
- const createBookingResponse = await insertBookings(headers, shipmentBody);
36
- if (createBookingResponse.error) {
37
- throw new Error(`Error al crear el envío: ${createBookingResponse.userMsg} con el body: ${JSON.stringify(shipmentBody)}`);
38
- }
39
- new_shipment_id = createBookingResponse.data?.id;
40
- }
41
- proccess_step++;
42
- //SE QUITA EL DESPACHO AUTOMATICO, PORQUE SE VA A HACER MANUAL AHORA
43
- /*
44
- if (proccess_step === 2) {
45
- //PASO 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO
46
- console.log("========================================>");
47
- console.log("paso 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO");
48
- const dispatchShipmentResponse = await despacharShipment_booking(
49
- headers,
50
- Number(new_shipment_id)
51
- );
52
-
53
- if (dispatchShipmentResponse.error) {
54
- throw new Error(
55
- `Error al despachar el envío: ${dispatchShipmentResponse.userMsg} con el id: ${new_shipment_id}`
56
- );
57
- }
58
- }
59
- */
60
- proccess_step++;
61
- if (proccess_step === 3) {
62
- //PASO 2: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA
63
- console.log("========================================>");
64
- console.log("paso 3: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA");
65
- for (const purchaseOrder of values.purchase_orders) {
66
- const response = await updateReceivedPurchaseOrder(headers, {
67
- purchase_order: {
68
- shipment_reference: values.shipment_reference,
69
- },
70
- }, purchaseOrder.id);
71
- if (response.error) {
72
- throw new Error(`Error al actualizar la orden de compra ${purchaseOrder.id}: ${response.userMsg}`);
73
- }
74
- }
75
- }
76
- proccess_step++;
77
- console.log("========================================>");
78
- console.log("paso 4: ELIMINAR EL REGISTRO DE LA COLA");
79
- //ELIMINAR EL REGISTRO DE LA COLA
80
- await deleteQueueShipmentsFormHistory(headers, session, idWebAppTable.toString());
81
- }
82
- catch (e) {
83
- console.log("========================================>");
84
- console.log("paso -1: ACTUALIZAR EL REGISTRO DE LA COLA A ERROR");
85
- console.error(`Error: ${e?.toString()}, idWebAppTable: ${idWebAppTable}`);
86
- await updateQueueShipmentsFormHistory(headers, session, {
87
- estado: ESTADOS_COLA_RECEPCIONES.ERROR,
88
- description: e?.toString(),
89
- apiStep: proccess_step,
90
- }, idWebAppTable);
91
- }
92
- };
93
- export const retryShipmennt = async (register, session, headers, hostname, cookie) => {
94
- console.log("REINTENTO DE REGISTRO DE ENVÍO =======================>");
95
- const queueResponse = await updateQueueShipmentsFormHistory(headers, session, {
96
- estado: ESTADOS_COLA_RECEPCIONES.REINTENTANDO,
97
- }, register.id);
98
- if (queueResponse.error || !queueResponse.data?.id) {
99
- return {
100
- error: true,
101
- title: "No se logró comunicar con la red.",
102
- type: "error",
103
- description: `No hay comunicación con la red para el reintento: ${queueResponse?.userMsg}`,
104
- };
105
- }
106
- if (hostname.includes("localhost")) {
107
- console.log("------- EJECUTANDO LOCALMENTE", ` para ${register.data?.formSubmited?.shipment_reference}`);
108
- register4pinosShipment({
109
- values: register.data?.formSubmited,
110
- cookie: cookie || "",
111
- idWebAppTable: register.id,
112
- apiStep: register.data?.apiStep,
113
- shipment_id: register.data?.shipment_id,
114
- });
115
- }
116
- else {
117
- console.log("------- ENVIANDO A EJECUTAR NETLIFY FUNCTION: 4pinosNewShipment-background", ` para ${register.data?.formSubmited?.shipment_reference}`);
118
- fetch(`https://${hostname}/.netlify/functions/4pinosNewShipment-background`, {
119
- method: "post",
120
- headers: { "Content-type": "application/json" },
121
- body: JSON.stringify({
122
- values: register.data?.formSubmited,
123
- cookie: cookie || "",
124
- idWebAppTable: register.id,
125
- apiStep: register.data?.apiStep,
126
- shipment_id: register.data?.shipment_id,
127
- }),
128
- });
129
- }
130
- return {
131
- error: false,
132
- title: "Reintento iniciado con éxito.",
133
- type: "success",
134
- description: `Se está procesando el reintento de ingreso de recepción!.`,
135
- };
136
- };
@@ -1,86 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppRow, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
3
- /**
4
- * Get getQueueShipmentsFormHistories from the web app table.
5
- * @param headers Request headers.
6
- * @param session Session object.
7
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
8
- */
9
- export const getQueueShipmentsFormHistories = (headers, session) => {
10
- return handlePossibleAxiosErrors(async () => {
11
- const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
12
- "queue_form_shipment_submited_web_app_table_id",
13
- ]);
14
- const response = await getWebAppTableRegisters(session, queue_form_shipment_submited_web_app_table_id);
15
- if (response.error) {
16
- throw new Error(`Ocurrió un error al consultar el historial de envíos: ${response.userMsg}`);
17
- }
18
- const history = response?.data ?? [];
19
- return history;
20
- });
21
- };
22
- /**
23
- * Get getQueueShipmentsFormHistories from the web app table.
24
- * @param headers Request headers.
25
- * @param session Session object.
26
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
27
- */
28
- export const getQueueShipmentsFormHistoryByID = (session, id) => {
29
- return handlePossibleAxiosErrors(async () => {
30
- const response = await getWebAppRow(session, Number(id));
31
- if (response.error) {
32
- throw new Error(`Ocurrió un error al consultar el historial de colas: ${response.userMsg}`);
33
- }
34
- const history = response?.data ?? null;
35
- return history;
36
- });
37
- };
38
- /**
39
- * Create a template in the web app table.
40
- * @param headers Request headers.
41
- * @param session Session object.
42
- * @param body QueueShipmentsForm data to be created.
43
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm>.
44
- */
45
- export const createQueueShipmentsFormHistory = (headers, session, body) => {
46
- return handlePossibleAxiosErrors(async () => {
47
- const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
48
- "queue_form_shipment_submited_web_app_table_id",
49
- ]);
50
- //Esto es para simular el tiempo de carga de la API nunca subir a producción
51
- //await new Promise((resolve) => setTimeout(resolve, 7000));
52
- //throw new Error("Error al crear el historial de colas");
53
- const response = await createWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, body);
54
- return response;
55
- });
56
- };
57
- /**
58
- * Put updateQueueShipmentsForm from the web app table.
59
- * @param headers Request headers.
60
- * @param session Session object.
61
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
62
- */
63
- export const updateQueueShipmentsFormHistory = (headers, session, body, id_registro) => {
64
- return handlePossibleAxiosErrors(async () => {
65
- const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
66
- "queue_form_shipment_submited_web_app_table_id",
67
- ]);
68
- const response = await updateWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, id_registro, { ...body });
69
- return response;
70
- });
71
- };
72
- /**
73
- * Delete QueueShipmentsFormHistory from the web app table.
74
- * @param headers Request headers.
75
- * @param session Session object.
76
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
77
- */
78
- export const deleteQueueShipmentsFormHistory = (headers, session, id) => {
79
- return handlePossibleAxiosErrors(async () => {
80
- const { queue_form_shipment_submited_web_app_table_id } = await getVariablesByName(headers, session, [
81
- "queue_form_shipment_submited_web_app_table_id",
82
- ]);
83
- const response = await deleteWebAppTableRegister(headers, queue_form_shipment_submited_web_app_table_id, Number(id));
84
- return response;
85
- });
86
- };
@@ -1,62 +0,0 @@
1
- import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
2
- import { createWebAppTableRegister, deleteWebAppTableRegister, getVariablesByName, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
3
- /**
4
- * Get programaciones from the web app table.
5
- * @param headers Request headers.
6
- * @param session Session object.
7
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>.
8
- */
9
- export const getProgramaciones = (headers, session) => {
10
- return handlePossibleAxiosErrors(async () => {
11
- const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
12
- const response = await getWebAppTableRegisters(session, programaciones_webapp_table_id);
13
- if (response.error) {
14
- throw new Error(`Ocurrió un error al consultar las programaciones: ${response.userMsg}`);
15
- }
16
- const registers = response.data ?? [];
17
- return registers;
18
- });
19
- };
20
- /**
21
- * Create a programacion in the web app table.
22
- * @param headers Request headers.
23
- * @param session Session object.
24
- * @param body Programacion data to be created.
25
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
26
- */
27
- export const createProgramacion = (headers, session, body) => {
28
- return handlePossibleAxiosErrors(async () => {
29
- const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
30
- const response = await createWebAppTableRegister(headers, programaciones_webapp_table_id, body);
31
- return response;
32
- });
33
- };
34
- /**
35
- * Delete a programacion from the web app table.
36
- * @param headers Request headers.
37
- * @param session Session object.
38
- * @param id ID of the programacion to be deleted.
39
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
40
- */
41
- export const deleteProgramacion = (headers, session, id) => {
42
- return handlePossibleAxiosErrors(async () => {
43
- const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
44
- const response = await deleteWebAppTableRegister(headers, programaciones_webapp_table_id, Number(id));
45
- return response;
46
- });
47
- };
48
- /**
49
- * Update a programacion in the web app table.
50
- * @param headers Request headers.
51
- * @param session Session object.
52
- * @param id ID of the programacion to be updated.
53
- * @param body Updated programacion data.
54
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
55
- */
56
- export const updateProgramacion = (headers, session, id, body) => {
57
- return handlePossibleAxiosErrors(async () => {
58
- const { programaciones_webapp_table_id } = await getVariablesByName(headers, session, ["programaciones_webapp_table_id"]);
59
- const response = await updateWebAppTableRegister(headers, programaciones_webapp_table_id, Number(id), body);
60
- return response;
61
- });
62
- };
@@ -1,36 +0,0 @@
1
- import { WebAppRowGraphQL, QueueFormReceptionWebAppTable } from "@zauru-sdk/types";
2
- import { Session } from "@remix-run/node";
3
- /**
4
- * Flujo de la función register4pinosReception:
5
- *
6
- * 1. Recibe parámetros como cookie, idWebAppTable, agency_id, values y originApiResponses.
7
- * 2. Inicializa la sesión y los headers.
8
- * 3. Realiza una serie de llamadas API en orden, manejadas por apiResponses.apiCall:
9
- * - Actualiza el estado de la cola de recepción.
10
- * - Valida que no exista una orden de compra con el mismo número.
11
- * - Crea una nueva orden de compra autorizada.
12
- * - Crea una nueva recepción.
13
- * - Realiza un envío de canastas a la agencia.
14
- * - Recibe el envío de canastas.
15
- * - Si no es centro de acopio:
16
- * - Realiza un envío de canastas a control de calidad (si aplica).
17
- * - Recibe el envío de control de calidad.
18
- * - Guarda el rechazo de canastas directo (si aplica).
19
- * - Si es centro de acopio:
20
- * - Guarda los motivos de rechazo (si existen).
21
- * 4. Elimina el registro de la cola al finalizar.
22
- * 5. En caso de error en cualquier paso, actualiza el estado de la cola a ERROR.
23
- *
24
- * La función decide qué camino tomar basándose en:
25
- * - El valor de apiResponses.apiCall para determinar en qué paso está.
26
- * - Si es centro de acopio o no (esCentroDeAcopio).
27
- * - La existencia de canastas de control de calidad (qualityControlBaskets).
28
- * - La presencia de motivos de rechazo para centros de acopio.
29
- */
30
- export declare const register4pinosReception: ({ cookie, idWebAppTable, agency_id, values, originApiResponses, }: any) => Promise<void>;
31
- export declare const retryPO: (register: WebAppRowGraphQL<QueueFormReceptionWebAppTable>, session: Session, headers: any, hostname: string, cookie: string | null) => Promise<{
32
- error: boolean;
33
- title: string;
34
- type: string;
35
- description: string;
36
- }>;
@@ -1,46 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, QueueFormReceptionWebAppTable, WebAppRowGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
- export declare const ESTADOS_COLA_RECEPCIONES: {
4
- INICIADO: string;
5
- EN_PROCESO: string;
6
- ERROR: string;
7
- REINTENTANDO: string;
8
- PENDIENTE_DE_REINTENTO: string;
9
- OFFLINE: string;
10
- };
11
- /**
12
- * Get getQueueFormReceptionHistories from the web app table.
13
- * @param headers Request headers.
14
- * @param session Session object.
15
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
16
- */
17
- export declare const getQueueFormReceptionHistories: (headers: any, session: Session) => Promise<AxiosUtilsResponse<WebAppRowGraphQL<QueueFormReceptionWebAppTable>[]>>;
18
- /**
19
- * Get getQueueFormReceptionHistories from the web app table.
20
- * @param headers Request headers.
21
- * @param session Session object.
22
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
23
- */
24
- export declare const getQueueFormReceptionHistoryByID: (session: Session, id: string | number) => Promise<AxiosUtilsResponse<QueueFormReceptionWebAppTable | null>>;
25
- /**
26
- * Create a template in the web app table.
27
- * @param headers Request headers.
28
- * @param session Session object.
29
- * @param body QueueFormReceptionWebAppTable data to be created.
30
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable>.
31
- */
32
- export declare const createQueueFormReceptionHistory: (headers: any, session: Session, body: QueueFormReceptionWebAppTable) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
33
- /**
34
- * Put updateQueueFormReception from the web app table.
35
- * @param headers Request headers.
36
- * @param session Session object.
37
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
38
- */
39
- export declare const updateQueueFormReceptionHistory: (headers: any, session: Session, body: Partial<QueueFormReceptionWebAppTable>, id_registro: string | number) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
40
- /**
41
- * Delete QueueFormReceptionHistory from the web app table.
42
- * @param headers Request headers.
43
- * @param session Session object.
44
- * @returns A Promise of AxiosUtilsResponse<QueueFormReceptionWebAppTable[]>.
45
- */
46
- export declare const deleteQueueFormReceptionHistory: (headers: any, session: Session, id: string) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
@@ -1,32 +0,0 @@
1
- import { Session } from "@remix-run/node";
2
- import { QueueShipmentsForm } from "@zauru-sdk/types";
3
- import { WebAppRowGraphQL } from "@zauru-sdk/types";
4
- export declare const register4pinosShipment: ({ cookie, idWebAppTable, apiStep, shipment_id, values, }: {
5
- cookie: string;
6
- idWebAppTable: number;
7
- apiStep?: number;
8
- shipment_id?: number;
9
- values: {
10
- booker_id: number;
11
- agency_from_id: number;
12
- transporter_id: number;
13
- planned_shipping: string;
14
- planned_delivery: string;
15
- shipment_reference: string;
16
- agency_to_id: number;
17
- memo?: string;
18
- purchase_orders: {
19
- id: number;
20
- id_number: string;
21
- lot_id: number;
22
- booked_quantity: number;
23
- item_id: number;
24
- }[];
25
- };
26
- }) => Promise<void>;
27
- export declare const retryShipmennt: (register: WebAppRowGraphQL<QueueShipmentsForm>, session: Session, headers: any, hostname: string, cookie: string | null) => Promise<{
28
- error: boolean;
29
- title: string;
30
- type: string;
31
- description: string;
32
- }>;
@@ -1,38 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { AxiosUtilsResponse, QueueShipmentsForm, WebAppRowGraphQL, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
- /**
4
- * Get getQueueShipmentsFormHistories from the web app table.
5
- * @param headers Request headers.
6
- * @param session Session object.
7
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
8
- */
9
- export declare const getQueueShipmentsFormHistories: (headers: any, session: Session) => Promise<AxiosUtilsResponse<WebAppRowGraphQL<QueueShipmentsForm>[]>>;
10
- /**
11
- * Get getQueueShipmentsFormHistories from the web app table.
12
- * @param headers Request headers.
13
- * @param session Session object.
14
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
15
- */
16
- export declare const getQueueShipmentsFormHistoryByID: (session: Session, id: string | number) => Promise<AxiosUtilsResponse<QueueShipmentsForm | null>>;
17
- /**
18
- * Create a template in the web app table.
19
- * @param headers Request headers.
20
- * @param session Session object.
21
- * @param body QueueShipmentsForm data to be created.
22
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm>.
23
- */
24
- export declare const createQueueShipmentsFormHistory: (headers: any, session: Session, body: QueueShipmentsForm) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
25
- /**
26
- * Put updateQueueShipmentsForm from the web app table.
27
- * @param headers Request headers.
28
- * @param session Session object.
29
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
30
- */
31
- export declare const updateQueueShipmentsFormHistory: (headers: any, session: Session, body: Partial<QueueShipmentsForm>, id_registro: string | number) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
32
- /**
33
- * Delete QueueShipmentsFormHistory from the web app table.
34
- * @param headers Request headers.
35
- * @param session Session object.
36
- * @returns A Promise of AxiosUtilsResponse<QueueShipmentsForm[]>.
37
- */
38
- export declare const deleteQueueShipmentsFormHistory: (headers: any, session: Session, id: string) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
@@ -1,34 +0,0 @@
1
- import type { Session } from "@remix-run/node";
2
- import { WebAppRowGraphQL, Programacion, AxiosUtilsResponse, WebAppTableUpdateResponse } from "@zauru-sdk/types";
3
- /**
4
- * Get programaciones from the web app table.
5
- * @param headers Request headers.
6
- * @param session Session object.
7
- * @returns A Promise of AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>.
8
- */
9
- export declare const getProgramaciones: (headers: any, session: Session) => Promise<AxiosUtilsResponse<WebAppRowGraphQL<Programacion>[]>>;
10
- /**
11
- * Create a programacion in the web app table.
12
- * @param headers Request headers.
13
- * @param session Session object.
14
- * @param body Programacion data to be created.
15
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
16
- */
17
- export declare const createProgramacion: (headers: any, session: Session, body: Programacion) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
18
- /**
19
- * Delete a programacion from the web app table.
20
- * @param headers Request headers.
21
- * @param session Session object.
22
- * @param id ID of the programacion to be deleted.
23
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
24
- */
25
- export declare const deleteProgramacion: (headers: any, session: Session, id: string) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;
26
- /**
27
- * Update a programacion in the web app table.
28
- * @param headers Request headers.
29
- * @param session Session object.
30
- * @param id ID of the programacion to be updated.
31
- * @param body Updated programacion data.
32
- * @returns A Promise of AxiosUtilsResponse<WebAppTableUpdateResponse>.
33
- */
34
- export declare const updateProgramacion: (headers: any, session: Session, id: string, body: Partial<Programacion>) => Promise<AxiosUtilsResponse<WebAppTableUpdateResponse>>;