repzo-sap-absjo 1.0.31 → 1.0.33
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/lib/actions/create_invoice.js +1 -0
- package/lib/actions/create_payment.js +2 -2
- package/lib/actions/create_return_invoice.js +1 -0
- package/lib/actions/create_transfer.js +1 -1
- package/lib/commands/price_list.js +2 -2
- package/package.json +1 -1
- package/src/actions/create_invoice.ts +3 -1
- package/src/actions/create_payment.ts +2 -2
- package/src/actions/create_return_invoice.ts +3 -1
- package/src/commands/measureunit.ts +11 -11
- package/src/commands/price_list.ts +3 -3
|
@@ -124,7 +124,7 @@ export const create_payment = async (event, options) => {
|
|
|
124
124
|
);
|
|
125
125
|
});
|
|
126
126
|
if (!repzo_invoice) {
|
|
127
|
-
throw `Invoice with serial number: ${
|
|
127
|
+
throw `Invoice with serial number: ${repzo_inv_serial_number} was not found on Repzo`;
|
|
128
128
|
}
|
|
129
129
|
let sap_open_invoices = [];
|
|
130
130
|
if (repzo_invoice.advanced_serial_number) {
|
|
@@ -150,7 +150,7 @@ export const create_payment = async (event, options) => {
|
|
|
150
150
|
? void 0
|
|
151
151
|
: sap_open_invoices.length)
|
|
152
152
|
) {
|
|
153
|
-
throw `Invoice with serial number: ${
|
|
153
|
+
throw `Invoice with serial number: ${repzo_inv_serial_number} & advance serial number: ${repzo_invoice.advanced_serial_number} was not found on SAP or was closed`;
|
|
154
154
|
}
|
|
155
155
|
sap_payment.InvoiceID = sap_open_invoices[0].InvoiceID;
|
|
156
156
|
sap_payment.InvoiceTotal =
|
|
@@ -271,6 +271,7 @@ export const create_return_invoice = async (event, options) => {
|
|
|
271
271
|
});
|
|
272
272
|
}
|
|
273
273
|
const sap_return_invoice = {
|
|
274
|
+
RepzoSerial: repzo_invoice.serial_number.formatted,
|
|
274
275
|
RefNum:
|
|
275
276
|
repzo_invoice.advanced_serial_number ||
|
|
276
277
|
repzo_invoice.serial_number.formatted,
|
|
@@ -171,7 +171,7 @@ export const create_transfer = async (event, options) => {
|
|
|
171
171
|
? repzo_rep.integration_id
|
|
172
172
|
: (_o = options.data) === null || _o === void 0
|
|
173
173
|
? void 0
|
|
174
|
-
: _o.SalesPersonCode,
|
|
174
|
+
: _o.SalesPersonCode,
|
|
175
175
|
FromWarehouse: body.from.code,
|
|
176
176
|
ToWarehouse: body.to.code,
|
|
177
177
|
RepzoStockTransferLines: variants,
|
|
@@ -475,8 +475,8 @@ export const sync_price_list = async (commandEvent) => {
|
|
|
475
475
|
(repzo_product_uom === null || repzo_product_uom === void 0
|
|
476
476
|
? void 0
|
|
477
477
|
: repzo_product_uom.factor) == 1
|
|
478
|
-
? Math.
|
|
479
|
-
: Math.
|
|
478
|
+
? Math.ceil(item.PLITEMPRICEVALUE * 1000)
|
|
479
|
+
: Math.ceil(
|
|
480
480
|
(item.PLITEMPRICEVALUE * 1000) / repzo_product_uom.factor
|
|
481
481
|
);
|
|
482
482
|
const variant =
|
package/package.json
CHANGED
|
@@ -26,7 +26,8 @@ interface SAPInvoiceItem {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
interface SAPInvoice {
|
|
29
|
-
|
|
29
|
+
RepzoSerial: string; // serial_number.formatted: "INV-1021-4"
|
|
30
|
+
RefNum: string; // advanced_serial_number || serial_number.formatted: "INV-1021-4",
|
|
30
31
|
SalPersCode?: string; // "106", // Required
|
|
31
32
|
DocDate: string; // "20211229",
|
|
32
33
|
DocDueDate: string; // "20211229",
|
|
@@ -285,6 +286,7 @@ export const create_invoice = async (event: EVENT, options: Config) => {
|
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
const sap_invoice: SAPInvoice = {
|
|
289
|
+
RepzoSerial: repzo_invoice.serial_number.formatted,
|
|
288
290
|
RefNum:
|
|
289
291
|
repzo_invoice.advanced_serial_number ||
|
|
290
292
|
repzo_invoice.serial_number.formatted,
|
|
@@ -96,7 +96,7 @@ export const create_payment = async (event: EVENT, options: Config) => {
|
|
|
96
96
|
(inv) => inv.serial_number?.formatted == repzo_inv_serial_number
|
|
97
97
|
);
|
|
98
98
|
if (!repzo_invoice) {
|
|
99
|
-
throw `Invoice with serial number: ${
|
|
99
|
+
throw `Invoice with serial number: ${repzo_inv_serial_number} was not found on Repzo`;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
let sap_open_invoices: SAPOpenInvoice[] = [];
|
|
@@ -115,7 +115,7 @@ export const create_payment = async (event: EVENT, options: Config) => {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
if (!sap_open_invoices?.length) {
|
|
118
|
-
throw `Invoice with serial number: ${
|
|
118
|
+
throw `Invoice with serial number: ${repzo_inv_serial_number} & advance serial number: ${repzo_invoice.advanced_serial_number} was not found on SAP or was closed`;
|
|
119
119
|
}
|
|
120
120
|
sap_payment.InvoiceID = sap_open_invoices[0].InvoiceID;
|
|
121
121
|
sap_payment.InvoiceTotal =
|
|
@@ -19,7 +19,8 @@ interface SAPInvoiceItem {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
interface SAPInvoice {
|
|
22
|
-
|
|
22
|
+
RepzoSerial: string; // serial_number.formatted: "INV-1021-4"
|
|
23
|
+
RefNum: string; // advanced_serial_number || serial_number.formatted: "INV-1021-4",
|
|
23
24
|
SalPersCode?: string; // "106", // Required
|
|
24
25
|
DocDate: string; // "20211229",
|
|
25
26
|
DocDueDate: string; // "20211229",
|
|
@@ -208,6 +209,7 @@ export const create_return_invoice = async (event: EVENT, options: Config) => {
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
const sap_return_invoice: SAPInvoice = {
|
|
212
|
+
RepzoSerial: repzo_invoice.serial_number.formatted,
|
|
211
213
|
RefNum:
|
|
212
214
|
repzo_invoice.advanced_serial_number ||
|
|
213
215
|
repzo_invoice.serial_number.formatted,
|
|
@@ -39,7 +39,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
39
39
|
const commandLog = new Repzo.CommandLog(
|
|
40
40
|
repzo,
|
|
41
41
|
commandEvent.app,
|
|
42
|
-
commandEvent.command
|
|
42
|
+
commandEvent.command
|
|
43
43
|
);
|
|
44
44
|
try {
|
|
45
45
|
// console.log("sync_measureunit");
|
|
@@ -64,7 +64,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
64
64
|
|
|
65
65
|
const sap_UoMs: SAPUoM[] = await get_sap_UoMs(
|
|
66
66
|
commandEvent.app.formData.sapHostUrl,
|
|
67
|
-
{}
|
|
67
|
+
{}
|
|
68
68
|
);
|
|
69
69
|
result.sap_total = sap_UoMs?.length;
|
|
70
70
|
|
|
@@ -116,10 +116,10 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
116
116
|
if (max_unit.sap_product_UoMs.length > 1) {
|
|
117
117
|
const PC = max_unit.sap_product_UoMs.find((u) => u.ALTUOMCODE == "PC");
|
|
118
118
|
const POUCH = max_unit.sap_product_UoMs.find(
|
|
119
|
-
(u) => u.ALTUOMCODE == "POUCH"
|
|
119
|
+
(u) => u.ALTUOMCODE == "POUCH"
|
|
120
120
|
);
|
|
121
121
|
const CARD = max_unit.sap_product_UoMs.find(
|
|
122
|
-
(u) => u.ALTUOMCODE == "CARD"
|
|
122
|
+
(u) => u.ALTUOMCODE == "CARD"
|
|
123
123
|
);
|
|
124
124
|
max_unit.default_unit = PC || POUCH || CARD;
|
|
125
125
|
|
|
@@ -135,7 +135,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
135
135
|
max_unit?.sap_product_UoMs[0]?.ITEMCODE || units[0]?.ITEMCODE,
|
|
136
136
|
doc: units,
|
|
137
137
|
error_message: set_error(
|
|
138
|
-
`Create/Update Measure Unit Failed >> ${max_unit?.sap_product_UoMs[0]?.ITEMCODE} Could not found the base_unit
|
|
138
|
+
`Create/Update Measure Unit Failed >> ${max_unit?.sap_product_UoMs[0]?.ITEMCODE} Could not found the base_unit`
|
|
139
139
|
),
|
|
140
140
|
});
|
|
141
141
|
result.failed++;
|
|
@@ -177,7 +177,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
177
177
|
const repzo_UoM = repzo_UoMs.data.find(
|
|
178
178
|
(r_UoM) =>
|
|
179
179
|
r_UoM.integration_meta?.id ==
|
|
180
|
-
`${nameSpace}_${sap_UoM.ITEMCODE}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}
|
|
180
|
+
`${nameSpace}_${sap_UoM.ITEMCODE}_${sap_UoM.UOMGROUPENTRY}_${sap_UoM.ALTUOMID}`
|
|
181
181
|
);
|
|
182
182
|
|
|
183
183
|
const body:
|
|
@@ -200,7 +200,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
200
200
|
// Create
|
|
201
201
|
try {
|
|
202
202
|
const created_UoM = await repzo.measureunit.create(
|
|
203
|
-
body as Service.MeasureUnit.Create.Body
|
|
203
|
+
body as Service.MeasureUnit.Create.Body
|
|
204
204
|
);
|
|
205
205
|
result.created++;
|
|
206
206
|
} catch (e: any) {
|
|
@@ -225,7 +225,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
225
225
|
try {
|
|
226
226
|
const updated_UoM = await repzo.measureunit.update(
|
|
227
227
|
repzo_UoM._id,
|
|
228
|
-
body as Service.MeasureUnit.Update.Body
|
|
228
|
+
body as Service.MeasureUnit.Update.Body
|
|
229
229
|
);
|
|
230
230
|
result.updated++;
|
|
231
231
|
} catch (e: any) {
|
|
@@ -251,12 +251,12 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
251
251
|
repzo,
|
|
252
252
|
commandEvent.app._id,
|
|
253
253
|
bench_time_key,
|
|
254
|
-
new_bench_time
|
|
254
|
+
new_bench_time
|
|
255
255
|
);
|
|
256
256
|
await commandLog
|
|
257
257
|
.setStatus(
|
|
258
258
|
"success",
|
|
259
|
-
failed_docs_report.length ? failed_docs_report : null
|
|
259
|
+
failed_docs_report.length ? failed_docs_report : null
|
|
260
260
|
)
|
|
261
261
|
.setBody(result)
|
|
262
262
|
.commit();
|
|
@@ -271,7 +271,7 @@ export const sync_measureunit = async (commandEvent: CommandEvent) => {
|
|
|
271
271
|
|
|
272
272
|
export const get_sap_UoMs = async (
|
|
273
273
|
serviceEndPoint: string,
|
|
274
|
-
query?: { updateAt?: string }
|
|
274
|
+
query?: { updateAt?: string }
|
|
275
275
|
): Promise<SAPUoM[]> => {
|
|
276
276
|
try {
|
|
277
277
|
const sap_UoMs: SAPUoMs = await _create(serviceEndPoint, "/Uom", {
|
|
@@ -344,13 +344,13 @@ export const sync_price_list = async (commandEvent: CommandEvent) => {
|
|
|
344
344
|
|
|
345
345
|
const price =
|
|
346
346
|
repzo_product_uom && repzo_product_uom?.factor == 1
|
|
347
|
-
? Math.
|
|
348
|
-
: Math.
|
|
347
|
+
? Math.ceil(item.PLITEMPRICEVALUE * 1000)
|
|
348
|
+
: Math.ceil(
|
|
349
349
|
(item.PLITEMPRICEVALUE * 1000) / repzo_product_uom.factor
|
|
350
350
|
);
|
|
351
351
|
|
|
352
352
|
const variant = repzo_product?.variants?.find(
|
|
353
|
-
(variant) =>
|
|
353
|
+
(variant: any) =>
|
|
354
354
|
variant?.integration_meta?.id == `${nameSpace}_${item.PLITEMID}`
|
|
355
355
|
);
|
|
356
356
|
if (!variant) {
|