@zauru-sdk/utils 2.0.32 → 2.0.34

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,22 @@ 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
- proccess_step++;
38
39
  if (proccess_step === 2) {
40
+ //PASO 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO
41
+ console.log("========================================>");
42
+ console.log("paso 2: DESPACHAR EL ENVIO -- PONER EN TRANSITO");
43
+ const dispatchShipmentResponse = await despacharShipment_booking(headers, Number(new_shipment_id));
44
+ if (dispatchShipmentResponse.error) {
45
+ throw new Error(`Error al despachar el envío: ${dispatchShipmentResponse.userMsg} con el id: ${new_shipment_id}`);
46
+ }
47
+ }
48
+ proccess_step++;
49
+ if (proccess_step === 3) {
39
50
  //PASO 2: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA
40
51
  console.log("========================================>");
41
- console.log("paso 2: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA");
52
+ console.log("paso 3: COLOCO EL NUMERO DE ENVIO EN TODAS LAS ORDENES DE COMPRA");
42
53
  for (const purchaseOrder of values.purchase_orders) {
43
54
  const response = await updateReceivedPurchaseOrder(headers, {
44
55
  purchase_order: {
@@ -87,6 +98,7 @@ export const retryShipmennt = async (register, session, headers, hostname, cooki
87
98
  cookie: cookie || "",
88
99
  idWebAppTable: register.id,
89
100
  apiStep: register.data?.apiStep,
101
+ shipment_id: register.data?.shipment_id,
90
102
  });
91
103
  }
92
104
  else {
@@ -99,6 +111,7 @@ export const retryShipmennt = async (register, session, headers, hostname, cooki
99
111
  cookie: cookie || "",
100
112
  idWebAppTable: register.id,
101
113
  apiStep: register.data?.apiStep,
114
+ shipment_id: register.data?.shipment_id,
102
115
  }),
103
116
  });
104
117
  }
@@ -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.32",
3
+ "version": "2.0.34",
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.24",
27
+ "@zauru-sdk/common": "^2.0.34",
28
28
  "@zauru-sdk/config": "^2.0.0",
29
- "@zauru-sdk/graphql": "^2.0.32",
30
- "@zauru-sdk/services": "^2.0.32",
31
- "@zauru-sdk/types": "^2.0.24"
29
+ "@zauru-sdk/graphql": "^2.0.33",
30
+ "@zauru-sdk/services": "^2.0.34",
31
+ "@zauru-sdk/types": "^2.0.34"
32
32
  },
33
- "gitHead": "a8ae6ccbcb3c0f52ec84250385dcc9d04008489f"
33
+ "gitHead": "9b063f081fafe1233060df30ebc91461a5d4df06"
34
34
  }