@feedmepos/mf-inventory-portal 1.2.53-dev.2 → 1.2.54
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-C8X881gs.js → App-D-VZYqug.js} +3 -3
- package/dist/{ApprovalView-CnwwVO46.js → ApprovalView-D4hwTR4F.js} +5 -5
- package/dist/{BindingsDialog-MM6wv-je.js → BindingsDialog-CTGKOvwl.js} +2 -2
- package/dist/{BindingsPicker-C_VV8t8e.js → BindingsPicker-Sns21683.js} +2 -2
- package/dist/{BindingsTable-CabKT98b.js → BindingsTable-DA4erzPZ.js} +3 -3
- package/dist/{ClosingDraftView-D3dwGHdG.js → ClosingDraftView-BMR9Pur6.js} +9 -9
- package/dist/{ClosingHistoryView-CBMIWL-O.js → ClosingHistoryView-BVUbc69A.js} +3 -3
- package/dist/{ClosingTemplateView-FHCJY1Y1.js → ClosingTemplateView-Bb8pwuCe.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-BB4HVWaM.js → DeliveryOrderPrintPreview-CqrV17Ss.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Dq2vcIMB.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BTQzT4Ll.js} +3 -3
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BSrjl8Vc.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BlbhHrvK.js} +2 -2
- package/dist/{FmMultiselectDialog-D8E2bGwL.js → FmMultiselectDialog-BP8cE15r.js} +2 -2
- package/dist/{FmMultiselectDialog-HP5xQpLC.js → FmMultiselectDialog-CmOYg6Kh.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang--yzPFTUH.js → FmUnitInput.vue_vue_type_script_setup_true_lang-D6xPtjIO.js} +3 -3
- package/dist/{ImportView-DQPKyc1T.js → ImportView-B7ByYT7o.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DZAOa26T.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-5B7hEmvj.js} +1 -1
- package/dist/{IngredientGroupView-CiR31jQz.js → IngredientGroupView-dC-PT8ql.js} +5 -5
- package/dist/{IngredientsView-Csa1Lifk.js → IngredientsView-BmhZK2YX.js} +14 -14
- package/dist/{IntegrationView-DqGXjNPx.js → IntegrationView-BmTQHUBD.js} +12 -12
- package/dist/{InventoryBindingForm-kZ6JIgK4.js → InventoryBindingForm-CQUHG8x6.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D-qjPLHS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DfdP2alD.js} +4 -4
- package/dist/{InventoryBindingSummary-Cn3y7cXX.js → InventoryBindingSummary-B_HFFXKk.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-5cpvf_ze.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bxhq-pC7.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DW_3XEAx.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CvWT2hby.js} +2 -2
- package/dist/{PublishView-tvxBQLp2.js → PublishView-Cebarksu.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CqSijErx.js → PurchaseOrderPrintPreview-D8_ElaqR.js} +1 -1
- package/dist/{ReceiveRequestView-Oq87gJ1d.js → ReceiveRequestView-CxXX8QZK.js} +19 -19
- package/dist/{RecipeView-c7SNUwhq.js → RecipeView-H6Pitxo6.js} +8 -8
- package/dist/{StockView-B3ocNf5D.js → StockView-B3xn8_p8.js} +15 -15
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Br3p4H5X.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DOQe7m9u.js} +1 -1
- package/dist/{SupplierView-7UHgW64q.js → SupplierView-C5x9TU-C.js} +11 -11
- package/dist/{SurchargeView-CkBBz_W1.js → SurchargeView-CHGzxR9G.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BxqwBD1A.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-BZZrh1rE.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DZxJDrcN.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-D5E7ynRF.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BP7PC5FE.js → TransferDetails.vue_vue_type_script_setup_true_lang-Dzgp0fQl.js} +14 -14
- package/dist/{TransferTemplateView-gnib1NSD.js → TransferTemplateView-ij6hOCIC.js} +15 -15
- package/dist/{UnitView-gccTcBDm.js → UnitView-DZ66UyJl.js} +6 -6
- package/dist/{WarehouseView-9Tzk2HFV.js → WarehouseView-9Dxjkrar.js} +5 -5
- package/dist/{WastageTemplateView-bxDDb0it.js → WastageTemplateView-BDsmo7JY.js} +14 -14
- package/dist/{app-S9HQBEDL.js → app-DD7JhUGU.js} +9 -9
- package/dist/app.js +1 -1
- package/dist/{closing-template-DSppbNBU.js → closing-template--kDye1Pd.js} +1 -1
- package/dist/{date2-a0EDY-8z.js → date2-H3nQLWV7.js} +1 -1
- package/dist/{dayjs.min-D3uqC-FM.js → dayjs.min-BbG9rrEk.js} +1 -1
- package/dist/{decimal-iC0dKSbY.js → decimal-Dcwv_L7B.js} +2 -2
- package/dist/{defineDeepModel-sBbNFqqR.js → defineDeepModel-DKe4PkHX.js} +1 -1
- package/dist/{duplicate-template-Dwe_h80w.js → duplicate-template-5CiM_4yA.js} +1 -1
- package/dist/{feature-12j10xt_.js → feature-BgBuIvMu.js} +2 -2
- package/dist/{format-time-from-id-Dyyvx-ha.js → format-time-from-id-BgBTem9u.js} +1 -1
- package/dist/{format-unit-display-DstE3kKS.js → format-unit-display-Iu9N0q6G.js} +10 -10
- package/dist/{import-export.helper-CR8rEBJV.js → import-export.helper-DhEsu7wC.js} +5 -5
- package/dist/{index-CvRrsISb.js → index-C62aoac6.js} +3 -3
- package/dist/{index-BbpxRM23.js → index-CgU0CX1f.js} +1 -1
- package/dist/{index-Ca8nKTEy.js → index-DKI8v8vQ.js} +1 -1
- package/dist/{lodash-BiCqhRt2.js → lodash-C6oTedPt.js} +1 -1
- package/dist/{netsuite-B84CfGmT.js → netsuite-DPmxZIui.js} +1113 -1089
- package/dist/{purchase-order-template-ogVLqXnM.js → purchase-order-template-DRAnse9p.js} +1 -1
- package/dist/{rules-C0W8tBAK.js → rules-16OnNEb8.js} +3 -3
- package/dist/{stock-Dy08ISna.js → stock-BHG8B4Ld.js} +1 -1
- package/dist/{stock-BfY956rP.js → stock-FiPf_fkj.js} +3 -3
- package/dist/{supplier-BGfg_Uzv.js → supplier-B95jcdwc.js} +2 -2
- package/dist/{surcharge-DZkc9Zxa.js → surcharge-CfECr29_.js} +1 -1
- package/dist/{use-ingredient-select-dialog-fOf-xHgn.js → use-ingredient-select-dialog-Bgw6vt-B.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CF6dmCop.js → use-inventory-binding-dialog-Cgx1LSn3.js} +2 -2
- package/dist/{use-template-enabled-locations-2-C9YTP8tP.js → use-template-enabled-locations-2-ra2HYT7d.js} +2 -2
- package/dist/{vue-i18n-CVvQI1xZ.js → vue-i18n-wiSHRpXy.js} +575 -575
- package/dist/{xlsx-C46Afq2T.js → xlsx-Dw4HzkZc.js} +1 -1
- package/dist/{xlsx.util-iJmlHY2V.js → xlsx.util-C8QAbDUA.js} +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { m as e, _ as Ht, $ as Kt, a0 as zt, a1 as Gt, a2 as
|
|
1
|
+
import { m as e, _ as Ht, $ as Kt, a0 as zt, a1 as Gt, a2 as Fe, a3 as Yt, a4 as ke, U as He, a5 as Xe, a6 as Dt, a7 as O, a8 as x, e as Te, N as R, w as A, a9 as $e, C as ne, B as se, aa as Ke, M as V, ab as Ct, ac as Jt, ad as Wt, ae as Qt, af as et, ag as Zt, o as Xt, j as en, v as ft, a as tn, u as Me } from "./app-DD7JhUGU.js";
|
|
2
2
|
import { useCoreStore as we } from "@feedmepos/mf-common";
|
|
3
3
|
import { useSnackbar as nn } from "@feedmepos/ui-library";
|
|
4
|
-
import { _ as
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { u as un } from "./feature-
|
|
7
|
-
var dn = Object.defineProperty, g = (
|
|
4
|
+
import { _ as P } from "./lodash-C6oTedPt.js";
|
|
5
|
+
import { defineComponent as rn, ref as ze, computed as Ie, resolveComponent as xe, openBlock as W, createBlock as sn, withCtx as oe, createVNode as ae, createElementVNode as w, createElementBlock as ue, Fragment as Le, createCommentVNode as Ue, createTextVNode as Q, toDisplayString as j, renderList as on, unref as It, h as an } from "vue";
|
|
6
|
+
import { u as un } from "./feature-BgBuIvMu.js";
|
|
7
|
+
var dn = Object.defineProperty, g = (s, u) => dn(s, "name", { value: u, configurable: !0 }), Ce = "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 Ge;
|
|
24
|
-
(function(
|
|
25
|
-
|
|
24
|
+
(function(s) {
|
|
25
|
+
s[s.Create = 0] = "Create", s[s.Set = 1] = "Set", s[s.Unset = 2] = "Unset", s[s.Change = 3] = "Change";
|
|
26
26
|
})(Ge || (Ge = {}));
|
|
27
27
|
e.nativeEnum(Ge);
|
|
28
28
|
e.enum([
|
|
@@ -341,8 +341,8 @@ e.object({
|
|
|
341
341
|
custbody_fm_po_num: e.number()
|
|
342
342
|
});
|
|
343
343
|
var Ne;
|
|
344
|
-
(function(
|
|
345
|
-
|
|
344
|
+
(function(s) {
|
|
345
|
+
s.A = "Pending Supervisor Approval", s.B = "Approved by Supervisor/Pending Receipt", s.C = "Rejected", s.D = "Partially Received", s.E = "Pending Billing/Partially Received", s.F = "Approved by Supervisor/Pending Bill", s.G = "Fully Billed", s.H = "Closed";
|
|
346
346
|
})(Ne || (Ne = {}));
|
|
347
347
|
var X = e.nativeEnum(Ne), gn = e.object({
|
|
348
348
|
amount: e.number().nullish(),
|
|
@@ -462,11 +462,11 @@ e.object({
|
|
|
462
462
|
custbody_fm_po_request_id: e.string(),
|
|
463
463
|
custbody_fm_po_num: e.number()
|
|
464
464
|
});
|
|
465
|
-
var
|
|
466
|
-
(function(
|
|
467
|
-
|
|
468
|
-
})(
|
|
469
|
-
var
|
|
465
|
+
var F;
|
|
466
|
+
(function(s) {
|
|
467
|
+
s.A = "Pending Approval", s.B = "Pending Fulfillment", s.C = "Rejected", s.D = "Partially Fulfilled", s.E = "Pending Receipt/Partially Fulfilled", s.F = "Pending Receipt", s.G = "Received", s.H = "Closed";
|
|
468
|
+
})(F || (F = {}));
|
|
469
|
+
var ce = e.nativeEnum(F), bn = e.object({
|
|
470
470
|
abbreviation: e.string(),
|
|
471
471
|
baseUnit: e.boolean(),
|
|
472
472
|
conversionRate: e.number(),
|
|
@@ -581,7 +581,7 @@ e.object({
|
|
|
581
581
|
custitem_pkt_code: e.string().nullish(),
|
|
582
582
|
custitem_pkt_name: e.string().nullish()
|
|
583
583
|
});
|
|
584
|
-
|
|
584
|
+
Fe.omit({
|
|
585
585
|
unit: !0
|
|
586
586
|
}).extend({
|
|
587
587
|
unit: At,
|
|
@@ -923,7 +923,7 @@ e.object({
|
|
|
923
923
|
}),
|
|
924
924
|
subtype: e.object({
|
|
925
925
|
id: e.string(),
|
|
926
|
-
refName: e.string().refine((
|
|
926
|
+
refName: e.string().refine((s) => Nn.options.includes(s), "Unsupported subtype value")
|
|
927
927
|
}),
|
|
928
928
|
unitsType: e.object({
|
|
929
929
|
id: e.string(),
|
|
@@ -938,12 +938,12 @@ e.object({
|
|
|
938
938
|
to_curr: e.string(),
|
|
939
939
|
to_curr_id: e.string()
|
|
940
940
|
});
|
|
941
|
-
function Ye(
|
|
942
|
-
return $e.FCurrency.safeParse(
|
|
941
|
+
function Ye(s) {
|
|
942
|
+
return $e.FCurrency.safeParse(s.trim().toUpperCase()).success;
|
|
943
943
|
}
|
|
944
944
|
g(Ye, "isCurrencySupported");
|
|
945
|
-
function nt(
|
|
946
|
-
const { purchasePrice: u, itemBaseCurrencyId: d, itemBaseCurrencyName: c, targetCurrencyId:
|
|
945
|
+
function nt(s) {
|
|
946
|
+
const { purchasePrice: u, itemBaseCurrencyId: d, itemBaseCurrencyName: c, targetCurrencyId: r, nsExchangeRates: n } = s;
|
|
947
947
|
if (u == null)
|
|
948
948
|
return null;
|
|
949
949
|
if (d.length === 0)
|
|
@@ -952,11 +952,11 @@ function nt(r) {
|
|
|
952
952
|
currency: Ye(c) ? c : Ce,
|
|
953
953
|
...A.fromNumber(u)
|
|
954
954
|
};
|
|
955
|
-
if (d ===
|
|
955
|
+
if (d === r)
|
|
956
956
|
return i;
|
|
957
|
-
const o = n.find((a) => a.from_curr_id === d && a.to_curr_id ===
|
|
957
|
+
const o = n.find((a) => a.from_curr_id === d && a.to_curr_id === r);
|
|
958
958
|
if (!o)
|
|
959
|
-
throw new Error(`Exchange rate not found from currency ID ${d ?? "unknown"} to target currency ID ${
|
|
959
|
+
throw new Error(`Exchange rate not found from currency ID ${d ?? "unknown"} to target currency ID ${r}`);
|
|
960
960
|
const m = Ye(o.to_curr) ? o.to_curr : Ce, l = A.fromNumber(Number(o.exchangerate)), f = A.multiply([
|
|
961
961
|
A.fromNumber(u),
|
|
962
962
|
l
|
|
@@ -968,26 +968,26 @@ function nt(r) {
|
|
|
968
968
|
}
|
|
969
969
|
g(nt, "getPurchasePriceInDifferentCurrency");
|
|
970
970
|
var pt;
|
|
971
|
-
(function(
|
|
971
|
+
(function(s) {
|
|
972
972
|
(function(u) {
|
|
973
|
-
function d(
|
|
973
|
+
function d(r, n) {
|
|
974
974
|
var v, U;
|
|
975
|
-
const { nsAssemblyItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } =
|
|
975
|
+
const { nsAssemblyItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } = r;
|
|
976
976
|
if (!t.unitsType)
|
|
977
977
|
throw new Error(`Missing unit type in NetSuite assembly item ${t.id}`);
|
|
978
978
|
if (o.netSuiteId !== t.unitsType.id)
|
|
979
979
|
throw new Error(`Unit type mismatch for NetSuite assembly item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
980
|
-
const f = t.subsidiary.items.map((N) => N.id), a =
|
|
980
|
+
const f = t.subsidiary.items.map((N) => N.id), a = O({
|
|
981
981
|
prefix: x.Enum.sku
|
|
982
|
-
}),
|
|
983
|
-
const D = M.compute(
|
|
982
|
+
}), I = (v = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : v.reduce((N, M) => {
|
|
983
|
+
const D = M.compute(r);
|
|
984
984
|
return {
|
|
985
985
|
...N,
|
|
986
986
|
[M.fieldId]: D
|
|
987
987
|
};
|
|
988
|
-
}, {}),
|
|
988
|
+
}, {}), p = t.purchaseUnit === t.baseUnit;
|
|
989
989
|
let y = null;
|
|
990
|
-
if (!
|
|
990
|
+
if (!p) {
|
|
991
991
|
const N = o.measurements.find((D) => D.netSuiteId === t.purchaseUnit);
|
|
992
992
|
if (!N)
|
|
993
993
|
throw new Error(`Measurement with NetSuite ID ${t.purchaseUnit} not found in unit ${i._id} (NetSuite unit type ${t.unitsType.id}). Please sync unit types before syncing assembly items.`);
|
|
@@ -997,7 +997,7 @@ var pt;
|
|
|
997
997
|
y = M;
|
|
998
998
|
}
|
|
999
999
|
const E = (U = n == null ? void 0 : n.overrideAttributes) == null ? void 0 : U.reduce((N, M) => {
|
|
1000
|
-
const D = M.compute(
|
|
1000
|
+
const D = M.compute(r);
|
|
1001
1001
|
return {
|
|
1002
1002
|
...N,
|
|
1003
1003
|
[M.fieldId]: D
|
|
@@ -1041,23 +1041,23 @@ var pt;
|
|
|
1041
1041
|
includeChildren: t.includeChildren,
|
|
1042
1042
|
externalId: t.externalId,
|
|
1043
1043
|
customFields: {
|
|
1044
|
-
...
|
|
1044
|
+
...I
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
1047
|
}
|
|
1048
1048
|
g(d, "transformAsParent"), u.transformAsParent = d;
|
|
1049
|
-
function c(
|
|
1049
|
+
function c(r, n) {
|
|
1050
1050
|
var f;
|
|
1051
|
-
const { nsAssemblyItem: t, nsUnitTypeConfig: i } =
|
|
1051
|
+
const { nsAssemblyItem: t, nsUnitTypeConfig: i } = r;
|
|
1052
1052
|
if (!t.unitsType)
|
|
1053
1053
|
throw new Error(`Missing unit type in NetSuite assembly child item ${t.id}`);
|
|
1054
1054
|
if (i.netSuiteId !== t.unitsType.id)
|
|
1055
1055
|
throw new Error(`Unit type mismatch for NetSuite assembly child item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${i.netSuiteId}`);
|
|
1056
|
-
const o = t.subsidiary.items.map((a) => a.id), m = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((a,
|
|
1057
|
-
const
|
|
1056
|
+
const o = t.subsidiary.items.map((a) => a.id), m = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((a, I) => {
|
|
1057
|
+
const p = I.compute(r);
|
|
1058
1058
|
return {
|
|
1059
1059
|
...a,
|
|
1060
|
-
[
|
|
1060
|
+
[I.fieldId]: p
|
|
1061
1061
|
};
|
|
1062
1062
|
}, {});
|
|
1063
1063
|
return {
|
|
@@ -1081,10 +1081,10 @@ var pt;
|
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
1083
|
g(c, "transformAsChild"), u.transformAsChild = c;
|
|
1084
|
-
})(
|
|
1084
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1085
1085
|
})(pt || (pt = {}));
|
|
1086
|
-
function Mt(
|
|
1087
|
-
switch (
|
|
1086
|
+
function Mt(s) {
|
|
1087
|
+
switch (s.costingMethod.id) {
|
|
1088
1088
|
case "FIFO":
|
|
1089
1089
|
return Te.Enum.FIFO;
|
|
1090
1090
|
case "LIFO":
|
|
@@ -1095,18 +1095,18 @@ function Mt(r) {
|
|
|
1095
1095
|
}
|
|
1096
1096
|
g(Mt, "_getValuation");
|
|
1097
1097
|
var yt;
|
|
1098
|
-
(function(
|
|
1098
|
+
(function(s) {
|
|
1099
1099
|
(function(u) {
|
|
1100
|
-
function d(c,
|
|
1100
|
+
function d(c, r) {
|
|
1101
1101
|
var E, _;
|
|
1102
1102
|
const { nsServiceItem: n, fmUnit: t, nsUnitTypeConfig: i } = c;
|
|
1103
1103
|
if (!n.unitsType)
|
|
1104
1104
|
throw new Error(`Missing unit type in NetSuite service item ${n.id}`);
|
|
1105
1105
|
if (i.netSuiteId !== n.unitsType.id)
|
|
1106
1106
|
throw new Error(`Unit type mismatch for NetSuite service item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${i.netSuiteId}`);
|
|
1107
|
-
const o = n.subsidiary.items.map((S) => S.id), m =
|
|
1107
|
+
const o = n.subsidiary.items.map((S) => S.id), m = O({
|
|
1108
1108
|
prefix: x.Enum.sku
|
|
1109
|
-
}), l = (E =
|
|
1109
|
+
}), l = (E = r == null ? void 0 : r.netsuiteCustomAttributes) == null ? void 0 : E.reduce((S, b) => {
|
|
1110
1110
|
const h = b.compute(c);
|
|
1111
1111
|
return {
|
|
1112
1112
|
...S,
|
|
@@ -1123,13 +1123,13 @@ var yt;
|
|
|
1123
1123
|
throw new Error(`Measurement with ID ${S.id} not found in unit ${t._id}. This indicates a data inconsistency. Please investigate.`);
|
|
1124
1124
|
a = b;
|
|
1125
1125
|
}
|
|
1126
|
-
const
|
|
1126
|
+
const I = (_ = r == null ? void 0 : r.overrideAttributes) == null ? void 0 : _.reduce((S, b) => {
|
|
1127
1127
|
const h = b.compute(c);
|
|
1128
1128
|
return {
|
|
1129
1129
|
...S,
|
|
1130
1130
|
[b.fieldId]: h
|
|
1131
1131
|
};
|
|
1132
|
-
}, {}),
|
|
1132
|
+
}, {}), p = {
|
|
1133
1133
|
_id: m,
|
|
1134
1134
|
name: n.itemId,
|
|
1135
1135
|
code: n.id,
|
|
@@ -1139,9 +1139,9 @@ var yt;
|
|
|
1139
1139
|
valuation: null,
|
|
1140
1140
|
isInactive: n.isInactive,
|
|
1141
1141
|
defaultCost: null,
|
|
1142
|
-
...
|
|
1142
|
+
...I,
|
|
1143
1143
|
customAttributes: {
|
|
1144
|
-
...(
|
|
1144
|
+
...(I == null ? void 0 : I.customAttributes) || {},
|
|
1145
1145
|
isFulfillable: n.isFulfillable
|
|
1146
1146
|
}
|
|
1147
1147
|
};
|
|
@@ -1149,7 +1149,7 @@ var yt;
|
|
|
1149
1149
|
businessId: "",
|
|
1150
1150
|
itemType: n.itemType.refName,
|
|
1151
1151
|
itemSubType: n.subtype.refName,
|
|
1152
|
-
skuCache:
|
|
1152
|
+
skuCache: p,
|
|
1153
1153
|
name: n.itemId,
|
|
1154
1154
|
netSuiteId: String(n.internalId || n.id),
|
|
1155
1155
|
unitTypeId: n.unitsType.id,
|
|
@@ -1164,29 +1164,29 @@ var yt;
|
|
|
1164
1164
|
};
|
|
1165
1165
|
}
|
|
1166
1166
|
g(d, "transformAsParent"), u.transformAsParent = d;
|
|
1167
|
-
})(
|
|
1167
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1168
1168
|
})(yt || (yt = {}));
|
|
1169
1169
|
var gt;
|
|
1170
|
-
(function(
|
|
1170
|
+
(function(s) {
|
|
1171
1171
|
(function(u) {
|
|
1172
|
-
function d(
|
|
1172
|
+
function d(r, n) {
|
|
1173
1173
|
var v, U;
|
|
1174
|
-
const { nsInventoryItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } =
|
|
1174
|
+
const { nsInventoryItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } = r;
|
|
1175
1175
|
if (!t.unitsType)
|
|
1176
1176
|
throw new Error(`Missing unit type in NetSuite inventory item ${t.id}`);
|
|
1177
1177
|
if (o.netSuiteId !== t.unitsType.id)
|
|
1178
1178
|
throw new Error(`Unit type mismatch for NetSuite inventory item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
1179
|
-
const f = t.subsidiary.items.map((N) => N.id), a =
|
|
1179
|
+
const f = t.subsidiary.items.map((N) => N.id), a = O({
|
|
1180
1180
|
prefix: x.Enum.sku
|
|
1181
|
-
}),
|
|
1182
|
-
const D = M.compute(
|
|
1181
|
+
}), I = (v = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : v.reduce((N, M) => {
|
|
1182
|
+
const D = M.compute(r);
|
|
1183
1183
|
return {
|
|
1184
1184
|
...N,
|
|
1185
1185
|
[M.fieldId]: D
|
|
1186
1186
|
};
|
|
1187
|
-
}, {}),
|
|
1187
|
+
}, {}), p = t.purchaseUnit === t.baseUnit;
|
|
1188
1188
|
let y = null;
|
|
1189
|
-
if (!
|
|
1189
|
+
if (!p) {
|
|
1190
1190
|
const N = o.measurements.find((D) => D.netSuiteId === t.purchaseUnit);
|
|
1191
1191
|
if (!N)
|
|
1192
1192
|
throw new Error(`Measurement with NetSuite ID ${t.purchaseUnit} not found in unit ${i._id} (NetSuite unit type ${t.unitsType.id}). Please sync unit types before syncing inventory items.`);
|
|
@@ -1196,7 +1196,7 @@ var gt;
|
|
|
1196
1196
|
y = M;
|
|
1197
1197
|
}
|
|
1198
1198
|
const E = (U = n == null ? void 0 : n.overrideAttributes) == null ? void 0 : U.reduce((N, M) => {
|
|
1199
|
-
const D = M.compute(
|
|
1199
|
+
const D = M.compute(r);
|
|
1200
1200
|
return {
|
|
1201
1201
|
...N,
|
|
1202
1202
|
[M.fieldId]: D
|
|
@@ -1240,23 +1240,23 @@ var gt;
|
|
|
1240
1240
|
includeChildren: t.includeChildren,
|
|
1241
1241
|
externalId: t.externalId,
|
|
1242
1242
|
customFields: {
|
|
1243
|
-
...
|
|
1243
|
+
...I
|
|
1244
1244
|
}
|
|
1245
1245
|
};
|
|
1246
1246
|
}
|
|
1247
1247
|
g(d, "transformAsParent"), u.transformAsParent = d;
|
|
1248
|
-
function c(
|
|
1248
|
+
function c(r, n) {
|
|
1249
1249
|
var f;
|
|
1250
|
-
const { nsInventoryItem: t, nsUnitTypeConfig: i } =
|
|
1250
|
+
const { nsInventoryItem: t, nsUnitTypeConfig: i } = r;
|
|
1251
1251
|
if (!t.unitsType)
|
|
1252
1252
|
throw new Error(`Missing unit type in NetSuite inventory child item ${t.id}`);
|
|
1253
1253
|
if (i.netSuiteId !== t.unitsType.id)
|
|
1254
1254
|
throw new Error(`Unit type mismatch for NetSuite inventory child item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${i.netSuiteId}`);
|
|
1255
|
-
const o = t.subsidiary.items.map((a) => a.id), m = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((a,
|
|
1256
|
-
const
|
|
1255
|
+
const o = t.subsidiary.items.map((a) => a.id), m = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((a, I) => {
|
|
1256
|
+
const p = I.compute(r);
|
|
1257
1257
|
return {
|
|
1258
1258
|
...a,
|
|
1259
|
-
[
|
|
1259
|
+
[I.fieldId]: p
|
|
1260
1260
|
};
|
|
1261
1261
|
}, {});
|
|
1262
1262
|
return {
|
|
@@ -1280,10 +1280,10 @@ var gt;
|
|
|
1280
1280
|
};
|
|
1281
1281
|
}
|
|
1282
1282
|
g(c, "transformAsChild"), u.transformAsChild = c;
|
|
1283
|
-
})(
|
|
1283
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1284
1284
|
})(gt || (gt = {}));
|
|
1285
|
-
function Ut(
|
|
1286
|
-
switch (
|
|
1285
|
+
function Ut(s) {
|
|
1286
|
+
switch (s.costingMethod.id) {
|
|
1287
1287
|
case "FIFO":
|
|
1288
1288
|
return Te.Enum.FIFO;
|
|
1289
1289
|
case "LIFO":
|
|
@@ -1293,30 +1293,30 @@ function Ut(r) {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
}
|
|
1295
1295
|
g(Ut, "_getValuation");
|
|
1296
|
-
function it(
|
|
1297
|
-
let c = 0,
|
|
1298
|
-
const n =
|
|
1296
|
+
function it(s, u, d) {
|
|
1297
|
+
let c = 0, r = Ce;
|
|
1298
|
+
const n = s == null ? void 0 : s.find((t) => t.itemid === d && t.hascostline === "T" && t.transactionline === u);
|
|
1299
1299
|
if (n) {
|
|
1300
|
-
const t =
|
|
1301
|
-
t && (c = Number(t.amount), t.isocurrency && (
|
|
1300
|
+
const t = s == null ? void 0 : s.find((i) => i.itemid === d && Number(i.amount) > 0 && i.transactionline === String(Number(n.transactionline) + 1));
|
|
1301
|
+
t && (c = Number(t.amount), t.isocurrency && (r = t.isocurrency));
|
|
1302
1302
|
} else {
|
|
1303
|
-
const t =
|
|
1304
|
-
t && (c = Number(t.amount), t.isocurrency && (
|
|
1303
|
+
const t = s == null ? void 0 : s.find((i) => i.itemid === d);
|
|
1304
|
+
t && (c = Number(t.amount), t.isocurrency && (r = t.isocurrency));
|
|
1305
1305
|
}
|
|
1306
1306
|
return {
|
|
1307
1307
|
cost: c,
|
|
1308
|
-
currency:
|
|
1308
|
+
currency: r
|
|
1309
1309
|
};
|
|
1310
1310
|
}
|
|
1311
1311
|
g(it, "getGLImpactCostMapping");
|
|
1312
|
-
var
|
|
1313
|
-
(function(
|
|
1312
|
+
var ie;
|
|
1313
|
+
(function(s) {
|
|
1314
1314
|
(function(u) {
|
|
1315
1315
|
function d(n) {
|
|
1316
|
-
var
|
|
1316
|
+
var p;
|
|
1317
1317
|
const { poItem: t, nsItemSetting: i, nsUnitTypes: o, overrideCost: m = !0, customAttributes: l } = n;
|
|
1318
1318
|
let f;
|
|
1319
|
-
if (t.totalCost && (m || i.itemType ===
|
|
1319
|
+
if (t.totalCost && (m || i.itemType === R.Enum.Service)) {
|
|
1320
1320
|
const y = A.divide([
|
|
1321
1321
|
t.totalCost,
|
|
1322
1322
|
t.quantity
|
|
@@ -1340,8 +1340,8 @@ var te;
|
|
|
1340
1340
|
break;
|
|
1341
1341
|
}
|
|
1342
1342
|
} else
|
|
1343
|
-
a = (
|
|
1344
|
-
const
|
|
1343
|
+
a = (p = o.find((y) => y.id == t.sku.unit._id)) == null ? void 0 : p.baseUnitUnitOfMeasureId;
|
|
1344
|
+
const I = l == null ? void 0 : l.reduce((y, E) => {
|
|
1345
1345
|
const _ = E.compute(n, E.extraParams);
|
|
1346
1346
|
return {
|
|
1347
1347
|
...y,
|
|
@@ -1358,7 +1358,7 @@ var te;
|
|
|
1358
1358
|
quantity: Number(A.toFormatString({
|
|
1359
1359
|
value: t.quantity
|
|
1360
1360
|
})),
|
|
1361
|
-
...
|
|
1361
|
+
...I
|
|
1362
1362
|
};
|
|
1363
1363
|
}
|
|
1364
1364
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
@@ -1373,20 +1373,20 @@ var te;
|
|
|
1373
1373
|
} = n;
|
|
1374
1374
|
let l;
|
|
1375
1375
|
if (t.measurement) {
|
|
1376
|
-
const
|
|
1377
|
-
for (const
|
|
1378
|
-
for (const y of (
|
|
1379
|
-
if (y.id ===
|
|
1376
|
+
const I = t.measurement.id;
|
|
1377
|
+
for (const p of o)
|
|
1378
|
+
for (const y of (p == null ? void 0 : p.measurements) || [])
|
|
1379
|
+
if (y.id === I) {
|
|
1380
1380
|
l = y.netSuiteId;
|
|
1381
1381
|
break;
|
|
1382
1382
|
}
|
|
1383
1383
|
} else
|
|
1384
|
-
l = (a = o.find((
|
|
1385
|
-
const f = m == null ? void 0 : m.reduce((
|
|
1386
|
-
const y =
|
|
1384
|
+
l = (a = o.find((I) => I.id == t.sku.unit._id)) == null ? void 0 : a.baseUnitUnitOfMeasureId;
|
|
1385
|
+
const f = m == null ? void 0 : m.reduce((I, p) => {
|
|
1386
|
+
const y = p.compute(n, p.extraParams);
|
|
1387
1387
|
return {
|
|
1388
|
-
...
|
|
1389
|
-
[
|
|
1388
|
+
...I,
|
|
1389
|
+
[p.fieldId]: y
|
|
1390
1390
|
};
|
|
1391
1391
|
}, {});
|
|
1392
1392
|
return {
|
|
@@ -1404,7 +1404,7 @@ var te;
|
|
|
1404
1404
|
};
|
|
1405
1405
|
}
|
|
1406
1406
|
g(c, "toTransferOrderItemUpdateDto"), u.toTransferOrderItemUpdateDto = c;
|
|
1407
|
-
function
|
|
1407
|
+
function r(n) {
|
|
1408
1408
|
const {
|
|
1409
1409
|
poItem: t,
|
|
1410
1410
|
nsItemSetting: i,
|
|
@@ -1414,7 +1414,7 @@ var te;
|
|
|
1414
1414
|
nsLocationId: l
|
|
1415
1415
|
} = n;
|
|
1416
1416
|
return {
|
|
1417
|
-
...
|
|
1417
|
+
...s.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
1418
1418
|
poItem: t,
|
|
1419
1419
|
nsItemSetting: i,
|
|
1420
1420
|
nsUnitTypes: o,
|
|
@@ -1426,17 +1426,17 @@ var te;
|
|
|
1426
1426
|
}
|
|
1427
1427
|
};
|
|
1428
1428
|
}
|
|
1429
|
-
g(
|
|
1430
|
-
})(
|
|
1431
|
-
function d(
|
|
1429
|
+
g(r, "toPurchaseOrderItemUpdateDto"), u.toPurchaseOrderItemUpdateDto = r;
|
|
1430
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
1431
|
+
function d(r) {
|
|
1432
1432
|
var y, E, _;
|
|
1433
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency: m } =
|
|
1434
|
-
const h = b.compute(
|
|
1433
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency: m } = r, l = (_ = (E = (y = o == null ? void 0 : o.options) == null ? void 0 : y.purchaseOrderItem) == null ? void 0 : E.customAttributes) == null ? void 0 : _.reduce((S, b) => {
|
|
1434
|
+
const h = b.compute(r, b.extraParams);
|
|
1435
1435
|
return {
|
|
1436
1436
|
...S,
|
|
1437
1437
|
[b.fieldId]: h
|
|
1438
1438
|
};
|
|
1439
|
-
}, {}), f = A.fromNumber(n.quantity), a = n.amount ? A.fromNumber(n.amount) : A.fromNumber(0),
|
|
1439
|
+
}, {}), f = A.fromNumber(n.quantity), a = n.amount ? A.fromNumber(n.amount) : A.fromNumber(0), I = $e.FCurrency.safeParse(m), p = I.success ? I.data : Ce;
|
|
1440
1440
|
return {
|
|
1441
1441
|
id: "",
|
|
1442
1442
|
externalId: String(n.line),
|
|
@@ -1450,33 +1450,33 @@ var te;
|
|
|
1450
1450
|
totalCost: {
|
|
1451
1451
|
amount: a.amount,
|
|
1452
1452
|
precision: a.precision,
|
|
1453
|
-
currency:
|
|
1453
|
+
currency: p
|
|
1454
1454
|
},
|
|
1455
1455
|
measurement: i ?? null,
|
|
1456
1456
|
...l
|
|
1457
1457
|
};
|
|
1458
1458
|
}
|
|
1459
1459
|
g(d, "toPurchaseOrderItem"), u.toPurchaseOrderItem = d;
|
|
1460
|
-
function c(
|
|
1460
|
+
function c(r) {
|
|
1461
1461
|
var _, S, b;
|
|
1462
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost: m } =
|
|
1463
|
-
const v = k.compute(
|
|
1462
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost: m } = r, { cost: l, currency: f } = it(m, String(n.line), n.item.id), a = (b = (S = (_ = o == null ? void 0 : o.options) == null ? void 0 : _.purchaseOrderReceived) == null ? void 0 : S.customAttributes) == null ? void 0 : b.reduce((h, k) => {
|
|
1463
|
+
const v = k.compute(r);
|
|
1464
1464
|
return {
|
|
1465
1465
|
...h,
|
|
1466
1466
|
[k.fieldId]: v
|
|
1467
1467
|
};
|
|
1468
|
-
}, {}),
|
|
1468
|
+
}, {}), I = A.fromNumber(n.quantity), p = A.fromNumber(l), y = $e.FCurrency.safeParse(f), E = y.success ? y.data : Ce;
|
|
1469
1469
|
return {
|
|
1470
1470
|
id: "",
|
|
1471
1471
|
externalId: String(n.orderLine),
|
|
1472
1472
|
sku: t,
|
|
1473
1473
|
amount: {
|
|
1474
|
-
amount:
|
|
1475
|
-
precision:
|
|
1474
|
+
amount: I.amount,
|
|
1475
|
+
precision: I.precision
|
|
1476
1476
|
},
|
|
1477
1477
|
cost: {
|
|
1478
|
-
amount:
|
|
1479
|
-
precision:
|
|
1478
|
+
amount: p.amount,
|
|
1479
|
+
precision: p.precision,
|
|
1480
1480
|
currency: E
|
|
1481
1481
|
},
|
|
1482
1482
|
measurement: i ?? null,
|
|
@@ -1484,10 +1484,10 @@ var te;
|
|
|
1484
1484
|
};
|
|
1485
1485
|
}
|
|
1486
1486
|
g(c, "toPurchaseOrderReceived"), u.toPurchaseOrderReceived = c;
|
|
1487
|
-
}(
|
|
1488
|
-
})(
|
|
1487
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1488
|
+
})(ie || (ie = {}));
|
|
1489
1489
|
var Et;
|
|
1490
|
-
(function(
|
|
1490
|
+
(function(s) {
|
|
1491
1491
|
(function(u) {
|
|
1492
1492
|
function d(c) {
|
|
1493
1493
|
var n;
|
|
@@ -1500,37 +1500,37 @@ var Et;
|
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
1502
|
g(d, "transform"), u.transform = d;
|
|
1503
|
-
})(
|
|
1503
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1504
1504
|
})(Et || (Et = {}));
|
|
1505
1505
|
var Je;
|
|
1506
|
-
(function(
|
|
1506
|
+
(function(s) {
|
|
1507
1507
|
(function(u) {
|
|
1508
|
-
function d(c,
|
|
1508
|
+
function d(c, r, n, t) {
|
|
1509
1509
|
var m;
|
|
1510
1510
|
if (!n.every((l) => l.externalId))
|
|
1511
1511
|
throw new Error("All purchase order items must have externalId");
|
|
1512
|
-
if (c !==
|
|
1512
|
+
if (c !== ne.Enum[1] && !t.items.every((l) => l.id))
|
|
1513
1513
|
throw new Error("All delivery fulfillment items must have id, if not v1");
|
|
1514
|
-
const i = t.items.reduce((l, f) => (c ===
|
|
1514
|
+
const i = t.items.reduce((l, f) => (c === ne.Enum[1] ? l[f.sku._id] = f : l[f.id] = f, l), {}), o = [];
|
|
1515
1515
|
for (const l of n) {
|
|
1516
1516
|
if (((m = l.sku.customAttributes) == null ? void 0 : m.isFulfillable) === !1)
|
|
1517
1517
|
continue;
|
|
1518
|
-
const a = Number(l.externalId),
|
|
1519
|
-
if (!
|
|
1518
|
+
const a = Number(l.externalId), I = r.find((y) => y.line === a);
|
|
1519
|
+
if (!I)
|
|
1520
1520
|
throw new Error(`Invalid line id ${l.externalId}`);
|
|
1521
|
-
let
|
|
1522
|
-
c ===
|
|
1521
|
+
let p;
|
|
1522
|
+
c === ne.Enum[1] ? p = i[l.sku._id] : p = i[l.id], p ? o.push({
|
|
1523
1523
|
item: {
|
|
1524
|
-
id:
|
|
1524
|
+
id: I.item.id
|
|
1525
1525
|
},
|
|
1526
1526
|
itemReceive: !0,
|
|
1527
1527
|
quantity: Number(A.toFormatString({
|
|
1528
|
-
value:
|
|
1528
|
+
value: p.amount
|
|
1529
1529
|
})),
|
|
1530
1530
|
orderLine: a + 1
|
|
1531
1531
|
}) : o.push({
|
|
1532
1532
|
item: {
|
|
1533
|
-
id:
|
|
1533
|
+
id: I.item.id
|
|
1534
1534
|
},
|
|
1535
1535
|
itemReceive: !1,
|
|
1536
1536
|
orderLine: a + 1
|
|
@@ -1544,11 +1544,11 @@ var Je;
|
|
|
1544
1544
|
};
|
|
1545
1545
|
}
|
|
1546
1546
|
g(d, "transformFromTransferOrder"), u.transformFromTransferOrder = d;
|
|
1547
|
-
})(
|
|
1548
|
-
function d(c,
|
|
1547
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
1548
|
+
function d(c, r, n) {
|
|
1549
1549
|
const t = n.item.items.map((o) => {
|
|
1550
|
-
const m =
|
|
1551
|
-
return
|
|
1550
|
+
const m = r[o.line].sku, l = r[o.line].measurement;
|
|
1551
|
+
return ie.FromNetSuite.toPurchaseOrderReceived({
|
|
1552
1552
|
context: c,
|
|
1553
1553
|
glImpactCost: n.glImpacts ?? [],
|
|
1554
1554
|
nsOrderItem: o,
|
|
@@ -1568,29 +1568,29 @@ var Je;
|
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
1570
|
g(d, "transform"), u.transform = d;
|
|
1571
|
-
}(
|
|
1571
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1572
1572
|
})(Je || (Je = {}));
|
|
1573
|
-
function
|
|
1574
|
-
const u =
|
|
1573
|
+
function Re(s) {
|
|
1574
|
+
const u = s.getFullYear(), d = String(s.getMonth() + 1).padStart(2, "0"), c = String(s.getDate()).padStart(2, "0");
|
|
1575
1575
|
return `${u}-${d}-${c}`;
|
|
1576
1576
|
}
|
|
1577
|
-
g(
|
|
1578
|
-
function J(
|
|
1579
|
-
return
|
|
1577
|
+
g(Re, "formatDateYYYYMMDD");
|
|
1578
|
+
function J(s, u) {
|
|
1579
|
+
return s.getDate() === u.getDate() && s.getMonth() === u.getMonth() && s.getFullYear() === u.getFullYear();
|
|
1580
1580
|
}
|
|
1581
1581
|
g(J, "isSameDay");
|
|
1582
1582
|
var je;
|
|
1583
|
-
(function(
|
|
1583
|
+
(function(s) {
|
|
1584
1584
|
(function(u) {
|
|
1585
|
-
function d(c,
|
|
1586
|
-
const o =
|
|
1587
|
-
var
|
|
1588
|
-
let a = f.id ? (
|
|
1585
|
+
function d(c, r, n, t, i) {
|
|
1586
|
+
const o = Re(new Date(t.effectiveAt ?? t.createdAt)), m = c.reduce((f, a) => (a.id && (f[a.id] = a), f), {}), l = t.received.filter((f) => f.sku.isFulfillable !== !1).map((f) => {
|
|
1587
|
+
var I;
|
|
1588
|
+
let a = f.id ? (I = m[f.id]) == null ? void 0 : I.externalId : void 0;
|
|
1589
1589
|
if (a) {
|
|
1590
|
-
const
|
|
1591
|
-
if (!!isNaN(
|
|
1590
|
+
const p = Number(a);
|
|
1591
|
+
if (!!isNaN(p))
|
|
1592
1592
|
throw new Error(`Invalid order line number: ${a} for item ID: ${f.id}`);
|
|
1593
|
-
a = (
|
|
1593
|
+
a = (p + 2).toString();
|
|
1594
1594
|
}
|
|
1595
1595
|
return {
|
|
1596
1596
|
orderLine: a,
|
|
@@ -1602,7 +1602,7 @@ var je;
|
|
|
1602
1602
|
});
|
|
1603
1603
|
return {
|
|
1604
1604
|
trandate: o,
|
|
1605
|
-
transferOrderId:
|
|
1605
|
+
transferOrderId: r,
|
|
1606
1606
|
itemFulfillmentId: n,
|
|
1607
1607
|
items: l,
|
|
1608
1608
|
fields: {
|
|
@@ -1613,16 +1613,16 @@ var je;
|
|
|
1613
1613
|
};
|
|
1614
1614
|
}
|
|
1615
1615
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
1616
|
-
})(
|
|
1617
|
-
function d(c,
|
|
1618
|
-
const i =
|
|
1616
|
+
})(s.ToNetSuiteTransferOrder || (s.ToNetSuiteTransferOrder = {})), function(u) {
|
|
1617
|
+
function d(c, r, n, t) {
|
|
1618
|
+
const i = Re(new Date(n.effectiveAt ?? n.createdAt)), o = c.reduce((l, f) => (f.id && (l[f.id] = f), l), {}), m = n.received.filter((l) => l.sku.isFulfillable !== !1).map((l) => {
|
|
1619
1619
|
var a;
|
|
1620
1620
|
let f = l.id ? (a = o[l.id]) == null ? void 0 : a.externalId : void 0;
|
|
1621
1621
|
if (f) {
|
|
1622
|
-
const
|
|
1623
|
-
if (!!isNaN(
|
|
1622
|
+
const I = Number(f);
|
|
1623
|
+
if (!!isNaN(I))
|
|
1624
1624
|
throw new Error(`Invalid order line number: ${f} for item ID: ${l.id}`);
|
|
1625
|
-
f =
|
|
1625
|
+
f = I.toString();
|
|
1626
1626
|
}
|
|
1627
1627
|
return {
|
|
1628
1628
|
orderLine: f,
|
|
@@ -1634,7 +1634,7 @@ var je;
|
|
|
1634
1634
|
});
|
|
1635
1635
|
return {
|
|
1636
1636
|
trandate: i,
|
|
1637
|
-
purchaseOrderId:
|
|
1637
|
+
purchaseOrderId: r,
|
|
1638
1638
|
items: m,
|
|
1639
1639
|
fields: {
|
|
1640
1640
|
custbody_fm_do_id: n.id || "",
|
|
@@ -1644,12 +1644,12 @@ var je;
|
|
|
1644
1644
|
};
|
|
1645
1645
|
}
|
|
1646
1646
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
1647
|
-
}(
|
|
1648
|
-
function d(c,
|
|
1647
|
+
}(s.ToNetSuitePurchaseOrder || (s.ToNetSuitePurchaseOrder = {})), function(u) {
|
|
1648
|
+
function d(c, r, n) {
|
|
1649
1649
|
var o;
|
|
1650
1650
|
const t = n.item.items.map((m) => {
|
|
1651
|
-
const l =
|
|
1652
|
-
return
|
|
1651
|
+
const l = r[m.line].sku, f = r[m.line].measurement;
|
|
1652
|
+
return ie.FromNetSuite.toPurchaseOrderReceived({
|
|
1653
1653
|
context: c,
|
|
1654
1654
|
glImpactCost: n.glImpacts ?? [],
|
|
1655
1655
|
nsOrderItem: m,
|
|
@@ -1675,30 +1675,30 @@ var je;
|
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
1677
|
g(d, "transform"), u.transform = d;
|
|
1678
|
-
}(
|
|
1678
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1679
1679
|
})(je || (je = {}));
|
|
1680
|
-
function kt(
|
|
1681
|
-
switch (
|
|
1682
|
-
case
|
|
1680
|
+
function kt(s) {
|
|
1681
|
+
switch (F[s.id]) {
|
|
1682
|
+
case ce.enum.A:
|
|
1683
1683
|
return V.Enum.REQUESTING;
|
|
1684
|
-
case
|
|
1685
|
-
case
|
|
1684
|
+
case ce.enum.B:
|
|
1685
|
+
case ce.enum.D:
|
|
1686
1686
|
return V.Enum.PROCESSING;
|
|
1687
|
-
case
|
|
1687
|
+
case ce.enum.C:
|
|
1688
1688
|
return V.Enum.REJECT;
|
|
1689
|
-
case
|
|
1690
|
-
case
|
|
1689
|
+
case ce.enum.E:
|
|
1690
|
+
case ce.enum.F:
|
|
1691
1691
|
return V.Enum.RECEIVING;
|
|
1692
|
-
case
|
|
1692
|
+
case ce.enum.G:
|
|
1693
1693
|
return V.Enum.COMPLETE;
|
|
1694
|
-
case
|
|
1694
|
+
case ce.enum.H:
|
|
1695
1695
|
return V.Enum.CLOSE;
|
|
1696
1696
|
}
|
|
1697
|
-
throw new Error(`Invalid NetSuite Transfer Order status with ${
|
|
1697
|
+
throw new Error(`Invalid NetSuite Transfer Order status with ${s.id}`);
|
|
1698
1698
|
}
|
|
1699
1699
|
g(kt, "validateTransferOrderStatusByKey");
|
|
1700
|
-
function wt(
|
|
1701
|
-
switch (Ne[
|
|
1700
|
+
function wt(s) {
|
|
1701
|
+
switch (Ne[s.id]) {
|
|
1702
1702
|
case X.enum.A:
|
|
1703
1703
|
return V.Enum.PROCESSING;
|
|
1704
1704
|
case X.enum.C:
|
|
@@ -1713,44 +1713,44 @@ function wt(r) {
|
|
|
1713
1713
|
case X.enum.H:
|
|
1714
1714
|
return V.Enum.CLOSE;
|
|
1715
1715
|
}
|
|
1716
|
-
throw new Error(`Invalid NetSuite Purchase Order status with ${
|
|
1716
|
+
throw new Error(`Invalid NetSuite Purchase Order status with ${s.id}`);
|
|
1717
1717
|
}
|
|
1718
1718
|
g(wt, "validatePurchaseOrderStatusByKey");
|
|
1719
|
-
function Ve(
|
|
1720
|
-
const u = Object.keys(
|
|
1719
|
+
function Ve(s) {
|
|
1720
|
+
const u = Object.keys(F).find((d) => F[d] === s);
|
|
1721
1721
|
if (!u)
|
|
1722
|
-
throw new Error(`Invalid transfer order status value: ${
|
|
1722
|
+
throw new Error(`Invalid transfer order status value: ${s}`);
|
|
1723
1723
|
return u;
|
|
1724
1724
|
}
|
|
1725
1725
|
g(Ve, "getTransferOrderStatusEnumKeyByValue");
|
|
1726
|
-
function We(
|
|
1727
|
-
const u = Object.keys(Ne).find((d) => Ne[d] ===
|
|
1726
|
+
function We(s) {
|
|
1727
|
+
const u = Object.keys(Ne).find((d) => Ne[d] === s);
|
|
1728
1728
|
if (!u)
|
|
1729
|
-
throw new Error(`Invalid purchase order status value: ${
|
|
1729
|
+
throw new Error(`Invalid purchase order status value: ${s}`);
|
|
1730
1730
|
return u;
|
|
1731
1731
|
}
|
|
1732
1732
|
g(We, "getPurchaseOrderStatusEnumKeyByValue");
|
|
1733
|
-
function
|
|
1734
|
-
const c = d.filter((a) => a.field === "TRANDOC.KSTATUS"),
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1733
|
+
function Rt(s, u, d) {
|
|
1734
|
+
const c = d.filter((a) => a.field === "TRANDOC.KSTATUS"), r = [
|
|
1735
|
+
F.B,
|
|
1736
|
+
F.D,
|
|
1737
|
+
F.E,
|
|
1738
|
+
F.F,
|
|
1739
|
+
F.G
|
|
1740
1740
|
], n = [
|
|
1741
|
-
|
|
1742
|
-
], t = Object.keys(
|
|
1741
|
+
F.C
|
|
1742
|
+
], t = Object.keys(F).filter((a) => r.includes(F[a])), i = Object.keys(F).filter((a) => n.includes(F[a])), o = c.find((a) => a.status === "Rejected"), m = c.find((a) => a.status === "Pending Fulfillment");
|
|
1743
1743
|
let l = null, f = null;
|
|
1744
|
-
if (m ? l = new Date(m.datetime) : t.includes(u) && (l = new Date(
|
|
1744
|
+
if (m ? l = new Date(m.datetime) : t.includes(u) && (l = new Date(s)), o ? f = new Date(o.datetime) : i.includes(u) && (f = new Date(s)), l && f)
|
|
1745
1745
|
throw new Error("Both processedAt and rejectedAt are set.");
|
|
1746
1746
|
return {
|
|
1747
1747
|
processedAt: l ? l.toISOString() : null,
|
|
1748
1748
|
rejectedAt: f ? f.toISOString() : null
|
|
1749
1749
|
};
|
|
1750
1750
|
}
|
|
1751
|
-
g(
|
|
1752
|
-
function
|
|
1753
|
-
const u =
|
|
1751
|
+
g(Rt, "getPurchaseOrderRequestStatusTimestamp");
|
|
1752
|
+
function Ft(s) {
|
|
1753
|
+
const u = s.shipDate;
|
|
1754
1754
|
if (!u)
|
|
1755
1755
|
return null;
|
|
1756
1756
|
const d = /* @__PURE__ */ new Date();
|
|
@@ -1761,11 +1761,11 @@ function Rt(r) {
|
|
|
1761
1761
|
estimatedTime: new Date(u).toISOString()
|
|
1762
1762
|
};
|
|
1763
1763
|
}
|
|
1764
|
-
g(
|
|
1764
|
+
g(Ft, "transformTransferOrderPreparingShipmentMilestoneFromNetSuite");
|
|
1765
1765
|
var _t;
|
|
1766
|
-
(function(
|
|
1766
|
+
(function(s) {
|
|
1767
1767
|
(function(u) {
|
|
1768
|
-
function d({ setting: n, purchaseOrderRequest: t, status: i =
|
|
1768
|
+
function d({ setting: n, purchaseOrderRequest: t, status: i = ce.enum.A, overrideItemCost: o = !0, customItemAttributes: m, customFields: l }) {
|
|
1769
1769
|
const { purchaseOrder: f } = t;
|
|
1770
1770
|
if (!f)
|
|
1771
1771
|
throw new Error("Purchase order request does not have a purchase order");
|
|
@@ -1773,24 +1773,24 @@ var _t;
|
|
|
1773
1773
|
throw new Error("Purchase order request does not have a NetSuite subsidiary");
|
|
1774
1774
|
const a = f.items.map((y) => {
|
|
1775
1775
|
const E = n.items.find((_) => _.id === y.sku._id);
|
|
1776
|
-
return
|
|
1776
|
+
return ie.ToNetSuite.toCreateDto({
|
|
1777
1777
|
poItem: y,
|
|
1778
1778
|
nsUnitTypes: n.units,
|
|
1779
1779
|
nsItemSetting: E,
|
|
1780
1780
|
overrideCost: o,
|
|
1781
1781
|
customAttributes: m
|
|
1782
1782
|
});
|
|
1783
|
-
}), { netSuiteFromId:
|
|
1783
|
+
}), { netSuiteFromId: I, netSuiteToId: p } = Pt(n.locations, t);
|
|
1784
1784
|
return {
|
|
1785
1785
|
// spread user-supplied custom fields (typed as CF)
|
|
1786
1786
|
...l,
|
|
1787
1787
|
location: {
|
|
1788
1788
|
// from location
|
|
1789
|
-
id:
|
|
1789
|
+
id: I
|
|
1790
1790
|
},
|
|
1791
1791
|
transferLocation: {
|
|
1792
1792
|
// to location
|
|
1793
|
-
id:
|
|
1793
|
+
id: p
|
|
1794
1794
|
},
|
|
1795
1795
|
subsidiary: {
|
|
1796
1796
|
id: t.netSuite.subsidiary.id
|
|
@@ -1807,12 +1807,12 @@ var _t;
|
|
|
1807
1807
|
}
|
|
1808
1808
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
1809
1809
|
function c({ setting: n, purchaseOrder: t, overrideItemCost: i, customItemAttributes: o, includeItems: m = !1, orderStatus: l, customFields: f }) {
|
|
1810
|
-
const a = t.items.map((
|
|
1811
|
-
const
|
|
1812
|
-
return
|
|
1813
|
-
poItem:
|
|
1810
|
+
const a = t.items.map((I) => {
|
|
1811
|
+
const p = n.items.find((y) => y.id === I.sku._id);
|
|
1812
|
+
return ie.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
1813
|
+
poItem: I,
|
|
1814
1814
|
nsUnitTypes: n.units,
|
|
1815
|
-
nsItemSetting:
|
|
1815
|
+
nsItemSetting: p,
|
|
1816
1816
|
overrideCost: i,
|
|
1817
1817
|
customAttributes: o
|
|
1818
1818
|
});
|
|
@@ -1830,7 +1830,7 @@ var _t;
|
|
|
1830
1830
|
};
|
|
1831
1831
|
}
|
|
1832
1832
|
g(c, "toUpdateDto"), u.toUpdateDto = c;
|
|
1833
|
-
function
|
|
1833
|
+
function r(n) {
|
|
1834
1834
|
return {
|
|
1835
1835
|
item: {
|
|
1836
1836
|
items: n.item.items.map((t) => ({
|
|
@@ -1840,11 +1840,11 @@ var _t;
|
|
|
1840
1840
|
}
|
|
1841
1841
|
};
|
|
1842
1842
|
}
|
|
1843
|
-
g(
|
|
1844
|
-
})(
|
|
1845
|
-
function d(
|
|
1846
|
-
var H, he,
|
|
1847
|
-
const { fromLocation: n, toLocation: t, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: m, orderItemMappingByFulfillment: l, nsItemReceipts: f, orderItemMappingByReceipt: a, context:
|
|
1843
|
+
g(r, "toCloseDto"), u.toCloseDto = r;
|
|
1844
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
1845
|
+
function d(r) {
|
|
1846
|
+
var H, he, Oe, at, ut, dt, ct, lt, mt;
|
|
1847
|
+
const { fromLocation: n, toLocation: t, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: m, orderItemMappingByFulfillment: l, nsItemReceipts: f, orderItemMappingByReceipt: a, context: I, nsSystemNotes: p } = r, y = {
|
|
1848
1848
|
_id: n.doc._id,
|
|
1849
1849
|
internal: n.type,
|
|
1850
1850
|
contactName: n.doc.profile.name,
|
|
@@ -1855,13 +1855,13 @@ var _t;
|
|
|
1855
1855
|
address: {
|
|
1856
1856
|
line1: ((H = n.doc.profile.address) == null ? void 0 : H.line1) || "",
|
|
1857
1857
|
line2: (he = n.doc.profile.address) == null ? void 0 : he.line2,
|
|
1858
|
-
state: ((
|
|
1858
|
+
state: ((Oe = n.doc.profile.address) == null ? void 0 : Oe.state) || "",
|
|
1859
1859
|
city: ((at = n.doc.profile.address) == null ? void 0 : at.city) || "",
|
|
1860
1860
|
country: ((ut = n.doc.profile.address) == null ? void 0 : ut.country) || "",
|
|
1861
1861
|
postcode: ((dt = n.doc.profile.address) == null ? void 0 : dt.postcode) || ""
|
|
1862
1862
|
}
|
|
1863
|
-
}, E = (mt = (lt = (ct =
|
|
1864
|
-
const ge = G.compute(
|
|
1863
|
+
}, E = (mt = (lt = (ct = I.options) == null ? void 0 : ct.netSuite) == null ? void 0 : lt.additionalInfo) == null ? void 0 : mt.reduce(($, G) => {
|
|
1864
|
+
const ge = G.compute(r, G.extraParams);
|
|
1865
1865
|
return {
|
|
1866
1866
|
...$,
|
|
1867
1867
|
[G.fieldId]: ge
|
|
@@ -1878,22 +1878,22 @@ var _t;
|
|
|
1878
1878
|
}
|
|
1879
1879
|
}, S = m.map(($) => {
|
|
1880
1880
|
const G = l[$.id];
|
|
1881
|
-
return Je.FromNetSuite.transform(
|
|
1881
|
+
return Je.FromNetSuite.transform(I, G, $);
|
|
1882
1882
|
}), b = f.map(($) => {
|
|
1883
1883
|
const G = a[$.id];
|
|
1884
|
-
return je.FromNetSuite.transform(
|
|
1884
|
+
return je.FromNetSuite.transform(I, G, $);
|
|
1885
1885
|
}), h = i.item.items.map(($) => {
|
|
1886
1886
|
const G = o[$.line].sku, ge = o[$.line].measurement;
|
|
1887
|
-
return
|
|
1887
|
+
return ie.FromNetSuite.toPurchaseOrderItem({
|
|
1888
1888
|
currency: i.currency.refName,
|
|
1889
1889
|
nsOrderItem: $,
|
|
1890
1890
|
sku: G,
|
|
1891
1891
|
glImpactCost: [],
|
|
1892
1892
|
measurement: ge,
|
|
1893
|
-
context:
|
|
1893
|
+
context: I
|
|
1894
1894
|
});
|
|
1895
|
-
}), k = new Date(i.createdDate), [v, U, N] = i.tranDate.split("-"), M = new Date(Number(v), Number(U) - 1, Number(N)), D =
|
|
1896
|
-
_id:
|
|
1895
|
+
}), k = new Date(i.createdDate), [v, U, N] = i.tranDate.split("-"), M = new Date(Number(v), Number(U) - 1, Number(N)), D = Ft(i), q = {
|
|
1896
|
+
_id: O({
|
|
1897
1897
|
prefix: x.Enum.purchaseOrder,
|
|
1898
1898
|
dateTime: k.toISOString()
|
|
1899
1899
|
}),
|
|
@@ -1911,7 +1911,7 @@ var _t;
|
|
|
1911
1911
|
id: i.custbody_fm_po_request_id,
|
|
1912
1912
|
adjustmentIds: []
|
|
1913
1913
|
} : void 0
|
|
1914
|
-
}, { processedAt: me, rejectedAt:
|
|
1914
|
+
}, { processedAt: me, rejectedAt: Pe } = Rt(i.createdDate, i.orderStatus.id, p ?? []), ve = S.reduce(($, G) => {
|
|
1915
1915
|
const ge = new Date(G.createdAt);
|
|
1916
1916
|
return $ ? ge.getTime() < $.getTime() ? ge : $ : ge;
|
|
1917
1917
|
}, null);
|
|
@@ -1928,7 +1928,7 @@ var _t;
|
|
|
1928
1928
|
},
|
|
1929
1929
|
purchaseOrderId: q._id,
|
|
1930
1930
|
processedAt: me || (ve == null ? void 0 : ve.toISOString()) || null,
|
|
1931
|
-
rejectedAt:
|
|
1931
|
+
rejectedAt: Pe,
|
|
1932
1932
|
adjustmentIds: [],
|
|
1933
1933
|
purchaseOrder: q,
|
|
1934
1934
|
// NetSuite
|
|
@@ -1942,14 +1942,14 @@ var _t;
|
|
|
1942
1942
|
function c() {
|
|
1943
1943
|
}
|
|
1944
1944
|
g(c, "convertToV1"), u.convertToV1 = c;
|
|
1945
|
-
}(
|
|
1945
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1946
1946
|
})(_t || (_t = {}));
|
|
1947
|
-
function
|
|
1948
|
-
var
|
|
1949
|
-
const d = (
|
|
1947
|
+
function Pt(s, u) {
|
|
1948
|
+
var r, n;
|
|
1949
|
+
const d = (r = s.find((t) => {
|
|
1950
1950
|
const [i, o] = u.from.dbName.split("_");
|
|
1951
1951
|
return t.id === o && t.type === i;
|
|
1952
|
-
})) == null ? void 0 :
|
|
1952
|
+
})) == null ? void 0 : r.netSuiteId, c = (n = s.find((t) => {
|
|
1953
1953
|
const [i, o] = u.to.dbName.split("_");
|
|
1954
1954
|
return t.id === o && t.type === i;
|
|
1955
1955
|
})) == null ? void 0 : n.netSuiteId;
|
|
@@ -1960,10 +1960,10 @@ function Ot(r, u) {
|
|
|
1960
1960
|
netSuiteToId: c
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
|
-
g(
|
|
1964
|
-
function
|
|
1963
|
+
g(Pt, "locationMapper");
|
|
1964
|
+
function Ot(s) {
|
|
1965
1965
|
let u = null, d = !1, c = !1;
|
|
1966
|
-
for (const t of
|
|
1966
|
+
for (const t of s.item.items) {
|
|
1967
1967
|
const i = t.expectedReceiptDate;
|
|
1968
1968
|
if (!i) {
|
|
1969
1969
|
d = !0;
|
|
@@ -1980,22 +1980,22 @@ function Pt(r) {
|
|
|
1980
1980
|
throw new Error("Inconsistent expected delivery dates found in purchase order items. Some items have null expected delivery dates while others have non-null dates.");
|
|
1981
1981
|
if (!u)
|
|
1982
1982
|
return null;
|
|
1983
|
-
const
|
|
1983
|
+
const r = /* @__PURE__ */ new Date();
|
|
1984
1984
|
return {
|
|
1985
1985
|
type: Ct.Enum.PREPARING,
|
|
1986
1986
|
description: "Expected Delivery Date (Synced from NetSuite)",
|
|
1987
|
-
createdAt:
|
|
1987
|
+
createdAt: r.toISOString(),
|
|
1988
1988
|
estimatedTime: new Date(u).toISOString()
|
|
1989
1989
|
};
|
|
1990
1990
|
}
|
|
1991
|
-
g(
|
|
1991
|
+
g(Ot, "transformPreparingShipmentMilestoneFromNetSuite");
|
|
1992
1992
|
var bt;
|
|
1993
|
-
(function(
|
|
1993
|
+
(function(s) {
|
|
1994
1994
|
(function(u) {
|
|
1995
1995
|
function d({ locationDb: n, setting: t, purchaseOrder: i, status: o = X.enum.A, overrideItemCost: m = !0, customItemAttributes: l, customFields: f }) {
|
|
1996
|
-
const { netSuiteFromId: a, netSuiteToId:
|
|
1996
|
+
const { netSuiteFromId: a, netSuiteToId: I } = Qe(t.locations, t.vendors, n, i.supplier._id), p = i.items.map((y) => {
|
|
1997
1997
|
const E = t.items.find((_) => _.id === y.sku._id);
|
|
1998
|
-
return
|
|
1998
|
+
return ie.ToNetSuite.toCreateDto({
|
|
1999
1999
|
poItem: y,
|
|
2000
2000
|
nsUnitTypes: t.units,
|
|
2001
2001
|
nsItemSetting: E,
|
|
@@ -2003,7 +2003,7 @@ var bt;
|
|
|
2003
2003
|
customAttributes: [
|
|
2004
2004
|
{
|
|
2005
2005
|
fieldId: "location",
|
|
2006
|
-
extraParams:
|
|
2006
|
+
extraParams: I,
|
|
2007
2007
|
compute: /* @__PURE__ */ g((_, S) => ({
|
|
2008
2008
|
id: S
|
|
2009
2009
|
}), "compute")
|
|
@@ -2021,13 +2021,13 @@ var bt;
|
|
|
2021
2021
|
},
|
|
2022
2022
|
location: {
|
|
2023
2023
|
// to location
|
|
2024
|
-
id:
|
|
2024
|
+
id: I
|
|
2025
2025
|
},
|
|
2026
2026
|
subsidiary: {
|
|
2027
2027
|
id: i.netSuite.subsidiary.id
|
|
2028
2028
|
},
|
|
2029
2029
|
item: {
|
|
2030
|
-
items:
|
|
2030
|
+
items: p
|
|
2031
2031
|
},
|
|
2032
2032
|
orderStatus: {
|
|
2033
2033
|
id: We(o)
|
|
@@ -2039,12 +2039,12 @@ var bt;
|
|
|
2039
2039
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
2040
2040
|
function c({ locationDb: n, setting: t, purchaseOrder: i, overrideItemCost: o, customItemAttributes: m, includeItems: l = !1, customFields: f }) {
|
|
2041
2041
|
const { netSuiteToId: a } = Qe(t.locations, t.vendors, n, i.supplier._id);
|
|
2042
|
-
i != null && i.effectiveAt ||
|
|
2043
|
-
const
|
|
2044
|
-
const y = t.items.find((E) => E.id ===
|
|
2045
|
-
return
|
|
2042
|
+
i != null && i.effectiveAt || se(i._id);
|
|
2043
|
+
const I = i.items.map((p) => {
|
|
2044
|
+
const y = t.items.find((E) => E.id === p.sku._id);
|
|
2045
|
+
return ie.ToNetSuite.toPurchaseOrderItemUpdateDto({
|
|
2046
2046
|
nsLocationId: a,
|
|
2047
|
-
poItem:
|
|
2047
|
+
poItem: p,
|
|
2048
2048
|
nsUnitTypes: t.units,
|
|
2049
2049
|
nsItemSetting: y,
|
|
2050
2050
|
overrideCost: o,
|
|
@@ -2054,7 +2054,7 @@ var bt;
|
|
|
2054
2054
|
return {
|
|
2055
2055
|
...f,
|
|
2056
2056
|
item: l ? {
|
|
2057
|
-
items:
|
|
2057
|
+
items: I
|
|
2058
2058
|
} : void 0,
|
|
2059
2059
|
// trandate: formatDateYYYYMMDD(new Date(effectiveAt)),
|
|
2060
2060
|
custbody_fm_po_num: i.seqNumber,
|
|
@@ -2062,33 +2062,33 @@ var bt;
|
|
|
2062
2062
|
};
|
|
2063
2063
|
}
|
|
2064
2064
|
g(c, "toUpdateDto"), u.toUpdateDto = c;
|
|
2065
|
-
function
|
|
2065
|
+
function r() {
|
|
2066
2066
|
return {
|
|
2067
2067
|
orderStatus: {
|
|
2068
2068
|
id: We(X.enum.H)
|
|
2069
2069
|
}
|
|
2070
2070
|
};
|
|
2071
2071
|
}
|
|
2072
|
-
g(
|
|
2073
|
-
})(
|
|
2072
|
+
g(r, "toCloseDto"), u.toCloseDto = r;
|
|
2073
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2074
2074
|
function d(c) {
|
|
2075
|
-
var v, U, N, M, D, q, me,
|
|
2076
|
-
const { vendor:
|
|
2077
|
-
_id:
|
|
2078
|
-
contactName:
|
|
2079
|
-
name:
|
|
2080
|
-
email:
|
|
2081
|
-
phoneNumber:
|
|
2082
|
-
registrationNumber:
|
|
2075
|
+
var v, U, N, M, D, q, me, Pe, ve;
|
|
2076
|
+
const { vendor: r, nsPurchaseOrder: n, orderItemMapping: t, nsItemReceipts: i, orderItemMappingByReceipt: o, context: m } = c, l = {
|
|
2077
|
+
_id: r._id,
|
|
2078
|
+
contactName: r.contactName,
|
|
2079
|
+
name: r.name ?? "",
|
|
2080
|
+
email: r.email,
|
|
2081
|
+
phoneNumber: r.phoneNumber,
|
|
2082
|
+
registrationNumber: r.registrationNumber,
|
|
2083
2083
|
address: {
|
|
2084
|
-
line1: ((v =
|
|
2085
|
-
line2: (U =
|
|
2086
|
-
state: ((N =
|
|
2087
|
-
city: ((M =
|
|
2088
|
-
country: ((D =
|
|
2089
|
-
postcode: ((q =
|
|
2084
|
+
line1: ((v = r.address) == null ? void 0 : v.line1) || "",
|
|
2085
|
+
line2: (U = r.address) == null ? void 0 : U.line2,
|
|
2086
|
+
state: ((N = r.address) == null ? void 0 : N.state) || "",
|
|
2087
|
+
city: ((M = r.address) == null ? void 0 : M.city) || "",
|
|
2088
|
+
country: ((D = r.address) == null ? void 0 : D.country) || "",
|
|
2089
|
+
postcode: ((q = r.address) == null ? void 0 : q.postcode) || ""
|
|
2090
2090
|
}
|
|
2091
|
-
}, f = (ve = (
|
|
2091
|
+
}, f = (ve = (Pe = (me = m.options) == null ? void 0 : me.netSuite) == null ? void 0 : Pe.additionalInfo) == null ? void 0 : ve.reduce((fe, H) => {
|
|
2092
2092
|
const he = H.compute(c, H.extraParams);
|
|
2093
2093
|
return {
|
|
2094
2094
|
...fe,
|
|
@@ -2104,23 +2104,23 @@ var bt;
|
|
|
2104
2104
|
additionalInfo: {
|
|
2105
2105
|
...f
|
|
2106
2106
|
}
|
|
2107
|
-
},
|
|
2107
|
+
}, I = i.map((fe) => {
|
|
2108
2108
|
const H = o[fe.id];
|
|
2109
2109
|
return je.FromNetSuite.transform(m, H, fe);
|
|
2110
|
-
}),
|
|
2111
|
-
const he = t[H.line].sku,
|
|
2112
|
-
return fe.push(
|
|
2110
|
+
}), p = n.item.items.reduce((fe, H) => {
|
|
2111
|
+
const he = t[H.line].sku, Oe = t[H.line].measurement;
|
|
2112
|
+
return fe.push(ie.FromNetSuite.toPurchaseOrderItem({
|
|
2113
2113
|
currency: n.currency.refName,
|
|
2114
2114
|
nsOrderItem: H,
|
|
2115
2115
|
sku: he,
|
|
2116
2116
|
glImpactCost: [],
|
|
2117
|
-
measurement:
|
|
2117
|
+
measurement: Oe,
|
|
2118
2118
|
context: m
|
|
2119
2119
|
})), fe;
|
|
2120
|
-
}, []), y = new Date(n.createdDate), [E, _, S] = n.tranDate.split("-"), b = new Date(Number(E), Number(_) - 1, Number(S)), h =
|
|
2120
|
+
}, []), y = new Date(n.createdDate), [E, _, S] = n.tranDate.split("-"), b = new Date(Number(E), Number(_) - 1, Number(S)), h = Ot(n);
|
|
2121
2121
|
return {
|
|
2122
2122
|
purchaseOrder: {
|
|
2123
|
-
_id:
|
|
2123
|
+
_id: O({
|
|
2124
2124
|
prefix: x.Enum.purchaseOrder,
|
|
2125
2125
|
dateTime: y.toISOString()
|
|
2126
2126
|
}),
|
|
@@ -2128,9 +2128,9 @@ var bt;
|
|
|
2128
2128
|
status: wt(n.orderStatus),
|
|
2129
2129
|
supplier: l,
|
|
2130
2130
|
seqNumber: parseInt(`${n.custbody_fm_po_num ?? "0"}`),
|
|
2131
|
-
items:
|
|
2131
|
+
items: p,
|
|
2132
2132
|
effectiveAt: b.toISOString(),
|
|
2133
|
-
deliveryOrder:
|
|
2133
|
+
deliveryOrder: I,
|
|
2134
2134
|
// NetSuite
|
|
2135
2135
|
netSuite: a
|
|
2136
2136
|
},
|
|
@@ -2138,28 +2138,28 @@ var bt;
|
|
|
2138
2138
|
};
|
|
2139
2139
|
}
|
|
2140
2140
|
g(d, "transform"), u.transform = d;
|
|
2141
|
-
}(
|
|
2141
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2142
2142
|
})(bt || (bt = {}));
|
|
2143
|
-
function Qe(
|
|
2143
|
+
function Qe(s, u, d, c) {
|
|
2144
2144
|
var t, i;
|
|
2145
|
-
const
|
|
2145
|
+
const r = (t = u.find((o) => o.id === c)) == null ? void 0 : t.netSuiteId, n = (i = s.find((o) => {
|
|
2146
2146
|
const [m, l] = d.split("_");
|
|
2147
2147
|
return o.id === l && o.type === m;
|
|
2148
2148
|
})) == null ? void 0 : i.netSuiteId;
|
|
2149
|
-
if (!
|
|
2149
|
+
if (!r || !n || r === n)
|
|
2150
2150
|
throw new Error("Invalid location");
|
|
2151
2151
|
return {
|
|
2152
|
-
netSuiteFromId:
|
|
2152
|
+
netSuiteFromId: r,
|
|
2153
2153
|
netSuiteToId: n
|
|
2154
2154
|
};
|
|
2155
2155
|
}
|
|
2156
2156
|
g(Qe, "locationMapper");
|
|
2157
2157
|
var Ze;
|
|
2158
|
-
(function(
|
|
2158
|
+
(function(s) {
|
|
2159
2159
|
(function(u) {
|
|
2160
2160
|
function d(c) {
|
|
2161
2161
|
const n = {
|
|
2162
|
-
id:
|
|
2162
|
+
id: O({
|
|
2163
2163
|
prefix: x.Enum.measurement
|
|
2164
2164
|
}),
|
|
2165
2165
|
name: c.unitName,
|
|
@@ -2178,20 +2178,20 @@ var Ze;
|
|
|
2178
2178
|
};
|
|
2179
2179
|
}
|
|
2180
2180
|
g(d, "transform"), u.transform = d;
|
|
2181
|
-
})(
|
|
2181
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2182
2182
|
})(Ze || (Ze = {}));
|
|
2183
2183
|
var St;
|
|
2184
|
-
(function(
|
|
2184
|
+
(function(s) {
|
|
2185
2185
|
(function(u) {
|
|
2186
|
-
function d(c,
|
|
2187
|
-
let n = c.uom.items, t =
|
|
2186
|
+
function d(c, r) {
|
|
2187
|
+
let n = c.uom.items, t = O({
|
|
2188
2188
|
prefix: x.Enum.unit
|
|
2189
2189
|
});
|
|
2190
2190
|
const i = {
|
|
2191
2191
|
_id: t,
|
|
2192
2192
|
name: c.name,
|
|
2193
2193
|
abbrev: c.name,
|
|
2194
|
-
precision: (
|
|
2194
|
+
precision: (r == null ? void 0 : r.precision) ?? 0,
|
|
2195
2195
|
measurements: []
|
|
2196
2196
|
};
|
|
2197
2197
|
let o;
|
|
@@ -2201,8 +2201,8 @@ var St;
|
|
|
2201
2201
|
i.name = `${c.name} (${a.unitName})`, i.abbrev = a.abbreviation, o = String(a.internalId);
|
|
2202
2202
|
continue;
|
|
2203
2203
|
}
|
|
2204
|
-
const
|
|
2205
|
-
l.push(
|
|
2204
|
+
const I = Ze.FromNetsuite.transform(a);
|
|
2205
|
+
l.push(I), m.push(I.nsConfig);
|
|
2206
2206
|
}
|
|
2207
2207
|
if (i.measurements = l, o === void 0)
|
|
2208
2208
|
throw new Error("Base unit not found");
|
|
@@ -2219,39 +2219,39 @@ var St;
|
|
|
2219
2219
|
};
|
|
2220
2220
|
}
|
|
2221
2221
|
g(d, "transform"), u.transform = d;
|
|
2222
|
-
})(
|
|
2222
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2223
2223
|
})(St || (St = {}));
|
|
2224
|
-
function An(
|
|
2224
|
+
function An(s, u) {
|
|
2225
2225
|
let d;
|
|
2226
2226
|
const c = [];
|
|
2227
|
-
for (const
|
|
2228
|
-
const n =
|
|
2227
|
+
for (const r of u.measurements) {
|
|
2228
|
+
const n = s.measurements.find((t) => t.id === r.id);
|
|
2229
2229
|
n && c.push({
|
|
2230
|
-
...
|
|
2230
|
+
...r,
|
|
2231
2231
|
nsConfig: n
|
|
2232
2232
|
});
|
|
2233
2233
|
}
|
|
2234
2234
|
return d = {
|
|
2235
2235
|
...u,
|
|
2236
|
-
nsConfig:
|
|
2236
|
+
nsConfig: s,
|
|
2237
2237
|
measurements: c
|
|
2238
2238
|
}, d;
|
|
2239
2239
|
}
|
|
2240
2240
|
g(An, "convertToUnitWithNsConfig");
|
|
2241
2241
|
var vt;
|
|
2242
|
-
(function(
|
|
2242
|
+
(function(s) {
|
|
2243
2243
|
(function(u) {
|
|
2244
2244
|
function d(c) {
|
|
2245
|
-
const
|
|
2245
|
+
const r = c.addressBook.items.find((o) => o.defaultBilling), n = O({
|
|
2246
2246
|
prefix: x.Enum.supplier
|
|
2247
2247
|
}), t = {
|
|
2248
2248
|
_id: n,
|
|
2249
2249
|
name: c.companyName,
|
|
2250
2250
|
email: c.email,
|
|
2251
|
-
contactName: (
|
|
2251
|
+
contactName: (r == null ? void 0 : r.addressBookAddress.attention) || (r == null ? void 0 : r.addressBookAddress.addressee),
|
|
2252
2252
|
phoneNumber: c.phone,
|
|
2253
2253
|
registrationNumber: "",
|
|
2254
|
-
address: xt(
|
|
2254
|
+
address: xt(r)
|
|
2255
2255
|
}, i = {
|
|
2256
2256
|
id: n,
|
|
2257
2257
|
netSuiteId: c.id,
|
|
@@ -2264,9 +2264,9 @@ var vt;
|
|
|
2264
2264
|
};
|
|
2265
2265
|
}
|
|
2266
2266
|
g(d, "transform"), u.transform = d;
|
|
2267
|
-
})(
|
|
2267
|
+
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2268
2268
|
})(vt || (vt = {}));
|
|
2269
|
-
function xt(
|
|
2269
|
+
function xt(s) {
|
|
2270
2270
|
let u = {
|
|
2271
2271
|
line1: "",
|
|
2272
2272
|
state: "",
|
|
@@ -2274,26 +2274,26 @@ function xt(r) {
|
|
|
2274
2274
|
postcode: "",
|
|
2275
2275
|
country: ""
|
|
2276
2276
|
};
|
|
2277
|
-
return
|
|
2277
|
+
return s && (u = {
|
|
2278
2278
|
...u,
|
|
2279
|
-
line1:
|
|
2280
|
-
line2:
|
|
2281
|
-
state:
|
|
2282
|
-
city:
|
|
2283
|
-
postcode:
|
|
2284
|
-
country:
|
|
2279
|
+
line1: s.addressBookAddress.addr1 ?? "",
|
|
2280
|
+
line2: s.addressBookAddress.addr2,
|
|
2281
|
+
state: s.addressBookAddress.state ?? "",
|
|
2282
|
+
city: s.addressBookAddress.city ?? "",
|
|
2283
|
+
postcode: s.addressBookAddress.zip ?? "",
|
|
2284
|
+
country: s.addressBookAddress.country.refName
|
|
2285
2285
|
}), u;
|
|
2286
2286
|
}
|
|
2287
2287
|
g(xt, "_transfromToSupplierAddress");
|
|
2288
|
-
function
|
|
2289
|
-
const d = {}, c = /* @__PURE__ */ new Set(),
|
|
2288
|
+
function rt(s, u) {
|
|
2289
|
+
const d = {}, c = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
2290
2290
|
for (const t of u) {
|
|
2291
2291
|
let { externalId: i, id: o } = t;
|
|
2292
2292
|
if (i) {
|
|
2293
2293
|
if (c.has(i))
|
|
2294
2294
|
throw new Error(`Duplicate externalId found in poItems: ${i}`);
|
|
2295
|
-
if (c.add(i), !o ||
|
|
2296
|
-
if (o || console.warn(`Missing id found in poItems for externalId: ${i}, generating a new id.`), o &&
|
|
2295
|
+
if (c.add(i), !o || r.has(o)) {
|
|
2296
|
+
if (o || console.warn(`Missing id found in poItems for externalId: ${i}, generating a new id.`), o && r.has(o)) {
|
|
2297
2297
|
let m;
|
|
2298
2298
|
Object.entries(d).forEach(([l, f]) => {
|
|
2299
2299
|
f === o && (m = l);
|
|
@@ -2301,70 +2301,70 @@ function st(r, u) {
|
|
|
2301
2301
|
}
|
|
2302
2302
|
o = crypto.randomUUID();
|
|
2303
2303
|
}
|
|
2304
|
-
|
|
2304
|
+
r.add(o), d[i] = o;
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
2307
|
const n = {};
|
|
2308
|
-
for (const t of
|
|
2308
|
+
for (const t of s) {
|
|
2309
2309
|
const i = t.transferorderitemlineid || t.lineid, o = d[i];
|
|
2310
2310
|
o && (n[t.lineid] = o);
|
|
2311
2311
|
}
|
|
2312
2312
|
return n;
|
|
2313
2313
|
}
|
|
2314
|
-
g(
|
|
2315
|
-
function Mn(
|
|
2314
|
+
g(rt, "mapOrderLineId");
|
|
2315
|
+
function Mn(s, u, d, c, r) {
|
|
2316
2316
|
var l, f;
|
|
2317
|
-
const n = d.some((a) => a.id), t =
|
|
2318
|
-
...
|
|
2317
|
+
const n = d.some((a) => a.id), t = rt(u, d), i = [], o = c, m = [
|
|
2318
|
+
...r || []
|
|
2319
2319
|
];
|
|
2320
2320
|
for (const a of d) {
|
|
2321
|
-
const
|
|
2321
|
+
const I = n && a.externalId ? t[a.externalId] : "";
|
|
2322
2322
|
i.push({
|
|
2323
2323
|
...a,
|
|
2324
|
-
id:
|
|
2324
|
+
id: I
|
|
2325
2325
|
});
|
|
2326
2326
|
}
|
|
2327
2327
|
for (let a = 0; a < o.length; a++) {
|
|
2328
|
-
const
|
|
2329
|
-
for (const y of
|
|
2328
|
+
const I = o[a], p = [];
|
|
2329
|
+
for (const y of I.received) {
|
|
2330
2330
|
const E = y.externalId;
|
|
2331
2331
|
if (!E) {
|
|
2332
|
-
|
|
2332
|
+
p.push(y);
|
|
2333
2333
|
continue;
|
|
2334
2334
|
}
|
|
2335
2335
|
const _ = (l = u.find((h) => h.lineid === E)) == null ? void 0 : l.transferorderitemlineid, S = n && _ ? t[_] : void 0, b = {
|
|
2336
2336
|
...y,
|
|
2337
2337
|
id: S
|
|
2338
2338
|
};
|
|
2339
|
-
if (
|
|
2339
|
+
if (s === ne.Enum[2] && (!S || S === ""))
|
|
2340
2340
|
throw new Error(`Cannot find mapped item ID for external line id ${E} in delivery order`);
|
|
2341
|
-
|
|
2341
|
+
p.push(b);
|
|
2342
2342
|
}
|
|
2343
2343
|
o[a] = {
|
|
2344
|
-
...
|
|
2345
|
-
received:
|
|
2344
|
+
...I,
|
|
2345
|
+
received: p
|
|
2346
2346
|
};
|
|
2347
2347
|
}
|
|
2348
2348
|
if (m)
|
|
2349
2349
|
for (let a = 0; a < m.length; a++) {
|
|
2350
|
-
const
|
|
2351
|
-
for (const y of
|
|
2350
|
+
const I = m[a], p = [];
|
|
2351
|
+
for (const y of I.items) {
|
|
2352
2352
|
const E = y.externalId;
|
|
2353
2353
|
if (!E) {
|
|
2354
|
-
|
|
2354
|
+
p.push(y);
|
|
2355
2355
|
continue;
|
|
2356
2356
|
}
|
|
2357
2357
|
const _ = (f = u.find((h) => h.lineid === E)) == null ? void 0 : f.transferorderitemlineid, S = n && _ ? t[_] : y.id, b = {
|
|
2358
2358
|
...y,
|
|
2359
2359
|
id: S
|
|
2360
2360
|
};
|
|
2361
|
-
if (
|
|
2361
|
+
if (s === ne.Enum[2] && (!S || S === ""))
|
|
2362
2362
|
throw new Error(`Cannot find mapped item ID for order external id ${E} in delivery fulfillment`);
|
|
2363
|
-
|
|
2363
|
+
p.push(b);
|
|
2364
2364
|
}
|
|
2365
2365
|
m[a] = {
|
|
2366
|
-
...
|
|
2367
|
-
items:
|
|
2366
|
+
...I,
|
|
2367
|
+
items: p
|
|
2368
2368
|
};
|
|
2369
2369
|
}
|
|
2370
2370
|
return {
|
|
@@ -2374,10 +2374,10 @@ function Mn(r, u, d, c, s) {
|
|
|
2374
2374
|
};
|
|
2375
2375
|
}
|
|
2376
2376
|
g(Mn, "alignItemLineIdsAcrossDocuments");
|
|
2377
|
-
function Un(
|
|
2378
|
-
const c = u.some((i) => i.id),
|
|
2377
|
+
function Un(s, u, d) {
|
|
2378
|
+
const c = u.some((i) => i.id), r = rt(s, u), n = [], t = d;
|
|
2379
2379
|
for (const i of u) {
|
|
2380
|
-
const o = c && i.externalId ?
|
|
2380
|
+
const o = c && i.externalId ? r[i.externalId] : "";
|
|
2381
2381
|
n.push({
|
|
2382
2382
|
...i,
|
|
2383
2383
|
id: o
|
|
@@ -2386,7 +2386,7 @@ function Un(r, u, d) {
|
|
|
2386
2386
|
for (let i = 0; i < t.length; i++) {
|
|
2387
2387
|
const o = t[i], m = [];
|
|
2388
2388
|
for (const l of o.received) {
|
|
2389
|
-
const f = l.externalId, a = u.find((
|
|
2389
|
+
const f = l.externalId, a = u.find((I) => I.externalId === f).id;
|
|
2390
2390
|
m.push({
|
|
2391
2391
|
...l,
|
|
2392
2392
|
id: a
|
|
@@ -2403,11 +2403,11 @@ function Un(r, u, d) {
|
|
|
2403
2403
|
};
|
|
2404
2404
|
}
|
|
2405
2405
|
g(Un, "alignInventoryTransferItemLineIds");
|
|
2406
|
-
var
|
|
2407
|
-
(function(
|
|
2406
|
+
var le;
|
|
2407
|
+
(function(s) {
|
|
2408
2408
|
(function(u) {
|
|
2409
|
-
function d(
|
|
2410
|
-
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } =
|
|
2409
|
+
function d(r) {
|
|
2410
|
+
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } = r;
|
|
2411
2411
|
let o;
|
|
2412
2412
|
if (n.measurement) {
|
|
2413
2413
|
const m = n.measurement.id;
|
|
@@ -2430,8 +2430,8 @@ var de;
|
|
|
2430
2430
|
};
|
|
2431
2431
|
}
|
|
2432
2432
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
2433
|
-
function c(
|
|
2434
|
-
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } =
|
|
2433
|
+
function c(r) {
|
|
2434
|
+
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } = r;
|
|
2435
2435
|
let o;
|
|
2436
2436
|
if (n.measurement) {
|
|
2437
2437
|
const m = n.measurement.id;
|
|
@@ -2454,12 +2454,12 @@ var de;
|
|
|
2454
2454
|
};
|
|
2455
2455
|
}
|
|
2456
2456
|
g(c, "fromDeliveryOrderToCreateDto"), u.fromDeliveryOrderToCreateDto = c;
|
|
2457
|
-
})(
|
|
2458
|
-
function d(
|
|
2459
|
-
const { cost: o, currency: m } = it(n, String(
|
|
2457
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2458
|
+
function d(r, n, t, i) {
|
|
2459
|
+
const { cost: o, currency: m } = it(n, String(r.line), r.item.id), l = A.fromNumber(r.adjustQtyBy), f = A.fromNumber(o), a = $e.FCurrency.safeParse(m), I = a.success ? a.data : Ce;
|
|
2460
2460
|
return {
|
|
2461
2461
|
id: "",
|
|
2462
|
-
externalId: String(
|
|
2462
|
+
externalId: String(r.line),
|
|
2463
2463
|
sku: t,
|
|
2464
2464
|
amount: {
|
|
2465
2465
|
amount: l.amount,
|
|
@@ -2468,17 +2468,17 @@ var de;
|
|
|
2468
2468
|
cost: {
|
|
2469
2469
|
amount: f.amount,
|
|
2470
2470
|
precision: f.precision,
|
|
2471
|
-
currency:
|
|
2471
|
+
currency: I
|
|
2472
2472
|
},
|
|
2473
2473
|
measurement: i ?? null
|
|
2474
2474
|
};
|
|
2475
2475
|
}
|
|
2476
2476
|
g(d, "toPurchaseOrderReceived"), u.toPurchaseOrderReceived = d;
|
|
2477
|
-
function c(
|
|
2478
|
-
const i = A.fromNumber(
|
|
2477
|
+
function c(r, n, t) {
|
|
2478
|
+
const i = A.fromNumber(r.adjustQtyBy), o = A.fromNumber(0);
|
|
2479
2479
|
return {
|
|
2480
2480
|
id: "",
|
|
2481
|
-
externalId: String(
|
|
2481
|
+
externalId: String(r.line),
|
|
2482
2482
|
sku: n,
|
|
2483
2483
|
code: n.code,
|
|
2484
2484
|
name: n.name,
|
|
@@ -2495,16 +2495,16 @@ var de;
|
|
|
2495
2495
|
};
|
|
2496
2496
|
}
|
|
2497
2497
|
g(c, "toPurchaseOrderItem"), u.toPurchaseOrderItem = c;
|
|
2498
|
-
}(
|
|
2499
|
-
})(
|
|
2498
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2499
|
+
})(le || (le = {}));
|
|
2500
2500
|
var ht;
|
|
2501
|
-
(function(
|
|
2501
|
+
(function(s) {
|
|
2502
2502
|
(function(u) {
|
|
2503
2503
|
function d(n) {
|
|
2504
|
-
const { setting: t, sourceLocationId: i, destinationLocationId: o, subsidiaryId: m, effectiveAt: l, orderItems: f, newAdjustmentId: a } = n,
|
|
2505
|
-
const y = t.items.find((E) => E.id ===
|
|
2506
|
-
return
|
|
2507
|
-
orderItem:
|
|
2504
|
+
const { setting: t, sourceLocationId: i, destinationLocationId: o, subsidiaryId: m, effectiveAt: l, orderItems: f, newAdjustmentId: a } = n, I = f.map((p) => {
|
|
2505
|
+
const y = t.items.find((E) => E.id === p.sku._id);
|
|
2506
|
+
return le.ToNetSuite.toCreateDto({
|
|
2507
|
+
orderItem: p,
|
|
2508
2508
|
nsUnitTypes: t.units,
|
|
2509
2509
|
nsItemSetting: y
|
|
2510
2510
|
});
|
|
@@ -2520,9 +2520,9 @@ var ht;
|
|
|
2520
2520
|
id: m
|
|
2521
2521
|
},
|
|
2522
2522
|
inventory: {
|
|
2523
|
-
items:
|
|
2523
|
+
items: I
|
|
2524
2524
|
},
|
|
2525
|
-
tranDate:
|
|
2525
|
+
tranDate: Re(new Date(l)),
|
|
2526
2526
|
custbody_fm_adjustment_id: a
|
|
2527
2527
|
};
|
|
2528
2528
|
}
|
|
@@ -2535,10 +2535,10 @@ var ht;
|
|
|
2535
2535
|
};
|
|
2536
2536
|
}
|
|
2537
2537
|
g(c, "toUpdateDto"), u.toUpdateDto = c;
|
|
2538
|
-
function
|
|
2539
|
-
const { setting: t, purchaseOrder: i, sourceLocationId: o, destinationLocationId: m, subsidiaryId: l, effectiveAt: f, orderItems: a, deliveryOrderId:
|
|
2538
|
+
function r(n) {
|
|
2539
|
+
const { setting: t, purchaseOrder: i, sourceLocationId: o, destinationLocationId: m, subsidiaryId: l, effectiveAt: f, orderItems: a, deliveryOrderId: I } = n, p = a.map((y) => {
|
|
2540
2540
|
const E = t.items.find((_) => _.id === y.sku._id);
|
|
2541
|
-
return
|
|
2541
|
+
return le.ToNetSuite.fromDeliveryOrderToCreateDto({
|
|
2542
2542
|
orderItem: y,
|
|
2543
2543
|
nsUnitTypes: t.units,
|
|
2544
2544
|
nsItemSetting: E
|
|
@@ -2555,17 +2555,17 @@ var ht;
|
|
|
2555
2555
|
id: l
|
|
2556
2556
|
},
|
|
2557
2557
|
inventory: {
|
|
2558
|
-
items:
|
|
2558
|
+
items: p
|
|
2559
2559
|
},
|
|
2560
|
-
tranDate:
|
|
2560
|
+
tranDate: Re(new Date(f)),
|
|
2561
2561
|
custbody_fm_po_id: i._id,
|
|
2562
|
-
custbody_fm_do_id:
|
|
2562
|
+
custbody_fm_do_id: I
|
|
2563
2563
|
};
|
|
2564
2564
|
}
|
|
2565
|
-
g(
|
|
2566
|
-
})(
|
|
2565
|
+
g(r, "fromDeliveryOrderToCreateDto"), u.fromDeliveryOrderToCreateDto = r;
|
|
2566
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2567
2567
|
function d(n) {
|
|
2568
|
-
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [m, l, f] = t.tranDate.split("-"), a = new Date(Number(m), Number(l) - 1, Number(f)),
|
|
2568
|
+
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [m, l, f] = t.tranDate.split("-"), a = new Date(Number(m), Number(l) - 1, Number(f)), I = {
|
|
2569
2569
|
_id: "",
|
|
2570
2570
|
name: t.location.refName,
|
|
2571
2571
|
internal: Ke.Enum.restaurant,
|
|
@@ -2576,14 +2576,14 @@ var ht;
|
|
|
2576
2576
|
country: "",
|
|
2577
2577
|
postcode: ""
|
|
2578
2578
|
}
|
|
2579
|
-
},
|
|
2579
|
+
}, p = {
|
|
2580
2580
|
id: t.id,
|
|
2581
2581
|
refNo: t.tranId,
|
|
2582
2582
|
recordType: ke.Enum.inventoryTransfer
|
|
2583
2583
|
}, E = {
|
|
2584
2584
|
received: t.inventory.items.map((b) => {
|
|
2585
2585
|
const h = i[b.line].sku, k = i[b.line].measurement;
|
|
2586
|
-
return
|
|
2586
|
+
return le.FromNetSuite.toPurchaseOrderReceived(b, t.glImpacts ?? [], h, k);
|
|
2587
2587
|
}),
|
|
2588
2588
|
createdBy: {
|
|
2589
2589
|
name: "",
|
|
@@ -2591,21 +2591,21 @@ var ht;
|
|
|
2591
2591
|
},
|
|
2592
2592
|
createdAt: o.toISOString(),
|
|
2593
2593
|
deliveryOrderNumber: "",
|
|
2594
|
-
netSuite:
|
|
2594
|
+
netSuite: p,
|
|
2595
2595
|
effectiveAt: a.toISOString()
|
|
2596
2596
|
}, _ = t.inventory.items.map((b) => {
|
|
2597
2597
|
const h = i[b.line].sku, k = i[b.line].measurement;
|
|
2598
|
-
return
|
|
2598
|
+
return le.FromNetSuite.toPurchaseOrderItem(b, h, k);
|
|
2599
2599
|
});
|
|
2600
2600
|
return {
|
|
2601
|
-
_id:
|
|
2601
|
+
_id: O({
|
|
2602
2602
|
prefix: x.Enum.purchaseOrder,
|
|
2603
2603
|
dateTime: o.toISOString()
|
|
2604
2604
|
}),
|
|
2605
2605
|
version: "2",
|
|
2606
2606
|
effectiveAt: a.toISOString(),
|
|
2607
2607
|
status: V.Enum.COMPLETE,
|
|
2608
|
-
supplier:
|
|
2608
|
+
supplier: I,
|
|
2609
2609
|
seqNumber: t.custbody_fm_po_num ?? 0,
|
|
2610
2610
|
items: _,
|
|
2611
2611
|
deliveryOrder: [
|
|
@@ -2615,13 +2615,13 @@ var ht;
|
|
|
2615
2615
|
id: t.custbody_fm_po_request_id,
|
|
2616
2616
|
adjustmentIds: []
|
|
2617
2617
|
} : void 0,
|
|
2618
|
-
netSuite:
|
|
2618
|
+
netSuite: p
|
|
2619
2619
|
};
|
|
2620
2620
|
}
|
|
2621
2621
|
g(d, "transformTransferIn"), u.transformTransferIn = d;
|
|
2622
2622
|
function c(n) {
|
|
2623
2623
|
var h, k, v, U, N, M;
|
|
2624
|
-
const { sourceLocation: t, nsInventoryTransfer: i, transferItemMapping: o } = n, m = new Date(i.createdDate), [l, f, a] = i.tranDate.split("-"),
|
|
2624
|
+
const { sourceLocation: t, nsInventoryTransfer: i, transferItemMapping: o } = n, m = new Date(i.createdDate), [l, f, a] = i.tranDate.split("-"), I = new Date(Number(l), Number(f) - 1, Number(a)), p = {
|
|
2625
2625
|
_id: t.doc._id,
|
|
2626
2626
|
internal: t.type,
|
|
2627
2627
|
contactName: t.doc.profile.name,
|
|
@@ -2648,7 +2648,7 @@ var ht;
|
|
|
2648
2648
|
}, _ = {
|
|
2649
2649
|
received: i.inventory.items.map((D) => {
|
|
2650
2650
|
const q = o[D.line].sku, me = o[D.line].measurement;
|
|
2651
|
-
return
|
|
2651
|
+
return le.FromNetSuite.toPurchaseOrderReceived(D, i.glImpacts ?? [], q, me);
|
|
2652
2652
|
}),
|
|
2653
2653
|
createdBy: {
|
|
2654
2654
|
name: "",
|
|
@@ -2657,20 +2657,20 @@ var ht;
|
|
|
2657
2657
|
createdAt: m.toISOString(),
|
|
2658
2658
|
deliveryOrderNumber: "",
|
|
2659
2659
|
netSuite: y,
|
|
2660
|
-
effectiveAt:
|
|
2660
|
+
effectiveAt: I.toISOString()
|
|
2661
2661
|
}, S = i.inventory.items.map((D) => {
|
|
2662
2662
|
const q = o[D.line].sku, me = o[D.line].measurement;
|
|
2663
|
-
return
|
|
2663
|
+
return le.FromNetSuite.toPurchaseOrderItem(D, q, me);
|
|
2664
2664
|
});
|
|
2665
2665
|
return {
|
|
2666
|
-
_id:
|
|
2666
|
+
_id: O({
|
|
2667
2667
|
prefix: x.Enum.purchaseOrder,
|
|
2668
2668
|
dateTime: m.toISOString()
|
|
2669
2669
|
}),
|
|
2670
2670
|
version: "2",
|
|
2671
|
-
effectiveAt:
|
|
2671
|
+
effectiveAt: I.toISOString(),
|
|
2672
2672
|
status: V.Enum.COMPLETE,
|
|
2673
|
-
supplier:
|
|
2673
|
+
supplier: p,
|
|
2674
2674
|
seqNumber: i.custbody_fm_po_num ?? 0,
|
|
2675
2675
|
items: S,
|
|
2676
2676
|
deliveryOrder: [
|
|
@@ -2684,12 +2684,12 @@ var ht;
|
|
|
2684
2684
|
};
|
|
2685
2685
|
}
|
|
2686
2686
|
g(c, "transformTransferOut"), u.transformTransferOut = c;
|
|
2687
|
-
function
|
|
2687
|
+
function r(n) {
|
|
2688
2688
|
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [m, l, f] = t.tranDate.split("-"), a = new Date(Number(m), Number(l) - 1, Number(f));
|
|
2689
2689
|
return {
|
|
2690
|
-
received: t.inventory.items.map((
|
|
2691
|
-
const y = i[
|
|
2692
|
-
return
|
|
2690
|
+
received: t.inventory.items.map((p) => {
|
|
2691
|
+
const y = i[p.line].sku, E = i[p.line].measurement;
|
|
2692
|
+
return le.FromNetSuite.toPurchaseOrderReceived(p, t.glImpacts ?? [], y, E);
|
|
2693
2693
|
}),
|
|
2694
2694
|
createdBy: {
|
|
2695
2695
|
name: "",
|
|
@@ -2705,34 +2705,34 @@ var ht;
|
|
|
2705
2705
|
effectiveAt: a.toISOString()
|
|
2706
2706
|
};
|
|
2707
2707
|
}
|
|
2708
|
-
g(
|
|
2709
|
-
}(
|
|
2708
|
+
g(r, "transformToDeliveryOrder"), u.transformToDeliveryOrder = r;
|
|
2709
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2710
2710
|
})(ht || (ht = {}));
|
|
2711
|
-
function Ee(
|
|
2712
|
-
const
|
|
2711
|
+
function Ee(s, u, d, c) {
|
|
2712
|
+
const r = {};
|
|
2713
2713
|
return c.forEach((n) => {
|
|
2714
|
-
|
|
2715
|
-
}),
|
|
2714
|
+
r[n.line] = Lt(s, u, d, n.item.id, n.units);
|
|
2715
|
+
}), r;
|
|
2716
2716
|
}
|
|
2717
2717
|
g(Ee, "validateOrderItems");
|
|
2718
|
-
function Lt(
|
|
2718
|
+
function Lt(s, u, d, c, r) {
|
|
2719
2719
|
const n = d.items.find((f) => f.netSuiteId === c);
|
|
2720
2720
|
if (!n)
|
|
2721
2721
|
throw new Error(`SKU with ID ${c} not found in settings`);
|
|
2722
|
-
const t =
|
|
2722
|
+
const t = s.find((f) => f._id === n.id);
|
|
2723
2723
|
if (!t)
|
|
2724
2724
|
throw new Error(`SKU with ID ${n.id} not matched`);
|
|
2725
2725
|
const i = d.units.find((f) => f.netSuiteId === n.unitTypeId);
|
|
2726
2726
|
if (!i)
|
|
2727
2727
|
throw new Error(`Unit with ID ${n.unitTypeId} not found in settings`);
|
|
2728
|
-
const o =
|
|
2728
|
+
const o = r == (i == null ? void 0 : i.baseUnitUnitOfMeasureId), m = u.find((f) => f._id === i.id);
|
|
2729
2729
|
if (!m)
|
|
2730
2730
|
throw new Error(`Unit with ID ${n.unitTypeId} not matched`);
|
|
2731
2731
|
let l;
|
|
2732
2732
|
if (!o) {
|
|
2733
|
-
const f = i.measurements.find((a) => a.netSuiteId ===
|
|
2733
|
+
const f = i.measurements.find((a) => a.netSuiteId === r);
|
|
2734
2734
|
if (!f)
|
|
2735
|
-
throw new Error(`Measurement with ID ${
|
|
2735
|
+
throw new Error(`Measurement with ID ${r} not found in unit "${i == null ? void 0 : i.id}"`);
|
|
2736
2736
|
if (l = m.measurements.find((a) => a.id === f.id), !l)
|
|
2737
2737
|
throw new Error(`Measurement with ID ${f.id} not found in SKU ${t._id}`);
|
|
2738
2738
|
}
|
|
@@ -2742,78 +2742,78 @@ function Lt(r, u, d, c, s) {
|
|
|
2742
2742
|
};
|
|
2743
2743
|
}
|
|
2744
2744
|
g(Lt, "validateNetSuiteOrderItem");
|
|
2745
|
-
function kn(
|
|
2746
|
-
const d =
|
|
2747
|
-
const { id: n, quantity: t } =
|
|
2745
|
+
function kn(s, u) {
|
|
2746
|
+
const d = s.items.reduce((c, r) => {
|
|
2747
|
+
const { id: n, quantity: t } = r;
|
|
2748
2748
|
return c[n] || (c[n] = A.fromNumber(0)), c[n] = A.add([
|
|
2749
2749
|
c[n],
|
|
2750
2750
|
t
|
|
2751
2751
|
]), c;
|
|
2752
2752
|
}, {});
|
|
2753
2753
|
for (const c of u) {
|
|
2754
|
-
const
|
|
2755
|
-
for (const n of
|
|
2754
|
+
const r = c.received;
|
|
2755
|
+
for (const n of r)
|
|
2756
2756
|
d[n.id] = A.subtract([
|
|
2757
2757
|
d[n.id],
|
|
2758
2758
|
n.amount
|
|
2759
2759
|
]);
|
|
2760
2760
|
}
|
|
2761
|
-
return Object.entries(d).reduce((c, [
|
|
2761
|
+
return Object.entries(d).reduce((c, [r, n]) => (A.smallerThan({
|
|
2762
2762
|
a: n,
|
|
2763
2763
|
b: A.fromNumber(0)
|
|
2764
|
-
}) && (c[
|
|
2764
|
+
}) && (c[r] = n), c), {});
|
|
2765
2765
|
}
|
|
2766
2766
|
g(kn, "validatePurchaseOrderOverReceive");
|
|
2767
|
-
function wn(
|
|
2768
|
-
const d =
|
|
2769
|
-
const { id: n, amount: t } =
|
|
2767
|
+
function wn(s, u) {
|
|
2768
|
+
const d = s.items.reduce((c, r) => {
|
|
2769
|
+
const { id: n, amount: t } = r;
|
|
2770
2770
|
return c[n] || (c[n] = A.fromNumber(0)), c[n] = A.add([
|
|
2771
2771
|
c[n],
|
|
2772
2772
|
t
|
|
2773
2773
|
]), c;
|
|
2774
2774
|
}, {});
|
|
2775
2775
|
for (const c of u) {
|
|
2776
|
-
const
|
|
2777
|
-
for (const n of
|
|
2776
|
+
const r = c.received;
|
|
2777
|
+
for (const n of r)
|
|
2778
2778
|
d[n.id] = A.subtract([
|
|
2779
2779
|
d[n.id],
|
|
2780
2780
|
n.amount
|
|
2781
2781
|
]);
|
|
2782
2782
|
}
|
|
2783
|
-
return Object.entries(d).reduce((c, [
|
|
2783
|
+
return Object.entries(d).reduce((c, [r, n]) => (A.smallerThan({
|
|
2784
2784
|
a: n,
|
|
2785
2785
|
b: A.fromNumber(0)
|
|
2786
|
-
}) && (c[
|
|
2786
|
+
}) && (c[r] = n), c), {});
|
|
2787
2787
|
}
|
|
2788
2788
|
g(wn, "validateItemFulfillmentOverReceive");
|
|
2789
2789
|
var Tt;
|
|
2790
|
-
(function(
|
|
2790
|
+
(function(s) {
|
|
2791
2791
|
(function(u) {
|
|
2792
|
-
function d(
|
|
2792
|
+
function d(r, n) {
|
|
2793
2793
|
var t, i;
|
|
2794
2794
|
if (n)
|
|
2795
2795
|
throw new Error("NetSuite Transfer Order already exists");
|
|
2796
|
-
if ((i = (t =
|
|
2796
|
+
if ((i = (t = r.netSuite) == null ? void 0 : t.subsidiary) != null && i.id)
|
|
2797
2797
|
throw new Error("NetSuite subsidiary ID is required");
|
|
2798
2798
|
}
|
|
2799
2799
|
g(d, "validateCreate"), u.validateCreate = d;
|
|
2800
|
-
function c(
|
|
2801
|
-
const { orderStatus: n, processedAt: t, rejectedAt: i } =
|
|
2800
|
+
function c(r) {
|
|
2801
|
+
const { orderStatus: n, processedAt: t, rejectedAt: i } = r;
|
|
2802
2802
|
if (!n || !n.id)
|
|
2803
2803
|
throw new Error("Missing transfer order status");
|
|
2804
2804
|
if (t && i)
|
|
2805
2805
|
throw new Error("Transfer Order cannot be both approved and rejected at the same time");
|
|
2806
|
-
const o = Ve(
|
|
2806
|
+
const o = Ve(F.A);
|
|
2807
2807
|
return n.id === o && t ? {
|
|
2808
|
-
id: Ve(
|
|
2808
|
+
id: Ve(F.B)
|
|
2809
2809
|
} : n;
|
|
2810
2810
|
}
|
|
2811
2811
|
g(c, "validateApprovalStatus"), u.validateApprovalStatus = c;
|
|
2812
|
-
})(
|
|
2813
|
-
function d(c,
|
|
2812
|
+
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2813
|
+
function d(c, r, n, t) {
|
|
2814
2814
|
const i = c.every((l) => l.isClosed);
|
|
2815
2815
|
let o = {
|
|
2816
|
-
...
|
|
2816
|
+
...r
|
|
2817
2817
|
};
|
|
2818
2818
|
const m = {};
|
|
2819
2819
|
if (i) {
|
|
@@ -2836,49 +2836,49 @@ var Tt;
|
|
|
2836
2836
|
};
|
|
2837
2837
|
}
|
|
2838
2838
|
g(d, "isVoided"), u.isVoided = d;
|
|
2839
|
-
}(
|
|
2839
|
+
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2840
2840
|
})(Tt || (Tt = {}));
|
|
2841
|
-
function
|
|
2842
|
-
const d =
|
|
2843
|
-
for (const
|
|
2844
|
-
const n =
|
|
2845
|
-
if (
|
|
2846
|
-
if (t >
|
|
2847
|
-
console.warn(`Quantity fulfilled (${t}) is greater than order item (${
|
|
2841
|
+
function Rn(s, u) {
|
|
2842
|
+
const d = s.reduce((r, n) => (r[n.line] = (r[n.line] || 0) + n.quantity, r), {}), c = [];
|
|
2843
|
+
for (const r of u) {
|
|
2844
|
+
const n = r.line, t = d[n] ?? 0;
|
|
2845
|
+
if (r.quantity !== t) {
|
|
2846
|
+
if (t > r.quantity) {
|
|
2847
|
+
console.warn(`Quantity fulfilled (${t}) is greater than order item (${r.quantity}) for line ${n}`);
|
|
2848
2848
|
continue;
|
|
2849
2849
|
}
|
|
2850
|
-
c.push(
|
|
2850
|
+
c.push(r);
|
|
2851
2851
|
}
|
|
2852
2852
|
}
|
|
2853
2853
|
return c;
|
|
2854
2854
|
}
|
|
2855
|
-
g(
|
|
2856
|
-
function
|
|
2855
|
+
g(Rn, "getAvailableItemToBeFulfilled");
|
|
2856
|
+
function Fn(s) {
|
|
2857
2857
|
var l, f;
|
|
2858
|
-
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } =
|
|
2858
|
+
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } = s, r = d.reduce((a, I) => (a[I.id] = I, a), {}), n = c.reduce((a, I) => (a[I.netSuiteId] = I, a), {}), t = /* @__PURE__ */ new Set(), i = [];
|
|
2859
2859
|
for (const a of u) {
|
|
2860
|
-
let
|
|
2860
|
+
let I = a;
|
|
2861
2861
|
try {
|
|
2862
|
-
const
|
|
2863
|
-
if (!
|
|
2862
|
+
const p = r[a._id];
|
|
2863
|
+
if (!p)
|
|
2864
2864
|
throw new Error(`Missing NetSuite assembly item config for SKU with ID ${a._id}`);
|
|
2865
|
-
const y = n[
|
|
2865
|
+
const y = n[p.netSuiteId];
|
|
2866
2866
|
if (!y)
|
|
2867
|
-
throw new Error(`Missing replica for NetSuite ID ${
|
|
2867
|
+
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
2868
2868
|
if (!y.skuCache)
|
|
2869
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
2870
|
-
if (y.itemType !==
|
|
2871
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
2869
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
2870
|
+
if (y.itemType !== R.Enum.Assembly)
|
|
2871
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'Assembly'.`);
|
|
2872
2872
|
if (y.skuCache._id !== a._id)
|
|
2873
2873
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
2874
|
-
|
|
2874
|
+
I = {
|
|
2875
2875
|
...y.skuCache,
|
|
2876
2876
|
customAttributes: a.customAttributes
|
|
2877
2877
|
};
|
|
2878
|
-
} catch (
|
|
2879
|
-
console.log("Error merging SKU:",
|
|
2878
|
+
} catch (p) {
|
|
2879
|
+
console.log("Error merging SKU:", p);
|
|
2880
2880
|
}
|
|
2881
|
-
i.push(
|
|
2881
|
+
i.push(I), t.add(I._id);
|
|
2882
2882
|
}
|
|
2883
2883
|
for (const a of c)
|
|
2884
2884
|
!a.skuCache || t.has(a.skuCache._id) || (i.push({
|
|
@@ -2901,18 +2901,18 @@ function Rn(r) {
|
|
|
2901
2901
|
pktName: ((f = a.customFields) == null ? void 0 : f.pktName) ?? null
|
|
2902
2902
|
}));
|
|
2903
2903
|
for (const a of d)
|
|
2904
|
-
a.itemType !==
|
|
2904
|
+
a.itemType !== R.Enum.Assembly && !m.has(a.id) && o.push(a);
|
|
2905
2905
|
return {
|
|
2906
2906
|
updatedInventorySkus: i,
|
|
2907
2907
|
updatedParentItemConfigs: o
|
|
2908
2908
|
};
|
|
2909
2909
|
}
|
|
2910
|
-
g(
|
|
2911
|
-
function
|
|
2910
|
+
g(Fn, "syncAssemblyParentItemsWithLegacyConfig");
|
|
2911
|
+
function Pn(s) {
|
|
2912
2912
|
var n, t;
|
|
2913
|
-
const { legacyChildItemConfigs: u, childReplicas: d } =
|
|
2913
|
+
const { legacyChildItemConfigs: u, childReplicas: d } = s, c = [], r = /* @__PURE__ */ new Set();
|
|
2914
2914
|
for (const i of d)
|
|
2915
|
-
|
|
2915
|
+
r.add(i.netSuiteId), c.push({
|
|
2916
2916
|
name: i.name,
|
|
2917
2917
|
netSuiteId: i.netSuiteId,
|
|
2918
2918
|
parentNetSuiteId: i.parentNetSuiteId,
|
|
@@ -2927,36 +2927,36 @@ function On(r) {
|
|
|
2927
2927
|
pktName: ((t = i.customFields) == null ? void 0 : t.pktName) ?? null
|
|
2928
2928
|
});
|
|
2929
2929
|
for (const i of u)
|
|
2930
|
-
i.itemType !==
|
|
2930
|
+
i.itemType !== R.Enum.Assembly && !r.has(i.netSuiteId) && c.push(i);
|
|
2931
2931
|
return c;
|
|
2932
2932
|
}
|
|
2933
|
-
g(
|
|
2934
|
-
function
|
|
2933
|
+
g(Pn, "syncAssemblyChildItemsWithLegacyConfig");
|
|
2934
|
+
function On(s) {
|
|
2935
2935
|
var l, f;
|
|
2936
|
-
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } =
|
|
2936
|
+
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } = s, r = d.reduce((a, I) => (a[I.id] = I, a), {}), n = c.reduce((a, I) => (a[I.netSuiteId] = I, a), {}), t = /* @__PURE__ */ new Set(), i = [];
|
|
2937
2937
|
for (const a of u) {
|
|
2938
|
-
let
|
|
2938
|
+
let I = a;
|
|
2939
2939
|
try {
|
|
2940
|
-
const
|
|
2941
|
-
if (!
|
|
2940
|
+
const p = r[a._id];
|
|
2941
|
+
if (!p)
|
|
2942
2942
|
throw new Error(`Missing NetSuite inventory item config for SKU with ID ${a._id}`);
|
|
2943
|
-
const y = n[
|
|
2943
|
+
const y = n[p.netSuiteId];
|
|
2944
2944
|
if (!y)
|
|
2945
|
-
throw new Error(`Missing replica for NetSuite ID ${
|
|
2945
|
+
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
2946
2946
|
if (!y.skuCache)
|
|
2947
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
2948
|
-
if (y.itemType !==
|
|
2949
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
2947
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
2948
|
+
if (y.itemType !== R.Enum.InvtPart)
|
|
2949
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'InvtPart'.`);
|
|
2950
2950
|
if (y.skuCache._id !== a._id)
|
|
2951
2951
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
2952
|
-
|
|
2952
|
+
I = {
|
|
2953
2953
|
...y.skuCache,
|
|
2954
2954
|
customAttributes: a.customAttributes
|
|
2955
2955
|
};
|
|
2956
|
-
} catch (
|
|
2957
|
-
console.log("Error merging SKU:",
|
|
2956
|
+
} catch (p) {
|
|
2957
|
+
console.log("Error merging SKU:", p);
|
|
2958
2958
|
}
|
|
2959
|
-
i.push(
|
|
2959
|
+
i.push(I), t.add(I._id);
|
|
2960
2960
|
}
|
|
2961
2961
|
for (const a of c)
|
|
2962
2962
|
!a.skuCache || t.has(a.skuCache._id) || (i.push({
|
|
@@ -2979,18 +2979,18 @@ function Pn(r) {
|
|
|
2979
2979
|
pktName: ((f = a.customFields) == null ? void 0 : f.pktName) ?? null
|
|
2980
2980
|
}));
|
|
2981
2981
|
for (const a of d)
|
|
2982
|
-
a.itemType !==
|
|
2982
|
+
a.itemType !== R.Enum.InvtPart && !m.has(a.id) && o.push(a);
|
|
2983
2983
|
return {
|
|
2984
2984
|
updatedInventorySkus: i,
|
|
2985
2985
|
updatedParentItemConfigs: o
|
|
2986
2986
|
};
|
|
2987
2987
|
}
|
|
2988
|
-
g(
|
|
2989
|
-
function xn(
|
|
2988
|
+
g(On, "syncInventoryParentItemsWithLegacyConfig");
|
|
2989
|
+
function xn(s) {
|
|
2990
2990
|
var n, t;
|
|
2991
|
-
const { legacyChildItemConfigs: u, childReplicas: d } =
|
|
2991
|
+
const { legacyChildItemConfigs: u, childReplicas: d } = s, c = [], r = /* @__PURE__ */ new Set();
|
|
2992
2992
|
for (const i of d)
|
|
2993
|
-
|
|
2993
|
+
r.add(i.netSuiteId), c.push({
|
|
2994
2994
|
name: i.name,
|
|
2995
2995
|
netSuiteId: i.netSuiteId,
|
|
2996
2996
|
parentNetSuiteId: i.parentNetSuiteId,
|
|
@@ -3005,36 +3005,36 @@ function xn(r) {
|
|
|
3005
3005
|
pktName: ((t = i.customFields) == null ? void 0 : t.pktName) ?? null
|
|
3006
3006
|
});
|
|
3007
3007
|
for (const i of u)
|
|
3008
|
-
i.itemType !==
|
|
3008
|
+
i.itemType !== R.Enum.InvtPart && !r.has(i.netSuiteId) && c.push(i);
|
|
3009
3009
|
return c;
|
|
3010
3010
|
}
|
|
3011
3011
|
g(xn, "syncInventoryChildItemsWithLegacyConfig");
|
|
3012
|
-
function Ln(
|
|
3012
|
+
function Ln(s) {
|
|
3013
3013
|
var l, f;
|
|
3014
|
-
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } =
|
|
3014
|
+
const { inventorySkus: u, legacyParentItemConfigs: d, parentReplicas: c } = s, r = d.reduce((a, I) => (a[I.id] = I, a), {}), n = c.reduce((a, I) => (a[I.netSuiteId] = I, a), {}), t = /* @__PURE__ */ new Set(), i = [];
|
|
3015
3015
|
for (const a of u) {
|
|
3016
|
-
let
|
|
3016
|
+
let I = a;
|
|
3017
3017
|
try {
|
|
3018
|
-
const
|
|
3019
|
-
if (!
|
|
3018
|
+
const p = r[a._id];
|
|
3019
|
+
if (!p)
|
|
3020
3020
|
throw new Error(`Missing NetSuite service item config for SKU with ID ${a._id}`);
|
|
3021
|
-
const y = n[
|
|
3021
|
+
const y = n[p.netSuiteId];
|
|
3022
3022
|
if (!y)
|
|
3023
|
-
throw new Error(`Missing replica for NetSuite ID ${
|
|
3023
|
+
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
3024
3024
|
if (!y.skuCache)
|
|
3025
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
3026
|
-
if (y.itemType !==
|
|
3027
|
-
throw new Error(`Replica for NetSuite ID ${
|
|
3025
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
3026
|
+
if (y.itemType !== R.Enum.Service)
|
|
3027
|
+
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'Service'.`);
|
|
3028
3028
|
if (y.skuCache._id !== a._id)
|
|
3029
3029
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
3030
|
-
|
|
3030
|
+
I = {
|
|
3031
3031
|
...y.skuCache,
|
|
3032
3032
|
customAttributes: a.customAttributes
|
|
3033
3033
|
};
|
|
3034
|
-
} catch (
|
|
3035
|
-
console.log("Error merging SKU:",
|
|
3034
|
+
} catch (p) {
|
|
3035
|
+
console.log("Error merging SKU:", p);
|
|
3036
3036
|
}
|
|
3037
|
-
i.push(
|
|
3037
|
+
i.push(I), t.add(I._id);
|
|
3038
3038
|
}
|
|
3039
3039
|
for (const a of c)
|
|
3040
3040
|
!a.skuCache || t.has(a.skuCache._id) || (i.push({
|
|
@@ -3058,38 +3058,38 @@ function Ln(r) {
|
|
|
3058
3058
|
itemSubType: a.itemSubType
|
|
3059
3059
|
}));
|
|
3060
3060
|
for (const a of d)
|
|
3061
|
-
a.itemType !==
|
|
3061
|
+
a.itemType !== R.Enum.Service && !m.has(a.id) && o.push(a);
|
|
3062
3062
|
return {
|
|
3063
3063
|
updatedInventorySkus: i,
|
|
3064
3064
|
updatedParentItemConfigs: o
|
|
3065
3065
|
};
|
|
3066
3066
|
}
|
|
3067
3067
|
g(Ln, "syncServiceParentItemsWithLegacyConfig");
|
|
3068
|
-
function $n(
|
|
3069
|
-
var
|
|
3070
|
-
const d = u === Ke.Enum.restaurant &&
|
|
3071
|
-
return ((
|
|
3068
|
+
function $n(s, u) {
|
|
3069
|
+
var r;
|
|
3070
|
+
const d = u === Ke.Enum.restaurant && s.supplier.internal === Ke.Enum.restaurant;
|
|
3071
|
+
return ((r = s.netSuite) == null ? void 0 : r.recordType) === ke.Enum.inventoryTransfer || d;
|
|
3072
3072
|
}
|
|
3073
3073
|
g($n, "canSyncWithInventoryTransfer");
|
|
3074
3074
|
var C;
|
|
3075
|
-
(function(
|
|
3076
|
-
|
|
3075
|
+
(function(s) {
|
|
3076
|
+
s.ITEM_CREATED = "ITEM_CREATED", s.ITEM_UPDATED = "ITEM_UPDATED", s.ITEM_DELETED = "ITEM_DELETED", s.ITEM_DUPLICATE = "ITEM_DUPLICATE", s.ITEM_RECEIPT_ITEM_CREATED = "ITEM_RECEIPT_ITEM_CREATED", s.ITEM_RECEIPT_ITEM_UPDATED = "ITEM_RECEIPT_ITEM_UPDATED", s.ITEM_RECEIPT_ITEM_DELETED = "ITEM_RECEIPT_ITEM_DELETED", s.ITEM_FULFILLMENT_ITEM_CREATED = "ITEM_FULFILLMENT_ITEM_CREATED", s.ITEM_FULFILLMENT_ITEM_UPDATED = "ITEM_FULFILLMENT_ITEM_UPDATED", s.ITEM_FULFILLMENT_ITEM_DELETED = "ITEM_FULFILLMENT_ITEM_DELETED";
|
|
3077
3077
|
})(C || (C = {}));
|
|
3078
|
-
function
|
|
3079
|
-
return u.reduce((d, c) => d.replace("$", c),
|
|
3078
|
+
function re(s, u) {
|
|
3079
|
+
return u.reduce((d, c) => d.replace("$", c), s);
|
|
3080
3080
|
}
|
|
3081
|
-
g(
|
|
3081
|
+
g(re, "replacePlaceholders");
|
|
3082
3082
|
var De = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3083
|
-
function Se(
|
|
3083
|
+
function Se(s, u, d, c, r = !1) {
|
|
3084
3084
|
const n = [];
|
|
3085
|
-
if ((c ===
|
|
3085
|
+
if ((c === ne.Enum[2] || r) && u.length != 0 && u.every((t) => !t.externalId))
|
|
3086
3086
|
for (let t = 0; t < u.length; t++) {
|
|
3087
|
-
const i =
|
|
3087
|
+
const i = s[t];
|
|
3088
3088
|
if (!i)
|
|
3089
3089
|
throw new Error("Incoming item is undefined");
|
|
3090
3090
|
n.push({
|
|
3091
3091
|
type: C.ITEM_UPDATED,
|
|
3092
|
-
message:
|
|
3092
|
+
message: re(De, [
|
|
3093
3093
|
"Order Item",
|
|
3094
3094
|
`${i.externalId}`,
|
|
3095
3095
|
"externalId",
|
|
@@ -3107,7 +3107,7 @@ function Se(r, u, d, c, s = !1) {
|
|
|
3107
3107
|
}), u[t].externalId = i.externalId;
|
|
3108
3108
|
}
|
|
3109
3109
|
for (const t of u)
|
|
3110
|
-
|
|
3110
|
+
s.find((o) => c == "2" ? o.externalId === t.externalId : o.sku._id === t.sku._id) || n.push({
|
|
3111
3111
|
type: C.ITEM_DELETED,
|
|
3112
3112
|
message: `Order Item ${d} does not match sku ${t.sku._id} with existing line [${t.externalId}]`,
|
|
3113
3113
|
data: {
|
|
@@ -3115,7 +3115,7 @@ function Se(r, u, d, c, s = !1) {
|
|
|
3115
3115
|
recordId: d
|
|
3116
3116
|
}
|
|
3117
3117
|
});
|
|
3118
|
-
for (const t of
|
|
3118
|
+
for (const t of s) {
|
|
3119
3119
|
const i = u.find((o) => c == "2" ? o.externalId === t.externalId : o.sku._id === t.sku._id);
|
|
3120
3120
|
if (!i)
|
|
3121
3121
|
n.push({
|
|
@@ -3129,12 +3129,12 @@ function Se(r, u, d, c, s = !1) {
|
|
|
3129
3129
|
else {
|
|
3130
3130
|
const o = Object.keys(He.shape);
|
|
3131
3131
|
for (const m of o) {
|
|
3132
|
-
if (m === "id" || m === "name" || m === "externalId" && c ===
|
|
3132
|
+
if (m === "id" || m === "name" || m === "externalId" && c === ne.Enum[1])
|
|
3133
3133
|
continue;
|
|
3134
3134
|
if (m === "sku") {
|
|
3135
3135
|
t[m]._id !== i[m]._id && n.push({
|
|
3136
3136
|
type: C.ITEM_UPDATED,
|
|
3137
|
-
message:
|
|
3137
|
+
message: re(De, [
|
|
3138
3138
|
"Order Item",
|
|
3139
3139
|
`${t.externalId}`,
|
|
3140
3140
|
m,
|
|
@@ -3157,18 +3157,18 @@ function Se(r, u, d, c, s = !1) {
|
|
|
3157
3157
|
if (!(m === "quantity" && l && f && A.equals({
|
|
3158
3158
|
a: l,
|
|
3159
3159
|
b: f
|
|
3160
|
-
})) && !
|
|
3161
|
-
let a = f,
|
|
3160
|
+
})) && !P.isEqual(t[m], i[m])) {
|
|
3161
|
+
let a = f, I = l;
|
|
3162
3162
|
if (m === "code" && f)
|
|
3163
3163
|
continue;
|
|
3164
|
-
typeof t[m] == "object" && (a = JSON.stringify(f),
|
|
3164
|
+
typeof t[m] == "object" && (a = JSON.stringify(f), I = JSON.stringify(l)), n.push({
|
|
3165
3165
|
type: C.ITEM_UPDATED,
|
|
3166
|
-
message:
|
|
3166
|
+
message: re(De, [
|
|
3167
3167
|
"Purchase Order Item",
|
|
3168
3168
|
`${t.externalId}`,
|
|
3169
3169
|
m,
|
|
3170
3170
|
`${a}`,
|
|
3171
|
-
`${
|
|
3171
|
+
`${I}`
|
|
3172
3172
|
]),
|
|
3173
3173
|
data: {
|
|
3174
3174
|
recordId: d,
|
|
@@ -3186,16 +3186,16 @@ function Se(r, u, d, c, s = !1) {
|
|
|
3186
3186
|
return n;
|
|
3187
3187
|
}
|
|
3188
3188
|
g(Se, "detectPurchaseOrderItemConflicts");
|
|
3189
|
-
function
|
|
3189
|
+
function st(s, u, d, c, r) {
|
|
3190
3190
|
const n = [], t = {};
|
|
3191
|
-
if (
|
|
3191
|
+
if (r === ne.Enum[2] && c.length != 0 && c.every((i) => !i.externalId))
|
|
3192
3192
|
for (let i = 0; i < c.length; i++) {
|
|
3193
3193
|
const o = d[i];
|
|
3194
3194
|
if (!o)
|
|
3195
3195
|
throw new Error("Incoming item is undefined");
|
|
3196
3196
|
n.push({
|
|
3197
3197
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3198
|
-
message:
|
|
3198
|
+
message: re(De, [
|
|
3199
3199
|
`${u}`,
|
|
3200
3200
|
`${o.externalId}`,
|
|
3201
3201
|
"externalId",
|
|
@@ -3203,7 +3203,7 @@ function rt(r, u, d, c, s) {
|
|
|
3203
3203
|
`${o.externalId}`
|
|
3204
3204
|
]),
|
|
3205
3205
|
data: {
|
|
3206
|
-
recordId:
|
|
3206
|
+
recordId: s,
|
|
3207
3207
|
field: "externalId",
|
|
3208
3208
|
externalId: o.externalId,
|
|
3209
3209
|
incomingValue: o.externalId,
|
|
@@ -3212,38 +3212,38 @@ function rt(r, u, d, c, s) {
|
|
|
3212
3212
|
}), c[i].externalId = o.externalId;
|
|
3213
3213
|
}
|
|
3214
3214
|
for (const i of c) {
|
|
3215
|
-
const o = d.find((m) =>
|
|
3215
|
+
const o = d.find((m) => r == "2" ? m.externalId === i.externalId : m.sku._id === i.sku._id);
|
|
3216
3216
|
o || n.push({
|
|
3217
3217
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_DELETED : C.ITEM_RECEIPT_ITEM_DELETED,
|
|
3218
|
-
message: `${u} ${
|
|
3218
|
+
message: `${u} ${s} does match sku ${i.sku._id} with existing line [${i.externalId}]`,
|
|
3219
3219
|
data: {
|
|
3220
3220
|
lineItem: o,
|
|
3221
3221
|
existinglineItem: i,
|
|
3222
|
-
recordId:
|
|
3222
|
+
recordId: s
|
|
3223
3223
|
}
|
|
3224
3224
|
});
|
|
3225
3225
|
}
|
|
3226
3226
|
for (const i of d) {
|
|
3227
|
-
const o = c.find((m) =>
|
|
3227
|
+
const o = c.find((m) => r == "2" ? m.externalId === i.externalId : m.sku._id === i.sku._id);
|
|
3228
3228
|
if (!o)
|
|
3229
3229
|
n.push({
|
|
3230
3230
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_CREATED : C.ITEM_RECEIPT_ITEM_CREATED,
|
|
3231
|
-
message: `${u} ${
|
|
3231
|
+
message: `${u} ${s} does not have sku ${i.sku._id} with line [${i.externalId}]`,
|
|
3232
3232
|
data: {
|
|
3233
3233
|
lineItem: i,
|
|
3234
|
-
recordId:
|
|
3234
|
+
recordId: s
|
|
3235
3235
|
}
|
|
3236
3236
|
});
|
|
3237
3237
|
else {
|
|
3238
3238
|
i.id && i.externalId && (t[i.id] = i.externalId);
|
|
3239
3239
|
const m = Object.keys(Jt.shape);
|
|
3240
3240
|
for (const l of m) {
|
|
3241
|
-
if (l === "id" || l === "externalId" &&
|
|
3241
|
+
if (l === "id" || l === "externalId" && r === ne.Enum[1])
|
|
3242
3242
|
continue;
|
|
3243
3243
|
if (l === "sku") {
|
|
3244
3244
|
i[l]._id !== o[l]._id && n.push({
|
|
3245
3245
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3246
|
-
message:
|
|
3246
|
+
message: re(De, [
|
|
3247
3247
|
`${u}`,
|
|
3248
3248
|
`${i.externalId}`,
|
|
3249
3249
|
l,
|
|
@@ -3251,7 +3251,7 @@ function rt(r, u, d, c, s) {
|
|
|
3251
3251
|
`${i[l]._id}`
|
|
3252
3252
|
]),
|
|
3253
3253
|
data: {
|
|
3254
|
-
recordId:
|
|
3254
|
+
recordId: s,
|
|
3255
3255
|
recordType: u,
|
|
3256
3256
|
sku: o.sku,
|
|
3257
3257
|
externalId: i.externalId,
|
|
@@ -3266,19 +3266,19 @@ function rt(r, u, d, c, s) {
|
|
|
3266
3266
|
if (!(l === "amount" && f && a && A.equals({
|
|
3267
3267
|
a: f,
|
|
3268
3268
|
b: a
|
|
3269
|
-
})) && !
|
|
3270
|
-
let
|
|
3271
|
-
typeof i[l] == "object" && (
|
|
3269
|
+
})) && !P.isEqual(i[l], o[l])) {
|
|
3270
|
+
let I = a, p = f;
|
|
3271
|
+
typeof i[l] == "object" && (I = JSON.stringify(a), p = JSON.stringify(f)), n.push({
|
|
3272
3272
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3273
|
-
message:
|
|
3273
|
+
message: re(De, [
|
|
3274
3274
|
`${u}`,
|
|
3275
3275
|
`${i.externalId}`,
|
|
3276
3276
|
l,
|
|
3277
|
-
`${
|
|
3278
|
-
`${
|
|
3277
|
+
`${I}`,
|
|
3278
|
+
`${p}`
|
|
3279
3279
|
]),
|
|
3280
3280
|
data: {
|
|
3281
|
-
recordId:
|
|
3281
|
+
recordId: s,
|
|
3282
3282
|
recordType: u,
|
|
3283
3283
|
sku: o.sku,
|
|
3284
3284
|
externalId: i.externalId,
|
|
@@ -3293,94 +3293,94 @@ function rt(r, u, d, c, s) {
|
|
|
3293
3293
|
}
|
|
3294
3294
|
return n;
|
|
3295
3295
|
}
|
|
3296
|
-
g(
|
|
3297
|
-
function qe(
|
|
3296
|
+
g(st, "detectPurchaseOrderReceivedConflicts");
|
|
3297
|
+
function qe(s, u, d = "1") {
|
|
3298
3298
|
if (u.length === 0)
|
|
3299
|
-
return
|
|
3299
|
+
return s;
|
|
3300
3300
|
const c = [
|
|
3301
|
-
...
|
|
3301
|
+
...s
|
|
3302
3302
|
];
|
|
3303
|
-
for (const
|
|
3304
|
-
if (
|
|
3305
|
-
...
|
|
3306
|
-
id:
|
|
3307
|
-
}),
|
|
3303
|
+
for (const r of u) {
|
|
3304
|
+
if (r.type === C.ITEM_CREATED && c.push({
|
|
3305
|
+
...r.data.lineItem,
|
|
3306
|
+
id: r.data.lineItem.id || crypto.randomUUID()
|
|
3307
|
+
}), r.type === C.ITEM_UPDATED) {
|
|
3308
3308
|
let n = -1;
|
|
3309
|
-
d == "2" ? n = c.findIndex((t) => t.externalId ===
|
|
3309
|
+
d == "2" ? n = c.findIndex((t) => t.externalId === r.data.externalId) : r.data.sku && (n = c.findIndex((t) => t.sku._id === r.data.sku._id)), n !== -1 && (c[n][r.data.field] = r.data.incomingValue);
|
|
3310
3310
|
}
|
|
3311
|
-
if (
|
|
3312
|
-
const n = c.findIndex((t) => t.externalId ===
|
|
3311
|
+
if (r.type === C.ITEM_DELETED) {
|
|
3312
|
+
const n = c.findIndex((t) => t.externalId === r.data.existinglineItem.externalId);
|
|
3313
3313
|
n !== -1 && c.splice(n, 1);
|
|
3314
3314
|
}
|
|
3315
3315
|
}
|
|
3316
|
-
return c.map((
|
|
3317
|
-
...
|
|
3318
|
-
id:
|
|
3316
|
+
return c.map((r) => ({
|
|
3317
|
+
...r,
|
|
3318
|
+
id: r.id || crypto.randomUUID()
|
|
3319
3319
|
}));
|
|
3320
3320
|
}
|
|
3321
3321
|
g(qe, "resolvePurchaseOrderItemConflicts");
|
|
3322
|
-
function ot(
|
|
3322
|
+
function ot(s, u, d = "1") {
|
|
3323
3323
|
if (u.length === 0)
|
|
3324
|
-
return
|
|
3324
|
+
return s;
|
|
3325
3325
|
const c = [
|
|
3326
|
-
...
|
|
3326
|
+
...s
|
|
3327
3327
|
];
|
|
3328
|
-
for (const
|
|
3329
|
-
if ((
|
|
3330
|
-
...
|
|
3331
|
-
id:
|
|
3332
|
-
}),
|
|
3328
|
+
for (const r of u) {
|
|
3329
|
+
if ((r.type === C.ITEM_CREATED || r.type === C.ITEM_RECEIPT_ITEM_CREATED || r.type === C.ITEM_FULFILLMENT_ITEM_CREATED) && c.push({
|
|
3330
|
+
...r.data.lineItem,
|
|
3331
|
+
id: r.data.lineItem.id || crypto.randomUUID()
|
|
3332
|
+
}), r.type === C.ITEM_UPDATED || r.type === C.ITEM_RECEIPT_ITEM_UPDATED || r.type === C.ITEM_FULFILLMENT_ITEM_UPDATED) {
|
|
3333
3333
|
let n = -1;
|
|
3334
|
-
d == "2" ? n = c.findIndex((t) => t.externalId ===
|
|
3334
|
+
d == "2" ? n = c.findIndex((t) => t.externalId === r.data.externalId) : r.data.sku && (n = c.findIndex((t) => t.sku._id === r.data.sku._id)), n !== -1 && (c[n][r.data.field] = r.data.incomingValue);
|
|
3335
3335
|
}
|
|
3336
|
-
if (
|
|
3336
|
+
if (r.type === C.ITEM_DELETED || r.type === C.ITEM_RECEIPT_ITEM_DELETED || r.type === C.ITEM_FULFILLMENT_ITEM_DELETED) {
|
|
3337
3337
|
let n = -1;
|
|
3338
|
-
d == "2" ? n = c.findIndex((t) => t.externalId ===
|
|
3338
|
+
d == "2" ? n = c.findIndex((t) => t.externalId === r.data.existinglineItem.externalId) : r.data.existinglineItem.sku && (n = c.findIndex((t) => t.sku._id === r.data.existinglineItem.sku._id)), n !== -1 && c.splice(n, 1);
|
|
3339
3339
|
}
|
|
3340
3340
|
}
|
|
3341
3341
|
return c;
|
|
3342
3342
|
}
|
|
3343
3343
|
g(ot, "resolvePurchaseOrderReceivedConflicts");
|
|
3344
|
-
var
|
|
3345
|
-
(function(
|
|
3346
|
-
|
|
3347
|
-
})(
|
|
3348
|
-
var L = /* @__PURE__ */ g((
|
|
3349
|
-
function Vn(
|
|
3344
|
+
var ee;
|
|
3345
|
+
(function(s) {
|
|
3346
|
+
s.ITEM_FULFILLMENT_CREATED = "ITEM_FULFILLMENT_CREATED", s.ITEM_FULFILLMENT_UPDATED = "ITEM_FULFILLMENT_UPDATED", s.ITEM_FULFILLMENT_DELETED = "ITEM_FULFILLMENT_DELETED";
|
|
3347
|
+
})(ee || (ee = {}));
|
|
3348
|
+
var L = /* @__PURE__ */ g((s) => s === "" ? null : s, "normalizeNullOrEmpty"), jn = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3349
|
+
function Vn(s, u, d) {
|
|
3350
3350
|
var n, t, i, o, m, l;
|
|
3351
|
-
const c = Object.keys(Wt.shape),
|
|
3351
|
+
const c = Object.keys(Wt.shape), r = [];
|
|
3352
3352
|
for (const f of u) {
|
|
3353
|
-
const a = L(f.id),
|
|
3354
|
-
if (!
|
|
3353
|
+
const a = L(f.id), I = L((n = f.netSuite) == null ? void 0 : n.id);
|
|
3354
|
+
if (!I)
|
|
3355
3355
|
continue;
|
|
3356
|
-
const
|
|
3356
|
+
const p = s.find((y) => {
|
|
3357
3357
|
var h;
|
|
3358
3358
|
const E = L(y.id), _ = L((h = y.netSuite) == null ? void 0 : h.id);
|
|
3359
|
-
return _ &&
|
|
3359
|
+
return _ && I && _ === I || E && E === a;
|
|
3360
3360
|
});
|
|
3361
|
-
if (!
|
|
3362
|
-
|
|
3363
|
-
type:
|
|
3361
|
+
if (!p)
|
|
3362
|
+
r.push({
|
|
3363
|
+
type: ee.ITEM_FULFILLMENT_CREATED,
|
|
3364
3364
|
message: `New Item Fulfillment ${(t = f.netSuite) == null ? void 0 : t.id} created`,
|
|
3365
3365
|
data: f
|
|
3366
3366
|
});
|
|
3367
3367
|
else {
|
|
3368
|
-
const y = L(
|
|
3369
|
-
if (E &&
|
|
3368
|
+
const y = L(p.id), E = L((i = p.netSuite) == null ? void 0 : i.id);
|
|
3369
|
+
if (E && I && E !== I || a && y && y !== a)
|
|
3370
3370
|
throw new Error(`Inconsistent data for Item Fulfillment ${(o = f.netSuite) == null ? void 0 : o.id} (or ${f.id})`);
|
|
3371
3371
|
for (const b of c) {
|
|
3372
3372
|
if (b === "adjustment" || b === "id")
|
|
3373
3373
|
continue;
|
|
3374
3374
|
if (b === "items") {
|
|
3375
|
-
|
|
3375
|
+
r.push(...st(p.id, "deliveryFulfillment", f.items, p.items, d));
|
|
3376
3376
|
continue;
|
|
3377
3377
|
}
|
|
3378
|
-
const h = f[b] ?? null, k =
|
|
3379
|
-
if (!
|
|
3378
|
+
const h = f[b] ?? null, k = p[b] ?? null;
|
|
3379
|
+
if (!P.isEqual(h, k)) {
|
|
3380
3380
|
let v = k, U = h;
|
|
3381
|
-
typeof f[b] == "object" && (v = JSON.stringify(k), U = JSON.stringify(h)), b === "createdAt" && (v = new Date(f[b]).toISOString(), U = new Date(
|
|
3382
|
-
type:
|
|
3383
|
-
message:
|
|
3381
|
+
typeof f[b] == "object" && (v = JSON.stringify(k), U = JSON.stringify(h)), b === "createdAt" && (v = new Date(f[b]).toISOString(), U = new Date(p[b]).toISOString()), r.push({
|
|
3382
|
+
type: ee.ITEM_FULFILLMENT_UPDATED,
|
|
3383
|
+
message: re(jn, [
|
|
3384
3384
|
"Item Fulfillment Field",
|
|
3385
3385
|
`${(m = f.netSuite) == null ? void 0 : m.id}`,
|
|
3386
3386
|
b,
|
|
@@ -3388,7 +3388,8 @@ function Vn(r, u, d) {
|
|
|
3388
3388
|
`${U}`
|
|
3389
3389
|
]),
|
|
3390
3390
|
data: {
|
|
3391
|
-
recordId: `${
|
|
3391
|
+
recordId: `${p.id}`,
|
|
3392
|
+
nsRecordId: `${(l = f.netSuite) == null ? void 0 : l.id}`,
|
|
3392
3393
|
field: b,
|
|
3393
3394
|
incomingValue: h,
|
|
3394
3395
|
existingValue: k
|
|
@@ -3398,23 +3399,35 @@ function Vn(r, u, d) {
|
|
|
3398
3399
|
}
|
|
3399
3400
|
}
|
|
3400
3401
|
}
|
|
3401
|
-
return
|
|
3402
|
+
return r;
|
|
3402
3403
|
}
|
|
3403
3404
|
g(Vn, "detectItemFulfillmentConflicts");
|
|
3404
|
-
function Bn(
|
|
3405
|
-
const d = u.filter((n) => n.type ===
|
|
3405
|
+
function Bn(s, u) {
|
|
3406
|
+
const d = u.filter((n) => n.type === ee.ITEM_FULFILLMENT_CREATED || n.type === ee.ITEM_FULFILLMENT_UPDATED || n.type === ee.ITEM_FULFILLMENT_DELETED || n.type === C.ITEM_FULFILLMENT_ITEM_CREATED || n.type === C.ITEM_FULFILLMENT_ITEM_UPDATED || n.type === C.ITEM_FULFILLMENT_ITEM_DELETED), c = [];
|
|
3406
3407
|
if (d.length === 0)
|
|
3407
|
-
return
|
|
3408
|
-
for (const n of
|
|
3409
|
-
const t = d.filter((l) =>
|
|
3408
|
+
return s;
|
|
3409
|
+
for (const n of s) {
|
|
3410
|
+
const t = d.filter((l) => {
|
|
3411
|
+
var f;
|
|
3412
|
+
if (l.type === ee.ITEM_FULFILLMENT_UPDATED) {
|
|
3413
|
+
const a = l.data;
|
|
3414
|
+
if (a.recordId && a.recordId === n.id) {
|
|
3415
|
+
if ((f = n.netSuite) != null && f.id && a.nsRecordId !== n.netSuite.id)
|
|
3416
|
+
throw new Error(`NetSuite ID mismatch for delivery fulfillment ${n.id}: conflict has nsRecordId="${a.nsRecordId}" but record has netSuite.id="${n.netSuite.id}"`);
|
|
3417
|
+
return !0;
|
|
3418
|
+
}
|
|
3419
|
+
return !1;
|
|
3420
|
+
}
|
|
3421
|
+
return l.data.recordId != "" && l.data.recordId === n.id;
|
|
3422
|
+
}), i = t.filter((l) => (l.type === C.ITEM_FULFILLMENT_ITEM_CREATED || l.type === C.ITEM_FULFILLMENT_ITEM_UPDATED || l.type === C.ITEM_FULFILLMENT_ITEM_DELETED) && l.data.recordId === n.id), o = ot(n.items || [], i);
|
|
3410
3423
|
let m = {
|
|
3411
3424
|
...n,
|
|
3412
3425
|
items: o
|
|
3413
3426
|
};
|
|
3414
3427
|
for (const l of t)
|
|
3415
|
-
if (l.type ===
|
|
3416
|
-
const f = l.data.field, a = l.data.incomingValue,
|
|
3417
|
-
a !==
|
|
3428
|
+
if (l.type === ee.ITEM_FULFILLMENT_UPDATED) {
|
|
3429
|
+
const f = l.data.field, a = l.data.incomingValue, I = n[f];
|
|
3430
|
+
a !== I && (m = {
|
|
3418
3431
|
...n,
|
|
3419
3432
|
[f]: a
|
|
3420
3433
|
});
|
|
@@ -3422,37 +3435,37 @@ function Bn(r, u) {
|
|
|
3422
3435
|
c.push(m);
|
|
3423
3436
|
}
|
|
3424
3437
|
for (const n of d)
|
|
3425
|
-
n.type ===
|
|
3438
|
+
n.type === ee.ITEM_FULFILLMENT_CREATED && c.push({
|
|
3426
3439
|
...n.data,
|
|
3427
|
-
id: n.data.id ||
|
|
3440
|
+
id: n.data.id || O({
|
|
3428
3441
|
prefix: x.Enum.deliveryFulfillment
|
|
3429
3442
|
})
|
|
3430
3443
|
});
|
|
3431
|
-
const
|
|
3444
|
+
const r = [];
|
|
3432
3445
|
for (const n of c)
|
|
3433
|
-
n.id ?
|
|
3446
|
+
n.id ? r.push(n) : (console.warn("Missing delivery fulfillment id, generating new id"), r.push({
|
|
3434
3447
|
...n,
|
|
3435
|
-
id:
|
|
3448
|
+
id: O({
|
|
3436
3449
|
prefix: x.Enum.deliveryFulfillment
|
|
3437
3450
|
})
|
|
3438
3451
|
}));
|
|
3439
|
-
return
|
|
3452
|
+
return r;
|
|
3440
3453
|
}
|
|
3441
3454
|
g(Bn, "resolveDeliveryFulfillmentConflicts");
|
|
3442
|
-
var
|
|
3443
|
-
(function(
|
|
3444
|
-
|
|
3445
|
-
})(
|
|
3455
|
+
var te;
|
|
3456
|
+
(function(s) {
|
|
3457
|
+
s.ITEM_RECEIPT_CREATED = "ITEM_RECEIPT_CREATED", s.ITEM_RECEIPT_UPDATED = "ITEM_RECEIPT_UPDATED", s.ITEM_RECEIPT_DELETED = "ITEM_RECEIPT_DELETED";
|
|
3458
|
+
})(te || (te = {}));
|
|
3446
3459
|
var qn = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3447
|
-
function $t(
|
|
3448
|
-
var i, o, m, l, f, a,
|
|
3449
|
-
const c = Object.keys(Qt.shape),
|
|
3450
|
-
for (const
|
|
3451
|
-
const y = L((i =
|
|
3460
|
+
function $t(s, u, d) {
|
|
3461
|
+
var i, o, m, l, f, a, I;
|
|
3462
|
+
const c = Object.keys(Qt.shape), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
3463
|
+
for (const p of s) {
|
|
3464
|
+
const y = L((i = p.netSuite) == null ? void 0 : i.id), E = L(p.id);
|
|
3452
3465
|
if (y) {
|
|
3453
|
-
if (
|
|
3466
|
+
if (r.has(y))
|
|
3454
3467
|
throw new Error(`Duplicate NetSuite ID found: ${y}`);
|
|
3455
|
-
|
|
3468
|
+
r.add(y);
|
|
3456
3469
|
}
|
|
3457
3470
|
if (E) {
|
|
3458
3471
|
if (n.has(E))
|
|
@@ -3461,48 +3474,49 @@ function $t(r, u, d) {
|
|
|
3461
3474
|
}
|
|
3462
3475
|
}
|
|
3463
3476
|
const t = [];
|
|
3464
|
-
for (const
|
|
3465
|
-
const y = L(
|
|
3477
|
+
for (const p of u) {
|
|
3478
|
+
const y = L(p.id), E = L((o = p.netSuite) == null ? void 0 : o.id);
|
|
3466
3479
|
if (!E)
|
|
3467
3480
|
continue;
|
|
3468
|
-
const _ =
|
|
3481
|
+
const _ = s.find((S) => {
|
|
3469
3482
|
var U;
|
|
3470
3483
|
const b = L(S.id), h = L((U = S.netSuite) == null ? void 0 : U.id);
|
|
3471
3484
|
return h && E && h === E || b && b === y;
|
|
3472
3485
|
});
|
|
3473
3486
|
if (!_)
|
|
3474
3487
|
t.push({
|
|
3475
|
-
type:
|
|
3476
|
-
message: `New Item Receipt ${(m =
|
|
3477
|
-
data:
|
|
3488
|
+
type: te.ITEM_RECEIPT_CREATED,
|
|
3489
|
+
message: `New Item Receipt ${(m = p.netSuite) == null ? void 0 : m.id} created`,
|
|
3490
|
+
data: p
|
|
3478
3491
|
});
|
|
3479
3492
|
else {
|
|
3480
3493
|
const S = L(_.id), b = L((l = _.netSuite) == null ? void 0 : l.id);
|
|
3481
3494
|
if (b && E && b !== E || y && S && S !== y)
|
|
3482
|
-
throw new Error(`Inconsistent data for Item Receipt ${(f =
|
|
3495
|
+
throw new Error(`Inconsistent data for Item Receipt ${(f = p.netSuite) == null ? void 0 : f.id} (or ${p.id})`);
|
|
3483
3496
|
for (const v of c) {
|
|
3484
3497
|
if (v === "adjustment" || v === "id")
|
|
3485
3498
|
continue;
|
|
3486
3499
|
if (v === "received") {
|
|
3487
|
-
t.push(...
|
|
3500
|
+
t.push(...st(_.id, "deliveryOrder", p.received, _.received, d));
|
|
3488
3501
|
continue;
|
|
3489
3502
|
}
|
|
3490
|
-
const U = L(
|
|
3491
|
-
if (!
|
|
3503
|
+
const U = L(p[v] ?? null), N = L(_[v] ?? null);
|
|
3504
|
+
if (!P.isEqual(U, N)) {
|
|
3492
3505
|
if ((v === "createdAt" || v === "createdBy" || v === "remark" || v === "effectiveAt") && N)
|
|
3493
3506
|
continue;
|
|
3494
3507
|
let M = N, D = U;
|
|
3495
|
-
typeof
|
|
3496
|
-
type:
|
|
3497
|
-
message:
|
|
3508
|
+
typeof p[v] == "object" && (M = JSON.stringify(N), D = JSON.stringify(U)), v === "createdAt" && (M = new Date(p[v]).toISOString(), D = new Date(_[v]).toISOString()), t.push({
|
|
3509
|
+
type: te.ITEM_RECEIPT_UPDATED,
|
|
3510
|
+
message: re(qn, [
|
|
3498
3511
|
"Item Receipt Field",
|
|
3499
|
-
`${(a =
|
|
3512
|
+
`${(a = p.netSuite) == null ? void 0 : a.id}`,
|
|
3500
3513
|
v,
|
|
3501
3514
|
`${M}`,
|
|
3502
3515
|
`${D}`
|
|
3503
3516
|
]),
|
|
3504
3517
|
data: {
|
|
3505
|
-
recordId: `${
|
|
3518
|
+
recordId: `${_ == null ? void 0 : _.id}`,
|
|
3519
|
+
nsRecordId: `${(I = p.netSuite) == null ? void 0 : I.id}`,
|
|
3506
3520
|
field: v,
|
|
3507
3521
|
incomingValue: U,
|
|
3508
3522
|
existingValue: N
|
|
@@ -3515,13 +3529,23 @@ function $t(r, u, d) {
|
|
|
3515
3529
|
return t;
|
|
3516
3530
|
}
|
|
3517
3531
|
g($t, "detectItemReceiptConflicts");
|
|
3518
|
-
function jt(
|
|
3519
|
-
const d = u.filter((n) => n.type ===
|
|
3532
|
+
function jt(s, u) {
|
|
3533
|
+
const d = u.filter((n) => n.type === te.ITEM_RECEIPT_CREATED || n.type === te.ITEM_RECEIPT_UPDATED || n.type === te.ITEM_RECEIPT_DELETED || n.type === C.ITEM_RECEIPT_ITEM_CREATED || n.type === C.ITEM_RECEIPT_ITEM_UPDATED || n.type === C.ITEM_RECEIPT_ITEM_DELETED), c = [];
|
|
3520
3534
|
if (d.length === 0)
|
|
3521
|
-
return
|
|
3522
|
-
for (const n of
|
|
3535
|
+
return s;
|
|
3536
|
+
for (const n of s) {
|
|
3523
3537
|
const t = d.filter((l) => {
|
|
3538
|
+
var a;
|
|
3524
3539
|
const f = l.data;
|
|
3540
|
+
if (l.type === te.ITEM_RECEIPT_UPDATED) {
|
|
3541
|
+
const I = l.data;
|
|
3542
|
+
if (I.recordId && I.recordId === n.id) {
|
|
3543
|
+
if ((a = n.netSuite) != null && a.id && I.nsRecordId !== n.netSuite.id)
|
|
3544
|
+
throw new Error(`NetSuite ID mismatch for delivery order ${n.id}: conflict has nsRecordId="${I.nsRecordId}" but record has netSuite.id="${n.netSuite.id}"`);
|
|
3545
|
+
return !0;
|
|
3546
|
+
}
|
|
3547
|
+
return !1;
|
|
3548
|
+
}
|
|
3525
3549
|
return f.recordId != "" && f.recordId === n.id;
|
|
3526
3550
|
}), i = t.filter((l) => l.type === C.ITEM_RECEIPT_ITEM_CREATED || l.type === C.ITEM_RECEIPT_ITEM_UPDATED || l.type === C.ITEM_RECEIPT_ITEM_DELETED), o = ot(n.received || [], i);
|
|
3527
3551
|
let m = {
|
|
@@ -3529,9 +3553,9 @@ function jt(r, u) {
|
|
|
3529
3553
|
received: o
|
|
3530
3554
|
};
|
|
3531
3555
|
for (const l of t)
|
|
3532
|
-
if (l.type ===
|
|
3533
|
-
const f = l.data.field, a = l.data.incomingValue,
|
|
3534
|
-
a !==
|
|
3556
|
+
if (l.type === te.ITEM_RECEIPT_UPDATED) {
|
|
3557
|
+
const f = l.data.field, a = l.data.incomingValue, I = n[f];
|
|
3558
|
+
a !== I && (m = {
|
|
3535
3559
|
...n,
|
|
3536
3560
|
[f]: a
|
|
3537
3561
|
});
|
|
@@ -3539,36 +3563,36 @@ function jt(r, u) {
|
|
|
3539
3563
|
c.push(m);
|
|
3540
3564
|
}
|
|
3541
3565
|
for (const n of d)
|
|
3542
|
-
if (n.type ===
|
|
3566
|
+
if (n.type === te.ITEM_RECEIPT_CREATED) {
|
|
3543
3567
|
const t = new Date(n.data.createdAt), i = new Date(n.data.effectiveAt);
|
|
3544
3568
|
c.push({
|
|
3545
3569
|
...n.data,
|
|
3546
|
-
id: n.data.id ||
|
|
3570
|
+
id: n.data.id || O({
|
|
3547
3571
|
prefix: x.Enum.deliveryOrder
|
|
3548
3572
|
}),
|
|
3549
3573
|
effectiveAt: J(t, i) ? void 0 : i.toISOString()
|
|
3550
3574
|
});
|
|
3551
3575
|
}
|
|
3552
|
-
const
|
|
3576
|
+
const r = [];
|
|
3553
3577
|
for (const n of c)
|
|
3554
|
-
n.id ?
|
|
3578
|
+
n.id ? r.push(n) : (console.warn("Missing delivery order id, generating new id"), r.push({
|
|
3555
3579
|
...n,
|
|
3556
|
-
id:
|
|
3580
|
+
id: O({
|
|
3557
3581
|
prefix: x.Enum.deliveryOrder
|
|
3558
3582
|
})
|
|
3559
3583
|
}));
|
|
3560
|
-
return
|
|
3584
|
+
return r;
|
|
3561
3585
|
}
|
|
3562
3586
|
g(jt, "resolveDeliveryOrdersConflicts");
|
|
3563
|
-
function Hn(
|
|
3587
|
+
function Hn(s, u, d, c) {
|
|
3564
3588
|
var t, i;
|
|
3565
|
-
const
|
|
3566
|
-
for (const o of
|
|
3589
|
+
const r = jt(u, c), n = [];
|
|
3590
|
+
for (const o of r) {
|
|
3567
3591
|
const m = {
|
|
3568
3592
|
...o
|
|
3569
3593
|
};
|
|
3570
3594
|
if ((t = o.netSuite) != null && t.id && !((i = o.fullfillmentId) != null && i.startsWith("delivery_fulfillment"))) {
|
|
3571
|
-
const l =
|
|
3595
|
+
const l = s.find((f) => {
|
|
3572
3596
|
var a;
|
|
3573
3597
|
return ((a = f.netSuite) == null ? void 0 : a.id) === o.fullfillmentId;
|
|
3574
3598
|
});
|
|
@@ -3580,27 +3604,27 @@ function Hn(r, u, d, c) {
|
|
|
3580
3604
|
}
|
|
3581
3605
|
g(Hn, "resolveAndMergeDeliveryOrders");
|
|
3582
3606
|
var Y;
|
|
3583
|
-
(function(
|
|
3584
|
-
|
|
3607
|
+
(function(s) {
|
|
3608
|
+
s.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", s.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED", s.PURCHASE_ORDER_REQUEST_CREATED = "PURCHASE_ORDER_REQUEST_CREATED", s.PURCHASE_ORDER_REQUEST_UPDATED = "PURCHASE_ORDER_REQUEST_UPDATED", s.ITEM_FULFILLMENT_CREATED = "ITEM_FULFILLMENT_CREATED", s.ITEM_FULFILLMENT_UPDATED = "ITEM_FULFILLMENT_UPDATED", s.ITEM_FULFILLMENT_DELETED = "ITEM_FULFILLMENT_DELETED", s.ITEM_FULFILLMENT_ITEM_CREATED = "ITEM_FULFILLMENT_ITEM_CREATED", s.ITEM_FULFILLMENT_ITEM_UPDATED = "ITEM_FULFILLMENT_ITEM_UPDATED", s.ITEM_FULFILLMENT_ITEM_DELETED = "ITEM_FULFILLMENT_ITEM_DELETED";
|
|
3585
3609
|
})(Y || (Y = {}));
|
|
3586
|
-
function B(
|
|
3587
|
-
let n = c, t =
|
|
3588
|
-
return typeof c == "object" && (n = JSON.stringify(c), t = JSON.stringify(
|
|
3610
|
+
function B(s, u, d, c, r) {
|
|
3611
|
+
let n = c, t = r;
|
|
3612
|
+
return typeof c == "object" && (n = JSON.stringify(c), t = JSON.stringify(r)), `${s} ${u} field ${d} changed from "${n}" to "${t}"`;
|
|
3589
3613
|
}
|
|
3590
3614
|
g(B, "generateLogMessage");
|
|
3591
|
-
function Kn(
|
|
3615
|
+
function Kn(s, u, d, c = !1) {
|
|
3592
3616
|
var n, t;
|
|
3593
|
-
const
|
|
3594
|
-
if (u ||
|
|
3617
|
+
const r = [];
|
|
3618
|
+
if (u || r.push({
|
|
3595
3619
|
type: Y.PURCHASE_ORDER_CREATED,
|
|
3596
3620
|
message: "Purchase order not found",
|
|
3597
|
-
data:
|
|
3598
|
-
}), d ||
|
|
3621
|
+
data: s.purchaseOrder
|
|
3622
|
+
}), d || r.push({
|
|
3599
3623
|
type: Y.PURCHASE_ORDER_REQUEST_CREATED,
|
|
3600
3624
|
message: "Purchase order request not found",
|
|
3601
|
-
data:
|
|
3625
|
+
data: s.purchaseOrderRequest
|
|
3602
3626
|
}), !u && !d)
|
|
3603
|
-
return
|
|
3627
|
+
return r.push(...Se(s.purchaseOrder.items, [], "", "2")), r;
|
|
3604
3628
|
if (u) {
|
|
3605
3629
|
const i = Object.keys(et.shape);
|
|
3606
3630
|
for (const o of i) {
|
|
@@ -3613,33 +3637,33 @@ function Kn(r, u, d, c = !1) {
|
|
|
3613
3637
|
].includes(o))
|
|
3614
3638
|
continue;
|
|
3615
3639
|
if (o === "items") {
|
|
3616
|
-
|
|
3640
|
+
r.push(...Se(s.purchaseOrder.items, u.items, u._id, u.version || "1", c));
|
|
3617
3641
|
continue;
|
|
3618
3642
|
}
|
|
3619
|
-
let l =
|
|
3643
|
+
let l = s.purchaseOrder[o] ?? null;
|
|
3620
3644
|
const f = u[o] ?? null;
|
|
3621
3645
|
if (o === "request") {
|
|
3622
|
-
const a = l,
|
|
3623
|
-
if (!(a != null && a.id) && (
|
|
3646
|
+
const a = l, I = f;
|
|
3647
|
+
if (!(a != null && a.id) && (I != null && I.id))
|
|
3624
3648
|
continue;
|
|
3625
3649
|
}
|
|
3626
3650
|
if (o === "effectiveAt" && l && typeof l == "string") {
|
|
3627
|
-
const a = new Date(
|
|
3651
|
+
const a = new Date(se(u._id));
|
|
3628
3652
|
J(a, new Date(l)) && (l = null);
|
|
3629
3653
|
}
|
|
3630
|
-
if (!
|
|
3631
|
-
let a = f,
|
|
3632
|
-
if (l && f && typeof l == "object" && typeof f == "object" && (a = f ? JSON.stringify(f) : null,
|
|
3654
|
+
if (!P.isEqual(l, f)) {
|
|
3655
|
+
let a = f, I = l;
|
|
3656
|
+
if (l && f && typeof l == "object" && typeof f == "object" && (a = f ? JSON.stringify(f) : null, I = l ? JSON.stringify(l) : null), o === "effectiveAt") {
|
|
3633
3657
|
if (!f) {
|
|
3634
|
-
const
|
|
3635
|
-
if (typeof l == "string" && new Date(l).toDateString() === new Date(
|
|
3658
|
+
const p = new Date(se(u._id));
|
|
3659
|
+
if (typeof l == "string" && new Date(l).toDateString() === new Date(p).toDateString())
|
|
3636
3660
|
continue;
|
|
3637
3661
|
}
|
|
3638
|
-
a = f && typeof f == "string" ? new Date(f).toISOString() : null,
|
|
3662
|
+
a = f && typeof f == "string" ? new Date(f).toISOString() : null, I = l && typeof l == "string" ? new Date(l).toISOString() : null;
|
|
3639
3663
|
}
|
|
3640
|
-
|
|
3664
|
+
r.push({
|
|
3641
3665
|
type: Y.PURCHASE_ORDER_UPDATED,
|
|
3642
|
-
message: B("Transfer Order", (n =
|
|
3666
|
+
message: B("Transfer Order", (n = s.purchaseOrder.netSuite) == null ? void 0 : n.id, o, a, I),
|
|
3643
3667
|
data: {
|
|
3644
3668
|
field: o,
|
|
3645
3669
|
incomingValue: l,
|
|
@@ -3654,36 +3678,36 @@ function Kn(r, u, d, c = !1) {
|
|
|
3654
3678
|
for (const o of i) {
|
|
3655
3679
|
if (o === "_id")
|
|
3656
3680
|
continue;
|
|
3657
|
-
const m =
|
|
3681
|
+
const m = s.purchaseOrderRequest[o] ?? null, l = d[o] ?? null;
|
|
3658
3682
|
if ((o === "processedAt" || o === "rejectedAt") && m !== l) {
|
|
3659
3683
|
const f = !!d.processedAt, a = !!d.rejectedAt;
|
|
3660
|
-
if (
|
|
3684
|
+
if (s.purchaseOrder.status === V.Enum.REQUESTING && (f || a))
|
|
3661
3685
|
continue;
|
|
3662
|
-
const
|
|
3663
|
-
|
|
3686
|
+
const p = s.purchaseOrderRequest[o] ? new Date(s.purchaseOrderRequest[o]).toISOString() : null, y = d[o] ? new Date(d[o]).toISOString() : null;
|
|
3687
|
+
r.push({
|
|
3664
3688
|
type: Y.PURCHASE_ORDER_REQUEST_UPDATED,
|
|
3665
|
-
message: B("Transfer Order", (t =
|
|
3689
|
+
message: B("Transfer Order", (t = s.purchaseOrder.netSuite) == null ? void 0 : t.id, o, y, p),
|
|
3666
3690
|
data: {
|
|
3667
3691
|
field: o,
|
|
3668
|
-
incomingValue:
|
|
3692
|
+
incomingValue: s.purchaseOrderRequest[o],
|
|
3669
3693
|
existingValue: d[o]
|
|
3670
3694
|
}
|
|
3671
3695
|
});
|
|
3672
3696
|
}
|
|
3673
3697
|
}
|
|
3674
3698
|
}
|
|
3675
|
-
return
|
|
3699
|
+
return r;
|
|
3676
3700
|
}
|
|
3677
3701
|
g(Kn, "detectTransferOrderConflicts");
|
|
3678
|
-
function zn(
|
|
3679
|
-
if (
|
|
3702
|
+
function zn(s, u, d, c, r) {
|
|
3703
|
+
if (s.length === 0)
|
|
3680
3704
|
throw new Error("No order lines found");
|
|
3681
|
-
let n = c || (
|
|
3705
|
+
let n = c || (r == null ? void 0 : r.purchaseOrder), t = r;
|
|
3682
3706
|
const i = qe((n == null ? void 0 : n.items) || [], u);
|
|
3683
3707
|
if (u.length === 0)
|
|
3684
3708
|
return {
|
|
3685
3709
|
purchaseOrder: c,
|
|
3686
|
-
purchaseOrderRequest:
|
|
3710
|
+
purchaseOrderRequest: r
|
|
3687
3711
|
};
|
|
3688
3712
|
if (n) {
|
|
3689
3713
|
for (const o of u)
|
|
@@ -3702,10 +3726,10 @@ function zn(r, u, d, c, s) {
|
|
|
3702
3726
|
for (const o of u)
|
|
3703
3727
|
switch (o.type) {
|
|
3704
3728
|
case Y.PURCHASE_ORDER_CREATED:
|
|
3705
|
-
const m = new Date(
|
|
3729
|
+
const m = new Date(se(d.purchaseOrder._id)), l = new Date(d.purchaseOrder.effectiveAt);
|
|
3706
3730
|
n = {
|
|
3707
3731
|
...d.purchaseOrder,
|
|
3708
|
-
_id: (
|
|
3732
|
+
_id: (r == null ? void 0 : r.purchaseOrderId) || d.purchaseOrder._id || O({
|
|
3709
3733
|
prefix: x.Enum.purchaseOrder
|
|
3710
3734
|
}),
|
|
3711
3735
|
effectiveAt: J(m, l) ? void 0 : l.toISOString(),
|
|
@@ -3723,8 +3747,8 @@ function zn(r, u, d, c, s) {
|
|
|
3723
3747
|
break;
|
|
3724
3748
|
case Y.PURCHASE_ORDER_UPDATED:
|
|
3725
3749
|
if (n) {
|
|
3726
|
-
const f = o.data.field, a = o.data.incomingValue,
|
|
3727
|
-
if (f === "version" && a !==
|
|
3750
|
+
const f = o.data.field, a = o.data.incomingValue, I = n[f];
|
|
3751
|
+
if (f === "version" && a !== I)
|
|
3728
3752
|
continue;
|
|
3729
3753
|
n = {
|
|
3730
3754
|
...n,
|
|
@@ -3734,8 +3758,8 @@ function zn(r, u, d, c, s) {
|
|
|
3734
3758
|
break;
|
|
3735
3759
|
case Y.PURCHASE_ORDER_REQUEST_UPDATED:
|
|
3736
3760
|
if (t) {
|
|
3737
|
-
const f = o.data.field, a = o.data.incomingValue,
|
|
3738
|
-
a !==
|
|
3761
|
+
const f = o.data.field, a = o.data.incomingValue, I = t[f];
|
|
3762
|
+
a !== I && (t = {
|
|
3739
3763
|
...t,
|
|
3740
3764
|
[f]: a
|
|
3741
3765
|
});
|
|
@@ -3766,72 +3790,72 @@ e.object({
|
|
|
3766
3790
|
recordId: e.string(),
|
|
3767
3791
|
recordType: e.string(),
|
|
3768
3792
|
externalId: e.string(),
|
|
3769
|
-
sku:
|
|
3793
|
+
sku: Fe.optional(),
|
|
3770
3794
|
field: e.string(),
|
|
3771
3795
|
incomingValue: e.any(),
|
|
3772
3796
|
existingValue: e.any()
|
|
3773
3797
|
});
|
|
3774
3798
|
var _e;
|
|
3775
|
-
(function(
|
|
3776
|
-
|
|
3799
|
+
(function(s) {
|
|
3800
|
+
s.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", s.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED", s.ITEM_RECEIPT_CREATED = "ITEM_RECEIPT_CREATED", s.ITEM_RECEIPT_UPDATED = "ITEM_RECEIPT_UPDATED", s.ITEM_RECEIPT_DELETED = "ITEM_RECEIPT_DELETED", s.ITEM_RECEIPT_ITEM_CREATED = "ITEM_RECEIPT_ITEM_CREATED", s.ITEM_RECEIPT_ITEM_UPDATED = "ITEM_RECEIPT_ITEM_UPDATED", s.ITEM_RECEIPT_ITEM_DELETED = "ITEM_RECEIPT_ITEM_DELETED";
|
|
3777
3801
|
})(_e || (_e = {}));
|
|
3778
|
-
function Gn(
|
|
3802
|
+
function Gn(s, u) {
|
|
3779
3803
|
const d = [];
|
|
3780
3804
|
if (!u)
|
|
3781
3805
|
return d.push({
|
|
3782
3806
|
type: _e.PURCHASE_ORDER_CREATED,
|
|
3783
3807
|
message: "Purchase order not found",
|
|
3784
|
-
data:
|
|
3785
|
-
}), d.push(...Se(
|
|
3808
|
+
data: s
|
|
3809
|
+
}), d.push(...Se(s.items, [], "", "2")), d;
|
|
3786
3810
|
const c = Object.keys(et.shape);
|
|
3787
|
-
for (const
|
|
3811
|
+
for (const r of c) {
|
|
3788
3812
|
if (![
|
|
3789
3813
|
"status",
|
|
3790
3814
|
"ref",
|
|
3791
3815
|
"items",
|
|
3792
3816
|
"effectiveAt",
|
|
3793
3817
|
"netSuite"
|
|
3794
|
-
].includes(
|
|
3818
|
+
].includes(r))
|
|
3795
3819
|
continue;
|
|
3796
|
-
if (
|
|
3797
|
-
d.push(...Se(
|
|
3820
|
+
if (r === "items") {
|
|
3821
|
+
d.push(...Se(s.items, u.items, u._id, u.version || "1"));
|
|
3798
3822
|
continue;
|
|
3799
3823
|
}
|
|
3800
|
-
const t = r
|
|
3801
|
-
if (
|
|
3802
|
-
const o = new Date(
|
|
3824
|
+
const t = s[r] ?? null, i = u[r] ?? null;
|
|
3825
|
+
if (r === "effectiveAt" && t && typeof t == "string") {
|
|
3826
|
+
const o = new Date(se(u._id));
|
|
3803
3827
|
if (J(o, new Date(t)))
|
|
3804
3828
|
continue;
|
|
3805
3829
|
}
|
|
3806
|
-
if (
|
|
3830
|
+
if (r === "effectiveAt" && t !== i) {
|
|
3807
3831
|
if (t && i && typeof t == "string" && typeof i == "string" && new Date(t).toDateString() === new Date(i).toDateString())
|
|
3808
3832
|
continue;
|
|
3809
3833
|
const o = t && typeof t == "string" ? new Date(t).toISOString() : null, m = i && typeof i == "string" ? new Date(i).toISOString() : null;
|
|
3810
3834
|
d.push({
|
|
3811
3835
|
type: _e.PURCHASE_ORDER_UPDATED,
|
|
3812
|
-
message: B("Purchase Order",
|
|
3836
|
+
message: B("Purchase Order", s.netSuite.id, r, m, o),
|
|
3813
3837
|
data: {
|
|
3814
|
-
field:
|
|
3838
|
+
field: r,
|
|
3815
3839
|
incomingValue: t,
|
|
3816
3840
|
existingValue: i
|
|
3817
3841
|
}
|
|
3818
3842
|
});
|
|
3819
3843
|
}
|
|
3820
3844
|
}
|
|
3821
|
-
return d.push(...$t((u == null ? void 0 : u.deliveryOrder) ?? [],
|
|
3845
|
+
return d.push(...$t((u == null ? void 0 : u.deliveryOrder) ?? [], s.deliveryOrder ?? [], u ? (u == null ? void 0 : u.version) || "1" : s.version)), d;
|
|
3822
3846
|
}
|
|
3823
3847
|
g(Gn, "detectPurchaseOrderConflicts");
|
|
3824
|
-
function Yn(
|
|
3825
|
-
let
|
|
3826
|
-
const n = qe((
|
|
3827
|
-
if (
|
|
3848
|
+
function Yn(s, u, d, c) {
|
|
3849
|
+
let r = c ? P.cloneDeep(c) : null;
|
|
3850
|
+
const n = qe((r == null ? void 0 : r.items) || [], u);
|
|
3851
|
+
if (s.length === 0)
|
|
3828
3852
|
throw new Error("No order lines found");
|
|
3829
|
-
if (
|
|
3853
|
+
if (r) {
|
|
3830
3854
|
for (const t of u)
|
|
3831
3855
|
if (t.type === _e.PURCHASE_ORDER_UPDATED) {
|
|
3832
|
-
const i = t.data.field, o = t.data.incomingValue, m =
|
|
3833
|
-
o !== m && (
|
|
3834
|
-
...
|
|
3856
|
+
const i = t.data.field, o = t.data.incomingValue, m = r[i];
|
|
3857
|
+
o !== m && (r = {
|
|
3858
|
+
...r,
|
|
3835
3859
|
[i]: o
|
|
3836
3860
|
});
|
|
3837
3861
|
}
|
|
@@ -3841,18 +3865,18 @@ function Yn(r, u, d, c) {
|
|
|
3841
3865
|
_id: (c == null ? void 0 : c._id) ?? d._id,
|
|
3842
3866
|
items: n
|
|
3843
3867
|
};
|
|
3844
|
-
|
|
3845
|
-
...
|
|
3868
|
+
r = {
|
|
3869
|
+
...r,
|
|
3846
3870
|
items: n
|
|
3847
3871
|
};
|
|
3848
3872
|
}
|
|
3849
3873
|
for (const t of u)
|
|
3850
3874
|
switch (t.type) {
|
|
3851
3875
|
case _e.PURCHASE_ORDER_CREATED:
|
|
3852
|
-
const i = new Date(
|
|
3853
|
-
|
|
3876
|
+
const i = new Date(se(d._id)), o = new Date(d.effectiveAt);
|
|
3877
|
+
r = {
|
|
3854
3878
|
...d,
|
|
3855
|
-
_id: d._id ||
|
|
3879
|
+
_id: d._id || O({
|
|
3856
3880
|
prefix: x.Enum.purchaseOrder
|
|
3857
3881
|
}),
|
|
3858
3882
|
effectiveAt: J(i, o) ? void 0 : o.toISOString(),
|
|
@@ -3860,53 +3884,53 @@ function Yn(r, u, d, c) {
|
|
|
3860
3884
|
};
|
|
3861
3885
|
break;
|
|
3862
3886
|
case _e.PURCHASE_ORDER_UPDATED:
|
|
3863
|
-
if (
|
|
3887
|
+
if (r) {
|
|
3864
3888
|
const m = t.data.field, l = t.data.incomingValue;
|
|
3865
|
-
|
|
3866
|
-
...
|
|
3889
|
+
r = {
|
|
3890
|
+
...r,
|
|
3867
3891
|
[m]: l,
|
|
3868
3892
|
items: n
|
|
3869
3893
|
};
|
|
3870
3894
|
}
|
|
3871
3895
|
}
|
|
3872
|
-
return
|
|
3873
|
-
...
|
|
3896
|
+
return r = {
|
|
3897
|
+
...r,
|
|
3874
3898
|
status: d.status,
|
|
3875
3899
|
netSuite: d.netSuite
|
|
3876
|
-
},
|
|
3900
|
+
}, r;
|
|
3877
3901
|
}
|
|
3878
3902
|
g(Yn, "resolvePurchaseOrderConflicts");
|
|
3879
3903
|
var Ae;
|
|
3880
|
-
(function(
|
|
3881
|
-
|
|
3904
|
+
(function(s) {
|
|
3905
|
+
s.UNIT_CREATED = "UNIT_CREATED", s.UNIT_UPDATED = "UNIT_UPDATED", s.UNIT_DELETED = "UNIT_DELETED";
|
|
3882
3906
|
})(Ae || (Ae = {}));
|
|
3883
3907
|
var pe;
|
|
3884
|
-
(function(
|
|
3885
|
-
|
|
3908
|
+
(function(s) {
|
|
3909
|
+
s.UNIT_OF_MEASUREMENT_CREATED = "UNIT_OF_MEASUREMENT_CREATED", s.UNIT_OF_MEASUREMENT_UPDATED = "UNIT_OF_MEASUREMENT_UPDATED", s.UNIT_OF_MEASUREMENT_DELETED = "UNIT_OF_MEASUREMENT_DELETED", s.UNIT_OF_MEASUREMENT_DUPLICATE = "UNIT_OF_MEASUREMENT_DUPLICATE";
|
|
3886
3910
|
})(pe || (pe = {}));
|
|
3887
3911
|
var Jn = 'Record [$] unif of measure on line [$], field "$" changed from "$" to "$"';
|
|
3888
|
-
function Vt(
|
|
3912
|
+
function Vt(s, u) {
|
|
3889
3913
|
const d = Object.keys(Nt.shape), c = [];
|
|
3890
|
-
for (const
|
|
3891
|
-
const n =
|
|
3914
|
+
for (const r of u) {
|
|
3915
|
+
const n = s.measurements.find((t) => t.nsConfig.netSuiteId === r.nsConfig.netSuiteId);
|
|
3892
3916
|
if (!n)
|
|
3893
3917
|
c.push({
|
|
3894
3918
|
type: pe.UNIT_OF_MEASUREMENT_CREATED,
|
|
3895
|
-
message: `NetSuite Measurement ${
|
|
3896
|
-
data:
|
|
3919
|
+
message: `NetSuite Measurement ${r.nsConfig.netSuiteId} does not exist in existing unit ${s.name} ${s.nsConfig.netSuiteId})`,
|
|
3920
|
+
data: r
|
|
3897
3921
|
});
|
|
3898
3922
|
else
|
|
3899
3923
|
for (const t of d) {
|
|
3900
3924
|
if (t === "nsConfig" || t === "id")
|
|
3901
3925
|
continue;
|
|
3902
|
-
const i =
|
|
3903
|
-
if (!
|
|
3926
|
+
const i = r[t] ?? null, o = n[t] ?? null;
|
|
3927
|
+
if (!P.isEqual(i, o)) {
|
|
3904
3928
|
let m = o, l = i;
|
|
3905
3929
|
typeof i == "object" && (m = JSON.stringify(o), l = JSON.stringify(i)), c.push({
|
|
3906
3930
|
type: pe.UNIT_OF_MEASUREMENT_UPDATED,
|
|
3907
|
-
message:
|
|
3931
|
+
message: re(Jn, [
|
|
3908
3932
|
"Unit Of Measure",
|
|
3909
|
-
`${
|
|
3933
|
+
`${r.nsConfig.netSuiteId}`,
|
|
3910
3934
|
t,
|
|
3911
3935
|
`${m}`,
|
|
3912
3936
|
`${l}`
|
|
@@ -3914,47 +3938,47 @@ function Vt(r, u) {
|
|
|
3914
3938
|
data: {
|
|
3915
3939
|
config: n.nsConfig,
|
|
3916
3940
|
field: t,
|
|
3917
|
-
incomingValue:
|
|
3941
|
+
incomingValue: r[t],
|
|
3918
3942
|
existingValue: n[t]
|
|
3919
3943
|
}
|
|
3920
3944
|
});
|
|
3921
3945
|
}
|
|
3922
3946
|
}
|
|
3923
3947
|
}
|
|
3924
|
-
for (const
|
|
3925
|
-
u.find((t) => t.nsConfig.netSuiteId ===
|
|
3948
|
+
for (const r of s.measurements)
|
|
3949
|
+
u.find((t) => t.nsConfig.netSuiteId === r.nsConfig.netSuiteId) || c.push({
|
|
3926
3950
|
type: pe.UNIT_OF_MEASUREMENT_DELETED,
|
|
3927
|
-
message: `Unit Of Measure [${
|
|
3928
|
-
data:
|
|
3951
|
+
message: `Unit Of Measure [${r.nsConfig.netSuiteId}] doesn't exist in incoming units`,
|
|
3952
|
+
data: r
|
|
3929
3953
|
});
|
|
3930
3954
|
return c;
|
|
3931
3955
|
}
|
|
3932
3956
|
g(Vt, "detectUnitOfMeasureConflicts");
|
|
3933
|
-
function Wn(
|
|
3957
|
+
function Wn(s, u) {
|
|
3934
3958
|
const d = [];
|
|
3935
3959
|
if (!u)
|
|
3936
3960
|
d.push({
|
|
3937
3961
|
type: Ae.UNIT_CREATED,
|
|
3938
|
-
message: `Unit type [${
|
|
3939
|
-
data:
|
|
3962
|
+
message: `Unit type [${s.nsConfig.netSuiteId}] config doesn't exist`,
|
|
3963
|
+
data: s
|
|
3940
3964
|
});
|
|
3941
3965
|
else {
|
|
3942
3966
|
const c = Object.keys(At.shape);
|
|
3943
|
-
for (const
|
|
3944
|
-
if (
|
|
3967
|
+
for (const r of c) {
|
|
3968
|
+
if (r === "nsConfig" || r === "_id")
|
|
3945
3969
|
continue;
|
|
3946
|
-
if (
|
|
3947
|
-
d.push(...Vt(u,
|
|
3970
|
+
if (r === "measurements") {
|
|
3971
|
+
d.push(...Vt(u, s.measurements));
|
|
3948
3972
|
continue;
|
|
3949
3973
|
}
|
|
3950
|
-
const n = r
|
|
3951
|
-
if (!
|
|
3974
|
+
const n = s[r] ?? null, t = u[r] ?? null;
|
|
3975
|
+
if (!P.isEqual(n, t)) {
|
|
3952
3976
|
let i = t, o = n;
|
|
3953
3977
|
d.push({
|
|
3954
3978
|
type: Ae.UNIT_UPDATED,
|
|
3955
|
-
message: B("Unit Type",
|
|
3979
|
+
message: B("Unit Type", s.nsConfig.netSuiteId, r, i, o),
|
|
3956
3980
|
data: {
|
|
3957
|
-
field:
|
|
3981
|
+
field: r,
|
|
3958
3982
|
incomingValue: n,
|
|
3959
3983
|
existingValue: t
|
|
3960
3984
|
}
|
|
@@ -3965,29 +3989,29 @@ function Wn(r, u) {
|
|
|
3965
3989
|
return d;
|
|
3966
3990
|
}
|
|
3967
3991
|
g(Wn, "detectUnitTypeConflicts");
|
|
3968
|
-
function Bt(
|
|
3992
|
+
function Bt(s, u) {
|
|
3969
3993
|
if (u.length === 0)
|
|
3970
|
-
return
|
|
3994
|
+
return s;
|
|
3971
3995
|
const d = [
|
|
3972
|
-
...
|
|
3996
|
+
...s
|
|
3973
3997
|
];
|
|
3974
3998
|
for (const c of u) {
|
|
3975
3999
|
if (c.type === pe.UNIT_OF_MEASUREMENT_CREATED && d.push(c.data), c.type === pe.UNIT_OF_MEASUREMENT_UPDATED) {
|
|
3976
|
-
const
|
|
3977
|
-
|
|
4000
|
+
const r = d.findIndex((n) => n.nsConfig.netSuiteId === c.data.config.netSuiteId);
|
|
4001
|
+
r !== -1 && (d[r][c.data.field] = c.data.incomingValue);
|
|
3978
4002
|
}
|
|
3979
4003
|
if (c.type === pe.UNIT_OF_MEASUREMENT_DELETED) {
|
|
3980
|
-
const
|
|
3981
|
-
|
|
4004
|
+
const r = d.findIndex((n) => n.nsConfig.netSuiteId === c.data.nsConfig.netSuiteId);
|
|
4005
|
+
r !== -1 && d.splice(r, 1);
|
|
3982
4006
|
}
|
|
3983
4007
|
}
|
|
3984
4008
|
return d;
|
|
3985
4009
|
}
|
|
3986
4010
|
g(Bt, "resolveUnitOfMeasurementConflicts");
|
|
3987
|
-
function Qn(
|
|
4011
|
+
function Qn(s, u, d) {
|
|
3988
4012
|
let c = d;
|
|
3989
|
-
const
|
|
3990
|
-
for (const n of
|
|
4013
|
+
const r = Bt((d == null ? void 0 : d.measurements) || u.measurements, s);
|
|
4014
|
+
for (const n of s)
|
|
3991
4015
|
switch (n.type) {
|
|
3992
4016
|
case Ae.UNIT_CREATED:
|
|
3993
4017
|
c = u;
|
|
@@ -3997,45 +4021,45 @@ function Qn(r, u, d) {
|
|
|
3997
4021
|
c = {
|
|
3998
4022
|
...c,
|
|
3999
4023
|
[t]: i,
|
|
4000
|
-
measurements:
|
|
4024
|
+
measurements: r
|
|
4001
4025
|
};
|
|
4002
4026
|
break;
|
|
4003
4027
|
default:
|
|
4004
4028
|
c && (c = {
|
|
4005
4029
|
...c,
|
|
4006
|
-
measurements:
|
|
4030
|
+
measurements: r
|
|
4007
4031
|
});
|
|
4008
4032
|
break;
|
|
4009
4033
|
}
|
|
4010
4034
|
return c || {
|
|
4011
4035
|
...u,
|
|
4012
|
-
measurements:
|
|
4036
|
+
measurements: r
|
|
4013
4037
|
};
|
|
4014
4038
|
}
|
|
4015
4039
|
g(Qn, "resolveUnitTypeConflicts");
|
|
4016
4040
|
var be;
|
|
4017
|
-
(function(
|
|
4018
|
-
|
|
4041
|
+
(function(s) {
|
|
4042
|
+
s.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", s.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED";
|
|
4019
4043
|
})(be || (be = {}));
|
|
4020
|
-
function Zn(
|
|
4044
|
+
function Zn(s, u) {
|
|
4021
4045
|
var c;
|
|
4022
4046
|
const d = [];
|
|
4023
4047
|
if (u || d.push({
|
|
4024
4048
|
type: be.PURCHASE_ORDER_CREATED,
|
|
4025
4049
|
message: "Purchase order not found",
|
|
4026
|
-
data:
|
|
4050
|
+
data: s
|
|
4027
4051
|
}), !u)
|
|
4028
|
-
return d.push(...Se(
|
|
4052
|
+
return d.push(...Se(s.items, [], "", "2")), d;
|
|
4029
4053
|
if (u) {
|
|
4030
|
-
const
|
|
4031
|
-
for (const n of
|
|
4054
|
+
const r = Object.keys(et.shape);
|
|
4055
|
+
for (const n of r) {
|
|
4032
4056
|
if (n === "_id" || n === "_rev" || n === "templateDoc" || n === "template" || n === "deliveryFullfillment" || n === "deliveryOrder" || n === "supplier" || n === "seqNumber" || n === "version")
|
|
4033
4057
|
continue;
|
|
4034
4058
|
if (n === "items") {
|
|
4035
|
-
d.push(...Se(
|
|
4059
|
+
d.push(...Se(s.items, u.items, u._id, u.version || "2"));
|
|
4036
4060
|
continue;
|
|
4037
4061
|
}
|
|
4038
|
-
let t =
|
|
4062
|
+
let t = s[n] ?? null;
|
|
4039
4063
|
const i = u[n] ?? null;
|
|
4040
4064
|
if (n === "request") {
|
|
4041
4065
|
const o = t, m = i;
|
|
@@ -4043,10 +4067,10 @@ function Zn(r, u) {
|
|
|
4043
4067
|
continue;
|
|
4044
4068
|
}
|
|
4045
4069
|
if (n === "effectiveAt" && t && typeof t == "string") {
|
|
4046
|
-
const o = new Date(
|
|
4070
|
+
const o = new Date(se(u._id));
|
|
4047
4071
|
J(o, new Date(t)) && (t = null);
|
|
4048
4072
|
}
|
|
4049
|
-
if (!
|
|
4073
|
+
if (!P.isEqual(t, i)) {
|
|
4050
4074
|
let o = i, m = t;
|
|
4051
4075
|
if (t && i && typeof t == "object" && typeof i == "object") {
|
|
4052
4076
|
if (n === "netSuite") {
|
|
@@ -4058,7 +4082,7 @@ function Zn(r, u) {
|
|
|
4058
4082
|
}
|
|
4059
4083
|
if (n === "effectiveAt") {
|
|
4060
4084
|
if (!i) {
|
|
4061
|
-
const l = new Date(
|
|
4085
|
+
const l = new Date(se(u._id));
|
|
4062
4086
|
if (typeof t == "string" && new Date(t).toDateString() === new Date(l).toDateString())
|
|
4063
4087
|
continue;
|
|
4064
4088
|
}
|
|
@@ -4066,7 +4090,7 @@ function Zn(r, u) {
|
|
|
4066
4090
|
}
|
|
4067
4091
|
d.push({
|
|
4068
4092
|
type: be.PURCHASE_ORDER_UPDATED,
|
|
4069
|
-
message: B("Inventory Transfer", (c =
|
|
4093
|
+
message: B("Inventory Transfer", (c = s.netSuite) == null ? void 0 : c.id, n, o, m),
|
|
4070
4094
|
data: {
|
|
4071
4095
|
field: n,
|
|
4072
4096
|
incomingValue: t,
|
|
@@ -4079,34 +4103,34 @@ function Zn(r, u) {
|
|
|
4079
4103
|
return d;
|
|
4080
4104
|
}
|
|
4081
4105
|
g(Zn, "detectInventoryTransferConflicts");
|
|
4082
|
-
function Xn(
|
|
4083
|
-
if (
|
|
4106
|
+
function Xn(s, u, d, c) {
|
|
4107
|
+
if (s.length === 0)
|
|
4084
4108
|
throw new Error("No order lines found");
|
|
4085
|
-
let
|
|
4086
|
-
const n = qe((
|
|
4109
|
+
let r = c;
|
|
4110
|
+
const n = qe((r == null ? void 0 : r.items) || [], u);
|
|
4087
4111
|
if (u.length === 0)
|
|
4088
4112
|
return c;
|
|
4089
|
-
if (
|
|
4113
|
+
if (r) {
|
|
4090
4114
|
for (const t of u)
|
|
4091
4115
|
if (t.type === be.PURCHASE_ORDER_UPDATED) {
|
|
4092
4116
|
const i = t.data.field, o = t.data.incomingValue;
|
|
4093
|
-
|
|
4094
|
-
...
|
|
4117
|
+
r = {
|
|
4118
|
+
...r,
|
|
4095
4119
|
[i]: o
|
|
4096
4120
|
};
|
|
4097
4121
|
}
|
|
4098
|
-
|
|
4099
|
-
...
|
|
4122
|
+
r = {
|
|
4123
|
+
...r,
|
|
4100
4124
|
items: n
|
|
4101
4125
|
};
|
|
4102
4126
|
}
|
|
4103
4127
|
for (const t of u)
|
|
4104
4128
|
switch (t.type) {
|
|
4105
4129
|
case be.PURCHASE_ORDER_CREATED:
|
|
4106
|
-
const i = new Date(
|
|
4107
|
-
|
|
4130
|
+
const i = new Date(se(d._id)), o = new Date(d.effectiveAt);
|
|
4131
|
+
r = {
|
|
4108
4132
|
...d,
|
|
4109
|
-
_id: d._id ||
|
|
4133
|
+
_id: d._id || O({
|
|
4110
4134
|
prefix: x.Enum.purchaseOrder
|
|
4111
4135
|
}),
|
|
4112
4136
|
effectiveAt: J(i, o) ? void 0 : o.toISOString(),
|
|
@@ -4114,28 +4138,28 @@ function Xn(r, u, d, c) {
|
|
|
4114
4138
|
};
|
|
4115
4139
|
break;
|
|
4116
4140
|
case be.PURCHASE_ORDER_UPDATED:
|
|
4117
|
-
if (
|
|
4118
|
-
const m = t.data.field, l = t.data.incomingValue, f =
|
|
4141
|
+
if (r) {
|
|
4142
|
+
const m = t.data.field, l = t.data.incomingValue, f = r[m];
|
|
4119
4143
|
if (m === "version" && l !== f)
|
|
4120
4144
|
continue;
|
|
4121
|
-
|
|
4122
|
-
...
|
|
4145
|
+
r = {
|
|
4146
|
+
...r,
|
|
4123
4147
|
[m]: l
|
|
4124
4148
|
};
|
|
4125
4149
|
}
|
|
4126
4150
|
}
|
|
4127
|
-
return
|
|
4128
|
-
...
|
|
4151
|
+
return r = {
|
|
4152
|
+
...r,
|
|
4129
4153
|
status: d.status,
|
|
4130
4154
|
netSuite: d.netSuite
|
|
4131
|
-
},
|
|
4155
|
+
}, r;
|
|
4132
4156
|
}
|
|
4133
4157
|
g(Xn, "resolveInventoryTransferConflicts");
|
|
4134
4158
|
var K;
|
|
4135
|
-
(function(
|
|
4136
|
-
|
|
4159
|
+
(function(s) {
|
|
4160
|
+
s.INVENTORY_ITEM_CREATED = "INVENTORY_ITEM_CREATED", s.INVENTORY_ITEM_UPDATED = "INVENTORY_ITEM_UPDATED", s.INVENTORY_ITEM_DELETED = "INVENTORY_ITEM_DELETED", s.INVENTORY_ITEM_SKU_UPDATED = "INVENTORY_ITEM_SKU_UPDATED";
|
|
4137
4161
|
})(K || (K = {}));
|
|
4138
|
-
var ei =
|
|
4162
|
+
var ei = Fe.pick({
|
|
4139
4163
|
code: !0,
|
|
4140
4164
|
name: !0,
|
|
4141
4165
|
defaultCost: !0,
|
|
@@ -4153,9 +4177,9 @@ var ei = Re.pick({
|
|
|
4153
4177
|
businessId: !0,
|
|
4154
4178
|
deletedAt: !0
|
|
4155
4179
|
});
|
|
4156
|
-
function ii(
|
|
4157
|
-
const u = [], { incoming: d, current: c } =
|
|
4158
|
-
if (d.itemType !==
|
|
4180
|
+
function ii(s) {
|
|
4181
|
+
const u = [], { incoming: d, current: c } = s;
|
|
4182
|
+
if (d.itemType !== R.Enum.InvtPart)
|
|
4159
4183
|
throw new Error("[detectInventoryChildItemConflicts] only supports InvtPart child items");
|
|
4160
4184
|
if (!c)
|
|
4161
4185
|
return u.push({
|
|
@@ -4163,10 +4187,10 @@ function ii(r) {
|
|
|
4163
4187
|
message: `InvtPart Child Item [${d.netSuiteId}] config doesn't exist`,
|
|
4164
4188
|
data: d
|
|
4165
4189
|
}), u;
|
|
4166
|
-
const
|
|
4167
|
-
for (const n of
|
|
4190
|
+
const r = Object.keys(ni.shape);
|
|
4191
|
+
for (const n of r) {
|
|
4168
4192
|
const t = d[n] ?? null, i = c[n] ?? null;
|
|
4169
|
-
|
|
4193
|
+
P.isEqual(t, i) || u.push({
|
|
4170
4194
|
type: K.INVENTORY_ITEM_UPDATED,
|
|
4171
4195
|
message: B("InvtPart Child Item", d.netSuiteId, n, i, t),
|
|
4172
4196
|
data: {
|
|
@@ -4179,9 +4203,9 @@ function ii(r) {
|
|
|
4179
4203
|
return u;
|
|
4180
4204
|
}
|
|
4181
4205
|
g(ii, "detectInventoryChildItemConflicts");
|
|
4182
|
-
function
|
|
4183
|
-
const u = [], { incoming: d, current: c } =
|
|
4184
|
-
if (d.itemType !==
|
|
4206
|
+
function ri(s) {
|
|
4207
|
+
const u = [], { incoming: d, current: c } = s;
|
|
4208
|
+
if (d.itemType !== R.Enum.InvtPart)
|
|
4185
4209
|
throw new Error("[detectInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
4186
4210
|
if (!c)
|
|
4187
4211
|
return u.push({
|
|
@@ -4189,10 +4213,10 @@ function si(r) {
|
|
|
4189
4213
|
message: `Inventory Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4190
4214
|
data: d
|
|
4191
4215
|
}), u;
|
|
4192
|
-
const
|
|
4193
|
-
for (const t of
|
|
4216
|
+
const r = Object.keys(ti.shape);
|
|
4217
|
+
for (const t of r) {
|
|
4194
4218
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4195
|
-
|
|
4219
|
+
P.isEqual(i, o) || u.push({
|
|
4196
4220
|
type: K.INVENTORY_ITEM_UPDATED,
|
|
4197
4221
|
message: B("Inventory Parent Item", d.netSuiteId, t, o, i),
|
|
4198
4222
|
data: {
|
|
@@ -4205,7 +4229,7 @@ function si(r) {
|
|
|
4205
4229
|
const n = Object.keys(ei.shape);
|
|
4206
4230
|
for (const t of n) {
|
|
4207
4231
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4208
|
-
|
|
4232
|
+
P.isEqual(i, o) || u.push({
|
|
4209
4233
|
type: K.INVENTORY_ITEM_SKU_UPDATED,
|
|
4210
4234
|
message: B("Inventory Parent Item", d.netSuiteId, t, o, i),
|
|
4211
4235
|
data: {
|
|
@@ -4217,55 +4241,55 @@ function si(r) {
|
|
|
4217
4241
|
}
|
|
4218
4242
|
return u;
|
|
4219
4243
|
}
|
|
4220
|
-
g(
|
|
4221
|
-
function
|
|
4222
|
-
if (u.itemType !==
|
|
4244
|
+
g(ri, "detectInventoryParentItemConflicts");
|
|
4245
|
+
function si(s, u, d) {
|
|
4246
|
+
if (u.itemType !== R.Enum.InvtPart)
|
|
4223
4247
|
throw new Error("[resolveInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
4224
|
-
if (
|
|
4248
|
+
if (s.some((n) => n.type === K.INVENTORY_ITEM_CREATED))
|
|
4225
4249
|
return u;
|
|
4226
|
-
let
|
|
4227
|
-
for (const n of
|
|
4250
|
+
let r = d;
|
|
4251
|
+
for (const n of s)
|
|
4228
4252
|
if (n.type === K.INVENTORY_ITEM_UPDATED) {
|
|
4229
4253
|
const t = n.data.field;
|
|
4230
|
-
|
|
4231
|
-
...
|
|
4254
|
+
r = {
|
|
4255
|
+
...r,
|
|
4232
4256
|
[t]: n.data.incomingValue
|
|
4233
4257
|
};
|
|
4234
4258
|
} else if (n.type === K.INVENTORY_ITEM_SKU_UPDATED) {
|
|
4235
4259
|
const t = n.data.field;
|
|
4236
|
-
|
|
4237
|
-
...
|
|
4260
|
+
r = {
|
|
4261
|
+
...r,
|
|
4238
4262
|
skuCache: {
|
|
4239
|
-
...
|
|
4263
|
+
...r.skuCache,
|
|
4240
4264
|
[t]: n.data.incomingValue
|
|
4241
4265
|
}
|
|
4242
4266
|
};
|
|
4243
4267
|
}
|
|
4244
|
-
return
|
|
4268
|
+
return r;
|
|
4245
4269
|
}
|
|
4246
|
-
g(
|
|
4247
|
-
function oi(
|
|
4248
|
-
if (u.itemType !==
|
|
4270
|
+
g(si, "resolveInventoryParentItemConflicts");
|
|
4271
|
+
function oi(s, u, d) {
|
|
4272
|
+
if (u.itemType !== R.Enum.InvtPart)
|
|
4249
4273
|
throw new Error("[resolveInventoryChildItemConflicts] only supports InvtPart child items");
|
|
4250
|
-
if (
|
|
4274
|
+
if (s.some((n) => n.type === K.INVENTORY_ITEM_CREATED))
|
|
4251
4275
|
return u;
|
|
4252
|
-
let
|
|
4253
|
-
for (const n of
|
|
4276
|
+
let r = d;
|
|
4277
|
+
for (const n of s)
|
|
4254
4278
|
if (n.type === K.INVENTORY_ITEM_UPDATED) {
|
|
4255
4279
|
const t = n.data.field;
|
|
4256
|
-
|
|
4257
|
-
...
|
|
4280
|
+
r = {
|
|
4281
|
+
...r,
|
|
4258
4282
|
[t]: n.data.incomingValue
|
|
4259
4283
|
};
|
|
4260
4284
|
}
|
|
4261
|
-
return
|
|
4285
|
+
return r;
|
|
4262
4286
|
}
|
|
4263
4287
|
g(oi, "resolveInventoryChildItemConflicts");
|
|
4264
4288
|
var z;
|
|
4265
|
-
(function(
|
|
4266
|
-
|
|
4289
|
+
(function(s) {
|
|
4290
|
+
s.ASSEMBLY_ITEM_CREATED = "ASSEMBLY_ITEM_CREATED", s.ASSEMBLY_ITEM_UPDATED = "ASSEMBLY_ITEM_UPDATED", s.ASSEMBLY_ITEM_DELETED = "ASSEMBLY_ITEM_DELETED", s.ASSEMBLY_ITEM_SKU_UPDATED = "ASSEMBLY_ITEM_SKU_UPDATED";
|
|
4267
4291
|
})(z || (z = {}));
|
|
4268
|
-
var ai =
|
|
4292
|
+
var ai = Fe.pick({
|
|
4269
4293
|
code: !0,
|
|
4270
4294
|
name: !0,
|
|
4271
4295
|
defaultCost: !0,
|
|
@@ -4283,9 +4307,9 @@ var ai = Re.pick({
|
|
|
4283
4307
|
businessId: !0,
|
|
4284
4308
|
deletedAt: !0
|
|
4285
4309
|
});
|
|
4286
|
-
function ci(
|
|
4287
|
-
const u = [], { incoming: d, current: c } =
|
|
4288
|
-
if (d.itemType !==
|
|
4310
|
+
function ci(s) {
|
|
4311
|
+
const u = [], { incoming: d, current: c } = s;
|
|
4312
|
+
if (d.itemType !== R.Enum.Assembly)
|
|
4289
4313
|
throw new Error("[detectAssemblyChildItemConflicts] only supports Assembly child items");
|
|
4290
4314
|
if (!c)
|
|
4291
4315
|
return u.push({
|
|
@@ -4293,10 +4317,10 @@ function ci(r) {
|
|
|
4293
4317
|
message: `Assembly Child Item [${d.netSuiteId}] config doesn't exist`,
|
|
4294
4318
|
data: d
|
|
4295
4319
|
}), u;
|
|
4296
|
-
const
|
|
4297
|
-
for (const n of
|
|
4320
|
+
const r = Object.keys(di.shape);
|
|
4321
|
+
for (const n of r) {
|
|
4298
4322
|
const t = d[n] ?? null, i = c[n] ?? null;
|
|
4299
|
-
|
|
4323
|
+
P.isEqual(t, i) || u.push({
|
|
4300
4324
|
type: z.ASSEMBLY_ITEM_UPDATED,
|
|
4301
4325
|
message: B("Assembly Child Item", d.netSuiteId, n, i, t),
|
|
4302
4326
|
data: {
|
|
@@ -4309,9 +4333,9 @@ function ci(r) {
|
|
|
4309
4333
|
return u;
|
|
4310
4334
|
}
|
|
4311
4335
|
g(ci, "detectAssemblyChildItemConflicts");
|
|
4312
|
-
function li(
|
|
4313
|
-
const u = [], { incoming: d, current: c } =
|
|
4314
|
-
if (d.itemType !==
|
|
4336
|
+
function li(s) {
|
|
4337
|
+
const u = [], { incoming: d, current: c } = s;
|
|
4338
|
+
if (d.itemType !== R.Enum.Assembly)
|
|
4315
4339
|
throw new Error("[detectAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
4316
4340
|
if (!c)
|
|
4317
4341
|
return u.push({
|
|
@@ -4319,10 +4343,10 @@ function li(r) {
|
|
|
4319
4343
|
message: `Assembly Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4320
4344
|
data: d
|
|
4321
4345
|
}), u;
|
|
4322
|
-
const
|
|
4323
|
-
for (const t of
|
|
4346
|
+
const r = Object.keys(ui.shape);
|
|
4347
|
+
for (const t of r) {
|
|
4324
4348
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4325
|
-
|
|
4349
|
+
P.isEqual(i, o) || u.push({
|
|
4326
4350
|
type: z.ASSEMBLY_ITEM_UPDATED,
|
|
4327
4351
|
message: B("Assembly Parent Item", d.netSuiteId, t, o, i),
|
|
4328
4352
|
data: {
|
|
@@ -4335,7 +4359,7 @@ function li(r) {
|
|
|
4335
4359
|
const n = Object.keys(ai.shape);
|
|
4336
4360
|
for (const t of n) {
|
|
4337
4361
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4338
|
-
|
|
4362
|
+
P.isEqual(i, o) || u.push({
|
|
4339
4363
|
type: z.ASSEMBLY_ITEM_SKU_UPDATED,
|
|
4340
4364
|
message: B("Assembly Parent Item", d.netSuiteId, t, o, i),
|
|
4341
4365
|
data: {
|
|
@@ -4348,54 +4372,54 @@ function li(r) {
|
|
|
4348
4372
|
return u;
|
|
4349
4373
|
}
|
|
4350
4374
|
g(li, "detectAssemblyParentItemConflicts");
|
|
4351
|
-
function mi(
|
|
4352
|
-
if (u.itemType !==
|
|
4375
|
+
function mi(s, u, d) {
|
|
4376
|
+
if (u.itemType !== R.Enum.Assembly)
|
|
4353
4377
|
throw new Error("[resolveAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
4354
|
-
if (
|
|
4378
|
+
if (s.some((n) => n.type === z.ASSEMBLY_ITEM_CREATED))
|
|
4355
4379
|
return u;
|
|
4356
|
-
let
|
|
4357
|
-
for (const n of
|
|
4380
|
+
let r = d;
|
|
4381
|
+
for (const n of s)
|
|
4358
4382
|
if (n.type === z.ASSEMBLY_ITEM_UPDATED) {
|
|
4359
4383
|
const t = n.data.field;
|
|
4360
|
-
|
|
4361
|
-
...
|
|
4384
|
+
r = {
|
|
4385
|
+
...r,
|
|
4362
4386
|
[t]: n.data.incomingValue
|
|
4363
4387
|
};
|
|
4364
4388
|
} else if (n.type === z.ASSEMBLY_ITEM_SKU_UPDATED) {
|
|
4365
4389
|
const t = n.data.field;
|
|
4366
|
-
|
|
4367
|
-
...
|
|
4390
|
+
r = {
|
|
4391
|
+
...r,
|
|
4368
4392
|
skuCache: {
|
|
4369
|
-
...
|
|
4393
|
+
...r.skuCache,
|
|
4370
4394
|
[t]: n.data.incomingValue
|
|
4371
4395
|
}
|
|
4372
4396
|
};
|
|
4373
4397
|
}
|
|
4374
|
-
return
|
|
4398
|
+
return r;
|
|
4375
4399
|
}
|
|
4376
4400
|
g(mi, "resolveAssemblyParentItemConflicts");
|
|
4377
|
-
function fi(
|
|
4378
|
-
if (u.itemType !==
|
|
4401
|
+
function fi(s, u, d) {
|
|
4402
|
+
if (u.itemType !== R.Enum.Assembly)
|
|
4379
4403
|
throw new Error("[resolveAssemblyChildItemConflicts] only supports Assembly child items");
|
|
4380
|
-
if (
|
|
4404
|
+
if (s.some((n) => n.type === z.ASSEMBLY_ITEM_CREATED))
|
|
4381
4405
|
return u;
|
|
4382
|
-
let
|
|
4383
|
-
for (const n of
|
|
4406
|
+
let r = d;
|
|
4407
|
+
for (const n of s)
|
|
4384
4408
|
if (n.type === z.ASSEMBLY_ITEM_UPDATED) {
|
|
4385
4409
|
const t = n.data.field;
|
|
4386
|
-
|
|
4387
|
-
...
|
|
4410
|
+
r = {
|
|
4411
|
+
...r,
|
|
4388
4412
|
[t]: n.data.incomingValue
|
|
4389
4413
|
};
|
|
4390
4414
|
}
|
|
4391
|
-
return
|
|
4415
|
+
return r;
|
|
4392
4416
|
}
|
|
4393
4417
|
g(fi, "resolveAssemblyChildItemConflicts");
|
|
4394
4418
|
var ye;
|
|
4395
|
-
(function(
|
|
4396
|
-
|
|
4419
|
+
(function(s) {
|
|
4420
|
+
s.SERVICE_ITEM_CREATED = "SERVICE_ITEM_CREATED", s.SERVICE_ITEM_UPDATED = "SERVICE_ITEM_UPDATED", s.SERVICE_ITEM_DELETED = "SERVICE_ITEM_DELETED", s.SERVICE_ITEM_SKU_UPDATED = "SERVICE_ITEM_SKU_UPDATED";
|
|
4397
4421
|
})(ye || (ye = {}));
|
|
4398
|
-
var Ii =
|
|
4422
|
+
var Ii = Fe.pick({
|
|
4399
4423
|
code: !0,
|
|
4400
4424
|
name: !0,
|
|
4401
4425
|
defaultCost: !0,
|
|
@@ -4410,9 +4434,9 @@ var Ii = Re.pick({
|
|
|
4410
4434
|
skuCache: !0,
|
|
4411
4435
|
deletedAt: !0
|
|
4412
4436
|
});
|
|
4413
|
-
function yi(
|
|
4414
|
-
const u = [], { incoming: d, current: c } =
|
|
4415
|
-
if (d.itemType !==
|
|
4437
|
+
function yi(s) {
|
|
4438
|
+
const u = [], { incoming: d, current: c } = s;
|
|
4439
|
+
if (d.itemType !== R.Enum.Service)
|
|
4416
4440
|
throw new Error("[detectServiceParentItemConflicts] only supports Service parent items");
|
|
4417
4441
|
if (!c)
|
|
4418
4442
|
return u.push({
|
|
@@ -4420,10 +4444,10 @@ function yi(r) {
|
|
|
4420
4444
|
message: `Service Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4421
4445
|
data: d
|
|
4422
4446
|
}), u;
|
|
4423
|
-
const
|
|
4424
|
-
for (const t of
|
|
4447
|
+
const r = Object.keys(pi.shape);
|
|
4448
|
+
for (const t of r) {
|
|
4425
4449
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4426
|
-
|
|
4450
|
+
P.isEqual(i, o) || u.push({
|
|
4427
4451
|
type: ye.SERVICE_ITEM_UPDATED,
|
|
4428
4452
|
message: B("Service Parent Item", d.netSuiteId, t, o, i),
|
|
4429
4453
|
data: {
|
|
@@ -4436,7 +4460,7 @@ function yi(r) {
|
|
|
4436
4460
|
const n = Object.keys(Ii.shape);
|
|
4437
4461
|
for (const t of n) {
|
|
4438
4462
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4439
|
-
|
|
4463
|
+
P.isEqual(i, o) || u.push({
|
|
4440
4464
|
type: ye.SERVICE_ITEM_SKU_UPDATED,
|
|
4441
4465
|
message: B("Service Parent Item", d.netSuiteId, t, o, i),
|
|
4442
4466
|
data: {
|
|
@@ -4449,89 +4473,89 @@ function yi(r) {
|
|
|
4449
4473
|
return u;
|
|
4450
4474
|
}
|
|
4451
4475
|
g(yi, "detectServiceParentItemConflicts");
|
|
4452
|
-
function gi(
|
|
4476
|
+
function gi(s, u, d) {
|
|
4453
4477
|
var n, t;
|
|
4454
|
-
if (u.itemType !==
|
|
4478
|
+
if (u.itemType !== R.Enum.Service)
|
|
4455
4479
|
throw new Error("[resolveServiceParentItemConflicts] only supports Service parent items");
|
|
4456
|
-
if (
|
|
4480
|
+
if (s.some((i) => i.type === ye.SERVICE_ITEM_CREATED))
|
|
4457
4481
|
return u;
|
|
4458
|
-
let
|
|
4459
|
-
for (const i of
|
|
4482
|
+
let r = d;
|
|
4483
|
+
for (const i of s)
|
|
4460
4484
|
if (i.type === ye.SERVICE_ITEM_UPDATED) {
|
|
4461
4485
|
const o = i.data.field;
|
|
4462
|
-
o === "customFields" ?
|
|
4463
|
-
...
|
|
4486
|
+
o === "customFields" ? r = {
|
|
4487
|
+
...r,
|
|
4464
4488
|
customFields: {
|
|
4465
4489
|
...i.data.incomingValue,
|
|
4466
4490
|
// Always preserve isFulfillable from incoming (transformer always sets it)
|
|
4467
|
-
isFulfillable: ((n = i.data.incomingValue) == null ? void 0 : n.isFulfillable) ?? ((t =
|
|
4491
|
+
isFulfillable: ((n = i.data.incomingValue) == null ? void 0 : n.isFulfillable) ?? ((t = r.customFields) == null ? void 0 : t.isFulfillable) ?? !1
|
|
4468
4492
|
}
|
|
4469
|
-
} :
|
|
4470
|
-
...
|
|
4493
|
+
} : r = {
|
|
4494
|
+
...r,
|
|
4471
4495
|
[o]: i.data.incomingValue
|
|
4472
4496
|
};
|
|
4473
4497
|
} else if (i.type === ye.SERVICE_ITEM_SKU_UPDATED) {
|
|
4474
4498
|
const o = i.data.field;
|
|
4475
|
-
|
|
4476
|
-
...
|
|
4499
|
+
r = {
|
|
4500
|
+
...r,
|
|
4477
4501
|
skuCache: {
|
|
4478
|
-
...
|
|
4502
|
+
...r.skuCache,
|
|
4479
4503
|
[o]: i.data.incomingValue
|
|
4480
4504
|
}
|
|
4481
4505
|
};
|
|
4482
4506
|
}
|
|
4483
|
-
return
|
|
4507
|
+
return r;
|
|
4484
4508
|
}
|
|
4485
4509
|
g(gi, "resolveServiceParentItemConflicts");
|
|
4486
|
-
function Ei(
|
|
4510
|
+
function Ei(s, u, d, c, r) {
|
|
4487
4511
|
const n = {}, t = {};
|
|
4488
4512
|
for (const o of u) {
|
|
4489
|
-
const m = Ee(
|
|
4513
|
+
const m = Ee(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4490
4514
|
n[o.id] = m;
|
|
4491
4515
|
}
|
|
4492
4516
|
for (const o of d) {
|
|
4493
|
-
const m = Ee(
|
|
4517
|
+
const m = Ee(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4494
4518
|
t[o.id] = m;
|
|
4495
4519
|
}
|
|
4496
4520
|
return {
|
|
4497
|
-
orderItemMapping: Ee(
|
|
4521
|
+
orderItemMapping: Ee(r.sku ?? [], r.unit ?? [], c, s.item.items),
|
|
4498
4522
|
orderItemMappingByFulfillment: n,
|
|
4499
4523
|
orderItemMappingByReceipt: t
|
|
4500
4524
|
};
|
|
4501
4525
|
}
|
|
4502
4526
|
g(Ei, "prepareTransferOrderTransformContext");
|
|
4503
|
-
function _i(
|
|
4504
|
-
const
|
|
4527
|
+
function _i(s, u, d, c) {
|
|
4528
|
+
const r = {};
|
|
4505
4529
|
for (const t of u) {
|
|
4506
4530
|
const i = Ee(c.sku ?? [], c.unit ?? [], d, t.item.items);
|
|
4507
|
-
|
|
4531
|
+
r[t.id] = i;
|
|
4508
4532
|
}
|
|
4509
4533
|
return {
|
|
4510
|
-
orderItemMapping: Ee(c.sku ?? [], c.unit ?? [], d,
|
|
4511
|
-
orderItemMappingByReceipt:
|
|
4534
|
+
orderItemMapping: Ee(c.sku ?? [], c.unit ?? [], d, s.item.items),
|
|
4535
|
+
orderItemMappingByReceipt: r
|
|
4512
4536
|
};
|
|
4513
4537
|
}
|
|
4514
4538
|
g(_i, "preparePurchaseOrderTransformContext");
|
|
4515
|
-
function bi(
|
|
4539
|
+
function bi(s, u, d) {
|
|
4516
4540
|
return {
|
|
4517
|
-
orderItemMapping: Ee(d.sku ?? [], d.unit ?? [], u,
|
|
4541
|
+
orderItemMapping: Ee(d.sku ?? [], d.unit ?? [], u, s.inventory.items)
|
|
4518
4542
|
};
|
|
4519
4543
|
}
|
|
4520
4544
|
g(bi, "prepareInventoryTransferTransformContext");
|
|
4521
|
-
function Si(
|
|
4522
|
-
const d =
|
|
4523
|
-
d.version =
|
|
4524
|
-
const c = /* @__PURE__ */ new Set(),
|
|
4545
|
+
function Si(s, u) {
|
|
4546
|
+
const d = s;
|
|
4547
|
+
d.version = ne.Enum[1];
|
|
4548
|
+
const c = /* @__PURE__ */ new Set(), r = [], n = [];
|
|
4525
4549
|
for (const t of d.items) {
|
|
4526
4550
|
c.has(t.sku._id) && n.push(t.sku._id), c.add(t.sku._id);
|
|
4527
4551
|
const i = {
|
|
4528
4552
|
...t
|
|
4529
4553
|
};
|
|
4530
|
-
delete i.id,
|
|
4554
|
+
delete i.id, r.push(i);
|
|
4531
4555
|
}
|
|
4532
4556
|
if (n.length > 0)
|
|
4533
4557
|
throw new Error(`Duplicate SKU found: ${n.join(", ")}`);
|
|
4534
|
-
return d.items =
|
|
4558
|
+
return d.items = r, d.deliveryOrder = d.deliveryOrder.map((t) => {
|
|
4535
4559
|
const i = {
|
|
4536
4560
|
...t
|
|
4537
4561
|
};
|
|
@@ -4560,160 +4584,160 @@ function Si(r, u) {
|
|
|
4560
4584
|
};
|
|
4561
4585
|
}
|
|
4562
4586
|
g(Si, "transformPurchaseOrderToV1");
|
|
4563
|
-
function vi(
|
|
4564
|
-
const d = new Date(
|
|
4587
|
+
function vi(s, u) {
|
|
4588
|
+
const d = new Date(se(s._id));
|
|
4565
4589
|
if (J(d, u)) return !0;
|
|
4566
|
-
const c =
|
|
4590
|
+
const c = s.deliveryFullfillment || [], r = s.deliveryOrder || [];
|
|
4567
4591
|
for (const n of c) {
|
|
4568
4592
|
const t = new Date(n.createdAt);
|
|
4569
4593
|
if (J(t, u)) return !0;
|
|
4570
4594
|
}
|
|
4571
|
-
for (const n of
|
|
4595
|
+
for (const n of r) {
|
|
4572
4596
|
const t = new Date(n.createdAt);
|
|
4573
4597
|
if (J(t, u)) return !0;
|
|
4574
4598
|
}
|
|
4575
4599
|
return !1;
|
|
4576
4600
|
}
|
|
4577
4601
|
g(vi, "shouldSyncOrderByTimestamp");
|
|
4578
|
-
function hi(
|
|
4602
|
+
function hi(s) {
|
|
4579
4603
|
var u, d;
|
|
4580
4604
|
return {
|
|
4581
|
-
name:
|
|
4582
|
-
netSuiteId:
|
|
4583
|
-
itemType:
|
|
4584
|
-
unitTypeId:
|
|
4585
|
-
unitOfMeasureId:
|
|
4586
|
-
subsidiaryIds:
|
|
4587
|
-
includeChildren:
|
|
4588
|
-
externalId:
|
|
4589
|
-
pktCode: ((u =
|
|
4590
|
-
pktName: ((d =
|
|
4605
|
+
name: s.name,
|
|
4606
|
+
netSuiteId: s.netSuiteId,
|
|
4607
|
+
itemType: s.itemType,
|
|
4608
|
+
unitTypeId: s.unitTypeId,
|
|
4609
|
+
unitOfMeasureId: s.unitOfMeasureId,
|
|
4610
|
+
subsidiaryIds: s.subsidiaryIds,
|
|
4611
|
+
includeChildren: s.includeChildren,
|
|
4612
|
+
externalId: s.externalId,
|
|
4613
|
+
pktCode: ((u = s.customFields) == null ? void 0 : u.pktCode) || null,
|
|
4614
|
+
pktName: ((d = s.customFields) == null ? void 0 : d.pktName) || null,
|
|
4591
4615
|
parentNetSuiteId: null,
|
|
4592
|
-
cogsAccount:
|
|
4616
|
+
cogsAccount: s.cogsAccount
|
|
4593
4617
|
};
|
|
4594
4618
|
}
|
|
4595
4619
|
g(hi, "transformParentToFdoNetSuiteItem");
|
|
4596
|
-
function Ti(
|
|
4620
|
+
function Ti(s) {
|
|
4597
4621
|
var u, d;
|
|
4598
4622
|
return {
|
|
4599
|
-
name:
|
|
4600
|
-
netSuiteId:
|
|
4601
|
-
itemType:
|
|
4602
|
-
unitTypeId:
|
|
4603
|
-
unitOfMeasureId:
|
|
4604
|
-
subsidiaryIds:
|
|
4605
|
-
includeChildren:
|
|
4606
|
-
externalId:
|
|
4607
|
-
pktCode: ((u =
|
|
4608
|
-
pktName: ((d =
|
|
4609
|
-
parentNetSuiteId:
|
|
4610
|
-
cogsAccount:
|
|
4623
|
+
name: s.name,
|
|
4624
|
+
netSuiteId: s.netSuiteId,
|
|
4625
|
+
itemType: s.itemType,
|
|
4626
|
+
unitTypeId: s.unitTypeId,
|
|
4627
|
+
unitOfMeasureId: s.unitOfMeasureId,
|
|
4628
|
+
subsidiaryIds: s.subsidiaryIds,
|
|
4629
|
+
includeChildren: s.includeChildren,
|
|
4630
|
+
externalId: s.externalId,
|
|
4631
|
+
pktCode: ((u = s.customFields) == null ? void 0 : u.pktCode) || null,
|
|
4632
|
+
pktName: ((d = s.customFields) == null ? void 0 : d.pktName) || null,
|
|
4633
|
+
parentNetSuiteId: s.parentNetSuiteId,
|
|
4634
|
+
cogsAccount: s.cogsAccount
|
|
4611
4635
|
};
|
|
4612
4636
|
}
|
|
4613
4637
|
g(Ti, "transformChildToFdoNetSuiteItem");
|
|
4614
|
-
const
|
|
4638
|
+
const de = Xt((s, u) => {
|
|
4615
4639
|
const d = we(), c = nn();
|
|
4616
|
-
return u.onError(async (
|
|
4617
|
-
if (
|
|
4640
|
+
return u.onError(async (r) => {
|
|
4641
|
+
if (r instanceof en)
|
|
4618
4642
|
throw c == null || c.open({
|
|
4619
|
-
title:
|
|
4620
|
-
message:
|
|
4643
|
+
title: r.title,
|
|
4644
|
+
message: r.message,
|
|
4621
4645
|
type: "error"
|
|
4622
|
-
}),
|
|
4646
|
+
}), r;
|
|
4623
4647
|
}), {
|
|
4624
4648
|
async readSetting() {
|
|
4625
4649
|
var t;
|
|
4626
|
-
const
|
|
4650
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/v2/settings`;
|
|
4627
4651
|
return await u.get(n);
|
|
4628
4652
|
},
|
|
4629
|
-
async updateLocationConfigs(
|
|
4653
|
+
async updateLocationConfigs(r) {
|
|
4630
4654
|
var i;
|
|
4631
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4632
|
-
return await u.post(t,
|
|
4655
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/settings/update-locations`;
|
|
4656
|
+
return await u.post(t, r);
|
|
4633
4657
|
},
|
|
4634
|
-
async updateSupplierConfigs(
|
|
4658
|
+
async updateSupplierConfigs(r) {
|
|
4635
4659
|
var i;
|
|
4636
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4637
|
-
return await u.post(t,
|
|
4660
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/settings/update-suppliers`;
|
|
4661
|
+
return await u.post(t, r);
|
|
4638
4662
|
},
|
|
4639
4663
|
async getNetSuiteVendorOptions() {
|
|
4640
4664
|
var t;
|
|
4641
|
-
const
|
|
4665
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/v2/vendor/options`;
|
|
4642
4666
|
return await u.get(n);
|
|
4643
4667
|
},
|
|
4644
4668
|
async getNetSuiteLocationOptions() {
|
|
4645
4669
|
var t;
|
|
4646
|
-
const
|
|
4670
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/v2/location/options`;
|
|
4647
4671
|
return await u.get(n);
|
|
4648
4672
|
},
|
|
4649
4673
|
async getNetSuiteLocation() {
|
|
4650
4674
|
var t;
|
|
4651
|
-
const
|
|
4675
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/location/browse`;
|
|
4652
4676
|
return await u.get(n);
|
|
4653
4677
|
},
|
|
4654
|
-
async manualSyncInventoryTransfer(
|
|
4678
|
+
async manualSyncInventoryTransfer(r) {
|
|
4655
4679
|
var i;
|
|
4656
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4680
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/api/${n}/${r}/inventory-transfer-sync`;
|
|
4657
4681
|
return await u.post(t);
|
|
4658
4682
|
},
|
|
4659
|
-
async syncPurchaseOrder(
|
|
4660
|
-
const t = `${
|
|
4683
|
+
async syncPurchaseOrder(r, n) {
|
|
4684
|
+
const t = `${s.netSuiteBackendUrl}/api/${r}/po-sync`;
|
|
4661
4685
|
return await u.post(t, {
|
|
4662
4686
|
purchaseOrderId: n
|
|
4663
4687
|
});
|
|
4664
4688
|
},
|
|
4665
|
-
async getItemAverageCosts(
|
|
4689
|
+
async getItemAverageCosts(r) {
|
|
4666
4690
|
var i;
|
|
4667
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4691
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/inventory-item/${r}/average-cost`;
|
|
4668
4692
|
return await u.post(t);
|
|
4669
4693
|
},
|
|
4670
4694
|
async getAllItemReplicas() {
|
|
4671
4695
|
var t;
|
|
4672
|
-
const
|
|
4696
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/v2/sync/item-replica`;
|
|
4673
4697
|
return await u.get(n);
|
|
4674
4698
|
},
|
|
4675
4699
|
async publishItemsToInventory() {
|
|
4676
4700
|
var t;
|
|
4677
|
-
const
|
|
4701
|
+
const r = ((t = d.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${s.netSuiteBackendUrl}/${r}/v2/sync/publish-items-to-inventory`;
|
|
4678
4702
|
return await u.post(n);
|
|
4679
4703
|
},
|
|
4680
|
-
async createInventoryTransfer(
|
|
4704
|
+
async createInventoryTransfer(r, n) {
|
|
4681
4705
|
var o;
|
|
4682
|
-
const t = ((o = d.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${
|
|
4706
|
+
const t = ((o = d.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${s.netSuiteBackendUrl}/${t}/v2/inventory-transfer/${r}/create`;
|
|
4683
4707
|
return await u.post(i, n);
|
|
4684
4708
|
},
|
|
4685
|
-
async getInventoryTransferHistory(
|
|
4709
|
+
async getInventoryTransferHistory(r, n, t) {
|
|
4686
4710
|
var m;
|
|
4687
|
-
const i = ((m = d.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${
|
|
4711
|
+
const i = ((m = d.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/inventory-transfer/${r}/transfer-out-history`;
|
|
4688
4712
|
return await u.post(o, {
|
|
4689
4713
|
startDate: n == null ? void 0 : n.toISOString(),
|
|
4690
4714
|
endDate: t == null ? void 0 : t.toISOString()
|
|
4691
4715
|
});
|
|
4692
4716
|
},
|
|
4693
|
-
async getSyncLogs(
|
|
4694
|
-
const n = `${
|
|
4717
|
+
async getSyncLogs(r) {
|
|
4718
|
+
const n = `${s.inventoryBackendUrl}/log/query?query=${encodeURIComponent(r)}`;
|
|
4695
4719
|
return await u.get(n);
|
|
4696
4720
|
},
|
|
4697
|
-
async getMoreInfo(
|
|
4721
|
+
async getMoreInfo(r, n) {
|
|
4698
4722
|
var o;
|
|
4699
|
-
const t = ((o = d.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${
|
|
4723
|
+
const t = ((o = d.currentBusiness.value) == null ? void 0 : o._id) ?? "", i = `${s.netSuiteBackendUrl}/api/${t}/${r}/more-info`;
|
|
4700
4724
|
return await u.post(i, {
|
|
4701
4725
|
purchaseOrderId: n
|
|
4702
4726
|
});
|
|
4703
4727
|
},
|
|
4704
|
-
async getChangeLogs(
|
|
4728
|
+
async getChangeLogs(r) {
|
|
4705
4729
|
var i;
|
|
4706
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4730
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/system-note/${r}`;
|
|
4707
4731
|
return await u.post(t, {}, AbortSignal.timeout(6e4));
|
|
4708
4732
|
},
|
|
4709
|
-
async getUnSyncTransferInOrders(
|
|
4733
|
+
async getUnSyncTransferInOrders(r) {
|
|
4710
4734
|
var i;
|
|
4711
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4735
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/transfer-order-cron/unlink-transfer-in/${r}`;
|
|
4712
4736
|
return await u.post(t);
|
|
4713
4737
|
},
|
|
4714
|
-
async manualSyncMultipleTransferInOrders(
|
|
4738
|
+
async manualSyncMultipleTransferInOrders(r) {
|
|
4715
4739
|
var m;
|
|
4716
|
-
const { netsuiteIds: n, version: t } =
|
|
4740
|
+
const { netsuiteIds: n, version: t } = r, i = ((m = d.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/transfer-order/sync-multiple`;
|
|
4717
4741
|
return await u.post(o, {
|
|
4718
4742
|
netsuiteIds: n,
|
|
4719
4743
|
metadata: t ? {
|
|
@@ -4721,14 +4745,14 @@ const ae = Xt((r, u) => {
|
|
|
4721
4745
|
} : void 0
|
|
4722
4746
|
});
|
|
4723
4747
|
},
|
|
4724
|
-
async getUnSyncPurchaseOrders(
|
|
4748
|
+
async getUnSyncPurchaseOrders(r) {
|
|
4725
4749
|
var i;
|
|
4726
|
-
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${
|
|
4750
|
+
const n = ((i = d.currentBusiness.value) == null ? void 0 : i._id) ?? "", t = `${s.netSuiteBackendUrl}/${n}/v2/purchase-order-cron/unlink-purchase-order/${r}`;
|
|
4727
4751
|
return await u.post(t);
|
|
4728
4752
|
},
|
|
4729
|
-
async manualSyncMultiplePurchaseOrders(
|
|
4753
|
+
async manualSyncMultiplePurchaseOrders(r) {
|
|
4730
4754
|
var m;
|
|
4731
|
-
const { netsuiteIds: n, version: t } =
|
|
4755
|
+
const { netsuiteIds: n, version: t } = r, i = ((m = d.currentBusiness.value) == null ? void 0 : m._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/purchase-order/sync-multiple`;
|
|
4732
4756
|
return await u.post(o, {
|
|
4733
4757
|
netsuiteIds: n,
|
|
4734
4758
|
metadata: t ? {
|
|
@@ -4736,15 +4760,15 @@ const ae = Xt((r, u) => {
|
|
|
4736
4760
|
} : void 0
|
|
4737
4761
|
});
|
|
4738
4762
|
},
|
|
4739
|
-
urls:
|
|
4763
|
+
urls: s
|
|
4740
4764
|
};
|
|
4741
|
-
}), Di = { class: "flex flex-col" }, Ci = { class: "text-sm" }, Ni = { class: "text-sm" }, Ai = { class: "text-sm" }, Mi = { class: "flex flex-col gap-2 mt-2" }, Ui = { class: "text-xs" }, ki = { class: "text-xs" }, wi = { class: "text-xs" },
|
|
4765
|
+
}), Di = { class: "flex flex-col" }, Ci = { class: "text-sm" }, Ni = { class: "text-sm" }, Ai = { class: "text-sm" }, Mi = { class: "flex flex-col gap-2 mt-2" }, Ui = { class: "text-xs" }, ki = { class: "text-xs" }, wi = { class: "text-xs" }, Ri = { class: "text-xs" }, Fi = {
|
|
4742
4766
|
key: 0,
|
|
4743
4767
|
class: "text-xs"
|
|
4744
|
-
},
|
|
4768
|
+
}, Pi = {
|
|
4745
4769
|
key: 0,
|
|
4746
4770
|
class: "text-sm text-gray-400"
|
|
4747
|
-
},
|
|
4771
|
+
}, Oi = {
|
|
4748
4772
|
key: 0,
|
|
4749
4773
|
class: "mt-2 flex flex-col"
|
|
4750
4774
|
}, xi = { class: "text-xs text-gray-400" }, Li = { class: "text-xs text-gray-400" }, $i = { class: "text-xs text-gray-400" }, ji = { class: "text-xs text-gray-400" }, Vi = {
|
|
@@ -4753,7 +4777,7 @@ const ae = Xt((r, u) => {
|
|
|
4753
4777
|
}, Bi = {
|
|
4754
4778
|
class: "flex flex-col w-full gap-2",
|
|
4755
4779
|
style: { "margin-left": "15px" }
|
|
4756
|
-
}, qi = { class: "flex flex-col gap-3" }, Hi = /* @__PURE__ */
|
|
4780
|
+
}, qi = { class: "flex flex-col gap-3" }, Hi = /* @__PURE__ */ rn({
|
|
4757
4781
|
__name: "NetSuiteCustomCodeSelection",
|
|
4758
4782
|
props: {
|
|
4759
4783
|
readonly: { type: Boolean },
|
|
@@ -4761,8 +4785,8 @@ const ae = Xt((r, u) => {
|
|
|
4761
4785
|
settingOptions: {}
|
|
4762
4786
|
},
|
|
4763
4787
|
emits: ["update:modelValue"],
|
|
4764
|
-
setup(
|
|
4765
|
-
const d =
|
|
4788
|
+
setup(s, { emit: u }) {
|
|
4789
|
+
const d = s, c = u, r = ze(!1), n = Ie(() => d.sku._id ? i.customFieldOptions[d.sku._id] ?? [] : []), t = ze({
|
|
4766
4790
|
code: "",
|
|
4767
4791
|
name: "",
|
|
4768
4792
|
childName: ""
|
|
@@ -4775,15 +4799,15 @@ const ae = Xt((r, u) => {
|
|
|
4775
4799
|
return `Overwrite with "${f ?? "N/A"}"`;
|
|
4776
4800
|
}
|
|
4777
4801
|
return (f, a) => {
|
|
4778
|
-
const
|
|
4779
|
-
return W(),
|
|
4780
|
-
modelValue:
|
|
4781
|
-
"onUpdate:modelValue": a[4] || (a[4] = (_) =>
|
|
4802
|
+
const I = xe("FmButton"), p = xe("FmLabel"), y = xe("FmSelect"), E = xe("FmDialog");
|
|
4803
|
+
return W(), sn(E, {
|
|
4804
|
+
modelValue: r.value,
|
|
4805
|
+
"onUpdate:modelValue": a[4] || (a[4] = (_) => r.value = _),
|
|
4782
4806
|
overlay: !0,
|
|
4783
4807
|
dismissAway: !0
|
|
4784
4808
|
}, {
|
|
4785
|
-
"dialog-button":
|
|
4786
|
-
|
|
4809
|
+
"dialog-button": oe(() => [
|
|
4810
|
+
ae(I, {
|
|
4787
4811
|
class: "delete-button",
|
|
4788
4812
|
label: "NetSuite",
|
|
4789
4813
|
type: "button",
|
|
@@ -4791,25 +4815,25 @@ const ae = Xt((r, u) => {
|
|
|
4791
4815
|
variant: "secondary",
|
|
4792
4816
|
size: "md",
|
|
4793
4817
|
onClick: a[0] || (a[0] = () => {
|
|
4794
|
-
|
|
4818
|
+
r.value = !0;
|
|
4795
4819
|
})
|
|
4796
4820
|
})
|
|
4797
4821
|
]),
|
|
4798
|
-
"dialog-header":
|
|
4822
|
+
"dialog-header": oe(() => a[5] || (a[5] = [
|
|
4799
4823
|
w("div", null, "NetSuite Custom Info", -1)
|
|
4800
4824
|
])),
|
|
4801
|
-
"dialog-footer":
|
|
4825
|
+
"dialog-footer": oe(() => [
|
|
4802
4826
|
w("div", Bi, [
|
|
4803
|
-
f.readonly ? Ue("", !0) : (W(),
|
|
4827
|
+
f.readonly ? Ue("", !0) : (W(), ue(Le, { key: 0 }, [
|
|
4804
4828
|
a[17] || (a[17] = w("span", { class: "text-sm mb-2 font-bold" }, " This will overwrite the code and uom only.", -1)),
|
|
4805
4829
|
w("div", qi, [
|
|
4806
|
-
|
|
4830
|
+
ae(I, {
|
|
4807
4831
|
class: "sm:w-full xs:w-full",
|
|
4808
4832
|
label: l(t.value.code),
|
|
4809
4833
|
size: "md",
|
|
4810
4834
|
variant: "destructive",
|
|
4811
4835
|
onClick: a[2] || (a[2] = () => {
|
|
4812
|
-
|
|
4836
|
+
r.value = !1;
|
|
4813
4837
|
const _ = d.sku.unit.measurements.find(
|
|
4814
4838
|
(S) => S.id === t.value.fmMeasurementId
|
|
4815
4839
|
);
|
|
@@ -4818,50 +4842,50 @@ const ae = Xt((r, u) => {
|
|
|
4818
4842
|
}, null, 8, ["label"])
|
|
4819
4843
|
])
|
|
4820
4844
|
], 64)),
|
|
4821
|
-
|
|
4845
|
+
ae(I, {
|
|
4822
4846
|
class: "ml-auto sm:w-full xs:w-full",
|
|
4823
4847
|
label: "Close",
|
|
4824
4848
|
size: "md",
|
|
4825
4849
|
variant: "primary",
|
|
4826
|
-
onClick: a[3] || (a[3] = (_) =>
|
|
4850
|
+
onClick: a[3] || (a[3] = (_) => r.value = !1)
|
|
4827
4851
|
})
|
|
4828
4852
|
])
|
|
4829
4853
|
]),
|
|
4830
|
-
default:
|
|
4854
|
+
default: oe(() => [
|
|
4831
4855
|
w("div", null, [
|
|
4832
4856
|
w("div", Di, [
|
|
4833
|
-
|
|
4834
|
-
default:
|
|
4857
|
+
ae(p, null, {
|
|
4858
|
+
default: oe(() => a[6] || (a[6] = [
|
|
4835
4859
|
Q("Code")
|
|
4836
4860
|
])),
|
|
4837
4861
|
_: 1
|
|
4838
4862
|
}),
|
|
4839
4863
|
w("span", Ci, j(f.sku.code), 1),
|
|
4840
|
-
|
|
4841
|
-
default:
|
|
4864
|
+
ae(p, null, {
|
|
4865
|
+
default: oe(() => a[7] || (a[7] = [
|
|
4842
4866
|
Q("Name")
|
|
4843
4867
|
])),
|
|
4844
4868
|
_: 1
|
|
4845
4869
|
}),
|
|
4846
4870
|
w("span", Ni, j(f.sku.name), 1),
|
|
4847
|
-
|
|
4848
|
-
default:
|
|
4871
|
+
ae(p, null, {
|
|
4872
|
+
default: oe(() => a[8] || (a[8] = [
|
|
4849
4873
|
Q("Unit")
|
|
4850
4874
|
])),
|
|
4851
4875
|
_: 1
|
|
4852
4876
|
}),
|
|
4853
4877
|
w("span", Ai, j(f.sku.unit.name), 1)
|
|
4854
4878
|
]),
|
|
4855
|
-
f.readonly ? (W(),
|
|
4879
|
+
f.readonly ? (W(), ue(Le, { key: 0 }, [
|
|
4856
4880
|
a[14] || (a[14] = w("hr", { class: "my-2" }, null, -1)),
|
|
4857
|
-
|
|
4858
|
-
default:
|
|
4881
|
+
ae(p, null, {
|
|
4882
|
+
default: oe(() => a[9] || (a[9] = [
|
|
4859
4883
|
Q("Custom Codes")
|
|
4860
4884
|
])),
|
|
4861
4885
|
_: 1
|
|
4862
4886
|
}),
|
|
4863
4887
|
w("div", Mi, [
|
|
4864
|
-
(W(!0),
|
|
4888
|
+
(W(!0), ue(Le, null, on(n.value, (_, S) => (W(), ue("div", {
|
|
4865
4889
|
key: S,
|
|
4866
4890
|
class: "rounded border-1 flex flex-col p-2"
|
|
4867
4891
|
}, [
|
|
@@ -4877,38 +4901,38 @@ const ae = Xt((r, u) => {
|
|
|
4877
4901
|
a[11] || (a[11] = w("b", null, "Custom name:", -1)),
|
|
4878
4902
|
Q(" " + j(_.value.name), 1)
|
|
4879
4903
|
]),
|
|
4880
|
-
w("span",
|
|
4904
|
+
w("span", Ri, [
|
|
4881
4905
|
a[12] || (a[12] = w("b", null, "UOM:", -1)),
|
|
4882
4906
|
Q(" " + j(_.value.fmMeasurementAbbrev ?? d.sku.unit.abbrev), 1)
|
|
4883
4907
|
]),
|
|
4884
|
-
_.value.remark ? (W(),
|
|
4908
|
+
_.value.remark ? (W(), ue("span", Fi, [
|
|
4885
4909
|
a[13] || (a[13] = w("b", null, "Remark:", -1)),
|
|
4886
4910
|
Q(" " + j(_.value.remark), 1)
|
|
4887
4911
|
])) : Ue("", !0)
|
|
4888
4912
|
]))), 128)),
|
|
4889
|
-
n.value.length === 0 ? (W(),
|
|
4913
|
+
n.value.length === 0 ? (W(), ue("span", Pi, "No custom code found.")) : Ue("", !0)
|
|
4890
4914
|
])
|
|
4891
|
-
], 64)) : (W(),
|
|
4915
|
+
], 64)) : (W(), ue(Le, { key: 1 }, [
|
|
4892
4916
|
a[16] || (a[16] = w("hr", { class: "my-2" }, null, -1)),
|
|
4893
|
-
|
|
4894
|
-
default:
|
|
4917
|
+
ae(p, null, {
|
|
4918
|
+
default: oe(() => a[15] || (a[15] = [
|
|
4895
4919
|
Q("Custom Code")
|
|
4896
4920
|
])),
|
|
4897
4921
|
_: 1
|
|
4898
4922
|
}),
|
|
4899
|
-
|
|
4923
|
+
ae(y, {
|
|
4900
4924
|
modelValue: t.value,
|
|
4901
4925
|
"onUpdate:modelValue": a[1] || (a[1] = (_) => t.value = _),
|
|
4902
4926
|
items: n.value,
|
|
4903
4927
|
placeholder: "Select NetSuite Custom Code",
|
|
4904
4928
|
class: "w-full mt-2"
|
|
4905
4929
|
}, null, 8, ["modelValue", "items"]),
|
|
4906
|
-
t.value ? (W(),
|
|
4930
|
+
t.value ? (W(), ue("div", Oi, [
|
|
4907
4931
|
w("span", xi, "Child Name: " + j(t.value.childName), 1),
|
|
4908
4932
|
w("span", Li, "Custom code (" + j(m.value ? It(ft)(m.value) : "N/A") + "): " + j(t.value.code), 1),
|
|
4909
4933
|
w("span", $i, "Custom name: " + j(t.value.name), 1),
|
|
4910
4934
|
w("span", ji, "UOM: " + j(t.value.fmMeasurementAbbrev ?? d.sku.unit.abbrev), 1),
|
|
4911
|
-
t.value.remark ? (W(),
|
|
4935
|
+
t.value.remark ? (W(), ue("span", Vi, "Remark: " + j(t.value.remark), 1)) : Ue("", !0)
|
|
4912
4936
|
])) : Ue("", !0)
|
|
4913
4937
|
], 64))
|
|
4914
4938
|
])
|
|
@@ -4962,15 +4986,15 @@ function Ki() {
|
|
|
4962
4986
|
}
|
|
4963
4987
|
const T = ze(Ki());
|
|
4964
4988
|
function zi() {
|
|
4965
|
-
const
|
|
4989
|
+
const s = tn(), u = Ie(() => T.value.setting.items.groupBy("netSuiteId", (i) => i.id)), d = Ie(() => T.value.setting.units.flatMap((i) => i.measurements).groupBy("netSuiteId", (i) => i.id)), c = Ie(() => T.value.setting.items.groupBy((i) => i.id)), r = Ie(
|
|
4966
4990
|
() => T.value.setting.units.groupBy(
|
|
4967
4991
|
(i) => i.netSuiteId,
|
|
4968
|
-
(i) =>
|
|
4992
|
+
(i) => s.unitById[i.id]
|
|
4969
4993
|
)
|
|
4970
4994
|
), n = Ie(
|
|
4971
4995
|
() => Gi({
|
|
4972
|
-
units:
|
|
4973
|
-
skus:
|
|
4996
|
+
units: s.unitById,
|
|
4997
|
+
skus: s.skus,
|
|
4974
4998
|
settingOptions: T.value.skuOptions,
|
|
4975
4999
|
customFields: Yi
|
|
4976
5000
|
})
|
|
@@ -4979,7 +5003,7 @@ function zi() {
|
|
|
4979
5003
|
(i) => i.measurements.map((o) => {
|
|
4980
5004
|
var m;
|
|
4981
5005
|
return {
|
|
4982
|
-
unit: (m =
|
|
5006
|
+
unit: (m = r.value.get(i.netSuiteId)) == null ? void 0 : m[0],
|
|
4983
5007
|
measurement: o
|
|
4984
5008
|
};
|
|
4985
5009
|
})
|
|
@@ -4999,27 +5023,27 @@ function zi() {
|
|
|
4999
5023
|
i.beforeStart && await i.beforeStart();
|
|
5000
5024
|
const o = {};
|
|
5001
5025
|
for (let m = 0; m < i.templateItems.length; m++) {
|
|
5002
|
-
const l = i.templateItems[m], f =
|
|
5026
|
+
const l = i.templateItems[m], f = s.skuById[l.sku._id];
|
|
5003
5027
|
if (!f) {
|
|
5004
5028
|
o[m] = "Invalid record. Please remove this row.";
|
|
5005
5029
|
continue;
|
|
5006
5030
|
}
|
|
5007
|
-
if (!
|
|
5031
|
+
if (!P.isEqual(f, l.sku)) {
|
|
5008
5032
|
o[m] = "Record is outdated. Please re-apply the item.";
|
|
5009
5033
|
continue;
|
|
5010
5034
|
}
|
|
5011
5035
|
const a = n.value[f._id];
|
|
5012
5036
|
if (!a)
|
|
5013
5037
|
continue;
|
|
5014
|
-
const
|
|
5038
|
+
const I = l.measurement, p = l.code;
|
|
5015
5039
|
if (!a.find(
|
|
5016
|
-
(E) => E.value.code ===
|
|
5040
|
+
(E) => E.value.code === p && E.value.fmMeasurementId === (I == null ? void 0 : I.id)
|
|
5017
5041
|
)) {
|
|
5018
|
-
if (!
|
|
5019
|
-
o[m] = `Invalid custom code "${
|
|
5042
|
+
if (!I) {
|
|
5043
|
+
o[m] = `Invalid custom code "${p}" for base unit "${f.unit.abbrev}".`;
|
|
5020
5044
|
continue;
|
|
5021
5045
|
}
|
|
5022
|
-
o[m] = `Invalid custom code "${
|
|
5046
|
+
o[m] = `Invalid custom code "${p}" for measurement "${I == null ? void 0 : I.abbrev}".`;
|
|
5023
5047
|
continue;
|
|
5024
5048
|
}
|
|
5025
5049
|
}
|
|
@@ -5030,7 +5054,7 @@ function zi() {
|
|
|
5030
5054
|
0: {
|
|
5031
5055
|
id: "netsuite-verify",
|
|
5032
5056
|
cell: (o) => {
|
|
5033
|
-
const m =
|
|
5057
|
+
const m = s.skuById[o.row.original.sku._id];
|
|
5034
5058
|
return an(Hi, {
|
|
5035
5059
|
sku: m,
|
|
5036
5060
|
settingOptions: T.value.skuOptions,
|
|
@@ -5077,7 +5101,7 @@ function zi() {
|
|
|
5077
5101
|
return c.value;
|
|
5078
5102
|
},
|
|
5079
5103
|
get unitByNetsuiteId() {
|
|
5080
|
-
return
|
|
5104
|
+
return r.value;
|
|
5081
5105
|
},
|
|
5082
5106
|
get measurementByNetsuiteId() {
|
|
5083
5107
|
return t.value;
|
|
@@ -5129,10 +5153,10 @@ function zi() {
|
|
|
5129
5153
|
};
|
|
5130
5154
|
},
|
|
5131
5155
|
currentLocationSubsidiary() {
|
|
5132
|
-
var
|
|
5133
|
-
const i = Me(), o = i.currentLocation.doc._id, m = i.currentLocation.type, l = ((
|
|
5134
|
-
(
|
|
5135
|
-
)) == null ? void 0 :
|
|
5156
|
+
var I;
|
|
5157
|
+
const i = Me(), o = i.currentLocation.doc._id, m = i.currentLocation.type, l = ((I = T.value.setting.locations.find(
|
|
5158
|
+
(p) => p.id === o && p.type == m
|
|
5159
|
+
)) == null ? void 0 : I.subsidiaryId) ?? null, { flat: f } = Z(T.value.setting.subsidiaries), a = f.find((p) => p.id === l);
|
|
5136
5160
|
return {
|
|
5137
5161
|
id: a == null ? void 0 : a.id,
|
|
5138
5162
|
name: (a == null ? void 0 : a.name) || "",
|
|
@@ -5195,50 +5219,50 @@ function zi() {
|
|
|
5195
5219
|
o
|
|
5196
5220
|
);
|
|
5197
5221
|
if (m.includeChildren) {
|
|
5198
|
-
const
|
|
5199
|
-
let y =
|
|
5200
|
-
if (
|
|
5201
|
-
for (const E of
|
|
5222
|
+
const I = T.value.setting.childItems.filter((p) => {
|
|
5223
|
+
let y = p.subsidiaryIds;
|
|
5224
|
+
if (p.includeChildren == !0)
|
|
5225
|
+
for (const E of p.subsidiaryIds)
|
|
5202
5226
|
y = y.concat(f[E]);
|
|
5203
|
-
return y = [...new Set(y)],
|
|
5204
|
-
}).flatMap((
|
|
5205
|
-
return T.value.setting.units.filter((
|
|
5227
|
+
return y = [...new Set(y)], p.parentNetSuiteId === m.netSuiteId && console.log(p), p.parentNetSuiteId === m.netSuiteId && y.some((E) => l.includes(E));
|
|
5228
|
+
}).flatMap((p) => p.unitTypeId);
|
|
5229
|
+
return T.value.setting.units.filter((p) => I.includes(p.netSuiteId)).flatMap((p) => p.measurements).map((p) => p.id);
|
|
5206
5230
|
}
|
|
5207
5231
|
return T.value.setting.units.filter((a) => a.netSuiteId === m.unitTypeId).flatMap((a) => a.measurements).map((a) => a.id);
|
|
5208
5232
|
},
|
|
5209
5233
|
async readSetting() {
|
|
5210
5234
|
var o;
|
|
5211
|
-
const i =
|
|
5235
|
+
const i = de();
|
|
5212
5236
|
try {
|
|
5213
5237
|
const m = await i.readSetting();
|
|
5214
5238
|
if (m) {
|
|
5215
5239
|
if (this.state.setting = m, (o = T.value.setting.subsidiaries) != null && o.length) {
|
|
5216
5240
|
const { flat: f, tree: a } = Z(T.value.setting.subsidiaries);
|
|
5217
|
-
for (const
|
|
5218
|
-
const y = f.find((E) => E.id ===
|
|
5219
|
-
this.state.vendorSubsidiary[
|
|
5241
|
+
for (const p of m.vendors) {
|
|
5242
|
+
const y = f.find((E) => E.id === p.subsidiaryId);
|
|
5243
|
+
this.state.vendorSubsidiary[p.id] = (y == null ? void 0 : y.fullName) || "";
|
|
5220
5244
|
}
|
|
5221
|
-
for (const
|
|
5245
|
+
for (const p of m.items) {
|
|
5222
5246
|
const y = [];
|
|
5223
|
-
for (const _ of
|
|
5247
|
+
for (const _ of p.subsidiaryIds) {
|
|
5224
5248
|
const S = f.find((b) => b.id === _);
|
|
5225
5249
|
S && y.push(S.fullName || "");
|
|
5226
5250
|
}
|
|
5227
5251
|
const E = qt(
|
|
5228
5252
|
a,
|
|
5229
|
-
|
|
5230
|
-
|
|
5253
|
+
p.subsidiaryIds,
|
|
5254
|
+
p.includeChildren
|
|
5231
5255
|
);
|
|
5232
|
-
this.state.skuSubsidiaries[
|
|
5233
|
-
includeChildren:
|
|
5256
|
+
this.state.skuSubsidiaries[p.id] = {
|
|
5257
|
+
includeChildren: p.includeChildren,
|
|
5234
5258
|
flattenedSubsidiaryNames: y,
|
|
5235
5259
|
subsidiaryTree: E
|
|
5236
5260
|
};
|
|
5237
5261
|
}
|
|
5238
|
-
const
|
|
5239
|
-
(
|
|
5262
|
+
const I = f.find(
|
|
5263
|
+
(p) => p.id === T.value.setting.subsidiaryId
|
|
5240
5264
|
);
|
|
5241
|
-
this.state.businessSubsidiaryName = (
|
|
5265
|
+
this.state.businessSubsidiaryName = (I == null ? void 0 : I.fullName) || "";
|
|
5242
5266
|
}
|
|
5243
5267
|
const l = T.value.setting.units.reduce(
|
|
5244
5268
|
(f, a) => (f[a.netSuiteId] = a, f),
|
|
@@ -5248,7 +5272,7 @@ function zi() {
|
|
|
5248
5272
|
(f, a) => (f[a.id] = {
|
|
5249
5273
|
item: a,
|
|
5250
5274
|
childItems: T.value.setting.childItems.filter(
|
|
5251
|
-
(
|
|
5275
|
+
(I) => I.parentNetSuiteId === a.netSuiteId
|
|
5252
5276
|
),
|
|
5253
5277
|
unit: l[a.unitTypeId] || {
|
|
5254
5278
|
id: "ERROR",
|
|
@@ -5272,22 +5296,22 @@ function zi() {
|
|
|
5272
5296
|
}
|
|
5273
5297
|
},
|
|
5274
5298
|
async updateLocationConfigs(i) {
|
|
5275
|
-
const m = await
|
|
5299
|
+
const m = await de().updateLocationConfigs(i);
|
|
5276
5300
|
m && (this.state.setting = m);
|
|
5277
5301
|
},
|
|
5278
5302
|
async updateSupplierConfigs(i) {
|
|
5279
|
-
const m = await
|
|
5303
|
+
const m = await de().updateSupplierConfigs(i);
|
|
5280
5304
|
m && (this.state.setting = m);
|
|
5281
5305
|
},
|
|
5282
5306
|
async getAllItemReplicas() {
|
|
5283
|
-
const i =
|
|
5307
|
+
const i = de();
|
|
5284
5308
|
this.state.itemReplicas = await i.getAllItemReplicas();
|
|
5285
5309
|
},
|
|
5286
5310
|
async getNetSuiteVendorOptions() {
|
|
5287
|
-
return await
|
|
5311
|
+
return await de().getNetSuiteVendorOptions();
|
|
5288
5312
|
},
|
|
5289
5313
|
async getNetSuiteLocations() {
|
|
5290
|
-
const o = await
|
|
5314
|
+
const o = await de().getNetSuiteLocation();
|
|
5291
5315
|
return console.log(o), o;
|
|
5292
5316
|
},
|
|
5293
5317
|
getVendorSubsidiaryName(i) {
|
|
@@ -5301,7 +5325,7 @@ function zi() {
|
|
|
5301
5325
|
};
|
|
5302
5326
|
},
|
|
5303
5327
|
async syncPurchaseOrder(i, o) {
|
|
5304
|
-
const m =
|
|
5328
|
+
const m = de();
|
|
5305
5329
|
let l = o;
|
|
5306
5330
|
if (!l) {
|
|
5307
5331
|
const f = Me(), a = f.currentLocation.doc._id;
|
|
@@ -5310,12 +5334,12 @@ function zi() {
|
|
|
5310
5334
|
await m.syncPurchaseOrder(l, i);
|
|
5311
5335
|
},
|
|
5312
5336
|
getItemCustomCode(i, o) {
|
|
5313
|
-
var
|
|
5314
|
-
const l = `business_${((
|
|
5315
|
-
let
|
|
5337
|
+
var p;
|
|
5338
|
+
const l = `business_${((p = we().currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, f = Be[l].code, a = c.value.get(i._id);
|
|
5339
|
+
let I = null;
|
|
5316
5340
|
if (a && a.length > 0) {
|
|
5317
5341
|
const y = a[0];
|
|
5318
|
-
y[f] && (
|
|
5342
|
+
y[f] && (I = y[f]);
|
|
5319
5343
|
const E = T.value.setting.units.find((S) => {
|
|
5320
5344
|
var b;
|
|
5321
5345
|
return S.id === ((b = i.unit) == null ? void 0 : b._id);
|
|
@@ -5329,41 +5353,41 @@ function zi() {
|
|
|
5329
5353
|
return (N = v.externalId) == null ? void 0 : N.startsWith(U);
|
|
5330
5354
|
})
|
|
5331
5355
|
)[0];
|
|
5332
|
-
k && k[f] && (
|
|
5356
|
+
k && k[f] && (I = k[f]);
|
|
5333
5357
|
}
|
|
5334
5358
|
}
|
|
5335
5359
|
}
|
|
5336
|
-
return
|
|
5360
|
+
return I;
|
|
5337
5361
|
},
|
|
5338
5362
|
async getNetSuiteLocationOptions() {
|
|
5339
|
-
return await
|
|
5363
|
+
return await de().getNetSuiteLocationOptions();
|
|
5340
5364
|
},
|
|
5341
5365
|
async getItemAverageCosts() {
|
|
5342
|
-
const i =
|
|
5366
|
+
const i = de(), m = Me().currentLocation.doc._id;
|
|
5343
5367
|
return await i.getItemAverageCosts(m);
|
|
5344
5368
|
}
|
|
5345
5369
|
};
|
|
5346
5370
|
}
|
|
5347
|
-
function qt(
|
|
5348
|
-
return
|
|
5349
|
-
const
|
|
5350
|
-
return { ...c, children: n, isAssigned:
|
|
5371
|
+
function qt(s, u, d) {
|
|
5372
|
+
return s.map((c) => {
|
|
5373
|
+
const r = u.includes(c.id), n = qt(c.children, u);
|
|
5374
|
+
return { ...c, children: n, isAssigned: r };
|
|
5351
5375
|
}).filter(Boolean);
|
|
5352
5376
|
}
|
|
5353
|
-
function Z(
|
|
5377
|
+
function Z(s, u) {
|
|
5354
5378
|
const d = [], c = [];
|
|
5355
|
-
function
|
|
5356
|
-
return
|
|
5379
|
+
function r(o, m, l = !1) {
|
|
5380
|
+
return s.filter((a) => a.parentId === m).map((a) => ((l || a.id === u || !u) && d.push(a.id), {
|
|
5357
5381
|
id: a.id,
|
|
5358
5382
|
name: a.name,
|
|
5359
5383
|
country: a.country,
|
|
5360
5384
|
currency: a.currency,
|
|
5361
5385
|
parentId: a.parentId,
|
|
5362
5386
|
depth: o,
|
|
5363
|
-
children:
|
|
5387
|
+
children: r(o + 1, a.id, l || a.id === u)
|
|
5364
5388
|
}));
|
|
5365
5389
|
}
|
|
5366
|
-
const n =
|
|
5390
|
+
const n = r(0, null), t = {};
|
|
5367
5391
|
function i(o, m = "") {
|
|
5368
5392
|
const l = o.fullName || o.name, f = m ? `${m} : ${l}` : l;
|
|
5369
5393
|
c.push({ ...o, fullName: f }), t[o.id] = [o.id];
|
|
@@ -5377,14 +5401,14 @@ function Z(r, u) {
|
|
|
5377
5401
|
flatMapping: t
|
|
5378
5402
|
};
|
|
5379
5403
|
}
|
|
5380
|
-
function Gi(
|
|
5404
|
+
function Gi(s) {
|
|
5381
5405
|
function u(i, o, m) {
|
|
5382
5406
|
const l = d[i];
|
|
5383
5407
|
return l(o, m);
|
|
5384
5408
|
}
|
|
5385
|
-
const { customFields: d, skus: c, settingOptions:
|
|
5409
|
+
const { customFields: d, skus: c, settingOptions: r, units: n } = s, t = {};
|
|
5386
5410
|
for (const i of c) {
|
|
5387
|
-
const o =
|
|
5411
|
+
const o = r[i._id], m = u("name", o.item), l = u("code", o.item), f = {
|
|
5388
5412
|
label: `${i.name} (${l})`,
|
|
5389
5413
|
value: {
|
|
5390
5414
|
code: l,
|
|
@@ -5393,16 +5417,16 @@ function Gi(r) {
|
|
|
5393
5417
|
externalId: o.item.externalId || ""
|
|
5394
5418
|
}
|
|
5395
5419
|
}, a = o.childItems.reduce(
|
|
5396
|
-
(
|
|
5397
|
-
const y = u("code", void 0,
|
|
5398
|
-
(v) => v.netSuiteId ===
|
|
5420
|
+
(I, p) => {
|
|
5421
|
+
const y = u("code", void 0, p), E = u("name", void 0, p), _ = o.unit.measurements.find(
|
|
5422
|
+
(v) => v.netSuiteId === p.unitOfMeasureId
|
|
5399
5423
|
);
|
|
5400
5424
|
let S = i.unit.measurements.find((v) => v.id === (_ == null ? void 0 : _.id)), b, h = S == null ? void 0 : S.abbrev;
|
|
5401
5425
|
if (!_) {
|
|
5402
|
-
const v = o.units[
|
|
5426
|
+
const v = o.units[p.unitTypeId];
|
|
5403
5427
|
if (v) {
|
|
5404
5428
|
const U = n[v.id], N = v == null ? void 0 : v.measurements.find(
|
|
5405
|
-
(D) => D.netSuiteId ===
|
|
5429
|
+
(D) => D.netSuiteId === p.unitOfMeasureId
|
|
5406
5430
|
), M = U == null ? void 0 : U.measurements.find(
|
|
5407
5431
|
(D) => D.id === (N == null ? void 0 : N.id)
|
|
5408
5432
|
);
|
|
@@ -5414,19 +5438,19 @@ function Gi(r) {
|
|
|
5414
5438
|
}
|
|
5415
5439
|
}
|
|
5416
5440
|
}
|
|
5417
|
-
const k =
|
|
5418
|
-
return
|
|
5441
|
+
const k = p.name || "N/A (childName not found)";
|
|
5442
|
+
return I.push({
|
|
5419
5443
|
label: `${k} (${y})`,
|
|
5420
5444
|
value: {
|
|
5421
5445
|
code: y,
|
|
5422
5446
|
name: E,
|
|
5423
5447
|
childName: k,
|
|
5424
|
-
externalId:
|
|
5448
|
+
externalId: p.externalId || "N/A (externalId not found)",
|
|
5425
5449
|
fmMeasurementId: S == null ? void 0 : S.id,
|
|
5426
5450
|
fmMeasurementAbbrev: h,
|
|
5427
5451
|
remark: b
|
|
5428
5452
|
}
|
|
5429
|
-
}),
|
|
5453
|
+
}), I;
|
|
5430
5454
|
},
|
|
5431
5455
|
[f]
|
|
5432
5456
|
);
|
|
@@ -5435,20 +5459,20 @@ function Gi(r) {
|
|
|
5435
5459
|
return t;
|
|
5436
5460
|
}
|
|
5437
5461
|
const Yi = {
|
|
5438
|
-
code: (
|
|
5462
|
+
code: (s, u) => {
|
|
5439
5463
|
var n;
|
|
5440
|
-
const c = `business_${((n = we().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`,
|
|
5441
|
-
return
|
|
5464
|
+
const c = `business_${((n = we().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = Be[c].code;
|
|
5465
|
+
return s && s[r] ? s[r] : u && u[r] ? u[r] : "N/A";
|
|
5442
5466
|
},
|
|
5443
|
-
name: (
|
|
5467
|
+
name: (s, u) => {
|
|
5444
5468
|
var n;
|
|
5445
|
-
const c = `business_${((n = we().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`,
|
|
5446
|
-
return
|
|
5469
|
+
const c = `business_${((n = we().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = Be[c].name;
|
|
5470
|
+
return s && s[r] ? s[r] : u && u[r] ? u[r] : "N/A";
|
|
5447
5471
|
}
|
|
5448
5472
|
};
|
|
5449
5473
|
export {
|
|
5450
5474
|
Ge as S,
|
|
5451
5475
|
Hi as _,
|
|
5452
|
-
|
|
5476
|
+
de as a,
|
|
5453
5477
|
zi as u
|
|
5454
5478
|
};
|