@feedmepos/mf-inventory-portal 1.2.44-dev.2 → 1.2.45
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-BO6IVlu7.js → App-rDJK0k1o.js} +3 -3
- package/dist/{ApprovalView-CVX6nsha.js → ApprovalView-D6_NjTMR.js} +5 -5
- package/dist/{BindingsDialog-CvoCVSNi.js → BindingsDialog-DAiNQNr0.js} +2 -2
- package/dist/{BindingsPicker-BgJRr_DM.js → BindingsPicker-CBRzm6R1.js} +2 -2
- package/dist/{BindingsTable-CoXmqfkS.js → BindingsTable-Jg-neO3F.js} +3 -3
- package/dist/{ClosingDraftView-DJOHSc45.js → ClosingDraftView-ChyEiH1o.js} +8 -8
- package/dist/{ClosingHistoryView-D_-BFRz0.js → ClosingHistoryView-DjlGBU5O.js} +3 -3
- package/dist/{ClosingTemplateView-Bk3D5Snj.js → ClosingTemplateView-Bji6A_pC.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-Cb64kpGv.js → DeliveryOrderPrintPreview-D42JLvjd.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DFANhaaJ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-ViI_uhZx.js} +4 -4
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DF_WpezC.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-xXhG-DmK.js} +2 -2
- package/dist/{FmMultiselectDialog-DeHxbT6C.js → FmMultiselectDialog-C3ip4IEJ.js} +1 -1
- package/dist/{FmMultiselectDialog-Cfc5qRdH.js → FmMultiselectDialog-Zg4QAuZ8.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BrCLK3_O.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DIUMW2nw.js} +3 -3
- package/dist/{ImportView-CwTD-Oy5.js → ImportView-Bm8LjiIn.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DLq0PwYt.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CYk23m7h.js} +1 -1
- package/dist/{IngredientGroupView-C9IrJkA2.js → IngredientGroupView-D6Ti6Pu6.js} +5 -5
- package/dist/{IngredientsView-cx05yMa1.js → IngredientsView-D5RxhF62.js} +14 -14
- package/dist/{IntegrationView-DyhKmpP1.js → IntegrationView-B8gVpqpb.js} +338 -336
- package/dist/{InventoryBindingForm-BiPyN399.js → InventoryBindingForm-C74n5-Ip.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B4hiEtLq.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-3Vhr5ODW.js} +4 -4
- package/dist/{InventoryBindingSummary-CLipXxCy.js → InventoryBindingSummary-BTfqeqeu.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-dpwW1B9T.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DcPE6UqX.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CFi82_2z.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DJV-1Tjv.js} +2 -2
- package/dist/{PublishView-xqkAIXWI.js → PublishView-DmBj-unJ.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DQgycOZX.js → PurchaseOrderPrintPreview-BWD392_G.js} +1 -1
- package/dist/{ReceiveRequestView-Bteeg8L4.js → ReceiveRequestView-TfQ1cenb.js} +55 -53
- package/dist/{RecipeView-Wr4d3B_9.js → RecipeView-M4ymed0Q.js} +8 -8
- package/dist/{StockView-CkKpgWUl.js → StockView-C7z4a6QE.js} +15 -15
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DSGGTbPw.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Di029YaN.js} +1 -1
- package/dist/{SupplierView-BK-t2Qtu.js → SupplierView-LEYmhFla.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-D7L13xxB.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DivExDxx.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DWMif1dO.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-C2jmjwOT.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-0tyNbKG0.js → TransferDetails.vue_vue_type_script_setup_true_lang-9uh_SH2T.js} +14 -14
- package/dist/{TransferTemplateView-qIlYcciH.js → TransferTemplateView-1JMSw8-R.js} +15 -15
- package/dist/{UnitView-B5boUZuR.js → UnitView-DJAefgnn.js} +6 -6
- package/dist/{WarehouseView-C3PXZgeW.js → WarehouseView-EsGx7CGP.js} +5 -5
- package/dist/{WastageTemplateView-BfJZ5Heq.js → WastageTemplateView-DBEXUwiT.js} +14 -14
- package/dist/api/netsuite.d.ts +4 -0
- package/dist/{app-IXE7AiJd.js → app-Nk4Y77Qj.js} +7 -7
- package/dist/app.js +1 -1
- package/dist/{closing-template-Bdb3yRUm.js → closing-template-wHoDakzO.js} +1 -1
- package/dist/{date2-FhBpgAsI.js → date2-DD_njicn.js} +1 -1
- package/dist/{dayjs.min-DzvYG-ky.js → dayjs.min-DIAxGyLq.js} +1 -1
- package/dist/{decimal-Io-Hwy_Y.js → decimal-BG_5gQlG.js} +2 -2
- package/dist/{defineDeepModel-D8sQDXuo.js → defineDeepModel-zNL5oQNT.js} +1 -1
- package/dist/{duplicate-template-DnygqbZo.js → duplicate-template-Dc8wYFVp.js} +1 -1
- package/dist/{feature-C4FdNiJm.js → feature-Coz9xh98.js} +279 -277
- package/dist/{format-time-from-id-oJMEPmai.js → format-time-from-id-C348W2sq.js} +1 -1
- package/dist/{format-unit-display-CyyP1TnC.js → format-unit-display-CFvZVBzb.js} +10 -10
- package/dist/{import-export.helper-C33N1h7C.js → import-export.helper-BiQb8N-1.js} +5 -5
- package/dist/{index-DdtrR7II.js → index-C-t3Z7Nq.js} +1 -1
- package/dist/{index-qDt3kqgv.js → index-C5yw1jFl.js} +1 -1
- package/dist/{index-DYfJ9nqH.js → index-De0Df7gB.js} +3 -3
- package/dist/{lodash-DRz5U0Za.js → lodash-COQBllYw.js} +1 -1
- package/dist/{netsuite-CIv-Yh60.js → netsuite-BImilKq9.js} +418 -411
- package/dist/{purchase-order-template-CX62LUzz.js → purchase-order-template-P3Xdw5Wn.js} +1 -1
- package/dist/{rules-DmJTahUJ.js → rules-C08N8B1y.js} +3 -3
- package/dist/{stock-dMNUMGOC.js → stock-BnhLE4SG.js} +1 -1
- package/dist/{stock-BAtpqZgN.js → stock-DC6One3R.js} +3 -3
- package/dist/{supplier-B2g3AW72.js → supplier-BjAFZVCS.js} +2 -2
- package/dist/{use-ingredient-select-dialog-ZyFtPCb9.js → use-ingredient-select-dialog-DO65mpQD.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CRgPd2qi.js → use-inventory-binding-dialog-DOOmS-6l.js} +2 -2
- package/dist/{use-template-enabled-locations-2-S598U0zh.js → use-template-enabled-locations-2-CahQ52Ro.js} +2 -2
- package/dist/{vue-i18n-CoLcy8bm.js → vue-i18n-Da-yf5Lo.js} +378 -378
- package/dist/{xlsx-CtFn9Ikt.js → xlsx-BVMVIxuA.js} +398 -398
- package/dist/{xlsx.util-C5Ug4P4c.js → xlsx.util-Dm__KhD6.js} +1 -1
- package/package.json +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { m as e, Z as Vt, _ as Bt, $ as qt, a0 as Ht, a1 as Ve, a2 as Kt, a3 as Ue, T as qe, a4 as vt, a5 as St, a6 as F, a7 as k, s as A, e as Te, a8 as Pe, B as ee, A as ie, a9 as He, L as j, aa as Tt, N as V, ab as Gt, ac as Yt, ad as Jt, ae as We, af as Qt, o as zt, j as Wt, v as ct, a as Zt, u as Ae } from "./app-
|
|
1
|
+
import { m as e, Z as Vt, _ as Bt, $ as qt, a0 as Ht, a1 as Ve, a2 as Kt, a3 as Ue, T as qe, a4 as vt, a5 as St, a6 as F, a7 as k, s as A, e as Te, a8 as Pe, B as ee, A as ie, a9 as He, L as j, aa as Tt, N as V, ab as Gt, ac as Yt, ad as Jt, ae as We, af as Qt, o as zt, j as Wt, v as ct, a as Zt, u as Ae } from "./app-Nk4Y77Qj.js";
|
|
2
2
|
import { useCoreStore as Oe } from "@feedmepos/mf-common";
|
|
3
3
|
import { useSnackbar as Xt } from "@feedmepos/ui-library";
|
|
4
|
-
import { _ as R } from "./lodash-
|
|
4
|
+
import { _ as R } from "./lodash-COQBllYw.js";
|
|
5
5
|
import { defineComponent as en, ref as Ke, computed as Ie, resolveComponent as Re, openBlock as Q, createBlock as tn, withCtx as re, createVNode as oe, createElementVNode as U, createElementBlock as ae, Fragment as Le, createCommentVNode as Me, createTextVNode as z, toDisplayString as x, renderList as nn, unref as lt, h as sn } from "vue";
|
|
6
|
-
import { u as rn } from "./feature-
|
|
6
|
+
import { u as rn } from "./feature-Coz9xh98.js";
|
|
7
7
|
var on = Object.defineProperty, g = (s, a) => on(s, "name", { value: a, configurable: !0 }), De = "MYR";
|
|
8
8
|
e.enum([
|
|
9
9
|
"custbody_fm_do_id",
|
|
@@ -889,7 +889,7 @@ var mt;
|
|
|
889
889
|
throw new Error(`Missing unit type in NetSuite assembly item ${t.id}`);
|
|
890
890
|
if (o.netSuiteId !== t.unitsType.id)
|
|
891
891
|
throw new Error(`Unit type mismatch for NetSuite assembly item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
892
|
-
const
|
|
892
|
+
const l = t.subsidiary.items.map((h) => h.id), m = F({
|
|
893
893
|
prefix: k.Enum.sku
|
|
894
894
|
}), f = (S = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : S.reduce((h, b) => {
|
|
895
895
|
const N = b.compute(r);
|
|
@@ -915,7 +915,7 @@ var mt;
|
|
|
915
915
|
[b.fieldId]: N
|
|
916
916
|
};
|
|
917
917
|
}, {}), y = t.currency.refName.trim().toUpperCase(), E = t.cost ?? t.lastPurchasePrice, _ = {
|
|
918
|
-
_id:
|
|
918
|
+
_id: m,
|
|
919
919
|
name: t.itemId,
|
|
920
920
|
code: t.id,
|
|
921
921
|
unit: i,
|
|
@@ -946,7 +946,7 @@ var mt;
|
|
|
946
946
|
id: t.cogsAccount.id,
|
|
947
947
|
refName: t.cogsAccount.refName
|
|
948
948
|
} : null,
|
|
949
|
-
subsidiaryIds:
|
|
949
|
+
subsidiaryIds: l,
|
|
950
950
|
includeChildren: t.includeChildren,
|
|
951
951
|
externalId: t.externalId,
|
|
952
952
|
customFields: {
|
|
@@ -962,7 +962,7 @@ var mt;
|
|
|
962
962
|
throw new Error(`Missing unit type in NetSuite assembly child item ${t.id}`);
|
|
963
963
|
if (i.netSuiteId !== t.unitsType.id)
|
|
964
964
|
throw new Error(`Unit type mismatch for NetSuite assembly child item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${i.netSuiteId}`);
|
|
965
|
-
const o = t.subsidiary.items.map((d) => d.id),
|
|
965
|
+
const o = t.subsidiary.items.map((d) => d.id), l = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((d, I) => {
|
|
966
966
|
const p = I.compute(r);
|
|
967
967
|
return {
|
|
968
968
|
...d,
|
|
@@ -985,7 +985,7 @@ var mt;
|
|
|
985
985
|
includeChildren: t.includeChildren,
|
|
986
986
|
externalId: t.externalId,
|
|
987
987
|
customFields: {
|
|
988
|
-
...
|
|
988
|
+
...l
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
991
|
}
|
|
@@ -1013,7 +1013,7 @@ var ft;
|
|
|
1013
1013
|
throw new Error(`Missing unit type in NetSuite inventory item ${t.id}`);
|
|
1014
1014
|
if (o.netSuiteId !== t.unitsType.id)
|
|
1015
1015
|
throw new Error(`Unit type mismatch for NetSuite inventory item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
1016
|
-
const
|
|
1016
|
+
const l = t.subsidiary.items.map((h) => h.id), m = F({
|
|
1017
1017
|
prefix: k.Enum.sku
|
|
1018
1018
|
}), f = (S = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : S.reduce((h, b) => {
|
|
1019
1019
|
const N = b.compute(r);
|
|
@@ -1039,7 +1039,7 @@ var ft;
|
|
|
1039
1039
|
[b.fieldId]: N
|
|
1040
1040
|
};
|
|
1041
1041
|
}, {}), y = t.currency.refName.trim().toUpperCase(), E = t.cost, _ = {
|
|
1042
|
-
_id:
|
|
1042
|
+
_id: m,
|
|
1043
1043
|
name: t.itemId,
|
|
1044
1044
|
code: t.id,
|
|
1045
1045
|
unit: i,
|
|
@@ -1070,7 +1070,7 @@ var ft;
|
|
|
1070
1070
|
id: t.cogsAccount.id,
|
|
1071
1071
|
refName: t.cogsAccount.refName
|
|
1072
1072
|
} : null,
|
|
1073
|
-
subsidiaryIds:
|
|
1073
|
+
subsidiaryIds: l,
|
|
1074
1074
|
includeChildren: t.includeChildren,
|
|
1075
1075
|
externalId: t.externalId,
|
|
1076
1076
|
customFields: {
|
|
@@ -1086,7 +1086,7 @@ var ft;
|
|
|
1086
1086
|
throw new Error(`Missing unit type in NetSuite inventory child item ${t.id}`);
|
|
1087
1087
|
if (i.netSuiteId !== t.unitsType.id)
|
|
1088
1088
|
throw new Error(`Unit type mismatch for NetSuite inventory child item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${i.netSuiteId}`);
|
|
1089
|
-
const o = t.subsidiary.items.map((d) => d.id),
|
|
1089
|
+
const o = t.subsidiary.items.map((d) => d.id), l = (f = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : f.reduce((d, I) => {
|
|
1090
1090
|
const p = I.compute(r);
|
|
1091
1091
|
return {
|
|
1092
1092
|
...d,
|
|
@@ -1109,7 +1109,7 @@ var ft;
|
|
|
1109
1109
|
includeChildren: t.includeChildren,
|
|
1110
1110
|
externalId: t.externalId,
|
|
1111
1111
|
customFields: {
|
|
1112
|
-
...
|
|
1112
|
+
...l
|
|
1113
1113
|
}
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
@@ -1148,9 +1148,9 @@ var te;
|
|
|
1148
1148
|
(function(a) {
|
|
1149
1149
|
function u(n) {
|
|
1150
1150
|
var p;
|
|
1151
|
-
const { poItem: t, nsItemSetting: i, nsUnitTypes: o, overrideCost:
|
|
1151
|
+
const { poItem: t, nsItemSetting: i, nsUnitTypes: o, overrideCost: l = !0, customAttributes: m } = n;
|
|
1152
1152
|
let f;
|
|
1153
|
-
if (
|
|
1153
|
+
if (l && t.totalCost) {
|
|
1154
1154
|
const y = A.divide([
|
|
1155
1155
|
t.totalCost,
|
|
1156
1156
|
t.quantity
|
|
@@ -1175,7 +1175,7 @@ var te;
|
|
|
1175
1175
|
}
|
|
1176
1176
|
} else
|
|
1177
1177
|
d = (p = o.find((y) => y.id == t.sku.unit._id)) == null ? void 0 : p.baseUnitUnitOfMeasureId;
|
|
1178
|
-
const I =
|
|
1178
|
+
const I = m == null ? void 0 : m.reduce((y, E) => {
|
|
1179
1179
|
const _ = E.compute(n, E.extraParams);
|
|
1180
1180
|
return {
|
|
1181
1181
|
...y,
|
|
@@ -1203,20 +1203,20 @@ var te;
|
|
|
1203
1203
|
nsItemSetting: i,
|
|
1204
1204
|
nsUnitTypes: o,
|
|
1205
1205
|
// overrideCost = true,
|
|
1206
|
-
customAttributes:
|
|
1206
|
+
customAttributes: l
|
|
1207
1207
|
} = n;
|
|
1208
|
-
let
|
|
1208
|
+
let m;
|
|
1209
1209
|
if (t.measurement) {
|
|
1210
1210
|
const I = t.measurement.id;
|
|
1211
1211
|
for (const p of o)
|
|
1212
1212
|
for (const y of (p == null ? void 0 : p.measurements) || [])
|
|
1213
1213
|
if (y.id === I) {
|
|
1214
|
-
|
|
1214
|
+
m = y.netSuiteId;
|
|
1215
1215
|
break;
|
|
1216
1216
|
}
|
|
1217
1217
|
} else
|
|
1218
|
-
|
|
1219
|
-
const f =
|
|
1218
|
+
m = (d = o.find((I) => I.id == t.sku.unit._id)) == null ? void 0 : d.baseUnitUnitOfMeasureId;
|
|
1219
|
+
const f = l == null ? void 0 : l.reduce((I, p) => {
|
|
1220
1220
|
const y = p.compute(n, p.extraParams);
|
|
1221
1221
|
return {
|
|
1222
1222
|
...I,
|
|
@@ -1229,7 +1229,7 @@ var te;
|
|
|
1229
1229
|
id: i.netSuiteId
|
|
1230
1230
|
},
|
|
1231
1231
|
unit: {
|
|
1232
|
-
id:
|
|
1232
|
+
id: m
|
|
1233
1233
|
},
|
|
1234
1234
|
quantity: Number(A.toFormatString({
|
|
1235
1235
|
value: t.quantity
|
|
@@ -1244,8 +1244,8 @@ var te;
|
|
|
1244
1244
|
nsItemSetting: i,
|
|
1245
1245
|
nsUnitTypes: o,
|
|
1246
1246
|
// overrideCost = true,
|
|
1247
|
-
customAttributes:
|
|
1248
|
-
nsLocationId:
|
|
1247
|
+
customAttributes: l,
|
|
1248
|
+
nsLocationId: m
|
|
1249
1249
|
} = n;
|
|
1250
1250
|
return {
|
|
1251
1251
|
...s.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
@@ -1253,10 +1253,10 @@ var te;
|
|
|
1253
1253
|
nsItemSetting: i,
|
|
1254
1254
|
nsUnitTypes: o,
|
|
1255
1255
|
// overrideCost,
|
|
1256
|
-
customAttributes:
|
|
1256
|
+
customAttributes: l
|
|
1257
1257
|
}),
|
|
1258
1258
|
location: {
|
|
1259
|
-
id:
|
|
1259
|
+
id: m
|
|
1260
1260
|
}
|
|
1261
1261
|
};
|
|
1262
1262
|
}
|
|
@@ -1264,13 +1264,13 @@ var te;
|
|
|
1264
1264
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
1265
1265
|
function u(r) {
|
|
1266
1266
|
var y, E, _;
|
|
1267
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency:
|
|
1267
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency: l } = r, m = (_ = (E = (y = o == null ? void 0 : o.options) == null ? void 0 : y.purchaseOrderItem) == null ? void 0 : E.customAttributes) == null ? void 0 : _.reduce((v, S) => {
|
|
1268
1268
|
const C = S.compute(r, S.extraParams);
|
|
1269
1269
|
return {
|
|
1270
1270
|
...v,
|
|
1271
1271
|
[S.fieldId]: C
|
|
1272
1272
|
};
|
|
1273
|
-
}, {}), f = A.fromNumber(n.quantity), d = n.amount ? A.fromNumber(n.amount) : A.fromNumber(0), I = Pe.FCurrency.safeParse(
|
|
1273
|
+
}, {}), f = A.fromNumber(n.quantity), d = n.amount ? A.fromNumber(n.amount) : A.fromNumber(0), I = Pe.FCurrency.safeParse(l), p = I.success ? I.data : De;
|
|
1274
1274
|
return {
|
|
1275
1275
|
id: "",
|
|
1276
1276
|
externalId: String(n.line),
|
|
@@ -1287,19 +1287,19 @@ var te;
|
|
|
1287
1287
|
currency: p
|
|
1288
1288
|
},
|
|
1289
1289
|
measurement: i ?? null,
|
|
1290
|
-
...
|
|
1290
|
+
...m
|
|
1291
1291
|
};
|
|
1292
1292
|
}
|
|
1293
1293
|
g(u, "toPurchaseOrderItem"), a.toPurchaseOrderItem = u;
|
|
1294
1294
|
function c(r) {
|
|
1295
1295
|
var _, v, S;
|
|
1296
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost:
|
|
1296
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost: l } = r, { cost: m, currency: f } = et(l, String(n.line), n.item.id), d = (S = (v = (_ = o == null ? void 0 : o.options) == null ? void 0 : _.purchaseOrderReceived) == null ? void 0 : v.customAttributes) == null ? void 0 : S.reduce((C, h) => {
|
|
1297
1297
|
const b = h.compute(r);
|
|
1298
1298
|
return {
|
|
1299
1299
|
...C,
|
|
1300
1300
|
[h.fieldId]: b
|
|
1301
1301
|
};
|
|
1302
|
-
}, {}), I = A.fromNumber(n.quantity), p = A.fromNumber(
|
|
1302
|
+
}, {}), I = A.fromNumber(n.quantity), p = A.fromNumber(m), y = Pe.FCurrency.safeParse(f), E = y.success ? y.data : De;
|
|
1303
1303
|
return {
|
|
1304
1304
|
id: "",
|
|
1305
1305
|
externalId: String(n.orderLine),
|
|
@@ -1340,17 +1340,17 @@ var Ye;
|
|
|
1340
1340
|
(function(s) {
|
|
1341
1341
|
(function(a) {
|
|
1342
1342
|
function u(c, r, n, t) {
|
|
1343
|
-
if (!n.every((
|
|
1343
|
+
if (!n.every((l) => l.externalId))
|
|
1344
1344
|
throw new Error("All purchase order items must have externalId");
|
|
1345
|
-
if (c !== ee.Enum[1] && !t.items.every((
|
|
1345
|
+
if (c !== ee.Enum[1] && !t.items.every((l) => l.id))
|
|
1346
1346
|
throw new Error("All delivery fulfillment items must have id, if not v1");
|
|
1347
|
-
const i = t.items.reduce((
|
|
1348
|
-
for (const
|
|
1349
|
-
const
|
|
1347
|
+
const i = t.items.reduce((l, m) => (c === ee.Enum[1] ? l[m.sku._id] = m : l[m.id] = m, l), {}), o = [];
|
|
1348
|
+
for (const l of n) {
|
|
1349
|
+
const m = Number(l.externalId), f = r.find((I) => I.line === m);
|
|
1350
1350
|
if (!f)
|
|
1351
|
-
throw new Error(`Invalid line id ${
|
|
1351
|
+
throw new Error(`Invalid line id ${l.externalId}`);
|
|
1352
1352
|
let d;
|
|
1353
|
-
c === ee.Enum[1] ? d = i[
|
|
1353
|
+
c === ee.Enum[1] ? d = i[l.sku._id] : d = i[l.id], d ? o.push({
|
|
1354
1354
|
item: {
|
|
1355
1355
|
id: f.item.id
|
|
1356
1356
|
},
|
|
@@ -1358,13 +1358,13 @@ var Ye;
|
|
|
1358
1358
|
quantity: Number(A.toFormatString({
|
|
1359
1359
|
value: d.amount
|
|
1360
1360
|
})),
|
|
1361
|
-
orderLine:
|
|
1361
|
+
orderLine: m + 1
|
|
1362
1362
|
}) : o.push({
|
|
1363
1363
|
item: {
|
|
1364
1364
|
id: f.item.id
|
|
1365
1365
|
},
|
|
1366
1366
|
itemReceive: !1,
|
|
1367
|
-
orderLine:
|
|
1367
|
+
orderLine: m + 1
|
|
1368
1368
|
});
|
|
1369
1369
|
}
|
|
1370
1370
|
return {
|
|
@@ -1377,13 +1377,13 @@ var Ye;
|
|
|
1377
1377
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
1378
1378
|
function u(c, r, n) {
|
|
1379
1379
|
const t = n.item.items.map((o) => {
|
|
1380
|
-
const
|
|
1380
|
+
const l = r[o.line].sku, m = r[o.line].measurement;
|
|
1381
1381
|
return te.FromNetSuite.toPurchaseOrderReceived({
|
|
1382
1382
|
context: c,
|
|
1383
1383
|
glImpactCost: n.glImpacts ?? [],
|
|
1384
1384
|
nsOrderItem: o,
|
|
1385
|
-
sku:
|
|
1386
|
-
measurement:
|
|
1385
|
+
sku: l,
|
|
1386
|
+
measurement: m
|
|
1387
1387
|
});
|
|
1388
1388
|
});
|
|
1389
1389
|
return {
|
|
@@ -1413,9 +1413,9 @@ var xe;
|
|
|
1413
1413
|
(function(s) {
|
|
1414
1414
|
(function(a) {
|
|
1415
1415
|
function u(c, r, n, t, i) {
|
|
1416
|
-
const o = we(new Date(t.effectiveAt ?? t.createdAt)),
|
|
1416
|
+
const o = we(new Date(t.effectiveAt ?? t.createdAt)), l = c.reduce((f, d) => (d.id && (f[d.id] = d), f), {}), m = t.received.map((f) => {
|
|
1417
1417
|
var I;
|
|
1418
|
-
let d = f.id ? (I =
|
|
1418
|
+
let d = f.id ? (I = l[f.id]) == null ? void 0 : I.externalId : void 0;
|
|
1419
1419
|
if (d) {
|
|
1420
1420
|
const p = Number(d);
|
|
1421
1421
|
if (!!isNaN(p))
|
|
@@ -1434,7 +1434,7 @@ var xe;
|
|
|
1434
1434
|
trandate: o,
|
|
1435
1435
|
transferOrderId: r,
|
|
1436
1436
|
itemFulfillmentId: n,
|
|
1437
|
-
items:
|
|
1437
|
+
items: m,
|
|
1438
1438
|
fields: {
|
|
1439
1439
|
custbody_fm_do_id: t.id || "",
|
|
1440
1440
|
custbody_fm_created_by_id: t.createdBy.id,
|
|
@@ -1445,27 +1445,27 @@ var xe;
|
|
|
1445
1445
|
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1446
1446
|
})(s.ToNetSuiteTransferOrder || (s.ToNetSuiteTransferOrder = {})), function(a) {
|
|
1447
1447
|
function u(c, r, n, t) {
|
|
1448
|
-
const i = we(new Date(n.effectiveAt ?? n.createdAt)), o = c.reduce((
|
|
1448
|
+
const i = we(new Date(n.effectiveAt ?? n.createdAt)), o = c.reduce((m, f) => (f.id && (m[f.id] = f), m), {}), l = n.received.map((m) => {
|
|
1449
1449
|
var d;
|
|
1450
|
-
let f =
|
|
1450
|
+
let f = m.id ? (d = o[m.id]) == null ? void 0 : d.externalId : void 0;
|
|
1451
1451
|
if (f) {
|
|
1452
1452
|
const I = Number(f);
|
|
1453
1453
|
if (!!isNaN(I))
|
|
1454
|
-
throw new Error(`Invalid order line number: ${f} for item ID: ${
|
|
1454
|
+
throw new Error(`Invalid order line number: ${f} for item ID: ${m.id}`);
|
|
1455
1455
|
f = I.toString();
|
|
1456
1456
|
}
|
|
1457
1457
|
return {
|
|
1458
1458
|
orderLine: f,
|
|
1459
|
-
itemId: t[
|
|
1459
|
+
itemId: t[m.sku._id],
|
|
1460
1460
|
quantity: Number(A.toFormatString({
|
|
1461
|
-
value:
|
|
1461
|
+
value: m.amount
|
|
1462
1462
|
}))
|
|
1463
1463
|
};
|
|
1464
1464
|
});
|
|
1465
1465
|
return {
|
|
1466
1466
|
trandate: i,
|
|
1467
1467
|
purchaseOrderId: r,
|
|
1468
|
-
items:
|
|
1468
|
+
items: l,
|
|
1469
1469
|
fields: {
|
|
1470
1470
|
custbody_fm_do_id: n.id || "",
|
|
1471
1471
|
custbody_fm_created_by_id: n.createdBy.id,
|
|
@@ -1477,13 +1477,13 @@ var xe;
|
|
|
1477
1477
|
}(s.ToNetSuitePurchaseOrder || (s.ToNetSuitePurchaseOrder = {})), function(a) {
|
|
1478
1478
|
function u(c, r, n) {
|
|
1479
1479
|
var o;
|
|
1480
|
-
const t = n.item.items.map((
|
|
1481
|
-
const
|
|
1480
|
+
const t = n.item.items.map((l) => {
|
|
1481
|
+
const m = r[l.line].sku, f = r[l.line].measurement;
|
|
1482
1482
|
return te.FromNetSuite.toPurchaseOrderReceived({
|
|
1483
1483
|
context: c,
|
|
1484
1484
|
glImpactCost: n.glImpacts ?? [],
|
|
1485
|
-
nsOrderItem:
|
|
1486
|
-
sku:
|
|
1485
|
+
nsOrderItem: l,
|
|
1486
|
+
sku: m,
|
|
1487
1487
|
measurement: f
|
|
1488
1488
|
});
|
|
1489
1489
|
}), i = new Date(n.tranDate);
|
|
@@ -1569,12 +1569,12 @@ function Ut(s, a, u) {
|
|
|
1569
1569
|
w.G
|
|
1570
1570
|
], n = [
|
|
1571
1571
|
w.C
|
|
1572
|
-
], t = Object.keys(w).filter((d) => r.includes(w[d])), i = Object.keys(w).filter((d) => n.includes(w[d])), o = c.find((d) => d.status === "Rejected"),
|
|
1573
|
-
let
|
|
1574
|
-
if (
|
|
1572
|
+
], t = Object.keys(w).filter((d) => r.includes(w[d])), i = Object.keys(w).filter((d) => n.includes(w[d])), o = c.find((d) => d.status === "Rejected"), l = c.find((d) => d.status === "Pending Fulfillment");
|
|
1573
|
+
let m = null, f = null;
|
|
1574
|
+
if (l ? m = new Date(l.datetime) : t.includes(a) && (m = new Date(s)), o ? f = new Date(o.datetime) : i.includes(a) && (f = new Date(s)), m && f)
|
|
1575
1575
|
throw new Error("Both processedAt and rejectedAt are set.");
|
|
1576
1576
|
return {
|
|
1577
|
-
processedAt:
|
|
1577
|
+
processedAt: m ? m.toISOString() : null,
|
|
1578
1578
|
rejectedAt: f ? f.toISOString() : null
|
|
1579
1579
|
};
|
|
1580
1580
|
}
|
|
@@ -1595,7 +1595,7 @@ g(Ot, "transformTransferOrderPreparingShipmentMilestoneFromNetSuite");
|
|
|
1595
1595
|
var pt;
|
|
1596
1596
|
(function(s) {
|
|
1597
1597
|
(function(a) {
|
|
1598
|
-
function u({ setting: n, purchaseOrderRequest: t, status: i = de.enum.A, overrideItemCost: o = !0, customItemAttributes:
|
|
1598
|
+
function u({ setting: n, purchaseOrderRequest: t, status: i = de.enum.A, overrideItemCost: o = !0, customItemAttributes: l, customFields: m }) {
|
|
1599
1599
|
const { purchaseOrder: f } = t;
|
|
1600
1600
|
if (!f)
|
|
1601
1601
|
throw new Error("Purchase order request does not have a purchase order");
|
|
@@ -1608,12 +1608,12 @@ var pt;
|
|
|
1608
1608
|
nsUnitTypes: n.units,
|
|
1609
1609
|
nsItemSetting: E,
|
|
1610
1610
|
overrideCost: o,
|
|
1611
|
-
customAttributes:
|
|
1611
|
+
customAttributes: l
|
|
1612
1612
|
});
|
|
1613
1613
|
}), { netSuiteFromId: I, netSuiteToId: p } = wt(n.locations, t);
|
|
1614
1614
|
return {
|
|
1615
1615
|
// spread user-supplied custom fields (typed as CF)
|
|
1616
|
-
...
|
|
1616
|
+
...m,
|
|
1617
1617
|
location: {
|
|
1618
1618
|
// from location
|
|
1619
1619
|
id: I
|
|
@@ -1636,7 +1636,7 @@ var pt;
|
|
|
1636
1636
|
};
|
|
1637
1637
|
}
|
|
1638
1638
|
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1639
|
-
function c({ setting: n, purchaseOrder: t, overrideItemCost: i, customItemAttributes: o, includeItems:
|
|
1639
|
+
function c({ setting: n, purchaseOrder: t, overrideItemCost: i, customItemAttributes: o, includeItems: l = !1, orderStatus: m, customFields: f }) {
|
|
1640
1640
|
const d = t.items.map((I) => {
|
|
1641
1641
|
const p = n.items.find((y) => y.id === I.sku._id);
|
|
1642
1642
|
return te.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
@@ -1650,8 +1650,8 @@ var pt;
|
|
|
1650
1650
|
return {
|
|
1651
1651
|
// spread user-supplied custom fields (typed as CF)
|
|
1652
1652
|
...f,
|
|
1653
|
-
orderStatus:
|
|
1654
|
-
item:
|
|
1653
|
+
orderStatus: m,
|
|
1654
|
+
item: l ? {
|
|
1655
1655
|
items: d
|
|
1656
1656
|
} : void 0,
|
|
1657
1657
|
// trandate: formatDateYYYYMMDD(new Date(effectiveAt)),
|
|
@@ -1674,7 +1674,7 @@ var pt;
|
|
|
1674
1674
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
1675
1675
|
function u(r) {
|
|
1676
1676
|
var $, Se, ke, st, rt, ot, at, ut, dt;
|
|
1677
|
-
const { fromLocation: n, toLocation: t, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments:
|
|
1677
|
+
const { fromLocation: n, toLocation: t, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: l, orderItemMappingByFulfillment: m, nsItemReceipts: f, orderItemMappingByReceipt: d, context: I, nsSystemNotes: p } = r, y = {
|
|
1678
1678
|
_id: n.doc._id,
|
|
1679
1679
|
internal: n.type,
|
|
1680
1680
|
contactName: n.doc.profile.name,
|
|
@@ -1706,8 +1706,8 @@ var pt;
|
|
|
1706
1706
|
additionalInfo: {
|
|
1707
1707
|
...E
|
|
1708
1708
|
}
|
|
1709
|
-
}, v =
|
|
1710
|
-
const G =
|
|
1709
|
+
}, v = l.map((P) => {
|
|
1710
|
+
const G = m[P.id];
|
|
1711
1711
|
return Ye.FromNetSuite.transform(I, G, P);
|
|
1712
1712
|
}), S = f.map((P) => {
|
|
1713
1713
|
const G = d[P.id];
|
|
@@ -1822,14 +1822,14 @@ g(Ft, "transformPreparingShipmentMilestoneFromNetSuite");
|
|
|
1822
1822
|
var yt;
|
|
1823
1823
|
(function(s) {
|
|
1824
1824
|
(function(a) {
|
|
1825
|
-
function u({ locationDb: n, setting: t, purchaseOrder: i, status: o = X.enum.A, overrideItemCost:
|
|
1825
|
+
function u({ locationDb: n, setting: t, purchaseOrder: i, status: o = X.enum.A, overrideItemCost: l = !0, customItemAttributes: m, customFields: f }) {
|
|
1826
1826
|
const { netSuiteFromId: d, netSuiteToId: I } = Qe(t.locations, t.vendors, n, i.supplier._id), p = i.items.map((y) => {
|
|
1827
1827
|
const E = t.items.find((_) => _.id === y.sku._id);
|
|
1828
1828
|
return te.ToNetSuite.toCreateDto({
|
|
1829
1829
|
poItem: y,
|
|
1830
1830
|
nsUnitTypes: t.units,
|
|
1831
1831
|
nsItemSetting: E,
|
|
1832
|
-
overrideCost:
|
|
1832
|
+
overrideCost: l,
|
|
1833
1833
|
customAttributes: [
|
|
1834
1834
|
{
|
|
1835
1835
|
fieldId: "location",
|
|
@@ -1838,7 +1838,7 @@ var yt;
|
|
|
1838
1838
|
id: v
|
|
1839
1839
|
}), "compute")
|
|
1840
1840
|
},
|
|
1841
|
-
...
|
|
1841
|
+
...m || []
|
|
1842
1842
|
]
|
|
1843
1843
|
});
|
|
1844
1844
|
});
|
|
@@ -1867,7 +1867,7 @@ var yt;
|
|
|
1867
1867
|
};
|
|
1868
1868
|
}
|
|
1869
1869
|
g(u, "toCreateDto"), a.toCreateDto = u;
|
|
1870
|
-
function c({ locationDb: n, setting: t, purchaseOrder: i, overrideItemCost: o, customItemAttributes:
|
|
1870
|
+
function c({ locationDb: n, setting: t, purchaseOrder: i, overrideItemCost: o, customItemAttributes: l, includeItems: m = !1, customFields: f }) {
|
|
1871
1871
|
const { netSuiteToId: d } = Qe(t.locations, t.vendors, n, i.supplier._id);
|
|
1872
1872
|
i != null && i.effectiveAt || ie(i._id);
|
|
1873
1873
|
const I = i.items.map((p) => {
|
|
@@ -1878,12 +1878,12 @@ var yt;
|
|
|
1878
1878
|
nsUnitTypes: t.units,
|
|
1879
1879
|
nsItemSetting: y,
|
|
1880
1880
|
overrideCost: o,
|
|
1881
|
-
customAttributes:
|
|
1881
|
+
customAttributes: l
|
|
1882
1882
|
});
|
|
1883
1883
|
});
|
|
1884
1884
|
return {
|
|
1885
1885
|
...f,
|
|
1886
|
-
item:
|
|
1886
|
+
item: m ? {
|
|
1887
1887
|
items: I
|
|
1888
1888
|
} : void 0,
|
|
1889
1889
|
// trandate: formatDateYYYYMMDD(new Date(effectiveAt)),
|
|
@@ -1903,7 +1903,7 @@ var yt;
|
|
|
1903
1903
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
1904
1904
|
function u(c) {
|
|
1905
1905
|
var b, N, O, L, M, B, fe, Fe, ve;
|
|
1906
|
-
const { vendor: r, nsPurchaseOrder: n, orderItemMapping: t, nsItemReceipts: i, orderItemMappingByReceipt: o, context:
|
|
1906
|
+
const { vendor: r, nsPurchaseOrder: n, orderItemMapping: t, nsItemReceipts: i, orderItemMappingByReceipt: o, context: l } = c, m = {
|
|
1907
1907
|
_id: r._id,
|
|
1908
1908
|
contactName: r.contactName,
|
|
1909
1909
|
name: r.name ?? "",
|
|
@@ -1918,7 +1918,7 @@ var yt;
|
|
|
1918
1918
|
country: ((M = r.address) == null ? void 0 : M.country) || "",
|
|
1919
1919
|
postcode: ((B = r.address) == null ? void 0 : B.postcode) || ""
|
|
1920
1920
|
}
|
|
1921
|
-
}, f = (ve = (Fe = (fe =
|
|
1921
|
+
}, f = (ve = (Fe = (fe = l.options) == null ? void 0 : fe.netSuite) == null ? void 0 : Fe.additionalInfo) == null ? void 0 : ve.reduce((se, $) => {
|
|
1922
1922
|
const Se = $.compute(c, $.extraParams);
|
|
1923
1923
|
return {
|
|
1924
1924
|
...se,
|
|
@@ -1936,7 +1936,7 @@ var yt;
|
|
|
1936
1936
|
}
|
|
1937
1937
|
}, I = i.map((se) => {
|
|
1938
1938
|
const $ = o[se.id];
|
|
1939
|
-
return xe.FromNetSuite.transform(
|
|
1939
|
+
return xe.FromNetSuite.transform(l, $, se);
|
|
1940
1940
|
}), p = n.item.items.reduce((se, $) => {
|
|
1941
1941
|
if ($.itemType.id === "Service")
|
|
1942
1942
|
return console.log(`Skipping service type item with line ${$.line} in purchase order ${n.tranId}`), se;
|
|
@@ -1947,7 +1947,7 @@ var yt;
|
|
|
1947
1947
|
sku: Se,
|
|
1948
1948
|
glImpactCost: [],
|
|
1949
1949
|
measurement: ke,
|
|
1950
|
-
context:
|
|
1950
|
+
context: l
|
|
1951
1951
|
})), se;
|
|
1952
1952
|
}, []), y = new Date(n.createdDate), [E, _, v] = n.tranDate.split("-"), S = new Date(Number(E), Number(_) - 1, Number(v)), C = Ft(n);
|
|
1953
1953
|
return {
|
|
@@ -1958,7 +1958,7 @@ var yt;
|
|
|
1958
1958
|
}),
|
|
1959
1959
|
version: "2",
|
|
1960
1960
|
status: Mt(n.orderStatus),
|
|
1961
|
-
supplier:
|
|
1961
|
+
supplier: m,
|
|
1962
1962
|
seqNumber: parseInt(`${n.custbody_fm_po_num ?? "0"}`),
|
|
1963
1963
|
items: p,
|
|
1964
1964
|
effectiveAt: S.toISOString(),
|
|
@@ -1975,8 +1975,8 @@ var yt;
|
|
|
1975
1975
|
function Qe(s, a, u, c) {
|
|
1976
1976
|
var t, i;
|
|
1977
1977
|
const r = (t = a.find((o) => o.id === c)) == null ? void 0 : t.netSuiteId, n = (i = s.find((o) => {
|
|
1978
|
-
const [
|
|
1979
|
-
return o.id ===
|
|
1978
|
+
const [l, m] = u.split("_");
|
|
1979
|
+
return o.id === m && o.type === l;
|
|
1980
1980
|
})) == null ? void 0 : i.netSuiteId;
|
|
1981
1981
|
if (!r || !n || r === n)
|
|
1982
1982
|
throw new Error("Invalid location");
|
|
@@ -2027,27 +2027,27 @@ var gt;
|
|
|
2027
2027
|
measurements: []
|
|
2028
2028
|
};
|
|
2029
2029
|
let o;
|
|
2030
|
-
const
|
|
2030
|
+
const l = [], m = [];
|
|
2031
2031
|
for (const d of n) {
|
|
2032
2032
|
if (d.baseUnit == !0) {
|
|
2033
2033
|
i.name = `${c.name} (${d.unitName})`, i.abbrev = d.abbreviation, o = String(d.internalId);
|
|
2034
2034
|
continue;
|
|
2035
2035
|
}
|
|
2036
2036
|
const I = ze.FromNetsuite.transform(d);
|
|
2037
|
-
|
|
2037
|
+
m.push(I), l.push(I.nsConfig);
|
|
2038
2038
|
}
|
|
2039
|
-
if (i.measurements =
|
|
2039
|
+
if (i.measurements = m, o === void 0)
|
|
2040
2040
|
throw new Error("Base unit not found");
|
|
2041
2041
|
const f = {
|
|
2042
2042
|
id: t,
|
|
2043
2043
|
netSuiteId: String(c.id),
|
|
2044
2044
|
baseUnitUnitOfMeasureId: o,
|
|
2045
|
-
measurements:
|
|
2045
|
+
measurements: l
|
|
2046
2046
|
};
|
|
2047
2047
|
return {
|
|
2048
2048
|
...i,
|
|
2049
2049
|
nsConfig: f,
|
|
2050
|
-
measurements:
|
|
2050
|
+
measurements: m
|
|
2051
2051
|
};
|
|
2052
2052
|
}
|
|
2053
2053
|
g(u, "transform"), a.transform = u;
|
|
@@ -2126,10 +2126,10 @@ function tt(s, a) {
|
|
|
2126
2126
|
throw new Error(`Duplicate externalId found in poItems: ${i}`);
|
|
2127
2127
|
if (c.add(i), !o || r.has(o)) {
|
|
2128
2128
|
if (o || console.warn(`Missing id found in poItems for externalId: ${i}, generating a new id.`), o && r.has(o)) {
|
|
2129
|
-
let
|
|
2130
|
-
Object.entries(u).forEach(([
|
|
2131
|
-
f === o && (
|
|
2132
|
-
}), console.warn(`Duplicate id for both externalIds: ${i} and ${
|
|
2129
|
+
let l;
|
|
2130
|
+
Object.entries(u).forEach(([m, f]) => {
|
|
2131
|
+
f === o && (l = m);
|
|
2132
|
+
}), console.warn(`Duplicate id for both externalIds: ${i} and ${l}, generating a new id.`);
|
|
2133
2133
|
}
|
|
2134
2134
|
o = crypto.randomUUID();
|
|
2135
2135
|
}
|
|
@@ -2145,8 +2145,8 @@ function tt(s, a) {
|
|
|
2145
2145
|
}
|
|
2146
2146
|
g(tt, "mapOrderLineId");
|
|
2147
2147
|
function Dn(s, a, u, c, r) {
|
|
2148
|
-
var
|
|
2149
|
-
const n = u.some((d) => d.id), t = tt(a, u), i = [], o = c,
|
|
2148
|
+
var m, f;
|
|
2149
|
+
const n = u.some((d) => d.id), t = tt(a, u), i = [], o = c, l = [
|
|
2150
2150
|
...r || []
|
|
2151
2151
|
];
|
|
2152
2152
|
for (const d of u) {
|
|
@@ -2164,7 +2164,7 @@ function Dn(s, a, u, c, r) {
|
|
|
2164
2164
|
p.push(y);
|
|
2165
2165
|
continue;
|
|
2166
2166
|
}
|
|
2167
|
-
const _ = (
|
|
2167
|
+
const _ = (m = a.find((C) => C.lineid === E)) == null ? void 0 : m.transferorderitemlineid, v = n && _ ? t[_] : void 0, S = {
|
|
2168
2168
|
...y,
|
|
2169
2169
|
id: v
|
|
2170
2170
|
};
|
|
@@ -2177,9 +2177,9 @@ function Dn(s, a, u, c, r) {
|
|
|
2177
2177
|
received: p
|
|
2178
2178
|
};
|
|
2179
2179
|
}
|
|
2180
|
-
if (
|
|
2181
|
-
for (let d = 0; d <
|
|
2182
|
-
const I =
|
|
2180
|
+
if (l)
|
|
2181
|
+
for (let d = 0; d < l.length; d++) {
|
|
2182
|
+
const I = l[d], p = [];
|
|
2183
2183
|
for (const y of I.items) {
|
|
2184
2184
|
const E = y.externalId;
|
|
2185
2185
|
if (!E) {
|
|
@@ -2194,7 +2194,7 @@ function Dn(s, a, u, c, r) {
|
|
|
2194
2194
|
throw new Error(`Cannot find mapped item ID for order external id ${E} in delivery fulfillment`);
|
|
2195
2195
|
p.push(S);
|
|
2196
2196
|
}
|
|
2197
|
-
|
|
2197
|
+
l[d] = {
|
|
2198
2198
|
...I,
|
|
2199
2199
|
items: p
|
|
2200
2200
|
};
|
|
@@ -2202,7 +2202,7 @@ function Dn(s, a, u, c, r) {
|
|
|
2202
2202
|
return {
|
|
2203
2203
|
alignedPOItems: i,
|
|
2204
2204
|
alignedDeliveryOrders: o,
|
|
2205
|
-
alignedDeliveryFulfillments:
|
|
2205
|
+
alignedDeliveryFulfillments: l
|
|
2206
2206
|
};
|
|
2207
2207
|
}
|
|
2208
2208
|
g(Dn, "alignItemLineIdsAcrossDocuments");
|
|
@@ -2216,17 +2216,17 @@ function Nn(s, a, u) {
|
|
|
2216
2216
|
});
|
|
2217
2217
|
}
|
|
2218
2218
|
for (let i = 0; i < t.length; i++) {
|
|
2219
|
-
const o = t[i],
|
|
2220
|
-
for (const
|
|
2221
|
-
const f =
|
|
2222
|
-
|
|
2223
|
-
...
|
|
2219
|
+
const o = t[i], l = [];
|
|
2220
|
+
for (const m of o.received) {
|
|
2221
|
+
const f = m.externalId, d = a.find((I) => I.externalId === f).id;
|
|
2222
|
+
l.push({
|
|
2223
|
+
...m,
|
|
2224
2224
|
id: d
|
|
2225
2225
|
});
|
|
2226
2226
|
}
|
|
2227
2227
|
t[i] = {
|
|
2228
2228
|
...o,
|
|
2229
|
-
received:
|
|
2229
|
+
received: l
|
|
2230
2230
|
};
|
|
2231
2231
|
}
|
|
2232
2232
|
return {
|
|
@@ -2242,15 +2242,15 @@ var ce;
|
|
|
2242
2242
|
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } = r;
|
|
2243
2243
|
let o;
|
|
2244
2244
|
if (n.measurement) {
|
|
2245
|
-
const
|
|
2246
|
-
for (const
|
|
2247
|
-
for (const f of (
|
|
2248
|
-
if (f.id ===
|
|
2245
|
+
const l = n.measurement.id;
|
|
2246
|
+
for (const m of t)
|
|
2247
|
+
for (const f of (m == null ? void 0 : m.measurements) || [])
|
|
2248
|
+
if (f.id === l) {
|
|
2249
2249
|
o = f.netSuiteId;
|
|
2250
2250
|
break;
|
|
2251
2251
|
}
|
|
2252
2252
|
} else
|
|
2253
|
-
o = t.find((
|
|
2253
|
+
o = t.find((l) => l.id == n.sku.unit._id).baseUnitUnitOfMeasureId;
|
|
2254
2254
|
return {
|
|
2255
2255
|
item: {
|
|
2256
2256
|
id: i.netSuiteId
|
|
@@ -2266,15 +2266,15 @@ var ce;
|
|
|
2266
2266
|
const { orderItem: n, nsUnitTypes: t, nsItemSetting: i } = r;
|
|
2267
2267
|
let o;
|
|
2268
2268
|
if (n.measurement) {
|
|
2269
|
-
const
|
|
2270
|
-
for (const
|
|
2271
|
-
for (const f of (
|
|
2272
|
-
if (f.id ===
|
|
2269
|
+
const l = n.measurement.id;
|
|
2270
|
+
for (const m of t)
|
|
2271
|
+
for (const f of (m == null ? void 0 : m.measurements) || [])
|
|
2272
|
+
if (f.id === l) {
|
|
2273
2273
|
o = f.netSuiteId;
|
|
2274
2274
|
break;
|
|
2275
2275
|
}
|
|
2276
2276
|
} else
|
|
2277
|
-
o = t.find((
|
|
2277
|
+
o = t.find((l) => l.id == n.sku.unit._id).baseUnitUnitOfMeasureId;
|
|
2278
2278
|
return {
|
|
2279
2279
|
item: {
|
|
2280
2280
|
id: i.netSuiteId
|
|
@@ -2288,14 +2288,14 @@ var ce;
|
|
|
2288
2288
|
g(c, "fromDeliveryOrderToCreateDto"), a.fromDeliveryOrderToCreateDto = c;
|
|
2289
2289
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
2290
2290
|
function u(r, n, t, i) {
|
|
2291
|
-
const { cost: o, currency:
|
|
2291
|
+
const { cost: o, currency: l } = et(n, String(r.line), r.item.id), m = A.fromNumber(r.adjustQtyBy), f = A.fromNumber(o), d = Pe.FCurrency.safeParse(l), I = d.success ? d.data : De;
|
|
2292
2292
|
return {
|
|
2293
2293
|
id: "",
|
|
2294
2294
|
externalId: String(r.line),
|
|
2295
2295
|
sku: t,
|
|
2296
2296
|
amount: {
|
|
2297
|
-
amount:
|
|
2298
|
-
precision:
|
|
2297
|
+
amount: m.amount,
|
|
2298
|
+
precision: m.precision
|
|
2299
2299
|
},
|
|
2300
2300
|
cost: {
|
|
2301
2301
|
amount: f.amount,
|
|
@@ -2333,7 +2333,7 @@ var _t;
|
|
|
2333
2333
|
(function(s) {
|
|
2334
2334
|
(function(a) {
|
|
2335
2335
|
function u(n) {
|
|
2336
|
-
const { setting: t, sourceLocationId: i, destinationLocationId: o, subsidiaryId:
|
|
2336
|
+
const { setting: t, sourceLocationId: i, destinationLocationId: o, subsidiaryId: l, effectiveAt: m, orderItems: f, newAdjustmentId: d } = n, I = f.map((p) => {
|
|
2337
2337
|
const y = t.items.find((E) => E.id === p.sku._id);
|
|
2338
2338
|
return ce.ToNetSuite.toCreateDto({
|
|
2339
2339
|
orderItem: p,
|
|
@@ -2349,12 +2349,12 @@ var _t;
|
|
|
2349
2349
|
id: o
|
|
2350
2350
|
},
|
|
2351
2351
|
subsidiary: {
|
|
2352
|
-
id:
|
|
2352
|
+
id: l
|
|
2353
2353
|
},
|
|
2354
2354
|
inventory: {
|
|
2355
2355
|
items: I
|
|
2356
2356
|
},
|
|
2357
|
-
tranDate: we(new Date(
|
|
2357
|
+
tranDate: we(new Date(m)),
|
|
2358
2358
|
custbody_fm_adjustment_id: d
|
|
2359
2359
|
};
|
|
2360
2360
|
}
|
|
@@ -2368,7 +2368,7 @@ var _t;
|
|
|
2368
2368
|
}
|
|
2369
2369
|
g(c, "toUpdateDto"), a.toUpdateDto = c;
|
|
2370
2370
|
function r(n) {
|
|
2371
|
-
const { setting: t, purchaseOrder: i, sourceLocationId: o, destinationLocationId:
|
|
2371
|
+
const { setting: t, purchaseOrder: i, sourceLocationId: o, destinationLocationId: l, subsidiaryId: m, effectiveAt: f, orderItems: d, deliveryOrderId: I } = n, p = d.map((y) => {
|
|
2372
2372
|
const E = t.items.find((_) => _.id === y.sku._id);
|
|
2373
2373
|
return ce.ToNetSuite.fromDeliveryOrderToCreateDto({
|
|
2374
2374
|
orderItem: y,
|
|
@@ -2381,10 +2381,10 @@ var _t;
|
|
|
2381
2381
|
id: o
|
|
2382
2382
|
},
|
|
2383
2383
|
transferLocation: {
|
|
2384
|
-
id:
|
|
2384
|
+
id: l
|
|
2385
2385
|
},
|
|
2386
2386
|
subsidiary: {
|
|
2387
|
-
id:
|
|
2387
|
+
id: m
|
|
2388
2388
|
},
|
|
2389
2389
|
inventory: {
|
|
2390
2390
|
items: p
|
|
@@ -2397,7 +2397,7 @@ var _t;
|
|
|
2397
2397
|
g(r, "fromDeliveryOrderToCreateDto"), a.fromDeliveryOrderToCreateDto = r;
|
|
2398
2398
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
2399
2399
|
function u(n) {
|
|
2400
|
-
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [
|
|
2400
|
+
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [l, m, f] = t.tranDate.split("-"), d = new Date(Number(l), Number(m) - 1, Number(f)), I = {
|
|
2401
2401
|
_id: "",
|
|
2402
2402
|
name: t.location.refName,
|
|
2403
2403
|
internal: He.Enum.restaurant,
|
|
@@ -2453,7 +2453,7 @@ var _t;
|
|
|
2453
2453
|
g(u, "transformTransferIn"), a.transformTransferIn = u;
|
|
2454
2454
|
function c(n) {
|
|
2455
2455
|
var C, h, b, N, O, L;
|
|
2456
|
-
const { sourceLocation: t, nsInventoryTransfer: i, transferItemMapping: o } = n,
|
|
2456
|
+
const { sourceLocation: t, nsInventoryTransfer: i, transferItemMapping: o } = n, l = new Date(i.createdDate), [m, f, d] = i.tranDate.split("-"), I = new Date(Number(m), Number(f) - 1, Number(d)), p = {
|
|
2457
2457
|
_id: t.doc._id,
|
|
2458
2458
|
internal: t.type,
|
|
2459
2459
|
contactName: t.doc.profile.name,
|
|
@@ -2486,7 +2486,7 @@ var _t;
|
|
|
2486
2486
|
name: "",
|
|
2487
2487
|
id: ""
|
|
2488
2488
|
},
|
|
2489
|
-
createdAt:
|
|
2489
|
+
createdAt: l.toISOString(),
|
|
2490
2490
|
deliveryOrderNumber: "",
|
|
2491
2491
|
netSuite: y,
|
|
2492
2492
|
effectiveAt: I.toISOString()
|
|
@@ -2497,7 +2497,7 @@ var _t;
|
|
|
2497
2497
|
return {
|
|
2498
2498
|
_id: F({
|
|
2499
2499
|
prefix: k.Enum.purchaseOrder,
|
|
2500
|
-
dateTime:
|
|
2500
|
+
dateTime: l.toISOString()
|
|
2501
2501
|
}),
|
|
2502
2502
|
version: "2",
|
|
2503
2503
|
effectiveAt: I.toISOString(),
|
|
@@ -2517,7 +2517,7 @@ var _t;
|
|
|
2517
2517
|
}
|
|
2518
2518
|
g(c, "transformTransferOut"), a.transformTransferOut = c;
|
|
2519
2519
|
function r(n) {
|
|
2520
|
-
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [
|
|
2520
|
+
const { nsInventoryTransfer: t, transferItemMapping: i } = n, o = new Date(t.createdDate), [l, m, f] = t.tranDate.split("-"), d = new Date(Number(l), Number(m) - 1, Number(f));
|
|
2521
2521
|
return {
|
|
2522
2522
|
received: t.inventory.items.map((p) => {
|
|
2523
2523
|
const y = i[p.line].sku, E = i[p.line].measurement;
|
|
@@ -2557,20 +2557,20 @@ function Rt(s, a, u, c, r) {
|
|
|
2557
2557
|
const i = u.units.find((f) => f.netSuiteId === n.unitTypeId);
|
|
2558
2558
|
if (!i)
|
|
2559
2559
|
throw new Error(`Unit with ID ${n.unitTypeId} not found in settings`);
|
|
2560
|
-
const o = r == (i == null ? void 0 : i.baseUnitUnitOfMeasureId),
|
|
2561
|
-
if (!
|
|
2560
|
+
const o = r == (i == null ? void 0 : i.baseUnitUnitOfMeasureId), l = a.find((f) => f._id === i.id);
|
|
2561
|
+
if (!l)
|
|
2562
2562
|
throw new Error(`Unit with ID ${n.unitTypeId} not matched`);
|
|
2563
|
-
let
|
|
2563
|
+
let m;
|
|
2564
2564
|
if (!o) {
|
|
2565
2565
|
const f = i.measurements.find((d) => d.netSuiteId === r);
|
|
2566
2566
|
if (!f)
|
|
2567
2567
|
throw new Error(`Measurement with ID ${r} not found in unit "${i == null ? void 0 : i.id}"`);
|
|
2568
|
-
if (
|
|
2568
|
+
if (m = l.measurements.find((d) => d.id === f.id), !m)
|
|
2569
2569
|
throw new Error(`Measurement with ID ${f.id} not found in SKU ${t._id}`);
|
|
2570
2570
|
}
|
|
2571
2571
|
return {
|
|
2572
2572
|
sku: t,
|
|
2573
|
-
measurement:
|
|
2573
|
+
measurement: m
|
|
2574
2574
|
};
|
|
2575
2575
|
}
|
|
2576
2576
|
g(Rt, "validateNetSuiteOrderItem");
|
|
@@ -2643,18 +2643,18 @@ var bt;
|
|
|
2643
2643
|
g(c, "validateApprovalStatus"), a.validateApprovalStatus = c;
|
|
2644
2644
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(a) {
|
|
2645
2645
|
function u(c, r, n, t) {
|
|
2646
|
-
const i = c.every((
|
|
2646
|
+
const i = c.every((m) => m.isClosed);
|
|
2647
2647
|
let o = {
|
|
2648
2648
|
...r
|
|
2649
2649
|
};
|
|
2650
|
-
const
|
|
2650
|
+
const l = {};
|
|
2651
2651
|
if (i) {
|
|
2652
|
-
|
|
2653
|
-
for (const
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
for (const
|
|
2657
|
-
|
|
2652
|
+
l[n] = [];
|
|
2653
|
+
for (const m of o.deliveryFullfillment ?? [])
|
|
2654
|
+
m.adjustment && l[n].push(m.adjustment);
|
|
2655
|
+
l[t] = [];
|
|
2656
|
+
for (const m of o.deliveryOrder)
|
|
2657
|
+
m.adjustment && l[t].push(m.adjustment);
|
|
2658
2658
|
o = {
|
|
2659
2659
|
...o,
|
|
2660
2660
|
deliveryFullfillment: [],
|
|
@@ -2664,7 +2664,7 @@ var bt;
|
|
|
2664
2664
|
return {
|
|
2665
2665
|
isOrderVoided: i,
|
|
2666
2666
|
purchaseOrder: o,
|
|
2667
|
-
adjustmentGoingToDeleteMap:
|
|
2667
|
+
adjustmentGoingToDeleteMap: l
|
|
2668
2668
|
};
|
|
2669
2669
|
}
|
|
2670
2670
|
g(u, "isVoided"), a.isVoided = u;
|
|
@@ -2686,7 +2686,7 @@ function Mn(s, a) {
|
|
|
2686
2686
|
}
|
|
2687
2687
|
g(Mn, "getAvailableItemToBeFulfilled");
|
|
2688
2688
|
function Un(s) {
|
|
2689
|
-
var
|
|
2689
|
+
var m, f;
|
|
2690
2690
|
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } = s, r = u.reduce((d, I) => (d[I.id] = I, d), {}), n = c.reduce((d, I) => (d[I.netSuiteId] = I, d), {}), t = /* @__PURE__ */ new Set(), i = [];
|
|
2691
2691
|
for (const d of a) {
|
|
2692
2692
|
let I = d;
|
|
@@ -2716,9 +2716,9 @@ function Un(s) {
|
|
|
2716
2716
|
!d.skuCache || t.has(d.skuCache._id) || (i.push({
|
|
2717
2717
|
...d.skuCache
|
|
2718
2718
|
}), t.add(d.skuCache._id));
|
|
2719
|
-
const o = [],
|
|
2719
|
+
const o = [], l = /* @__PURE__ */ new Set();
|
|
2720
2720
|
for (const d of c)
|
|
2721
|
-
d.skuCache && (
|
|
2721
|
+
d.skuCache && (l.add(d.skuCache._id), o.push({
|
|
2722
2722
|
id: d.skuCache._id,
|
|
2723
2723
|
name: d.name,
|
|
2724
2724
|
netSuiteId: d.netSuiteId,
|
|
@@ -2729,11 +2729,11 @@ function Un(s) {
|
|
|
2729
2729
|
cogsAccount: d.cogsAccount,
|
|
2730
2730
|
itemType: d.itemType,
|
|
2731
2731
|
externalId: d.externalId,
|
|
2732
|
-
pktCode: ((
|
|
2732
|
+
pktCode: ((m = d.customFields) == null ? void 0 : m.pktCode) ?? null,
|
|
2733
2733
|
pktName: ((f = d.customFields) == null ? void 0 : f.pktName) ?? null
|
|
2734
2734
|
}));
|
|
2735
2735
|
for (const d of u)
|
|
2736
|
-
d.itemType !== V.Enum.Assembly && !
|
|
2736
|
+
d.itemType !== V.Enum.Assembly && !l.has(d.id) && o.push(d);
|
|
2737
2737
|
return {
|
|
2738
2738
|
updatedInventorySkus: i,
|
|
2739
2739
|
updatedParentItemConfigs: o
|
|
@@ -2764,7 +2764,7 @@ function On(s) {
|
|
|
2764
2764
|
}
|
|
2765
2765
|
g(On, "syncAssemblyChildItemsWithLegacyConfig");
|
|
2766
2766
|
function wn(s) {
|
|
2767
|
-
var
|
|
2767
|
+
var m, f;
|
|
2768
2768
|
const { inventorySkus: a, legacyParentItemConfigs: u, parentReplicas: c } = s, r = u.reduce((d, I) => (d[I.id] = I, d), {}), n = c.reduce((d, I) => (d[I.netSuiteId] = I, d), {}), t = /* @__PURE__ */ new Set(), i = [];
|
|
2769
2769
|
for (const d of a) {
|
|
2770
2770
|
let I = d;
|
|
@@ -2794,9 +2794,9 @@ function wn(s) {
|
|
|
2794
2794
|
!d.skuCache || t.has(d.skuCache._id) || (i.push({
|
|
2795
2795
|
...d.skuCache
|
|
2796
2796
|
}), t.add(d.skuCache._id));
|
|
2797
|
-
const o = [],
|
|
2797
|
+
const o = [], l = /* @__PURE__ */ new Set();
|
|
2798
2798
|
for (const d of c)
|
|
2799
|
-
d.skuCache && (
|
|
2799
|
+
d.skuCache && (l.add(d.skuCache._id), o.push({
|
|
2800
2800
|
id: d.skuCache._id,
|
|
2801
2801
|
name: d.name,
|
|
2802
2802
|
netSuiteId: d.netSuiteId,
|
|
@@ -2807,11 +2807,11 @@ function wn(s) {
|
|
|
2807
2807
|
cogsAccount: d.cogsAccount,
|
|
2808
2808
|
itemType: d.itemType,
|
|
2809
2809
|
externalId: d.externalId,
|
|
2810
|
-
pktCode: ((
|
|
2810
|
+
pktCode: ((m = d.customFields) == null ? void 0 : m.pktCode) ?? null,
|
|
2811
2811
|
pktName: ((f = d.customFields) == null ? void 0 : f.pktName) ?? null
|
|
2812
2812
|
}));
|
|
2813
2813
|
for (const d of u)
|
|
2814
|
-
d.itemType !== V.Enum.InvtPart && !
|
|
2814
|
+
d.itemType !== V.Enum.InvtPart && !l.has(d.id) && o.push(d);
|
|
2815
2815
|
return {
|
|
2816
2816
|
updatedInventorySkus: i,
|
|
2817
2817
|
updatedParentItemConfigs: o
|
|
@@ -2904,45 +2904,45 @@ function be(s, a, u, c, r = !1) {
|
|
|
2904
2904
|
});
|
|
2905
2905
|
else {
|
|
2906
2906
|
const o = Object.keys(qe.shape);
|
|
2907
|
-
for (const
|
|
2908
|
-
if (
|
|
2907
|
+
for (const l of o) {
|
|
2908
|
+
if (l === "id" || l === "name" || l === "externalId" && c === ee.Enum[1])
|
|
2909
2909
|
continue;
|
|
2910
|
-
if (
|
|
2911
|
-
t[
|
|
2910
|
+
if (l === "sku") {
|
|
2911
|
+
t[l]._id !== i[l]._id && n.push({
|
|
2912
2912
|
type: D.ITEM_UPDATED,
|
|
2913
2913
|
message: ne(he, [
|
|
2914
2914
|
"Order Item",
|
|
2915
2915
|
`${t.externalId}`,
|
|
2916
|
-
|
|
2917
|
-
`${i[
|
|
2918
|
-
`${t[
|
|
2916
|
+
l,
|
|
2917
|
+
`${i[l]._id}`,
|
|
2918
|
+
`${t[l]._id}`
|
|
2919
2919
|
]),
|
|
2920
2920
|
data: {
|
|
2921
2921
|
recordId: u,
|
|
2922
2922
|
recordType: "purchaseOrder",
|
|
2923
|
-
field:
|
|
2923
|
+
field: l,
|
|
2924
2924
|
externalId: t.externalId,
|
|
2925
2925
|
sku: i.sku,
|
|
2926
|
-
incomingValue: t[
|
|
2927
|
-
existingValue: i[
|
|
2926
|
+
incomingValue: t[l],
|
|
2927
|
+
existingValue: i[l]
|
|
2928
2928
|
}
|
|
2929
2929
|
});
|
|
2930
2930
|
continue;
|
|
2931
2931
|
}
|
|
2932
|
-
const
|
|
2933
|
-
if (!(
|
|
2934
|
-
a:
|
|
2932
|
+
const m = t[l] ?? null, f = i[l] ?? null;
|
|
2933
|
+
if (!(l === "quantity" && m && f && A.equals({
|
|
2934
|
+
a: m,
|
|
2935
2935
|
b: f
|
|
2936
|
-
})) && !R.isEqual(t[
|
|
2937
|
-
let d = f, I =
|
|
2938
|
-
if (
|
|
2936
|
+
})) && !R.isEqual(t[l], i[l])) {
|
|
2937
|
+
let d = f, I = m;
|
|
2938
|
+
if (l === "code" && f)
|
|
2939
2939
|
continue;
|
|
2940
|
-
typeof t[
|
|
2940
|
+
typeof t[l] == "object" && (d = JSON.stringify(f), I = JSON.stringify(m)), n.push({
|
|
2941
2941
|
type: D.ITEM_UPDATED,
|
|
2942
2942
|
message: ne(he, [
|
|
2943
2943
|
"Purchase Order Item",
|
|
2944
2944
|
`${t.externalId}`,
|
|
2945
|
-
|
|
2945
|
+
l,
|
|
2946
2946
|
`${d}`,
|
|
2947
2947
|
`${I}`
|
|
2948
2948
|
]),
|
|
@@ -2950,9 +2950,9 @@ function be(s, a, u, c, r = !1) {
|
|
|
2950
2950
|
recordId: u,
|
|
2951
2951
|
externalId: t.externalId,
|
|
2952
2952
|
sku: i.sku,
|
|
2953
|
-
field:
|
|
2954
|
-
incomingValue: t[
|
|
2955
|
-
existingValue: i[
|
|
2953
|
+
field: l,
|
|
2954
|
+
incomingValue: t[l],
|
|
2955
|
+
existingValue: i[l]
|
|
2956
2956
|
}
|
|
2957
2957
|
});
|
|
2958
2958
|
}
|
|
@@ -2988,7 +2988,7 @@ function nt(s, a, u, c, r) {
|
|
|
2988
2988
|
}), c[i].externalId = o.externalId;
|
|
2989
2989
|
}
|
|
2990
2990
|
for (const i of c) {
|
|
2991
|
-
const o = u.find((
|
|
2991
|
+
const o = u.find((l) => r == "2" ? l.externalId === i.externalId : l.sku._id === i.sku._id);
|
|
2992
2992
|
o || n.push({
|
|
2993
2993
|
type: a === "deliveryFulfillment" ? D.ITEM_FULFILLMENT_ITEM_DELETED : D.ITEM_RECEIPT_ITEM_DELETED,
|
|
2994
2994
|
message: `${a} ${s} does match sku ${i.sku._id} with existing line [${i.externalId}]`,
|
|
@@ -3000,7 +3000,7 @@ function nt(s, a, u, c, r) {
|
|
|
3000
3000
|
});
|
|
3001
3001
|
}
|
|
3002
3002
|
for (const i of u) {
|
|
3003
|
-
const o = c.find((
|
|
3003
|
+
const o = c.find((l) => r == "2" ? l.externalId === i.externalId : l.sku._id === i.sku._id);
|
|
3004
3004
|
if (!o)
|
|
3005
3005
|
n.push({
|
|
3006
3006
|
type: a === "deliveryFulfillment" ? D.ITEM_FULFILLMENT_ITEM_CREATED : D.ITEM_RECEIPT_ITEM_CREATED,
|
|
@@ -3012,44 +3012,44 @@ function nt(s, a, u, c, r) {
|
|
|
3012
3012
|
});
|
|
3013
3013
|
else {
|
|
3014
3014
|
i.id && i.externalId && (t[i.id] = i.externalId);
|
|
3015
|
-
const
|
|
3016
|
-
for (const
|
|
3017
|
-
if (
|
|
3015
|
+
const l = Object.keys(Gt.shape);
|
|
3016
|
+
for (const m of l) {
|
|
3017
|
+
if (m === "id" || m === "externalId" && r === ee.Enum[1])
|
|
3018
3018
|
continue;
|
|
3019
|
-
if (
|
|
3020
|
-
i[
|
|
3019
|
+
if (m === "sku") {
|
|
3020
|
+
i[m]._id !== o[m]._id && n.push({
|
|
3021
3021
|
type: a === "deliveryFulfillment" ? D.ITEM_FULFILLMENT_ITEM_UPDATED : D.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3022
3022
|
message: ne(he, [
|
|
3023
3023
|
`${a}`,
|
|
3024
3024
|
`${i.externalId}`,
|
|
3025
|
-
|
|
3026
|
-
`${o[
|
|
3027
|
-
`${i[
|
|
3025
|
+
m,
|
|
3026
|
+
`${o[m]._id}`,
|
|
3027
|
+
`${i[m]._id}`
|
|
3028
3028
|
]),
|
|
3029
3029
|
data: {
|
|
3030
3030
|
recordId: s,
|
|
3031
3031
|
recordType: a,
|
|
3032
3032
|
sku: o.sku,
|
|
3033
3033
|
externalId: i.externalId,
|
|
3034
|
-
field:
|
|
3035
|
-
incomingValue: i[
|
|
3036
|
-
existingValue: o[
|
|
3034
|
+
field: m,
|
|
3035
|
+
incomingValue: i[m],
|
|
3036
|
+
existingValue: o[m]
|
|
3037
3037
|
}
|
|
3038
3038
|
});
|
|
3039
3039
|
continue;
|
|
3040
3040
|
}
|
|
3041
|
-
const f = i[
|
|
3042
|
-
if (!(
|
|
3041
|
+
const f = i[m] ?? null, d = o[m] ?? null;
|
|
3042
|
+
if (!(m === "amount" && f && d && A.equals({
|
|
3043
3043
|
a: f,
|
|
3044
3044
|
b: d
|
|
3045
|
-
})) && !R.isEqual(i[
|
|
3045
|
+
})) && !R.isEqual(i[m], o[m])) {
|
|
3046
3046
|
let I = d, p = f;
|
|
3047
|
-
typeof i[
|
|
3047
|
+
typeof i[m] == "object" && (I = JSON.stringify(d), p = JSON.stringify(f)), n.push({
|
|
3048
3048
|
type: a === "deliveryFulfillment" ? D.ITEM_FULFILLMENT_ITEM_UPDATED : D.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3049
3049
|
message: ne(he, [
|
|
3050
3050
|
`${a}`,
|
|
3051
3051
|
`${i.externalId}`,
|
|
3052
|
-
|
|
3052
|
+
m,
|
|
3053
3053
|
`${I}`,
|
|
3054
3054
|
`${p}`
|
|
3055
3055
|
]),
|
|
@@ -3058,9 +3058,9 @@ function nt(s, a, u, c, r) {
|
|
|
3058
3058
|
recordType: a,
|
|
3059
3059
|
sku: o.sku,
|
|
3060
3060
|
externalId: i.externalId,
|
|
3061
|
-
field:
|
|
3062
|
-
incomingValue: i[
|
|
3063
|
-
existingValue: o[
|
|
3061
|
+
field: m,
|
|
3062
|
+
incomingValue: i[m],
|
|
3063
|
+
existingValue: o[m]
|
|
3064
3064
|
}
|
|
3065
3065
|
});
|
|
3066
3066
|
}
|
|
@@ -3126,39 +3126,39 @@ function Ln(s, a, u) {
|
|
|
3126
3126
|
var n, t, i;
|
|
3127
3127
|
const c = Object.keys(Yt.shape), r = [];
|
|
3128
3128
|
for (const o of a) {
|
|
3129
|
-
const
|
|
3129
|
+
const l = s.find((m) => {
|
|
3130
3130
|
var f;
|
|
3131
|
-
return ((f =
|
|
3131
|
+
return ((f = m.netSuite) == null ? void 0 : f.id) === o.netSuite.id;
|
|
3132
3132
|
});
|
|
3133
|
-
if (!
|
|
3133
|
+
if (!l)
|
|
3134
3134
|
r.push({
|
|
3135
3135
|
type: le.ITEM_FULFILLMENT_CREATED,
|
|
3136
3136
|
message: `New Item Fulfillment ${(n = o.netSuite) == null ? void 0 : n.id} created`,
|
|
3137
3137
|
data: o
|
|
3138
3138
|
});
|
|
3139
3139
|
else
|
|
3140
|
-
for (const
|
|
3141
|
-
if (
|
|
3140
|
+
for (const m of c) {
|
|
3141
|
+
if (m === "adjustment" || m === "id")
|
|
3142
3142
|
continue;
|
|
3143
|
-
if (
|
|
3144
|
-
r.push(...nt(
|
|
3143
|
+
if (m === "items") {
|
|
3144
|
+
r.push(...nt(l.id, "deliveryFulfillment", o.items, l.items, u));
|
|
3145
3145
|
continue;
|
|
3146
3146
|
}
|
|
3147
|
-
const f = o[
|
|
3147
|
+
const f = o[m] ?? null, d = l[m] ?? null;
|
|
3148
3148
|
if (!R.isEqual(f, d)) {
|
|
3149
3149
|
let I = d, p = f;
|
|
3150
|
-
typeof o[
|
|
3150
|
+
typeof o[m] == "object" && (I = JSON.stringify(d), p = JSON.stringify(f)), m === "createdAt" && (I = new Date(o[m]).toISOString(), p = new Date(l[m]).toISOString()), r.push({
|
|
3151
3151
|
type: le.ITEM_FULFILLMENT_UPDATED,
|
|
3152
3152
|
message: ne(Rn, [
|
|
3153
3153
|
"Item Fulfillment Field",
|
|
3154
3154
|
`${(t = o.netSuite) == null ? void 0 : t.id}`,
|
|
3155
|
-
|
|
3155
|
+
m,
|
|
3156
3156
|
`${I}`,
|
|
3157
3157
|
`${p}`
|
|
3158
3158
|
]),
|
|
3159
3159
|
data: {
|
|
3160
3160
|
recordId: `${(i = o.netSuite) == null ? void 0 : i.id}`,
|
|
3161
|
-
field:
|
|
3161
|
+
field: m,
|
|
3162
3162
|
incomingValue: f,
|
|
3163
3163
|
existingValue: d
|
|
3164
3164
|
}
|
|
@@ -3174,20 +3174,20 @@ function Pn(s, a) {
|
|
|
3174
3174
|
if (u.length === 0)
|
|
3175
3175
|
return s;
|
|
3176
3176
|
for (const n of s) {
|
|
3177
|
-
const t = u.filter((
|
|
3178
|
-
let
|
|
3177
|
+
const t = u.filter((m) => m.data.recordId != "" && m.data.recordId === n.id), i = t.filter((m) => (m.type === D.ITEM_FULFILLMENT_ITEM_CREATED || m.type === D.ITEM_FULFILLMENT_ITEM_UPDATED || m.type === D.ITEM_FULFILLMENT_ITEM_DELETED) && m.data.recordId === n.id), o = it(n.items || [], i);
|
|
3178
|
+
let l = {
|
|
3179
3179
|
...n,
|
|
3180
3180
|
items: o
|
|
3181
3181
|
};
|
|
3182
|
-
for (const
|
|
3183
|
-
if (
|
|
3184
|
-
const f =
|
|
3185
|
-
d !== I && (
|
|
3182
|
+
for (const m of t)
|
|
3183
|
+
if (m.type === le.ITEM_FULFILLMENT_UPDATED) {
|
|
3184
|
+
const f = m.data.field, d = m.data.incomingValue, I = n[f];
|
|
3185
|
+
d !== I && (l = {
|
|
3186
3186
|
...n,
|
|
3187
3187
|
[f]: d
|
|
3188
3188
|
});
|
|
3189
3189
|
}
|
|
3190
|
-
c.push(
|
|
3190
|
+
c.push(l);
|
|
3191
3191
|
}
|
|
3192
3192
|
for (const n of u)
|
|
3193
3193
|
n.type === le.ITEM_FULFILLMENT_CREATED && c.push({
|
|
@@ -3213,7 +3213,7 @@ var me;
|
|
|
3213
3213
|
})(me || (me = {}));
|
|
3214
3214
|
var W = /* @__PURE__ */ g((s) => s === "" ? null : s, "normalizeNullOrEmpty"), xn = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3215
3215
|
function Lt(s, a, u) {
|
|
3216
|
-
var i, o,
|
|
3216
|
+
var i, o, l, m, f, d, I;
|
|
3217
3217
|
const c = Object.keys(Jt.shape), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
3218
3218
|
for (const p of s) {
|
|
3219
3219
|
const y = W((i = p.netSuite) == null ? void 0 : i.id), E = W(p.id);
|
|
@@ -3241,11 +3241,11 @@ function Lt(s, a, u) {
|
|
|
3241
3241
|
if (!_)
|
|
3242
3242
|
t.push({
|
|
3243
3243
|
type: me.ITEM_RECEIPT_CREATED,
|
|
3244
|
-
message: `New Item Receipt ${(
|
|
3244
|
+
message: `New Item Receipt ${(l = p.netSuite) == null ? void 0 : l.id} created`,
|
|
3245
3245
|
data: p
|
|
3246
3246
|
});
|
|
3247
3247
|
else {
|
|
3248
|
-
const v = W(_.id), S = W((
|
|
3248
|
+
const v = W(_.id), S = W((m = _.netSuite) == null ? void 0 : m.id);
|
|
3249
3249
|
if (S && E && S !== E || y && v && v !== y)
|
|
3250
3250
|
throw new Error(`Inconsistent data for Item Receipt ${(f = p.netSuite) == null ? void 0 : f.id} (or ${p.id})`);
|
|
3251
3251
|
for (const b of c) {
|
|
@@ -3288,23 +3288,23 @@ function Pt(s, a) {
|
|
|
3288
3288
|
if (u.length === 0)
|
|
3289
3289
|
return s;
|
|
3290
3290
|
for (const n of s) {
|
|
3291
|
-
const t = u.filter((
|
|
3292
|
-
const f =
|
|
3291
|
+
const t = u.filter((m) => {
|
|
3292
|
+
const f = m.data;
|
|
3293
3293
|
return f.recordId != "" && f.recordId === n.id;
|
|
3294
|
-
}), i = t.filter((
|
|
3295
|
-
let
|
|
3294
|
+
}), i = t.filter((m) => m.type === D.ITEM_RECEIPT_ITEM_CREATED || m.type === D.ITEM_RECEIPT_ITEM_UPDATED || m.type === D.ITEM_RECEIPT_ITEM_DELETED), o = it(n.received || [], i);
|
|
3295
|
+
let l = {
|
|
3296
3296
|
...n,
|
|
3297
3297
|
received: o
|
|
3298
3298
|
};
|
|
3299
|
-
for (const
|
|
3300
|
-
if (
|
|
3301
|
-
const f =
|
|
3302
|
-
d !== I && (
|
|
3299
|
+
for (const m of t)
|
|
3300
|
+
if (m.type === me.ITEM_RECEIPT_UPDATED) {
|
|
3301
|
+
const f = m.data.field, d = m.data.incomingValue, I = n[f];
|
|
3302
|
+
d !== I && (l = {
|
|
3303
3303
|
...n,
|
|
3304
3304
|
[f]: d
|
|
3305
3305
|
});
|
|
3306
3306
|
}
|
|
3307
|
-
c.push(
|
|
3307
|
+
c.push(l);
|
|
3308
3308
|
}
|
|
3309
3309
|
for (const n of u)
|
|
3310
3310
|
if (n.type === me.ITEM_RECEIPT_CREATED) {
|
|
@@ -3332,17 +3332,17 @@ function $n(s, a, u, c) {
|
|
|
3332
3332
|
var t, i;
|
|
3333
3333
|
const r = Pt(a, c), n = [];
|
|
3334
3334
|
for (const o of r) {
|
|
3335
|
-
const
|
|
3335
|
+
const l = {
|
|
3336
3336
|
...o
|
|
3337
3337
|
};
|
|
3338
3338
|
if ((t = o.netSuite) != null && t.id && !((i = o.fullfillmentId) != null && i.startsWith("delivery_fulfillment"))) {
|
|
3339
|
-
const
|
|
3339
|
+
const m = s.find((f) => {
|
|
3340
3340
|
var d;
|
|
3341
3341
|
return ((d = f.netSuite) == null ? void 0 : d.id) === o.fullfillmentId;
|
|
3342
3342
|
});
|
|
3343
|
-
|
|
3343
|
+
m && (l.fullfillmentId = m.id);
|
|
3344
3344
|
}
|
|
3345
|
-
n.push(
|
|
3345
|
+
n.push(l);
|
|
3346
3346
|
}
|
|
3347
3347
|
return n;
|
|
3348
3348
|
}
|
|
@@ -3384,33 +3384,33 @@ function jn(s, a, u, c = !1) {
|
|
|
3384
3384
|
r.push(...be(s.purchaseOrder.items, a.items, a._id, a.version || "1", c));
|
|
3385
3385
|
continue;
|
|
3386
3386
|
}
|
|
3387
|
-
let
|
|
3387
|
+
let m = s.purchaseOrder[o] ?? null;
|
|
3388
3388
|
const f = a[o] ?? null;
|
|
3389
3389
|
if (o === "request") {
|
|
3390
|
-
const d =
|
|
3390
|
+
const d = m, I = f;
|
|
3391
3391
|
if (!(d != null && d.id) && (I != null && I.id))
|
|
3392
3392
|
continue;
|
|
3393
3393
|
}
|
|
3394
|
-
if (o === "effectiveAt" &&
|
|
3394
|
+
if (o === "effectiveAt" && m && typeof m == "string") {
|
|
3395
3395
|
const d = new Date(ie(a._id));
|
|
3396
|
-
J(d, new Date(
|
|
3396
|
+
J(d, new Date(m)) && (m = null);
|
|
3397
3397
|
}
|
|
3398
|
-
if (!R.isEqual(
|
|
3399
|
-
let d = f, I =
|
|
3400
|
-
if (
|
|
3398
|
+
if (!R.isEqual(m, f)) {
|
|
3399
|
+
let d = f, I = m;
|
|
3400
|
+
if (m && f && typeof m == "object" && typeof f == "object" && (d = f ? JSON.stringify(f) : null, I = m ? JSON.stringify(m) : null), o === "effectiveAt") {
|
|
3401
3401
|
if (!f) {
|
|
3402
3402
|
const p = new Date(ie(a._id));
|
|
3403
|
-
if (typeof
|
|
3403
|
+
if (typeof m == "string" && new Date(m).toDateString() === new Date(p).toDateString())
|
|
3404
3404
|
continue;
|
|
3405
3405
|
}
|
|
3406
|
-
d = f && typeof f == "string" ? new Date(f).toISOString() : null, I =
|
|
3406
|
+
d = f && typeof f == "string" ? new Date(f).toISOString() : null, I = m && typeof m == "string" ? new Date(m).toISOString() : null;
|
|
3407
3407
|
}
|
|
3408
3408
|
r.push({
|
|
3409
3409
|
type: Y.PURCHASE_ORDER_UPDATED,
|
|
3410
3410
|
message: K("Transfer Order", (n = s.purchaseOrder.netSuite) == null ? void 0 : n.id, o, d, I),
|
|
3411
3411
|
data: {
|
|
3412
3412
|
field: o,
|
|
3413
|
-
incomingValue:
|
|
3413
|
+
incomingValue: m,
|
|
3414
3414
|
existingValue: f
|
|
3415
3415
|
}
|
|
3416
3416
|
});
|
|
@@ -3422,8 +3422,8 @@ function jn(s, a, u, c = !1) {
|
|
|
3422
3422
|
for (const o of i) {
|
|
3423
3423
|
if (o === "_id")
|
|
3424
3424
|
continue;
|
|
3425
|
-
const
|
|
3426
|
-
if ((o === "processedAt" || o === "rejectedAt") &&
|
|
3425
|
+
const l = s.purchaseOrderRequest[o] ?? null, m = u[o] ?? null;
|
|
3426
|
+
if ((o === "processedAt" || o === "rejectedAt") && l !== m) {
|
|
3427
3427
|
const f = !!u.processedAt, d = !!u.rejectedAt;
|
|
3428
3428
|
if (s.purchaseOrder.status === j.Enum.REQUESTING && (f || d))
|
|
3429
3429
|
continue;
|
|
@@ -3456,10 +3456,10 @@ function Vn(s, a, u, c, r) {
|
|
|
3456
3456
|
if (n) {
|
|
3457
3457
|
for (const o of a)
|
|
3458
3458
|
if (o.type === Y.PURCHASE_ORDER_UPDATED) {
|
|
3459
|
-
const
|
|
3459
|
+
const l = o.data.field, m = o.data.incomingValue;
|
|
3460
3460
|
n = {
|
|
3461
3461
|
...n,
|
|
3462
|
-
[
|
|
3462
|
+
[l]: m
|
|
3463
3463
|
};
|
|
3464
3464
|
}
|
|
3465
3465
|
n = {
|
|
@@ -3470,13 +3470,13 @@ function Vn(s, a, u, c, r) {
|
|
|
3470
3470
|
for (const o of a)
|
|
3471
3471
|
switch (o.type) {
|
|
3472
3472
|
case Y.PURCHASE_ORDER_CREATED:
|
|
3473
|
-
const
|
|
3473
|
+
const l = new Date(ie(u.purchaseOrder._id)), m = new Date(u.purchaseOrder.effectiveAt);
|
|
3474
3474
|
n = {
|
|
3475
3475
|
...u.purchaseOrder,
|
|
3476
3476
|
_id: (r == null ? void 0 : r.purchaseOrderId) || u.purchaseOrder._id || F({
|
|
3477
3477
|
prefix: k.Enum.purchaseOrder
|
|
3478
3478
|
}),
|
|
3479
|
-
effectiveAt: J(
|
|
3479
|
+
effectiveAt: J(l, m) ? void 0 : m.toISOString(),
|
|
3480
3480
|
items: i
|
|
3481
3481
|
};
|
|
3482
3482
|
break;
|
|
@@ -3568,17 +3568,17 @@ function Bn(s, a) {
|
|
|
3568
3568
|
}
|
|
3569
3569
|
const i = s[n] ?? null, o = a[n] ?? null;
|
|
3570
3570
|
if (n === "effectiveAt" && i && typeof i == "string") {
|
|
3571
|
-
const
|
|
3572
|
-
if (J(
|
|
3571
|
+
const l = new Date(ie(a._id));
|
|
3572
|
+
if (J(l, new Date(i)))
|
|
3573
3573
|
continue;
|
|
3574
3574
|
}
|
|
3575
3575
|
if (n === "effectiveAt" && i !== o) {
|
|
3576
3576
|
if (i && o && typeof i == "string" && typeof o == "string" && new Date(i).toDateString() === new Date(o).toDateString())
|
|
3577
3577
|
continue;
|
|
3578
|
-
const
|
|
3578
|
+
const l = i && typeof i == "string" ? new Date(i).toISOString() : null, m = o && typeof o == "string" ? new Date(o).toISOString() : null;
|
|
3579
3579
|
u.push({
|
|
3580
3580
|
type: Ee.PURCHASE_ORDER_UPDATED,
|
|
3581
|
-
message: K("Purchase Order", (r = s.netSuite) == null ? void 0 : r.id, n,
|
|
3581
|
+
message: K("Purchase Order", (r = s.netSuite) == null ? void 0 : r.id, n, m, l),
|
|
3582
3582
|
data: {
|
|
3583
3583
|
field: n,
|
|
3584
3584
|
incomingValue: i,
|
|
@@ -3598,8 +3598,8 @@ function qn(s, a, u, c) {
|
|
|
3598
3598
|
if (r) {
|
|
3599
3599
|
for (const t of a)
|
|
3600
3600
|
if (t.type === Ee.PURCHASE_ORDER_UPDATED) {
|
|
3601
|
-
const i = t.data.field, o = t.data.incomingValue,
|
|
3602
|
-
o !==
|
|
3601
|
+
const i = t.data.field, o = t.data.incomingValue, l = r[i];
|
|
3602
|
+
o !== l && (r = {
|
|
3603
3603
|
...r,
|
|
3604
3604
|
[i]: o
|
|
3605
3605
|
});
|
|
@@ -3630,10 +3630,10 @@ function qn(s, a, u, c) {
|
|
|
3630
3630
|
break;
|
|
3631
3631
|
case Ee.PURCHASE_ORDER_UPDATED:
|
|
3632
3632
|
if (r) {
|
|
3633
|
-
const
|
|
3634
|
-
r[
|
|
3633
|
+
const l = t.data.field, m = t.data.incomingValue;
|
|
3634
|
+
r[l], r = {
|
|
3635
3635
|
...r,
|
|
3636
|
-
[
|
|
3636
|
+
[l]: m,
|
|
3637
3637
|
items: n
|
|
3638
3638
|
};
|
|
3639
3639
|
}
|
|
@@ -3670,15 +3670,15 @@ function xt(s, a) {
|
|
|
3670
3670
|
continue;
|
|
3671
3671
|
const i = r[t] ?? null, o = n[t] ?? null;
|
|
3672
3672
|
if (!R.isEqual(i, o)) {
|
|
3673
|
-
let
|
|
3674
|
-
typeof i == "object" && (
|
|
3673
|
+
let l = o, m = i;
|
|
3674
|
+
typeof i == "object" && (l = JSON.stringify(o), m = JSON.stringify(i)), c.push({
|
|
3675
3675
|
type: pe.UNIT_OF_MEASUREMENT_UPDATED,
|
|
3676
3676
|
message: ne(Hn, [
|
|
3677
3677
|
"Unit Of Measure",
|
|
3678
3678
|
`${r.nsConfig.netSuiteId}`,
|
|
3679
3679
|
t,
|
|
3680
|
-
`${
|
|
3681
|
-
`${
|
|
3680
|
+
`${l}`,
|
|
3681
|
+
`${m}`
|
|
3682
3682
|
]),
|
|
3683
3683
|
data: {
|
|
3684
3684
|
config: n.nsConfig,
|
|
@@ -3807,8 +3807,8 @@ function Yn(s, a) {
|
|
|
3807
3807
|
let t = s[n] ?? null;
|
|
3808
3808
|
const i = a[n] ?? null;
|
|
3809
3809
|
if (n === "request") {
|
|
3810
|
-
const o = t,
|
|
3811
|
-
if (!(o != null && o.id) && (
|
|
3810
|
+
const o = t, l = i;
|
|
3811
|
+
if (!(o != null && o.id) && (l != null && l.id))
|
|
3812
3812
|
continue;
|
|
3813
3813
|
}
|
|
3814
3814
|
if (n === "effectiveAt" && t && typeof t == "string") {
|
|
@@ -3816,26 +3816,26 @@ function Yn(s, a) {
|
|
|
3816
3816
|
J(o, new Date(t)) && (t = null);
|
|
3817
3817
|
}
|
|
3818
3818
|
if (!R.isEqual(t, i)) {
|
|
3819
|
-
let o = i,
|
|
3819
|
+
let o = i, l = t;
|
|
3820
3820
|
if (t && i && typeof t == "object" && typeof i == "object") {
|
|
3821
3821
|
if (n === "netSuite") {
|
|
3822
|
-
const
|
|
3823
|
-
if (
|
|
3822
|
+
const m = t, f = i;
|
|
3823
|
+
if (m.id === f.id)
|
|
3824
3824
|
continue;
|
|
3825
3825
|
}
|
|
3826
|
-
o = i ? JSON.stringify(i) : null,
|
|
3826
|
+
o = i ? JSON.stringify(i) : null, l = t ? JSON.stringify(t) : null;
|
|
3827
3827
|
}
|
|
3828
3828
|
if (n === "effectiveAt") {
|
|
3829
3829
|
if (!i) {
|
|
3830
|
-
const
|
|
3831
|
-
if (typeof t == "string" && new Date(t).toDateString() === new Date(
|
|
3830
|
+
const m = new Date(ie(a._id));
|
|
3831
|
+
if (typeof t == "string" && new Date(t).toDateString() === new Date(m).toDateString())
|
|
3832
3832
|
continue;
|
|
3833
3833
|
}
|
|
3834
|
-
o = i && typeof i == "string" ? new Date(i).toISOString() : null,
|
|
3834
|
+
o = i && typeof i == "string" ? new Date(i).toISOString() : null, l = t && typeof t == "string" ? new Date(t).toISOString() : null;
|
|
3835
3835
|
}
|
|
3836
3836
|
u.push({
|
|
3837
3837
|
type: _e.PURCHASE_ORDER_UPDATED,
|
|
3838
|
-
message: K("Inventory Transfer", (c = s.netSuite) == null ? void 0 : c.id, n, o,
|
|
3838
|
+
message: K("Inventory Transfer", (c = s.netSuite) == null ? void 0 : c.id, n, o, l),
|
|
3839
3839
|
data: {
|
|
3840
3840
|
field: n,
|
|
3841
3841
|
incomingValue: t,
|
|
@@ -3884,12 +3884,12 @@ function Jn(s, a, u, c) {
|
|
|
3884
3884
|
break;
|
|
3885
3885
|
case _e.PURCHASE_ORDER_UPDATED:
|
|
3886
3886
|
if (r) {
|
|
3887
|
-
const
|
|
3888
|
-
if (
|
|
3887
|
+
const l = t.data.field, m = t.data.incomingValue, f = r[l];
|
|
3888
|
+
if (l === "version" && m !== f)
|
|
3889
3889
|
continue;
|
|
3890
3890
|
r = {
|
|
3891
3891
|
...r,
|
|
3892
|
-
[
|
|
3892
|
+
[l]: m
|
|
3893
3893
|
};
|
|
3894
3894
|
}
|
|
3895
3895
|
}
|
|
@@ -4163,12 +4163,12 @@ g(ui, "resolveAssemblyChildItemConflicts");
|
|
|
4163
4163
|
function di(s, a, u, c, r) {
|
|
4164
4164
|
const n = {}, t = {};
|
|
4165
4165
|
for (const o of a) {
|
|
4166
|
-
const
|
|
4167
|
-
n[o.id] =
|
|
4166
|
+
const l = ge(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4167
|
+
n[o.id] = l;
|
|
4168
4168
|
}
|
|
4169
4169
|
for (const o of u) {
|
|
4170
|
-
const
|
|
4171
|
-
t[o.id] =
|
|
4170
|
+
const l = ge(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4171
|
+
t[o.id] = l;
|
|
4172
4172
|
}
|
|
4173
4173
|
return {
|
|
4174
4174
|
orderItemMapping: ge(r.sku ?? [], r.unit ?? [], c, s.item.items),
|
|
@@ -4213,20 +4213,20 @@ function mi(s, a) {
|
|
|
4213
4213
|
...t
|
|
4214
4214
|
};
|
|
4215
4215
|
return i.received = i.received.map((o) => {
|
|
4216
|
-
const
|
|
4216
|
+
const l = {
|
|
4217
4217
|
...o
|
|
4218
4218
|
};
|
|
4219
|
-
return delete
|
|
4219
|
+
return delete l.id, l;
|
|
4220
4220
|
}), i;
|
|
4221
4221
|
}), u.deliveryFullfillment && (u.deliveryFullfillment = u.deliveryFullfillment.map((t) => {
|
|
4222
4222
|
const i = {
|
|
4223
4223
|
...t
|
|
4224
4224
|
};
|
|
4225
4225
|
return i.items = i.items.map((o) => {
|
|
4226
|
-
const
|
|
4226
|
+
const l = {
|
|
4227
4227
|
...o
|
|
4228
4228
|
};
|
|
4229
|
-
return delete
|
|
4229
|
+
return delete l.id, l;
|
|
4230
4230
|
}), i;
|
|
4231
4231
|
})), {
|
|
4232
4232
|
purchaseOrder: u,
|
|
@@ -4360,8 +4360,8 @@ const ue = zt((s, a) => {
|
|
|
4360
4360
|
return await a.post(i, n);
|
|
4361
4361
|
},
|
|
4362
4362
|
async getInventoryTransferHistory(r, n, t) {
|
|
4363
|
-
var
|
|
4364
|
-
const i = ((
|
|
4363
|
+
var l;
|
|
4364
|
+
const i = ((l = u.currentBusiness.value) == null ? void 0 : l._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/inventory-transfer/${r}/transfer-out-history`;
|
|
4365
4365
|
return await a.post(o, {
|
|
4366
4366
|
startDate: n == null ? void 0 : n.toISOString(),
|
|
4367
4367
|
endDate: t == null ? void 0 : t.toISOString()
|
|
@@ -4389,8 +4389,8 @@ const ue = zt((s, a) => {
|
|
|
4389
4389
|
return await a.post(t);
|
|
4390
4390
|
},
|
|
4391
4391
|
async manualSyncMultipleTransferInOrders(r) {
|
|
4392
|
-
var
|
|
4393
|
-
const { netsuiteIds: n, version: t } = r, i = ((
|
|
4392
|
+
var l;
|
|
4393
|
+
const { netsuiteIds: n, version: t } = r, i = ((l = u.currentBusiness.value) == null ? void 0 : l._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/transfer-order/sync-multiple`;
|
|
4394
4394
|
return await a.post(o, {
|
|
4395
4395
|
netsuiteIds: n,
|
|
4396
4396
|
metadata: t ? {
|
|
@@ -4404,8 +4404,8 @@ const ue = zt((s, a) => {
|
|
|
4404
4404
|
return await a.post(t);
|
|
4405
4405
|
},
|
|
4406
4406
|
async manualSyncMultiplePurchaseOrders(r) {
|
|
4407
|
-
var
|
|
4408
|
-
const { netsuiteIds: n, version: t } = r, i = ((
|
|
4407
|
+
var l;
|
|
4408
|
+
const { netsuiteIds: n, version: t } = r, i = ((l = u.currentBusiness.value) == null ? void 0 : l._id) ?? "", o = `${s.netSuiteBackendUrl}/${i}/v2/purchase-order/sync-multiple`;
|
|
4409
4409
|
return await a.post(o, {
|
|
4410
4410
|
netsuiteIds: n,
|
|
4411
4411
|
metadata: t ? {
|
|
@@ -4443,12 +4443,12 @@ const ue = zt((s, a) => {
|
|
|
4443
4443
|
code: "",
|
|
4444
4444
|
name: "",
|
|
4445
4445
|
childName: ""
|
|
4446
|
-
}), i = Pi(), o = Oe(),
|
|
4446
|
+
}), i = Pi(), o = Oe(), l = Ie(() => {
|
|
4447
4447
|
var d;
|
|
4448
4448
|
const f = `business_${((d = o.currentBusiness.value) == null ? void 0 : d._id) ?? ""}`;
|
|
4449
4449
|
return je[f].code;
|
|
4450
4450
|
});
|
|
4451
|
-
function
|
|
4451
|
+
function m(f) {
|
|
4452
4452
|
return `Overwrite with "${f ?? "N/A"}"`;
|
|
4453
4453
|
}
|
|
4454
4454
|
return (f, d) => {
|
|
@@ -4482,7 +4482,7 @@ const ue = zt((s, a) => {
|
|
|
4482
4482
|
U("div", ki, [
|
|
4483
4483
|
oe(I, {
|
|
4484
4484
|
class: "sm:w-full xs:w-full",
|
|
4485
|
-
label:
|
|
4485
|
+
label: m(t.value.code),
|
|
4486
4486
|
size: "md",
|
|
4487
4487
|
variant: "destructive",
|
|
4488
4488
|
onClick: d[2] || (d[2] = () => {
|
|
@@ -4547,7 +4547,7 @@ const ue = zt((s, a) => {
|
|
|
4547
4547
|
z(" " + x(_.value.childName), 1)
|
|
4548
4548
|
]),
|
|
4549
4549
|
U("span", Si, [
|
|
4550
|
-
U("b", null, "Custom code (" + x(
|
|
4550
|
+
U("b", null, "Custom code (" + x(l.value ? lt(ct)(l.value) : "N/A") + "):", 1),
|
|
4551
4551
|
z(" " + x(_.value.code), 1)
|
|
4552
4552
|
]),
|
|
4553
4553
|
U("span", Ti, [
|
|
@@ -4582,7 +4582,7 @@ const ue = zt((s, a) => {
|
|
|
4582
4582
|
}, null, 8, ["modelValue", "items"]),
|
|
4583
4583
|
t.value ? (Q(), ae("div", Ci, [
|
|
4584
4584
|
U("span", Ai, "Child Name: " + x(t.value.childName), 1),
|
|
4585
|
-
U("span", Mi, "Custom code (" + x(
|
|
4585
|
+
U("span", Mi, "Custom code (" + x(l.value ? lt(ct)(l.value) : "N/A") + "): " + x(t.value.code), 1),
|
|
4586
4586
|
U("span", Ui, "Custom name: " + x(t.value.name), 1),
|
|
4587
4587
|
U("span", Oi, "UOM: " + x(t.value.fmMeasurementAbbrev ?? u.sku.unit.abbrev), 1),
|
|
4588
4588
|
t.value.remark ? (Q(), ae("span", wi, "Remark: " + x(t.value.remark), 1)) : Me("", !0)
|
|
@@ -4654,9 +4654,9 @@ function Pi() {
|
|
|
4654
4654
|
), t = Ie(
|
|
4655
4655
|
() => T.value.setting.units.flatMap(
|
|
4656
4656
|
(i) => i.measurements.map((o) => {
|
|
4657
|
-
var
|
|
4657
|
+
var l;
|
|
4658
4658
|
return {
|
|
4659
|
-
unit: (
|
|
4659
|
+
unit: (l = r.value.get(i.netSuiteId)) == null ? void 0 : l[0],
|
|
4660
4660
|
measurement: o
|
|
4661
4661
|
};
|
|
4662
4662
|
})
|
|
@@ -4664,7 +4664,7 @@ function Pi() {
|
|
|
4664
4664
|
(i) => i.measurement.netSuiteId,
|
|
4665
4665
|
(i) => {
|
|
4666
4666
|
var o;
|
|
4667
|
-
return (o = i.unit) == null ? void 0 : o.measurements.find((
|
|
4667
|
+
return (o = i.unit) == null ? void 0 : o.measurements.find((l) => l.id === i.measurement.id);
|
|
4668
4668
|
}
|
|
4669
4669
|
)
|
|
4670
4670
|
);
|
|
@@ -4675,28 +4675,28 @@ function Pi() {
|
|
|
4675
4675
|
async checkCustomFieldCodes(i) {
|
|
4676
4676
|
i.beforeStart && await i.beforeStart();
|
|
4677
4677
|
const o = {};
|
|
4678
|
-
for (let
|
|
4679
|
-
const
|
|
4678
|
+
for (let l = 0; l < i.templateItems.length; l++) {
|
|
4679
|
+
const m = i.templateItems[l], f = s.skuById[m.sku._id];
|
|
4680
4680
|
if (!f) {
|
|
4681
|
-
o[
|
|
4681
|
+
o[l] = "Invalid record. Please remove this row.";
|
|
4682
4682
|
continue;
|
|
4683
4683
|
}
|
|
4684
|
-
if (!R.isEqual(f,
|
|
4685
|
-
o[
|
|
4684
|
+
if (!R.isEqual(f, m.sku)) {
|
|
4685
|
+
o[l] = "Record is outdated. Please re-apply the item.";
|
|
4686
4686
|
continue;
|
|
4687
4687
|
}
|
|
4688
4688
|
const d = n.value[f._id];
|
|
4689
4689
|
if (!d)
|
|
4690
4690
|
continue;
|
|
4691
|
-
const I =
|
|
4691
|
+
const I = m.measurement, p = m.code;
|
|
4692
4692
|
if (!d.find(
|
|
4693
4693
|
(E) => E.value.code === p && E.value.fmMeasurementId === (I == null ? void 0 : I.id)
|
|
4694
4694
|
)) {
|
|
4695
4695
|
if (!I) {
|
|
4696
|
-
o[
|
|
4696
|
+
o[l] = `Invalid custom code "${p}" for base unit "${f.unit.abbrev}".`;
|
|
4697
4697
|
continue;
|
|
4698
4698
|
}
|
|
4699
|
-
o[
|
|
4699
|
+
o[l] = `Invalid custom code "${p}" for measurement "${I == null ? void 0 : I.abbrev}".`;
|
|
4700
4700
|
continue;
|
|
4701
4701
|
}
|
|
4702
4702
|
}
|
|
@@ -4707,12 +4707,12 @@ function Pi() {
|
|
|
4707
4707
|
0: {
|
|
4708
4708
|
id: "netsuite-verify",
|
|
4709
4709
|
cell: (o) => {
|
|
4710
|
-
const
|
|
4710
|
+
const l = s.skuById[o.row.original.sku._id];
|
|
4711
4711
|
return sn(Ri, {
|
|
4712
|
-
sku:
|
|
4712
|
+
sku: l,
|
|
4713
4713
|
settingOptions: T.value.skuOptions,
|
|
4714
|
-
"onUpdate:modelValue": (
|
|
4715
|
-
i.onUpdate(o.row.index,
|
|
4714
|
+
"onUpdate:modelValue": (m, f, d) => {
|
|
4715
|
+
i.onUpdate(o.row.index, m, f, d);
|
|
4716
4716
|
}
|
|
4717
4717
|
});
|
|
4718
4718
|
}
|
|
@@ -4773,8 +4773,8 @@ function Pi() {
|
|
|
4773
4773
|
return T.value.setting.vendors.find((o) => o.id === i);
|
|
4774
4774
|
},
|
|
4775
4775
|
getNetSuiteLocation(i) {
|
|
4776
|
-
const [o,
|
|
4777
|
-
return T.value.setting.locations.find((f) => f.id ==
|
|
4776
|
+
const [o, l] = i.split("_");
|
|
4777
|
+
return T.value.setting.locations.find((f) => f.id == l && f.type == o);
|
|
4778
4778
|
},
|
|
4779
4779
|
getSubsidiaryFullName(i) {
|
|
4780
4780
|
if (!i)
|
|
@@ -4783,11 +4783,11 @@ function Pi() {
|
|
|
4783
4783
|
name: "",
|
|
4784
4784
|
fullName: ""
|
|
4785
4785
|
};
|
|
4786
|
-
const { flat: o } = Z(T.value.setting.subsidiaries),
|
|
4786
|
+
const { flat: o } = Z(T.value.setting.subsidiaries), l = o.find((m) => m.id === i);
|
|
4787
4787
|
return {
|
|
4788
|
-
id:
|
|
4789
|
-
name: (
|
|
4790
|
-
fullName: `${(
|
|
4788
|
+
id: l == null ? void 0 : l.id,
|
|
4789
|
+
name: (l == null ? void 0 : l.name) || "",
|
|
4790
|
+
fullName: `${(l == null ? void 0 : l.fullName) ?? ""}`
|
|
4791
4791
|
};
|
|
4792
4792
|
},
|
|
4793
4793
|
getLocationSubsidiary(i) {
|
|
@@ -4798,18 +4798,18 @@ function Pi() {
|
|
|
4798
4798
|
name: "",
|
|
4799
4799
|
fullName: ""
|
|
4800
4800
|
};
|
|
4801
|
-
const o = ((f = T.value.setting.locations.find((d) => d.netSuiteId === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat:
|
|
4801
|
+
const o = ((f = T.value.setting.locations.find((d) => d.netSuiteId === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat: l } = Z(T.value.setting.subsidiaries), m = l.find((d) => d.id === o);
|
|
4802
4802
|
return {
|
|
4803
|
-
id:
|
|
4804
|
-
name: (
|
|
4805
|
-
fullName: `${(
|
|
4803
|
+
id: m == null ? void 0 : m.id,
|
|
4804
|
+
name: (m == null ? void 0 : m.name) || "",
|
|
4805
|
+
fullName: `${(m == null ? void 0 : m.fullName) ?? ""}`
|
|
4806
4806
|
};
|
|
4807
4807
|
},
|
|
4808
4808
|
currentLocationSubsidiary() {
|
|
4809
4809
|
var I;
|
|
4810
|
-
const i = Ae(), o = i.currentLocation.doc._id,
|
|
4811
|
-
(p) => p.id === o && p.type ==
|
|
4812
|
-
)) == null ? void 0 : I.subsidiaryId) ?? null, { flat: f } = Z(T.value.setting.subsidiaries), d = f.find((p) => p.id ===
|
|
4810
|
+
const i = Ae(), o = i.currentLocation.doc._id, l = i.currentLocation.type, m = ((I = T.value.setting.locations.find(
|
|
4811
|
+
(p) => p.id === o && p.type == l
|
|
4812
|
+
)) == null ? void 0 : I.subsidiaryId) ?? null, { flat: f } = Z(T.value.setting.subsidiaries), d = f.find((p) => p.id === m);
|
|
4813
4813
|
return {
|
|
4814
4814
|
id: d == null ? void 0 : d.id,
|
|
4815
4815
|
name: (d == null ? void 0 : d.name) || "",
|
|
@@ -4818,11 +4818,11 @@ function Pi() {
|
|
|
4818
4818
|
},
|
|
4819
4819
|
currentVendorSubsidiary(i) {
|
|
4820
4820
|
var f;
|
|
4821
|
-
const o = ((f = T.value.setting.vendors.find((d) => d.id === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat:
|
|
4821
|
+
const o = ((f = T.value.setting.vendors.find((d) => d.id === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat: l } = Z(T.value.setting.subsidiaries), m = l.find((d) => d.id === o);
|
|
4822
4822
|
return {
|
|
4823
|
-
id:
|
|
4824
|
-
name: (
|
|
4825
|
-
fullName: `${(
|
|
4823
|
+
id: m == null ? void 0 : m.id,
|
|
4824
|
+
name: (m == null ? void 0 : m.name) || "",
|
|
4825
|
+
fullName: `${(m == null ? void 0 : m.fullName) ?? ""}`
|
|
4826
4826
|
};
|
|
4827
4827
|
},
|
|
4828
4828
|
get subsidiaryOptions() {
|
|
@@ -4846,108 +4846,115 @@ function Pi() {
|
|
|
4846
4846
|
if (!T.value.setting.subsidiaryId)
|
|
4847
4847
|
return [];
|
|
4848
4848
|
const { flat: i } = Z(T.value.setting.subsidiaries), o = [];
|
|
4849
|
-
let
|
|
4850
|
-
for (;
|
|
4851
|
-
o.unshift(
|
|
4852
|
-
const
|
|
4853
|
-
|
|
4849
|
+
let l = T.value.setting.subsidiaryId;
|
|
4850
|
+
for (; l; ) {
|
|
4851
|
+
o.unshift(l);
|
|
4852
|
+
const m = i.find((f) => f.id === l);
|
|
4853
|
+
l = m == null ? void 0 : m.parentId;
|
|
4854
4854
|
}
|
|
4855
4855
|
return o;
|
|
4856
4856
|
},
|
|
4857
4857
|
getAvailableItems(i) {
|
|
4858
|
-
const { available: o, flatMapping:
|
|
4858
|
+
const { available: o, flatMapping: l } = Z(
|
|
4859
4859
|
T.value.setting.subsidiaries,
|
|
4860
4860
|
i
|
|
4861
4861
|
);
|
|
4862
4862
|
return T.value.setting.items.filter(
|
|
4863
|
-
(
|
|
4864
|
-
).map((
|
|
4863
|
+
(m) => m.subsidiaryIds.some((f) => m.includeChildren && l[f] && l[f].some((d) => o.includes(d)) || o.includes(f))
|
|
4864
|
+
).map((m) => m.id);
|
|
4865
4865
|
},
|
|
4866
4866
|
getAvailableMeasurements(i, o) {
|
|
4867
|
-
const
|
|
4868
|
-
if (!
|
|
4867
|
+
const l = T.value.setting.items.find((d) => d.id === i);
|
|
4868
|
+
if (!l)
|
|
4869
4869
|
return [];
|
|
4870
|
-
const { available:
|
|
4870
|
+
const { available: m, flatMapping: f } = Z(
|
|
4871
4871
|
T.value.setting.subsidiaries,
|
|
4872
4872
|
o
|
|
4873
4873
|
);
|
|
4874
|
-
if (
|
|
4874
|
+
if (l.includeChildren) {
|
|
4875
4875
|
const I = T.value.setting.childItems.filter((p) => {
|
|
4876
4876
|
let y = p.subsidiaryIds;
|
|
4877
4877
|
if (p.includeChildren == !0)
|
|
4878
4878
|
for (const E of p.subsidiaryIds)
|
|
4879
4879
|
y = y.concat(f[E]);
|
|
4880
|
-
return y = [...new Set(y)], p.parentNetSuiteId ===
|
|
4880
|
+
return y = [...new Set(y)], p.parentNetSuiteId === l.netSuiteId && console.log(p), p.parentNetSuiteId === l.netSuiteId && y.some((E) => m.includes(E));
|
|
4881
4881
|
}).flatMap((p) => p.unitTypeId);
|
|
4882
4882
|
return T.value.setting.units.filter((p) => I.includes(p.netSuiteId)).flatMap((p) => p.measurements).map((p) => p.id);
|
|
4883
4883
|
}
|
|
4884
|
-
return T.value.setting.units.filter((d) => d.netSuiteId ===
|
|
4884
|
+
return T.value.setting.units.filter((d) => d.netSuiteId === l.unitTypeId).flatMap((d) => d.measurements).map((d) => d.id);
|
|
4885
4885
|
},
|
|
4886
4886
|
async readSetting() {
|
|
4887
|
-
var
|
|
4888
|
-
const
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
const
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
const y = [];
|
|
4898
|
-
for (const _ of p.subsidiaryIds) {
|
|
4899
|
-
const v = f.find((S) => S.id === _);
|
|
4900
|
-
v && y.push(v.fullName || "");
|
|
4887
|
+
var o;
|
|
4888
|
+
const i = ue();
|
|
4889
|
+
try {
|
|
4890
|
+
const l = await i.readSetting();
|
|
4891
|
+
if (l) {
|
|
4892
|
+
if (this.state.setting = l, (o = T.value.setting.subsidiaries) != null && o.length) {
|
|
4893
|
+
const { flat: f, tree: d } = Z(T.value.setting.subsidiaries);
|
|
4894
|
+
for (const p of l.vendors) {
|
|
4895
|
+
const y = f.find((E) => E.id === p.subsidiaryId);
|
|
4896
|
+
this.state.vendorSubsidiary[p.id] = (y == null ? void 0 : y.fullName) || "";
|
|
4901
4897
|
}
|
|
4902
|
-
const
|
|
4903
|
-
|
|
4904
|
-
p.subsidiaryIds
|
|
4905
|
-
|
|
4898
|
+
for (const p of l.items) {
|
|
4899
|
+
const y = [];
|
|
4900
|
+
for (const _ of p.subsidiaryIds) {
|
|
4901
|
+
const v = f.find((S) => S.id === _);
|
|
4902
|
+
v && y.push(v.fullName || "");
|
|
4903
|
+
}
|
|
4904
|
+
const E = jt(
|
|
4905
|
+
d,
|
|
4906
|
+
p.subsidiaryIds,
|
|
4907
|
+
p.includeChildren
|
|
4908
|
+
);
|
|
4909
|
+
this.state.skuSubsidiaries[p.id] = {
|
|
4910
|
+
includeChildren: p.includeChildren,
|
|
4911
|
+
flattenedSubsidiaryNames: y,
|
|
4912
|
+
subsidiaryTree: E
|
|
4913
|
+
};
|
|
4914
|
+
}
|
|
4915
|
+
const I = f.find(
|
|
4916
|
+
(p) => p.id === T.value.setting.subsidiaryId
|
|
4906
4917
|
);
|
|
4907
|
-
this.state.
|
|
4908
|
-
includeChildren: p.includeChildren,
|
|
4909
|
-
flattenedSubsidiaryNames: y,
|
|
4910
|
-
subsidiaryTree: E
|
|
4911
|
-
};
|
|
4918
|
+
this.state.businessSubsidiaryName = (I == null ? void 0 : I.fullName) || "";
|
|
4912
4919
|
}
|
|
4913
|
-
const
|
|
4914
|
-
|
|
4920
|
+
const m = T.value.setting.units.reduce(
|
|
4921
|
+
(f, d) => (f[d.netSuiteId] = d, f),
|
|
4922
|
+
{}
|
|
4923
|
+
);
|
|
4924
|
+
this.state.skuOptions = T.value.setting.items.reduce(
|
|
4925
|
+
(f, d) => (f[d.id] = {
|
|
4926
|
+
item: d,
|
|
4927
|
+
childItems: T.value.setting.childItems.filter(
|
|
4928
|
+
(I) => I.parentNetSuiteId === d.netSuiteId
|
|
4929
|
+
),
|
|
4930
|
+
unit: m[d.unitTypeId] || {
|
|
4931
|
+
id: "ERROR",
|
|
4932
|
+
measurements: [
|
|
4933
|
+
{
|
|
4934
|
+
id: "ERROR",
|
|
4935
|
+
netSuiteId: "ERROR"
|
|
4936
|
+
}
|
|
4937
|
+
],
|
|
4938
|
+
netSuiteId: "ERROR",
|
|
4939
|
+
baseUnitUnitOfMeasureId: "ERROR"
|
|
4940
|
+
},
|
|
4941
|
+
units: m
|
|
4942
|
+
}, f),
|
|
4943
|
+
{}
|
|
4944
|
+
);
|
|
4915
4945
|
}
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
);
|
|
4920
|
-
this.state.skuOptions = T.value.setting.items.reduce(
|
|
4921
|
-
(f, d) => (f[d.id] = {
|
|
4922
|
-
item: d,
|
|
4923
|
-
childItems: T.value.setting.childItems.filter(
|
|
4924
|
-
(I) => I.parentNetSuiteId === d.netSuiteId
|
|
4925
|
-
),
|
|
4926
|
-
unit: l[d.unitTypeId] || {
|
|
4927
|
-
id: "ERROR",
|
|
4928
|
-
measurements: [
|
|
4929
|
-
{
|
|
4930
|
-
id: "ERROR",
|
|
4931
|
-
netSuiteId: "ERROR"
|
|
4932
|
-
}
|
|
4933
|
-
],
|
|
4934
|
-
netSuiteId: "ERROR",
|
|
4935
|
-
baseUnitUnitOfMeasureId: "ERROR"
|
|
4936
|
-
},
|
|
4937
|
-
units: l
|
|
4938
|
-
}, f),
|
|
4939
|
-
{}
|
|
4940
|
-
);
|
|
4946
|
+
this.state.isReady = !0;
|
|
4947
|
+
} catch (l) {
|
|
4948
|
+
console.error("Failed to read NetSuite settings:", l), this.state.isReady = !1;
|
|
4941
4949
|
}
|
|
4942
|
-
this.state.isReady = !0;
|
|
4943
4950
|
},
|
|
4944
4951
|
async updateLocationConfigs(i) {
|
|
4945
|
-
const
|
|
4946
|
-
|
|
4952
|
+
const l = await ue().updateLocationConfigs(i);
|
|
4953
|
+
l && (this.state.setting = l);
|
|
4947
4954
|
},
|
|
4948
4955
|
async updateSupplierConfigs(i) {
|
|
4949
|
-
const
|
|
4950
|
-
|
|
4956
|
+
const l = await ue().updateSupplierConfigs(i);
|
|
4957
|
+
l && (this.state.setting = l);
|
|
4951
4958
|
},
|
|
4952
4959
|
async getAllItemReplicas() {
|
|
4953
4960
|
const i = ue();
|
|
@@ -4971,17 +4978,17 @@ function Pi() {
|
|
|
4971
4978
|
};
|
|
4972
4979
|
},
|
|
4973
4980
|
async syncPurchaseOrder(i, o) {
|
|
4974
|
-
const
|
|
4975
|
-
let
|
|
4976
|
-
if (!
|
|
4981
|
+
const l = ue();
|
|
4982
|
+
let m = o;
|
|
4983
|
+
if (!m) {
|
|
4977
4984
|
const f = Ae(), d = f.currentLocation.doc._id;
|
|
4978
|
-
|
|
4985
|
+
m = `${f.currentLocation.type}_${d}`;
|
|
4979
4986
|
}
|
|
4980
|
-
await
|
|
4987
|
+
await l.syncPurchaseOrder(m, i);
|
|
4981
4988
|
},
|
|
4982
4989
|
getItemCustomCode(i, o) {
|
|
4983
4990
|
var p;
|
|
4984
|
-
const
|
|
4991
|
+
const m = `business_${((p = Oe().currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, f = je[m].code, d = c.value.get(i._id);
|
|
4985
4992
|
let I = null;
|
|
4986
4993
|
if (d && d.length > 0) {
|
|
4987
4994
|
const y = d[0];
|
|
@@ -5009,8 +5016,8 @@ function Pi() {
|
|
|
5009
5016
|
return await ue().getNetSuiteLocationOptions();
|
|
5010
5017
|
},
|
|
5011
5018
|
async getItemAverageCosts() {
|
|
5012
|
-
const i = ue(),
|
|
5013
|
-
return await i.getItemAverageCosts(
|
|
5019
|
+
const i = ue(), l = Ae().currentLocation.doc._id;
|
|
5020
|
+
return await i.getItemAverageCosts(l);
|
|
5014
5021
|
}
|
|
5015
5022
|
};
|
|
5016
5023
|
}
|
|
@@ -5022,20 +5029,20 @@ function jt(s, a, u) {
|
|
|
5022
5029
|
}
|
|
5023
5030
|
function Z(s, a) {
|
|
5024
5031
|
const u = [], c = [];
|
|
5025
|
-
function r(o,
|
|
5026
|
-
return s.filter((d) => d.parentId ===
|
|
5032
|
+
function r(o, l, m = !1) {
|
|
5033
|
+
return s.filter((d) => d.parentId === l).map((d) => ((m || d.id === a || !a) && u.push(d.id), {
|
|
5027
5034
|
id: d.id,
|
|
5028
5035
|
name: d.name,
|
|
5029
5036
|
country: d.country,
|
|
5030
5037
|
currency: d.currency,
|
|
5031
5038
|
parentId: d.parentId,
|
|
5032
5039
|
depth: o,
|
|
5033
|
-
children: r(o + 1, d.id,
|
|
5040
|
+
children: r(o + 1, d.id, m || d.id === a)
|
|
5034
5041
|
}));
|
|
5035
5042
|
}
|
|
5036
5043
|
const n = r(0, null), t = {};
|
|
5037
|
-
function i(o,
|
|
5038
|
-
const
|
|
5044
|
+
function i(o, l = "") {
|
|
5045
|
+
const m = o.fullName || o.name, f = l ? `${l} : ${m}` : m;
|
|
5039
5046
|
c.push({ ...o, fullName: f }), t[o.id] = [o.id];
|
|
5040
5047
|
for (const d of o.children)
|
|
5041
5048
|
i(d, f), t[o.id].push(...t[d.id]);
|
|
@@ -5048,17 +5055,17 @@ function Z(s, a) {
|
|
|
5048
5055
|
};
|
|
5049
5056
|
}
|
|
5050
5057
|
function xi(s) {
|
|
5051
|
-
function a(i, o,
|
|
5052
|
-
const
|
|
5053
|
-
return
|
|
5058
|
+
function a(i, o, l) {
|
|
5059
|
+
const m = u[i];
|
|
5060
|
+
return m(o, l);
|
|
5054
5061
|
}
|
|
5055
5062
|
const { customFields: u, skus: c, settingOptions: r, units: n } = s, t = {};
|
|
5056
5063
|
for (const i of c) {
|
|
5057
|
-
const o = r[i._id],
|
|
5058
|
-
label: `${i.name} (${
|
|
5064
|
+
const o = r[i._id], l = a("name", o.item), m = a("code", o.item), f = {
|
|
5065
|
+
label: `${i.name} (${m})`,
|
|
5059
5066
|
value: {
|
|
5060
|
-
code:
|
|
5061
|
-
name:
|
|
5067
|
+
code: m,
|
|
5068
|
+
name: l,
|
|
5062
5069
|
childName: "-",
|
|
5063
5070
|
externalId: o.item.externalId || ""
|
|
5064
5071
|
}
|