@feedmepos/mf-inventory-portal 1.2.36 → 1.2.37-dev.2
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/{App-CoRV0uPu.js → App-BNC_VGLY.js} +3 -3
- package/dist/{ApprovalView-D1RJwuTs.js → ApprovalView-C3-qwfBy.js} +5 -5
- package/dist/{BindingsDialog-DIjYRaBX.js → BindingsDialog-DJYcwvLj.js} +2 -2
- package/dist/{BindingsPicker-DWzm6wUk.js → BindingsPicker-BfjaThga.js} +2 -2
- package/dist/{BindingsTable-Cgt_1URn.js → BindingsTable-CxsJ7J29.js} +3 -3
- package/dist/{ClosingDraftView-BtmTem1i.js → ClosingDraftView-lWH-HNt8.js} +8 -8
- package/dist/ClosingHistoryView-tDq0ShBo.js +391 -0
- package/dist/{ClosingTemplateView-DldPeva3.js → ClosingTemplateView-VDIoPSGE.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-CN1ISr0X.js → DeliveryOrderPrintPreview-BB57thjw.js} +9 -9
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ClqAKJw7.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BFJquom_.js} +17 -17
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-C4h5BXYx.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D6nFHej1.js} +2 -2
- package/dist/{FmMultiselectDialog-C7l2zdfp.js → FmMultiselectDialog-ByhflquX.js} +2 -2
- package/dist/{FmMultiselectDialog-Dm6KX3jk.js → FmMultiselectDialog-pbQjC6ox.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C7SxuBsK.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BVkl9ATd.js} +3 -3
- package/dist/{ImportView-DoeGZffY.js → ImportView-BESMNYR1.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CiK769eN.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-6nCLOWwx.js} +1 -1
- package/dist/{IngredientGroupView-CAGoKjAQ.js → IngredientGroupView-JdgXfEsA.js} +5 -5
- package/dist/{IngredientsView-CqiVcl6C.js → IngredientsView-Btcmhy3H.js} +14 -14
- package/dist/IntegrationView-CxHNZ7E3.js +4488 -0
- package/dist/{InventoryBindingForm-ABaQrODH.js → InventoryBindingForm-CpLif5mq.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CCkqGDgP.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B2AQxOn1.js} +4 -4
- package/dist/{InventoryBindingSummary-NKnKZi6q.js → InventoryBindingSummary-DGBAel1C.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CgYH09wF.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-oQlPxFAX.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CB1g11Ll.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DuWFQ6Q0.js} +2 -2
- package/dist/{PublishView-DksyQG3l.js → PublishView-C-UiGWym.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-03pZKACn.js → PurchaseOrderPrintPreview-mO_oxnft.js} +10 -10
- package/dist/{ReceiveRequestView-BeQfTd9r.js → ReceiveRequestView-Cr6Xrv4Q.js} +19 -19
- package/dist/{RecipeView-ifhPuBGA.js → RecipeView-Bk9O5UiN.js} +8 -8
- package/dist/{StockView-DedXRTWx.js → StockView-C2op154q.js} +15 -15
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-ChlgF_bk.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CntpgdYL.js} +1 -1
- package/dist/{SupplierView-CrfsfuOf.js → SupplierView-2qjnAlnU.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Csi6RdZv.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DqdgsUES.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BAkZOh6P.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CbSWd397.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Drtj7Kd3.js → TransferDetails.vue_vue_type_script_setup_true_lang-U5KJ5_b2.js} +14 -14
- package/dist/{TransferTemplateView-BhdAu8px.js → TransferTemplateView-Dw4Ukcce.js} +15 -15
- package/dist/{UnitView-BiSvzbL6.js → UnitView-H4Sgdzg5.js} +6 -6
- package/dist/{WarehouseView-Dhi2uxnP.js → WarehouseView-DzR1A-Cr.js} +5 -5
- package/dist/{WastageTemplateView-DkvpRveY.js → WastageTemplateView-Sb2KtrF3.js} +14 -14
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/netsuite.d.ts +96 -3
- package/dist/{app-Bwm5cx2b.js → app-Cnok7m8q.js} +3735 -3731
- package/dist/app.js +1 -1
- package/dist/{closing-template-kl2L1-wG.js → closing-template-u2ACSj7R.js} +1 -1
- package/dist/{date2-BkJijdu3.js → date2-DtnfdJTF.js} +1 -1
- package/dist/{dayjs.min-CHim5Kj5.js → dayjs.min-DcraCntx.js} +1 -1
- package/dist/{decimal-D6edjUO7.js → decimal-CIJMix9a.js} +2 -2
- package/dist/{defineDeepModel-Be2-pkT1.js → defineDeepModel-LcFLGZe5.js} +1 -1
- package/dist/{duplicate-template-DmG9P6zh.js → duplicate-template-Btr1_Yzf.js} +1 -1
- package/dist/{feature-BVjxI6j1.js → feature-DSy7PE3I.js} +2 -2
- package/dist/{format-time-from-id-F6jt6fTo.js → format-time-from-id-Dh_SXggJ.js} +1 -1
- package/dist/{format-unit-display-BPfoIQ5l.js → format-unit-display-BZ9AAp4V.js} +10 -10
- package/dist/{import-export.helper-CH-D34oH.js → import-export.helper-C3aWPNyJ.js} +5 -5
- package/dist/{index-DRQQwiwn.js → index-BTM5svgh.js} +1 -1
- package/dist/{index-Bgc84muo.js → index-DbWKRddg.js} +3 -3
- package/dist/{index-eJWoHNdw.js → index-eN7NxI-_.js} +1 -1
- package/dist/{lodash-C24hnHyT.js → lodash-DUlA5LSE.js} +1 -1
- package/dist/{netsuite-BhH6M8jR.js → netsuite-ekrD_FS6.js} +961 -928
- package/dist/{purchase-order-template-1sBeg568.js → purchase-order-template-C4S6XRoE.js} +1 -1
- package/dist/{rules-CCd7mYLv.js → rules-Buw1aczb.js} +3 -3
- package/dist/{stock-BWS0ZS6g.js → stock-CLvc2DUC.js} +3 -3
- package/dist/{stock-rD5kj1QP.js → stock-DqZP0ldB.js} +1 -1
- package/dist/stores/integration/netsuite.d.ts +13 -0
- package/dist/{supplier-BbyOdDkm.js → supplier-BA4riI7a.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-B5qh-1pZ.js → use-ingredient-select-dialog-BFI0Mdnw.js} +2 -2
- package/dist/{use-inventory-binding-dialog-Dvhw3xKV.js → use-inventory-binding-dialog-BIqgx607.js} +2 -2
- package/dist/{use-template-enabled-locations-2-CXYSdKKV.js → use-template-enabled-locations-2-CyBo9a3I.js} +2 -2
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +743 -0
- package/dist/views/integration/components/netsuite/business/NetSuiteVendorField.vue.d.ts +73 -0
- package/dist/{vue-i18n-CKCDKj-z.js → vue-i18n-C62Txccp.js} +341 -341
- package/dist/{xlsx-CHsCI3Ao.js → xlsx-Cmu71X0Z.js} +1 -1
- package/dist/{xlsx.util-BgpaGhEM.js → xlsx.util-DI9MSTQE.js} +1 -1
- package/package.json +3 -3
- package/dist/ClosingHistoryView-Ao3Hm8IY.js +0 -367
- package/dist/IntegrationView-DBoAg8xQ.js +0 -4069
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { m as e, V as jt, W as Vt, X as Bt, Y as qt, Z as je, _ as Ht, $ as Be,
|
|
1
|
+
import { m as e, V as jt, W as Vt, X as Bt, Y as qt, Z as je, _ as Ht, $ as Be, M as qe, a0 as bt, a1 as St, a2 as O, a3 as R, s as A, e as ve, a4 as Re, A as ee, z as ie, a5 as Kt, K as j, a6 as vt, N as V, a7 as Yt, a8 as Gt, a9 as Jt, aa as Qe, ab as zt, o as Qt, j as Wt, t as dt, a as Zt, u as Ce } from "./app-Cnok7m8q.js";
|
|
2
2
|
import { useCoreStore as Me } from "@feedmepos/mf-common";
|
|
3
3
|
import { useSnackbar as Xt } from "@feedmepos/ui-library";
|
|
4
|
-
import { _ as L } from "./lodash-
|
|
5
|
-
import { defineComponent as en, ref as He, computed as
|
|
6
|
-
import { u as rn } from "./feature-
|
|
7
|
-
var on = Object.defineProperty,
|
|
4
|
+
import { _ as L } from "./lodash-DUlA5LSE.js";
|
|
5
|
+
import { defineComponent as en, ref as He, computed as me, resolveComponent as ke, openBlock as z, createBlock as tn, withCtx as re, createVNode as oe, createElementVNode as M, createElementBlock as ae, Fragment as Oe, createCommentVNode as Ae, createTextVNode as Q, toDisplayString as x, renderList as nn, unref as ct, h as sn } from "vue";
|
|
6
|
+
import { u as rn } from "./feature-DSy7PE3I.js";
|
|
7
|
+
var on = Object.defineProperty, g = (r, a) => on(r, "name", { value: a, configurable: !0 }), he = "MYR";
|
|
8
8
|
e.enum([
|
|
9
9
|
"custbody_fm_do_id",
|
|
10
10
|
"custbody_fm_po_request_id",
|
|
@@ -21,8 +21,8 @@ e.enum([
|
|
|
21
21
|
"custcol_fm_line_id"
|
|
22
22
|
]);
|
|
23
23
|
var Ke;
|
|
24
|
-
(function(
|
|
25
|
-
|
|
24
|
+
(function(r) {
|
|
25
|
+
r[r.Create = 0] = "Create", r[r.Set = 1] = "Set", r[r.Unset = 2] = "Unset", r[r.Change = 3] = "Change";
|
|
26
26
|
})(Ke || (Ke = {}));
|
|
27
27
|
e.nativeEnum(Ke);
|
|
28
28
|
e.enum([
|
|
@@ -331,8 +331,8 @@ e.object({
|
|
|
331
331
|
custbody_fm_po_num: e.number()
|
|
332
332
|
});
|
|
333
333
|
var De;
|
|
334
|
-
(function(
|
|
335
|
-
|
|
334
|
+
(function(r) {
|
|
335
|
+
r.A = "Pending Supervisor Approval", r.B = "Approved by Supervisor/Pending Receipt", r.C = "Rejected", r.D = "Partially Received", r.E = "Pending Billing/Partially Received", r.F = "Approved by Supervisor/Pending Bill", r.G = "Fully Billed", r.H = "Closed";
|
|
336
336
|
})(De || (De = {}));
|
|
337
337
|
var X = e.nativeEnum(De), In = e.object({
|
|
338
338
|
amount: e.number().nullish(),
|
|
@@ -401,7 +401,7 @@ var pn = e.object({
|
|
|
401
401
|
custcol_pkt_code: e.string().nullish(),
|
|
402
402
|
custcol_pkt_name: e.string().nullish(),
|
|
403
403
|
externalId: e.string().nullish()
|
|
404
|
-
}),
|
|
404
|
+
}), gn = e.object({
|
|
405
405
|
item: e.object({
|
|
406
406
|
id: e.string()
|
|
407
407
|
}),
|
|
@@ -447,16 +447,16 @@ e.object({
|
|
|
447
447
|
}).optional(),
|
|
448
448
|
trandate: e.string().nullish(),
|
|
449
449
|
item: e.object({
|
|
450
|
-
items: e.array(
|
|
450
|
+
items: e.array(gn)
|
|
451
451
|
}).optional(),
|
|
452
452
|
custbody_fm_po_request_id: e.string(),
|
|
453
453
|
custbody_fm_po_num: e.number()
|
|
454
454
|
});
|
|
455
455
|
var k;
|
|
456
|
-
(function(
|
|
457
|
-
|
|
456
|
+
(function(r) {
|
|
457
|
+
r.A = "Pending Approval", r.B = "Pending Fulfillment", r.C = "Rejected", r.D = "Partially Fulfilled", r.E = "Pending Receipt/Partially Fulfilled", r.F = "Pending Receipt", r.G = "Received", r.H = "Closed";
|
|
458
458
|
})(k || (k = {}));
|
|
459
|
-
var
|
|
459
|
+
var de = e.nativeEnum(k), En = e.object({
|
|
460
460
|
abbreviation: e.string(),
|
|
461
461
|
baseUnit: e.boolean(),
|
|
462
462
|
conversionRate: e.number(),
|
|
@@ -472,7 +472,7 @@ e.object({
|
|
|
472
472
|
lastModifiedDate: e.string(),
|
|
473
473
|
name: e.string(),
|
|
474
474
|
uom: e.object({
|
|
475
|
-
items: e.array(
|
|
475
|
+
items: e.array(En),
|
|
476
476
|
totalResults: e.number()
|
|
477
477
|
})
|
|
478
478
|
});
|
|
@@ -615,6 +615,12 @@ e.object({
|
|
|
615
615
|
refName: e.string()
|
|
616
616
|
})
|
|
617
617
|
});
|
|
618
|
+
e.object({
|
|
619
|
+
netsuiteId: e.string(),
|
|
620
|
+
name: e.string(),
|
|
621
|
+
subsidiaryName: e.string(),
|
|
622
|
+
subsidiaryId: e.string()
|
|
623
|
+
});
|
|
618
624
|
e.enum([
|
|
619
625
|
"unitstype",
|
|
620
626
|
"transferorder",
|
|
@@ -629,7 +635,8 @@ e.object({
|
|
|
629
635
|
recordId: e.string(),
|
|
630
636
|
recordType: e.string(),
|
|
631
637
|
accountId: e.string(),
|
|
632
|
-
source: e.string().nullish()
|
|
638
|
+
source: e.string().nullish(),
|
|
639
|
+
metadata: e.record(e.any()).nullish()
|
|
633
640
|
});
|
|
634
641
|
var bn = e.object({
|
|
635
642
|
adjustQtyBy: e.number().positive(),
|
|
@@ -862,24 +869,24 @@ e.object({
|
|
|
862
869
|
/// custom fields
|
|
863
870
|
externalId: e.string().nullish()
|
|
864
871
|
});
|
|
865
|
-
function Ze(
|
|
866
|
-
return
|
|
872
|
+
function Ze(r) {
|
|
873
|
+
return Re.FCurrency.safeParse(r.trim().toUpperCase()).success;
|
|
867
874
|
}
|
|
868
|
-
|
|
875
|
+
g(Ze, "isCurrencySupported");
|
|
869
876
|
var lt;
|
|
870
|
-
(function(
|
|
877
|
+
(function(r) {
|
|
871
878
|
(function(a) {
|
|
872
|
-
function u(
|
|
879
|
+
function u(s, t) {
|
|
873
880
|
var v, C;
|
|
874
|
-
const { nsAssemblyItem: n, fmUnit: i, nsUnitTypeConfig: o } =
|
|
881
|
+
const { nsAssemblyItem: n, fmUnit: i, nsUnitTypeConfig: o } = s;
|
|
875
882
|
if (!n.unitsType)
|
|
876
883
|
throw new Error(`Missing unit type in NetSuite assembly item ${n.id}`);
|
|
877
884
|
if (o.netSuiteId !== n.unitsType.id)
|
|
878
885
|
throw new Error(`Unit type mismatch for NetSuite assembly item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${o.netSuiteId}`);
|
|
879
|
-
const m = n.subsidiary.items.map((N) => N.id), l =
|
|
880
|
-
prefix:
|
|
886
|
+
const m = n.subsidiary.items.map((N) => N.id), l = O({
|
|
887
|
+
prefix: R.Enum.sku
|
|
881
888
|
}), f = (v = t == null ? void 0 : t.netsuiteCustomAttributes) == null ? void 0 : v.reduce((N, b) => {
|
|
882
|
-
const D = b.compute(
|
|
889
|
+
const D = b.compute(s);
|
|
883
890
|
return {
|
|
884
891
|
...N,
|
|
885
892
|
[b.fieldId]: D
|
|
@@ -896,12 +903,12 @@ var lt;
|
|
|
896
903
|
I = b;
|
|
897
904
|
}
|
|
898
905
|
const p = (C = t == null ? void 0 : t.overrideAttributes) == null ? void 0 : C.reduce((N, b) => {
|
|
899
|
-
const D = b.compute(
|
|
906
|
+
const D = b.compute(s);
|
|
900
907
|
return {
|
|
901
908
|
...N,
|
|
902
909
|
[b.fieldId]: D
|
|
903
910
|
};
|
|
904
|
-
}, {}),
|
|
911
|
+
}, {}), E = n.currency.refName.trim().toUpperCase(), y = n.cost ?? n.lastPurchasePrice, _ = {
|
|
905
912
|
_id: l,
|
|
906
913
|
name: n.itemId,
|
|
907
914
|
code: n.id,
|
|
@@ -915,7 +922,7 @@ var lt;
|
|
|
915
922
|
measurement: I
|
|
916
923
|
},
|
|
917
924
|
costPerUnit: {
|
|
918
|
-
currency: Ze(
|
|
925
|
+
currency: Ze(E) ? E : he,
|
|
919
926
|
...A.fromNumber(y)
|
|
920
927
|
}
|
|
921
928
|
} : null,
|
|
@@ -941,16 +948,16 @@ var lt;
|
|
|
941
948
|
}
|
|
942
949
|
};
|
|
943
950
|
}
|
|
944
|
-
|
|
945
|
-
function c(
|
|
951
|
+
g(u, "transformAsParent"), a.transformAsParent = u;
|
|
952
|
+
function c(s, t) {
|
|
946
953
|
var f;
|
|
947
|
-
const { nsAssemblyItem: n, nsUnitTypeConfig: i } =
|
|
954
|
+
const { nsAssemblyItem: n, nsUnitTypeConfig: i } = s;
|
|
948
955
|
if (!n.unitsType)
|
|
949
956
|
throw new Error(`Missing unit type in NetSuite assembly child item ${n.id}`);
|
|
950
957
|
if (i.netSuiteId !== n.unitsType.id)
|
|
951
958
|
throw new Error(`Unit type mismatch for NetSuite assembly child item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${i.netSuiteId}`);
|
|
952
959
|
const o = n.subsidiary.items.map((d) => d.id), m = (f = t == null ? void 0 : t.netsuiteCustomAttributes) == null ? void 0 : f.reduce((d, I) => {
|
|
953
|
-
const p = I.compute(
|
|
960
|
+
const p = I.compute(s);
|
|
954
961
|
return {
|
|
955
962
|
...d,
|
|
956
963
|
[I.fieldId]: p
|
|
@@ -976,11 +983,11 @@ var lt;
|
|
|
976
983
|
}
|
|
977
984
|
};
|
|
978
985
|
}
|
|
979
|
-
|
|
980
|
-
})(
|
|
986
|
+
g(c, "transformAsChild"), a.transformAsChild = c;
|
|
987
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
981
988
|
})(lt || (lt = {}));
|
|
982
|
-
function Dt(
|
|
983
|
-
switch (
|
|
989
|
+
function Dt(r) {
|
|
990
|
+
switch (r.costingMethod.id) {
|
|
984
991
|
case "FIFO":
|
|
985
992
|
return ve.Enum.FIFO;
|
|
986
993
|
case "LIFO":
|
|
@@ -989,21 +996,21 @@ function Dt(s) {
|
|
|
989
996
|
return ve.Enum.WAVG;
|
|
990
997
|
}
|
|
991
998
|
}
|
|
992
|
-
|
|
999
|
+
g(Dt, "_getValuation");
|
|
993
1000
|
var mt;
|
|
994
|
-
(function(
|
|
1001
|
+
(function(r) {
|
|
995
1002
|
(function(a) {
|
|
996
|
-
function u(
|
|
1003
|
+
function u(s, t) {
|
|
997
1004
|
var v, C;
|
|
998
|
-
const { nsInventoryItem: n, fmUnit: i, nsUnitTypeConfig: o } =
|
|
1005
|
+
const { nsInventoryItem: n, fmUnit: i, nsUnitTypeConfig: o } = s;
|
|
999
1006
|
if (!n.unitsType)
|
|
1000
1007
|
throw new Error(`Missing unit type in NetSuite inventory item ${n.id}`);
|
|
1001
1008
|
if (o.netSuiteId !== n.unitsType.id)
|
|
1002
1009
|
throw new Error(`Unit type mismatch for NetSuite inventory item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${o.netSuiteId}`);
|
|
1003
|
-
const m = n.subsidiary.items.map((N) => N.id), l =
|
|
1004
|
-
prefix:
|
|
1010
|
+
const m = n.subsidiary.items.map((N) => N.id), l = O({
|
|
1011
|
+
prefix: R.Enum.sku
|
|
1005
1012
|
}), f = (v = t == null ? void 0 : t.netsuiteCustomAttributes) == null ? void 0 : v.reduce((N, b) => {
|
|
1006
|
-
const D = b.compute(
|
|
1013
|
+
const D = b.compute(s);
|
|
1007
1014
|
return {
|
|
1008
1015
|
...N,
|
|
1009
1016
|
[b.fieldId]: D
|
|
@@ -1020,12 +1027,12 @@ var mt;
|
|
|
1020
1027
|
I = b;
|
|
1021
1028
|
}
|
|
1022
1029
|
const p = (C = t == null ? void 0 : t.overrideAttributes) == null ? void 0 : C.reduce((N, b) => {
|
|
1023
|
-
const D = b.compute(
|
|
1030
|
+
const D = b.compute(s);
|
|
1024
1031
|
return {
|
|
1025
1032
|
...N,
|
|
1026
1033
|
[b.fieldId]: D
|
|
1027
1034
|
};
|
|
1028
|
-
}, {}),
|
|
1035
|
+
}, {}), E = n.currency.refName.trim().toUpperCase(), y = n.cost, _ = {
|
|
1029
1036
|
_id: l,
|
|
1030
1037
|
name: n.itemId,
|
|
1031
1038
|
code: n.id,
|
|
@@ -1039,7 +1046,7 @@ var mt;
|
|
|
1039
1046
|
measurement: I
|
|
1040
1047
|
},
|
|
1041
1048
|
costPerUnit: {
|
|
1042
|
-
currency: Ze(
|
|
1049
|
+
currency: Ze(E) ? E : he,
|
|
1043
1050
|
...A.fromNumber(y)
|
|
1044
1051
|
}
|
|
1045
1052
|
} : null,
|
|
@@ -1065,16 +1072,16 @@ var mt;
|
|
|
1065
1072
|
}
|
|
1066
1073
|
};
|
|
1067
1074
|
}
|
|
1068
|
-
|
|
1069
|
-
function c(
|
|
1075
|
+
g(u, "transformAsParent"), a.transformAsParent = u;
|
|
1076
|
+
function c(s, t) {
|
|
1070
1077
|
var f;
|
|
1071
|
-
const { nsInventoryItem: n, nsUnitTypeConfig: i } =
|
|
1078
|
+
const { nsInventoryItem: n, nsUnitTypeConfig: i } = s;
|
|
1072
1079
|
if (!n.unitsType)
|
|
1073
1080
|
throw new Error(`Missing unit type in NetSuite inventory child item ${n.id}`);
|
|
1074
1081
|
if (i.netSuiteId !== n.unitsType.id)
|
|
1075
1082
|
throw new Error(`Unit type mismatch for NetSuite inventory child item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${i.netSuiteId}`);
|
|
1076
1083
|
const o = n.subsidiary.items.map((d) => d.id), m = (f = t == null ? void 0 : t.netsuiteCustomAttributes) == null ? void 0 : f.reduce((d, I) => {
|
|
1077
|
-
const p = I.compute(
|
|
1084
|
+
const p = I.compute(s);
|
|
1078
1085
|
return {
|
|
1079
1086
|
...d,
|
|
1080
1087
|
[I.fieldId]: p
|
|
@@ -1100,11 +1107,11 @@ var mt;
|
|
|
1100
1107
|
}
|
|
1101
1108
|
};
|
|
1102
1109
|
}
|
|
1103
|
-
|
|
1104
|
-
})(
|
|
1110
|
+
g(c, "transformAsChild"), a.transformAsChild = c;
|
|
1111
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
1105
1112
|
})(mt || (mt = {}));
|
|
1106
|
-
function Nt(
|
|
1107
|
-
switch (
|
|
1113
|
+
function Nt(r) {
|
|
1114
|
+
switch (r.costingMethod.id) {
|
|
1108
1115
|
case "FIFO":
|
|
1109
1116
|
return ve.Enum.FIFO;
|
|
1110
1117
|
case "LIFO":
|
|
@@ -1113,32 +1120,32 @@ function Nt(s) {
|
|
|
1113
1120
|
return ve.Enum.WAVG;
|
|
1114
1121
|
}
|
|
1115
1122
|
}
|
|
1116
|
-
|
|
1117
|
-
function Xe(
|
|
1118
|
-
let c = 0,
|
|
1119
|
-
const t =
|
|
1123
|
+
g(Nt, "_getValuation");
|
|
1124
|
+
function Xe(r, a, u) {
|
|
1125
|
+
let c = 0, s = he;
|
|
1126
|
+
const t = r == null ? void 0 : r.find((n) => n.itemid === u && n.hascostline === "T" && n.transactionline === a);
|
|
1120
1127
|
if (t) {
|
|
1121
|
-
const n =
|
|
1122
|
-
n && (c = Number(n.amount), n.isocurrency && (
|
|
1128
|
+
const n = r == null ? void 0 : r.find((i) => i.itemid === u && Number(i.amount) > 0 && i.transactionline === String(Number(t.transactionline) + 1));
|
|
1129
|
+
n && (c = Number(n.amount), n.isocurrency && (s = n.isocurrency));
|
|
1123
1130
|
} else {
|
|
1124
|
-
const n =
|
|
1125
|
-
n && (c = Number(n.amount), n.isocurrency && (
|
|
1131
|
+
const n = r == null ? void 0 : r.find((i) => i.itemid === u);
|
|
1132
|
+
n && (c = Number(n.amount), n.isocurrency && (s = n.isocurrency));
|
|
1126
1133
|
}
|
|
1127
1134
|
return {
|
|
1128
1135
|
cost: c,
|
|
1129
|
-
currency:
|
|
1136
|
+
currency: s
|
|
1130
1137
|
};
|
|
1131
1138
|
}
|
|
1132
|
-
|
|
1139
|
+
g(Xe, "getGLImpactCostMapping");
|
|
1133
1140
|
var te;
|
|
1134
|
-
(function(
|
|
1141
|
+
(function(r) {
|
|
1135
1142
|
(function(a) {
|
|
1136
1143
|
function u(t) {
|
|
1137
1144
|
var p;
|
|
1138
1145
|
const { poItem: n, nsItemSetting: i, nsUnitTypes: o, overrideCost: m = !0, customAttributes: l } = t;
|
|
1139
1146
|
let f;
|
|
1140
1147
|
if (m && n.totalCost) {
|
|
1141
|
-
const
|
|
1148
|
+
const E = A.divide([
|
|
1142
1149
|
n.totalCost,
|
|
1143
1150
|
n.quantity
|
|
1144
1151
|
]);
|
|
@@ -1147,25 +1154,25 @@ var te;
|
|
|
1147
1154
|
value: n.totalCost
|
|
1148
1155
|
})),
|
|
1149
1156
|
rate: Number(A.toFormatString({
|
|
1150
|
-
value:
|
|
1157
|
+
value: E
|
|
1151
1158
|
}))
|
|
1152
1159
|
};
|
|
1153
1160
|
}
|
|
1154
1161
|
let d;
|
|
1155
1162
|
if (n.measurement) {
|
|
1156
|
-
const
|
|
1163
|
+
const E = n.measurement.id;
|
|
1157
1164
|
for (const y of o)
|
|
1158
1165
|
for (const _ of (y == null ? void 0 : y.measurements) || [])
|
|
1159
|
-
if (_.id ===
|
|
1166
|
+
if (_.id === E) {
|
|
1160
1167
|
d = _.netSuiteId;
|
|
1161
1168
|
break;
|
|
1162
1169
|
}
|
|
1163
1170
|
} else
|
|
1164
|
-
d = (p = o.find((
|
|
1165
|
-
const I = l == null ? void 0 : l.reduce((
|
|
1171
|
+
d = (p = o.find((E) => E.id == n.sku.unit._id)) == null ? void 0 : p.baseUnitUnitOfMeasureId;
|
|
1172
|
+
const I = l == null ? void 0 : l.reduce((E, y) => {
|
|
1166
1173
|
const _ = y.compute(t, y.extraParams);
|
|
1167
1174
|
return {
|
|
1168
|
-
...
|
|
1175
|
+
...E,
|
|
1169
1176
|
[y.fieldId]: _
|
|
1170
1177
|
};
|
|
1171
1178
|
}, {});
|
|
@@ -1182,7 +1189,7 @@ var te;
|
|
|
1182
1189
|
...I
|
|
1183
1190
|
};
|
|
1184
1191
|
}
|
|
1185
|
-
|
|
1192
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1186
1193
|
function c(t) {
|
|
1187
1194
|
var d;
|
|
1188
1195
|
const {
|
|
@@ -1196,18 +1203,18 @@ var te;
|
|
|
1196
1203
|
if (n.measurement) {
|
|
1197
1204
|
const I = n.measurement.id;
|
|
1198
1205
|
for (const p of o)
|
|
1199
|
-
for (const
|
|
1200
|
-
if (
|
|
1201
|
-
l =
|
|
1206
|
+
for (const E of (p == null ? void 0 : p.measurements) || [])
|
|
1207
|
+
if (E.id === I) {
|
|
1208
|
+
l = E.netSuiteId;
|
|
1202
1209
|
break;
|
|
1203
1210
|
}
|
|
1204
1211
|
} else
|
|
1205
1212
|
l = (d = o.find((I) => I.id == n.sku.unit._id)) == null ? void 0 : d.baseUnitUnitOfMeasureId;
|
|
1206
1213
|
const f = m == null ? void 0 : m.reduce((I, p) => {
|
|
1207
|
-
const
|
|
1214
|
+
const E = p.compute(t, p.extraParams);
|
|
1208
1215
|
return {
|
|
1209
1216
|
...I,
|
|
1210
|
-
[p.fieldId]:
|
|
1217
|
+
[p.fieldId]: E
|
|
1211
1218
|
};
|
|
1212
1219
|
}, {});
|
|
1213
1220
|
return {
|
|
@@ -1224,8 +1231,8 @@ var te;
|
|
|
1224
1231
|
...f
|
|
1225
1232
|
};
|
|
1226
1233
|
}
|
|
1227
|
-
|
|
1228
|
-
function
|
|
1234
|
+
g(c, "toTransferOrderItemUpdateDto"), a.toTransferOrderItemUpdateDto = c;
|
|
1235
|
+
function s(t) {
|
|
1229
1236
|
const {
|
|
1230
1237
|
poItem: n,
|
|
1231
1238
|
nsItemSetting: i,
|
|
@@ -1235,7 +1242,7 @@ var te;
|
|
|
1235
1242
|
nsLocationId: l
|
|
1236
1243
|
} = t;
|
|
1237
1244
|
return {
|
|
1238
|
-
...
|
|
1245
|
+
...r.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
1239
1246
|
poItem: n,
|
|
1240
1247
|
nsItemSetting: i,
|
|
1241
1248
|
nsUnitTypes: o,
|
|
@@ -1247,17 +1254,17 @@ var te;
|
|
|
1247
1254
|
}
|
|
1248
1255
|
};
|
|
1249
1256
|
}
|
|
1250
|
-
|
|
1251
|
-
})(
|
|
1252
|
-
function u(
|
|
1253
|
-
var
|
|
1254
|
-
const { nsOrderItem: t, sku: n, measurement: i, context: o, currency: m } =
|
|
1255
|
-
const C = v.compute(
|
|
1257
|
+
g(s, "toPurchaseOrderItemUpdateDto"), a.toPurchaseOrderItemUpdateDto = s;
|
|
1258
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
1259
|
+
function u(s) {
|
|
1260
|
+
var E, y, _;
|
|
1261
|
+
const { nsOrderItem: t, sku: n, measurement: i, context: o, currency: m } = s, l = (_ = (y = (E = o == null ? void 0 : o.options) == null ? void 0 : E.purchaseOrderItem) == null ? void 0 : y.customAttributes) == null ? void 0 : _.reduce((S, v) => {
|
|
1262
|
+
const C = v.compute(s, v.extraParams);
|
|
1256
1263
|
return {
|
|
1257
1264
|
...S,
|
|
1258
1265
|
[v.fieldId]: C
|
|
1259
1266
|
};
|
|
1260
|
-
}, {}), f = A.fromNumber(t.quantity), d = t.amount ? A.fromNumber(t.amount) : A.fromNumber(0), I =
|
|
1267
|
+
}, {}), f = A.fromNumber(t.quantity), d = t.amount ? A.fromNumber(t.amount) : A.fromNumber(0), I = Re.FCurrency.safeParse(m), p = I.success ? I.data : he;
|
|
1261
1268
|
return {
|
|
1262
1269
|
id: "",
|
|
1263
1270
|
externalId: String(t.line),
|
|
@@ -1277,16 +1284,16 @@ var te;
|
|
|
1277
1284
|
...l
|
|
1278
1285
|
};
|
|
1279
1286
|
}
|
|
1280
|
-
|
|
1281
|
-
function c(
|
|
1287
|
+
g(u, "toPurchaseOrderItem"), a.toPurchaseOrderItem = u;
|
|
1288
|
+
function c(s) {
|
|
1282
1289
|
var _, S, v;
|
|
1283
|
-
const { nsOrderItem: t, sku: n, measurement: i, context: o, glImpactCost: m } =
|
|
1284
|
-
const b = N.compute(
|
|
1290
|
+
const { nsOrderItem: t, sku: n, measurement: i, context: o, glImpactCost: m } = s, { cost: l, currency: f } = Xe(m, String(t.line), t.item.id), d = (v = (S = (_ = o == null ? void 0 : o.options) == null ? void 0 : _.purchaseOrderReceived) == null ? void 0 : S.customAttributes) == null ? void 0 : v.reduce((C, N) => {
|
|
1291
|
+
const b = N.compute(s);
|
|
1285
1292
|
return {
|
|
1286
1293
|
...C,
|
|
1287
1294
|
[N.fieldId]: b
|
|
1288
1295
|
};
|
|
1289
|
-
}, {}), I = A.fromNumber(t.quantity), p = A.fromNumber(l),
|
|
1296
|
+
}, {}), I = A.fromNumber(t.quantity), p = A.fromNumber(l), E = Re.FCurrency.safeParse(f), y = E.success ? E.data : he;
|
|
1290
1297
|
return {
|
|
1291
1298
|
id: "",
|
|
1292
1299
|
externalId: String(t.orderLine),
|
|
@@ -1304,11 +1311,11 @@ var te;
|
|
|
1304
1311
|
...d
|
|
1305
1312
|
};
|
|
1306
1313
|
}
|
|
1307
|
-
|
|
1308
|
-
}(
|
|
1314
|
+
g(c, "toPurchaseOrderReceived"), a.toPurchaseOrderReceived = c;
|
|
1315
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
1309
1316
|
})(te || (te = {}));
|
|
1310
1317
|
var ft;
|
|
1311
|
-
(function(
|
|
1318
|
+
(function(r) {
|
|
1312
1319
|
(function(a) {
|
|
1313
1320
|
function u(c) {
|
|
1314
1321
|
var t;
|
|
@@ -1320,20 +1327,20 @@ var ft;
|
|
|
1320
1327
|
currency: c.currency.refName
|
|
1321
1328
|
};
|
|
1322
1329
|
}
|
|
1323
|
-
|
|
1324
|
-
})(
|
|
1330
|
+
g(u, "transform"), a.transform = u;
|
|
1331
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
1325
1332
|
})(ft || (ft = {}));
|
|
1326
1333
|
var Ye;
|
|
1327
|
-
(function(
|
|
1334
|
+
(function(r) {
|
|
1328
1335
|
(function(a) {
|
|
1329
|
-
function u(c,
|
|
1336
|
+
function u(c, s, t, n) {
|
|
1330
1337
|
if (!t.every((m) => m.externalId))
|
|
1331
1338
|
throw new Error("All purchase order items must have externalId");
|
|
1332
1339
|
if (c !== ee.Enum[1] && !n.items.every((m) => m.id))
|
|
1333
1340
|
throw new Error("All delivery fulfillment items must have id, if not v1");
|
|
1334
1341
|
const i = n.items.reduce((m, l) => (c === ee.Enum[1] ? m[l.sku._id] = l : m[l.id] = l, m), {}), o = [];
|
|
1335
1342
|
for (const m of t) {
|
|
1336
|
-
const l = Number(m.externalId), f =
|
|
1343
|
+
const l = Number(m.externalId), f = s.find((I) => I.line === l);
|
|
1337
1344
|
if (!f)
|
|
1338
1345
|
throw new Error(`Invalid line id ${m.externalId}`);
|
|
1339
1346
|
let d;
|
|
@@ -1360,11 +1367,11 @@ var Ye;
|
|
|
1360
1367
|
}
|
|
1361
1368
|
};
|
|
1362
1369
|
}
|
|
1363
|
-
|
|
1364
|
-
})(
|
|
1365
|
-
function u(c,
|
|
1370
|
+
g(u, "transformFromTransferOrder"), a.transformFromTransferOrder = u;
|
|
1371
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
1372
|
+
function u(c, s, t) {
|
|
1366
1373
|
const n = t.item.items.map((o) => {
|
|
1367
|
-
const m =
|
|
1374
|
+
const m = s[o.line].sku, l = s[o.line].measurement;
|
|
1368
1375
|
return te.FromNetSuite.toPurchaseOrderReceived({
|
|
1369
1376
|
context: c,
|
|
1370
1377
|
glImpactCost: t.glImpacts ?? [],
|
|
@@ -1384,22 +1391,22 @@ var Ye;
|
|
|
1384
1391
|
}
|
|
1385
1392
|
};
|
|
1386
1393
|
}
|
|
1387
|
-
|
|
1388
|
-
}(
|
|
1394
|
+
g(u, "transform"), a.transform = u;
|
|
1395
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
1389
1396
|
})(Ye || (Ye = {}));
|
|
1390
|
-
function Le(
|
|
1391
|
-
const a =
|
|
1397
|
+
function Le(r) {
|
|
1398
|
+
const a = r.getFullYear(), u = String(r.getMonth() + 1).padStart(2, "0"), c = String(r.getDate()).padStart(2, "0");
|
|
1392
1399
|
return `${a}-${u}-${c}`;
|
|
1393
1400
|
}
|
|
1394
|
-
|
|
1395
|
-
function J(
|
|
1396
|
-
return
|
|
1401
|
+
g(Le, "formatDateYYYYMMDD");
|
|
1402
|
+
function J(r, a) {
|
|
1403
|
+
return r.getDate() === a.getDate() && r.getMonth() === a.getMonth() && r.getFullYear() === a.getFullYear();
|
|
1397
1404
|
}
|
|
1398
|
-
|
|
1405
|
+
g(J, "isSameDay");
|
|
1399
1406
|
var Pe;
|
|
1400
|
-
(function(
|
|
1407
|
+
(function(r) {
|
|
1401
1408
|
(function(a) {
|
|
1402
|
-
function u(c,
|
|
1409
|
+
function u(c, s, t, n, i) {
|
|
1403
1410
|
const o = Le(new Date(n.effectiveAt ?? n.createdAt)), m = c.reduce((f, d) => (d.id && (f[d.id] = d), f), {}), l = n.received.map((f) => {
|
|
1404
1411
|
var I;
|
|
1405
1412
|
let d = f.id ? (I = m[f.id]) == null ? void 0 : I.externalId : void 0;
|
|
@@ -1419,7 +1426,7 @@ var Pe;
|
|
|
1419
1426
|
});
|
|
1420
1427
|
return {
|
|
1421
1428
|
trandate: o,
|
|
1422
|
-
transferOrderId:
|
|
1429
|
+
transferOrderId: s,
|
|
1423
1430
|
itemFulfillmentId: t,
|
|
1424
1431
|
items: l,
|
|
1425
1432
|
fields: {
|
|
@@ -1429,9 +1436,9 @@ var Pe;
|
|
|
1429
1436
|
}
|
|
1430
1437
|
};
|
|
1431
1438
|
}
|
|
1432
|
-
|
|
1433
|
-
})(
|
|
1434
|
-
function u(c,
|
|
1439
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1440
|
+
})(r.ToNetSuiteTransferOrder || (r.ToNetSuiteTransferOrder = {})), function(a) {
|
|
1441
|
+
function u(c, s, t, n) {
|
|
1435
1442
|
const i = Le(new Date(t.effectiveAt ?? t.createdAt)), o = c.reduce((l, f) => (f.id && (l[f.id] = f), l), {}), m = t.received.map((l) => {
|
|
1436
1443
|
var d;
|
|
1437
1444
|
let f = l.id ? (d = o[l.id]) == null ? void 0 : d.externalId : void 0;
|
|
@@ -1451,7 +1458,7 @@ var Pe;
|
|
|
1451
1458
|
});
|
|
1452
1459
|
return {
|
|
1453
1460
|
trandate: i,
|
|
1454
|
-
purchaseOrderId:
|
|
1461
|
+
purchaseOrderId: s,
|
|
1455
1462
|
items: m,
|
|
1456
1463
|
fields: {
|
|
1457
1464
|
custbody_fm_do_id: t.id || "",
|
|
@@ -1460,12 +1467,12 @@ var Pe;
|
|
|
1460
1467
|
}
|
|
1461
1468
|
};
|
|
1462
1469
|
}
|
|
1463
|
-
|
|
1464
|
-
}(
|
|
1465
|
-
function u(c,
|
|
1470
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1471
|
+
}(r.ToNetSuitePurchaseOrder || (r.ToNetSuitePurchaseOrder = {})), function(a) {
|
|
1472
|
+
function u(c, s, t) {
|
|
1466
1473
|
var o;
|
|
1467
1474
|
const n = t.item.items.map((m) => {
|
|
1468
|
-
const l =
|
|
1475
|
+
const l = s[m.line].sku, f = s[m.line].measurement;
|
|
1469
1476
|
return te.FromNetSuite.toPurchaseOrderReceived({
|
|
1470
1477
|
context: c,
|
|
1471
1478
|
glImpactCost: t.glImpacts ?? [],
|
|
@@ -1491,31 +1498,31 @@ var Pe;
|
|
|
1491
1498
|
fullfillmentId: (o = t.itemFulfillment) == null ? void 0 : o.id
|
|
1492
1499
|
};
|
|
1493
1500
|
}
|
|
1494
|
-
|
|
1495
|
-
}(
|
|
1501
|
+
g(u, "transform"), a.transform = u;
|
|
1502
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
1496
1503
|
})(Pe || (Pe = {}));
|
|
1497
|
-
function Ct(
|
|
1498
|
-
switch (k[
|
|
1499
|
-
case
|
|
1504
|
+
function Ct(r) {
|
|
1505
|
+
switch (k[r.id]) {
|
|
1506
|
+
case de.enum.A:
|
|
1500
1507
|
return j.Enum.REQUESTING;
|
|
1501
|
-
case
|
|
1502
|
-
case
|
|
1508
|
+
case de.enum.B:
|
|
1509
|
+
case de.enum.D:
|
|
1503
1510
|
return j.Enum.PROCESSING;
|
|
1504
|
-
case
|
|
1511
|
+
case de.enum.C:
|
|
1505
1512
|
return j.Enum.REJECT;
|
|
1506
|
-
case
|
|
1507
|
-
case
|
|
1513
|
+
case de.enum.E:
|
|
1514
|
+
case de.enum.F:
|
|
1508
1515
|
return j.Enum.RECEIVING;
|
|
1509
|
-
case
|
|
1516
|
+
case de.enum.G:
|
|
1510
1517
|
return j.Enum.COMPLETE;
|
|
1511
|
-
case
|
|
1518
|
+
case de.enum.H:
|
|
1512
1519
|
return j.Enum.CLOSE;
|
|
1513
1520
|
}
|
|
1514
|
-
throw new Error(`Invalid NetSuite Transfer Order status with ${
|
|
1521
|
+
throw new Error(`Invalid NetSuite Transfer Order status with ${r.id}`);
|
|
1515
1522
|
}
|
|
1516
|
-
|
|
1517
|
-
function At(
|
|
1518
|
-
switch (De[
|
|
1523
|
+
g(Ct, "validateTransferOrderStatusByKey");
|
|
1524
|
+
function At(r) {
|
|
1525
|
+
switch (De[r.id]) {
|
|
1519
1526
|
case X.enum.A:
|
|
1520
1527
|
return j.Enum.PROCESSING;
|
|
1521
1528
|
case X.enum.C:
|
|
@@ -1530,25 +1537,25 @@ function At(s) {
|
|
|
1530
1537
|
case X.enum.H:
|
|
1531
1538
|
return j.Enum.CLOSE;
|
|
1532
1539
|
}
|
|
1533
|
-
throw new Error(`Invalid NetSuite Purchase Order status with ${
|
|
1540
|
+
throw new Error(`Invalid NetSuite Purchase Order status with ${r.id}`);
|
|
1534
1541
|
}
|
|
1535
|
-
|
|
1536
|
-
function xe(
|
|
1537
|
-
const a = Object.keys(k).find((u) => k[u] ===
|
|
1542
|
+
g(At, "validatePurchaseOrderStatusByKey");
|
|
1543
|
+
function xe(r) {
|
|
1544
|
+
const a = Object.keys(k).find((u) => k[u] === r);
|
|
1538
1545
|
if (!a)
|
|
1539
|
-
throw new Error(`Invalid transfer order status value: ${
|
|
1546
|
+
throw new Error(`Invalid transfer order status value: ${r}`);
|
|
1540
1547
|
return a;
|
|
1541
1548
|
}
|
|
1542
|
-
|
|
1543
|
-
function Ge(
|
|
1544
|
-
const a = Object.keys(De).find((u) => De[u] ===
|
|
1549
|
+
g(xe, "getTransferOrderStatusEnumKeyByValue");
|
|
1550
|
+
function Ge(r) {
|
|
1551
|
+
const a = Object.keys(De).find((u) => De[u] === r);
|
|
1545
1552
|
if (!a)
|
|
1546
|
-
throw new Error(`Invalid purchase order status value: ${
|
|
1553
|
+
throw new Error(`Invalid purchase order status value: ${r}`);
|
|
1547
1554
|
return a;
|
|
1548
1555
|
}
|
|
1549
|
-
|
|
1550
|
-
function Mt(
|
|
1551
|
-
const c = u.filter((d) => d.field === "TRANDOC.KSTATUS"),
|
|
1556
|
+
g(Ge, "getPurchaseOrderStatusEnumKeyByValue");
|
|
1557
|
+
function Mt(r, a, u) {
|
|
1558
|
+
const c = u.filter((d) => d.field === "TRANDOC.KSTATUS"), s = [
|
|
1552
1559
|
k.B,
|
|
1553
1560
|
k.D,
|
|
1554
1561
|
k.E,
|
|
@@ -1556,18 +1563,18 @@ function Mt(s, a, u) {
|
|
|
1556
1563
|
k.G
|
|
1557
1564
|
], t = [
|
|
1558
1565
|
k.C
|
|
1559
|
-
], n = Object.keys(k).filter((d) =>
|
|
1566
|
+
], n = Object.keys(k).filter((d) => s.includes(k[d])), i = Object.keys(k).filter((d) => t.includes(k[d])), o = c.find((d) => d.status === "Rejected"), m = c.find((d) => d.status === "Pending Fulfillment");
|
|
1560
1567
|
let l = null, f = null;
|
|
1561
|
-
if (m ? l = new Date(m.datetime) : n.includes(a) && (l = new Date(
|
|
1568
|
+
if (m ? l = new Date(m.datetime) : n.includes(a) && (l = new Date(r)), o ? f = new Date(o.datetime) : i.includes(a) && (f = new Date(r)), l && f)
|
|
1562
1569
|
throw new Error("Both processedAt and rejectedAt are set.");
|
|
1563
1570
|
return {
|
|
1564
1571
|
processedAt: l ? l.toISOString() : null,
|
|
1565
1572
|
rejectedAt: f ? f.toISOString() : null
|
|
1566
1573
|
};
|
|
1567
1574
|
}
|
|
1568
|
-
|
|
1569
|
-
function Ut(
|
|
1570
|
-
const a =
|
|
1575
|
+
g(Mt, "getPurchaseOrderRequestStatusTimestamp");
|
|
1576
|
+
function Ut(r) {
|
|
1577
|
+
const a = r.shipDate;
|
|
1571
1578
|
if (!a)
|
|
1572
1579
|
return null;
|
|
1573
1580
|
const u = /* @__PURE__ */ new Date();
|
|
@@ -1578,20 +1585,20 @@ function Ut(s) {
|
|
|
1578
1585
|
estimatedTime: new Date(a).toISOString()
|
|
1579
1586
|
};
|
|
1580
1587
|
}
|
|
1581
|
-
|
|
1588
|
+
g(Ut, "transformTransferOrderPreparingShipmentMilestoneFromNetSuite");
|
|
1582
1589
|
var It;
|
|
1583
|
-
(function(
|
|
1590
|
+
(function(r) {
|
|
1584
1591
|
(function(a) {
|
|
1585
|
-
function u({ setting: t, purchaseOrderRequest: n, status: i =
|
|
1592
|
+
function u({ setting: t, purchaseOrderRequest: n, status: i = de.enum.A, overrideItemCost: o = !0, customItemAttributes: m, customFields: l }) {
|
|
1586
1593
|
const { purchaseOrder: f } = n;
|
|
1587
1594
|
if (!f)
|
|
1588
1595
|
throw new Error("Purchase order request does not have a purchase order");
|
|
1589
1596
|
if (n.netSuite.subsidiary === void 0)
|
|
1590
1597
|
throw new Error("Purchase order request does not have a NetSuite subsidiary");
|
|
1591
|
-
const d = f.items.map((
|
|
1592
|
-
const y = t.items.find((_) => _.id ===
|
|
1598
|
+
const d = f.items.map((E) => {
|
|
1599
|
+
const y = t.items.find((_) => _.id === E.sku._id);
|
|
1593
1600
|
return te.ToNetSuite.toCreateDto({
|
|
1594
|
-
poItem:
|
|
1601
|
+
poItem: E,
|
|
1595
1602
|
nsUnitTypes: t.units,
|
|
1596
1603
|
nsItemSetting: y,
|
|
1597
1604
|
overrideCost: o,
|
|
@@ -1622,10 +1629,10 @@ var It;
|
|
|
1622
1629
|
custbody_fm_po_request_id: n._id
|
|
1623
1630
|
};
|
|
1624
1631
|
}
|
|
1625
|
-
|
|
1632
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1626
1633
|
function c({ setting: t, purchaseOrder: n, overrideItemCost: i, customItemAttributes: o, includeItems: m = !1, orderStatus: l, customFields: f }) {
|
|
1627
1634
|
const d = n.items.map((I) => {
|
|
1628
|
-
const p = t.items.find((
|
|
1635
|
+
const p = t.items.find((E) => E.id === I.sku._id);
|
|
1629
1636
|
return te.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
1630
1637
|
poItem: I,
|
|
1631
1638
|
nsUnitTypes: t.units,
|
|
@@ -1646,8 +1653,8 @@ var It;
|
|
|
1646
1653
|
custbody_fm_po_request_id: n.request.id
|
|
1647
1654
|
};
|
|
1648
1655
|
}
|
|
1649
|
-
|
|
1650
|
-
function
|
|
1656
|
+
g(c, "toUpdateDto"), a.toUpdateDto = c;
|
|
1657
|
+
function s(t) {
|
|
1651
1658
|
return {
|
|
1652
1659
|
item: {
|
|
1653
1660
|
items: t.item.items.map((n) => ({
|
|
@@ -1657,11 +1664,11 @@ var It;
|
|
|
1657
1664
|
}
|
|
1658
1665
|
};
|
|
1659
1666
|
}
|
|
1660
|
-
|
|
1661
|
-
})(
|
|
1662
|
-
function u(
|
|
1663
|
-
var $,
|
|
1664
|
-
const { fromLocation: t, toLocation: n, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: m, orderItemMappingByFulfillment: l, nsItemReceipts: f, orderItemMappingByReceipt: d, context: I, nsSystemNotes: p } =
|
|
1667
|
+
g(s, "toCloseDto"), a.toCloseDto = s;
|
|
1668
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
1669
|
+
function u(s) {
|
|
1670
|
+
var $, Se, we, it, st, rt, ot, at, ut;
|
|
1671
|
+
const { fromLocation: t, toLocation: n, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: m, orderItemMappingByFulfillment: l, nsItemReceipts: f, orderItemMappingByReceipt: d, context: I, nsSystemNotes: p } = s, E = {
|
|
1665
1672
|
_id: t.doc._id,
|
|
1666
1673
|
internal: t.type,
|
|
1667
1674
|
contactName: t.doc.profile.name,
|
|
@@ -1671,17 +1678,17 @@ var It;
|
|
|
1671
1678
|
registrationNumber: t.doc.profile.regNo,
|
|
1672
1679
|
address: {
|
|
1673
1680
|
line1: (($ = t.doc.profile.address) == null ? void 0 : $.line1) || "",
|
|
1674
|
-
line2: (
|
|
1681
|
+
line2: (Se = t.doc.profile.address) == null ? void 0 : Se.line2,
|
|
1675
1682
|
state: ((we = t.doc.profile.address) == null ? void 0 : we.state) || "",
|
|
1676
1683
|
city: ((it = t.doc.profile.address) == null ? void 0 : it.city) || "",
|
|
1677
1684
|
country: ((st = t.doc.profile.address) == null ? void 0 : st.country) || "",
|
|
1678
1685
|
postcode: ((rt = t.doc.profile.address) == null ? void 0 : rt.postcode) || ""
|
|
1679
1686
|
}
|
|
1680
1687
|
}, y = (ut = (at = (ot = I.options) == null ? void 0 : ot.netSuite) == null ? void 0 : at.additionalInfo) == null ? void 0 : ut.reduce((P, Y) => {
|
|
1681
|
-
const
|
|
1688
|
+
const Ie = Y.compute(s, Y.extraParams);
|
|
1682
1689
|
return {
|
|
1683
1690
|
...P,
|
|
1684
|
-
[Y.fieldId]:
|
|
1691
|
+
[Y.fieldId]: Ie
|
|
1685
1692
|
};
|
|
1686
1693
|
}, {}), _ = {
|
|
1687
1694
|
id: i.id,
|
|
@@ -1700,23 +1707,23 @@ var It;
|
|
|
1700
1707
|
const Y = d[P.id];
|
|
1701
1708
|
return Pe.FromNetSuite.transform(I, Y, P);
|
|
1702
1709
|
}), C = i.item.items.map((P) => {
|
|
1703
|
-
const Y = o[P.line].sku,
|
|
1710
|
+
const Y = o[P.line].sku, Ie = o[P.line].measurement;
|
|
1704
1711
|
return te.FromNetSuite.toPurchaseOrderItem({
|
|
1705
1712
|
currency: i.currency.refName,
|
|
1706
1713
|
nsOrderItem: P,
|
|
1707
1714
|
sku: Y,
|
|
1708
1715
|
glImpactCost: [],
|
|
1709
|
-
measurement:
|
|
1716
|
+
measurement: Ie,
|
|
1710
1717
|
context: I
|
|
1711
1718
|
});
|
|
1712
1719
|
}), N = new Date(i.createdDate), [b, D, F] = i.tranDate.split("-"), w = new Date(Number(b), Number(D) - 1, Number(F)), U = Ut(i), B = {
|
|
1713
|
-
_id:
|
|
1714
|
-
prefix:
|
|
1720
|
+
_id: O({
|
|
1721
|
+
prefix: R.Enum.purchaseOrder,
|
|
1715
1722
|
dateTime: N.toISOString()
|
|
1716
1723
|
}),
|
|
1717
1724
|
version: "2",
|
|
1718
1725
|
status: Ct(i.orderStatus),
|
|
1719
|
-
supplier:
|
|
1726
|
+
supplier: E,
|
|
1720
1727
|
seqNumber: parseInt(i.custbody_fm_po_num ?? "0"),
|
|
1721
1728
|
items: C,
|
|
1722
1729
|
effectiveAt: w.toISOString(),
|
|
@@ -1728,9 +1735,9 @@ var It;
|
|
|
1728
1735
|
id: i.custbody_fm_po_request_id,
|
|
1729
1736
|
adjustmentIds: []
|
|
1730
1737
|
} : void 0
|
|
1731
|
-
}, { processedAt: Ue, rejectedAt: Fe } = Mt(i.createdDate, i.orderStatus.id, p ?? []),
|
|
1732
|
-
const
|
|
1733
|
-
return P ?
|
|
1738
|
+
}, { processedAt: Ue, rejectedAt: Fe } = Mt(i.createdDate, i.orderStatus.id, p ?? []), be = S.reduce((P, Y) => {
|
|
1739
|
+
const Ie = new Date(Y.createdAt);
|
|
1740
|
+
return P ? Ie.getTime() < P.getTime() ? Ie : P : Ie;
|
|
1734
1741
|
}, null);
|
|
1735
1742
|
return {
|
|
1736
1743
|
purchaseOrderRequest: {
|
|
@@ -1744,7 +1751,7 @@ var It;
|
|
|
1744
1751
|
name: n.name
|
|
1745
1752
|
},
|
|
1746
1753
|
purchaseOrderId: B._id,
|
|
1747
|
-
processedAt: Ue || (
|
|
1754
|
+
processedAt: Ue || (be == null ? void 0 : be.toISOString()) || null,
|
|
1748
1755
|
rejectedAt: Fe,
|
|
1749
1756
|
adjustmentIds: [],
|
|
1750
1757
|
purchaseOrder: B,
|
|
@@ -1755,18 +1762,18 @@ var It;
|
|
|
1755
1762
|
deliveryMilestone: U
|
|
1756
1763
|
};
|
|
1757
1764
|
}
|
|
1758
|
-
|
|
1765
|
+
g(u, "transform"), a.transform = u;
|
|
1759
1766
|
function c() {
|
|
1760
1767
|
}
|
|
1761
|
-
|
|
1762
|
-
}(
|
|
1768
|
+
g(c, "convertToV1"), a.convertToV1 = c;
|
|
1769
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
1763
1770
|
})(It || (It = {}));
|
|
1764
|
-
function Ft(
|
|
1765
|
-
var
|
|
1766
|
-
const u = (
|
|
1771
|
+
function Ft(r, a) {
|
|
1772
|
+
var s, t;
|
|
1773
|
+
const u = (s = r.find((n) => {
|
|
1767
1774
|
const [i, o] = a.from.dbName.split("_");
|
|
1768
1775
|
return n.id === o && n.type === i;
|
|
1769
|
-
})) == null ? void 0 :
|
|
1776
|
+
})) == null ? void 0 : s.netSuiteId, c = (t = r.find((n) => {
|
|
1770
1777
|
const [i, o] = a.to.dbName.split("_");
|
|
1771
1778
|
return n.id === o && n.type === i;
|
|
1772
1779
|
})) == null ? void 0 : t.netSuiteId;
|
|
@@ -1777,10 +1784,10 @@ function Ft(s, a) {
|
|
|
1777
1784
|
netSuiteToId: c
|
|
1778
1785
|
};
|
|
1779
1786
|
}
|
|
1780
|
-
|
|
1781
|
-
function wt(
|
|
1787
|
+
g(Ft, "locationMapper");
|
|
1788
|
+
function wt(r) {
|
|
1782
1789
|
let a = null, u = !1, c = !1;
|
|
1783
|
-
for (const n of
|
|
1790
|
+
for (const n of r.item.items) {
|
|
1784
1791
|
const i = n.expectedReceiptDate;
|
|
1785
1792
|
if (!i) {
|
|
1786
1793
|
u = !0;
|
|
@@ -1797,23 +1804,23 @@ function wt(s) {
|
|
|
1797
1804
|
throw new Error("Inconsistent expected delivery dates found in purchase order items.");
|
|
1798
1805
|
if (!a)
|
|
1799
1806
|
return null;
|
|
1800
|
-
const
|
|
1807
|
+
const s = /* @__PURE__ */ new Date();
|
|
1801
1808
|
return {
|
|
1802
1809
|
type: vt.Enum.PREPARING,
|
|
1803
1810
|
description: "Expected Delivery Date (Synced from NetSuite)",
|
|
1804
|
-
createdAt:
|
|
1811
|
+
createdAt: s.toISOString(),
|
|
1805
1812
|
estimatedTime: new Date(a).toISOString()
|
|
1806
1813
|
};
|
|
1807
1814
|
}
|
|
1808
|
-
|
|
1815
|
+
g(wt, "transformPreparingShipmentMilestoneFromNetSuite");
|
|
1809
1816
|
var pt;
|
|
1810
|
-
(function(
|
|
1817
|
+
(function(r) {
|
|
1811
1818
|
(function(a) {
|
|
1812
1819
|
function u({ locationDb: t, setting: n, purchaseOrder: i, status: o = X.enum.A, overrideItemCost: m = !0, customItemAttributes: l, customFields: f }) {
|
|
1813
|
-
const { netSuiteFromId: d, netSuiteToId: I } = Je(n.locations, n.vendors, t, i.supplier._id), p = i.items.map((
|
|
1814
|
-
const y = n.items.find((_) => _.id ===
|
|
1820
|
+
const { netSuiteFromId: d, netSuiteToId: I } = Je(n.locations, n.vendors, t, i.supplier._id), p = i.items.map((E) => {
|
|
1821
|
+
const y = n.items.find((_) => _.id === E.sku._id);
|
|
1815
1822
|
return te.ToNetSuite.toCreateDto({
|
|
1816
|
-
poItem:
|
|
1823
|
+
poItem: E,
|
|
1817
1824
|
nsUnitTypes: n.units,
|
|
1818
1825
|
nsItemSetting: y,
|
|
1819
1826
|
overrideCost: m,
|
|
@@ -1821,7 +1828,7 @@ var pt;
|
|
|
1821
1828
|
{
|
|
1822
1829
|
fieldId: "location",
|
|
1823
1830
|
extraParams: I,
|
|
1824
|
-
compute: /* @__PURE__ */
|
|
1831
|
+
compute: /* @__PURE__ */ g((_, S) => ({
|
|
1825
1832
|
id: S
|
|
1826
1833
|
}), "compute")
|
|
1827
1834
|
},
|
|
@@ -1853,17 +1860,17 @@ var pt;
|
|
|
1853
1860
|
custbody_fm_po_id: i._id
|
|
1854
1861
|
};
|
|
1855
1862
|
}
|
|
1856
|
-
|
|
1863
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1857
1864
|
function c({ locationDb: t, setting: n, purchaseOrder: i, overrideItemCost: o, customItemAttributes: m, includeItems: l = !1, customFields: f }) {
|
|
1858
1865
|
const { netSuiteToId: d } = Je(n.locations, n.vendors, t, i.supplier._id);
|
|
1859
1866
|
i != null && i.effectiveAt || ie(i._id);
|
|
1860
1867
|
const I = i.items.map((p) => {
|
|
1861
|
-
const
|
|
1868
|
+
const E = n.items.find((y) => y.id === p.sku._id);
|
|
1862
1869
|
return te.ToNetSuite.toPurchaseOrderItemUpdateDto({
|
|
1863
1870
|
nsLocationId: d,
|
|
1864
1871
|
poItem: p,
|
|
1865
1872
|
nsUnitTypes: n.units,
|
|
1866
|
-
nsItemSetting:
|
|
1873
|
+
nsItemSetting: E,
|
|
1867
1874
|
overrideCost: o,
|
|
1868
1875
|
customAttributes: m
|
|
1869
1876
|
});
|
|
@@ -1878,38 +1885,38 @@ var pt;
|
|
|
1878
1885
|
custbody_fm_po_id: i._id
|
|
1879
1886
|
};
|
|
1880
1887
|
}
|
|
1881
|
-
|
|
1882
|
-
function
|
|
1888
|
+
g(c, "toUpdateDto"), a.toUpdateDto = c;
|
|
1889
|
+
function s() {
|
|
1883
1890
|
return {
|
|
1884
1891
|
orderStatus: {
|
|
1885
1892
|
id: Ge(X.enum.H)
|
|
1886
1893
|
}
|
|
1887
1894
|
};
|
|
1888
1895
|
}
|
|
1889
|
-
|
|
1890
|
-
})(
|
|
1896
|
+
g(s, "toCloseDto"), a.toCloseDto = s;
|
|
1897
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
1891
1898
|
function u(c) {
|
|
1892
|
-
var b, D, F, w, U, B, Ue, Fe,
|
|
1893
|
-
const { vendor:
|
|
1894
|
-
_id:
|
|
1895
|
-
contactName:
|
|
1896
|
-
name:
|
|
1897
|
-
email:
|
|
1898
|
-
phoneNumber:
|
|
1899
|
-
registrationNumber:
|
|
1899
|
+
var b, D, F, w, U, B, Ue, Fe, be;
|
|
1900
|
+
const { vendor: s, nsPurchaseOrder: t, orderItemMapping: n, nsItemReceipts: i, orderItemMappingByReceipt: o, context: m } = c, l = {
|
|
1901
|
+
_id: s._id,
|
|
1902
|
+
contactName: s.contactName,
|
|
1903
|
+
name: s.name ?? "",
|
|
1904
|
+
email: s.email,
|
|
1905
|
+
phoneNumber: s.phoneNumber,
|
|
1906
|
+
registrationNumber: s.registrationNumber,
|
|
1900
1907
|
address: {
|
|
1901
|
-
line1: ((b =
|
|
1902
|
-
line2: (D =
|
|
1903
|
-
state: ((F =
|
|
1904
|
-
city: ((w =
|
|
1905
|
-
country: ((U =
|
|
1906
|
-
postcode: ((B =
|
|
1908
|
+
line1: ((b = s.address) == null ? void 0 : b.line1) || "",
|
|
1909
|
+
line2: (D = s.address) == null ? void 0 : D.line2,
|
|
1910
|
+
state: ((F = s.address) == null ? void 0 : F.state) || "",
|
|
1911
|
+
city: ((w = s.address) == null ? void 0 : w.city) || "",
|
|
1912
|
+
country: ((U = s.address) == null ? void 0 : U.country) || "",
|
|
1913
|
+
postcode: ((B = s.address) == null ? void 0 : B.postcode) || ""
|
|
1907
1914
|
}
|
|
1908
|
-
}, f = (
|
|
1909
|
-
const
|
|
1915
|
+
}, f = (be = (Fe = (Ue = m.options) == null ? void 0 : Ue.netSuite) == null ? void 0 : Fe.additionalInfo) == null ? void 0 : be.reduce((se, $) => {
|
|
1916
|
+
const Se = $.compute(c, $.extraParams);
|
|
1910
1917
|
return {
|
|
1911
1918
|
...se,
|
|
1912
|
-
[$.fieldId]:
|
|
1919
|
+
[$.fieldId]: Se
|
|
1913
1920
|
};
|
|
1914
1921
|
}, {}), d = {
|
|
1915
1922
|
id: t.id,
|
|
@@ -1927,21 +1934,21 @@ var pt;
|
|
|
1927
1934
|
}), p = t.item.items.reduce((se, $) => {
|
|
1928
1935
|
if ($.itemType.id === "Service")
|
|
1929
1936
|
return console.log(`Skipping service type item with line ${$.line} in purchase order ${t.tranId}`), se;
|
|
1930
|
-
const
|
|
1937
|
+
const Se = n[$.line].sku, we = n[$.line].measurement;
|
|
1931
1938
|
return se.push(te.FromNetSuite.toPurchaseOrderItem({
|
|
1932
1939
|
currency: t.currency.refName,
|
|
1933
1940
|
nsOrderItem: $,
|
|
1934
|
-
sku:
|
|
1941
|
+
sku: Se,
|
|
1935
1942
|
glImpactCost: [],
|
|
1936
1943
|
measurement: we,
|
|
1937
1944
|
context: m
|
|
1938
1945
|
})), se;
|
|
1939
|
-
}, []),
|
|
1946
|
+
}, []), E = new Date(t.createdDate), [y, _, S] = t.tranDate.split("-"), v = new Date(Number(y), Number(_) - 1, Number(S)), C = wt(t);
|
|
1940
1947
|
return {
|
|
1941
1948
|
purchaseOrder: {
|
|
1942
|
-
_id:
|
|
1943
|
-
prefix:
|
|
1944
|
-
dateTime:
|
|
1949
|
+
_id: O({
|
|
1950
|
+
prefix: R.Enum.purchaseOrder,
|
|
1951
|
+
dateTime: E.toISOString()
|
|
1945
1952
|
}),
|
|
1946
1953
|
version: "2",
|
|
1947
1954
|
status: At(t.orderStatus),
|
|
@@ -1956,30 +1963,30 @@ var pt;
|
|
|
1956
1963
|
deliveryMilestone: C
|
|
1957
1964
|
};
|
|
1958
1965
|
}
|
|
1959
|
-
|
|
1960
|
-
}(
|
|
1966
|
+
g(u, "transform"), a.transform = u;
|
|
1967
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
1961
1968
|
})(pt || (pt = {}));
|
|
1962
|
-
function Je(
|
|
1969
|
+
function Je(r, a, u, c) {
|
|
1963
1970
|
var n, i;
|
|
1964
|
-
const
|
|
1971
|
+
const s = (n = a.find((o) => o.id === c)) == null ? void 0 : n.netSuiteId, t = (i = r.find((o) => {
|
|
1965
1972
|
const [m, l] = u.split("_");
|
|
1966
1973
|
return o.id === l && o.type === m;
|
|
1967
1974
|
})) == null ? void 0 : i.netSuiteId;
|
|
1968
|
-
if (!
|
|
1975
|
+
if (!s || !t || s === t)
|
|
1969
1976
|
throw new Error("Invalid location");
|
|
1970
1977
|
return {
|
|
1971
|
-
netSuiteFromId:
|
|
1978
|
+
netSuiteFromId: s,
|
|
1972
1979
|
netSuiteToId: t
|
|
1973
1980
|
};
|
|
1974
1981
|
}
|
|
1975
|
-
|
|
1982
|
+
g(Je, "locationMapper");
|
|
1976
1983
|
var ze;
|
|
1977
|
-
(function(
|
|
1984
|
+
(function(r) {
|
|
1978
1985
|
(function(a) {
|
|
1979
1986
|
function u(c) {
|
|
1980
1987
|
const t = {
|
|
1981
|
-
id:
|
|
1982
|
-
prefix:
|
|
1988
|
+
id: O({
|
|
1989
|
+
prefix: R.Enum.measurement
|
|
1983
1990
|
}),
|
|
1984
1991
|
name: c.unitName,
|
|
1985
1992
|
abbrev: c.abbreviation,
|
|
@@ -1996,21 +2003,21 @@ var ze;
|
|
|
1996
2003
|
}
|
|
1997
2004
|
};
|
|
1998
2005
|
}
|
|
1999
|
-
|
|
2000
|
-
})(
|
|
2006
|
+
g(u, "transform"), a.transform = u;
|
|
2007
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
2001
2008
|
})(ze || (ze = {}));
|
|
2002
|
-
var
|
|
2003
|
-
(function(
|
|
2009
|
+
var gt;
|
|
2010
|
+
(function(r) {
|
|
2004
2011
|
(function(a) {
|
|
2005
|
-
function u(c,
|
|
2006
|
-
let t = c.uom.items, n =
|
|
2007
|
-
prefix:
|
|
2012
|
+
function u(c, s) {
|
|
2013
|
+
let t = c.uom.items, n = O({
|
|
2014
|
+
prefix: R.Enum.unit
|
|
2008
2015
|
});
|
|
2009
2016
|
const i = {
|
|
2010
2017
|
_id: n,
|
|
2011
2018
|
name: c.name,
|
|
2012
2019
|
abbrev: c.name,
|
|
2013
|
-
precision: (
|
|
2020
|
+
precision: (s == null ? void 0 : s.precision) ?? 0,
|
|
2014
2021
|
measurements: []
|
|
2015
2022
|
};
|
|
2016
2023
|
let o;
|
|
@@ -2037,40 +2044,40 @@ var Et;
|
|
|
2037
2044
|
measurements: l
|
|
2038
2045
|
};
|
|
2039
2046
|
}
|
|
2040
|
-
|
|
2041
|
-
})(
|
|
2042
|
-
})(
|
|
2043
|
-
function Tn(
|
|
2047
|
+
g(u, "transform"), a.transform = u;
|
|
2048
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
2049
|
+
})(gt || (gt = {}));
|
|
2050
|
+
function Tn(r, a) {
|
|
2044
2051
|
let u;
|
|
2045
2052
|
const c = [];
|
|
2046
|
-
for (const
|
|
2047
|
-
const t =
|
|
2053
|
+
for (const s of a.measurements) {
|
|
2054
|
+
const t = r.measurements.find((n) => n.id === s.id);
|
|
2048
2055
|
t && c.push({
|
|
2049
|
-
...
|
|
2056
|
+
...s,
|
|
2050
2057
|
nsConfig: t
|
|
2051
2058
|
});
|
|
2052
2059
|
}
|
|
2053
2060
|
return u = {
|
|
2054
2061
|
...a,
|
|
2055
|
-
nsConfig:
|
|
2062
|
+
nsConfig: r,
|
|
2056
2063
|
measurements: c
|
|
2057
2064
|
}, u;
|
|
2058
2065
|
}
|
|
2059
|
-
|
|
2060
|
-
var
|
|
2061
|
-
(function(
|
|
2066
|
+
g(Tn, "convertToUnitWithNsConfig");
|
|
2067
|
+
var Et;
|
|
2068
|
+
(function(r) {
|
|
2062
2069
|
(function(a) {
|
|
2063
2070
|
function u(c) {
|
|
2064
|
-
const
|
|
2065
|
-
prefix:
|
|
2071
|
+
const s = c.addressBook.items.find((o) => o.defaultBilling), t = O({
|
|
2072
|
+
prefix: R.Enum.supplier
|
|
2066
2073
|
}), n = {
|
|
2067
2074
|
_id: t,
|
|
2068
2075
|
name: c.companyName,
|
|
2069
2076
|
email: c.email,
|
|
2070
|
-
contactName: (
|
|
2077
|
+
contactName: (s == null ? void 0 : s.addressBookAddress.attention) || (s == null ? void 0 : s.addressBookAddress.addressee),
|
|
2071
2078
|
phoneNumber: c.phone,
|
|
2072
2079
|
registrationNumber: "",
|
|
2073
|
-
address: kt(
|
|
2080
|
+
address: kt(s)
|
|
2074
2081
|
}, i = {
|
|
2075
2082
|
id: t,
|
|
2076
2083
|
netSuiteId: c.id,
|
|
@@ -2082,10 +2089,10 @@ var gt;
|
|
|
2082
2089
|
nsConfig: i
|
|
2083
2090
|
};
|
|
2084
2091
|
}
|
|
2085
|
-
|
|
2086
|
-
})(
|
|
2087
|
-
})(
|
|
2088
|
-
function kt(
|
|
2092
|
+
g(u, "transform"), a.transform = u;
|
|
2093
|
+
})(r.FromNetsuite || (r.FromNetsuite = {}));
|
|
2094
|
+
})(Et || (Et = {}));
|
|
2095
|
+
function kt(r) {
|
|
2089
2096
|
let a = {
|
|
2090
2097
|
line1: "",
|
|
2091
2098
|
state: "",
|
|
@@ -2093,26 +2100,26 @@ function kt(s) {
|
|
|
2093
2100
|
postcode: "",
|
|
2094
2101
|
country: ""
|
|
2095
2102
|
};
|
|
2096
|
-
return
|
|
2103
|
+
return r && (a = {
|
|
2097
2104
|
...a,
|
|
2098
|
-
line1:
|
|
2099
|
-
line2:
|
|
2100
|
-
state:
|
|
2101
|
-
city:
|
|
2102
|
-
postcode:
|
|
2103
|
-
country:
|
|
2105
|
+
line1: r.addressBookAddress.addr1 ?? "",
|
|
2106
|
+
line2: r.addressBookAddress.addr2,
|
|
2107
|
+
state: r.addressBookAddress.state ?? "",
|
|
2108
|
+
city: r.addressBookAddress.city ?? "",
|
|
2109
|
+
postcode: r.addressBookAddress.zip ?? "",
|
|
2110
|
+
country: r.addressBookAddress.country.refName
|
|
2104
2111
|
}), a;
|
|
2105
2112
|
}
|
|
2106
|
-
|
|
2107
|
-
function et(
|
|
2108
|
-
const u = {}, c = /* @__PURE__ */ new Set(),
|
|
2113
|
+
g(kt, "_transfromToSupplierAddress");
|
|
2114
|
+
function et(r, a) {
|
|
2115
|
+
const u = {}, c = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
2109
2116
|
for (const n of a) {
|
|
2110
2117
|
let { externalId: i, id: o } = n;
|
|
2111
2118
|
if (i) {
|
|
2112
2119
|
if (c.has(i))
|
|
2113
2120
|
throw new Error(`Duplicate externalId found in poItems: ${i}`);
|
|
2114
|
-
if (c.add(i), !o ||
|
|
2115
|
-
if (o || console.warn(`Missing id found in poItems for externalId: ${i}, generating a new id.`), o &&
|
|
2121
|
+
if (c.add(i), !o || s.has(o)) {
|
|
2122
|
+
if (o || console.warn(`Missing id found in poItems for externalId: ${i}, generating a new id.`), o && s.has(o)) {
|
|
2116
2123
|
let m;
|
|
2117
2124
|
Object.entries(u).forEach(([l, f]) => {
|
|
2118
2125
|
f === o && (m = l);
|
|
@@ -2120,21 +2127,21 @@ function et(s, a) {
|
|
|
2120
2127
|
}
|
|
2121
2128
|
o = crypto.randomUUID();
|
|
2122
2129
|
}
|
|
2123
|
-
|
|
2130
|
+
s.add(o), u[i] = o;
|
|
2124
2131
|
}
|
|
2125
2132
|
}
|
|
2126
2133
|
const t = {};
|
|
2127
|
-
for (const n of
|
|
2134
|
+
for (const n of r) {
|
|
2128
2135
|
const i = n.transferorderitemlineid || n.lineid, o = u[i];
|
|
2129
2136
|
o && (t[n.lineid] = o);
|
|
2130
2137
|
}
|
|
2131
2138
|
return t;
|
|
2132
2139
|
}
|
|
2133
|
-
|
|
2134
|
-
function hn(
|
|
2140
|
+
g(et, "mapOrderLineId");
|
|
2141
|
+
function hn(r, a, u, c, s) {
|
|
2135
2142
|
var l, f;
|
|
2136
2143
|
const t = u.some((d) => d.id), n = et(a, u), i = [], o = c, m = [
|
|
2137
|
-
...
|
|
2144
|
+
...s || []
|
|
2138
2145
|
];
|
|
2139
2146
|
for (const d of u) {
|
|
2140
2147
|
const I = t && d.externalId ? n[d.externalId] : "";
|
|
@@ -2145,17 +2152,17 @@ function hn(s, a, u, c, r) {
|
|
|
2145
2152
|
}
|
|
2146
2153
|
for (let d = 0; d < o.length; d++) {
|
|
2147
2154
|
const I = o[d], p = [];
|
|
2148
|
-
for (const
|
|
2149
|
-
const y =
|
|
2155
|
+
for (const E of I.received) {
|
|
2156
|
+
const y = E.externalId;
|
|
2150
2157
|
if (!y) {
|
|
2151
|
-
p.push(
|
|
2158
|
+
p.push(E);
|
|
2152
2159
|
continue;
|
|
2153
2160
|
}
|
|
2154
2161
|
const _ = (l = a.find((C) => C.lineid === y)) == null ? void 0 : l.transferorderitemlineid, S = t && _ ? n[_] : void 0, v = {
|
|
2155
|
-
...
|
|
2162
|
+
...E,
|
|
2156
2163
|
id: S
|
|
2157
2164
|
};
|
|
2158
|
-
if (
|
|
2165
|
+
if (r === ee.Enum[2] && (!S || S === ""))
|
|
2159
2166
|
throw new Error(`Cannot find mapped item ID for external line id ${y} in delivery order`);
|
|
2160
2167
|
p.push(v);
|
|
2161
2168
|
}
|
|
@@ -2167,17 +2174,17 @@ function hn(s, a, u, c, r) {
|
|
|
2167
2174
|
if (m)
|
|
2168
2175
|
for (let d = 0; d < m.length; d++) {
|
|
2169
2176
|
const I = m[d], p = [];
|
|
2170
|
-
for (const
|
|
2171
|
-
const y =
|
|
2177
|
+
for (const E of I.items) {
|
|
2178
|
+
const y = E.externalId;
|
|
2172
2179
|
if (!y) {
|
|
2173
|
-
p.push(
|
|
2180
|
+
p.push(E);
|
|
2174
2181
|
continue;
|
|
2175
2182
|
}
|
|
2176
|
-
const _ = (f = a.find((C) => C.lineid === y)) == null ? void 0 : f.transferorderitemlineid, S = t && _ ? n[_] :
|
|
2177
|
-
...
|
|
2183
|
+
const _ = (f = a.find((C) => C.lineid === y)) == null ? void 0 : f.transferorderitemlineid, S = t && _ ? n[_] : E.id, v = {
|
|
2184
|
+
...E,
|
|
2178
2185
|
id: S
|
|
2179
2186
|
};
|
|
2180
|
-
if (
|
|
2187
|
+
if (r === ee.Enum[2] && (!S || S === ""))
|
|
2181
2188
|
throw new Error(`Cannot find mapped item ID for order external id ${y} in delivery fulfillment`);
|
|
2182
2189
|
p.push(v);
|
|
2183
2190
|
}
|
|
@@ -2192,11 +2199,11 @@ function hn(s, a, u, c, r) {
|
|
|
2192
2199
|
alignedDeliveryFulfillments: m
|
|
2193
2200
|
};
|
|
2194
2201
|
}
|
|
2195
|
-
|
|
2196
|
-
function Dn(
|
|
2197
|
-
const c = a.some((i) => i.id),
|
|
2202
|
+
g(hn, "alignItemLineIdsAcrossDocuments");
|
|
2203
|
+
function Dn(r, a, u) {
|
|
2204
|
+
const c = a.some((i) => i.id), s = et(r, a), t = [], n = u;
|
|
2198
2205
|
for (const i of a) {
|
|
2199
|
-
const o = c && i.externalId ?
|
|
2206
|
+
const o = c && i.externalId ? s[i.externalId] : "";
|
|
2200
2207
|
t.push({
|
|
2201
2208
|
...i,
|
|
2202
2209
|
id: o
|
|
@@ -2221,15 +2228,15 @@ function Dn(s, a, u) {
|
|
|
2221
2228
|
alignedDeliveryOrders: n
|
|
2222
2229
|
};
|
|
2223
2230
|
}
|
|
2224
|
-
|
|
2225
|
-
var
|
|
2226
|
-
(function(
|
|
2231
|
+
g(Dn, "alignInventoryTransferItemLineIds");
|
|
2232
|
+
var pe;
|
|
2233
|
+
(function(r) {
|
|
2227
2234
|
(function(a) {
|
|
2228
2235
|
function u(c) {
|
|
2229
|
-
const { orderItem:
|
|
2236
|
+
const { orderItem: s, nsUnitTypes: t, nsItemSetting: n } = c;
|
|
2230
2237
|
let i;
|
|
2231
|
-
if (
|
|
2232
|
-
const o =
|
|
2238
|
+
if (s.measurement) {
|
|
2239
|
+
const o = s.measurement.id;
|
|
2233
2240
|
for (const m of t)
|
|
2234
2241
|
for (const l of (m == null ? void 0 : m.measurements) || [])
|
|
2235
2242
|
if (l.id === o) {
|
|
@@ -2237,24 +2244,24 @@ var Ie;
|
|
|
2237
2244
|
break;
|
|
2238
2245
|
}
|
|
2239
2246
|
} else
|
|
2240
|
-
i = t.find((o) => o.id ==
|
|
2247
|
+
i = t.find((o) => o.id == s.sku.unit._id).baseUnitUnitOfMeasureId;
|
|
2241
2248
|
return {
|
|
2242
2249
|
item: {
|
|
2243
2250
|
id: n.netSuiteId
|
|
2244
2251
|
},
|
|
2245
2252
|
adjustQtyBy: Number(A.toFormatString({
|
|
2246
|
-
value:
|
|
2253
|
+
value: s.quantity
|
|
2247
2254
|
})),
|
|
2248
2255
|
units: i
|
|
2249
2256
|
};
|
|
2250
2257
|
}
|
|
2251
|
-
|
|
2252
|
-
})(
|
|
2253
|
-
function u(
|
|
2254
|
-
const { cost: o, currency: m } = Xe(t, String(
|
|
2258
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
2259
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
2260
|
+
function u(s, t, n, i) {
|
|
2261
|
+
const { cost: o, currency: m } = Xe(t, String(s.line), s.item.id), l = A.fromNumber(s.adjustQtyBy), f = A.fromNumber(o), d = Re.FCurrency.safeParse(m), I = d.success ? d.data : he;
|
|
2255
2262
|
return {
|
|
2256
2263
|
id: "",
|
|
2257
|
-
externalId: String(
|
|
2264
|
+
externalId: String(s.line),
|
|
2258
2265
|
sku: n,
|
|
2259
2266
|
amount: {
|
|
2260
2267
|
amount: l.amount,
|
|
@@ -2268,12 +2275,12 @@ var Ie;
|
|
|
2268
2275
|
measurement: i ?? null
|
|
2269
2276
|
};
|
|
2270
2277
|
}
|
|
2271
|
-
|
|
2272
|
-
function c(
|
|
2273
|
-
const i = A.fromNumber(
|
|
2278
|
+
g(u, "toPurchaseOrderReceived"), a.toPurchaseOrderReceived = u;
|
|
2279
|
+
function c(s, t, n) {
|
|
2280
|
+
const i = A.fromNumber(s.adjustQtyBy), o = A.fromNumber(0);
|
|
2274
2281
|
return {
|
|
2275
2282
|
id: "",
|
|
2276
|
-
externalId: String(
|
|
2283
|
+
externalId: String(s.line),
|
|
2277
2284
|
sku: t,
|
|
2278
2285
|
code: t.code,
|
|
2279
2286
|
name: t.name,
|
|
@@ -2289,16 +2296,16 @@ var Ie;
|
|
|
2289
2296
|
measurement: n ?? null
|
|
2290
2297
|
};
|
|
2291
2298
|
}
|
|
2292
|
-
|
|
2293
|
-
}(
|
|
2294
|
-
})(
|
|
2299
|
+
g(c, "toPurchaseOrderItem"), a.toPurchaseOrderItem = c;
|
|
2300
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
2301
|
+
})(pe || (pe = {}));
|
|
2295
2302
|
var yt;
|
|
2296
|
-
(function(
|
|
2303
|
+
(function(r) {
|
|
2297
2304
|
(function(a) {
|
|
2298
|
-
function u(
|
|
2299
|
-
const { setting: t, sourceLocationId: n, destinationLocationId: i, subsidiaryId: o, effectiveAt: m, orderItems: l, newAdjustmentId: f } =
|
|
2300
|
-
const p = t.items.find((
|
|
2301
|
-
return
|
|
2305
|
+
function u(s) {
|
|
2306
|
+
const { setting: t, sourceLocationId: n, destinationLocationId: i, subsidiaryId: o, effectiveAt: m, orderItems: l, newAdjustmentId: f } = s, d = l.map((I) => {
|
|
2307
|
+
const p = t.items.find((E) => E.id === I.sku._id);
|
|
2308
|
+
return pe.ToNetSuite.toCreateDto({
|
|
2302
2309
|
orderItem: I,
|
|
2303
2310
|
nsUnitTypes: t.units,
|
|
2304
2311
|
nsItemSetting: p
|
|
@@ -2321,18 +2328,18 @@ var yt;
|
|
|
2321
2328
|
custbody_fm_adjustment_id: f
|
|
2322
2329
|
};
|
|
2323
2330
|
}
|
|
2324
|
-
|
|
2325
|
-
function c(
|
|
2331
|
+
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
2332
|
+
function c(s, t) {
|
|
2326
2333
|
return {
|
|
2327
|
-
custbody_fm_po_id:
|
|
2328
|
-
custbody_fm_po_num:
|
|
2334
|
+
custbody_fm_po_id: s._id,
|
|
2335
|
+
custbody_fm_po_num: s.seqNumber,
|
|
2329
2336
|
custbody_fm_po_request_id: t == null ? void 0 : t._id
|
|
2330
2337
|
};
|
|
2331
2338
|
}
|
|
2332
|
-
|
|
2333
|
-
})(
|
|
2334
|
-
function u(
|
|
2335
|
-
const { nsInventoryTransfer: t, transferItemMapping: n } =
|
|
2339
|
+
g(c, "toUpdateDto"), a.toUpdateDto = c;
|
|
2340
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
2341
|
+
function u(s) {
|
|
2342
|
+
const { nsInventoryTransfer: t, transferItemMapping: n } = s, i = new Date(t.createdDate), [o, m, l] = t.tranDate.split("-"), f = new Date(Number(o), Number(m) - 1, Number(l)), d = {
|
|
2336
2343
|
_id: "",
|
|
2337
2344
|
name: t.location.refName,
|
|
2338
2345
|
internal: Kt.Enum.restaurant,
|
|
@@ -2347,10 +2354,10 @@ var yt;
|
|
|
2347
2354
|
id: t.id,
|
|
2348
2355
|
refNo: t.tranId,
|
|
2349
2356
|
recordType: Be.Enum.inventoryTransfer
|
|
2350
|
-
},
|
|
2357
|
+
}, E = {
|
|
2351
2358
|
received: t.inventory.items.map((S) => {
|
|
2352
2359
|
const v = n[S.line].sku, C = n[S.line].measurement;
|
|
2353
|
-
return
|
|
2360
|
+
return pe.FromNetSuite.toPurchaseOrderReceived(S, t.glImpacts ?? [], v, C);
|
|
2354
2361
|
}),
|
|
2355
2362
|
createdBy: {
|
|
2356
2363
|
name: "",
|
|
@@ -2362,11 +2369,11 @@ var yt;
|
|
|
2362
2369
|
effectiveAt: f.toISOString()
|
|
2363
2370
|
}, y = t.inventory.items.map((S) => {
|
|
2364
2371
|
const v = n[S.line].sku, C = n[S.line].measurement;
|
|
2365
|
-
return
|
|
2372
|
+
return pe.FromNetSuite.toPurchaseOrderItem(S, v, C);
|
|
2366
2373
|
});
|
|
2367
2374
|
return {
|
|
2368
|
-
_id:
|
|
2369
|
-
prefix:
|
|
2375
|
+
_id: O({
|
|
2376
|
+
prefix: R.Enum.purchaseOrder,
|
|
2370
2377
|
dateTime: i.toISOString()
|
|
2371
2378
|
}),
|
|
2372
2379
|
version: "2",
|
|
@@ -2376,7 +2383,7 @@ var yt;
|
|
|
2376
2383
|
seqNumber: t.custbody_fm_po_num ?? 0,
|
|
2377
2384
|
items: y,
|
|
2378
2385
|
deliveryOrder: [
|
|
2379
|
-
|
|
2386
|
+
E
|
|
2380
2387
|
],
|
|
2381
2388
|
request: t.custbody_fm_po_request_id ? {
|
|
2382
2389
|
id: t.custbody_fm_po_request_id,
|
|
@@ -2385,10 +2392,10 @@ var yt;
|
|
|
2385
2392
|
netSuite: I
|
|
2386
2393
|
};
|
|
2387
2394
|
}
|
|
2388
|
-
|
|
2389
|
-
function c(
|
|
2395
|
+
g(u, "transformTransferIn"), a.transformTransferIn = u;
|
|
2396
|
+
function c(s) {
|
|
2390
2397
|
var v, C, N, b, D, F;
|
|
2391
|
-
const { sourceLocation: t, nsInventoryTransfer: n, transferItemMapping: i } =
|
|
2398
|
+
const { sourceLocation: t, nsInventoryTransfer: n, transferItemMapping: i } = s, o = new Date(n.createdDate), [m, l, f] = n.tranDate.split("-"), d = new Date(Number(m), Number(l) - 1, Number(f)), I = {
|
|
2392
2399
|
_id: t.doc._id,
|
|
2393
2400
|
internal: t.type,
|
|
2394
2401
|
contactName: t.doc.profile.name,
|
|
@@ -2415,7 +2422,7 @@ var yt;
|
|
|
2415
2422
|
}, y = {
|
|
2416
2423
|
received: n.inventory.items.map((w) => {
|
|
2417
2424
|
const U = i[w.line].sku, B = i[w.line].measurement;
|
|
2418
|
-
return
|
|
2425
|
+
return pe.FromNetSuite.toPurchaseOrderReceived(w, n.glImpacts ?? [], U, B);
|
|
2419
2426
|
}),
|
|
2420
2427
|
createdBy: {
|
|
2421
2428
|
name: "",
|
|
@@ -2427,11 +2434,11 @@ var yt;
|
|
|
2427
2434
|
effectiveAt: d.toISOString()
|
|
2428
2435
|
}, _ = n.inventory.items.map((w) => {
|
|
2429
2436
|
const U = i[w.line].sku, B = i[w.line].measurement;
|
|
2430
|
-
return
|
|
2437
|
+
return pe.FromNetSuite.toPurchaseOrderItem(w, U, B);
|
|
2431
2438
|
});
|
|
2432
2439
|
return {
|
|
2433
|
-
_id:
|
|
2434
|
-
prefix:
|
|
2440
|
+
_id: O({
|
|
2441
|
+
prefix: R.Enum.purchaseOrder,
|
|
2435
2442
|
dateTime: o.toISOString()
|
|
2436
2443
|
}),
|
|
2437
2444
|
version: "2",
|
|
@@ -2450,34 +2457,34 @@ var yt;
|
|
|
2450
2457
|
netSuite: p
|
|
2451
2458
|
};
|
|
2452
2459
|
}
|
|
2453
|
-
|
|
2454
|
-
}(
|
|
2460
|
+
g(c, "transformTransferOut"), a.transformTransferOut = c;
|
|
2461
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
2455
2462
|
})(yt || (yt = {}));
|
|
2456
|
-
function
|
|
2457
|
-
const
|
|
2463
|
+
function ge(r, a, u, c) {
|
|
2464
|
+
const s = {};
|
|
2458
2465
|
return c.forEach((t) => {
|
|
2459
|
-
"itemType" in t && t.itemType.id === "Service" || (
|
|
2460
|
-
}),
|
|
2466
|
+
"itemType" in t && t.itemType.id === "Service" || (s[t.line] = Ot(r, a, u, t.item.id, t.units));
|
|
2467
|
+
}), s;
|
|
2461
2468
|
}
|
|
2462
|
-
|
|
2463
|
-
function
|
|
2469
|
+
g(ge, "validateOrderItems");
|
|
2470
|
+
function Ot(r, a, u, c, s) {
|
|
2464
2471
|
const t = u.items.find((f) => f.netSuiteId === c);
|
|
2465
2472
|
if (!t)
|
|
2466
2473
|
throw new Error(`SKU with ID ${c} not found in settings`);
|
|
2467
|
-
const n =
|
|
2474
|
+
const n = r.find((f) => f._id === t.id);
|
|
2468
2475
|
if (!n)
|
|
2469
2476
|
throw new Error(`SKU with ID ${t.id} not matched`);
|
|
2470
2477
|
const i = u.units.find((f) => f.netSuiteId === t.unitTypeId);
|
|
2471
2478
|
if (!i)
|
|
2472
2479
|
throw new Error(`Unit with ID ${t.unitTypeId} not found in settings`);
|
|
2473
|
-
const o =
|
|
2480
|
+
const o = s == (i == null ? void 0 : i.baseUnitUnitOfMeasureId), m = a.find((f) => f._id === i.id);
|
|
2474
2481
|
if (!m)
|
|
2475
2482
|
throw new Error(`Unit with ID ${t.unitTypeId} not matched`);
|
|
2476
2483
|
let l;
|
|
2477
2484
|
if (!o) {
|
|
2478
|
-
const f = i.measurements.find((d) => d.netSuiteId ===
|
|
2485
|
+
const f = i.measurements.find((d) => d.netSuiteId === s);
|
|
2479
2486
|
if (!f)
|
|
2480
|
-
throw new Error(`Measurement with ID ${
|
|
2487
|
+
throw new Error(`Measurement with ID ${s} not found in unit "${i == null ? void 0 : i.id}"`);
|
|
2481
2488
|
if (l = m.measurements.find((d) => d.id === f.id), !l)
|
|
2482
2489
|
throw new Error(`Measurement with ID ${f.id} not found in SKU ${n._id}`);
|
|
2483
2490
|
}
|
|
@@ -2486,64 +2493,64 @@ function Rt(s, a, u, c, r) {
|
|
|
2486
2493
|
measurement: l
|
|
2487
2494
|
};
|
|
2488
2495
|
}
|
|
2489
|
-
|
|
2490
|
-
function Nn(
|
|
2491
|
-
const u =
|
|
2492
|
-
const { id: t, quantity: n } =
|
|
2496
|
+
g(Ot, "validateNetSuiteOrderItem");
|
|
2497
|
+
function Nn(r, a) {
|
|
2498
|
+
const u = r.items.reduce((c, s) => {
|
|
2499
|
+
const { id: t, quantity: n } = s;
|
|
2493
2500
|
return c[t] || (c[t] = A.fromNumber(0)), c[t] = A.add([
|
|
2494
2501
|
c[t],
|
|
2495
2502
|
n
|
|
2496
2503
|
]), c;
|
|
2497
2504
|
}, {});
|
|
2498
2505
|
for (const c of a) {
|
|
2499
|
-
const
|
|
2500
|
-
for (const t of
|
|
2506
|
+
const s = c.received;
|
|
2507
|
+
for (const t of s)
|
|
2501
2508
|
u[t.id] = A.subtract([
|
|
2502
2509
|
u[t.id],
|
|
2503
2510
|
t.amount
|
|
2504
2511
|
]);
|
|
2505
2512
|
}
|
|
2506
|
-
return Object.entries(u).reduce((c, [
|
|
2513
|
+
return Object.entries(u).reduce((c, [s, t]) => (A.smallerThan({
|
|
2507
2514
|
a: t,
|
|
2508
2515
|
b: A.fromNumber(0)
|
|
2509
|
-
}) && (c[
|
|
2516
|
+
}) && (c[s] = t), c), {});
|
|
2510
2517
|
}
|
|
2511
|
-
|
|
2512
|
-
function Cn(
|
|
2513
|
-
const u =
|
|
2514
|
-
const { id: t, amount: n } =
|
|
2518
|
+
g(Nn, "validatePurchaseOrderOverReceive");
|
|
2519
|
+
function Cn(r, a) {
|
|
2520
|
+
const u = r.items.reduce((c, s) => {
|
|
2521
|
+
const { id: t, amount: n } = s;
|
|
2515
2522
|
return c[t] || (c[t] = A.fromNumber(0)), c[t] = A.add([
|
|
2516
2523
|
c[t],
|
|
2517
2524
|
n
|
|
2518
2525
|
]), c;
|
|
2519
2526
|
}, {});
|
|
2520
2527
|
for (const c of a) {
|
|
2521
|
-
const
|
|
2522
|
-
for (const t of
|
|
2528
|
+
const s = c.received;
|
|
2529
|
+
for (const t of s)
|
|
2523
2530
|
u[t.id] = A.subtract([
|
|
2524
2531
|
u[t.id],
|
|
2525
2532
|
t.amount
|
|
2526
2533
|
]);
|
|
2527
2534
|
}
|
|
2528
|
-
return Object.entries(u).reduce((c, [
|
|
2535
|
+
return Object.entries(u).reduce((c, [s, t]) => (A.smallerThan({
|
|
2529
2536
|
a: t,
|
|
2530
2537
|
b: A.fromNumber(0)
|
|
2531
|
-
}) && (c[
|
|
2538
|
+
}) && (c[s] = t), c), {});
|
|
2532
2539
|
}
|
|
2533
|
-
|
|
2540
|
+
g(Cn, "validateItemFulfillmentOverReceive");
|
|
2534
2541
|
var _t;
|
|
2535
|
-
(function(
|
|
2542
|
+
(function(r) {
|
|
2536
2543
|
(function(a) {
|
|
2537
|
-
function u(
|
|
2544
|
+
function u(s, t) {
|
|
2538
2545
|
var n, i;
|
|
2539
2546
|
if (t)
|
|
2540
2547
|
throw new Error("NetSuite Transfer Order already exists");
|
|
2541
|
-
if ((i = (n =
|
|
2548
|
+
if ((i = (n = s.netSuite) == null ? void 0 : n.subsidiary) != null && i.id)
|
|
2542
2549
|
throw new Error("NetSuite subsidiary ID is required");
|
|
2543
2550
|
}
|
|
2544
|
-
|
|
2545
|
-
function c(
|
|
2546
|
-
const { orderStatus: t, processedAt: n, rejectedAt: i } =
|
|
2551
|
+
g(u, "validateCreate"), a.validateCreate = u;
|
|
2552
|
+
function c(s) {
|
|
2553
|
+
const { orderStatus: t, processedAt: n, rejectedAt: i } = s;
|
|
2547
2554
|
if (!t || !t.id)
|
|
2548
2555
|
throw new Error("Missing transfer order status");
|
|
2549
2556
|
if (n && i)
|
|
@@ -2553,12 +2560,12 @@ var _t;
|
|
|
2553
2560
|
id: xe(k.B)
|
|
2554
2561
|
} : t;
|
|
2555
2562
|
}
|
|
2556
|
-
|
|
2557
|
-
})(
|
|
2558
|
-
function u(c,
|
|
2563
|
+
g(c, "validateApprovalStatus"), a.validateApprovalStatus = c;
|
|
2564
|
+
})(r.ToNetSuite || (r.ToNetSuite = {})), function(a) {
|
|
2565
|
+
function u(c, s, t, n) {
|
|
2559
2566
|
const i = c.every((l) => l.isClosed);
|
|
2560
2567
|
let o = {
|
|
2561
|
-
...
|
|
2568
|
+
...s
|
|
2562
2569
|
};
|
|
2563
2570
|
const m = {};
|
|
2564
2571
|
if (i) {
|
|
@@ -2580,44 +2587,44 @@ var _t;
|
|
|
2580
2587
|
adjustmentGoingToDeleteMap: m
|
|
2581
2588
|
};
|
|
2582
2589
|
}
|
|
2583
|
-
|
|
2584
|
-
}(
|
|
2590
|
+
g(u, "isVoided"), a.isVoided = u;
|
|
2591
|
+
}(r.FromNetSuite || (r.FromNetSuite = {}));
|
|
2585
2592
|
})(_t || (_t = {}));
|
|
2586
|
-
function An(
|
|
2587
|
-
const u =
|
|
2588
|
-
for (const
|
|
2589
|
-
const t =
|
|
2590
|
-
if (
|
|
2591
|
-
if (n >
|
|
2592
|
-
console.warn(`Quantity fulfilled (${n}) is greater than order item (${
|
|
2593
|
+
function An(r, a) {
|
|
2594
|
+
const u = r.reduce((s, t) => (s[t.line] = (s[t.line] || 0) + t.quantity, s), {}), c = [];
|
|
2595
|
+
for (const s of a) {
|
|
2596
|
+
const t = s.line, n = u[t] ?? 0;
|
|
2597
|
+
if (s.quantity !== n) {
|
|
2598
|
+
if (n > s.quantity) {
|
|
2599
|
+
console.warn(`Quantity fulfilled (${n}) is greater than order item (${s.quantity}) for line ${t}`);
|
|
2593
2600
|
continue;
|
|
2594
2601
|
}
|
|
2595
|
-
c.push(
|
|
2602
|
+
c.push(s);
|
|
2596
2603
|
}
|
|
2597
2604
|
}
|
|
2598
2605
|
return c;
|
|
2599
2606
|
}
|
|
2600
|
-
|
|
2601
|
-
function Mn(
|
|
2607
|
+
g(An, "getAvailableItemToBeFulfilled");
|
|
2608
|
+
function Mn(r) {
|
|
2602
2609
|
var l, f;
|
|
2603
|
-
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } =
|
|
2610
|
+
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } = r, s = u.reduce((d, I) => (d[I.id] = I, d), {}), t = c.reduce((d, I) => (d[I.netSuiteId] = I, d), {}), n = /* @__PURE__ */ new Set(), i = [];
|
|
2604
2611
|
for (const d of a) {
|
|
2605
2612
|
let I = d;
|
|
2606
2613
|
try {
|
|
2607
|
-
const p =
|
|
2614
|
+
const p = s[d._id];
|
|
2608
2615
|
if (!p)
|
|
2609
2616
|
throw new Error(`Missing NetSuite assembly item config for SKU with ID ${d._id}`);
|
|
2610
|
-
const
|
|
2611
|
-
if (!
|
|
2617
|
+
const E = t[p.netSuiteId];
|
|
2618
|
+
if (!E)
|
|
2612
2619
|
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${d._id}`);
|
|
2613
|
-
if (!
|
|
2620
|
+
if (!E.skuCache)
|
|
2614
2621
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
2615
|
-
if (
|
|
2616
|
-
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${
|
|
2617
|
-
if (
|
|
2618
|
-
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${d._id}', but got '${
|
|
2622
|
+
if (E.itemType !== V.Enum.Assembly)
|
|
2623
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${E.itemType}'. Expected 'Assembly'.`);
|
|
2624
|
+
if (E.skuCache._id !== d._id)
|
|
2625
|
+
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${d._id}', but got '${E.skuCache._id}'`);
|
|
2619
2626
|
I = {
|
|
2620
|
-
...
|
|
2627
|
+
...E.skuCache,
|
|
2621
2628
|
customAttributes: d.customAttributes
|
|
2622
2629
|
};
|
|
2623
2630
|
} catch (p) {
|
|
@@ -2652,12 +2659,12 @@ function Mn(s) {
|
|
|
2652
2659
|
updatedParentItemConfigs: o
|
|
2653
2660
|
};
|
|
2654
2661
|
}
|
|
2655
|
-
|
|
2656
|
-
function Un(
|
|
2662
|
+
g(Mn, "syncAssemblyParentItemsWithLegacyConfig");
|
|
2663
|
+
function Un(r) {
|
|
2657
2664
|
var t, n;
|
|
2658
|
-
const { legacyChildItemConfigs: a, childReplicas: u } =
|
|
2665
|
+
const { legacyChildItemConfigs: a, childReplicas: u } = r, c = [], s = /* @__PURE__ */ new Set();
|
|
2659
2666
|
for (const i of u)
|
|
2660
|
-
|
|
2667
|
+
s.add(i.netSuiteId), c.push({
|
|
2661
2668
|
name: i.name,
|
|
2662
2669
|
netSuiteId: i.netSuiteId,
|
|
2663
2670
|
parentNetSuiteId: i.parentNetSuiteId,
|
|
@@ -2672,30 +2679,30 @@ function Un(s) {
|
|
|
2672
2679
|
pktName: ((n = i.customFields) == null ? void 0 : n.pktName) ?? null
|
|
2673
2680
|
});
|
|
2674
2681
|
for (const i of a)
|
|
2675
|
-
i.itemType !== V.Enum.Assembly && !
|
|
2682
|
+
i.itemType !== V.Enum.Assembly && !s.has(i.netSuiteId) && c.push(i);
|
|
2676
2683
|
return c;
|
|
2677
2684
|
}
|
|
2678
|
-
|
|
2679
|
-
function Fn(
|
|
2685
|
+
g(Un, "syncAssemblyChildItemsWithLegacyConfig");
|
|
2686
|
+
function Fn(r) {
|
|
2680
2687
|
var l, f;
|
|
2681
|
-
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } =
|
|
2688
|
+
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } = r, s = u.reduce((d, I) => (d[I.id] = I, d), {}), t = c.reduce((d, I) => (d[I.netSuiteId] = I, d), {}), n = /* @__PURE__ */ new Set(), i = [];
|
|
2682
2689
|
for (const d of a) {
|
|
2683
2690
|
let I = d;
|
|
2684
2691
|
try {
|
|
2685
|
-
const p =
|
|
2692
|
+
const p = s[d._id];
|
|
2686
2693
|
if (!p)
|
|
2687
2694
|
throw new Error(`Missing NetSuite inventory item config for SKU with ID ${d._id}`);
|
|
2688
|
-
const
|
|
2689
|
-
if (!
|
|
2695
|
+
const E = t[p.netSuiteId];
|
|
2696
|
+
if (!E)
|
|
2690
2697
|
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${d._id}`);
|
|
2691
|
-
if (!
|
|
2698
|
+
if (!E.skuCache)
|
|
2692
2699
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
2693
|
-
if (
|
|
2694
|
-
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${
|
|
2695
|
-
if (
|
|
2696
|
-
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${d._id}', but got '${
|
|
2700
|
+
if (E.itemType !== V.Enum.InvtPart)
|
|
2701
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${E.itemType}'. Expected 'InvtPart'.`);
|
|
2702
|
+
if (E.skuCache._id !== d._id)
|
|
2703
|
+
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${d._id}', but got '${E.skuCache._id}'`);
|
|
2697
2704
|
I = {
|
|
2698
|
-
...
|
|
2705
|
+
...E.skuCache,
|
|
2699
2706
|
customAttributes: d.customAttributes
|
|
2700
2707
|
};
|
|
2701
2708
|
} catch (p) {
|
|
@@ -2730,12 +2737,12 @@ function Fn(s) {
|
|
|
2730
2737
|
updatedParentItemConfigs: o
|
|
2731
2738
|
};
|
|
2732
2739
|
}
|
|
2733
|
-
|
|
2734
|
-
function wn(
|
|
2740
|
+
g(Fn, "syncInventoryParentItemsWithLegacyConfig");
|
|
2741
|
+
function wn(r) {
|
|
2735
2742
|
var t, n;
|
|
2736
|
-
const { legacyChildItemConfigs: a, childReplicas: u } =
|
|
2743
|
+
const { legacyChildItemConfigs: a, childReplicas: u } = r, c = [], s = /* @__PURE__ */ new Set();
|
|
2737
2744
|
for (const i of u)
|
|
2738
|
-
|
|
2745
|
+
s.add(i.netSuiteId), c.push({
|
|
2739
2746
|
name: i.name,
|
|
2740
2747
|
netSuiteId: i.netSuiteId,
|
|
2741
2748
|
parentNetSuiteId: i.parentNetSuiteId,
|
|
@@ -2750,24 +2757,24 @@ function wn(s) {
|
|
|
2750
2757
|
pktName: ((n = i.customFields) == null ? void 0 : n.pktName) ?? null
|
|
2751
2758
|
});
|
|
2752
2759
|
for (const i of a)
|
|
2753
|
-
i.itemType !== V.Enum.InvtPart && !
|
|
2760
|
+
i.itemType !== V.Enum.InvtPart && !s.has(i.netSuiteId) && c.push(i);
|
|
2754
2761
|
return c;
|
|
2755
2762
|
}
|
|
2756
|
-
|
|
2763
|
+
g(wn, "syncInventoryChildItemsWithLegacyConfig");
|
|
2757
2764
|
var h;
|
|
2758
|
-
(function(
|
|
2759
|
-
|
|
2765
|
+
(function(r) {
|
|
2766
|
+
r.ITEM_CREATED = "ITEM_CREATED", r.ITEM_UPDATED = "ITEM_UPDATED", r.ITEM_DELETED = "ITEM_DELETED", r.ITEM_DUPLICATE = "ITEM_DUPLICATE", r.ITEM_RECEIPT_ITEM_CREATED = "ITEM_RECEIPT_ITEM_CREATED", r.ITEM_RECEIPT_ITEM_UPDATED = "ITEM_RECEIPT_ITEM_UPDATED", r.ITEM_RECEIPT_ITEM_DELETED = "ITEM_RECEIPT_ITEM_DELETED", r.ITEM_FULFILLMENT_ITEM_CREATED = "ITEM_FULFILLMENT_ITEM_CREATED", r.ITEM_FULFILLMENT_ITEM_UPDATED = "ITEM_FULFILLMENT_ITEM_UPDATED", r.ITEM_FULFILLMENT_ITEM_DELETED = "ITEM_FULFILLMENT_ITEM_DELETED";
|
|
2760
2767
|
})(h || (h = {}));
|
|
2761
|
-
function ne(
|
|
2762
|
-
return a.reduce((u, c) => u.replace("$", c),
|
|
2768
|
+
function ne(r, a) {
|
|
2769
|
+
return a.reduce((u, c) => u.replace("$", c), r);
|
|
2763
2770
|
}
|
|
2764
|
-
|
|
2771
|
+
g(ne, "replacePlaceholders");
|
|
2765
2772
|
var Te = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
2766
|
-
function
|
|
2773
|
+
function _e(r, a, u, c, s = !1) {
|
|
2767
2774
|
const t = [];
|
|
2768
|
-
if ((c === ee.Enum[2] ||
|
|
2775
|
+
if ((c === ee.Enum[2] || s) && a.length != 0 && a.every((n) => !n.externalId))
|
|
2769
2776
|
for (let n = 0; n < a.length; n++) {
|
|
2770
|
-
const i =
|
|
2777
|
+
const i = r[n];
|
|
2771
2778
|
if (!i)
|
|
2772
2779
|
throw new Error("Incoming item is undefined");
|
|
2773
2780
|
t.push({
|
|
@@ -2790,7 +2797,7 @@ function ye(s, a, u, c, r = !1) {
|
|
|
2790
2797
|
}), a[n].externalId = i.externalId;
|
|
2791
2798
|
}
|
|
2792
2799
|
for (const n of a)
|
|
2793
|
-
|
|
2800
|
+
r.find((o) => c == "2" ? o.externalId === n.externalId : o.sku._id === n.sku._id) || t.push({
|
|
2794
2801
|
type: h.ITEM_DELETED,
|
|
2795
2802
|
message: `Order Item ${u} does not match sku ${n.sku._id} with existing line [${n.externalId}]`,
|
|
2796
2803
|
data: {
|
|
@@ -2798,7 +2805,7 @@ function ye(s, a, u, c, r = !1) {
|
|
|
2798
2805
|
recordId: u
|
|
2799
2806
|
}
|
|
2800
2807
|
});
|
|
2801
|
-
for (const n of
|
|
2808
|
+
for (const n of r) {
|
|
2802
2809
|
const i = a.find((o) => c == "2" ? o.externalId === n.externalId : o.sku._id === n.sku._id);
|
|
2803
2810
|
if (!i)
|
|
2804
2811
|
t.push({
|
|
@@ -2868,10 +2875,10 @@ function ye(s, a, u, c, r = !1) {
|
|
|
2868
2875
|
}
|
|
2869
2876
|
return t;
|
|
2870
2877
|
}
|
|
2871
|
-
|
|
2872
|
-
function tt(
|
|
2878
|
+
g(_e, "detectPurchaseOrderItemConflicts");
|
|
2879
|
+
function tt(r, a, u, c, s) {
|
|
2873
2880
|
const t = [], n = {};
|
|
2874
|
-
if (
|
|
2881
|
+
if (s === ee.Enum[2] && c.length != 0 && c.every((i) => !i.externalId))
|
|
2875
2882
|
for (let i = 0; i < c.length; i++) {
|
|
2876
2883
|
const o = u[i];
|
|
2877
2884
|
if (!o)
|
|
@@ -2886,7 +2893,7 @@ function tt(s, a, u, c, r) {
|
|
|
2886
2893
|
`${o.externalId}`
|
|
2887
2894
|
]),
|
|
2888
2895
|
data: {
|
|
2889
|
-
recordId:
|
|
2896
|
+
recordId: r,
|
|
2890
2897
|
field: "externalId",
|
|
2891
2898
|
externalId: o.externalId,
|
|
2892
2899
|
incomingValue: o.externalId,
|
|
@@ -2895,33 +2902,33 @@ function tt(s, a, u, c, r) {
|
|
|
2895
2902
|
}), c[i].externalId = o.externalId;
|
|
2896
2903
|
}
|
|
2897
2904
|
for (const i of c) {
|
|
2898
|
-
const o = u.find((m) =>
|
|
2905
|
+
const o = u.find((m) => s == "2" ? m.externalId === i.externalId : m.sku._id === i.sku._id);
|
|
2899
2906
|
o || t.push({
|
|
2900
2907
|
type: a === "deliveryFulfillment" ? h.ITEM_FULFILLMENT_ITEM_DELETED : h.ITEM_RECEIPT_ITEM_DELETED,
|
|
2901
|
-
message: `${a} ${
|
|
2908
|
+
message: `${a} ${r} does match sku ${i.sku._id} with existing line [${i.externalId}]`,
|
|
2902
2909
|
data: {
|
|
2903
2910
|
lineItem: o,
|
|
2904
2911
|
existinglineItem: i,
|
|
2905
|
-
recordId:
|
|
2912
|
+
recordId: r
|
|
2906
2913
|
}
|
|
2907
2914
|
});
|
|
2908
2915
|
}
|
|
2909
2916
|
for (const i of u) {
|
|
2910
|
-
const o = c.find((m) =>
|
|
2917
|
+
const o = c.find((m) => s == "2" ? m.externalId === i.externalId : m.sku._id === i.sku._id);
|
|
2911
2918
|
if (!o)
|
|
2912
2919
|
t.push({
|
|
2913
2920
|
type: a === "deliveryFulfillment" ? h.ITEM_FULFILLMENT_ITEM_CREATED : h.ITEM_RECEIPT_ITEM_CREATED,
|
|
2914
|
-
message: `${a} ${
|
|
2921
|
+
message: `${a} ${r} does not have sku ${i.sku._id} with line [${i.externalId}]`,
|
|
2915
2922
|
data: {
|
|
2916
2923
|
lineItem: i,
|
|
2917
|
-
recordId:
|
|
2924
|
+
recordId: r
|
|
2918
2925
|
}
|
|
2919
2926
|
});
|
|
2920
2927
|
else {
|
|
2921
2928
|
i.id && i.externalId && (n[i.id] = i.externalId);
|
|
2922
2929
|
const m = Object.keys(Yt.shape);
|
|
2923
2930
|
for (const l of m) {
|
|
2924
|
-
if (l === "id" || l === "externalId" &&
|
|
2931
|
+
if (l === "id" || l === "externalId" && s === ee.Enum[1])
|
|
2925
2932
|
continue;
|
|
2926
2933
|
if (l === "sku") {
|
|
2927
2934
|
i[l]._id !== o[l]._id && t.push({
|
|
@@ -2934,7 +2941,7 @@ function tt(s, a, u, c, r) {
|
|
|
2934
2941
|
`${i[l]._id}`
|
|
2935
2942
|
]),
|
|
2936
2943
|
data: {
|
|
2937
|
-
recordId:
|
|
2944
|
+
recordId: r,
|
|
2938
2945
|
recordType: a,
|
|
2939
2946
|
sku: o.sku,
|
|
2940
2947
|
externalId: i.externalId,
|
|
@@ -2961,7 +2968,7 @@ function tt(s, a, u, c, r) {
|
|
|
2961
2968
|
`${p}`
|
|
2962
2969
|
]),
|
|
2963
2970
|
data: {
|
|
2964
|
-
recordId:
|
|
2971
|
+
recordId: r,
|
|
2965
2972
|
recordType: a,
|
|
2966
2973
|
sku: o.sku,
|
|
2967
2974
|
externalId: i.externalId,
|
|
@@ -2976,70 +2983,70 @@ function tt(s, a, u, c, r) {
|
|
|
2976
2983
|
}
|
|
2977
2984
|
return t;
|
|
2978
2985
|
}
|
|
2979
|
-
|
|
2980
|
-
function Ve(
|
|
2986
|
+
g(tt, "detectPurchaseOrderReceivedConflicts");
|
|
2987
|
+
function Ve(r, a, u = "1") {
|
|
2981
2988
|
if (a.length === 0)
|
|
2982
|
-
return
|
|
2989
|
+
return r;
|
|
2983
2990
|
const c = [
|
|
2984
|
-
...
|
|
2991
|
+
...r
|
|
2985
2992
|
];
|
|
2986
|
-
for (const
|
|
2987
|
-
if (
|
|
2988
|
-
...
|
|
2989
|
-
id:
|
|
2990
|
-
}),
|
|
2993
|
+
for (const s of a) {
|
|
2994
|
+
if (s.type === h.ITEM_CREATED && c.push({
|
|
2995
|
+
...s.data.lineItem,
|
|
2996
|
+
id: s.data.lineItem.id || crypto.randomUUID()
|
|
2997
|
+
}), s.type === h.ITEM_UPDATED) {
|
|
2991
2998
|
let t = -1;
|
|
2992
|
-
u == "2" ? t = c.findIndex((n) => n.externalId ===
|
|
2999
|
+
u == "2" ? t = c.findIndex((n) => n.externalId === s.data.externalId) : s.data.sku && (t = c.findIndex((n) => n.sku._id === s.data.sku._id)), t !== -1 && (c[t][s.data.field] = s.data.incomingValue);
|
|
2993
3000
|
}
|
|
2994
|
-
if (
|
|
2995
|
-
const t = c.findIndex((n) => n.externalId ===
|
|
3001
|
+
if (s.type === h.ITEM_DELETED) {
|
|
3002
|
+
const t = c.findIndex((n) => n.externalId === s.data.existinglineItem.externalId);
|
|
2996
3003
|
t !== -1 && c.splice(t, 1);
|
|
2997
3004
|
}
|
|
2998
3005
|
}
|
|
2999
|
-
return c.map((
|
|
3000
|
-
...
|
|
3001
|
-
id:
|
|
3006
|
+
return c.map((s) => ({
|
|
3007
|
+
...s,
|
|
3008
|
+
id: s.id || crypto.randomUUID()
|
|
3002
3009
|
}));
|
|
3003
3010
|
}
|
|
3004
|
-
|
|
3005
|
-
function nt(
|
|
3011
|
+
g(Ve, "resolvePurchaseOrderItemConflicts");
|
|
3012
|
+
function nt(r, a, u = "1") {
|
|
3006
3013
|
if (a.length === 0)
|
|
3007
|
-
return
|
|
3014
|
+
return r;
|
|
3008
3015
|
const c = [
|
|
3009
|
-
...
|
|
3016
|
+
...r
|
|
3010
3017
|
];
|
|
3011
|
-
for (const
|
|
3012
|
-
if ((
|
|
3013
|
-
...
|
|
3014
|
-
id:
|
|
3015
|
-
}),
|
|
3018
|
+
for (const s of a) {
|
|
3019
|
+
if ((s.type === h.ITEM_CREATED || s.type === h.ITEM_RECEIPT_ITEM_CREATED || s.type === h.ITEM_FULFILLMENT_ITEM_CREATED) && c.push({
|
|
3020
|
+
...s.data.lineItem,
|
|
3021
|
+
id: s.data.lineItem.id || crypto.randomUUID()
|
|
3022
|
+
}), s.type === h.ITEM_UPDATED || s.type === h.ITEM_RECEIPT_ITEM_UPDATED || s.type === h.ITEM_FULFILLMENT_ITEM_UPDATED) {
|
|
3016
3023
|
let t = -1;
|
|
3017
|
-
u == "2" ? t = c.findIndex((n) => n.externalId ===
|
|
3024
|
+
u == "2" ? t = c.findIndex((n) => n.externalId === s.data.externalId) : s.data.sku && (t = c.findIndex((n) => n.sku._id === s.data.sku._id)), t !== -1 && (c[t][s.data.field] = s.data.incomingValue);
|
|
3018
3025
|
}
|
|
3019
|
-
if (
|
|
3020
|
-
const t = c.findIndex((n) => n.externalId ===
|
|
3026
|
+
if (s.type === h.ITEM_DELETED || s.type === h.ITEM_RECEIPT_ITEM_DELETED || s.type === h.ITEM_FULFILLMENT_ITEM_DELETED) {
|
|
3027
|
+
const t = c.findIndex((n) => n.externalId === s.data.existinglineItem.externalId);
|
|
3021
3028
|
t !== -1 && c.splice(t, 1);
|
|
3022
3029
|
}
|
|
3023
3030
|
}
|
|
3024
3031
|
return c;
|
|
3025
3032
|
}
|
|
3026
|
-
|
|
3027
|
-
var
|
|
3028
|
-
(function(
|
|
3029
|
-
|
|
3030
|
-
})(
|
|
3033
|
+
g(nt, "resolvePurchaseOrderReceivedConflicts");
|
|
3034
|
+
var ce;
|
|
3035
|
+
(function(r) {
|
|
3036
|
+
r.ITEM_FULFILLMENT_CREATED = "ITEM_FULFILLMENT_CREATED", r.ITEM_FULFILLMENT_UPDATED = "ITEM_FULFILLMENT_UPDATED", r.ITEM_FULFILLMENT_DELETED = "ITEM_FULFILLMENT_DELETED";
|
|
3037
|
+
})(ce || (ce = {}));
|
|
3031
3038
|
var kn = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3032
|
-
function
|
|
3039
|
+
function On(r, a, u) {
|
|
3033
3040
|
var t, n, i;
|
|
3034
|
-
const c = Object.keys(Gt.shape),
|
|
3041
|
+
const c = Object.keys(Gt.shape), s = [];
|
|
3035
3042
|
for (const o of a) {
|
|
3036
|
-
const m =
|
|
3043
|
+
const m = r.find((l) => {
|
|
3037
3044
|
var f;
|
|
3038
3045
|
return ((f = l.netSuite) == null ? void 0 : f.id) === o.netSuite.id;
|
|
3039
3046
|
});
|
|
3040
3047
|
if (!m)
|
|
3041
|
-
|
|
3042
|
-
type:
|
|
3048
|
+
s.push({
|
|
3049
|
+
type: ce.ITEM_FULFILLMENT_CREATED,
|
|
3043
3050
|
message: `New Item Fulfillment ${(t = o.netSuite) == null ? void 0 : t.id} created`,
|
|
3044
3051
|
data: o
|
|
3045
3052
|
});
|
|
@@ -3048,14 +3055,14 @@ function Rn(s, a, u) {
|
|
|
3048
3055
|
if (l === "adjustment" || l === "id")
|
|
3049
3056
|
continue;
|
|
3050
3057
|
if (l === "items") {
|
|
3051
|
-
|
|
3058
|
+
s.push(...tt(m.id, "deliveryFulfillment", o.items, m.items, u));
|
|
3052
3059
|
continue;
|
|
3053
3060
|
}
|
|
3054
3061
|
const f = o[l] ?? null, d = m[l] ?? null;
|
|
3055
3062
|
if (!L.isEqual(f, d)) {
|
|
3056
3063
|
let I = d, p = f;
|
|
3057
|
-
typeof o[l] == "object" && (I = JSON.stringify(d), p = JSON.stringify(f)), l === "createdAt" && (I = new Date(o[l]).toISOString(), p = new Date(m[l]).toISOString()),
|
|
3058
|
-
type:
|
|
3064
|
+
typeof o[l] == "object" && (I = JSON.stringify(d), p = JSON.stringify(f)), l === "createdAt" && (I = new Date(o[l]).toISOString(), p = new Date(m[l]).toISOString()), s.push({
|
|
3065
|
+
type: ce.ITEM_FULFILLMENT_UPDATED,
|
|
3059
3066
|
message: ne(kn, [
|
|
3060
3067
|
"Item Fulfillment Field",
|
|
3061
3068
|
`${(n = o.netSuite) == null ? void 0 : n.id}`,
|
|
@@ -3073,21 +3080,21 @@ function Rn(s, a, u) {
|
|
|
3073
3080
|
}
|
|
3074
3081
|
}
|
|
3075
3082
|
}
|
|
3076
|
-
return
|
|
3083
|
+
return s;
|
|
3077
3084
|
}
|
|
3078
|
-
|
|
3079
|
-
function
|
|
3080
|
-
const u = a.filter((t) => t.type ===
|
|
3085
|
+
g(On, "detectItemFulfillmentConflicts");
|
|
3086
|
+
function Rn(r, a) {
|
|
3087
|
+
const u = a.filter((t) => t.type === ce.ITEM_FULFILLMENT_CREATED || t.type === ce.ITEM_FULFILLMENT_UPDATED || t.type === ce.ITEM_FULFILLMENT_DELETED || t.type === h.ITEM_FULFILLMENT_ITEM_CREATED || t.type === h.ITEM_FULFILLMENT_ITEM_UPDATED || t.type === h.ITEM_FULFILLMENT_ITEM_DELETED), c = [];
|
|
3081
3088
|
if (u.length === 0)
|
|
3082
|
-
return
|
|
3083
|
-
for (const t of
|
|
3089
|
+
return r;
|
|
3090
|
+
for (const t of r) {
|
|
3084
3091
|
const n = u.filter((l) => l.data.recordId != "" && l.data.recordId === t.id), i = n.filter((l) => (l.type === h.ITEM_FULFILLMENT_ITEM_CREATED || l.type === h.ITEM_FULFILLMENT_ITEM_UPDATED || l.type === h.ITEM_FULFILLMENT_ITEM_DELETED) && l.data.recordId === t.id), o = nt(t.items || [], i);
|
|
3085
3092
|
let m = {
|
|
3086
3093
|
...t,
|
|
3087
3094
|
items: o
|
|
3088
3095
|
};
|
|
3089
3096
|
for (const l of n)
|
|
3090
|
-
if (l.type ===
|
|
3097
|
+
if (l.type === ce.ITEM_FULFILLMENT_UPDATED) {
|
|
3091
3098
|
const f = l.data.field, d = l.data.incomingValue, I = t[f];
|
|
3092
3099
|
d !== I && (m = {
|
|
3093
3100
|
...t,
|
|
@@ -3097,37 +3104,37 @@ function On(s, a) {
|
|
|
3097
3104
|
c.push(m);
|
|
3098
3105
|
}
|
|
3099
3106
|
for (const t of u)
|
|
3100
|
-
t.type ===
|
|
3107
|
+
t.type === ce.ITEM_FULFILLMENT_CREATED && c.push({
|
|
3101
3108
|
...t.data,
|
|
3102
|
-
id: t.data.id ||
|
|
3103
|
-
prefix:
|
|
3109
|
+
id: t.data.id || O({
|
|
3110
|
+
prefix: R.Enum.deliveryFulfillment
|
|
3104
3111
|
})
|
|
3105
3112
|
});
|
|
3106
|
-
const
|
|
3113
|
+
const s = [];
|
|
3107
3114
|
for (const t of c)
|
|
3108
|
-
t.id ?
|
|
3115
|
+
t.id ? s.push(t) : (console.warn("Missing delivery fulfillment id, generating new id"), s.push({
|
|
3109
3116
|
...t,
|
|
3110
|
-
id:
|
|
3111
|
-
prefix:
|
|
3117
|
+
id: O({
|
|
3118
|
+
prefix: R.Enum.deliveryFulfillment
|
|
3112
3119
|
})
|
|
3113
3120
|
}));
|
|
3114
|
-
return
|
|
3121
|
+
return s;
|
|
3115
3122
|
}
|
|
3116
|
-
|
|
3117
|
-
var
|
|
3118
|
-
(function(
|
|
3119
|
-
|
|
3120
|
-
})(
|
|
3121
|
-
var W = /* @__PURE__ */
|
|
3122
|
-
function
|
|
3123
|
+
g(Rn, "resolveDeliveryFulfillmentConflicts");
|
|
3124
|
+
var le;
|
|
3125
|
+
(function(r) {
|
|
3126
|
+
r.ITEM_RECEIPT_CREATED = "ITEM_RECEIPT_CREATED", r.ITEM_RECEIPT_UPDATED = "ITEM_RECEIPT_UPDATED", r.ITEM_RECEIPT_DELETED = "ITEM_RECEIPT_DELETED";
|
|
3127
|
+
})(le || (le = {}));
|
|
3128
|
+
var W = /* @__PURE__ */ g((r) => r === "" ? null : r, "normalizeNullOrEmpty"), Ln = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3129
|
+
function Rt(r, a, u) {
|
|
3123
3130
|
var i, o, m, l, f, d, I;
|
|
3124
|
-
const c = Object.keys(Jt.shape),
|
|
3125
|
-
for (const p of
|
|
3126
|
-
const
|
|
3127
|
-
if (
|
|
3128
|
-
if (
|
|
3129
|
-
throw new Error(`Duplicate NetSuite ID found: ${
|
|
3130
|
-
|
|
3131
|
+
const c = Object.keys(Jt.shape), s = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
3132
|
+
for (const p of r) {
|
|
3133
|
+
const E = W((i = p.netSuite) == null ? void 0 : i.id), y = W(p.id);
|
|
3134
|
+
if (E) {
|
|
3135
|
+
if (s.has(E))
|
|
3136
|
+
throw new Error(`Duplicate NetSuite ID found: ${E}`);
|
|
3137
|
+
s.add(E);
|
|
3131
3138
|
}
|
|
3132
3139
|
if (y) {
|
|
3133
3140
|
if (t.has(y))
|
|
@@ -3137,23 +3144,23 @@ function Ot(s, a, u) {
|
|
|
3137
3144
|
}
|
|
3138
3145
|
const n = [];
|
|
3139
3146
|
for (const p of a) {
|
|
3140
|
-
const
|
|
3147
|
+
const E = W(p.id), y = W((o = p.netSuite) == null ? void 0 : o.id);
|
|
3141
3148
|
if (!y)
|
|
3142
3149
|
continue;
|
|
3143
|
-
const _ =
|
|
3150
|
+
const _ = r.find((S) => {
|
|
3144
3151
|
var D;
|
|
3145
3152
|
const v = W(S.id), C = W((D = S.netSuite) == null ? void 0 : D.id);
|
|
3146
|
-
return C && y && C === y || v && v ===
|
|
3153
|
+
return C && y && C === y || v && v === E;
|
|
3147
3154
|
});
|
|
3148
3155
|
if (!_)
|
|
3149
3156
|
n.push({
|
|
3150
|
-
type:
|
|
3157
|
+
type: le.ITEM_RECEIPT_CREATED,
|
|
3151
3158
|
message: `New Item Receipt ${(m = p.netSuite) == null ? void 0 : m.id} created`,
|
|
3152
3159
|
data: p
|
|
3153
3160
|
});
|
|
3154
3161
|
else {
|
|
3155
3162
|
const S = W(_.id), v = W((l = _.netSuite) == null ? void 0 : l.id);
|
|
3156
|
-
if (v && y && v !== y ||
|
|
3163
|
+
if (v && y && v !== y || E && S && S !== E)
|
|
3157
3164
|
throw new Error(`Inconsistent data for Item Receipt ${(f = p.netSuite) == null ? void 0 : f.id} (or ${p.id})`);
|
|
3158
3165
|
for (const b of c) {
|
|
3159
3166
|
if (b === "adjustment" || b === "id")
|
|
@@ -3168,7 +3175,7 @@ function Ot(s, a, u) {
|
|
|
3168
3175
|
continue;
|
|
3169
3176
|
let w = F, U = D;
|
|
3170
3177
|
typeof p[b] == "object" && (w = JSON.stringify(F), U = JSON.stringify(D)), b === "createdAt" && (w = new Date(p[b]).toISOString(), U = new Date(_[b]).toISOString()), n.push({
|
|
3171
|
-
type:
|
|
3178
|
+
type: le.ITEM_RECEIPT_UPDATED,
|
|
3172
3179
|
message: ne(Ln, [
|
|
3173
3180
|
"Item Receipt Field",
|
|
3174
3181
|
`${(d = p.netSuite) == null ? void 0 : d.id}`,
|
|
@@ -3189,12 +3196,12 @@ function Ot(s, a, u) {
|
|
|
3189
3196
|
}
|
|
3190
3197
|
return n;
|
|
3191
3198
|
}
|
|
3192
|
-
|
|
3193
|
-
function Lt(
|
|
3194
|
-
const u = a.filter((t) => t.type ===
|
|
3199
|
+
g(Rt, "detectItemReceiptConflicts");
|
|
3200
|
+
function Lt(r, a) {
|
|
3201
|
+
const u = a.filter((t) => t.type === le.ITEM_RECEIPT_CREATED || t.type === le.ITEM_RECEIPT_UPDATED || t.type === le.ITEM_RECEIPT_DELETED || t.type === h.ITEM_RECEIPT_ITEM_CREATED || t.type === h.ITEM_RECEIPT_ITEM_UPDATED || t.type === h.ITEM_RECEIPT_ITEM_DELETED), c = [];
|
|
3195
3202
|
if (u.length === 0)
|
|
3196
|
-
return
|
|
3197
|
-
for (const t of
|
|
3203
|
+
return r;
|
|
3204
|
+
for (const t of r) {
|
|
3198
3205
|
const n = u.filter((l) => {
|
|
3199
3206
|
const f = l.data;
|
|
3200
3207
|
return f.recordId != "" && f.recordId === t.id;
|
|
@@ -3204,7 +3211,7 @@ function Lt(s, a) {
|
|
|
3204
3211
|
received: o
|
|
3205
3212
|
};
|
|
3206
3213
|
for (const l of n)
|
|
3207
|
-
if (l.type ===
|
|
3214
|
+
if (l.type === le.ITEM_RECEIPT_UPDATED) {
|
|
3208
3215
|
const f = l.data.field, d = l.data.incomingValue, I = t[f];
|
|
3209
3216
|
d !== I && (m = {
|
|
3210
3217
|
...t,
|
|
@@ -3214,36 +3221,36 @@ function Lt(s, a) {
|
|
|
3214
3221
|
c.push(m);
|
|
3215
3222
|
}
|
|
3216
3223
|
for (const t of u)
|
|
3217
|
-
if (t.type ===
|
|
3224
|
+
if (t.type === le.ITEM_RECEIPT_CREATED) {
|
|
3218
3225
|
const n = new Date(t.data.createdAt), i = new Date(t.data.effectiveAt);
|
|
3219
3226
|
c.push({
|
|
3220
3227
|
...t.data,
|
|
3221
|
-
id: t.data.id ||
|
|
3222
|
-
prefix:
|
|
3228
|
+
id: t.data.id || O({
|
|
3229
|
+
prefix: R.Enum.deliveryOrder
|
|
3223
3230
|
}),
|
|
3224
3231
|
effectiveAt: J(n, i) ? void 0 : i.toISOString()
|
|
3225
3232
|
});
|
|
3226
3233
|
}
|
|
3227
|
-
const
|
|
3234
|
+
const s = [];
|
|
3228
3235
|
for (const t of c)
|
|
3229
|
-
t.id ?
|
|
3236
|
+
t.id ? s.push(t) : (console.warn("Missing delivery order id, generating new id"), s.push({
|
|
3230
3237
|
...t,
|
|
3231
|
-
id:
|
|
3232
|
-
prefix:
|
|
3238
|
+
id: O({
|
|
3239
|
+
prefix: R.Enum.deliveryOrder
|
|
3233
3240
|
})
|
|
3234
3241
|
}));
|
|
3235
|
-
return
|
|
3242
|
+
return s;
|
|
3236
3243
|
}
|
|
3237
|
-
|
|
3238
|
-
function Pn(
|
|
3244
|
+
g(Lt, "resolveDeliveryOrdersConflicts");
|
|
3245
|
+
function Pn(r, a, u, c) {
|
|
3239
3246
|
var n, i;
|
|
3240
|
-
const
|
|
3241
|
-
for (const o of
|
|
3247
|
+
const s = Lt(a, c), t = [];
|
|
3248
|
+
for (const o of s) {
|
|
3242
3249
|
const m = {
|
|
3243
3250
|
...o
|
|
3244
3251
|
};
|
|
3245
3252
|
if ((n = o.netSuite) != null && n.id && !((i = o.fullfillmentId) != null && i.startsWith("delivery_fulfillment"))) {
|
|
3246
|
-
const l =
|
|
3253
|
+
const l = r.find((f) => {
|
|
3247
3254
|
var d;
|
|
3248
3255
|
return ((d = f.netSuite) == null ? void 0 : d.id) === o.fullfillmentId;
|
|
3249
3256
|
});
|
|
@@ -3253,29 +3260,29 @@ function Pn(s, a, u, c) {
|
|
|
3253
3260
|
}
|
|
3254
3261
|
return t;
|
|
3255
3262
|
}
|
|
3256
|
-
|
|
3263
|
+
g(Pn, "resolveAndMergeDeliveryOrders");
|
|
3257
3264
|
var G;
|
|
3258
|
-
(function(
|
|
3259
|
-
|
|
3265
|
+
(function(r) {
|
|
3266
|
+
r.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", r.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED", r.PURCHASE_ORDER_REQUEST_CREATED = "PURCHASE_ORDER_REQUEST_CREATED", r.PURCHASE_ORDER_REQUEST_UPDATED = "PURCHASE_ORDER_REQUEST_UPDATED", r.ITEM_FULFILLMENT_CREATED = "ITEM_FULFILLMENT_CREATED", r.ITEM_FULFILLMENT_UPDATED = "ITEM_FULFILLMENT_UPDATED", r.ITEM_FULFILLMENT_DELETED = "ITEM_FULFILLMENT_DELETED", r.ITEM_FULFILLMENT_ITEM_CREATED = "ITEM_FULFILLMENT_ITEM_CREATED", r.ITEM_FULFILLMENT_ITEM_UPDATED = "ITEM_FULFILLMENT_ITEM_UPDATED", r.ITEM_FULFILLMENT_ITEM_DELETED = "ITEM_FULFILLMENT_ITEM_DELETED";
|
|
3260
3267
|
})(G || (G = {}));
|
|
3261
|
-
function K(
|
|
3262
|
-
let t = c, n =
|
|
3263
|
-
return typeof c == "object" && (t = JSON.stringify(c), n = JSON.stringify(
|
|
3268
|
+
function K(r, a, u, c, s) {
|
|
3269
|
+
let t = c, n = s;
|
|
3270
|
+
return typeof c == "object" && (t = JSON.stringify(c), n = JSON.stringify(s)), `${r} ${a} field ${u} changed from "${t}" to "${n}"`;
|
|
3264
3271
|
}
|
|
3265
|
-
|
|
3266
|
-
function xn(
|
|
3272
|
+
g(K, "generateLogMessage");
|
|
3273
|
+
function xn(r, a, u, c = !1) {
|
|
3267
3274
|
var t, n;
|
|
3268
|
-
const
|
|
3269
|
-
if (a ||
|
|
3275
|
+
const s = [];
|
|
3276
|
+
if (a || s.push({
|
|
3270
3277
|
type: G.PURCHASE_ORDER_CREATED,
|
|
3271
3278
|
message: "Purchase order not found",
|
|
3272
|
-
data:
|
|
3273
|
-
}), u ||
|
|
3279
|
+
data: r.purchaseOrder
|
|
3280
|
+
}), u || s.push({
|
|
3274
3281
|
type: G.PURCHASE_ORDER_REQUEST_CREATED,
|
|
3275
3282
|
message: "Purchase order request not found",
|
|
3276
|
-
data:
|
|
3283
|
+
data: r.purchaseOrderRequest
|
|
3277
3284
|
}), !a && !u)
|
|
3278
|
-
return
|
|
3285
|
+
return s.push(..._e(r.purchaseOrder.items, [], "", "2")), s;
|
|
3279
3286
|
if (a) {
|
|
3280
3287
|
const i = Object.keys(Qe.shape);
|
|
3281
3288
|
for (const o of i) {
|
|
@@ -3288,10 +3295,10 @@ function xn(s, a, u, c = !1) {
|
|
|
3288
3295
|
].includes(o))
|
|
3289
3296
|
continue;
|
|
3290
3297
|
if (o === "items") {
|
|
3291
|
-
|
|
3298
|
+
s.push(..._e(r.purchaseOrder.items, a.items, a._id, a.version || "1", c));
|
|
3292
3299
|
continue;
|
|
3293
3300
|
}
|
|
3294
|
-
let l =
|
|
3301
|
+
let l = r.purchaseOrder[o] ?? null;
|
|
3295
3302
|
const f = a[o] ?? null;
|
|
3296
3303
|
if (o === "request") {
|
|
3297
3304
|
const d = l, I = f;
|
|
@@ -3312,9 +3319,9 @@ function xn(s, a, u, c = !1) {
|
|
|
3312
3319
|
}
|
|
3313
3320
|
d = f && typeof f == "string" ? new Date(f).toISOString() : null, I = l && typeof l == "string" ? new Date(l).toISOString() : null;
|
|
3314
3321
|
}
|
|
3315
|
-
|
|
3322
|
+
s.push({
|
|
3316
3323
|
type: G.PURCHASE_ORDER_UPDATED,
|
|
3317
|
-
message: K("Transfer Order", (t =
|
|
3324
|
+
message: K("Transfer Order", (t = r.purchaseOrder.netSuite) == null ? void 0 : t.id, o, d, I),
|
|
3318
3325
|
data: {
|
|
3319
3326
|
field: o,
|
|
3320
3327
|
incomingValue: l,
|
|
@@ -3329,36 +3336,36 @@ function xn(s, a, u, c = !1) {
|
|
|
3329
3336
|
for (const o of i) {
|
|
3330
3337
|
if (o === "_id")
|
|
3331
3338
|
continue;
|
|
3332
|
-
const m =
|
|
3339
|
+
const m = r.purchaseOrderRequest[o] ?? null, l = u[o] ?? null;
|
|
3333
3340
|
if ((o === "processedAt" || o === "rejectedAt") && m !== l) {
|
|
3334
3341
|
const f = !!u.processedAt, d = !!u.rejectedAt;
|
|
3335
|
-
if (
|
|
3342
|
+
if (r.purchaseOrder.status === j.Enum.REQUESTING && (f || d))
|
|
3336
3343
|
continue;
|
|
3337
|
-
const p =
|
|
3338
|
-
|
|
3344
|
+
const p = r.purchaseOrderRequest[o] ? new Date(r.purchaseOrderRequest[o]).toISOString() : null, E = u[o] ? new Date(u[o]).toISOString() : null;
|
|
3345
|
+
s.push({
|
|
3339
3346
|
type: G.PURCHASE_ORDER_REQUEST_UPDATED,
|
|
3340
|
-
message: K("Transfer Order", (n =
|
|
3347
|
+
message: K("Transfer Order", (n = r.purchaseOrder.netSuite) == null ? void 0 : n.id, o, E, p),
|
|
3341
3348
|
data: {
|
|
3342
3349
|
field: o,
|
|
3343
|
-
incomingValue:
|
|
3350
|
+
incomingValue: r.purchaseOrderRequest[o],
|
|
3344
3351
|
existingValue: u[o]
|
|
3345
3352
|
}
|
|
3346
3353
|
});
|
|
3347
3354
|
}
|
|
3348
3355
|
}
|
|
3349
3356
|
}
|
|
3350
|
-
return
|
|
3357
|
+
return s;
|
|
3351
3358
|
}
|
|
3352
|
-
|
|
3353
|
-
function $n(
|
|
3354
|
-
if (
|
|
3359
|
+
g(xn, "detectTransferOrderConflicts");
|
|
3360
|
+
function $n(r, a, u, c, s) {
|
|
3361
|
+
if (r.length === 0)
|
|
3355
3362
|
throw new Error("No order lines found");
|
|
3356
|
-
let t = c || (
|
|
3363
|
+
let t = c || (s == null ? void 0 : s.purchaseOrder), n = s;
|
|
3357
3364
|
const i = Ve((t == null ? void 0 : t.items) || [], a);
|
|
3358
3365
|
if (a.length === 0)
|
|
3359
3366
|
return {
|
|
3360
3367
|
purchaseOrder: c,
|
|
3361
|
-
purchaseOrderRequest:
|
|
3368
|
+
purchaseOrderRequest: s
|
|
3362
3369
|
};
|
|
3363
3370
|
if (t) {
|
|
3364
3371
|
for (const o of a)
|
|
@@ -3380,8 +3387,8 @@ function $n(s, a, u, c, r) {
|
|
|
3380
3387
|
const m = new Date(ie(u.purchaseOrder._id)), l = new Date(u.purchaseOrder.effectiveAt);
|
|
3381
3388
|
t = {
|
|
3382
3389
|
...u.purchaseOrder,
|
|
3383
|
-
_id: (
|
|
3384
|
-
prefix:
|
|
3390
|
+
_id: (s == null ? void 0 : s.purchaseOrderId) || u.purchaseOrder._id || O({
|
|
3391
|
+
prefix: R.Enum.purchaseOrder
|
|
3385
3392
|
}),
|
|
3386
3393
|
effectiveAt: J(m, l) ? void 0 : l.toISOString(),
|
|
3387
3394
|
items: i
|
|
@@ -3431,7 +3438,7 @@ function $n(s, a, u, c, r) {
|
|
|
3431
3438
|
purchaseOrderRequest: n
|
|
3432
3439
|
};
|
|
3433
3440
|
}
|
|
3434
|
-
|
|
3441
|
+
g($n, "resolveTransferOrderConflicts");
|
|
3435
3442
|
e.object({
|
|
3436
3443
|
lineItem: qe.nullish(),
|
|
3437
3444
|
existinglineItem: qe.nullish(),
|
|
@@ -3447,18 +3454,18 @@ e.object({
|
|
|
3447
3454
|
existingValue: e.any()
|
|
3448
3455
|
});
|
|
3449
3456
|
var Ee;
|
|
3450
|
-
(function(
|
|
3451
|
-
|
|
3457
|
+
(function(r) {
|
|
3458
|
+
r.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", r.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED", r.ITEM_RECEIPT_CREATED = "ITEM_RECEIPT_CREATED", r.ITEM_RECEIPT_UPDATED = "ITEM_RECEIPT_UPDATED", r.ITEM_RECEIPT_DELETED = "ITEM_RECEIPT_DELETED", r.ITEM_RECEIPT_ITEM_CREATED = "ITEM_RECEIPT_ITEM_CREATED", r.ITEM_RECEIPT_ITEM_UPDATED = "ITEM_RECEIPT_ITEM_UPDATED", r.ITEM_RECEIPT_ITEM_DELETED = "ITEM_RECEIPT_ITEM_DELETED";
|
|
3452
3459
|
})(Ee || (Ee = {}));
|
|
3453
|
-
function jn(
|
|
3454
|
-
var
|
|
3460
|
+
function jn(r, a) {
|
|
3461
|
+
var s;
|
|
3455
3462
|
const u = [];
|
|
3456
3463
|
if (!a)
|
|
3457
3464
|
return u.push({
|
|
3458
3465
|
type: Ee.PURCHASE_ORDER_CREATED,
|
|
3459
3466
|
message: "Purchase order not found",
|
|
3460
|
-
data:
|
|
3461
|
-
}), u.push(...
|
|
3467
|
+
data: r
|
|
3468
|
+
}), u.push(..._e(r.items, [], "", "2")), u;
|
|
3462
3469
|
const c = Object.keys(Qe.shape);
|
|
3463
3470
|
for (const t of c) {
|
|
3464
3471
|
if (![
|
|
@@ -3470,10 +3477,10 @@ function jn(s, a) {
|
|
|
3470
3477
|
].includes(t))
|
|
3471
3478
|
continue;
|
|
3472
3479
|
if (t === "items") {
|
|
3473
|
-
u.push(...
|
|
3480
|
+
u.push(..._e(r.items, a.items, a._id, a.version || "1"));
|
|
3474
3481
|
continue;
|
|
3475
3482
|
}
|
|
3476
|
-
const i =
|
|
3483
|
+
const i = r[t] ?? null, o = a[t] ?? null;
|
|
3477
3484
|
if (t === "effectiveAt" && i && typeof i == "string") {
|
|
3478
3485
|
const m = new Date(ie(a._id));
|
|
3479
3486
|
if (J(m, new Date(i)))
|
|
@@ -3485,7 +3492,7 @@ function jn(s, a) {
|
|
|
3485
3492
|
const m = i && typeof i == "string" ? new Date(i).toISOString() : null, l = o && typeof o == "string" ? new Date(o).toISOString() : null;
|
|
3486
3493
|
u.push({
|
|
3487
3494
|
type: Ee.PURCHASE_ORDER_UPDATED,
|
|
3488
|
-
message: K("Purchase Order", (
|
|
3495
|
+
message: K("Purchase Order", (s = r.netSuite) == null ? void 0 : s.id, t, l, m),
|
|
3489
3496
|
data: {
|
|
3490
3497
|
field: t,
|
|
3491
3498
|
incomingValue: i,
|
|
@@ -3494,20 +3501,20 @@ function jn(s, a) {
|
|
|
3494
3501
|
});
|
|
3495
3502
|
}
|
|
3496
3503
|
}
|
|
3497
|
-
return u.push(...
|
|
3504
|
+
return u.push(...Rt((a == null ? void 0 : a.deliveryOrder) ?? [], r.deliveryOrder ?? [], a ? (a == null ? void 0 : a.version) || "1" : r.version)), u;
|
|
3498
3505
|
}
|
|
3499
|
-
|
|
3500
|
-
function Vn(
|
|
3501
|
-
let
|
|
3502
|
-
const t = Ve((
|
|
3503
|
-
if (
|
|
3506
|
+
g(jn, "detectPurchaseOrderConflicts");
|
|
3507
|
+
function Vn(r, a, u, c) {
|
|
3508
|
+
let s = c ? L.cloneDeep(c) : null;
|
|
3509
|
+
const t = Ve((s == null ? void 0 : s.items) || [], a);
|
|
3510
|
+
if (r.length === 0)
|
|
3504
3511
|
throw new Error("No order lines found");
|
|
3505
|
-
if (
|
|
3512
|
+
if (s) {
|
|
3506
3513
|
for (const n of a)
|
|
3507
3514
|
if (n.type === Ee.PURCHASE_ORDER_UPDATED) {
|
|
3508
|
-
const i = n.data.field, o = n.data.incomingValue, m =
|
|
3509
|
-
o !== m && (
|
|
3510
|
-
...
|
|
3515
|
+
const i = n.data.field, o = n.data.incomingValue, m = s[i];
|
|
3516
|
+
o !== m && (s = {
|
|
3517
|
+
...s,
|
|
3511
3518
|
[i]: o
|
|
3512
3519
|
});
|
|
3513
3520
|
}
|
|
@@ -3517,8 +3524,8 @@ function Vn(s, a, u, c) {
|
|
|
3517
3524
|
_id: (c == null ? void 0 : c._id) ?? u._id,
|
|
3518
3525
|
items: t
|
|
3519
3526
|
};
|
|
3520
|
-
|
|
3521
|
-
...
|
|
3527
|
+
s = {
|
|
3528
|
+
...s,
|
|
3522
3529
|
items: t
|
|
3523
3530
|
};
|
|
3524
3531
|
}
|
|
@@ -3526,63 +3533,63 @@ function Vn(s, a, u, c) {
|
|
|
3526
3533
|
switch (n.type) {
|
|
3527
3534
|
case Ee.PURCHASE_ORDER_CREATED:
|
|
3528
3535
|
const i = new Date(ie(u._id)), o = new Date(u.effectiveAt);
|
|
3529
|
-
|
|
3536
|
+
s = {
|
|
3530
3537
|
...u,
|
|
3531
|
-
_id: u._id ||
|
|
3532
|
-
prefix:
|
|
3538
|
+
_id: u._id || O({
|
|
3539
|
+
prefix: R.Enum.purchaseOrder
|
|
3533
3540
|
}),
|
|
3534
3541
|
effectiveAt: J(i, o) ? void 0 : o.toISOString(),
|
|
3535
3542
|
items: t
|
|
3536
3543
|
};
|
|
3537
3544
|
break;
|
|
3538
3545
|
case Ee.PURCHASE_ORDER_UPDATED:
|
|
3539
|
-
if (
|
|
3546
|
+
if (s) {
|
|
3540
3547
|
const m = n.data.field, l = n.data.incomingValue;
|
|
3541
|
-
|
|
3542
|
-
...
|
|
3548
|
+
s[m], s = {
|
|
3549
|
+
...s,
|
|
3543
3550
|
[m]: l,
|
|
3544
3551
|
items: t
|
|
3545
3552
|
};
|
|
3546
3553
|
}
|
|
3547
3554
|
}
|
|
3548
|
-
return
|
|
3549
|
-
...
|
|
3555
|
+
return s = {
|
|
3556
|
+
...s,
|
|
3550
3557
|
status: u.status,
|
|
3551
3558
|
netSuite: u.netSuite
|
|
3552
|
-
},
|
|
3559
|
+
}, s;
|
|
3553
3560
|
}
|
|
3554
|
-
|
|
3561
|
+
g(Vn, "resolvePurchaseOrderConflicts");
|
|
3555
3562
|
var Ne;
|
|
3556
|
-
(function(
|
|
3557
|
-
|
|
3563
|
+
(function(r) {
|
|
3564
|
+
r.UNIT_CREATED = "UNIT_CREATED", r.UNIT_UPDATED = "UNIT_UPDATED", r.UNIT_DELETED = "UNIT_DELETED";
|
|
3558
3565
|
})(Ne || (Ne = {}));
|
|
3559
|
-
var
|
|
3560
|
-
(function(
|
|
3561
|
-
|
|
3562
|
-
})(
|
|
3566
|
+
var fe;
|
|
3567
|
+
(function(r) {
|
|
3568
|
+
r.UNIT_OF_MEASUREMENT_CREATED = "UNIT_OF_MEASUREMENT_CREATED", r.UNIT_OF_MEASUREMENT_UPDATED = "UNIT_OF_MEASUREMENT_UPDATED", r.UNIT_OF_MEASUREMENT_DELETED = "UNIT_OF_MEASUREMENT_DELETED", r.UNIT_OF_MEASUREMENT_DUPLICATE = "UNIT_OF_MEASUREMENT_DUPLICATE";
|
|
3569
|
+
})(fe || (fe = {}));
|
|
3563
3570
|
var Bn = 'Record [$] unif of measure on line [$], field "$" changed from "$" to "$"';
|
|
3564
|
-
function Pt(
|
|
3571
|
+
function Pt(r, a) {
|
|
3565
3572
|
const u = Object.keys(Tt.shape), c = [];
|
|
3566
|
-
for (const
|
|
3567
|
-
const t =
|
|
3573
|
+
for (const s of a) {
|
|
3574
|
+
const t = r.measurements.find((n) => n.nsConfig.netSuiteId === s.nsConfig.netSuiteId);
|
|
3568
3575
|
if (!t)
|
|
3569
3576
|
c.push({
|
|
3570
|
-
type:
|
|
3571
|
-
message: `NetSuite Measurement ${
|
|
3572
|
-
data:
|
|
3577
|
+
type: fe.UNIT_OF_MEASUREMENT_CREATED,
|
|
3578
|
+
message: `NetSuite Measurement ${s.nsConfig.netSuiteId} does not exist in existing unit ${r.name} ${r.nsConfig.netSuiteId})`,
|
|
3579
|
+
data: s
|
|
3573
3580
|
});
|
|
3574
3581
|
else
|
|
3575
3582
|
for (const n of u) {
|
|
3576
3583
|
if (n === "nsConfig" || n === "id")
|
|
3577
3584
|
continue;
|
|
3578
|
-
const i =
|
|
3585
|
+
const i = s[n] ?? null, o = t[n] ?? null;
|
|
3579
3586
|
if (!L.isEqual(i, o)) {
|
|
3580
3587
|
let m = o, l = i;
|
|
3581
3588
|
typeof i == "object" && (m = JSON.stringify(o), l = JSON.stringify(i)), c.push({
|
|
3582
|
-
type:
|
|
3589
|
+
type: fe.UNIT_OF_MEASUREMENT_UPDATED,
|
|
3583
3590
|
message: ne(Bn, [
|
|
3584
3591
|
"Unit Of Measure",
|
|
3585
|
-
`${
|
|
3592
|
+
`${s.nsConfig.netSuiteId}`,
|
|
3586
3593
|
n,
|
|
3587
3594
|
`${m}`,
|
|
3588
3595
|
`${l}`
|
|
@@ -3590,47 +3597,47 @@ function Pt(s, a) {
|
|
|
3590
3597
|
data: {
|
|
3591
3598
|
config: t.nsConfig,
|
|
3592
3599
|
field: n,
|
|
3593
|
-
incomingValue:
|
|
3600
|
+
incomingValue: s[n],
|
|
3594
3601
|
existingValue: t[n]
|
|
3595
3602
|
}
|
|
3596
3603
|
});
|
|
3597
3604
|
}
|
|
3598
3605
|
}
|
|
3599
3606
|
}
|
|
3600
|
-
for (const
|
|
3601
|
-
a.find((n) => n.nsConfig.netSuiteId ===
|
|
3602
|
-
type:
|
|
3603
|
-
message: `Unit Of Measure [${
|
|
3604
|
-
data:
|
|
3607
|
+
for (const s of r.measurements)
|
|
3608
|
+
a.find((n) => n.nsConfig.netSuiteId === s.nsConfig.netSuiteId) || c.push({
|
|
3609
|
+
type: fe.UNIT_OF_MEASUREMENT_DELETED,
|
|
3610
|
+
message: `Unit Of Measure [${s.nsConfig.netSuiteId}] doesn't exist in incoming units`,
|
|
3611
|
+
data: s
|
|
3605
3612
|
});
|
|
3606
3613
|
return c;
|
|
3607
3614
|
}
|
|
3608
|
-
|
|
3609
|
-
function qn(
|
|
3615
|
+
g(Pt, "detectUnitOfMeasureConflicts");
|
|
3616
|
+
function qn(r, a) {
|
|
3610
3617
|
const u = [];
|
|
3611
3618
|
if (!a)
|
|
3612
3619
|
u.push({
|
|
3613
3620
|
type: Ne.UNIT_CREATED,
|
|
3614
|
-
message: `Unit type [${
|
|
3615
|
-
data:
|
|
3621
|
+
message: `Unit type [${r.nsConfig.netSuiteId}] config doesn't exist`,
|
|
3622
|
+
data: r
|
|
3616
3623
|
});
|
|
3617
3624
|
else {
|
|
3618
3625
|
const c = Object.keys(ht.shape);
|
|
3619
|
-
for (const
|
|
3620
|
-
if (
|
|
3626
|
+
for (const s of c) {
|
|
3627
|
+
if (s === "nsConfig" || s === "_id")
|
|
3621
3628
|
continue;
|
|
3622
|
-
if (
|
|
3623
|
-
u.push(...Pt(a,
|
|
3629
|
+
if (s === "measurements") {
|
|
3630
|
+
u.push(...Pt(a, r.measurements));
|
|
3624
3631
|
continue;
|
|
3625
3632
|
}
|
|
3626
|
-
const t = s
|
|
3633
|
+
const t = r[s] ?? null, n = a[s] ?? null;
|
|
3627
3634
|
if (!L.isEqual(t, n)) {
|
|
3628
3635
|
let i = n, o = t;
|
|
3629
3636
|
u.push({
|
|
3630
3637
|
type: Ne.UNIT_UPDATED,
|
|
3631
|
-
message: K("Unit Type",
|
|
3638
|
+
message: K("Unit Type", r.nsConfig.netSuiteId, s, i, o),
|
|
3632
3639
|
data: {
|
|
3633
|
-
field:
|
|
3640
|
+
field: s,
|
|
3634
3641
|
incomingValue: t,
|
|
3635
3642
|
existingValue: n
|
|
3636
3643
|
}
|
|
@@ -3640,30 +3647,30 @@ function qn(s, a) {
|
|
|
3640
3647
|
}
|
|
3641
3648
|
return u;
|
|
3642
3649
|
}
|
|
3643
|
-
|
|
3644
|
-
function xt(
|
|
3650
|
+
g(qn, "detectUnitTypeConflicts");
|
|
3651
|
+
function xt(r, a) {
|
|
3645
3652
|
if (a.length === 0)
|
|
3646
|
-
return
|
|
3653
|
+
return r;
|
|
3647
3654
|
const u = [
|
|
3648
|
-
...
|
|
3655
|
+
...r
|
|
3649
3656
|
];
|
|
3650
3657
|
for (const c of a) {
|
|
3651
|
-
if (c.type ===
|
|
3652
|
-
const
|
|
3653
|
-
|
|
3658
|
+
if (c.type === fe.UNIT_OF_MEASUREMENT_CREATED && u.push(c.data), c.type === fe.UNIT_OF_MEASUREMENT_UPDATED) {
|
|
3659
|
+
const s = u.findIndex((t) => t.nsConfig.netSuiteId === c.data.config.netSuiteId);
|
|
3660
|
+
s !== -1 && (u[s][c.data.field] = c.data.incomingValue);
|
|
3654
3661
|
}
|
|
3655
|
-
if (c.type ===
|
|
3656
|
-
const
|
|
3657
|
-
|
|
3662
|
+
if (c.type === fe.UNIT_OF_MEASUREMENT_DELETED) {
|
|
3663
|
+
const s = u.findIndex((t) => t.nsConfig.netSuiteId === c.data.nsConfig.netSuiteId);
|
|
3664
|
+
s !== -1 && u.splice(s, 1);
|
|
3658
3665
|
}
|
|
3659
3666
|
}
|
|
3660
3667
|
return u;
|
|
3661
3668
|
}
|
|
3662
|
-
|
|
3663
|
-
function Hn(
|
|
3669
|
+
g(xt, "resolveUnitOfMeasurementConflicts");
|
|
3670
|
+
function Hn(r, a, u) {
|
|
3664
3671
|
let c = u;
|
|
3665
|
-
const
|
|
3666
|
-
for (const t of
|
|
3672
|
+
const s = xt((u == null ? void 0 : u.measurements) || a.measurements, r);
|
|
3673
|
+
for (const t of r)
|
|
3667
3674
|
switch (t.type) {
|
|
3668
3675
|
case Ne.UNIT_CREATED:
|
|
3669
3676
|
c = a;
|
|
@@ -3673,45 +3680,45 @@ function Hn(s, a, u) {
|
|
|
3673
3680
|
c = {
|
|
3674
3681
|
...c,
|
|
3675
3682
|
[n]: i,
|
|
3676
|
-
measurements:
|
|
3683
|
+
measurements: s
|
|
3677
3684
|
};
|
|
3678
3685
|
break;
|
|
3679
3686
|
default:
|
|
3680
3687
|
c && (c = {
|
|
3681
3688
|
...c,
|
|
3682
|
-
measurements:
|
|
3689
|
+
measurements: s
|
|
3683
3690
|
});
|
|
3684
3691
|
break;
|
|
3685
3692
|
}
|
|
3686
3693
|
return c || {
|
|
3687
3694
|
...a,
|
|
3688
|
-
measurements:
|
|
3695
|
+
measurements: s
|
|
3689
3696
|
};
|
|
3690
3697
|
}
|
|
3691
|
-
|
|
3692
|
-
var
|
|
3693
|
-
(function(
|
|
3694
|
-
|
|
3695
|
-
})(
|
|
3696
|
-
function Kn(
|
|
3698
|
+
g(Hn, "resolveUnitTypeConflicts");
|
|
3699
|
+
var ye;
|
|
3700
|
+
(function(r) {
|
|
3701
|
+
r.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", r.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED";
|
|
3702
|
+
})(ye || (ye = {}));
|
|
3703
|
+
function Kn(r, a) {
|
|
3697
3704
|
var c;
|
|
3698
3705
|
const u = [];
|
|
3699
3706
|
if (a || u.push({
|
|
3700
|
-
type:
|
|
3707
|
+
type: ye.PURCHASE_ORDER_CREATED,
|
|
3701
3708
|
message: "Purchase order not found",
|
|
3702
|
-
data:
|
|
3709
|
+
data: r
|
|
3703
3710
|
}), !a)
|
|
3704
|
-
return u.push(...
|
|
3711
|
+
return u.push(..._e(r.items, [], "", "2")), u;
|
|
3705
3712
|
if (a) {
|
|
3706
|
-
const
|
|
3707
|
-
for (const t of
|
|
3713
|
+
const s = Object.keys(Qe.shape);
|
|
3714
|
+
for (const t of s) {
|
|
3708
3715
|
if (t === "_id" || t === "_rev" || t === "templateDoc" || t === "template" || t === "deliveryFullfillment" || t === "deliveryOrder" || t === "supplier" || t === "seqNumber" || t === "version")
|
|
3709
3716
|
continue;
|
|
3710
3717
|
if (t === "items") {
|
|
3711
|
-
u.push(...
|
|
3718
|
+
u.push(..._e(r.items, a.items, a._id, a.version || "2"));
|
|
3712
3719
|
continue;
|
|
3713
3720
|
}
|
|
3714
|
-
let n =
|
|
3721
|
+
let n = r[t] ?? null;
|
|
3715
3722
|
const i = a[t] ?? null;
|
|
3716
3723
|
if (t === "request") {
|
|
3717
3724
|
const o = n, m = i;
|
|
@@ -3741,8 +3748,8 @@ function Kn(s, a) {
|
|
|
3741
3748
|
o = i && typeof i == "string" ? new Date(i).toISOString() : null, m = n && typeof n == "string" ? new Date(n).toISOString() : null;
|
|
3742
3749
|
}
|
|
3743
3750
|
u.push({
|
|
3744
|
-
type:
|
|
3745
|
-
message: K("Inventory Transfer", (c =
|
|
3751
|
+
type: ye.PURCHASE_ORDER_UPDATED,
|
|
3752
|
+
message: K("Inventory Transfer", (c = r.netSuite) == null ? void 0 : c.id, t, o, m),
|
|
3746
3753
|
data: {
|
|
3747
3754
|
field: t,
|
|
3748
3755
|
incomingValue: n,
|
|
@@ -3754,62 +3761,62 @@ function Kn(s, a) {
|
|
|
3754
3761
|
}
|
|
3755
3762
|
return u;
|
|
3756
3763
|
}
|
|
3757
|
-
|
|
3758
|
-
function Yn(
|
|
3759
|
-
if (
|
|
3764
|
+
g(Kn, "detectInventoryTransferConflicts");
|
|
3765
|
+
function Yn(r, a, u, c) {
|
|
3766
|
+
if (r.length === 0)
|
|
3760
3767
|
throw new Error("No order lines found");
|
|
3761
|
-
let
|
|
3762
|
-
const t = Ve((
|
|
3768
|
+
let s = c;
|
|
3769
|
+
const t = Ve((s == null ? void 0 : s.items) || [], a);
|
|
3763
3770
|
if (a.length === 0)
|
|
3764
3771
|
return c;
|
|
3765
|
-
if (
|
|
3772
|
+
if (s) {
|
|
3766
3773
|
for (const n of a)
|
|
3767
|
-
if (n.type ===
|
|
3774
|
+
if (n.type === ye.PURCHASE_ORDER_UPDATED) {
|
|
3768
3775
|
const i = n.data.field, o = n.data.incomingValue;
|
|
3769
|
-
|
|
3770
|
-
...
|
|
3776
|
+
s = {
|
|
3777
|
+
...s,
|
|
3771
3778
|
[i]: o
|
|
3772
3779
|
};
|
|
3773
3780
|
}
|
|
3774
|
-
|
|
3775
|
-
...
|
|
3781
|
+
s = {
|
|
3782
|
+
...s,
|
|
3776
3783
|
items: t
|
|
3777
3784
|
};
|
|
3778
3785
|
}
|
|
3779
3786
|
for (const n of a)
|
|
3780
3787
|
switch (n.type) {
|
|
3781
|
-
case
|
|
3788
|
+
case ye.PURCHASE_ORDER_CREATED:
|
|
3782
3789
|
const i = new Date(ie(u._id)), o = new Date(u.effectiveAt);
|
|
3783
|
-
|
|
3790
|
+
s = {
|
|
3784
3791
|
...u,
|
|
3785
|
-
_id: u._id ||
|
|
3786
|
-
prefix:
|
|
3792
|
+
_id: u._id || O({
|
|
3793
|
+
prefix: R.Enum.purchaseOrder
|
|
3787
3794
|
}),
|
|
3788
3795
|
effectiveAt: J(i, o) ? void 0 : o.toISOString(),
|
|
3789
3796
|
items: t
|
|
3790
3797
|
};
|
|
3791
3798
|
break;
|
|
3792
|
-
case
|
|
3793
|
-
if (
|
|
3794
|
-
const m = n.data.field, l = n.data.incomingValue, f =
|
|
3799
|
+
case ye.PURCHASE_ORDER_UPDATED:
|
|
3800
|
+
if (s) {
|
|
3801
|
+
const m = n.data.field, l = n.data.incomingValue, f = s[m];
|
|
3795
3802
|
if (m === "version" && l !== f)
|
|
3796
3803
|
continue;
|
|
3797
|
-
|
|
3798
|
-
...
|
|
3804
|
+
s = {
|
|
3805
|
+
...s,
|
|
3799
3806
|
[m]: l
|
|
3800
3807
|
};
|
|
3801
3808
|
}
|
|
3802
3809
|
}
|
|
3803
|
-
return
|
|
3804
|
-
...
|
|
3810
|
+
return s = {
|
|
3811
|
+
...s,
|
|
3805
3812
|
status: u.status,
|
|
3806
3813
|
netSuite: u.netSuite
|
|
3807
|
-
},
|
|
3814
|
+
}, s;
|
|
3808
3815
|
}
|
|
3809
|
-
|
|
3816
|
+
g(Yn, "resolveInventoryTransferConflicts");
|
|
3810
3817
|
var q;
|
|
3811
|
-
(function(
|
|
3812
|
-
|
|
3818
|
+
(function(r) {
|
|
3819
|
+
r.INVENTORY_ITEM_CREATED = "INVENTORY_ITEM_CREATED", r.INVENTORY_ITEM_UPDATED = "INVENTORY_ITEM_UPDATED", r.INVENTORY_ITEM_DELETED = "INVENTORY_ITEM_DELETED", r.INVENTORY_ITEM_SKU_UPDATED = "INVENTORY_ITEM_SKU_UPDATED";
|
|
3813
3820
|
})(q || (q = {}));
|
|
3814
3821
|
var Gn = je.pick({
|
|
3815
3822
|
code: !0,
|
|
@@ -3829,8 +3836,8 @@ var Gn = je.pick({
|
|
|
3829
3836
|
businessId: !0,
|
|
3830
3837
|
deletedAt: !0
|
|
3831
3838
|
});
|
|
3832
|
-
function Qn(
|
|
3833
|
-
const a = [], { incoming: u, current: c } =
|
|
3839
|
+
function Qn(r) {
|
|
3840
|
+
const a = [], { incoming: u, current: c } = r;
|
|
3834
3841
|
if (u.itemType !== V.Enum.InvtPart)
|
|
3835
3842
|
throw new Error("[detectInventoryChildItemConflicts] only supports InvtPart child items");
|
|
3836
3843
|
if (!c)
|
|
@@ -3839,8 +3846,8 @@ function Qn(s) {
|
|
|
3839
3846
|
message: `InvtPart Child Item [${u.netSuiteId}] config doesn't exist`,
|
|
3840
3847
|
data: u
|
|
3841
3848
|
}), a;
|
|
3842
|
-
const
|
|
3843
|
-
for (const t of
|
|
3849
|
+
const s = Object.keys(zn.shape);
|
|
3850
|
+
for (const t of s) {
|
|
3844
3851
|
const n = u[t] ?? null, i = c[t] ?? null;
|
|
3845
3852
|
L.isEqual(n, i) || a.push({
|
|
3846
3853
|
type: q.INVENTORY_ITEM_UPDATED,
|
|
@@ -3854,9 +3861,9 @@ function Qn(s) {
|
|
|
3854
3861
|
}
|
|
3855
3862
|
return a;
|
|
3856
3863
|
}
|
|
3857
|
-
|
|
3858
|
-
function Wn(
|
|
3859
|
-
const a = [], { incoming: u, current: c } =
|
|
3864
|
+
g(Qn, "detectInventoryChildItemConflicts");
|
|
3865
|
+
function Wn(r) {
|
|
3866
|
+
const a = [], { incoming: u, current: c } = r;
|
|
3860
3867
|
if (u.itemType !== V.Enum.InvtPart)
|
|
3861
3868
|
throw new Error("[detectInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
3862
3869
|
if (!c)
|
|
@@ -3865,8 +3872,8 @@ function Wn(s) {
|
|
|
3865
3872
|
message: `Inventory Parent Item [${u.netSuiteId}] config doesn't exist`,
|
|
3866
3873
|
data: u
|
|
3867
3874
|
}), a;
|
|
3868
|
-
const
|
|
3869
|
-
for (const n of
|
|
3875
|
+
const s = Object.keys(Jn.shape);
|
|
3876
|
+
for (const n of s) {
|
|
3870
3877
|
const i = u[n] ?? null, o = c[n] ?? null;
|
|
3871
3878
|
L.isEqual(i, o) || a.push({
|
|
3872
3879
|
type: q.INVENTORY_ITEM_UPDATED,
|
|
@@ -3893,53 +3900,53 @@ function Wn(s) {
|
|
|
3893
3900
|
}
|
|
3894
3901
|
return a;
|
|
3895
3902
|
}
|
|
3896
|
-
|
|
3897
|
-
function Zn(
|
|
3903
|
+
g(Wn, "detectInventoryParentItemConflicts");
|
|
3904
|
+
function Zn(r, a, u) {
|
|
3898
3905
|
if (a.itemType !== V.Enum.InvtPart)
|
|
3899
3906
|
throw new Error("[resolveInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
3900
|
-
if (
|
|
3907
|
+
if (r.some((t) => t.type === q.INVENTORY_ITEM_CREATED))
|
|
3901
3908
|
return a;
|
|
3902
|
-
let
|
|
3903
|
-
for (const t of
|
|
3909
|
+
let s = u;
|
|
3910
|
+
for (const t of r)
|
|
3904
3911
|
if (t.type === q.INVENTORY_ITEM_UPDATED) {
|
|
3905
3912
|
const n = t.data.field;
|
|
3906
|
-
|
|
3907
|
-
...
|
|
3913
|
+
s = {
|
|
3914
|
+
...s,
|
|
3908
3915
|
[n]: t.data.incomingValue
|
|
3909
3916
|
};
|
|
3910
3917
|
} else if (t.type === q.INVENTORY_ITEM_SKU_UPDATED) {
|
|
3911
3918
|
const n = t.data.field;
|
|
3912
|
-
|
|
3913
|
-
...
|
|
3919
|
+
s = {
|
|
3920
|
+
...s,
|
|
3914
3921
|
skuCache: {
|
|
3915
|
-
...
|
|
3922
|
+
...s.skuCache,
|
|
3916
3923
|
[n]: t.data.incomingValue
|
|
3917
3924
|
}
|
|
3918
3925
|
};
|
|
3919
3926
|
}
|
|
3920
|
-
return
|
|
3927
|
+
return s;
|
|
3921
3928
|
}
|
|
3922
|
-
|
|
3923
|
-
function Xn(
|
|
3929
|
+
g(Zn, "resolveInventoryParentItemConflicts");
|
|
3930
|
+
function Xn(r, a, u) {
|
|
3924
3931
|
if (a.itemType !== V.Enum.InvtPart)
|
|
3925
3932
|
throw new Error("[resolveInventoryChildItemConflicts] only supports InvtPart child items");
|
|
3926
|
-
if (
|
|
3933
|
+
if (r.some((t) => t.type === q.INVENTORY_ITEM_CREATED))
|
|
3927
3934
|
return a;
|
|
3928
|
-
let
|
|
3929
|
-
for (const t of
|
|
3935
|
+
let s = u;
|
|
3936
|
+
for (const t of r)
|
|
3930
3937
|
if (t.type === q.INVENTORY_ITEM_UPDATED) {
|
|
3931
3938
|
const n = t.data.field;
|
|
3932
|
-
|
|
3933
|
-
...
|
|
3939
|
+
s = {
|
|
3940
|
+
...s,
|
|
3934
3941
|
[n]: t.data.incomingValue
|
|
3935
3942
|
};
|
|
3936
3943
|
}
|
|
3937
|
-
return
|
|
3944
|
+
return s;
|
|
3938
3945
|
}
|
|
3939
|
-
|
|
3946
|
+
g(Xn, "resolveInventoryChildItemConflicts");
|
|
3940
3947
|
var H;
|
|
3941
|
-
(function(
|
|
3942
|
-
|
|
3948
|
+
(function(r) {
|
|
3949
|
+
r.ASSEMBLY_ITEM_CREATED = "ASSEMBLY_ITEM_CREATED", r.ASSEMBLY_ITEM_UPDATED = "ASSEMBLY_ITEM_UPDATED", r.ASSEMBLY_ITEM_DELETED = "ASSEMBLY_ITEM_DELETED", r.ASSEMBLY_ITEM_SKU_UPDATED = "ASSEMBLY_ITEM_SKU_UPDATED";
|
|
3943
3950
|
})(H || (H = {}));
|
|
3944
3951
|
var ei = je.pick({
|
|
3945
3952
|
code: !0,
|
|
@@ -3959,8 +3966,8 @@ var ei = je.pick({
|
|
|
3959
3966
|
businessId: !0,
|
|
3960
3967
|
deletedAt: !0
|
|
3961
3968
|
});
|
|
3962
|
-
function ii(
|
|
3963
|
-
const a = [], { incoming: u, current: c } =
|
|
3969
|
+
function ii(r) {
|
|
3970
|
+
const a = [], { incoming: u, current: c } = r;
|
|
3964
3971
|
if (u.itemType !== V.Enum.Assembly)
|
|
3965
3972
|
throw new Error("[detectAssemblyChildItemConflicts] only supports Assembly child items");
|
|
3966
3973
|
if (!c)
|
|
@@ -3969,8 +3976,8 @@ function ii(s) {
|
|
|
3969
3976
|
message: `Assembly Child Item [${u.netSuiteId}] config doesn't exist`,
|
|
3970
3977
|
data: u
|
|
3971
3978
|
}), a;
|
|
3972
|
-
const
|
|
3973
|
-
for (const t of
|
|
3979
|
+
const s = Object.keys(ni.shape);
|
|
3980
|
+
for (const t of s) {
|
|
3974
3981
|
const n = u[t] ?? null, i = c[t] ?? null;
|
|
3975
3982
|
L.isEqual(n, i) || a.push({
|
|
3976
3983
|
type: H.ASSEMBLY_ITEM_UPDATED,
|
|
@@ -3984,9 +3991,9 @@ function ii(s) {
|
|
|
3984
3991
|
}
|
|
3985
3992
|
return a;
|
|
3986
3993
|
}
|
|
3987
|
-
|
|
3988
|
-
function si(
|
|
3989
|
-
const a = [], { incoming: u, current: c } =
|
|
3994
|
+
g(ii, "detectAssemblyChildItemConflicts");
|
|
3995
|
+
function si(r) {
|
|
3996
|
+
const a = [], { incoming: u, current: c } = r;
|
|
3990
3997
|
if (u.itemType !== V.Enum.Assembly)
|
|
3991
3998
|
throw new Error("[detectAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
3992
3999
|
if (!c)
|
|
@@ -3995,8 +4002,8 @@ function si(s) {
|
|
|
3995
4002
|
message: `Assembly Parent Item [${u.netSuiteId}] config doesn't exist`,
|
|
3996
4003
|
data: u
|
|
3997
4004
|
}), a;
|
|
3998
|
-
const
|
|
3999
|
-
for (const n of
|
|
4005
|
+
const s = Object.keys(ti.shape);
|
|
4006
|
+
for (const n of s) {
|
|
4000
4007
|
const i = u[n] ?? null, o = c[n] ?? null;
|
|
4001
4008
|
L.isEqual(i, o) || a.push({
|
|
4002
4009
|
type: H.ASSEMBLY_ITEM_UPDATED,
|
|
@@ -4023,99 +4030,99 @@ function si(s) {
|
|
|
4023
4030
|
}
|
|
4024
4031
|
return a;
|
|
4025
4032
|
}
|
|
4026
|
-
|
|
4027
|
-
function ri(
|
|
4033
|
+
g(si, "detectAssemblyParentItemConflicts");
|
|
4034
|
+
function ri(r, a, u) {
|
|
4028
4035
|
if (a.itemType !== V.Enum.Assembly)
|
|
4029
4036
|
throw new Error("[resolveAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
4030
|
-
if (
|
|
4037
|
+
if (r.some((t) => t.type === H.ASSEMBLY_ITEM_CREATED))
|
|
4031
4038
|
return a;
|
|
4032
|
-
let
|
|
4033
|
-
for (const t of
|
|
4039
|
+
let s = u;
|
|
4040
|
+
for (const t of r)
|
|
4034
4041
|
if (t.type === H.ASSEMBLY_ITEM_UPDATED) {
|
|
4035
4042
|
const n = t.data.field;
|
|
4036
|
-
|
|
4037
|
-
...
|
|
4043
|
+
s = {
|
|
4044
|
+
...s,
|
|
4038
4045
|
[n]: t.data.incomingValue
|
|
4039
4046
|
};
|
|
4040
4047
|
} else if (t.type === H.ASSEMBLY_ITEM_SKU_UPDATED) {
|
|
4041
4048
|
const n = t.data.field;
|
|
4042
|
-
|
|
4043
|
-
...
|
|
4049
|
+
s = {
|
|
4050
|
+
...s,
|
|
4044
4051
|
skuCache: {
|
|
4045
|
-
...
|
|
4052
|
+
...s.skuCache,
|
|
4046
4053
|
[n]: t.data.incomingValue
|
|
4047
4054
|
}
|
|
4048
4055
|
};
|
|
4049
4056
|
}
|
|
4050
|
-
return
|
|
4057
|
+
return s;
|
|
4051
4058
|
}
|
|
4052
|
-
|
|
4053
|
-
function oi(
|
|
4059
|
+
g(ri, "resolveAssemblyParentItemConflicts");
|
|
4060
|
+
function oi(r, a, u) {
|
|
4054
4061
|
if (a.itemType !== V.Enum.Assembly)
|
|
4055
4062
|
throw new Error("[resolveAssemblyChildItemConflicts] only supports Assembly child items");
|
|
4056
|
-
if (
|
|
4063
|
+
if (r.some((t) => t.type === H.ASSEMBLY_ITEM_CREATED))
|
|
4057
4064
|
return a;
|
|
4058
|
-
let
|
|
4059
|
-
for (const t of
|
|
4065
|
+
let s = u;
|
|
4066
|
+
for (const t of r)
|
|
4060
4067
|
if (t.type === H.ASSEMBLY_ITEM_UPDATED) {
|
|
4061
4068
|
const n = t.data.field;
|
|
4062
|
-
|
|
4063
|
-
...
|
|
4069
|
+
s = {
|
|
4070
|
+
...s,
|
|
4064
4071
|
[n]: t.data.incomingValue
|
|
4065
4072
|
};
|
|
4066
4073
|
}
|
|
4067
|
-
return
|
|
4074
|
+
return s;
|
|
4068
4075
|
}
|
|
4069
|
-
|
|
4070
|
-
function ai(
|
|
4076
|
+
g(oi, "resolveAssemblyChildItemConflicts");
|
|
4077
|
+
function ai(r, a, u, c, s) {
|
|
4071
4078
|
const t = {}, n = {};
|
|
4072
4079
|
for (const o of a) {
|
|
4073
|
-
const m =
|
|
4080
|
+
const m = ge(s.sku ?? [], s.unit ?? [], c, o.item.items);
|
|
4074
4081
|
t[o.id] = m;
|
|
4075
4082
|
}
|
|
4076
4083
|
for (const o of u) {
|
|
4077
|
-
const m =
|
|
4084
|
+
const m = ge(s.sku ?? [], s.unit ?? [], c, o.item.items);
|
|
4078
4085
|
n[o.id] = m;
|
|
4079
4086
|
}
|
|
4080
4087
|
return {
|
|
4081
|
-
orderItemMapping:
|
|
4088
|
+
orderItemMapping: ge(s.sku ?? [], s.unit ?? [], c, r.item.items),
|
|
4082
4089
|
orderItemMappingByFulfillment: t,
|
|
4083
4090
|
orderItemMappingByReceipt: n
|
|
4084
4091
|
};
|
|
4085
4092
|
}
|
|
4086
|
-
|
|
4087
|
-
function ui(
|
|
4088
|
-
const
|
|
4093
|
+
g(ai, "prepareTransferOrderTransformContext");
|
|
4094
|
+
function ui(r, a, u, c) {
|
|
4095
|
+
const s = {};
|
|
4089
4096
|
for (const n of a) {
|
|
4090
|
-
const i =
|
|
4091
|
-
|
|
4097
|
+
const i = ge(c.sku ?? [], c.unit ?? [], u, n.item.items);
|
|
4098
|
+
s[n.id] = i;
|
|
4092
4099
|
}
|
|
4093
4100
|
return {
|
|
4094
|
-
orderItemMapping:
|
|
4095
|
-
orderItemMappingByReceipt:
|
|
4101
|
+
orderItemMapping: ge(c.sku ?? [], c.unit ?? [], u, r.item.items),
|
|
4102
|
+
orderItemMappingByReceipt: s
|
|
4096
4103
|
};
|
|
4097
4104
|
}
|
|
4098
|
-
|
|
4099
|
-
function di(
|
|
4105
|
+
g(ui, "preparePurchaseOrderTransformContext");
|
|
4106
|
+
function di(r, a, u) {
|
|
4100
4107
|
return {
|
|
4101
|
-
orderItemMapping:
|
|
4108
|
+
orderItemMapping: ge(u.sku ?? [], u.unit ?? [], a, r.inventory.items)
|
|
4102
4109
|
};
|
|
4103
4110
|
}
|
|
4104
|
-
|
|
4105
|
-
function ci(
|
|
4106
|
-
const u =
|
|
4111
|
+
g(di, "prepareInventoryTransferTransformContext");
|
|
4112
|
+
function ci(r, a) {
|
|
4113
|
+
const u = r;
|
|
4107
4114
|
u.version = ee.Enum[1];
|
|
4108
|
-
const c = /* @__PURE__ */ new Set(),
|
|
4115
|
+
const c = /* @__PURE__ */ new Set(), s = [], t = [];
|
|
4109
4116
|
for (const n of u.items) {
|
|
4110
4117
|
c.has(n.sku._id) && t.push(n.sku._id), c.add(n.sku._id);
|
|
4111
4118
|
const i = {
|
|
4112
4119
|
...n
|
|
4113
4120
|
};
|
|
4114
|
-
delete i.id,
|
|
4121
|
+
delete i.id, s.push(i);
|
|
4115
4122
|
}
|
|
4116
4123
|
if (t.length > 0)
|
|
4117
4124
|
throw new Error(`Duplicate SKU found: ${t.join(", ")}`);
|
|
4118
|
-
return u.items =
|
|
4125
|
+
return u.items = s, u.deliveryOrder = u.deliveryOrder.map((n) => {
|
|
4119
4126
|
const i = {
|
|
4120
4127
|
...n
|
|
4121
4128
|
};
|
|
@@ -4143,160 +4150,176 @@ function ci(s, a) {
|
|
|
4143
4150
|
} : void 0
|
|
4144
4151
|
};
|
|
4145
4152
|
}
|
|
4146
|
-
|
|
4147
|
-
function li(
|
|
4148
|
-
const u = new Date(ie(
|
|
4153
|
+
g(ci, "transformPurchaseOrderToV1");
|
|
4154
|
+
function li(r, a) {
|
|
4155
|
+
const u = new Date(ie(r._id));
|
|
4149
4156
|
if (J(u, a)) return !0;
|
|
4150
|
-
const c =
|
|
4157
|
+
const c = r.deliveryFullfillment || [], s = r.deliveryOrder || [];
|
|
4151
4158
|
for (const t of c) {
|
|
4152
4159
|
const n = new Date(t.createdAt);
|
|
4153
4160
|
if (J(n, a)) return !0;
|
|
4154
4161
|
}
|
|
4155
|
-
for (const t of
|
|
4162
|
+
for (const t of s) {
|
|
4156
4163
|
const n = new Date(t.createdAt);
|
|
4157
4164
|
if (J(n, a)) return !0;
|
|
4158
4165
|
}
|
|
4159
4166
|
return !1;
|
|
4160
4167
|
}
|
|
4161
|
-
|
|
4162
|
-
function mi(
|
|
4168
|
+
g(li, "shouldSyncOrderByTimestamp");
|
|
4169
|
+
function mi(r) {
|
|
4163
4170
|
var a, u;
|
|
4164
4171
|
return {
|
|
4165
|
-
name:
|
|
4166
|
-
netSuiteId:
|
|
4167
|
-
itemType:
|
|
4168
|
-
unitTypeId:
|
|
4169
|
-
unitOfMeasureId:
|
|
4170
|
-
subsidiaryIds:
|
|
4171
|
-
includeChildren:
|
|
4172
|
-
externalId:
|
|
4173
|
-
pktCode: ((a =
|
|
4174
|
-
pktName: ((u =
|
|
4172
|
+
name: r.name,
|
|
4173
|
+
netSuiteId: r.netSuiteId,
|
|
4174
|
+
itemType: r.itemType,
|
|
4175
|
+
unitTypeId: r.unitTypeId,
|
|
4176
|
+
unitOfMeasureId: r.unitOfMeasureId,
|
|
4177
|
+
subsidiaryIds: r.subsidiaryIds,
|
|
4178
|
+
includeChildren: r.includeChildren,
|
|
4179
|
+
externalId: r.externalId,
|
|
4180
|
+
pktCode: ((a = r.customFields) == null ? void 0 : a.pktCode) || null,
|
|
4181
|
+
pktName: ((u = r.customFields) == null ? void 0 : u.pktName) || null,
|
|
4175
4182
|
parentNetSuiteId: null,
|
|
4176
|
-
cogsAccount:
|
|
4183
|
+
cogsAccount: r.cogsAccount
|
|
4177
4184
|
};
|
|
4178
4185
|
}
|
|
4179
|
-
|
|
4180
|
-
function fi(
|
|
4186
|
+
g(mi, "transformParentToFdoNetSuiteItem");
|
|
4187
|
+
function fi(r) {
|
|
4181
4188
|
var a, u;
|
|
4182
4189
|
return {
|
|
4183
|
-
name:
|
|
4184
|
-
netSuiteId:
|
|
4185
|
-
itemType:
|
|
4186
|
-
unitTypeId:
|
|
4187
|
-
unitOfMeasureId:
|
|
4188
|
-
subsidiaryIds:
|
|
4189
|
-
includeChildren:
|
|
4190
|
-
externalId:
|
|
4191
|
-
pktCode: ((a =
|
|
4192
|
-
pktName: ((u =
|
|
4193
|
-
parentNetSuiteId:
|
|
4194
|
-
cogsAccount:
|
|
4190
|
+
name: r.name,
|
|
4191
|
+
netSuiteId: r.netSuiteId,
|
|
4192
|
+
itemType: r.itemType,
|
|
4193
|
+
unitTypeId: r.unitTypeId,
|
|
4194
|
+
unitOfMeasureId: r.unitOfMeasureId,
|
|
4195
|
+
subsidiaryIds: r.subsidiaryIds,
|
|
4196
|
+
includeChildren: r.includeChildren,
|
|
4197
|
+
externalId: r.externalId,
|
|
4198
|
+
pktCode: ((a = r.customFields) == null ? void 0 : a.pktCode) || null,
|
|
4199
|
+
pktName: ((u = r.customFields) == null ? void 0 : u.pktName) || null,
|
|
4200
|
+
parentNetSuiteId: r.parentNetSuiteId,
|
|
4201
|
+
cogsAccount: r.cogsAccount
|
|
4195
4202
|
};
|
|
4196
4203
|
}
|
|
4197
|
-
|
|
4198
|
-
const
|
|
4204
|
+
g(fi, "transformChildToFdoNetSuiteItem");
|
|
4205
|
+
const ue = Qt((r, a) => {
|
|
4199
4206
|
const u = Me(), c = Xt();
|
|
4200
|
-
return a.onError(async (
|
|
4201
|
-
if (
|
|
4207
|
+
return a.onError(async (s) => {
|
|
4208
|
+
if (s instanceof Wt)
|
|
4202
4209
|
throw c == null || c.open({
|
|
4203
|
-
title:
|
|
4204
|
-
message:
|
|
4210
|
+
title: s.title,
|
|
4211
|
+
message: s.message,
|
|
4205
4212
|
type: "error"
|
|
4206
|
-
}),
|
|
4213
|
+
}), s;
|
|
4207
4214
|
}), {
|
|
4208
4215
|
async readSetting() {
|
|
4209
4216
|
var n;
|
|
4210
|
-
const
|
|
4217
|
+
const s = ((n = u.currentBusiness.value) == null ? void 0 : n._id) ?? "", t = `${r.netSuiteBackendUrl}/${s}/v2/settings`;
|
|
4211
4218
|
return await a.get(t);
|
|
4212
4219
|
},
|
|
4213
|
-
async updateLocationConfigs(
|
|
4220
|
+
async updateLocationConfigs(s) {
|
|
4221
|
+
var i;
|
|
4222
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/settings/update-locations`;
|
|
4223
|
+
return await a.post(n, s);
|
|
4224
|
+
},
|
|
4225
|
+
async updateSupplierConfigs(s) {
|
|
4214
4226
|
var i;
|
|
4215
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4216
|
-
return await a.post(n,
|
|
4227
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/settings/update-suppliers`;
|
|
4228
|
+
return await a.post(n, s);
|
|
4229
|
+
},
|
|
4230
|
+
async getNetSuiteVendorOptions() {
|
|
4231
|
+
var n;
|
|
4232
|
+
const s = ((n = u.currentBusiness.value) == null ? void 0 : n._id) ?? "", t = `${r.netSuiteBackendUrl}/${s}/v2/vendor/options`;
|
|
4233
|
+
return await a.get(t);
|
|
4217
4234
|
},
|
|
4218
4235
|
async getNetSuiteLocationOptions() {
|
|
4219
4236
|
var n;
|
|
4220
|
-
const
|
|
4237
|
+
const s = ((n = u.currentBusiness.value) == null ? void 0 : n._id) ?? "", t = `${r.netSuiteBackendUrl}/${s}/v2/location/options`;
|
|
4221
4238
|
return await a.get(t);
|
|
4222
4239
|
},
|
|
4223
4240
|
async getNetSuiteLocation() {
|
|
4224
4241
|
var n;
|
|
4225
|
-
const
|
|
4242
|
+
const s = ((n = u.currentBusiness.value) == null ? void 0 : n._id) ?? "", t = `${r.netSuiteBackendUrl}/${s}/location/browse`;
|
|
4226
4243
|
return await a.get(t);
|
|
4227
4244
|
},
|
|
4228
|
-
async manualSyncInventoryTransfer(
|
|
4245
|
+
async manualSyncInventoryTransfer(s) {
|
|
4229
4246
|
var i;
|
|
4230
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4247
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/api/${t}/${s}/inventory-transfer-sync`;
|
|
4231
4248
|
return await a.post(n);
|
|
4232
4249
|
},
|
|
4233
|
-
async syncPurchaseOrder(
|
|
4234
|
-
const n = `${
|
|
4250
|
+
async syncPurchaseOrder(s, t) {
|
|
4251
|
+
const n = `${r.netSuiteBackendUrl}/api/${s}/po-sync`;
|
|
4235
4252
|
return await a.post(n, {
|
|
4236
4253
|
purchaseOrderId: t
|
|
4237
4254
|
});
|
|
4238
4255
|
},
|
|
4239
|
-
async getItemAverageCosts(
|
|
4256
|
+
async getItemAverageCosts(s) {
|
|
4240
4257
|
var i;
|
|
4241
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4258
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/inventory-item/${s}/average-cost`;
|
|
4242
4259
|
return await a.post(n);
|
|
4243
4260
|
},
|
|
4244
|
-
async createInventoryTransfer(
|
|
4261
|
+
async createInventoryTransfer(s, t) {
|
|
4245
4262
|
var o;
|
|
4246
|
-
const n = ((o = u.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${
|
|
4263
|
+
const n = ((o = u.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${r.netSuiteBackendUrl}/${n}/v2/inventory-transfer/${s}/create`;
|
|
4247
4264
|
return await a.post(i, t);
|
|
4248
4265
|
},
|
|
4249
|
-
async getInventoryTransferHistory(
|
|
4266
|
+
async getInventoryTransferHistory(s, t, n) {
|
|
4250
4267
|
var m;
|
|
4251
|
-
const i = ((m = u.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${
|
|
4268
|
+
const i = ((m = u.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${r.netSuiteBackendUrl}/${i}/v2/inventory-transfer/${s}/transfer-out-history`;
|
|
4252
4269
|
return await a.post(o, {
|
|
4253
4270
|
startDate: t == null ? void 0 : t.toISOString(),
|
|
4254
4271
|
endDate: n == null ? void 0 : n.toISOString()
|
|
4255
4272
|
});
|
|
4256
4273
|
},
|
|
4257
|
-
async getSyncLogs(
|
|
4258
|
-
const t = `${
|
|
4274
|
+
async getSyncLogs(s) {
|
|
4275
|
+
const t = `${r.inventoryBackendUrl}/log/query?query=${encodeURIComponent(s)}`;
|
|
4259
4276
|
return await a.get(t);
|
|
4260
4277
|
},
|
|
4261
|
-
async getMoreInfo(
|
|
4278
|
+
async getMoreInfo(s, t) {
|
|
4262
4279
|
var o;
|
|
4263
|
-
const n = ((o = u.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${
|
|
4280
|
+
const n = ((o = u.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${r.netSuiteBackendUrl}/api/${n}/${s}/more-info`;
|
|
4264
4281
|
return await a.post(i, {
|
|
4265
4282
|
purchaseOrderId: t
|
|
4266
4283
|
});
|
|
4267
4284
|
},
|
|
4268
|
-
async getChangeLogs(
|
|
4285
|
+
async getChangeLogs(s) {
|
|
4269
4286
|
var i;
|
|
4270
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4287
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/system-note/${s}`;
|
|
4271
4288
|
return await a.post(n, {}, AbortSignal.timeout(6e4));
|
|
4272
4289
|
},
|
|
4273
|
-
async getUnSyncTransferInOrders(
|
|
4290
|
+
async getUnSyncTransferInOrders(s) {
|
|
4274
4291
|
var i;
|
|
4275
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4292
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/transfer-order-cron/unlink-transfer-in/${s}`;
|
|
4276
4293
|
return await a.post(n);
|
|
4277
4294
|
},
|
|
4278
|
-
async manualSyncMultipleTransferInOrders(
|
|
4279
|
-
var
|
|
4280
|
-
const t = ((
|
|
4281
|
-
return await a.post(
|
|
4282
|
-
netsuiteIds:
|
|
4295
|
+
async manualSyncMultipleTransferInOrders(s) {
|
|
4296
|
+
var m;
|
|
4297
|
+
const { netsuiteIds: t, version: n } = s, i = ((m = u.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${r.netSuiteBackendUrl}/${i}/v2/transfer-order/sync-multiple`;
|
|
4298
|
+
return await a.post(o, {
|
|
4299
|
+
netsuiteIds: t,
|
|
4300
|
+
metadata: n ? {
|
|
4301
|
+
version: n
|
|
4302
|
+
} : void 0
|
|
4283
4303
|
});
|
|
4284
4304
|
},
|
|
4285
|
-
async getUnSyncPurchaseOrders(
|
|
4305
|
+
async getUnSyncPurchaseOrders(s) {
|
|
4286
4306
|
var i;
|
|
4287
|
-
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${
|
|
4307
|
+
const t = ((i = u.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${r.netSuiteBackendUrl}/${t}/v2/purchase-order-cron/unlink-purchase-order/${s}`;
|
|
4288
4308
|
return await a.post(n);
|
|
4289
4309
|
},
|
|
4290
|
-
async manualSyncMultiplePurchaseOrders(
|
|
4291
|
-
var
|
|
4292
|
-
const t = ((
|
|
4293
|
-
return await a.post(
|
|
4294
|
-
netsuiteIds:
|
|
4310
|
+
async manualSyncMultiplePurchaseOrders(s) {
|
|
4311
|
+
var m;
|
|
4312
|
+
const { netsuiteIds: t, version: n } = s, i = ((m = u.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${r.netSuiteBackendUrl}/${i}/v2/purchase-order/sync-multiple`;
|
|
4313
|
+
return await a.post(o, {
|
|
4314
|
+
netsuiteIds: t,
|
|
4315
|
+
metadata: n ? {
|
|
4316
|
+
version: n
|
|
4317
|
+
} : void 0
|
|
4295
4318
|
});
|
|
4296
4319
|
},
|
|
4297
|
-
urls:
|
|
4320
|
+
urls: r
|
|
4298
4321
|
};
|
|
4299
|
-
}), Ii = { class: "flex flex-col" }, pi = { class: "text-sm" },
|
|
4322
|
+
}), Ii = { class: "flex flex-col" }, pi = { class: "text-sm" }, gi = { class: "text-sm" }, Ei = { class: "text-sm" }, yi = { class: "flex flex-col gap-2 mt-2" }, _i = { class: "text-xs" }, bi = { class: "text-xs" }, Si = { class: "text-xs" }, vi = { class: "text-xs" }, Ti = {
|
|
4300
4323
|
key: 0,
|
|
4301
4324
|
class: "text-xs"
|
|
4302
4325
|
}, hi = {
|
|
@@ -4319,12 +4342,12 @@ const Se = Qt((s, a) => {
|
|
|
4319
4342
|
settingOptions: {}
|
|
4320
4343
|
},
|
|
4321
4344
|
emits: ["update:modelValue"],
|
|
4322
|
-
setup(
|
|
4323
|
-
const u =
|
|
4345
|
+
setup(r, { emit: a }) {
|
|
4346
|
+
const u = r, c = a, s = He(!1), t = me(() => u.sku._id ? i.customFieldOptions[u.sku._id] ?? [] : []), n = He({
|
|
4324
4347
|
code: "",
|
|
4325
4348
|
name: "",
|
|
4326
4349
|
childName: ""
|
|
4327
|
-
}), i =
|
|
4350
|
+
}), i = Ri(), o = Me(), m = me(() => {
|
|
4328
4351
|
var d;
|
|
4329
4352
|
const f = `business_${((d = o.currentBusiness.value) == null ? void 0 : d._id) ?? ""}`;
|
|
4330
4353
|
return $e[f].code;
|
|
@@ -4333,10 +4356,10 @@ const Se = Qt((s, a) => {
|
|
|
4333
4356
|
return `Overwrite with "${f ?? "N/A"}"`;
|
|
4334
4357
|
}
|
|
4335
4358
|
return (f, d) => {
|
|
4336
|
-
const I = ke("FmButton"), p = ke("FmLabel"),
|
|
4359
|
+
const I = ke("FmButton"), p = ke("FmLabel"), E = ke("FmSelect"), y = ke("FmDialog");
|
|
4337
4360
|
return z(), tn(y, {
|
|
4338
|
-
modelValue:
|
|
4339
|
-
"onUpdate:modelValue": d[4] || (d[4] = (_) =>
|
|
4361
|
+
modelValue: s.value,
|
|
4362
|
+
"onUpdate:modelValue": d[4] || (d[4] = (_) => s.value = _),
|
|
4340
4363
|
overlay: !0,
|
|
4341
4364
|
dismissAway: !0
|
|
4342
4365
|
}, {
|
|
@@ -4349,7 +4372,7 @@ const Se = Qt((s, a) => {
|
|
|
4349
4372
|
variant: "secondary",
|
|
4350
4373
|
size: "md",
|
|
4351
4374
|
onClick: d[0] || (d[0] = () => {
|
|
4352
|
-
|
|
4375
|
+
s.value = !0;
|
|
4353
4376
|
})
|
|
4354
4377
|
})
|
|
4355
4378
|
]),
|
|
@@ -4358,7 +4381,7 @@ const Se = Qt((s, a) => {
|
|
|
4358
4381
|
])),
|
|
4359
4382
|
"dialog-footer": re(() => [
|
|
4360
4383
|
M("div", Fi, [
|
|
4361
|
-
f.readonly ? Ae("", !0) : (z(), ae(
|
|
4384
|
+
f.readonly ? Ae("", !0) : (z(), ae(Oe, { key: 0 }, [
|
|
4362
4385
|
d[17] || (d[17] = M("span", { class: "text-sm mb-2 font-bold" }, " This will overwrite the code and uom only.", -1)),
|
|
4363
4386
|
M("div", wi, [
|
|
4364
4387
|
oe(I, {
|
|
@@ -4367,7 +4390,7 @@ const Se = Qt((s, a) => {
|
|
|
4367
4390
|
size: "md",
|
|
4368
4391
|
variant: "destructive",
|
|
4369
4392
|
onClick: d[2] || (d[2] = () => {
|
|
4370
|
-
|
|
4393
|
+
s.value = !1;
|
|
4371
4394
|
const _ = u.sku.unit.measurements.find(
|
|
4372
4395
|
(S) => S.id === n.value.fmMeasurementId
|
|
4373
4396
|
);
|
|
@@ -4381,7 +4404,7 @@ const Se = Qt((s, a) => {
|
|
|
4381
4404
|
label: "Close",
|
|
4382
4405
|
size: "md",
|
|
4383
4406
|
variant: "primary",
|
|
4384
|
-
onClick: d[3] || (d[3] = (_) =>
|
|
4407
|
+
onClick: d[3] || (d[3] = (_) => s.value = !1)
|
|
4385
4408
|
})
|
|
4386
4409
|
])
|
|
4387
4410
|
]),
|
|
@@ -4401,16 +4424,16 @@ const Se = Qt((s, a) => {
|
|
|
4401
4424
|
])),
|
|
4402
4425
|
_: 1
|
|
4403
4426
|
}),
|
|
4404
|
-
M("span",
|
|
4427
|
+
M("span", gi, x(f.sku.name), 1),
|
|
4405
4428
|
oe(p, null, {
|
|
4406
4429
|
default: re(() => d[8] || (d[8] = [
|
|
4407
4430
|
Q("Unit")
|
|
4408
4431
|
])),
|
|
4409
4432
|
_: 1
|
|
4410
4433
|
}),
|
|
4411
|
-
M("span",
|
|
4434
|
+
M("span", Ei, x(f.sku.unit.name), 1)
|
|
4412
4435
|
]),
|
|
4413
|
-
f.readonly ? (z(), ae(
|
|
4436
|
+
f.readonly ? (z(), ae(Oe, { key: 0 }, [
|
|
4414
4437
|
d[14] || (d[14] = M("hr", { class: "my-2" }, null, -1)),
|
|
4415
4438
|
oe(p, null, {
|
|
4416
4439
|
default: re(() => d[9] || (d[9] = [
|
|
@@ -4419,7 +4442,7 @@ const Se = Qt((s, a) => {
|
|
|
4419
4442
|
_: 1
|
|
4420
4443
|
}),
|
|
4421
4444
|
M("div", yi, [
|
|
4422
|
-
(z(!0), ae(
|
|
4445
|
+
(z(!0), ae(Oe, null, nn(t.value, (_, S) => (z(), ae("div", {
|
|
4423
4446
|
key: S,
|
|
4424
4447
|
class: "rounded border-1 flex flex-col p-2"
|
|
4425
4448
|
}, [
|
|
@@ -4446,7 +4469,7 @@ const Se = Qt((s, a) => {
|
|
|
4446
4469
|
]))), 128)),
|
|
4447
4470
|
t.value.length === 0 ? (z(), ae("span", hi, "No custom code found.")) : Ae("", !0)
|
|
4448
4471
|
])
|
|
4449
|
-
], 64)) : (z(), ae(
|
|
4472
|
+
], 64)) : (z(), ae(Oe, { key: 1 }, [
|
|
4450
4473
|
d[16] || (d[16] = M("hr", { class: "my-2" }, null, -1)),
|
|
4451
4474
|
oe(p, null, {
|
|
4452
4475
|
default: re(() => d[15] || (d[15] = [
|
|
@@ -4454,7 +4477,7 @@ const Se = Qt((s, a) => {
|
|
|
4454
4477
|
])),
|
|
4455
4478
|
_: 1
|
|
4456
4479
|
}),
|
|
4457
|
-
oe(
|
|
4480
|
+
oe(E, {
|
|
4458
4481
|
modelValue: n.value,
|
|
4459
4482
|
"onUpdate:modelValue": d[1] || (d[1] = (_) => n.value = _),
|
|
4460
4483
|
items: t.value,
|
|
@@ -4497,7 +4520,7 @@ const Se = Qt((s, a) => {
|
|
|
4497
4520
|
name: "name"
|
|
4498
4521
|
}
|
|
4499
4522
|
};
|
|
4500
|
-
function
|
|
4523
|
+
function Oi() {
|
|
4501
4524
|
return {
|
|
4502
4525
|
setting: {
|
|
4503
4526
|
_id: "",
|
|
@@ -4517,26 +4540,26 @@ function Ri() {
|
|
|
4517
4540
|
businessSubsidiaryName: ""
|
|
4518
4541
|
};
|
|
4519
4542
|
}
|
|
4520
|
-
const T = He(
|
|
4521
|
-
function
|
|
4522
|
-
const
|
|
4543
|
+
const T = He(Oi());
|
|
4544
|
+
function Ri() {
|
|
4545
|
+
const r = Zt(), a = me(() => T.value.setting.items.groupBy("netSuiteId", (i) => i.id)), u = me(() => T.value.setting.units.flatMap((i) => i.measurements).groupBy("netSuiteId", (i) => i.id)), c = me(() => T.value.setting.items.groupBy((i) => i.id)), s = me(
|
|
4523
4546
|
() => T.value.setting.units.groupBy(
|
|
4524
4547
|
(i) => i.netSuiteId,
|
|
4525
|
-
(i) =>
|
|
4548
|
+
(i) => r.unitById[i.id]
|
|
4526
4549
|
)
|
|
4527
|
-
), t =
|
|
4550
|
+
), t = me(
|
|
4528
4551
|
() => Li({
|
|
4529
|
-
units:
|
|
4530
|
-
skus:
|
|
4552
|
+
units: r.unitById,
|
|
4553
|
+
skus: r.skus,
|
|
4531
4554
|
settingOptions: T.value.skuOptions,
|
|
4532
4555
|
customFields: Pi
|
|
4533
4556
|
})
|
|
4534
|
-
), n =
|
|
4557
|
+
), n = me(
|
|
4535
4558
|
() => T.value.setting.units.flatMap(
|
|
4536
4559
|
(i) => i.measurements.map((o) => {
|
|
4537
4560
|
var m;
|
|
4538
4561
|
return {
|
|
4539
|
-
unit: (m =
|
|
4562
|
+
unit: (m = s.value.get(i.netSuiteId)) == null ? void 0 : m[0],
|
|
4540
4563
|
measurement: o
|
|
4541
4564
|
};
|
|
4542
4565
|
})
|
|
@@ -4556,7 +4579,7 @@ function Oi() {
|
|
|
4556
4579
|
i.beforeStart && await i.beforeStart();
|
|
4557
4580
|
const o = {};
|
|
4558
4581
|
for (let m = 0; m < i.templateItems.length; m++) {
|
|
4559
|
-
const l = i.templateItems[m], f =
|
|
4582
|
+
const l = i.templateItems[m], f = r.skuById[l.sku._id];
|
|
4560
4583
|
if (!f) {
|
|
4561
4584
|
o[m] = "Invalid record. Please remove this row.";
|
|
4562
4585
|
continue;
|
|
@@ -4587,7 +4610,7 @@ function Oi() {
|
|
|
4587
4610
|
0: {
|
|
4588
4611
|
id: "netsuite-verify",
|
|
4589
4612
|
cell: (o) => {
|
|
4590
|
-
const m =
|
|
4613
|
+
const m = r.skuById[o.row.original.sku._id];
|
|
4591
4614
|
return sn(ki, {
|
|
4592
4615
|
sku: m,
|
|
4593
4616
|
settingOptions: T.value.skuOptions,
|
|
@@ -4634,7 +4657,7 @@ function Oi() {
|
|
|
4634
4657
|
return c.value;
|
|
4635
4658
|
},
|
|
4636
4659
|
get unitByNetsuiteId() {
|
|
4637
|
-
return
|
|
4660
|
+
return s.value;
|
|
4638
4661
|
},
|
|
4639
4662
|
get measurementByNetsuiteId() {
|
|
4640
4663
|
return n.value;
|
|
@@ -4753,11 +4776,11 @@ function Oi() {
|
|
|
4753
4776
|
);
|
|
4754
4777
|
if (m.includeChildren) {
|
|
4755
4778
|
const I = T.value.setting.childItems.filter((p) => {
|
|
4756
|
-
let
|
|
4779
|
+
let E = p.subsidiaryIds;
|
|
4757
4780
|
if (p.includeChildren == !0)
|
|
4758
4781
|
for (const y of p.subsidiaryIds)
|
|
4759
|
-
|
|
4760
|
-
return
|
|
4782
|
+
E = E.concat(f[y]);
|
|
4783
|
+
return E = [...new Set(E)], p.parentNetSuiteId === m.netSuiteId && console.log(p), p.parentNetSuiteId === m.netSuiteId && E.some((y) => l.includes(y));
|
|
4761
4784
|
}).flatMap((p) => p.unitTypeId);
|
|
4762
4785
|
return T.value.setting.units.filter((p) => I.includes(p.netSuiteId)).flatMap((p) => p.measurements).map((p) => p.id);
|
|
4763
4786
|
}
|
|
@@ -4765,19 +4788,19 @@ function Oi() {
|
|
|
4765
4788
|
},
|
|
4766
4789
|
async readSetting() {
|
|
4767
4790
|
var m;
|
|
4768
|
-
const o = await
|
|
4791
|
+
const o = await ue().readSetting();
|
|
4769
4792
|
if (o) {
|
|
4770
4793
|
if (this.state.setting = o, (m = T.value.setting.subsidiaries) != null && m.length) {
|
|
4771
4794
|
const { flat: f, tree: d } = Z(T.value.setting.subsidiaries);
|
|
4772
4795
|
for (const p of o.vendors) {
|
|
4773
|
-
const
|
|
4774
|
-
this.state.vendorSubsidiary[p.id] = (
|
|
4796
|
+
const E = f.find((y) => y.id === p.subsidiaryId);
|
|
4797
|
+
this.state.vendorSubsidiary[p.id] = (E == null ? void 0 : E.fullName) || "";
|
|
4775
4798
|
}
|
|
4776
4799
|
for (const p of o.items) {
|
|
4777
|
-
const
|
|
4800
|
+
const E = [];
|
|
4778
4801
|
for (const _ of p.subsidiaryIds) {
|
|
4779
4802
|
const S = f.find((v) => v.id === _);
|
|
4780
|
-
S &&
|
|
4803
|
+
S && E.push(S.fullName || "");
|
|
4781
4804
|
}
|
|
4782
4805
|
const y = $t(
|
|
4783
4806
|
d,
|
|
@@ -4786,7 +4809,7 @@ function Oi() {
|
|
|
4786
4809
|
);
|
|
4787
4810
|
this.state.skuSubsidiaries[p.id] = {
|
|
4788
4811
|
includeChildren: p.includeChildren,
|
|
4789
|
-
flattenedSubsidiaryNames:
|
|
4812
|
+
flattenedSubsidiaryNames: E,
|
|
4790
4813
|
subsidiaryTree: y
|
|
4791
4814
|
};
|
|
4792
4815
|
}
|
|
@@ -4822,11 +4845,18 @@ function Oi() {
|
|
|
4822
4845
|
this.state.isReady = !0;
|
|
4823
4846
|
},
|
|
4824
4847
|
async updateLocationConfigs(i) {
|
|
4825
|
-
const m = await
|
|
4848
|
+
const m = await ue().updateLocationConfigs(i);
|
|
4826
4849
|
m && (this.state.setting = m);
|
|
4827
4850
|
},
|
|
4851
|
+
async updateSupplierConfigs(i) {
|
|
4852
|
+
const m = await ue().updateSupplierConfigs(i);
|
|
4853
|
+
m && (this.state.setting = m);
|
|
4854
|
+
},
|
|
4855
|
+
async getNetSuiteVendorOptions() {
|
|
4856
|
+
return await ue().getNetSuiteVendorOptions();
|
|
4857
|
+
},
|
|
4828
4858
|
async getNetSuiteLocations() {
|
|
4829
|
-
const o = await
|
|
4859
|
+
const o = await ue().getNetSuiteLocation();
|
|
4830
4860
|
return console.log(o), o;
|
|
4831
4861
|
},
|
|
4832
4862
|
getVendorSubsidiaryName(i) {
|
|
@@ -4840,7 +4870,7 @@ function Oi() {
|
|
|
4840
4870
|
};
|
|
4841
4871
|
},
|
|
4842
4872
|
async syncPurchaseOrder(i, o) {
|
|
4843
|
-
const m =
|
|
4873
|
+
const m = ue();
|
|
4844
4874
|
let l = o;
|
|
4845
4875
|
if (!l) {
|
|
4846
4876
|
const f = Ce(), d = f.currentLocation.doc._id;
|
|
@@ -4853,12 +4883,12 @@ function Oi() {
|
|
|
4853
4883
|
const l = `business_${((p = Me().currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, f = $e[l].code, d = c.value.get(i._id);
|
|
4854
4884
|
let I = null;
|
|
4855
4885
|
if (d && d.length > 0) {
|
|
4856
|
-
const
|
|
4857
|
-
|
|
4886
|
+
const E = d[0];
|
|
4887
|
+
E[f] && (I = E[f]);
|
|
4858
4888
|
const y = T.value.setting.units.find((S) => {
|
|
4859
4889
|
var v;
|
|
4860
4890
|
return S.id === ((v = i.unit) == null ? void 0 : v._id);
|
|
4861
|
-
}), _ =
|
|
4891
|
+
}), _ = E.netSuiteId;
|
|
4862
4892
|
if (o) {
|
|
4863
4893
|
const S = y == null ? void 0 : y.measurements.find((v) => v.id === o);
|
|
4864
4894
|
if (S) {
|
|
@@ -4875,34 +4905,37 @@ function Oi() {
|
|
|
4875
4905
|
return I;
|
|
4876
4906
|
},
|
|
4877
4907
|
async getNetSuiteLocationOptions() {
|
|
4878
|
-
return await
|
|
4908
|
+
return await ue().getNetSuiteLocationOptions();
|
|
4909
|
+
},
|
|
4910
|
+
async getNetSuiteVendorsOptions() {
|
|
4911
|
+
return await ue().getNetSuiteVendorOptions();
|
|
4879
4912
|
},
|
|
4880
4913
|
async getItemAverageCosts() {
|
|
4881
|
-
const i =
|
|
4914
|
+
const i = ue(), m = Ce().currentLocation.doc._id;
|
|
4882
4915
|
return await i.getItemAverageCosts(m);
|
|
4883
4916
|
}
|
|
4884
4917
|
};
|
|
4885
4918
|
}
|
|
4886
|
-
function $t(
|
|
4887
|
-
return
|
|
4888
|
-
const
|
|
4889
|
-
return { ...c, children: t, isAssigned:
|
|
4919
|
+
function $t(r, a, u) {
|
|
4920
|
+
return r.map((c) => {
|
|
4921
|
+
const s = a.includes(c.id), t = $t(c.children, a);
|
|
4922
|
+
return { ...c, children: t, isAssigned: s };
|
|
4890
4923
|
}).filter(Boolean);
|
|
4891
4924
|
}
|
|
4892
|
-
function Z(
|
|
4925
|
+
function Z(r, a) {
|
|
4893
4926
|
const u = [], c = [];
|
|
4894
|
-
function
|
|
4895
|
-
return
|
|
4927
|
+
function s(o, m, l = !1) {
|
|
4928
|
+
return r.filter((d) => d.parentId === m).map((d) => ((l || d.id === a || !a) && u.push(d.id), {
|
|
4896
4929
|
id: d.id,
|
|
4897
4930
|
name: d.name,
|
|
4898
4931
|
country: d.country,
|
|
4899
4932
|
currency: d.currency,
|
|
4900
4933
|
parentId: d.parentId,
|
|
4901
4934
|
depth: o,
|
|
4902
|
-
children:
|
|
4935
|
+
children: s(o + 1, d.id, l || d.id === a)
|
|
4903
4936
|
}));
|
|
4904
4937
|
}
|
|
4905
|
-
const t =
|
|
4938
|
+
const t = s(0, null), n = {};
|
|
4906
4939
|
function i(o, m = "") {
|
|
4907
4940
|
const l = o.fullName || o.name, f = m ? `${m} : ${l}` : l;
|
|
4908
4941
|
c.push({ ...o, fullName: f }), n[o.id] = [o.id];
|
|
@@ -4916,14 +4949,14 @@ function Z(s, a) {
|
|
|
4916
4949
|
flatMapping: n
|
|
4917
4950
|
};
|
|
4918
4951
|
}
|
|
4919
|
-
function Li(
|
|
4952
|
+
function Li(r) {
|
|
4920
4953
|
function a(i, o, m) {
|
|
4921
4954
|
const l = u[i];
|
|
4922
4955
|
return l(o, m);
|
|
4923
4956
|
}
|
|
4924
|
-
const { customFields: u, skus: c, settingOptions:
|
|
4957
|
+
const { customFields: u, skus: c, settingOptions: s, units: t } = r, n = {};
|
|
4925
4958
|
for (const i of c) {
|
|
4926
|
-
const o =
|
|
4959
|
+
const o = s[i._id], m = a("name", o.item), l = a("code", o.item), f = {
|
|
4927
4960
|
label: `${i.name} (${l})`,
|
|
4928
4961
|
value: {
|
|
4929
4962
|
code: l,
|
|
@@ -4933,7 +4966,7 @@ function Li(s) {
|
|
|
4933
4966
|
}
|
|
4934
4967
|
}, d = o.childItems.reduce(
|
|
4935
4968
|
(I, p) => {
|
|
4936
|
-
const
|
|
4969
|
+
const E = a("code", void 0, p), y = a("name", void 0, p), _ = o.unit.measurements.find(
|
|
4937
4970
|
(b) => b.netSuiteId === p.unitOfMeasureId
|
|
4938
4971
|
);
|
|
4939
4972
|
let S = i.unit.measurements.find((b) => b.id === (_ == null ? void 0 : _.id)), v, C = S == null ? void 0 : S.abbrev;
|
|
@@ -4955,9 +4988,9 @@ function Li(s) {
|
|
|
4955
4988
|
}
|
|
4956
4989
|
const N = p.name || "N/A (childName not found)";
|
|
4957
4990
|
return I.push({
|
|
4958
|
-
label: `${N} (${
|
|
4991
|
+
label: `${N} (${E})`,
|
|
4959
4992
|
value: {
|
|
4960
|
-
code:
|
|
4993
|
+
code: E,
|
|
4961
4994
|
name: y,
|
|
4962
4995
|
childName: N,
|
|
4963
4996
|
externalId: p.externalId || "N/A (externalId not found)",
|
|
@@ -4974,20 +5007,20 @@ function Li(s) {
|
|
|
4974
5007
|
return n;
|
|
4975
5008
|
}
|
|
4976
5009
|
const Pi = {
|
|
4977
|
-
code: (
|
|
5010
|
+
code: (r, a) => {
|
|
4978
5011
|
var t;
|
|
4979
|
-
const c = `business_${((t = Me().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`,
|
|
4980
|
-
return
|
|
5012
|
+
const c = `business_${((t = Me().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`, s = $e[c].code;
|
|
5013
|
+
return r && r[s] ? r[s] : a && a[s] ? a[s] : "N/A";
|
|
4981
5014
|
},
|
|
4982
|
-
name: (
|
|
5015
|
+
name: (r, a) => {
|
|
4983
5016
|
var t;
|
|
4984
|
-
const c = `business_${((t = Me().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`,
|
|
4985
|
-
return
|
|
5017
|
+
const c = `business_${((t = Me().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`, s = $e[c].name;
|
|
5018
|
+
return r && r[s] ? r[s] : a && a[s] ? a[s] : "N/A";
|
|
4986
5019
|
}
|
|
4987
5020
|
};
|
|
4988
5021
|
export {
|
|
4989
5022
|
Ke as S,
|
|
4990
5023
|
ki as _,
|
|
4991
|
-
|
|
4992
|
-
|
|
5024
|
+
ue as a,
|
|
5025
|
+
Ri as u
|
|
4993
5026
|
};
|