@zauru-sdk/utils 2.0.33 → 2.0.35

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.
@@ -1,10 +1,11 @@
1
- import { getHeaders, getSession, insertBookings, updateReceivedPurchaseOrder, } from "@zauru-sdk/services";
1
+ import { despacharShipment_booking, getHeaders, getSession, insertBookings, updateReceivedPurchaseOrder, } from "@zauru-sdk/services";
2
2
  import { deleteQueueShipmentsFormHistory, updateQueueShipmentsFormHistory, } from "./4pinos-shipments-form-history.utils.js";
3
3
  import { ESTADOS_COLA_RECEPCIONES } from "./4pinos-receptions-form-history.utils.js";
4
- export const register4pinosShipment = async ({ cookie, idWebAppTable, apiStep, values, }) => {
4
+ export const register4pinosShipment = async ({ cookie, idWebAppTable, apiStep, shipment_id, values, }) => {
5
5
  const session = await getSession(cookie);
6
6
  const headers = await getHeaders(cookie, session);
7
7
  let proccess_step = apiStep ?? 1;
8
+ let new_shipment_id = shipment_id ?? undefined;
8
9
  try {
9
10
  //TODO: VERIFICAR SI EL ENVIO YA EXISTE
10
11
  if (proccess_step === 1) {
@@ -33,12 +34,23 @@ export const register4pinosShipment = async ({ cookie, idWebAppTable, apiStep, v
33
34
  if (createBookingResponse.error) {
34
35
  throw new Error(`Error al crear el envío: ${createBookingResponse.userMsg} con el body: ${JSON.stringify(shipmentBody)}`);
35
36
  }
37
+ new_shipment_id = createBookingResponse.data?.id;
36
38
  }
37
39
  proccess_step++;
38
40
  if (proccess_step === 2) {
41
+ //PASO 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO
42
+ console.log("========================================>");
43
+ console.log("paso 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO");
44
+ const dispatchShipmentResponse = await despacharShipment_booking(headers, Number(new_shipment_id));
45
+ if (dispatchShipmentResponse.error) {
46
+ throw new Error(`Error al despachar el envío: ${dispatchShipmentResponse.userMsg} con el id: ${new_shipment_id}`);
47
+ }
48
+ }
49
+ proccess_step++;
50
+ if (proccess_step === 3) {
39
51
  //PASO 2: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA
40
52
  console.log("========================================>");
41
- console.log("paso 2: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA");
53
+ console.log("paso 3: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA");
42
54
  for (const purchaseOrder of values.purchase_orders) {
43
55
  const response = await updateReceivedPurchaseOrder(headers, {
44
56
  purchase_order: {
@@ -87,6 +99,7 @@ export const retryShipmennt = async (register, session, headers, hostname, cooki
87
99
  cookie: cookie || "",
88
100
  idWebAppTable: register.id,
89
101
  apiStep: register.data?.apiStep,
102
+ shipment_id: register.data?.shipment_id,
90
103
  });
91
104
  }
92
105
  else {
@@ -99,6 +112,7 @@ export const retryShipmennt = async (register, session, headers, hostname, cooki
99
112
  cookie: cookie || "",
100
113
  idWebAppTable: register.id,
101
114
  apiStep: register.data?.apiStep,
115
+ shipment_id: register.data?.shipment_id,
102
116
  }),
103
117
  });
104
118
  }
@@ -1,10 +1,11 @@
1
1
  import { Session } from "@remix-run/node";
2
2
  import { QueueShipmentsForm } from "@zauru-sdk/types";
3
3
  import { WebAppRowGraphQL } from "@zauru-sdk/types";
4
- export declare const register4pinosShipment: ({ cookie, idWebAppTable, apiStep, values, }: {
4
+ export declare const register4pinosShipment: ({ cookie, idWebAppTable, apiStep, shipment_id, values, }: {
5
5
  cookie: string;
6
6
  idWebAppTable: number;
7
7
  apiStep?: number;
8
+ shipment_id?: number;
8
9
  values: {
9
10
  booker_id: number;
10
11
  agency_from_id: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/utils",
3
- "version": "2.0.33",
3
+ "version": "2.0.35",
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",
@@ -24,11 +24,11 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@remix-run/node": "^2.8.1",
27
- "@zauru-sdk/common": "^2.0.33",
27
+ "@zauru-sdk/common": "^2.0.34",
28
28
  "@zauru-sdk/config": "^2.0.0",
29
29
  "@zauru-sdk/graphql": "^2.0.33",
30
- "@zauru-sdk/services": "^2.0.33",
31
- "@zauru-sdk/types": "^2.0.33"
30
+ "@zauru-sdk/services": "^2.0.35",
31
+ "@zauru-sdk/types": "^2.0.34"
32
32
  },
33
- "gitHead": "16838516924a5b98ef2fdf89ec46881451b9589b"
33
+ "gitHead": "5736aff4b853109557c218e2757d3b607aaf32f8"
34
34
  }