@feedmepos/mf-inventory-portal 1.5.2-dev.1 → 1.5.3
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-DYOb7uJv.js → App-Tip851gM.js} +101 -99
- package/dist/{ApprovalView-DRBS-RE3.js → ApprovalView-Co_jr0yJ.js} +7 -7
- package/dist/{BindingsDialog-DFBuiKjI.js → BindingsDialog-BKLZATL5.js} +2 -2
- package/dist/{BindingsPicker-BSt1KP3v.js → BindingsPicker-BmNUo00s.js} +2 -2
- package/dist/{BindingsTable-DbfWpchk.js → BindingsTable-CDW0p3XW.js} +3 -3
- package/dist/{ClosingDraftView-CzAV6Ak-.js → ClosingDraftView-BRoUOMnB.js} +14 -14
- package/dist/{ClosingHistoryView-B2m1mFVb.js → ClosingHistoryView-BfjMgTvj.js} +5 -5
- package/dist/{ClosingTemplateView-CPoNLI4K.js → ClosingTemplateView-BxpOMPaW.js} +14 -14
- package/dist/{DefaultView-Dr7NC5pE.js → DefaultView-CDgYGaus.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-CSJ3EbkI.js → DeliveryOrderPrintPreview-Cpxujtv1.js} +2 -2
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BxCzBq7X.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-jmTuy7Q-.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DhFYEJSi.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DtdLaxj1.js} +2 -2
- package/dist/{FmMultiselectDialog-Dc9XTsJp.js → FmMultiselectDialog-PQkX6Fbu.js} +1 -1
- package/dist/{FmMultiselectDialog-CK4OxOcC.js → FmMultiselectDialog-whugZ2H4.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Cf3ZVYFG.js → FmUnitInput.vue_vue_type_script_setup_true_lang-naoG-656.js} +4 -4
- package/dist/{ImportView-D19TZvnF.js → ImportView-DzwhWGy8.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BLS6Nv_u.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DM5HnG4b.js} +1 -1
- package/dist/{IngredientGroupView-BArstaQe.js → IngredientGroupView-CQ1dD6By.js} +5 -5
- package/dist/{IngredientsView-KOpZ2hFt.js → IngredientsView-BnZZfPxe.js} +15 -15
- package/dist/{IntegrationExplorerView-Sw7DUhV4.js → IntegrationExplorerView-Stxhc76u.js} +5 -5
- package/dist/{IntegrationView-D4T29bFi.js → IntegrationView-CF-WkMUn.js} +13 -13
- package/dist/{InventoryBindingForm-CZa1x5z5.js → InventoryBindingForm-DKpbfR1q.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-ByLQyONl.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bwg3EPGp.js} +5 -5
- package/dist/{InventoryBindingSummary-DAy_XvKk.js → InventoryBindingSummary-IfhUtZSq.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CCjud7QA.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-PB76EGz3.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DI4Z24d2.js → PremiumBadge.vue_vue_type_script_setup_true_lang-mDtjDdRa.js} +1 -1
- package/dist/{PublishView-8SaK6fyS.js → PublishView-DDW8AvS7.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-B2UholCw.js → PurchaseOrderPrintPreview-CiXt3Jl8.js} +2 -2
- package/dist/{ReceiveRequestView-jKp1PH1p.js → ReceiveRequestView-BPn5F6x0.js} +25 -25
- package/dist/{RecipeView-B-_V8Hl0.js → RecipeView-B6QJg7Es.js} +17 -17
- package/dist/{SettingsView-DoKpbHug.js → SettingsView-DpT_Ih8C.js} +4 -4
- package/dist/{StockView-BtlUbkCk.js → StockView-Dtiy0YFc.js} +19 -19
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-y0pbttbS.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BipR8XT4.js} +1 -1
- package/dist/{SupplierView-B4xKWE8v.js → SupplierView-BwYsrfeB.js} +12 -12
- package/dist/{SurchargeView-B_3TwBUc.js → SurchargeView-Bypfh3qG.js} +6 -6
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BW6VWRLA.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bmu1ilka.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-atJQ2x6h.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CdJrATDm.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-yt-idxfW.js → TransferDetails.vue_vue_type_script_setup_true_lang-CQHdJM5b.js} +20 -20
- package/dist/{TransferTemplateView-Df5vRxcF.js → TransferTemplateView-B6keHDoT.js} +18 -18
- package/dist/{UnitCostHistoryView-VD8C3tW0.js → UnitCostHistoryView-CJZjR6LD.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BZ9doLmV.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-CBfZKWMS.js} +4 -4
- package/dist/{UnitView-CXOAeVfR.js → UnitView-Bg3N4L5v.js} +7 -7
- package/dist/{WarehouseView-Cqq49OjI.js → WarehouseView-DBQa43bC.js} +5 -5
- package/dist/{WastageTemplateView-BTzJB_Un.js → WastageTemplateView-Pd1_NNpV.js} +14 -14
- package/dist/api/netsuite.d.ts +4 -0
- package/dist/{app-Dgp7U3Bu.js → app-vSI7o64L.js} +4153 -4090
- package/dist/app.js +1 -1
- package/dist/{closing-template-CDO4H1ec.js → closing-template-DVI1UstK.js} +1 -1
- package/dist/{date2-Co4esyS0.js → date2-Bl0d_33c.js} +1 -1
- package/dist/{dayjs.min-fDFTQLDV.js → dayjs.min-C2tfHKCc.js} +1 -1
- package/dist/{decimal-CAoqWZAo.js → decimal-ysEl72HE.js} +2 -2
- package/dist/{defineDeepModel-Bu3A8_gN.js → defineDeepModel-Bue1KSYu.js} +1 -1
- package/dist/{duplicate-template-DFYzr9yc.js → duplicate-template-DefSuGTM.js} +1 -1
- package/dist/{export-SbWbn-Q1.js → export-BsvVWSah.js} +2 -2
- package/dist/{feature-CiFq5nzV.js → feature-Ble30e7u.js} +2 -2
- package/dist/{format-time-from-id-CewwXLFE.js → format-time-from-id-rL8zKj9R.js} +1 -1
- package/dist/{format-unit-display-CjSRi94f.js → format-unit-display-D7kQOF1c.js} +11 -11
- package/dist/{import-export.helper-BTmjUBR4.js → import-export.helper-DueYHILM.js} +6 -6
- package/dist/{index-B2NWsBtj.js → index-Bqizeiw2.js} +1 -1
- package/dist/{index-DMx7gikW.js → index-CuYUOzR5.js} +3 -3
- package/dist/{index-Ds1sxRgy.js → index-ICVB-RbL.js} +1 -1
- package/dist/{inventory-core-dart.default-CTfsXlyP.js → inventory-core-dart.default-C4oYtkAS.js} +3 -3
- package/dist/{lodash-BoYjh2w1.js → lodash-CJDbt6zN.js} +1 -1
- package/dist/{lz-string-DFsbzXIB.js → lz-string-DGI7OOd0.js} +1 -1
- package/dist/{netsuite-DWa9K-3f.js → netsuite-CNSrwmDK.js} +930 -841
- package/dist/{number-Dr63YrYs.js → number-AWapL9Jq.js} +3 -3
- package/dist/{predefined-templates-CjGGmE-S.js → predefined-templates-CnAEkEQx.js} +1 -1
- package/dist/{purchase-order-template-e6v2iw1L.js → purchase-order-template-CpWZ8Agv.js} +1 -1
- package/dist/{recalculationUtils-CATRgU8s.js → recalculationUtils-B5chj8Yr.js} +1 -1
- package/dist/{rules-o0HyoFZS.js → rules-Bji3egEM.js} +2 -2
- package/dist/{stock-CiQJys85.js → stock-CobZZaou.js} +1 -1
- package/dist/stores/integration/netsuite.d.ts +6 -0
- package/dist/{supplier-l7eN_Q6M.js → supplier-C7eV9eko.js} +2 -2
- package/dist/{surcharge-C66q09ht.js → surcharge-BMnJG9Wp.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-C5hAoyG7.js → use-ingredient-select-dialog-CoyT4NI0.js} +2 -2
- package/dist/{use-inventory-binding-dialog-IYVfWMn0.js → use-inventory-binding-dialog-CChnp1_1.js} +2 -2
- package/dist/{use-template-enabled-locations-DH9oAsU9.js → use-template-enabled-locations-D4AkRbcD.js} +2 -2
- package/dist/{use-transfer-locations-C0qBfWjj.js → use-transfer-locations-RQIHaB3o.js} +2 -2
- package/dist/{useHrmPermission-O6wgWbn6.js → useHrmPermission-CLahtOPY.js} +1 -1
- package/dist/{useNavigationMenu-CSQM3o-a.js → useNavigationMenu-CUanWPd_.js} +2 -2
- package/dist/{useSseClient-V3x2n4_X.js → useSseClient-DlcA3RSF.js} +3 -3
- package/dist/{vue-i18n-B_D296iV.js → vue-i18n-efULw9Mj.js} +280 -280
- package/dist/{xlsx-z39dJT1l.js → xlsx-N71KISwc.js} +398 -398
- package/dist/{xlsx.util-BT9LSxGd.js → xlsx.util-D6kwayGS.js} +3 -3
- package/package.json +6 -6
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { V as e, a3 as
|
|
2
|
-
import { useCoreStore as
|
|
3
|
-
import { useSnackbar as
|
|
4
|
-
import { _ as P } from "./lodash-
|
|
5
|
-
import { defineComponent as
|
|
6
|
-
import { u as dn } from "./feature-
|
|
7
|
-
var cn = Object.defineProperty, g = (s, u) => cn(s, "name", { value: u, configurable: !0 }),
|
|
1
|
+
import { V as e, a3 as zt, a4 as Gt, a5 as Yt, a6 as Jt, a7 as Pe, a8 as Wt, C as X, a9 as Re, T as Ke, aa as et, ab as Ct, ac as L, ad as $, d as Ne, N as F, w as M, ae as je, B as ae, af as ze, P as B, ag as At, ah as Qt, ai as Zt, aj as Xt, ak as tt, al as en, m as tn, i as nn, s as It, a as rn, u as we } from "./app-vSI7o64L.js";
|
|
2
|
+
import { useCoreStore as Ce } from "@feedmepos/mf-common";
|
|
3
|
+
import { useSnackbar as sn } from "@feedmepos/ui-library";
|
|
4
|
+
import { _ as P } from "./lodash-CJDbt6zN.js";
|
|
5
|
+
import { defineComponent as on, ref as Ge, computed as Ee, resolveComponent as De, openBlock as G, createBlock as He, withCtx as H, createVNode as Q, createElementVNode as w, createElementBlock as ue, Fragment as $e, createCommentVNode as ge, createTextVNode as K, toDisplayString as O, renderList as an, unref as pt, h as un } from "vue";
|
|
6
|
+
import { u as dn } from "./feature-Ble30e7u.js";
|
|
7
|
+
var cn = Object.defineProperty, g = (s, u) => cn(s, "name", { value: u, configurable: !0 }), Me = "MYR";
|
|
8
8
|
e.enum([
|
|
9
9
|
"custbody_fm_do_id",
|
|
10
10
|
"custbody_fm_po_request_id",
|
|
@@ -20,11 +20,11 @@ e.enum([
|
|
|
20
20
|
/// delivery order item id
|
|
21
21
|
"custcol_fm_line_id"
|
|
22
22
|
]);
|
|
23
|
-
var
|
|
23
|
+
var Ye;
|
|
24
24
|
(function(s) {
|
|
25
25
|
s[s.Create = 0] = "Create", s[s.Set = 1] = "Set", s[s.Unset = 2] = "Unset", s[s.Change = 3] = "Change";
|
|
26
|
-
})(
|
|
27
|
-
e.nativeEnum(
|
|
26
|
+
})(Ye || (Ye = {}));
|
|
27
|
+
e.nativeEnum(Ye);
|
|
28
28
|
e.enum([
|
|
29
29
|
"TrnfrOrd",
|
|
30
30
|
"PurchOrd"
|
|
@@ -36,9 +36,10 @@ e.enum([
|
|
|
36
36
|
e.enum([
|
|
37
37
|
"THB",
|
|
38
38
|
"MYR",
|
|
39
|
-
"SGD"
|
|
39
|
+
"SGD",
|
|
40
|
+
"IDR"
|
|
40
41
|
]);
|
|
41
|
-
var
|
|
42
|
+
var nt = e.object({
|
|
42
43
|
hascostline: e.string(),
|
|
43
44
|
itemid: e.string(),
|
|
44
45
|
transactionline: e.string(),
|
|
@@ -115,7 +116,7 @@ var ln = e.object({
|
|
|
115
116
|
})
|
|
116
117
|
});
|
|
117
118
|
mn.extend({
|
|
118
|
-
glImpacts: e.array(
|
|
119
|
+
glImpacts: e.array(nt).nullish()
|
|
119
120
|
});
|
|
120
121
|
e.object({
|
|
121
122
|
custbody_fm_fulfillment_id: e.string(),
|
|
@@ -167,7 +168,7 @@ var fn = e.object({
|
|
|
167
168
|
custbody_fm_created_by_name: e.string().nullish()
|
|
168
169
|
});
|
|
169
170
|
In.extend({
|
|
170
|
-
glImpacts: e.array(
|
|
171
|
+
glImpacts: e.array(nt).nullish()
|
|
171
172
|
});
|
|
172
173
|
e.object({
|
|
173
174
|
trandate: e.string(),
|
|
@@ -341,11 +342,11 @@ e.object({
|
|
|
341
342
|
custbody_fm_po_id: e.string(),
|
|
342
343
|
custbody_fm_po_num: e.number()
|
|
343
344
|
});
|
|
344
|
-
var
|
|
345
|
+
var Ue;
|
|
345
346
|
(function(s) {
|
|
346
347
|
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";
|
|
347
|
-
})(
|
|
348
|
-
var
|
|
348
|
+
})(Ue || (Ue = {}));
|
|
349
|
+
var ne = e.nativeEnum(Ue), En = e.object({
|
|
349
350
|
amount: e.number().nullish(),
|
|
350
351
|
custcol_fm_line_id: e.string().nullish(),
|
|
351
352
|
item: e.object({
|
|
@@ -463,11 +464,11 @@ e.object({
|
|
|
463
464
|
custbody_fm_po_request_id: e.string(),
|
|
464
465
|
custbody_fm_po_num: e.number()
|
|
465
466
|
});
|
|
466
|
-
var
|
|
467
|
+
var x;
|
|
467
468
|
(function(s) {
|
|
468
469
|
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";
|
|
469
|
-
})(
|
|
470
|
-
var ce = e.nativeEnum(
|
|
470
|
+
})(x || (x = {}));
|
|
471
|
+
var ce = e.nativeEnum(x), Sn = e.object({
|
|
471
472
|
abbreviation: e.string(),
|
|
472
473
|
baseUnit: e.boolean(),
|
|
473
474
|
conversionRate: e.number(),
|
|
@@ -487,14 +488,14 @@ e.object({
|
|
|
487
488
|
totalResults: e.number()
|
|
488
489
|
})
|
|
489
490
|
});
|
|
490
|
-
var
|
|
491
|
+
var Mt = zt.extend({
|
|
491
492
|
nsConfig: Gt
|
|
492
|
-
}),
|
|
493
|
+
}), Ut = Yt.omit({
|
|
493
494
|
measurements: !0
|
|
494
495
|
}).extend({
|
|
495
|
-
nsConfig:
|
|
496
|
-
measurements: e.array(
|
|
497
|
-
}),
|
|
496
|
+
nsConfig: Jt,
|
|
497
|
+
measurements: e.array(Mt)
|
|
498
|
+
}), hn = e.object({
|
|
498
499
|
itemVendorPrice: e.object({
|
|
499
500
|
itemvendorpricelines: e.object({
|
|
500
501
|
items: e.array(e.object({
|
|
@@ -559,7 +560,7 @@ e.object({
|
|
|
559
560
|
refName: e.string()
|
|
560
561
|
}),
|
|
561
562
|
itemVendor: e.object({
|
|
562
|
-
items: e.array(
|
|
563
|
+
items: e.array(hn),
|
|
563
564
|
totalResults: e.number()
|
|
564
565
|
}),
|
|
565
566
|
lastModifiedDate: e.string(),
|
|
@@ -598,20 +599,22 @@ e.object({
|
|
|
598
599
|
custitem_item_externalid: e.string().nullish(),
|
|
599
600
|
custitem_item_externalid_current: e.string().nullish(),
|
|
600
601
|
custitem_pkt_code: e.string().nullish(),
|
|
601
|
-
custitem_pkt_name: e.string().nullish()
|
|
602
|
+
custitem_pkt_name: e.string().nullish(),
|
|
603
|
+
custitem_indonesia_code: e.string().nullish(),
|
|
604
|
+
custitem_indonesia_name: e.string().nullish()
|
|
602
605
|
});
|
|
603
|
-
|
|
606
|
+
Pe.omit({
|
|
604
607
|
unit: !0
|
|
605
608
|
}).extend({
|
|
606
|
-
unit:
|
|
607
|
-
nsConfig:
|
|
609
|
+
unit: Ut,
|
|
610
|
+
nsConfig: Wt
|
|
608
611
|
});
|
|
609
612
|
e.enum([
|
|
610
613
|
"AVG",
|
|
611
614
|
"FIFO",
|
|
612
615
|
"LIFO"
|
|
613
616
|
]);
|
|
614
|
-
var
|
|
617
|
+
var vn = e.object({
|
|
615
618
|
addressBookAddress: e.object({
|
|
616
619
|
attention: e.string().nullish(),
|
|
617
620
|
addressee: e.string(),
|
|
@@ -633,7 +636,7 @@ e.object({
|
|
|
633
636
|
companyName: e.string(),
|
|
634
637
|
dateCreated: e.string(),
|
|
635
638
|
addressBook: e.object({
|
|
636
|
-
items: e.array(
|
|
639
|
+
items: e.array(vn),
|
|
637
640
|
totalResults: e.number()
|
|
638
641
|
}),
|
|
639
642
|
email: e.string().nullish(),
|
|
@@ -667,7 +670,7 @@ var Tn = e.object({
|
|
|
667
670
|
/** FM business ID — pino log context only. */
|
|
668
671
|
businessId: e.string().nullish(),
|
|
669
672
|
/** Sync version override from portal bulk-sync dialog. Missing = follow feature flag. */
|
|
670
|
-
version:
|
|
673
|
+
version: X.optional()
|
|
671
674
|
}).passthrough();
|
|
672
675
|
e.object({
|
|
673
676
|
event: e.string(),
|
|
@@ -685,7 +688,7 @@ var Dn = e.object({
|
|
|
685
688
|
}),
|
|
686
689
|
line: e.number().positive(),
|
|
687
690
|
units: e.string()
|
|
688
|
-
}),
|
|
691
|
+
}), Nn = e.object({
|
|
689
692
|
createdDate: e.string(),
|
|
690
693
|
id: e.string(),
|
|
691
694
|
inventory: e.object({
|
|
@@ -710,7 +713,7 @@ var Dn = e.object({
|
|
|
710
713
|
custbody_fm_po_num: e.number().nullish(),
|
|
711
714
|
custbody_fm_po_request_id: e.string().nullish(),
|
|
712
715
|
custbody_fm_adjustment_id: e.string().nullish()
|
|
713
|
-
}),
|
|
716
|
+
}), Cn = e.object({
|
|
714
717
|
item: e.object({
|
|
715
718
|
id: e.string()
|
|
716
719
|
}),
|
|
@@ -730,7 +733,7 @@ var Dn = e.object({
|
|
|
730
733
|
id: e.string()
|
|
731
734
|
}),
|
|
732
735
|
inventory: e.object({
|
|
733
|
-
items: e.array(
|
|
736
|
+
items: e.array(Cn)
|
|
734
737
|
}),
|
|
735
738
|
custbody_fm_adjustment_id: e.string()
|
|
736
739
|
});
|
|
@@ -745,8 +748,8 @@ e.object({
|
|
|
745
748
|
custbody_fm_po_num: e.number(),
|
|
746
749
|
custbody_fm_po_request_id: e.string().nullish()
|
|
747
750
|
});
|
|
748
|
-
|
|
749
|
-
glImpacts: e.array(
|
|
751
|
+
Nn.extend({
|
|
752
|
+
glImpacts: e.array(nt).nullish()
|
|
750
753
|
});
|
|
751
754
|
e.object({
|
|
752
755
|
externalId: e.string(),
|
|
@@ -814,7 +817,7 @@ e.object({
|
|
|
814
817
|
id: e.string(),
|
|
815
818
|
createdAt: e.string(),
|
|
816
819
|
effectiveAt: e.string(),
|
|
817
|
-
recordType:
|
|
820
|
+
recordType: Re,
|
|
818
821
|
status: e.string().optional(),
|
|
819
822
|
fulfillments: e.array(e.string()).optional(),
|
|
820
823
|
receipts: e.array(e.string()).optional()
|
|
@@ -930,7 +933,9 @@ e.object({
|
|
|
930
933
|
totalResults: e.number()
|
|
931
934
|
}).nullish(),
|
|
932
935
|
/// custom fields
|
|
933
|
-
externalId: e.string().nullish()
|
|
936
|
+
externalId: e.string().nullish(),
|
|
937
|
+
custitem_indonesia_code: e.string().nullish(),
|
|
938
|
+
custitem_indonesia_name: e.string().nullish()
|
|
934
939
|
});
|
|
935
940
|
var Mn = e.enum([
|
|
936
941
|
"Resale",
|
|
@@ -1031,18 +1036,18 @@ e.object({
|
|
|
1031
1036
|
endDate: e.string().optional(),
|
|
1032
1037
|
destinationLocationId: e.string().optional()
|
|
1033
1038
|
});
|
|
1034
|
-
function
|
|
1035
|
-
return
|
|
1039
|
+
function Je(s) {
|
|
1040
|
+
return je.FCurrency.safeParse(s.trim().toUpperCase()).success;
|
|
1036
1041
|
}
|
|
1037
|
-
g(
|
|
1038
|
-
function
|
|
1042
|
+
g(Je, "isCurrencySupported");
|
|
1043
|
+
function it(s) {
|
|
1039
1044
|
const { purchasePrice: u, itemBaseCurrencyId: d, itemBaseCurrencyName: c, targetCurrencyId: r, nsExchangeRates: n } = s;
|
|
1040
1045
|
if (u == null)
|
|
1041
1046
|
return null;
|
|
1042
1047
|
if (d.length === 0)
|
|
1043
1048
|
throw new Error("Item base currency ID is missing for purchase price conversion.");
|
|
1044
1049
|
const i = {
|
|
1045
|
-
currency:
|
|
1050
|
+
currency: Je(c) ? c : Me,
|
|
1046
1051
|
...M.fromNumber(u)
|
|
1047
1052
|
};
|
|
1048
1053
|
if (d === r)
|
|
@@ -1050,7 +1055,7 @@ function nt(s) {
|
|
|
1050
1055
|
const o = n.find((a) => a.from_curr_id === d && a.to_curr_id === r);
|
|
1051
1056
|
if (!o)
|
|
1052
1057
|
throw new Error(`Exchange rate not found from currency ID ${d ?? "unknown"} to target currency ID ${r}`);
|
|
1053
|
-
const m =
|
|
1058
|
+
const m = Je(o.to_curr) ? o.to_curr : Me, l = M.fromNumber(Number(o.exchangerate)), f = M.multiply([
|
|
1054
1059
|
M.fromNumber(u),
|
|
1055
1060
|
l
|
|
1056
1061
|
]);
|
|
@@ -1059,69 +1064,69 @@ function nt(s) {
|
|
|
1059
1064
|
...f
|
|
1060
1065
|
};
|
|
1061
1066
|
}
|
|
1062
|
-
g(
|
|
1063
|
-
var
|
|
1067
|
+
g(it, "getPurchasePriceInDifferentCurrency");
|
|
1068
|
+
var yt;
|
|
1064
1069
|
(function(s) {
|
|
1065
1070
|
(function(u) {
|
|
1066
1071
|
function d(r, n) {
|
|
1067
|
-
var
|
|
1072
|
+
var h, k;
|
|
1068
1073
|
const { nsAssemblyItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } = r;
|
|
1069
1074
|
if (!t.unitsType)
|
|
1070
1075
|
throw new Error(`Missing unit type in NetSuite assembly item ${t.id}`);
|
|
1071
1076
|
if (o.netSuiteId !== t.unitsType.id)
|
|
1072
1077
|
throw new Error(`Unit type mismatch for NetSuite assembly item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
1073
|
-
const f = t.subsidiary.items.map((
|
|
1074
|
-
prefix:
|
|
1075
|
-
}), I = (
|
|
1076
|
-
const
|
|
1078
|
+
const f = t.subsidiary.items.map((A) => A.id), a = L({
|
|
1079
|
+
prefix: $.Enum.sku
|
|
1080
|
+
}), I = (h = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : h.reduce((A, D) => {
|
|
1081
|
+
const T = D.compute(r);
|
|
1077
1082
|
return {
|
|
1078
|
-
...
|
|
1079
|
-
[
|
|
1083
|
+
...A,
|
|
1084
|
+
[D.fieldId]: T
|
|
1080
1085
|
};
|
|
1081
1086
|
}, {}), p = t.purchaseUnit === t.baseUnit;
|
|
1082
1087
|
let y = null;
|
|
1083
1088
|
if (!p) {
|
|
1084
|
-
const
|
|
1085
|
-
if (!N)
|
|
1086
|
-
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.`);
|
|
1087
|
-
const A = i.measurements.find((D) => D.id === N.id);
|
|
1089
|
+
const A = o.measurements.find((T) => T.netSuiteId === t.purchaseUnit);
|
|
1088
1090
|
if (!A)
|
|
1089
|
-
throw new Error(`Measurement with ID ${
|
|
1090
|
-
|
|
1091
|
+
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.`);
|
|
1092
|
+
const D = i.measurements.find((T) => T.id === A.id);
|
|
1093
|
+
if (!D)
|
|
1094
|
+
throw new Error(`Measurement with ID ${A.id} not found in unit ${i._id}. This indicates a data inconsistency. Please investigate.`);
|
|
1095
|
+
y = D;
|
|
1091
1096
|
}
|
|
1092
|
-
const
|
|
1093
|
-
const
|
|
1097
|
+
const _ = (k = n == null ? void 0 : n.overrideAttributes) == null ? void 0 : k.reduce((A, D) => {
|
|
1098
|
+
const T = D.compute(r);
|
|
1094
1099
|
return {
|
|
1095
|
-
...
|
|
1096
|
-
[
|
|
1100
|
+
...A,
|
|
1101
|
+
[D.fieldId]: T
|
|
1097
1102
|
};
|
|
1098
|
-
}, {}),
|
|
1103
|
+
}, {}), b = t.currency.refName.trim().toUpperCase(), S = t.cost ?? t.lastPurchasePrice, E = it({
|
|
1099
1104
|
purchasePrice: S,
|
|
1100
1105
|
nsExchangeRates: m ?? [],
|
|
1101
1106
|
itemBaseCurrencyId: t.currency.id,
|
|
1102
|
-
itemBaseCurrencyName:
|
|
1107
|
+
itemBaseCurrencyName: b,
|
|
1103
1108
|
targetCurrencyId: l
|
|
1104
|
-
}),
|
|
1109
|
+
}), v = {
|
|
1105
1110
|
_id: a,
|
|
1106
1111
|
name: t.itemId,
|
|
1107
1112
|
code: t.id,
|
|
1108
1113
|
unit: i,
|
|
1109
1114
|
trackingMeasurement: (y == null ? void 0 : y.id) ?? null,
|
|
1110
1115
|
convert: null,
|
|
1111
|
-
valuation:
|
|
1116
|
+
valuation: kt(t),
|
|
1112
1117
|
isInactive: t.isInactive,
|
|
1113
|
-
defaultCost:
|
|
1118
|
+
defaultCost: E ? {
|
|
1114
1119
|
...y && {
|
|
1115
1120
|
measurement: y
|
|
1116
1121
|
},
|
|
1117
|
-
costPerUnit:
|
|
1122
|
+
costPerUnit: E
|
|
1118
1123
|
} : null,
|
|
1119
|
-
...
|
|
1124
|
+
..._
|
|
1120
1125
|
};
|
|
1121
1126
|
return {
|
|
1122
1127
|
businessId: "",
|
|
1123
1128
|
itemType: t.itemType.refName,
|
|
1124
|
-
skuCache:
|
|
1129
|
+
skuCache: v,
|
|
1125
1130
|
name: t.itemId,
|
|
1126
1131
|
netSuiteId: String(t.internalId),
|
|
1127
1132
|
unitTypeId: t.unitsType.id,
|
|
@@ -1175,52 +1180,52 @@ var pt;
|
|
|
1175
1180
|
}
|
|
1176
1181
|
g(c, "transformAsChild"), u.transformAsChild = c;
|
|
1177
1182
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1178
|
-
})(
|
|
1179
|
-
function
|
|
1183
|
+
})(yt || (yt = {}));
|
|
1184
|
+
function kt(s) {
|
|
1180
1185
|
switch (s.costingMethod.id) {
|
|
1181
1186
|
case "FIFO":
|
|
1182
|
-
return
|
|
1187
|
+
return Ne.Enum.FIFO;
|
|
1183
1188
|
case "LIFO":
|
|
1184
|
-
return
|
|
1189
|
+
return Ne.Enum.LIFO;
|
|
1185
1190
|
default:
|
|
1186
|
-
return
|
|
1191
|
+
return Ne.Enum.WAVG;
|
|
1187
1192
|
}
|
|
1188
1193
|
}
|
|
1189
|
-
g(
|
|
1190
|
-
var
|
|
1194
|
+
g(kt, "_getValuation");
|
|
1195
|
+
var gt;
|
|
1191
1196
|
(function(s) {
|
|
1192
1197
|
(function(u) {
|
|
1193
1198
|
function d(c, r) {
|
|
1194
|
-
var
|
|
1199
|
+
var _, b;
|
|
1195
1200
|
const { nsServiceItem: n, fmUnit: t, nsUnitTypeConfig: i } = c;
|
|
1196
1201
|
if (!n.unitsType)
|
|
1197
1202
|
throw new Error(`Missing unit type in NetSuite service item ${n.id}`);
|
|
1198
1203
|
if (i.netSuiteId !== n.unitsType.id)
|
|
1199
1204
|
throw new Error(`Unit type mismatch for NetSuite service item ${n.id}: expected unit type ID ${n.unitsType.id}, got ${i.netSuiteId}`);
|
|
1200
|
-
const o = n.subsidiary.items.map((S) => S.id), m =
|
|
1201
|
-
prefix:
|
|
1202
|
-
}), l = (
|
|
1203
|
-
const
|
|
1205
|
+
const o = n.subsidiary.items.map((S) => S.id), m = L({
|
|
1206
|
+
prefix: $.Enum.sku
|
|
1207
|
+
}), l = (_ = r == null ? void 0 : r.netsuiteCustomAttributes) == null ? void 0 : _.reduce((S, E) => {
|
|
1208
|
+
const v = E.compute(c);
|
|
1204
1209
|
return {
|
|
1205
1210
|
...S,
|
|
1206
|
-
[
|
|
1211
|
+
[E.fieldId]: v
|
|
1207
1212
|
};
|
|
1208
1213
|
}, {}), f = n.purchaseUnit === n.baseUnit;
|
|
1209
1214
|
let a = null;
|
|
1210
1215
|
if (!f) {
|
|
1211
|
-
const S = i.measurements.find((
|
|
1216
|
+
const S = i.measurements.find((v) => v.netSuiteId === n.purchaseUnit);
|
|
1212
1217
|
if (!S)
|
|
1213
1218
|
throw new Error(`Measurement with NetSuite ID ${n.purchaseUnit} not found in unit ${t._id} (NetSuite unit type ${n.unitsType.id}). Please sync unit types before syncing service items.`);
|
|
1214
|
-
const
|
|
1215
|
-
if (!
|
|
1219
|
+
const E = t.measurements.find((v) => v.id === S.id);
|
|
1220
|
+
if (!E)
|
|
1216
1221
|
throw new Error(`Measurement with ID ${S.id} not found in unit ${t._id}. This indicates a data inconsistency. Please investigate.`);
|
|
1217
|
-
a =
|
|
1222
|
+
a = E;
|
|
1218
1223
|
}
|
|
1219
|
-
const I = (
|
|
1220
|
-
const
|
|
1224
|
+
const I = (b = r == null ? void 0 : r.overrideAttributes) == null ? void 0 : b.reduce((S, E) => {
|
|
1225
|
+
const v = E.compute(c);
|
|
1221
1226
|
return {
|
|
1222
1227
|
...S,
|
|
1223
|
-
[
|
|
1228
|
+
[E.fieldId]: v
|
|
1224
1229
|
};
|
|
1225
1230
|
}, {}), p = {
|
|
1226
1231
|
_id: m,
|
|
@@ -1258,69 +1263,69 @@ var yt;
|
|
|
1258
1263
|
}
|
|
1259
1264
|
g(d, "transformAsParent"), u.transformAsParent = d;
|
|
1260
1265
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1261
|
-
})(
|
|
1262
|
-
var
|
|
1266
|
+
})(gt || (gt = {}));
|
|
1267
|
+
var Et;
|
|
1263
1268
|
(function(s) {
|
|
1264
1269
|
(function(u) {
|
|
1265
1270
|
function d(r, n) {
|
|
1266
|
-
var
|
|
1271
|
+
var h, k;
|
|
1267
1272
|
const { nsInventoryItem: t, fmUnit: i, nsUnitTypeConfig: o, nsExchangeRates: m, nsTargetCurrencyId: l } = r;
|
|
1268
1273
|
if (!t.unitsType)
|
|
1269
1274
|
throw new Error(`Missing unit type in NetSuite inventory item ${t.id}`);
|
|
1270
1275
|
if (o.netSuiteId !== t.unitsType.id)
|
|
1271
1276
|
throw new Error(`Unit type mismatch for NetSuite inventory item ${t.id}: expected unit type ID ${t.unitsType.id}, got ${o.netSuiteId}`);
|
|
1272
|
-
const f = t.subsidiary.items.map((
|
|
1273
|
-
prefix:
|
|
1274
|
-
}), I = (
|
|
1275
|
-
const
|
|
1277
|
+
const f = t.subsidiary.items.map((A) => A.id), a = L({
|
|
1278
|
+
prefix: $.Enum.sku
|
|
1279
|
+
}), I = (h = n == null ? void 0 : n.netsuiteCustomAttributes) == null ? void 0 : h.reduce((A, D) => {
|
|
1280
|
+
const T = D.compute(r);
|
|
1276
1281
|
return {
|
|
1277
|
-
...
|
|
1278
|
-
[
|
|
1282
|
+
...A,
|
|
1283
|
+
[D.fieldId]: T
|
|
1279
1284
|
};
|
|
1280
1285
|
}, {}), p = t.purchaseUnit === t.baseUnit;
|
|
1281
1286
|
let y = null;
|
|
1282
1287
|
if (!p) {
|
|
1283
|
-
const
|
|
1284
|
-
if (!N)
|
|
1285
|
-
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.`);
|
|
1286
|
-
const A = i.measurements.find((D) => D.id === N.id);
|
|
1288
|
+
const A = o.measurements.find((T) => T.netSuiteId === t.purchaseUnit);
|
|
1287
1289
|
if (!A)
|
|
1288
|
-
throw new Error(`Measurement with ID ${
|
|
1289
|
-
|
|
1290
|
+
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.`);
|
|
1291
|
+
const D = i.measurements.find((T) => T.id === A.id);
|
|
1292
|
+
if (!D)
|
|
1293
|
+
throw new Error(`Measurement with ID ${A.id} not found in unit ${i._id}. This indicates a data inconsistency. Please investigate.`);
|
|
1294
|
+
y = D;
|
|
1290
1295
|
}
|
|
1291
|
-
const
|
|
1292
|
-
const
|
|
1296
|
+
const _ = (k = n == null ? void 0 : n.overrideAttributes) == null ? void 0 : k.reduce((A, D) => {
|
|
1297
|
+
const T = D.compute(r);
|
|
1293
1298
|
return {
|
|
1294
|
-
...
|
|
1295
|
-
[
|
|
1299
|
+
...A,
|
|
1300
|
+
[D.fieldId]: T
|
|
1296
1301
|
};
|
|
1297
|
-
}, {}),
|
|
1302
|
+
}, {}), b = t.currency.refName.trim().toUpperCase(), S = t.cost, E = it({
|
|
1298
1303
|
purchasePrice: S,
|
|
1299
1304
|
nsExchangeRates: m ?? [],
|
|
1300
1305
|
itemBaseCurrencyId: t.currency.id,
|
|
1301
|
-
itemBaseCurrencyName:
|
|
1306
|
+
itemBaseCurrencyName: b,
|
|
1302
1307
|
targetCurrencyId: l
|
|
1303
|
-
}),
|
|
1308
|
+
}), v = {
|
|
1304
1309
|
_id: a,
|
|
1305
1310
|
name: t.itemId,
|
|
1306
1311
|
code: t.id,
|
|
1307
1312
|
unit: i,
|
|
1308
1313
|
trackingMeasurement: (y == null ? void 0 : y.id) ?? null,
|
|
1309
1314
|
convert: null,
|
|
1310
|
-
valuation:
|
|
1315
|
+
valuation: wt(t),
|
|
1311
1316
|
isInactive: t.isInactive,
|
|
1312
|
-
defaultCost:
|
|
1317
|
+
defaultCost: E ? {
|
|
1313
1318
|
...y && {
|
|
1314
1319
|
measurement: y
|
|
1315
1320
|
},
|
|
1316
|
-
costPerUnit:
|
|
1321
|
+
costPerUnit: E
|
|
1317
1322
|
} : null,
|
|
1318
|
-
...
|
|
1323
|
+
..._
|
|
1319
1324
|
};
|
|
1320
1325
|
return {
|
|
1321
1326
|
businessId: "",
|
|
1322
1327
|
itemType: t.itemType.refName,
|
|
1323
|
-
skuCache:
|
|
1328
|
+
skuCache: v,
|
|
1324
1329
|
name: t.itemId,
|
|
1325
1330
|
netSuiteId: String(t.internalId),
|
|
1326
1331
|
unitTypeId: t.unitsType.id,
|
|
@@ -1374,20 +1379,20 @@ var gt;
|
|
|
1374
1379
|
}
|
|
1375
1380
|
g(c, "transformAsChild"), u.transformAsChild = c;
|
|
1376
1381
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1377
|
-
})(
|
|
1378
|
-
function
|
|
1382
|
+
})(Et || (Et = {}));
|
|
1383
|
+
function wt(s) {
|
|
1379
1384
|
switch (s.costingMethod.id) {
|
|
1380
1385
|
case "FIFO":
|
|
1381
|
-
return
|
|
1386
|
+
return Ne.Enum.FIFO;
|
|
1382
1387
|
case "LIFO":
|
|
1383
|
-
return
|
|
1388
|
+
return Ne.Enum.LIFO;
|
|
1384
1389
|
default:
|
|
1385
|
-
return
|
|
1390
|
+
return Ne.Enum.WAVG;
|
|
1386
1391
|
}
|
|
1387
1392
|
}
|
|
1388
|
-
g(
|
|
1389
|
-
function
|
|
1390
|
-
let c = 0, r =
|
|
1393
|
+
g(wt, "_getValuation");
|
|
1394
|
+
function rt(s, u, d) {
|
|
1395
|
+
let c = 0, r = Me;
|
|
1391
1396
|
const n = s == null ? void 0 : s.find((t) => t.itemid === d && t.hascostline === "T" && t.transactionline === u);
|
|
1392
1397
|
if (n) {
|
|
1393
1398
|
const t = s == null ? void 0 : s.find((i) => i.itemid === d && Number(i.amount) > 0 && i.transactionline === String(Number(n.transactionline) + 1));
|
|
@@ -1401,15 +1406,15 @@ function it(s, u, d) {
|
|
|
1401
1406
|
currency: r
|
|
1402
1407
|
};
|
|
1403
1408
|
}
|
|
1404
|
-
g(
|
|
1405
|
-
var
|
|
1409
|
+
g(rt, "getGLImpactCostMapping");
|
|
1410
|
+
var se;
|
|
1406
1411
|
(function(s) {
|
|
1407
1412
|
(function(u) {
|
|
1408
1413
|
function d(n) {
|
|
1409
1414
|
var p;
|
|
1410
1415
|
const { poItem: t, nsItemSetting: i, nsUnitTypes: o, overrideCost: m = !0, customAttributes: l } = n;
|
|
1411
1416
|
let f;
|
|
1412
|
-
if (t.totalCost && (m || i.itemType ===
|
|
1417
|
+
if (t.totalCost && (m || i.itemType === F.Enum.Service)) {
|
|
1413
1418
|
const y = M.divide([
|
|
1414
1419
|
t.totalCost,
|
|
1415
1420
|
t.quantity
|
|
@@ -1426,19 +1431,19 @@ var ie;
|
|
|
1426
1431
|
let a;
|
|
1427
1432
|
if (t.measurement) {
|
|
1428
1433
|
const y = t.measurement.id;
|
|
1429
|
-
for (const
|
|
1430
|
-
for (const
|
|
1431
|
-
if (
|
|
1432
|
-
a =
|
|
1434
|
+
for (const _ of o)
|
|
1435
|
+
for (const b of (_ == null ? void 0 : _.measurements) || [])
|
|
1436
|
+
if (b.id === y) {
|
|
1437
|
+
a = b.netSuiteId;
|
|
1433
1438
|
break;
|
|
1434
1439
|
}
|
|
1435
1440
|
} else
|
|
1436
1441
|
a = (p = o.find((y) => y.id == t.sku.unit._id)) == null ? void 0 : p.baseUnitUnitOfMeasureId;
|
|
1437
|
-
const I = l == null ? void 0 : l.reduce((y,
|
|
1438
|
-
const
|
|
1442
|
+
const I = l == null ? void 0 : l.reduce((y, _) => {
|
|
1443
|
+
const b = _.compute(n, _.extraParams);
|
|
1439
1444
|
return {
|
|
1440
1445
|
...y,
|
|
1441
|
-
[
|
|
1446
|
+
[_.fieldId]: b
|
|
1442
1447
|
};
|
|
1443
1448
|
}, {});
|
|
1444
1449
|
return {
|
|
@@ -1522,14 +1527,14 @@ var ie;
|
|
|
1522
1527
|
g(r, "toPurchaseOrderItemUpdateDto"), u.toPurchaseOrderItemUpdateDto = r;
|
|
1523
1528
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
1524
1529
|
function d(r) {
|
|
1525
|
-
var y,
|
|
1526
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency: m } = r, l = (
|
|
1527
|
-
const
|
|
1530
|
+
var y, _, b;
|
|
1531
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, currency: m } = r, l = (b = (_ = (y = o == null ? void 0 : o.options) == null ? void 0 : y.purchaseOrderItem) == null ? void 0 : _.customAttributes) == null ? void 0 : b.reduce((S, E) => {
|
|
1532
|
+
const v = E.compute(r, E.extraParams);
|
|
1528
1533
|
return {
|
|
1529
1534
|
...S,
|
|
1530
|
-
[
|
|
1535
|
+
[E.fieldId]: v
|
|
1531
1536
|
};
|
|
1532
|
-
}, {}), f = M.fromNumber(n.quantity), a = n.amount ? M.fromNumber(n.amount) : M.fromNumber(0), I =
|
|
1537
|
+
}, {}), f = M.fromNumber(n.quantity), a = n.amount ? M.fromNumber(n.amount) : M.fromNumber(0), I = je.FCurrency.safeParse(m), p = I.success ? I.data : Me;
|
|
1533
1538
|
return {
|
|
1534
1539
|
id: "",
|
|
1535
1540
|
externalId: String(n.line),
|
|
@@ -1551,14 +1556,14 @@ var ie;
|
|
|
1551
1556
|
}
|
|
1552
1557
|
g(d, "toPurchaseOrderItem"), u.toPurchaseOrderItem = d;
|
|
1553
1558
|
function c(r) {
|
|
1554
|
-
var
|
|
1555
|
-
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost: m } = r, { cost: l, currency: f } =
|
|
1556
|
-
const
|
|
1559
|
+
var b, S, E;
|
|
1560
|
+
const { nsOrderItem: n, sku: t, measurement: i, context: o, glImpactCost: m } = r, { cost: l, currency: f } = rt(m, String(n.line), n.item.id), a = (E = (S = (b = o == null ? void 0 : o.options) == null ? void 0 : b.purchaseOrderReceived) == null ? void 0 : S.customAttributes) == null ? void 0 : E.reduce((v, U) => {
|
|
1561
|
+
const h = U.compute(r);
|
|
1557
1562
|
return {
|
|
1558
|
-
...
|
|
1559
|
-
[
|
|
1563
|
+
...v,
|
|
1564
|
+
[U.fieldId]: h
|
|
1560
1565
|
};
|
|
1561
|
-
}, {}), I = M.fromNumber(n.quantity), p = M.fromNumber(l), y =
|
|
1566
|
+
}, {}), I = M.fromNumber(n.quantity), p = M.fromNumber(l), y = je.FCurrency.safeParse(f), _ = y.success ? y.data : Me;
|
|
1562
1567
|
return {
|
|
1563
1568
|
id: "",
|
|
1564
1569
|
externalId: String(n.orderLine),
|
|
@@ -1570,7 +1575,7 @@ var ie;
|
|
|
1570
1575
|
cost: {
|
|
1571
1576
|
amount: p.amount,
|
|
1572
1577
|
precision: p.precision,
|
|
1573
|
-
currency:
|
|
1578
|
+
currency: _
|
|
1574
1579
|
},
|
|
1575
1580
|
measurement: i ?? null,
|
|
1576
1581
|
...a
|
|
@@ -1578,8 +1583,8 @@ var ie;
|
|
|
1578
1583
|
}
|
|
1579
1584
|
g(c, "toPurchaseOrderReceived"), u.toPurchaseOrderReceived = c;
|
|
1580
1585
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1581
|
-
})(
|
|
1582
|
-
var
|
|
1586
|
+
})(se || (se = {}));
|
|
1587
|
+
var _t;
|
|
1583
1588
|
(function(s) {
|
|
1584
1589
|
(function(u) {
|
|
1585
1590
|
function d(c) {
|
|
@@ -1594,17 +1599,17 @@ var Et;
|
|
|
1594
1599
|
}
|
|
1595
1600
|
g(d, "transform"), u.transform = d;
|
|
1596
1601
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
1597
|
-
})(
|
|
1598
|
-
var
|
|
1602
|
+
})(_t || (_t = {}));
|
|
1603
|
+
var We;
|
|
1599
1604
|
(function(s) {
|
|
1600
1605
|
(function(u) {
|
|
1601
1606
|
function d(c, r, n, t) {
|
|
1602
1607
|
var m;
|
|
1603
1608
|
if (!n.every((l) => l.externalId))
|
|
1604
1609
|
throw new Error("All purchase order items must have externalId");
|
|
1605
|
-
if (c !==
|
|
1610
|
+
if (c !== X.Enum[1] && !t.items.every((l) => l.id))
|
|
1606
1611
|
throw new Error("All delivery fulfillment items must have id, if not v1");
|
|
1607
|
-
const i = t.items.reduce((l, f) => (c ===
|
|
1612
|
+
const i = t.items.reduce((l, f) => (c === X.Enum[1] ? l[f.sku._id] = f : l[f.id] = f, l), {}), o = [];
|
|
1608
1613
|
for (const l of n) {
|
|
1609
1614
|
if (((m = l.sku.customAttributes) == null ? void 0 : m.isFulfillable) === !1)
|
|
1610
1615
|
continue;
|
|
@@ -1612,7 +1617,7 @@ var Je;
|
|
|
1612
1617
|
if (!I)
|
|
1613
1618
|
throw new Error(`Invalid line id ${l.externalId}`);
|
|
1614
1619
|
let p;
|
|
1615
|
-
c ===
|
|
1620
|
+
c === X.Enum[1] ? p = i[l.sku._id] : p = i[l.id], p ? o.push({
|
|
1616
1621
|
item: {
|
|
1617
1622
|
id: I.item.id
|
|
1618
1623
|
},
|
|
@@ -1641,7 +1646,7 @@ var Je;
|
|
|
1641
1646
|
function d(c, r, n) {
|
|
1642
1647
|
const t = n.item.items.map((o) => {
|
|
1643
1648
|
const m = r[o.line].sku, l = r[o.line].measurement;
|
|
1644
|
-
return
|
|
1649
|
+
return se.FromNetSuite.toPurchaseOrderReceived({
|
|
1645
1650
|
context: c,
|
|
1646
1651
|
glImpactCost: n.glImpacts ?? [],
|
|
1647
1652
|
nsOrderItem: o,
|
|
@@ -1662,21 +1667,21 @@ var Je;
|
|
|
1662
1667
|
}
|
|
1663
1668
|
g(d, "transform"), u.transform = d;
|
|
1664
1669
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1665
|
-
})(
|
|
1666
|
-
function
|
|
1670
|
+
})(We || (We = {}));
|
|
1671
|
+
function xe(s) {
|
|
1667
1672
|
const u = s.getFullYear(), d = String(s.getMonth() + 1).padStart(2, "0"), c = String(s.getDate()).padStart(2, "0");
|
|
1668
1673
|
return `${u}-${d}-${c}`;
|
|
1669
1674
|
}
|
|
1670
|
-
g(
|
|
1671
|
-
function
|
|
1675
|
+
g(xe, "formatDateYYYYMMDD");
|
|
1676
|
+
function ee(s, u) {
|
|
1672
1677
|
return s.getDate() === u.getDate() && s.getMonth() === u.getMonth() && s.getFullYear() === u.getFullYear();
|
|
1673
1678
|
}
|
|
1674
|
-
g(
|
|
1675
|
-
var
|
|
1679
|
+
g(ee, "isSameDay");
|
|
1680
|
+
var Ve;
|
|
1676
1681
|
(function(s) {
|
|
1677
1682
|
(function(u) {
|
|
1678
1683
|
function d(c, r, n, t, i) {
|
|
1679
|
-
const o =
|
|
1684
|
+
const o = xe(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) => {
|
|
1680
1685
|
var I;
|
|
1681
1686
|
let a = f.id ? (I = m[f.id]) == null ? void 0 : I.externalId : void 0;
|
|
1682
1687
|
if (a) {
|
|
@@ -1708,7 +1713,7 @@ var je;
|
|
|
1708
1713
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
1709
1714
|
})(s.ToNetSuiteTransferOrder || (s.ToNetSuiteTransferOrder = {})), function(u) {
|
|
1710
1715
|
function d(c, r, n, t) {
|
|
1711
|
-
const i =
|
|
1716
|
+
const i = xe(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) => {
|
|
1712
1717
|
var a;
|
|
1713
1718
|
let f = l.id ? (a = o[l.id]) == null ? void 0 : a.externalId : void 0;
|
|
1714
1719
|
if (f) {
|
|
@@ -1742,7 +1747,7 @@ var je;
|
|
|
1742
1747
|
var o;
|
|
1743
1748
|
const t = n.item.items.map((m) => {
|
|
1744
1749
|
const l = r[m.line].sku, f = r[m.line].measurement;
|
|
1745
|
-
return
|
|
1750
|
+
return se.FromNetSuite.toPurchaseOrderReceived({
|
|
1746
1751
|
context: c,
|
|
1747
1752
|
glImpactCost: n.glImpacts ?? [],
|
|
1748
1753
|
nsOrderItem: m,
|
|
@@ -1769,9 +1774,9 @@ var je;
|
|
|
1769
1774
|
}
|
|
1770
1775
|
g(d, "transform"), u.transform = d;
|
|
1771
1776
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
1772
|
-
})(
|
|
1773
|
-
function
|
|
1774
|
-
switch (
|
|
1777
|
+
})(Ve || (Ve = {}));
|
|
1778
|
+
function Rt(s) {
|
|
1779
|
+
switch (x[s.id]) {
|
|
1775
1780
|
case ce.enum.A:
|
|
1776
1781
|
return B.Enum.REQUESTING;
|
|
1777
1782
|
case ce.enum.B:
|
|
@@ -1789,50 +1794,50 @@ function wt(s) {
|
|
|
1789
1794
|
}
|
|
1790
1795
|
throw new Error(`Invalid NetSuite Transfer Order status with ${s.id}`);
|
|
1791
1796
|
}
|
|
1792
|
-
g(
|
|
1793
|
-
function
|
|
1794
|
-
switch (
|
|
1795
|
-
case
|
|
1797
|
+
g(Rt, "validateTransferOrderStatusByKey");
|
|
1798
|
+
function Ft(s) {
|
|
1799
|
+
switch (Ue[s.id]) {
|
|
1800
|
+
case ne.enum.A:
|
|
1796
1801
|
return B.Enum.PROCESSING;
|
|
1797
|
-
case
|
|
1802
|
+
case ne.enum.C:
|
|
1798
1803
|
return B.Enum.REJECT;
|
|
1799
|
-
case
|
|
1800
|
-
case
|
|
1801
|
-
case
|
|
1804
|
+
case ne.enum.B:
|
|
1805
|
+
case ne.enum.D:
|
|
1806
|
+
case ne.enum.E:
|
|
1802
1807
|
return B.Enum.RECEIVING;
|
|
1803
|
-
case
|
|
1804
|
-
case
|
|
1808
|
+
case ne.enum.F:
|
|
1809
|
+
case ne.enum.G:
|
|
1805
1810
|
return B.Enum.COMPLETE;
|
|
1806
|
-
case
|
|
1811
|
+
case ne.enum.H:
|
|
1807
1812
|
return B.Enum.CLOSE;
|
|
1808
1813
|
}
|
|
1809
1814
|
throw new Error(`Invalid NetSuite Purchase Order status with ${s.id}`);
|
|
1810
1815
|
}
|
|
1811
|
-
g(
|
|
1812
|
-
function
|
|
1813
|
-
const u = Object.keys(
|
|
1816
|
+
g(Ft, "validatePurchaseOrderStatusByKey");
|
|
1817
|
+
function Be(s) {
|
|
1818
|
+
const u = Object.keys(x).find((d) => x[d] === s);
|
|
1814
1819
|
if (!u)
|
|
1815
1820
|
throw new Error(`Invalid transfer order status value: ${s}`);
|
|
1816
1821
|
return u;
|
|
1817
1822
|
}
|
|
1818
|
-
g(
|
|
1819
|
-
function
|
|
1820
|
-
const u = Object.keys(
|
|
1823
|
+
g(Be, "getTransferOrderStatusEnumKeyByValue");
|
|
1824
|
+
function Qe(s) {
|
|
1825
|
+
const u = Object.keys(Ue).find((d) => Ue[d] === s);
|
|
1821
1826
|
if (!u)
|
|
1822
1827
|
throw new Error(`Invalid purchase order status value: ${s}`);
|
|
1823
1828
|
return u;
|
|
1824
1829
|
}
|
|
1825
|
-
g(
|
|
1826
|
-
function
|
|
1830
|
+
g(Qe, "getPurchaseOrderStatusEnumKeyByValue");
|
|
1831
|
+
function xt(s, u, d) {
|
|
1827
1832
|
const c = d.filter((a) => a.field === "TRANDOC.KSTATUS"), r = [
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
+
x.B,
|
|
1834
|
+
x.D,
|
|
1835
|
+
x.E,
|
|
1836
|
+
x.F,
|
|
1837
|
+
x.G
|
|
1833
1838
|
], n = [
|
|
1834
|
-
|
|
1835
|
-
], t = Object.keys(
|
|
1839
|
+
x.C
|
|
1840
|
+
], t = Object.keys(x).filter((a) => r.includes(x[a])), i = Object.keys(x).filter((a) => n.includes(x[a])), o = c.find((a) => a.status === "Rejected"), m = c.find((a) => a.status === "Pending Fulfillment");
|
|
1836
1841
|
let l = null, f = null;
|
|
1837
1842
|
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)
|
|
1838
1843
|
throw new Error("Both processedAt and rejectedAt are set.");
|
|
@@ -1841,21 +1846,21 @@ function Ft(s, u, d) {
|
|
|
1841
1846
|
rejectedAt: f ? f.toISOString() : null
|
|
1842
1847
|
};
|
|
1843
1848
|
}
|
|
1844
|
-
g(
|
|
1849
|
+
g(xt, "getPurchaseOrderRequestStatusTimestamp");
|
|
1845
1850
|
function Pt(s) {
|
|
1846
1851
|
const u = s.shipDate;
|
|
1847
1852
|
if (!u)
|
|
1848
1853
|
return null;
|
|
1849
1854
|
const d = /* @__PURE__ */ new Date();
|
|
1850
1855
|
return {
|
|
1851
|
-
type:
|
|
1856
|
+
type: At.Enum.PREPARING,
|
|
1852
1857
|
description: "Expected Delivery Date (Synced from NetSuite)",
|
|
1853
1858
|
createdAt: d.toISOString(),
|
|
1854
1859
|
estimatedTime: new Date(u).toISOString()
|
|
1855
1860
|
};
|
|
1856
1861
|
}
|
|
1857
1862
|
g(Pt, "transformTransferOrderPreparingShipmentMilestoneFromNetSuite");
|
|
1858
|
-
var
|
|
1863
|
+
var bt;
|
|
1859
1864
|
(function(s) {
|
|
1860
1865
|
(function(u) {
|
|
1861
1866
|
function d({ setting: n, purchaseOrderRequest: t, status: i = ce.enum.A, overrideItemCost: o = !0, customItemAttributes: m, customFields: l }) {
|
|
@@ -1865,11 +1870,11 @@ var _t;
|
|
|
1865
1870
|
if (t.netSuite.subsidiary === void 0)
|
|
1866
1871
|
throw new Error("Purchase order request does not have a NetSuite subsidiary");
|
|
1867
1872
|
const a = f.items.map((y) => {
|
|
1868
|
-
const
|
|
1869
|
-
return
|
|
1873
|
+
const _ = n.items.find((b) => b.id === y.sku._id);
|
|
1874
|
+
return se.ToNetSuite.toCreateDto({
|
|
1870
1875
|
poItem: y,
|
|
1871
1876
|
nsUnitTypes: n.units,
|
|
1872
|
-
nsItemSetting:
|
|
1877
|
+
nsItemSetting: _,
|
|
1873
1878
|
overrideCost: o,
|
|
1874
1879
|
customAttributes: m
|
|
1875
1880
|
});
|
|
@@ -1892,7 +1897,7 @@ var _t;
|
|
|
1892
1897
|
items: a
|
|
1893
1898
|
},
|
|
1894
1899
|
orderStatus: {
|
|
1895
|
-
id:
|
|
1900
|
+
id: Be(i)
|
|
1896
1901
|
},
|
|
1897
1902
|
custbody_fm_po_num: f.seqNumber,
|
|
1898
1903
|
custbody_fm_po_request_id: t._id
|
|
@@ -1902,7 +1907,7 @@ var _t;
|
|
|
1902
1907
|
function c({ setting: n, purchaseOrder: t, overrideItemCost: i, customItemAttributes: o, includeItems: m = !1, orderStatus: l, customFields: f }) {
|
|
1903
1908
|
const a = t.items.map((I) => {
|
|
1904
1909
|
const p = n.items.find((y) => y.id === I.sku._id);
|
|
1905
|
-
return
|
|
1910
|
+
return se.ToNetSuite.toTransferOrderItemUpdateDto({
|
|
1906
1911
|
poItem: I,
|
|
1907
1912
|
nsUnitTypes: n.units,
|
|
1908
1913
|
nsItemSetting: p,
|
|
@@ -1936,7 +1941,7 @@ var _t;
|
|
|
1936
1941
|
g(r, "toCloseDto"), u.toCloseDto = r;
|
|
1937
1942
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
1938
1943
|
function d(r) {
|
|
1939
|
-
var
|
|
1944
|
+
var z, Te, Le, ut, dt, ct, lt, mt, ft;
|
|
1940
1945
|
const { fromLocation: n, toLocation: t, nsTransferOrder: i, orderItemMapping: o, nsItemFulfillments: m, orderItemMappingByFulfillment: l, nsItemReceipts: f, orderItemMappingByReceipt: a, context: I, nsSystemNotes: p } = r, y = {
|
|
1941
1946
|
_id: n.doc._id,
|
|
1942
1947
|
internal: n.type,
|
|
@@ -1946,20 +1951,20 @@ var _t;
|
|
|
1946
1951
|
phoneNumber: n.doc.profile.phoneNo,
|
|
1947
1952
|
registrationNumber: n.doc.profile.regNo,
|
|
1948
1953
|
address: {
|
|
1949
|
-
line1: ((
|
|
1950
|
-
line2: (
|
|
1951
|
-
state: ((
|
|
1952
|
-
city: ((
|
|
1953
|
-
country: ((
|
|
1954
|
-
postcode: ((
|
|
1954
|
+
line1: ((z = n.doc.profile.address) == null ? void 0 : z.line1) || "",
|
|
1955
|
+
line2: (Te = n.doc.profile.address) == null ? void 0 : Te.line2,
|
|
1956
|
+
state: ((Le = n.doc.profile.address) == null ? void 0 : Le.state) || "",
|
|
1957
|
+
city: ((ut = n.doc.profile.address) == null ? void 0 : ut.city) || "",
|
|
1958
|
+
country: ((dt = n.doc.profile.address) == null ? void 0 : dt.country) || "",
|
|
1959
|
+
postcode: ((ct = n.doc.profile.address) == null ? void 0 : ct.postcode) || ""
|
|
1955
1960
|
}
|
|
1956
|
-
},
|
|
1957
|
-
const
|
|
1961
|
+
}, _ = (ft = (mt = (lt = I.options) == null ? void 0 : lt.netSuite) == null ? void 0 : mt.additionalInfo) == null ? void 0 : ft.reduce((V, W) => {
|
|
1962
|
+
const ye = W.compute(r, W.extraParams);
|
|
1958
1963
|
return {
|
|
1959
|
-
...
|
|
1960
|
-
[
|
|
1964
|
+
...V,
|
|
1965
|
+
[W.fieldId]: ye
|
|
1961
1966
|
};
|
|
1962
|
-
}, {}),
|
|
1967
|
+
}, {}), b = {
|
|
1963
1968
|
id: i.id,
|
|
1964
1969
|
refNo: i.tranId,
|
|
1965
1970
|
subsidiary: {
|
|
@@ -1967,46 +1972,46 @@ var _t;
|
|
|
1967
1972
|
name: i.subsidiary.refName
|
|
1968
1973
|
},
|
|
1969
1974
|
additionalInfo: {
|
|
1970
|
-
...
|
|
1975
|
+
..._
|
|
1971
1976
|
}
|
|
1972
|
-
}, S = m.map((
|
|
1973
|
-
const
|
|
1974
|
-
return
|
|
1975
|
-
}),
|
|
1976
|
-
const
|
|
1977
|
-
return
|
|
1978
|
-
}),
|
|
1979
|
-
const
|
|
1980
|
-
return
|
|
1977
|
+
}, S = m.map((V) => {
|
|
1978
|
+
const W = l[V.id];
|
|
1979
|
+
return We.FromNetSuite.transform(I, W, V);
|
|
1980
|
+
}), E = f.map((V) => {
|
|
1981
|
+
const W = a[V.id];
|
|
1982
|
+
return Ve.FromNetSuite.transform(I, W, V);
|
|
1983
|
+
}), v = i.item.items.map((V) => {
|
|
1984
|
+
const W = o[V.line].sku, ye = o[V.line].measurement;
|
|
1985
|
+
return se.FromNetSuite.toPurchaseOrderItem({
|
|
1981
1986
|
currency: i.currency.refName,
|
|
1982
|
-
nsOrderItem:
|
|
1983
|
-
sku:
|
|
1987
|
+
nsOrderItem: V,
|
|
1988
|
+
sku: W,
|
|
1984
1989
|
glImpactCost: [],
|
|
1985
|
-
measurement:
|
|
1990
|
+
measurement: ye,
|
|
1986
1991
|
context: I
|
|
1987
1992
|
});
|
|
1988
|
-
}),
|
|
1989
|
-
_id:
|
|
1990
|
-
prefix:
|
|
1991
|
-
dateTime:
|
|
1993
|
+
}), U = new Date(i.createdDate), [h, k, A] = i.tranDate.split("-"), D = new Date(Number(h), Number(k) - 1, Number(A)), T = Pt(i), R = {
|
|
1994
|
+
_id: L({
|
|
1995
|
+
prefix: $.Enum.purchaseOrder,
|
|
1996
|
+
dateTime: U.toISOString()
|
|
1992
1997
|
}),
|
|
1993
1998
|
version: "2",
|
|
1994
|
-
status:
|
|
1999
|
+
status: Rt(i.orderStatus),
|
|
1995
2000
|
supplier: y,
|
|
1996
2001
|
seqNumber: parseInt(i.custbody_fm_po_num ?? "0"),
|
|
1997
|
-
items:
|
|
1998
|
-
effectiveAt:
|
|
2002
|
+
items: v,
|
|
2003
|
+
effectiveAt: D.toISOString(),
|
|
1999
2004
|
deliveryFullfillment: S,
|
|
2000
|
-
deliveryOrder:
|
|
2005
|
+
deliveryOrder: E,
|
|
2001
2006
|
// NetSuite
|
|
2002
|
-
netSuite:
|
|
2007
|
+
netSuite: b,
|
|
2003
2008
|
request: i.custbody_fm_po_request_id ? {
|
|
2004
2009
|
id: i.custbody_fm_po_request_id,
|
|
2005
2010
|
adjustmentIds: []
|
|
2006
2011
|
} : void 0
|
|
2007
|
-
}, { processedAt: me, rejectedAt:
|
|
2008
|
-
const
|
|
2009
|
-
return
|
|
2012
|
+
}, { processedAt: me, rejectedAt: Oe } = xt(i.createdDate, i.orderStatus.id, p ?? []), ve = S.reduce((V, W) => {
|
|
2013
|
+
const ye = new Date(W.createdAt);
|
|
2014
|
+
return V ? ye.getTime() < V.getTime() ? ye : V : ye;
|
|
2010
2015
|
}, null);
|
|
2011
2016
|
return {
|
|
2012
2017
|
purchaseOrderRequest: {
|
|
@@ -2019,16 +2024,16 @@ var _t;
|
|
|
2019
2024
|
dbName: `${t.type}_${t.dbName}`,
|
|
2020
2025
|
name: t.name
|
|
2021
2026
|
},
|
|
2022
|
-
purchaseOrderId:
|
|
2027
|
+
purchaseOrderId: R._id,
|
|
2023
2028
|
processedAt: me || (ve == null ? void 0 : ve.toISOString()) || null,
|
|
2024
|
-
rejectedAt:
|
|
2029
|
+
rejectedAt: Oe,
|
|
2025
2030
|
adjustmentIds: [],
|
|
2026
|
-
purchaseOrder:
|
|
2031
|
+
purchaseOrder: R,
|
|
2027
2032
|
// NetSuite
|
|
2028
|
-
netSuite:
|
|
2033
|
+
netSuite: b
|
|
2029
2034
|
},
|
|
2030
|
-
purchaseOrder:
|
|
2031
|
-
deliveryMilestone:
|
|
2035
|
+
purchaseOrder: R,
|
|
2036
|
+
deliveryMilestone: T
|
|
2032
2037
|
};
|
|
2033
2038
|
}
|
|
2034
2039
|
g(d, "transform"), u.transform = d;
|
|
@@ -2036,7 +2041,7 @@ var _t;
|
|
|
2036
2041
|
}
|
|
2037
2042
|
g(c, "convertToV1"), u.convertToV1 = c;
|
|
2038
2043
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2039
|
-
})(
|
|
2044
|
+
})(bt || (bt = {}));
|
|
2040
2045
|
function Ot(s, u) {
|
|
2041
2046
|
var r, n;
|
|
2042
2047
|
const d = (r = s.find((t) => {
|
|
@@ -2054,7 +2059,7 @@ function Ot(s, u) {
|
|
|
2054
2059
|
};
|
|
2055
2060
|
}
|
|
2056
2061
|
g(Ot, "locationMapper");
|
|
2057
|
-
function
|
|
2062
|
+
function Lt(s) {
|
|
2058
2063
|
let u = null, d = !1, c = !1;
|
|
2059
2064
|
for (const t of s.item.items) {
|
|
2060
2065
|
const i = t.expectedReceiptDate;
|
|
@@ -2075,29 +2080,29 @@ function xt(s) {
|
|
|
2075
2080
|
return null;
|
|
2076
2081
|
const r = /* @__PURE__ */ new Date();
|
|
2077
2082
|
return {
|
|
2078
|
-
type:
|
|
2083
|
+
type: At.Enum.PREPARING,
|
|
2079
2084
|
description: "Expected Delivery Date (Synced from NetSuite)",
|
|
2080
2085
|
createdAt: r.toISOString(),
|
|
2081
2086
|
estimatedTime: new Date(u).toISOString()
|
|
2082
2087
|
};
|
|
2083
2088
|
}
|
|
2084
|
-
g(
|
|
2085
|
-
var
|
|
2089
|
+
g(Lt, "transformPreparingShipmentMilestoneFromNetSuite");
|
|
2090
|
+
var St;
|
|
2086
2091
|
(function(s) {
|
|
2087
2092
|
(function(u) {
|
|
2088
|
-
function d({ locationDb: n, setting: t, purchaseOrder: i, status: o =
|
|
2089
|
-
const { netSuiteFromId: a, netSuiteToId: I } =
|
|
2090
|
-
const
|
|
2091
|
-
return
|
|
2093
|
+
function d({ locationDb: n, setting: t, purchaseOrder: i, status: o = ne.enum.A, overrideItemCost: m = !0, customItemAttributes: l, customFields: f }) {
|
|
2094
|
+
const { netSuiteFromId: a, netSuiteToId: I } = Ze(t.locations, t.vendors, n, i.supplier._id), p = i.items.map((y) => {
|
|
2095
|
+
const _ = t.items.find((b) => b.id === y.sku._id);
|
|
2096
|
+
return se.ToNetSuite.toCreateDto({
|
|
2092
2097
|
poItem: y,
|
|
2093
2098
|
nsUnitTypes: t.units,
|
|
2094
|
-
nsItemSetting:
|
|
2099
|
+
nsItemSetting: _,
|
|
2095
2100
|
overrideCost: m,
|
|
2096
2101
|
customAttributes: [
|
|
2097
2102
|
{
|
|
2098
2103
|
fieldId: "location",
|
|
2099
2104
|
extraParams: I,
|
|
2100
|
-
compute: /* @__PURE__ */ g((
|
|
2105
|
+
compute: /* @__PURE__ */ g((b, S) => ({
|
|
2101
2106
|
id: S
|
|
2102
2107
|
}), "compute")
|
|
2103
2108
|
},
|
|
@@ -2123,7 +2128,7 @@ var bt;
|
|
|
2123
2128
|
items: p
|
|
2124
2129
|
},
|
|
2125
2130
|
orderStatus: {
|
|
2126
|
-
id:
|
|
2131
|
+
id: Qe(o)
|
|
2127
2132
|
},
|
|
2128
2133
|
custbody_fm_po_num: i.seqNumber,
|
|
2129
2134
|
custbody_fm_po_id: i._id
|
|
@@ -2131,11 +2136,11 @@ var bt;
|
|
|
2131
2136
|
}
|
|
2132
2137
|
g(d, "toCreateDto"), u.toCreateDto = d;
|
|
2133
2138
|
function c({ locationDb: n, setting: t, purchaseOrder: i, overrideItemCost: o, customItemAttributes: m, includeItems: l = !1, customFields: f }) {
|
|
2134
|
-
const { netSuiteToId: a } =
|
|
2135
|
-
i != null && i.effectiveAt ||
|
|
2139
|
+
const { netSuiteToId: a } = Ze(t.locations, t.vendors, n, i.supplier._id);
|
|
2140
|
+
i != null && i.effectiveAt || ae(i._id);
|
|
2136
2141
|
const I = i.items.map((p) => {
|
|
2137
|
-
const y = t.items.find((
|
|
2138
|
-
return
|
|
2142
|
+
const y = t.items.find((_) => _.id === p.sku._id);
|
|
2143
|
+
return se.ToNetSuite.toPurchaseOrderItemUpdateDto({
|
|
2139
2144
|
nsLocationId: a,
|
|
2140
2145
|
poItem: p,
|
|
2141
2146
|
nsUnitTypes: t.units,
|
|
@@ -2158,14 +2163,14 @@ var bt;
|
|
|
2158
2163
|
function r() {
|
|
2159
2164
|
return {
|
|
2160
2165
|
orderStatus: {
|
|
2161
|
-
id:
|
|
2166
|
+
id: Qe(ne.enum.H)
|
|
2162
2167
|
}
|
|
2163
2168
|
};
|
|
2164
2169
|
}
|
|
2165
2170
|
g(r, "toCloseDto"), u.toCloseDto = r;
|
|
2166
2171
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2167
2172
|
function d(c) {
|
|
2168
|
-
var
|
|
2173
|
+
var h, k, A, D, T, R, me, Oe, ve;
|
|
2169
2174
|
const { vendor: r, nsPurchaseOrder: n, orderItemMapping: t, nsItemReceipts: i, orderItemMappingByReceipt: o, context: m } = c, l = {
|
|
2170
2175
|
_id: r._id,
|
|
2171
2176
|
contactName: r.contactName,
|
|
@@ -2174,18 +2179,18 @@ var bt;
|
|
|
2174
2179
|
phoneNumber: r.phoneNumber,
|
|
2175
2180
|
registrationNumber: r.registrationNumber,
|
|
2176
2181
|
address: {
|
|
2177
|
-
line1: ((
|
|
2178
|
-
line2: (
|
|
2179
|
-
state: ((
|
|
2180
|
-
city: ((
|
|
2181
|
-
country: ((
|
|
2182
|
-
postcode: ((
|
|
2182
|
+
line1: ((h = r.address) == null ? void 0 : h.line1) || "",
|
|
2183
|
+
line2: (k = r.address) == null ? void 0 : k.line2,
|
|
2184
|
+
state: ((A = r.address) == null ? void 0 : A.state) || "",
|
|
2185
|
+
city: ((D = r.address) == null ? void 0 : D.city) || "",
|
|
2186
|
+
country: ((T = r.address) == null ? void 0 : T.country) || "",
|
|
2187
|
+
postcode: ((R = r.address) == null ? void 0 : R.postcode) || ""
|
|
2183
2188
|
}
|
|
2184
|
-
}, f = (ve = (
|
|
2185
|
-
const
|
|
2189
|
+
}, f = (ve = (Oe = (me = m.options) == null ? void 0 : me.netSuite) == null ? void 0 : Oe.additionalInfo) == null ? void 0 : ve.reduce((fe, z) => {
|
|
2190
|
+
const Te = z.compute(c, z.extraParams);
|
|
2186
2191
|
return {
|
|
2187
2192
|
...fe,
|
|
2188
|
-
[
|
|
2193
|
+
[z.fieldId]: Te
|
|
2189
2194
|
};
|
|
2190
2195
|
}, {}), a = {
|
|
2191
2196
|
id: n.id,
|
|
@@ -2198,42 +2203,42 @@ var bt;
|
|
|
2198
2203
|
...f
|
|
2199
2204
|
}
|
|
2200
2205
|
}, I = i.map((fe) => {
|
|
2201
|
-
const
|
|
2202
|
-
return
|
|
2203
|
-
}), p = n.item.items.reduce((fe,
|
|
2204
|
-
const
|
|
2205
|
-
return fe.push(
|
|
2206
|
+
const z = o[fe.id];
|
|
2207
|
+
return Ve.FromNetSuite.transform(m, z, fe);
|
|
2208
|
+
}), p = n.item.items.reduce((fe, z) => {
|
|
2209
|
+
const Te = t[z.line].sku, Le = t[z.line].measurement;
|
|
2210
|
+
return fe.push(se.FromNetSuite.toPurchaseOrderItem({
|
|
2206
2211
|
currency: n.currency.refName,
|
|
2207
|
-
nsOrderItem:
|
|
2208
|
-
sku:
|
|
2212
|
+
nsOrderItem: z,
|
|
2213
|
+
sku: Te,
|
|
2209
2214
|
glImpactCost: [],
|
|
2210
|
-
measurement:
|
|
2215
|
+
measurement: Le,
|
|
2211
2216
|
context: m
|
|
2212
2217
|
})), fe;
|
|
2213
|
-
}, []), y = new Date(n.createdDate), [
|
|
2218
|
+
}, []), y = new Date(n.createdDate), [_, b, S] = n.tranDate.split("-"), E = new Date(Number(_), Number(b) - 1, Number(S)), v = Lt(n);
|
|
2214
2219
|
return {
|
|
2215
2220
|
purchaseOrder: {
|
|
2216
|
-
_id:
|
|
2217
|
-
prefix:
|
|
2221
|
+
_id: L({
|
|
2222
|
+
prefix: $.Enum.purchaseOrder,
|
|
2218
2223
|
dateTime: y.toISOString()
|
|
2219
2224
|
}),
|
|
2220
2225
|
version: "2",
|
|
2221
|
-
status:
|
|
2226
|
+
status: Ft(n.orderStatus),
|
|
2222
2227
|
supplier: l,
|
|
2223
2228
|
seqNumber: parseInt(`${n.custbody_fm_po_num ?? "0"}`),
|
|
2224
2229
|
items: p,
|
|
2225
|
-
effectiveAt:
|
|
2230
|
+
effectiveAt: E.toISOString(),
|
|
2226
2231
|
deliveryOrder: I,
|
|
2227
2232
|
// NetSuite
|
|
2228
2233
|
netSuite: a
|
|
2229
2234
|
},
|
|
2230
|
-
deliveryMilestone:
|
|
2235
|
+
deliveryMilestone: v
|
|
2231
2236
|
};
|
|
2232
2237
|
}
|
|
2233
2238
|
g(d, "transform"), u.transform = d;
|
|
2234
2239
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2235
|
-
})(
|
|
2236
|
-
function
|
|
2240
|
+
})(St || (St = {}));
|
|
2241
|
+
function Ze(s, u, d, c) {
|
|
2237
2242
|
var t, i;
|
|
2238
2243
|
const r = (t = u.find((o) => o.id === c)) == null ? void 0 : t.netSuiteId, n = (i = s.find((o) => {
|
|
2239
2244
|
const [m, l] = d.split("_");
|
|
@@ -2246,14 +2251,14 @@ function Qe(s, u, d, c) {
|
|
|
2246
2251
|
netSuiteToId: n
|
|
2247
2252
|
};
|
|
2248
2253
|
}
|
|
2249
|
-
g(
|
|
2250
|
-
var
|
|
2254
|
+
g(Ze, "locationMapper");
|
|
2255
|
+
var Xe;
|
|
2251
2256
|
(function(s) {
|
|
2252
2257
|
(function(u) {
|
|
2253
2258
|
function d(c) {
|
|
2254
2259
|
const n = {
|
|
2255
|
-
id:
|
|
2256
|
-
prefix:
|
|
2260
|
+
id: L({
|
|
2261
|
+
prefix: $.Enum.measurement
|
|
2257
2262
|
}),
|
|
2258
2263
|
name: c.unitName,
|
|
2259
2264
|
abbrev: c.abbreviation,
|
|
@@ -2272,13 +2277,13 @@ var Ze;
|
|
|
2272
2277
|
}
|
|
2273
2278
|
g(d, "transform"), u.transform = d;
|
|
2274
2279
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2275
|
-
})(
|
|
2276
|
-
var
|
|
2280
|
+
})(Xe || (Xe = {}));
|
|
2281
|
+
var ht;
|
|
2277
2282
|
(function(s) {
|
|
2278
2283
|
(function(u) {
|
|
2279
2284
|
function d(c, r) {
|
|
2280
|
-
let n = c.uom.items, t =
|
|
2281
|
-
prefix:
|
|
2285
|
+
let n = c.uom.items, t = L({
|
|
2286
|
+
prefix: $.Enum.unit
|
|
2282
2287
|
});
|
|
2283
2288
|
const i = {
|
|
2284
2289
|
_id: t,
|
|
@@ -2294,7 +2299,7 @@ var St;
|
|
|
2294
2299
|
i.name = `${c.name} (${a.unitName})`, i.abbrev = a.abbreviation, o = String(a.internalId);
|
|
2295
2300
|
continue;
|
|
2296
2301
|
}
|
|
2297
|
-
const I =
|
|
2302
|
+
const I = Xe.FromNetsuite.transform(a);
|
|
2298
2303
|
l.push(I), m.push(I.nsConfig);
|
|
2299
2304
|
}
|
|
2300
2305
|
if (i.measurements = l, o === void 0)
|
|
@@ -2313,7 +2318,7 @@ var St;
|
|
|
2313
2318
|
}
|
|
2314
2319
|
g(d, "transform"), u.transform = d;
|
|
2315
2320
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2316
|
-
})(
|
|
2321
|
+
})(ht || (ht = {}));
|
|
2317
2322
|
function Un(s, u) {
|
|
2318
2323
|
let d;
|
|
2319
2324
|
const c = [];
|
|
@@ -2335,8 +2340,8 @@ var vt;
|
|
|
2335
2340
|
(function(s) {
|
|
2336
2341
|
(function(u) {
|
|
2337
2342
|
function d(c) {
|
|
2338
|
-
const r = c.addressBook.items.find((o) => o.defaultBilling), n =
|
|
2339
|
-
prefix:
|
|
2343
|
+
const r = c.addressBook.items.find((o) => o.defaultBilling), n = L({
|
|
2344
|
+
prefix: $.Enum.supplier
|
|
2340
2345
|
}), t = {
|
|
2341
2346
|
_id: n,
|
|
2342
2347
|
name: c.companyName,
|
|
@@ -2344,7 +2349,7 @@ var vt;
|
|
|
2344
2349
|
contactName: (r == null ? void 0 : r.addressBookAddress.attention) || (r == null ? void 0 : r.addressBookAddress.addressee),
|
|
2345
2350
|
phoneNumber: c.phone,
|
|
2346
2351
|
registrationNumber: "",
|
|
2347
|
-
address:
|
|
2352
|
+
address: $t(r)
|
|
2348
2353
|
}, i = {
|
|
2349
2354
|
id: n,
|
|
2350
2355
|
netSuiteId: c.id,
|
|
@@ -2359,7 +2364,7 @@ var vt;
|
|
|
2359
2364
|
g(d, "transform"), u.transform = d;
|
|
2360
2365
|
})(s.FromNetsuite || (s.FromNetsuite = {}));
|
|
2361
2366
|
})(vt || (vt = {}));
|
|
2362
|
-
function
|
|
2367
|
+
function $t(s) {
|
|
2363
2368
|
let u = {
|
|
2364
2369
|
line1: "",
|
|
2365
2370
|
state: "",
|
|
@@ -2377,8 +2382,8 @@ function Lt(s) {
|
|
|
2377
2382
|
country: s.addressBookAddress.country.refName
|
|
2378
2383
|
}), u;
|
|
2379
2384
|
}
|
|
2380
|
-
g(
|
|
2381
|
-
function
|
|
2385
|
+
g($t, "_transfromToSupplierAddress");
|
|
2386
|
+
function st(s, u) {
|
|
2382
2387
|
const d = {}, c = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
2383
2388
|
for (const t of u) {
|
|
2384
2389
|
let { externalId: i, id: o } = t;
|
|
@@ -2404,10 +2409,10 @@ function rt(s, u) {
|
|
|
2404
2409
|
}
|
|
2405
2410
|
return n;
|
|
2406
2411
|
}
|
|
2407
|
-
g(
|
|
2412
|
+
g(st, "mapOrderLineId");
|
|
2408
2413
|
function kn(s, u, d, c, r) {
|
|
2409
2414
|
var l, f;
|
|
2410
|
-
const n = d.some((a) => a.id), t =
|
|
2415
|
+
const n = d.some((a) => a.id), t = st(u, d), i = [], o = c, m = [
|
|
2411
2416
|
...r || []
|
|
2412
2417
|
];
|
|
2413
2418
|
for (const a of d) {
|
|
@@ -2420,18 +2425,18 @@ function kn(s, u, d, c, r) {
|
|
|
2420
2425
|
for (let a = 0; a < o.length; a++) {
|
|
2421
2426
|
const I = o[a], p = [];
|
|
2422
2427
|
for (const y of I.received) {
|
|
2423
|
-
const
|
|
2424
|
-
if (!
|
|
2428
|
+
const _ = y.externalId;
|
|
2429
|
+
if (!_) {
|
|
2425
2430
|
p.push(y);
|
|
2426
2431
|
continue;
|
|
2427
2432
|
}
|
|
2428
|
-
const
|
|
2433
|
+
const b = (l = u.find((v) => v.lineid === _)) == null ? void 0 : l.transferorderitemlineid, S = n && b ? t[b] : void 0, E = {
|
|
2429
2434
|
...y,
|
|
2430
2435
|
id: S
|
|
2431
2436
|
};
|
|
2432
|
-
if (s ===
|
|
2433
|
-
throw new Error(`Cannot find mapped item ID for external line id ${
|
|
2434
|
-
p.push(
|
|
2437
|
+
if (s === X.Enum[2] && (!S || S === ""))
|
|
2438
|
+
throw new Error(`Cannot find mapped item ID for external line id ${_} in delivery order`);
|
|
2439
|
+
p.push(E);
|
|
2435
2440
|
}
|
|
2436
2441
|
o[a] = {
|
|
2437
2442
|
...I,
|
|
@@ -2442,18 +2447,18 @@ function kn(s, u, d, c, r) {
|
|
|
2442
2447
|
for (let a = 0; a < m.length; a++) {
|
|
2443
2448
|
const I = m[a], p = [];
|
|
2444
2449
|
for (const y of I.items) {
|
|
2445
|
-
const
|
|
2446
|
-
if (!
|
|
2450
|
+
const _ = y.externalId;
|
|
2451
|
+
if (!_) {
|
|
2447
2452
|
p.push(y);
|
|
2448
2453
|
continue;
|
|
2449
2454
|
}
|
|
2450
|
-
const
|
|
2455
|
+
const b = (f = u.find((v) => v.lineid === _)) == null ? void 0 : f.transferorderitemlineid, S = n && b ? t[b] : y.id, E = {
|
|
2451
2456
|
...y,
|
|
2452
2457
|
id: S
|
|
2453
2458
|
};
|
|
2454
|
-
if (s ===
|
|
2455
|
-
throw new Error(`Cannot find mapped item ID for order external id ${
|
|
2456
|
-
p.push(
|
|
2459
|
+
if (s === X.Enum[2] && (!S || S === ""))
|
|
2460
|
+
throw new Error(`Cannot find mapped item ID for order external id ${_} in delivery fulfillment`);
|
|
2461
|
+
p.push(E);
|
|
2457
2462
|
}
|
|
2458
2463
|
m[a] = {
|
|
2459
2464
|
...I,
|
|
@@ -2468,7 +2473,7 @@ function kn(s, u, d, c, r) {
|
|
|
2468
2473
|
}
|
|
2469
2474
|
g(kn, "alignItemLineIdsAcrossDocuments");
|
|
2470
2475
|
function wn(s, u, d) {
|
|
2471
|
-
const c = u.some((i) => i.id), r =
|
|
2476
|
+
const c = u.some((i) => i.id), r = st(s, u), n = [], t = d;
|
|
2472
2477
|
for (const i of u) {
|
|
2473
2478
|
const o = c && i.externalId ? r[i.externalId] : "";
|
|
2474
2479
|
n.push({
|
|
@@ -2549,7 +2554,7 @@ var le;
|
|
|
2549
2554
|
g(c, "fromDeliveryOrderToCreateDto"), u.fromDeliveryOrderToCreateDto = c;
|
|
2550
2555
|
})(s.ToNetSuite || (s.ToNetSuite = {})), function(u) {
|
|
2551
2556
|
function d(r, n, t, i) {
|
|
2552
|
-
const { cost: o, currency: m } =
|
|
2557
|
+
const { cost: o, currency: m } = rt(n, String(r.line), r.item.id), l = M.fromNumber(r.adjustQtyBy), f = M.fromNumber(o), a = je.FCurrency.safeParse(m), I = a.success ? a.data : Me;
|
|
2553
2558
|
return {
|
|
2554
2559
|
id: "",
|
|
2555
2560
|
externalId: String(r.line),
|
|
@@ -2590,12 +2595,12 @@ var le;
|
|
|
2590
2595
|
g(c, "toPurchaseOrderItem"), u.toPurchaseOrderItem = c;
|
|
2591
2596
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2592
2597
|
})(le || (le = {}));
|
|
2593
|
-
var
|
|
2598
|
+
var Tt;
|
|
2594
2599
|
(function(s) {
|
|
2595
2600
|
(function(u) {
|
|
2596
2601
|
function d(n) {
|
|
2597
2602
|
const { setting: t, sourceLocationId: i, destinationLocationId: o, subsidiaryId: m, effectiveAt: l, orderItems: f, newAdjustmentId: a } = n, I = f.map((p) => {
|
|
2598
|
-
const y = t.items.find((
|
|
2603
|
+
const y = t.items.find((_) => _.id === p.sku._id);
|
|
2599
2604
|
return le.ToNetSuite.toCreateDto({
|
|
2600
2605
|
orderItem: p,
|
|
2601
2606
|
nsUnitTypes: t.units,
|
|
@@ -2615,7 +2620,7 @@ var ht;
|
|
|
2615
2620
|
inventory: {
|
|
2616
2621
|
items: I
|
|
2617
2622
|
},
|
|
2618
|
-
tranDate:
|
|
2623
|
+
tranDate: xe(new Date(l)),
|
|
2619
2624
|
custbody_fm_adjustment_id: a
|
|
2620
2625
|
};
|
|
2621
2626
|
}
|
|
@@ -2630,11 +2635,11 @@ var ht;
|
|
|
2630
2635
|
g(c, "toUpdateDto"), u.toUpdateDto = c;
|
|
2631
2636
|
function r(n) {
|
|
2632
2637
|
const { setting: t, purchaseOrder: i, sourceLocationId: o, destinationLocationId: m, subsidiaryId: l, effectiveAt: f, orderItems: a, deliveryOrderId: I } = n, p = a.map((y) => {
|
|
2633
|
-
const
|
|
2638
|
+
const _ = t.items.find((b) => b.id === y.sku._id);
|
|
2634
2639
|
return le.ToNetSuite.fromDeliveryOrderToCreateDto({
|
|
2635
2640
|
orderItem: y,
|
|
2636
2641
|
nsUnitTypes: t.units,
|
|
2637
|
-
nsItemSetting:
|
|
2642
|
+
nsItemSetting: _
|
|
2638
2643
|
});
|
|
2639
2644
|
});
|
|
2640
2645
|
return {
|
|
@@ -2650,7 +2655,7 @@ var ht;
|
|
|
2650
2655
|
inventory: {
|
|
2651
2656
|
items: p
|
|
2652
2657
|
},
|
|
2653
|
-
tranDate:
|
|
2658
|
+
tranDate: xe(new Date(f)),
|
|
2654
2659
|
custbody_fm_po_id: i._id,
|
|
2655
2660
|
custbody_fm_do_id: I
|
|
2656
2661
|
};
|
|
@@ -2661,7 +2666,7 @@ var ht;
|
|
|
2661
2666
|
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 = {
|
|
2662
2667
|
_id: "",
|
|
2663
2668
|
name: t.location.refName,
|
|
2664
|
-
internal:
|
|
2669
|
+
internal: ze.Enum.restaurant,
|
|
2665
2670
|
address: {
|
|
2666
2671
|
line1: "",
|
|
2667
2672
|
state: "",
|
|
@@ -2672,11 +2677,11 @@ var ht;
|
|
|
2672
2677
|
}, p = {
|
|
2673
2678
|
id: t.id,
|
|
2674
2679
|
refNo: t.tranId,
|
|
2675
|
-
recordType:
|
|
2676
|
-
},
|
|
2677
|
-
received: t.inventory.items.map((
|
|
2678
|
-
const
|
|
2679
|
-
return le.FromNetSuite.toPurchaseOrderReceived(
|
|
2680
|
+
recordType: Re.Enum.inventoryTransfer
|
|
2681
|
+
}, _ = {
|
|
2682
|
+
received: t.inventory.items.map((E) => {
|
|
2683
|
+
const v = i[E.line].sku, U = i[E.line].measurement;
|
|
2684
|
+
return le.FromNetSuite.toPurchaseOrderReceived(E, t.glImpacts ?? [], v, U);
|
|
2680
2685
|
}),
|
|
2681
2686
|
createdBy: {
|
|
2682
2687
|
name: "",
|
|
@@ -2686,13 +2691,13 @@ var ht;
|
|
|
2686
2691
|
deliveryOrderNumber: "",
|
|
2687
2692
|
netSuite: p,
|
|
2688
2693
|
effectiveAt: a.toISOString()
|
|
2689
|
-
},
|
|
2690
|
-
const
|
|
2691
|
-
return le.FromNetSuite.toPurchaseOrderItem(
|
|
2694
|
+
}, b = t.inventory.items.map((E) => {
|
|
2695
|
+
const v = i[E.line].sku, U = i[E.line].measurement;
|
|
2696
|
+
return le.FromNetSuite.toPurchaseOrderItem(E, v, U);
|
|
2692
2697
|
});
|
|
2693
2698
|
return {
|
|
2694
|
-
_id:
|
|
2695
|
-
prefix:
|
|
2699
|
+
_id: L({
|
|
2700
|
+
prefix: $.Enum.purchaseOrder,
|
|
2696
2701
|
dateTime: o.toISOString()
|
|
2697
2702
|
}),
|
|
2698
2703
|
version: "2",
|
|
@@ -2700,9 +2705,9 @@ var ht;
|
|
|
2700
2705
|
status: B.Enum.COMPLETE,
|
|
2701
2706
|
supplier: I,
|
|
2702
2707
|
seqNumber: t.custbody_fm_po_num ?? 0,
|
|
2703
|
-
items:
|
|
2708
|
+
items: b,
|
|
2704
2709
|
deliveryOrder: [
|
|
2705
|
-
|
|
2710
|
+
_
|
|
2706
2711
|
],
|
|
2707
2712
|
request: t.custbody_fm_po_request_id ? {
|
|
2708
2713
|
id: t.custbody_fm_po_request_id,
|
|
@@ -2713,7 +2718,7 @@ var ht;
|
|
|
2713
2718
|
}
|
|
2714
2719
|
g(d, "transformTransferIn"), u.transformTransferIn = d;
|
|
2715
2720
|
function c(n) {
|
|
2716
|
-
var
|
|
2721
|
+
var v, U, h, k, A, D;
|
|
2717
2722
|
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 = {
|
|
2718
2723
|
_id: t.doc._id,
|
|
2719
2724
|
internal: t.type,
|
|
@@ -2723,25 +2728,25 @@ var ht;
|
|
|
2723
2728
|
phoneNumber: t.doc.profile.phoneNo,
|
|
2724
2729
|
registrationNumber: t.doc.profile.regNo,
|
|
2725
2730
|
address: {
|
|
2726
|
-
line1: ((
|
|
2727
|
-
line2: (
|
|
2728
|
-
state: ((
|
|
2729
|
-
city: ((
|
|
2730
|
-
country: ((
|
|
2731
|
-
postcode: ((
|
|
2731
|
+
line1: ((v = t.doc.profile.address) == null ? void 0 : v.line1) || "",
|
|
2732
|
+
line2: (U = t.doc.profile.address) == null ? void 0 : U.line2,
|
|
2733
|
+
state: ((h = t.doc.profile.address) == null ? void 0 : h.state) || "",
|
|
2734
|
+
city: ((k = t.doc.profile.address) == null ? void 0 : k.city) || "",
|
|
2735
|
+
country: ((A = t.doc.profile.address) == null ? void 0 : A.country) || "",
|
|
2736
|
+
postcode: ((D = t.doc.profile.address) == null ? void 0 : D.postcode) || ""
|
|
2732
2737
|
}
|
|
2733
2738
|
}, y = {
|
|
2734
2739
|
id: i.id,
|
|
2735
2740
|
refNo: i.tranId,
|
|
2736
|
-
recordType:
|
|
2741
|
+
recordType: Re.Enum.inventoryTransfer,
|
|
2737
2742
|
subsidiary: {
|
|
2738
2743
|
id: i.subsidiary.id,
|
|
2739
2744
|
name: i.subsidiary.refName
|
|
2740
2745
|
}
|
|
2741
|
-
},
|
|
2742
|
-
received: i.inventory.items.map((
|
|
2743
|
-
const
|
|
2744
|
-
return le.FromNetSuite.toPurchaseOrderReceived(
|
|
2746
|
+
}, b = {
|
|
2747
|
+
received: i.inventory.items.map((T) => {
|
|
2748
|
+
const R = o[T.line].sku, me = o[T.line].measurement;
|
|
2749
|
+
return le.FromNetSuite.toPurchaseOrderReceived(T, i.glImpacts ?? [], R, me);
|
|
2745
2750
|
}),
|
|
2746
2751
|
createdBy: {
|
|
2747
2752
|
name: "",
|
|
@@ -2751,13 +2756,13 @@ var ht;
|
|
|
2751
2756
|
deliveryOrderNumber: "",
|
|
2752
2757
|
netSuite: y,
|
|
2753
2758
|
effectiveAt: I.toISOString()
|
|
2754
|
-
}, S = i.inventory.items.map((
|
|
2755
|
-
const
|
|
2756
|
-
return le.FromNetSuite.toPurchaseOrderItem(
|
|
2759
|
+
}, S = i.inventory.items.map((T) => {
|
|
2760
|
+
const R = o[T.line].sku, me = o[T.line].measurement;
|
|
2761
|
+
return le.FromNetSuite.toPurchaseOrderItem(T, R, me);
|
|
2757
2762
|
});
|
|
2758
2763
|
return {
|
|
2759
|
-
_id:
|
|
2760
|
-
prefix:
|
|
2764
|
+
_id: L({
|
|
2765
|
+
prefix: $.Enum.purchaseOrder,
|
|
2761
2766
|
dateTime: m.toISOString()
|
|
2762
2767
|
}),
|
|
2763
2768
|
version: "2",
|
|
@@ -2767,7 +2772,7 @@ var ht;
|
|
|
2767
2772
|
seqNumber: i.custbody_fm_po_num ?? 0,
|
|
2768
2773
|
items: S,
|
|
2769
2774
|
deliveryOrder: [
|
|
2770
|
-
|
|
2775
|
+
b
|
|
2771
2776
|
],
|
|
2772
2777
|
request: i.custbody_fm_po_request_id ? {
|
|
2773
2778
|
id: i.custbody_fm_po_request_id,
|
|
@@ -2781,8 +2786,8 @@ var ht;
|
|
|
2781
2786
|
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));
|
|
2782
2787
|
return {
|
|
2783
2788
|
received: t.inventory.items.map((p) => {
|
|
2784
|
-
const y = i[p.line].sku,
|
|
2785
|
-
return le.FromNetSuite.toPurchaseOrderReceived(p, t.glImpacts ?? [], y,
|
|
2789
|
+
const y = i[p.line].sku, _ = i[p.line].measurement;
|
|
2790
|
+
return le.FromNetSuite.toPurchaseOrderReceived(p, t.glImpacts ?? [], y, _);
|
|
2786
2791
|
}),
|
|
2787
2792
|
createdBy: {
|
|
2788
2793
|
name: "",
|
|
@@ -2793,22 +2798,22 @@ var ht;
|
|
|
2793
2798
|
netSuite: {
|
|
2794
2799
|
id: t.id,
|
|
2795
2800
|
refNo: t.tranId,
|
|
2796
|
-
recordType:
|
|
2801
|
+
recordType: Re.Enum.inventoryTransfer
|
|
2797
2802
|
},
|
|
2798
2803
|
effectiveAt: a.toISOString()
|
|
2799
2804
|
};
|
|
2800
2805
|
}
|
|
2801
2806
|
g(r, "transformToDeliveryOrder"), u.transformToDeliveryOrder = r;
|
|
2802
2807
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2803
|
-
})(
|
|
2804
|
-
function
|
|
2808
|
+
})(Tt || (Tt = {}));
|
|
2809
|
+
function _e(s, u, d, c) {
|
|
2805
2810
|
const r = {};
|
|
2806
2811
|
return c.forEach((n) => {
|
|
2807
|
-
r[n.line] =
|
|
2812
|
+
r[n.line] = jt(s, u, d, n.item.id, n.units);
|
|
2808
2813
|
}), r;
|
|
2809
2814
|
}
|
|
2810
|
-
g(
|
|
2811
|
-
function
|
|
2815
|
+
g(_e, "validateOrderItems");
|
|
2816
|
+
function jt(s, u, d, c, r) {
|
|
2812
2817
|
const n = d.items.find((f) => f.netSuiteId === c);
|
|
2813
2818
|
if (!n)
|
|
2814
2819
|
throw new Error(`SKU with ID ${c} not found in settings`);
|
|
@@ -2834,7 +2839,7 @@ function $t(s, u, d, c, r) {
|
|
|
2834
2839
|
measurement: l
|
|
2835
2840
|
};
|
|
2836
2841
|
}
|
|
2837
|
-
g(
|
|
2842
|
+
g(jt, "validateNetSuiteOrderItem");
|
|
2838
2843
|
function Rn(s, u) {
|
|
2839
2844
|
const d = s.items.reduce((c, r) => {
|
|
2840
2845
|
const { id: n, quantity: t } = r;
|
|
@@ -2879,7 +2884,7 @@ function Fn(s, u) {
|
|
|
2879
2884
|
}) && (c[r] = n), c), {});
|
|
2880
2885
|
}
|
|
2881
2886
|
g(Fn, "validateItemFulfillmentOverReceive");
|
|
2882
|
-
var
|
|
2887
|
+
var Dt;
|
|
2883
2888
|
(function(s) {
|
|
2884
2889
|
(function(u) {
|
|
2885
2890
|
function d(r, n) {
|
|
@@ -2896,9 +2901,9 @@ var Tt;
|
|
|
2896
2901
|
throw new Error("Missing transfer order status");
|
|
2897
2902
|
if (t && i)
|
|
2898
2903
|
throw new Error("Transfer Order cannot be both approved and rejected at the same time");
|
|
2899
|
-
const o =
|
|
2904
|
+
const o = Be(x.A);
|
|
2900
2905
|
return n.id === o && t ? {
|
|
2901
|
-
id:
|
|
2906
|
+
id: Be(x.B)
|
|
2902
2907
|
} : n;
|
|
2903
2908
|
}
|
|
2904
2909
|
g(c, "validateApprovalStatus"), u.validateApprovalStatus = c;
|
|
@@ -2930,8 +2935,8 @@ var Tt;
|
|
|
2930
2935
|
}
|
|
2931
2936
|
g(d, "isVoided"), u.isVoided = d;
|
|
2932
2937
|
}(s.FromNetSuite || (s.FromNetSuite = {}));
|
|
2933
|
-
})(
|
|
2934
|
-
function
|
|
2938
|
+
})(Dt || (Dt = {}));
|
|
2939
|
+
function xn(s, u) {
|
|
2935
2940
|
const d = s.reduce((r, n) => (r[n.line] = (r[n.line] || 0) + n.quantity, r), {}), c = [];
|
|
2936
2941
|
for (const r of u) {
|
|
2937
2942
|
const n = r.line, t = d[n] ?? 0;
|
|
@@ -2945,8 +2950,8 @@ function Pn(s, u) {
|
|
|
2945
2950
|
}
|
|
2946
2951
|
return c;
|
|
2947
2952
|
}
|
|
2948
|
-
g(
|
|
2949
|
-
function
|
|
2953
|
+
g(xn, "getAvailableItemToBeFulfilled");
|
|
2954
|
+
function Pn(s) {
|
|
2950
2955
|
var l, f;
|
|
2951
2956
|
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 = [];
|
|
2952
2957
|
for (const a of u) {
|
|
@@ -2960,7 +2965,7 @@ function On(s) {
|
|
|
2960
2965
|
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
2961
2966
|
if (!y.skuCache)
|
|
2962
2967
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
2963
|
-
if (y.itemType !==
|
|
2968
|
+
if (y.itemType !== F.Enum.Assembly)
|
|
2964
2969
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'Assembly'.`);
|
|
2965
2970
|
if (y.skuCache._id !== a._id)
|
|
2966
2971
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
@@ -2997,14 +3002,14 @@ function On(s) {
|
|
|
2997
3002
|
pktName: ((f = a.customFields) == null ? void 0 : f.pktName) ?? null
|
|
2998
3003
|
}));
|
|
2999
3004
|
for (const a of d)
|
|
3000
|
-
a.itemType !==
|
|
3005
|
+
a.itemType !== F.Enum.Assembly && !m.has(a.id) && o.push(a);
|
|
3001
3006
|
return {
|
|
3002
3007
|
updatedInventorySkus: i,
|
|
3003
3008
|
updatedParentItemConfigs: o
|
|
3004
3009
|
};
|
|
3005
3010
|
}
|
|
3006
|
-
g(
|
|
3007
|
-
function
|
|
3011
|
+
g(Pn, "syncAssemblyParentItemsWithLegacyConfig");
|
|
3012
|
+
function On(s) {
|
|
3008
3013
|
var n, t;
|
|
3009
3014
|
const { legacyChildItemConfigs: u, childReplicas: d } = s, c = [], r = /* @__PURE__ */ new Set();
|
|
3010
3015
|
for (const i of d)
|
|
@@ -3023,10 +3028,10 @@ function xn(s) {
|
|
|
3023
3028
|
pktName: ((t = i.customFields) == null ? void 0 : t.pktName) ?? null
|
|
3024
3029
|
});
|
|
3025
3030
|
for (const i of u)
|
|
3026
|
-
i.itemType !==
|
|
3031
|
+
i.itemType !== F.Enum.Assembly && !r.has(i.netSuiteId) && c.push(i);
|
|
3027
3032
|
return c;
|
|
3028
3033
|
}
|
|
3029
|
-
g(
|
|
3034
|
+
g(On, "syncAssemblyChildItemsWithLegacyConfig");
|
|
3030
3035
|
function Ln(s) {
|
|
3031
3036
|
var l, f;
|
|
3032
3037
|
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 = [];
|
|
@@ -3041,7 +3046,7 @@ function Ln(s) {
|
|
|
3041
3046
|
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
3042
3047
|
if (!y.skuCache)
|
|
3043
3048
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
3044
|
-
if (y.itemType !==
|
|
3049
|
+
if (y.itemType !== F.Enum.InvtPart)
|
|
3045
3050
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'InvtPart'.`);
|
|
3046
3051
|
if (y.skuCache._id !== a._id)
|
|
3047
3052
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
@@ -3078,7 +3083,7 @@ function Ln(s) {
|
|
|
3078
3083
|
pktName: ((f = a.customFields) == null ? void 0 : f.pktName) ?? null
|
|
3079
3084
|
}));
|
|
3080
3085
|
for (const a of d)
|
|
3081
|
-
a.itemType !==
|
|
3086
|
+
a.itemType !== F.Enum.InvtPart && !m.has(a.id) && o.push(a);
|
|
3082
3087
|
return {
|
|
3083
3088
|
updatedInventorySkus: i,
|
|
3084
3089
|
updatedParentItemConfigs: o
|
|
@@ -3086,25 +3091,26 @@ function Ln(s) {
|
|
|
3086
3091
|
}
|
|
3087
3092
|
g(Ln, "syncInventoryParentItemsWithLegacyConfig");
|
|
3088
3093
|
function $n(s) {
|
|
3089
|
-
var n, t;
|
|
3094
|
+
var n, t, i;
|
|
3090
3095
|
const { legacyChildItemConfigs: u, childReplicas: d } = s, c = [], r = /* @__PURE__ */ new Set();
|
|
3091
|
-
for (const
|
|
3092
|
-
r.add(
|
|
3093
|
-
name:
|
|
3094
|
-
netSuiteId:
|
|
3095
|
-
parentNetSuiteId:
|
|
3096
|
-
unitTypeId:
|
|
3097
|
-
unitOfMeasureId:
|
|
3098
|
-
subsidiaryIds:
|
|
3099
|
-
includeChildren:
|
|
3100
|
-
cogsAccount:
|
|
3101
|
-
itemType:
|
|
3102
|
-
externalId:
|
|
3103
|
-
pktCode: ((n =
|
|
3104
|
-
pktName: ((t =
|
|
3096
|
+
for (const o of d)
|
|
3097
|
+
r.add(o.netSuiteId), c.push({
|
|
3098
|
+
name: o.name,
|
|
3099
|
+
netSuiteId: o.netSuiteId,
|
|
3100
|
+
parentNetSuiteId: o.parentNetSuiteId,
|
|
3101
|
+
unitTypeId: o.unitTypeId,
|
|
3102
|
+
unitOfMeasureId: o.unitOfMeasureId,
|
|
3103
|
+
subsidiaryIds: o.subsidiaryIds,
|
|
3104
|
+
includeChildren: o.includeChildren,
|
|
3105
|
+
cogsAccount: o.cogsAccount,
|
|
3106
|
+
itemType: o.itemType,
|
|
3107
|
+
externalId: o.externalId,
|
|
3108
|
+
pktCode: ((n = o.customFields) == null ? void 0 : n.pktCode) ?? null,
|
|
3109
|
+
pktName: ((t = o.customFields) == null ? void 0 : t.pktName) ?? null,
|
|
3110
|
+
customAttributes: (i = o.customFields) == null ? void 0 : i.customAttributes
|
|
3105
3111
|
});
|
|
3106
|
-
for (const
|
|
3107
|
-
|
|
3112
|
+
for (const o of u)
|
|
3113
|
+
o.itemType !== F.Enum.InvtPart && !r.has(o.netSuiteId) && c.push(o);
|
|
3108
3114
|
return c;
|
|
3109
3115
|
}
|
|
3110
3116
|
g($n, "syncInventoryChildItemsWithLegacyConfig");
|
|
@@ -3122,7 +3128,7 @@ function jn(s) {
|
|
|
3122
3128
|
throw new Error(`Missing replica for NetSuite ID ${p.netSuiteId} for SKU with ID ${a._id}`);
|
|
3123
3129
|
if (!y.skuCache)
|
|
3124
3130
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} is missing skuCache. Expected parent item replica.`);
|
|
3125
|
-
if (y.itemType !==
|
|
3131
|
+
if (y.itemType !== F.Enum.Service)
|
|
3126
3132
|
throw new Error(`Replica for NetSuite ID ${p.netSuiteId} has itemType '${y.itemType}'. Expected 'Service'.`);
|
|
3127
3133
|
if (y.skuCache._id !== a._id)
|
|
3128
3134
|
throw new Error(`SKU ID mismatch: expected replica skuCache._id to be '${a._id}', but got '${y.skuCache._id}'`);
|
|
@@ -3160,7 +3166,7 @@ function jn(s) {
|
|
|
3160
3166
|
itemSubType: a.itemSubType
|
|
3161
3167
|
}));
|
|
3162
3168
|
for (const a of d)
|
|
3163
|
-
a.itemType !==
|
|
3169
|
+
a.itemType !== F.Enum.Service && !m.has(a.id) && o.push(a);
|
|
3164
3170
|
return {
|
|
3165
3171
|
updatedInventorySkus: i,
|
|
3166
3172
|
updatedParentItemConfigs: o
|
|
@@ -3169,29 +3175,29 @@ function jn(s) {
|
|
|
3169
3175
|
g(jn, "syncServiceParentItemsWithLegacyConfig");
|
|
3170
3176
|
function Vn(s, u) {
|
|
3171
3177
|
var r;
|
|
3172
|
-
const d = u ===
|
|
3173
|
-
return ((r = s.netSuite) == null ? void 0 : r.recordType) ===
|
|
3178
|
+
const d = u === ze.Enum.restaurant && s.supplier.internal === ze.Enum.restaurant;
|
|
3179
|
+
return ((r = s.netSuite) == null ? void 0 : r.recordType) === Re.Enum.inventoryTransfer || d;
|
|
3174
3180
|
}
|
|
3175
3181
|
g(Vn, "canSyncWithInventoryTransfer");
|
|
3176
3182
|
var C;
|
|
3177
3183
|
(function(s) {
|
|
3178
3184
|
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";
|
|
3179
3185
|
})(C || (C = {}));
|
|
3180
|
-
function
|
|
3186
|
+
function oe(s, u) {
|
|
3181
3187
|
return u.reduce((d, c) => d.replace("$", c), s);
|
|
3182
3188
|
}
|
|
3183
|
-
g(
|
|
3184
|
-
var
|
|
3185
|
-
function
|
|
3189
|
+
g(oe, "replacePlaceholders");
|
|
3190
|
+
var Ae = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3191
|
+
function he(s, u, d, c, r = !1) {
|
|
3186
3192
|
const n = [];
|
|
3187
|
-
if ((c ===
|
|
3193
|
+
if ((c === X.Enum[2] || r) && u.length != 0 && u.every((t) => !t.externalId))
|
|
3188
3194
|
for (let t = 0; t < u.length; t++) {
|
|
3189
3195
|
const i = s[t];
|
|
3190
3196
|
if (!i)
|
|
3191
3197
|
throw new Error("Incoming item is undefined");
|
|
3192
3198
|
n.push({
|
|
3193
3199
|
type: C.ITEM_UPDATED,
|
|
3194
|
-
message:
|
|
3200
|
+
message: oe(Ae, [
|
|
3195
3201
|
"Order Item",
|
|
3196
3202
|
`${i.externalId}`,
|
|
3197
3203
|
"externalId",
|
|
@@ -3229,14 +3235,14 @@ function Se(s, u, d, c, r = !1) {
|
|
|
3229
3235
|
}
|
|
3230
3236
|
});
|
|
3231
3237
|
else {
|
|
3232
|
-
const o = Object.keys(
|
|
3238
|
+
const o = Object.keys(Ke.shape);
|
|
3233
3239
|
for (const m of o) {
|
|
3234
|
-
if (m === "id" || m === "name" || m === "externalId" && c ===
|
|
3240
|
+
if (m === "id" || m === "name" || m === "externalId" && c === X.Enum[1])
|
|
3235
3241
|
continue;
|
|
3236
3242
|
if (m === "sku") {
|
|
3237
3243
|
t[m]._id !== i[m]._id && n.push({
|
|
3238
3244
|
type: C.ITEM_UPDATED,
|
|
3239
|
-
message:
|
|
3245
|
+
message: oe(Ae, [
|
|
3240
3246
|
"Order Item",
|
|
3241
3247
|
`${t.externalId}`,
|
|
3242
3248
|
m,
|
|
@@ -3265,7 +3271,7 @@ function Se(s, u, d, c, r = !1) {
|
|
|
3265
3271
|
continue;
|
|
3266
3272
|
typeof t[m] == "object" && (a = JSON.stringify(f), I = JSON.stringify(l)), n.push({
|
|
3267
3273
|
type: C.ITEM_UPDATED,
|
|
3268
|
-
message:
|
|
3274
|
+
message: oe(Ae, [
|
|
3269
3275
|
"Purchase Order Item",
|
|
3270
3276
|
`${t.externalId}`,
|
|
3271
3277
|
m,
|
|
@@ -3287,17 +3293,17 @@ function Se(s, u, d, c, r = !1) {
|
|
|
3287
3293
|
}
|
|
3288
3294
|
return n;
|
|
3289
3295
|
}
|
|
3290
|
-
g(
|
|
3291
|
-
function
|
|
3296
|
+
g(he, "detectPurchaseOrderItemConflicts");
|
|
3297
|
+
function ot(s, u, d, c, r) {
|
|
3292
3298
|
const n = [], t = {};
|
|
3293
|
-
if (r ===
|
|
3299
|
+
if (r === X.Enum[2] && c.length != 0 && c.every((i) => !i.externalId))
|
|
3294
3300
|
for (let i = 0; i < c.length; i++) {
|
|
3295
3301
|
const o = d[i];
|
|
3296
3302
|
if (!o)
|
|
3297
3303
|
throw new Error("Incoming item is undefined");
|
|
3298
3304
|
n.push({
|
|
3299
3305
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3300
|
-
message:
|
|
3306
|
+
message: oe(Ae, [
|
|
3301
3307
|
`${u}`,
|
|
3302
3308
|
`${o.externalId}`,
|
|
3303
3309
|
"externalId",
|
|
@@ -3338,14 +3344,14 @@ function st(s, u, d, c, r) {
|
|
|
3338
3344
|
});
|
|
3339
3345
|
else {
|
|
3340
3346
|
i.id && i.externalId && (t[i.id] = i.externalId);
|
|
3341
|
-
const m = Object.keys(
|
|
3347
|
+
const m = Object.keys(Qt.shape);
|
|
3342
3348
|
for (const l of m) {
|
|
3343
|
-
if (l === "id" || l === "externalId" && r ===
|
|
3349
|
+
if (l === "id" || l === "externalId" && r === X.Enum[1])
|
|
3344
3350
|
continue;
|
|
3345
3351
|
if (l === "sku") {
|
|
3346
3352
|
i[l]._id !== o[l]._id && n.push({
|
|
3347
3353
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3348
|
-
message:
|
|
3354
|
+
message: oe(Ae, [
|
|
3349
3355
|
`${u}`,
|
|
3350
3356
|
`${i.externalId}`,
|
|
3351
3357
|
l,
|
|
@@ -3372,7 +3378,7 @@ function st(s, u, d, c, r) {
|
|
|
3372
3378
|
let I = a, p = f;
|
|
3373
3379
|
typeof i[l] == "object" && (I = JSON.stringify(a), p = JSON.stringify(f)), n.push({
|
|
3374
3380
|
type: u === "deliveryFulfillment" ? C.ITEM_FULFILLMENT_ITEM_UPDATED : C.ITEM_RECEIPT_ITEM_UPDATED,
|
|
3375
|
-
message:
|
|
3381
|
+
message: oe(Ae, [
|
|
3376
3382
|
`${u}`,
|
|
3377
3383
|
`${i.externalId}`,
|
|
3378
3384
|
l,
|
|
@@ -3395,7 +3401,7 @@ function st(s, u, d, c, r) {
|
|
|
3395
3401
|
}
|
|
3396
3402
|
return n;
|
|
3397
3403
|
}
|
|
3398
|
-
g(
|
|
3404
|
+
g(ot, "detectPurchaseOrderReceivedConflicts");
|
|
3399
3405
|
function qe(s, u, d = "1") {
|
|
3400
3406
|
if (u.length === 0)
|
|
3401
3407
|
return s;
|
|
@@ -3424,7 +3430,7 @@ function qe(s, u, d = "1") {
|
|
|
3424
3430
|
}));
|
|
3425
3431
|
}
|
|
3426
3432
|
g(qe, "resolvePurchaseOrderItemConflicts");
|
|
3427
|
-
function
|
|
3433
|
+
function at(s, u, d = "1") {
|
|
3428
3434
|
if (u.length === 0)
|
|
3429
3435
|
return s;
|
|
3430
3436
|
const c = [
|
|
@@ -3445,59 +3451,59 @@ function ot(s, u, d = "1") {
|
|
|
3445
3451
|
}
|
|
3446
3452
|
return c;
|
|
3447
3453
|
}
|
|
3448
|
-
g(
|
|
3449
|
-
var
|
|
3454
|
+
g(at, "resolvePurchaseOrderReceivedConflicts");
|
|
3455
|
+
var ie;
|
|
3450
3456
|
(function(s) {
|
|
3451
3457
|
s.ITEM_FULFILLMENT_CREATED = "ITEM_FULFILLMENT_CREATED", s.ITEM_FULFILLMENT_UPDATED = "ITEM_FULFILLMENT_UPDATED", s.ITEM_FULFILLMENT_DELETED = "ITEM_FULFILLMENT_DELETED";
|
|
3452
|
-
})(
|
|
3453
|
-
var
|
|
3458
|
+
})(ie || (ie = {}));
|
|
3459
|
+
var j = /* @__PURE__ */ g((s) => s === "" ? null : s, "normalizeNullOrEmpty"), Bn = 'Record [$] item on line [$], field "$" changed from "$" to "$"';
|
|
3454
3460
|
function qn(s, u, d) {
|
|
3455
3461
|
var n, t, i, o, m, l;
|
|
3456
|
-
const c = Object.keys(
|
|
3462
|
+
const c = Object.keys(Zt.shape), r = [];
|
|
3457
3463
|
for (const f of u) {
|
|
3458
|
-
const a =
|
|
3464
|
+
const a = j(f.id), I = j((n = f.netSuite) == null ? void 0 : n.id);
|
|
3459
3465
|
if (!I)
|
|
3460
3466
|
continue;
|
|
3461
3467
|
const p = s.find((y) => {
|
|
3462
|
-
var
|
|
3463
|
-
const
|
|
3464
|
-
return
|
|
3468
|
+
var v;
|
|
3469
|
+
const _ = j(y.id), b = j((v = y.netSuite) == null ? void 0 : v.id);
|
|
3470
|
+
return b && I && b === I || _ && _ === a;
|
|
3465
3471
|
});
|
|
3466
3472
|
if (!p)
|
|
3467
3473
|
r.push({
|
|
3468
|
-
type:
|
|
3474
|
+
type: ie.ITEM_FULFILLMENT_CREATED,
|
|
3469
3475
|
message: `New Item Fulfillment ${(t = f.netSuite) == null ? void 0 : t.id} created`,
|
|
3470
3476
|
data: f
|
|
3471
3477
|
});
|
|
3472
3478
|
else {
|
|
3473
|
-
const y =
|
|
3474
|
-
if (
|
|
3479
|
+
const y = j(p.id), _ = j((i = p.netSuite) == null ? void 0 : i.id);
|
|
3480
|
+
if (_ && I && _ !== I || a && y && y !== a)
|
|
3475
3481
|
throw new Error(`Inconsistent data for Item Fulfillment ${(o = f.netSuite) == null ? void 0 : o.id} (or ${f.id})`);
|
|
3476
|
-
for (const
|
|
3477
|
-
if (
|
|
3482
|
+
for (const E of c) {
|
|
3483
|
+
if (E === "adjustment" || E === "id")
|
|
3478
3484
|
continue;
|
|
3479
|
-
if (
|
|
3480
|
-
r.push(...
|
|
3485
|
+
if (E === "items") {
|
|
3486
|
+
r.push(...ot(p.id, "deliveryFulfillment", f.items, p.items, d));
|
|
3481
3487
|
continue;
|
|
3482
3488
|
}
|
|
3483
|
-
const
|
|
3484
|
-
if (!P.isEqual(
|
|
3485
|
-
let
|
|
3486
|
-
typeof f[
|
|
3487
|
-
type:
|
|
3488
|
-
message:
|
|
3489
|
+
const v = f[E] ?? null, U = p[E] ?? null;
|
|
3490
|
+
if (!P.isEqual(v, U)) {
|
|
3491
|
+
let h = U, k = v;
|
|
3492
|
+
typeof f[E] == "object" && (h = JSON.stringify(U), k = JSON.stringify(v)), E === "createdAt" && (h = new Date(f[E]).toISOString(), k = new Date(p[E]).toISOString()), r.push({
|
|
3493
|
+
type: ie.ITEM_FULFILLMENT_UPDATED,
|
|
3494
|
+
message: oe(Bn, [
|
|
3489
3495
|
"Item Fulfillment Field",
|
|
3490
3496
|
`${(m = f.netSuite) == null ? void 0 : m.id}`,
|
|
3491
|
-
|
|
3492
|
-
`${
|
|
3493
|
-
`${
|
|
3497
|
+
E,
|
|
3498
|
+
`${h}`,
|
|
3499
|
+
`${k}`
|
|
3494
3500
|
]),
|
|
3495
3501
|
data: {
|
|
3496
3502
|
recordId: `${p.id}`,
|
|
3497
3503
|
nsRecordId: `${(l = f.netSuite) == null ? void 0 : l.id}`,
|
|
3498
|
-
field:
|
|
3499
|
-
incomingValue:
|
|
3500
|
-
existingValue:
|
|
3504
|
+
field: E,
|
|
3505
|
+
incomingValue: v,
|
|
3506
|
+
existingValue: U
|
|
3501
3507
|
}
|
|
3502
3508
|
});
|
|
3503
3509
|
}
|
|
@@ -3508,13 +3514,13 @@ function qn(s, u, d) {
|
|
|
3508
3514
|
}
|
|
3509
3515
|
g(qn, "detectItemFulfillmentConflicts");
|
|
3510
3516
|
function Hn(s, u) {
|
|
3511
|
-
const d = u.filter((n) => n.type ===
|
|
3517
|
+
const d = u.filter((n) => n.type === ie.ITEM_FULFILLMENT_CREATED || n.type === ie.ITEM_FULFILLMENT_UPDATED || n.type === ie.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 = [];
|
|
3512
3518
|
if (d.length === 0)
|
|
3513
3519
|
return s;
|
|
3514
3520
|
for (const n of s) {
|
|
3515
3521
|
const t = d.filter((l) => {
|
|
3516
3522
|
var f;
|
|
3517
|
-
if (l.type ===
|
|
3523
|
+
if (l.type === ie.ITEM_FULFILLMENT_UPDATED) {
|
|
3518
3524
|
const a = l.data;
|
|
3519
3525
|
if (a.recordId && a.recordId === n.id) {
|
|
3520
3526
|
if ((f = n.netSuite) != null && f.id && a.nsRecordId !== n.netSuite.id)
|
|
@@ -3524,13 +3530,13 @@ function Hn(s, u) {
|
|
|
3524
3530
|
return !1;
|
|
3525
3531
|
}
|
|
3526
3532
|
return l.data.recordId != "" && l.data.recordId === n.id;
|
|
3527
|
-
}), 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 =
|
|
3533
|
+
}), 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 = at(n.items || [], i);
|
|
3528
3534
|
let m = {
|
|
3529
3535
|
...n,
|
|
3530
3536
|
items: o
|
|
3531
3537
|
};
|
|
3532
3538
|
for (const l of t)
|
|
3533
|
-
if (l.type ===
|
|
3539
|
+
if (l.type === ie.ITEM_FULFILLMENT_UPDATED) {
|
|
3534
3540
|
const f = l.data.field, a = l.data.incomingValue, I = n[f];
|
|
3535
3541
|
a !== I && (m = {
|
|
3536
3542
|
...n,
|
|
@@ -3540,93 +3546,93 @@ function Hn(s, u) {
|
|
|
3540
3546
|
c.push(m);
|
|
3541
3547
|
}
|
|
3542
3548
|
for (const n of d)
|
|
3543
|
-
n.type ===
|
|
3549
|
+
n.type === ie.ITEM_FULFILLMENT_CREATED && c.push({
|
|
3544
3550
|
...n.data,
|
|
3545
|
-
id: n.data.id ||
|
|
3546
|
-
prefix:
|
|
3551
|
+
id: n.data.id || L({
|
|
3552
|
+
prefix: $.Enum.deliveryFulfillment
|
|
3547
3553
|
})
|
|
3548
3554
|
});
|
|
3549
3555
|
const r = [];
|
|
3550
3556
|
for (const n of c)
|
|
3551
3557
|
n.id ? r.push(n) : (console.warn("Missing delivery fulfillment id, generating new id"), r.push({
|
|
3552
3558
|
...n,
|
|
3553
|
-
id:
|
|
3554
|
-
prefix:
|
|
3559
|
+
id: L({
|
|
3560
|
+
prefix: $.Enum.deliveryFulfillment
|
|
3555
3561
|
})
|
|
3556
3562
|
}));
|
|
3557
3563
|
return r;
|
|
3558
3564
|
}
|
|
3559
3565
|
g(Hn, "resolveDeliveryFulfillmentConflicts");
|
|
3560
|
-
var
|
|
3566
|
+
var re;
|
|
3561
3567
|
(function(s) {
|
|
3562
3568
|
s.ITEM_RECEIPT_CREATED = "ITEM_RECEIPT_CREATED", s.ITEM_RECEIPT_UPDATED = "ITEM_RECEIPT_UPDATED", s.ITEM_RECEIPT_DELETED = "ITEM_RECEIPT_DELETED";
|
|
3563
|
-
})(
|
|
3564
|
-
var Kn = 'Record [$] item on line [$], field "$" changed from "$" to "$"',
|
|
3569
|
+
})(re || (re = {}));
|
|
3570
|
+
var Kn = 'Record [$] item on line [$], field "$" changed from "$" to "$"', Nt = {
|
|
3565
3571
|
deliveryOrderNumber: ""
|
|
3566
3572
|
};
|
|
3567
|
-
function
|
|
3573
|
+
function Vt(s, u, d) {
|
|
3568
3574
|
var i, o, m, l, f, a, I;
|
|
3569
|
-
const c = Object.keys(
|
|
3575
|
+
const c = Object.keys(Xt.shape), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
|
|
3570
3576
|
for (const p of s) {
|
|
3571
|
-
const y =
|
|
3577
|
+
const y = j((i = p.netSuite) == null ? void 0 : i.id), _ = j(p.id);
|
|
3572
3578
|
if (y) {
|
|
3573
3579
|
if (r.has(y))
|
|
3574
3580
|
throw new Error(`Duplicate NetSuite ID found: ${y}`);
|
|
3575
3581
|
r.add(y);
|
|
3576
3582
|
}
|
|
3577
|
-
if (
|
|
3578
|
-
if (n.has(
|
|
3579
|
-
throw new Error(`Duplicate delivery order ID found: ${
|
|
3580
|
-
n.add(
|
|
3583
|
+
if (_) {
|
|
3584
|
+
if (n.has(_))
|
|
3585
|
+
throw new Error(`Duplicate delivery order ID found: ${_}`);
|
|
3586
|
+
n.add(_);
|
|
3581
3587
|
}
|
|
3582
3588
|
}
|
|
3583
3589
|
const t = [];
|
|
3584
3590
|
for (const p of u) {
|
|
3585
|
-
const y =
|
|
3586
|
-
if (!
|
|
3591
|
+
const y = j(p.id), _ = j((o = p.netSuite) == null ? void 0 : o.id);
|
|
3592
|
+
if (!_)
|
|
3587
3593
|
continue;
|
|
3588
|
-
const
|
|
3589
|
-
var
|
|
3590
|
-
const
|
|
3591
|
-
return
|
|
3594
|
+
const b = s.find((S) => {
|
|
3595
|
+
var k;
|
|
3596
|
+
const E = j(S.id), v = j((k = S.netSuite) == null ? void 0 : k.id);
|
|
3597
|
+
return v && _ && v === _ || E && E === y;
|
|
3592
3598
|
});
|
|
3593
|
-
if (!
|
|
3599
|
+
if (!b)
|
|
3594
3600
|
t.push({
|
|
3595
|
-
type:
|
|
3601
|
+
type: re.ITEM_RECEIPT_CREATED,
|
|
3596
3602
|
message: `New Item Receipt ${(m = p.netSuite) == null ? void 0 : m.id} created`,
|
|
3597
3603
|
data: p
|
|
3598
3604
|
});
|
|
3599
3605
|
else {
|
|
3600
|
-
const S =
|
|
3601
|
-
if (
|
|
3606
|
+
const S = j(b.id), E = j((l = b.netSuite) == null ? void 0 : l.id);
|
|
3607
|
+
if (E && _ && E !== _ || y && S && S !== y)
|
|
3602
3608
|
throw new Error(`Inconsistent data for Item Receipt ${(f = p.netSuite) == null ? void 0 : f.id} (or ${p.id})`);
|
|
3603
|
-
for (const
|
|
3604
|
-
if (
|
|
3609
|
+
for (const h of c) {
|
|
3610
|
+
if (h === "adjustment" || h === "id")
|
|
3605
3611
|
continue;
|
|
3606
|
-
if (
|
|
3607
|
-
t.push(...
|
|
3612
|
+
if (h === "received") {
|
|
3613
|
+
t.push(...ot(b.id, "deliveryOrder", p.received, b.received, d));
|
|
3608
3614
|
continue;
|
|
3609
3615
|
}
|
|
3610
|
-
const
|
|
3611
|
-
if (!P.isEqual(
|
|
3612
|
-
if ((
|
|
3616
|
+
const k = h in Nt, A = k ? p[h] ?? Nt[h] : j(p[h] ?? null), D = k ? b[h] : j(b[h] ?? null);
|
|
3617
|
+
if (!P.isEqual(A, D)) {
|
|
3618
|
+
if ((h === "createdAt" || h === "createdBy" || h === "remark" || h === "effectiveAt") && D)
|
|
3613
3619
|
continue;
|
|
3614
|
-
let
|
|
3615
|
-
typeof p[
|
|
3616
|
-
type:
|
|
3617
|
-
message:
|
|
3620
|
+
let T = D, R = A;
|
|
3621
|
+
typeof p[h] == "object" && (T = JSON.stringify(D), R = JSON.stringify(A)), h === "createdAt" && (T = new Date(p[h]).toISOString(), R = new Date(b[h]).toISOString()), t.push({
|
|
3622
|
+
type: re.ITEM_RECEIPT_UPDATED,
|
|
3623
|
+
message: oe(Kn, [
|
|
3618
3624
|
"Item Receipt Field",
|
|
3619
3625
|
`${(a = p.netSuite) == null ? void 0 : a.id}`,
|
|
3620
|
-
|
|
3621
|
-
`${
|
|
3622
|
-
`${
|
|
3626
|
+
h,
|
|
3627
|
+
`${T}`,
|
|
3628
|
+
`${R}`
|
|
3623
3629
|
]),
|
|
3624
3630
|
data: {
|
|
3625
|
-
recordId: `${
|
|
3631
|
+
recordId: `${b == null ? void 0 : b.id}`,
|
|
3626
3632
|
nsRecordId: `${(I = p.netSuite) == null ? void 0 : I.id}`,
|
|
3627
|
-
field:
|
|
3628
|
-
incomingValue:
|
|
3629
|
-
existingValue:
|
|
3633
|
+
field: h,
|
|
3634
|
+
incomingValue: A,
|
|
3635
|
+
existingValue: D
|
|
3630
3636
|
}
|
|
3631
3637
|
});
|
|
3632
3638
|
}
|
|
@@ -3635,16 +3641,16 @@ function jt(s, u, d) {
|
|
|
3635
3641
|
}
|
|
3636
3642
|
return t;
|
|
3637
3643
|
}
|
|
3638
|
-
g(
|
|
3639
|
-
function
|
|
3640
|
-
const d = u.filter((n) => n.type ===
|
|
3644
|
+
g(Vt, "detectItemReceiptConflicts");
|
|
3645
|
+
function Bt(s, u) {
|
|
3646
|
+
const d = u.filter((n) => n.type === re.ITEM_RECEIPT_CREATED || n.type === re.ITEM_RECEIPT_UPDATED || n.type === re.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 = [];
|
|
3641
3647
|
if (d.length === 0)
|
|
3642
3648
|
return s;
|
|
3643
3649
|
for (const n of s) {
|
|
3644
3650
|
const t = d.filter((l) => {
|
|
3645
3651
|
var a;
|
|
3646
3652
|
const f = l.data;
|
|
3647
|
-
if (l.type ===
|
|
3653
|
+
if (l.type === re.ITEM_RECEIPT_UPDATED) {
|
|
3648
3654
|
const I = l.data;
|
|
3649
3655
|
if (I.recordId && I.recordId === n.id) {
|
|
3650
3656
|
if ((a = n.netSuite) != null && a.id && I.nsRecordId !== n.netSuite.id)
|
|
@@ -3654,13 +3660,13 @@ function Vt(s, u) {
|
|
|
3654
3660
|
return !1;
|
|
3655
3661
|
}
|
|
3656
3662
|
return f.recordId != "" && f.recordId === n.id;
|
|
3657
|
-
}), 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 =
|
|
3663
|
+
}), 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 = at(n.received || [], i);
|
|
3658
3664
|
let m = {
|
|
3659
3665
|
...n,
|
|
3660
3666
|
received: o
|
|
3661
3667
|
};
|
|
3662
3668
|
for (const l of t)
|
|
3663
|
-
if (l.type ===
|
|
3669
|
+
if (l.type === re.ITEM_RECEIPT_UPDATED) {
|
|
3664
3670
|
const f = l.data.field, a = l.data.incomingValue, I = n[f];
|
|
3665
3671
|
a !== I && (m = {
|
|
3666
3672
|
...n,
|
|
@@ -3670,30 +3676,30 @@ function Vt(s, u) {
|
|
|
3670
3676
|
c.push(m);
|
|
3671
3677
|
}
|
|
3672
3678
|
for (const n of d)
|
|
3673
|
-
if (n.type ===
|
|
3679
|
+
if (n.type === re.ITEM_RECEIPT_CREATED) {
|
|
3674
3680
|
const t = new Date(n.data.createdAt), i = new Date(n.data.effectiveAt);
|
|
3675
3681
|
c.push({
|
|
3676
3682
|
...n.data,
|
|
3677
|
-
id: n.data.id ||
|
|
3678
|
-
prefix:
|
|
3683
|
+
id: n.data.id || L({
|
|
3684
|
+
prefix: $.Enum.deliveryOrder
|
|
3679
3685
|
}),
|
|
3680
|
-
effectiveAt:
|
|
3686
|
+
effectiveAt: ee(t, i) ? void 0 : i.toISOString()
|
|
3681
3687
|
});
|
|
3682
3688
|
}
|
|
3683
3689
|
const r = [];
|
|
3684
3690
|
for (const n of c)
|
|
3685
3691
|
n.id ? r.push(n) : (console.warn("Missing delivery order id, generating new id"), r.push({
|
|
3686
3692
|
...n,
|
|
3687
|
-
id:
|
|
3688
|
-
prefix:
|
|
3693
|
+
id: L({
|
|
3694
|
+
prefix: $.Enum.deliveryOrder
|
|
3689
3695
|
})
|
|
3690
3696
|
}));
|
|
3691
3697
|
return r;
|
|
3692
3698
|
}
|
|
3693
|
-
g(
|
|
3694
|
-
function
|
|
3699
|
+
g(Bt, "resolveDeliveryOrdersConflicts");
|
|
3700
|
+
function zn(s, u, d, c) {
|
|
3695
3701
|
var t, i;
|
|
3696
|
-
const r =
|
|
3702
|
+
const r = Bt(u, c), n = [];
|
|
3697
3703
|
for (const o of r) {
|
|
3698
3704
|
const m = {
|
|
3699
3705
|
...o
|
|
@@ -3709,31 +3715,31 @@ function Gn(s, u, d, c) {
|
|
|
3709
3715
|
}
|
|
3710
3716
|
return n;
|
|
3711
3717
|
}
|
|
3712
|
-
g(
|
|
3713
|
-
var
|
|
3718
|
+
g(zn, "resolveAndMergeDeliveryOrders");
|
|
3719
|
+
var Z;
|
|
3714
3720
|
(function(s) {
|
|
3715
3721
|
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";
|
|
3716
|
-
})(
|
|
3722
|
+
})(Z || (Z = {}));
|
|
3717
3723
|
function q(s, u, d, c, r) {
|
|
3718
3724
|
let n = c, t = r;
|
|
3719
3725
|
return typeof c == "object" && (n = JSON.stringify(c), t = JSON.stringify(r)), `${s} ${u} field ${d} changed from "${n}" to "${t}"`;
|
|
3720
3726
|
}
|
|
3721
3727
|
g(q, "generateLogMessage");
|
|
3722
|
-
function
|
|
3728
|
+
function Gn(s, u, d, c = !1) {
|
|
3723
3729
|
var n, t;
|
|
3724
3730
|
const r = [];
|
|
3725
3731
|
if (u || r.push({
|
|
3726
|
-
type:
|
|
3732
|
+
type: Z.PURCHASE_ORDER_CREATED,
|
|
3727
3733
|
message: "Purchase order not found",
|
|
3728
3734
|
data: s.purchaseOrder
|
|
3729
3735
|
}), d || r.push({
|
|
3730
|
-
type:
|
|
3736
|
+
type: Z.PURCHASE_ORDER_REQUEST_CREATED,
|
|
3731
3737
|
message: "Purchase order request not found",
|
|
3732
3738
|
data: s.purchaseOrderRequest
|
|
3733
3739
|
}), !u && !d)
|
|
3734
|
-
return r.push(...
|
|
3740
|
+
return r.push(...he(s.purchaseOrder.items, [], "", "2")), r;
|
|
3735
3741
|
if (u) {
|
|
3736
|
-
const i = Object.keys(
|
|
3742
|
+
const i = Object.keys(tt.shape);
|
|
3737
3743
|
for (const o of i) {
|
|
3738
3744
|
if (![
|
|
3739
3745
|
"status",
|
|
@@ -3744,7 +3750,7 @@ function zn(s, u, d, c = !1) {
|
|
|
3744
3750
|
].includes(o))
|
|
3745
3751
|
continue;
|
|
3746
3752
|
if (o === "items") {
|
|
3747
|
-
r.push(...
|
|
3753
|
+
r.push(...he(s.purchaseOrder.items, u.items, u._id, u.version || "1", c));
|
|
3748
3754
|
continue;
|
|
3749
3755
|
}
|
|
3750
3756
|
let l = s.purchaseOrder[o] ?? null;
|
|
@@ -3755,21 +3761,21 @@ function zn(s, u, d, c = !1) {
|
|
|
3755
3761
|
continue;
|
|
3756
3762
|
}
|
|
3757
3763
|
if (o === "effectiveAt" && l && typeof l == "string") {
|
|
3758
|
-
const a = new Date(
|
|
3759
|
-
|
|
3764
|
+
const a = new Date(ae(u._id));
|
|
3765
|
+
ee(a, new Date(l)) && (l = null);
|
|
3760
3766
|
}
|
|
3761
3767
|
if (!P.isEqual(l, f)) {
|
|
3762
3768
|
let a = f, I = l;
|
|
3763
3769
|
if (l && f && typeof l == "object" && typeof f == "object" && (a = f ? JSON.stringify(f) : null, I = l ? JSON.stringify(l) : null), o === "effectiveAt") {
|
|
3764
3770
|
if (!f) {
|
|
3765
|
-
const p = new Date(
|
|
3771
|
+
const p = new Date(ae(u._id));
|
|
3766
3772
|
if (typeof l == "string" && new Date(l).toDateString() === new Date(p).toDateString())
|
|
3767
3773
|
continue;
|
|
3768
3774
|
}
|
|
3769
3775
|
a = f && typeof f == "string" ? new Date(f).toISOString() : null, I = l && typeof l == "string" ? new Date(l).toISOString() : null;
|
|
3770
3776
|
}
|
|
3771
3777
|
r.push({
|
|
3772
|
-
type:
|
|
3778
|
+
type: Z.PURCHASE_ORDER_UPDATED,
|
|
3773
3779
|
message: q("Transfer Order", (n = s.purchaseOrder.netSuite) == null ? void 0 : n.id, o, a, I),
|
|
3774
3780
|
data: {
|
|
3775
3781
|
field: o,
|
|
@@ -3781,7 +3787,7 @@ function zn(s, u, d, c = !1) {
|
|
|
3781
3787
|
}
|
|
3782
3788
|
}
|
|
3783
3789
|
if (d) {
|
|
3784
|
-
const i = Object.keys(
|
|
3790
|
+
const i = Object.keys(en.shape);
|
|
3785
3791
|
for (const o of i) {
|
|
3786
3792
|
if (o === "_id")
|
|
3787
3793
|
continue;
|
|
@@ -3792,7 +3798,7 @@ function zn(s, u, d, c = !1) {
|
|
|
3792
3798
|
continue;
|
|
3793
3799
|
const p = s.purchaseOrderRequest[o] ? new Date(s.purchaseOrderRequest[o]).toISOString() : null, y = d[o] ? new Date(d[o]).toISOString() : null;
|
|
3794
3800
|
r.push({
|
|
3795
|
-
type:
|
|
3801
|
+
type: Z.PURCHASE_ORDER_REQUEST_UPDATED,
|
|
3796
3802
|
message: q("Transfer Order", (t = s.purchaseOrder.netSuite) == null ? void 0 : t.id, o, y, p),
|
|
3797
3803
|
data: {
|
|
3798
3804
|
field: o,
|
|
@@ -3805,7 +3811,7 @@ function zn(s, u, d, c = !1) {
|
|
|
3805
3811
|
}
|
|
3806
3812
|
return r;
|
|
3807
3813
|
}
|
|
3808
|
-
g(
|
|
3814
|
+
g(Gn, "detectTransferOrderConflicts");
|
|
3809
3815
|
function Yn(s, u, d, c, r) {
|
|
3810
3816
|
if (s.length === 0)
|
|
3811
3817
|
throw new Error("No order lines found");
|
|
@@ -3818,7 +3824,7 @@ function Yn(s, u, d, c, r) {
|
|
|
3818
3824
|
};
|
|
3819
3825
|
if (n) {
|
|
3820
3826
|
for (const o of u)
|
|
3821
|
-
if (o.type ===
|
|
3827
|
+
if (o.type === Z.PURCHASE_ORDER_UPDATED) {
|
|
3822
3828
|
const m = o.data.field, l = o.data.incomingValue;
|
|
3823
3829
|
n = {
|
|
3824
3830
|
...n,
|
|
@@ -3832,18 +3838,18 @@ function Yn(s, u, d, c, r) {
|
|
|
3832
3838
|
}
|
|
3833
3839
|
for (const o of u)
|
|
3834
3840
|
switch (o.type) {
|
|
3835
|
-
case
|
|
3836
|
-
const m = new Date(
|
|
3841
|
+
case Z.PURCHASE_ORDER_CREATED:
|
|
3842
|
+
const m = new Date(ae(d.purchaseOrder._id)), l = new Date(d.purchaseOrder.effectiveAt);
|
|
3837
3843
|
n = {
|
|
3838
3844
|
...d.purchaseOrder,
|
|
3839
|
-
_id: (r == null ? void 0 : r.purchaseOrderId) || d.purchaseOrder._id ||
|
|
3840
|
-
prefix:
|
|
3845
|
+
_id: (r == null ? void 0 : r.purchaseOrderId) || d.purchaseOrder._id || L({
|
|
3846
|
+
prefix: $.Enum.purchaseOrder
|
|
3841
3847
|
}),
|
|
3842
|
-
effectiveAt:
|
|
3848
|
+
effectiveAt: ee(m, l) ? void 0 : l.toISOString(),
|
|
3843
3849
|
items: i
|
|
3844
3850
|
};
|
|
3845
3851
|
break;
|
|
3846
|
-
case
|
|
3852
|
+
case Z.PURCHASE_ORDER_REQUEST_CREATED:
|
|
3847
3853
|
t = {
|
|
3848
3854
|
...d.purchaseOrderRequest,
|
|
3849
3855
|
purchaseOrder: {
|
|
@@ -3852,7 +3858,7 @@ function Yn(s, u, d, c, r) {
|
|
|
3852
3858
|
}
|
|
3853
3859
|
};
|
|
3854
3860
|
break;
|
|
3855
|
-
case
|
|
3861
|
+
case Z.PURCHASE_ORDER_UPDATED:
|
|
3856
3862
|
if (n) {
|
|
3857
3863
|
const f = o.data.field, a = o.data.incomingValue, I = n[f];
|
|
3858
3864
|
if (f === "version" && a !== I)
|
|
@@ -3863,7 +3869,7 @@ function Yn(s, u, d, c, r) {
|
|
|
3863
3869
|
};
|
|
3864
3870
|
}
|
|
3865
3871
|
break;
|
|
3866
|
-
case
|
|
3872
|
+
case Z.PURCHASE_ORDER_REQUEST_UPDATED:
|
|
3867
3873
|
if (t) {
|
|
3868
3874
|
const f = o.data.field, a = o.data.incomingValue, I = t[f];
|
|
3869
3875
|
a !== I && (t = {
|
|
@@ -3889,32 +3895,32 @@ function Yn(s, u, d, c, r) {
|
|
|
3889
3895
|
}
|
|
3890
3896
|
g(Yn, "resolveTransferOrderConflicts");
|
|
3891
3897
|
e.object({
|
|
3892
|
-
lineItem:
|
|
3893
|
-
existinglineItem:
|
|
3898
|
+
lineItem: Ke.nullish(),
|
|
3899
|
+
existinglineItem: Ke.nullish(),
|
|
3894
3900
|
recordId: e.string()
|
|
3895
3901
|
});
|
|
3896
3902
|
e.object({
|
|
3897
3903
|
recordId: e.string(),
|
|
3898
3904
|
recordType: e.string(),
|
|
3899
3905
|
externalId: e.string(),
|
|
3900
|
-
sku:
|
|
3906
|
+
sku: Pe.optional(),
|
|
3901
3907
|
field: e.string(),
|
|
3902
3908
|
incomingValue: e.any(),
|
|
3903
3909
|
existingValue: e.any()
|
|
3904
3910
|
});
|
|
3905
|
-
var
|
|
3911
|
+
var be;
|
|
3906
3912
|
(function(s) {
|
|
3907
3913
|
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";
|
|
3908
|
-
})(
|
|
3914
|
+
})(be || (be = {}));
|
|
3909
3915
|
function Jn(s, u) {
|
|
3910
3916
|
const d = [];
|
|
3911
3917
|
if (!u)
|
|
3912
3918
|
return d.push({
|
|
3913
|
-
type:
|
|
3919
|
+
type: be.PURCHASE_ORDER_CREATED,
|
|
3914
3920
|
message: "Purchase order not found",
|
|
3915
3921
|
data: s
|
|
3916
|
-
}), d.push(...
|
|
3917
|
-
const c = Object.keys(
|
|
3922
|
+
}), d.push(...he(s.items, [], "", "2")), d;
|
|
3923
|
+
const c = Object.keys(tt.shape);
|
|
3918
3924
|
for (const r of c) {
|
|
3919
3925
|
if (![
|
|
3920
3926
|
"status",
|
|
@@ -3925,13 +3931,13 @@ function Jn(s, u) {
|
|
|
3925
3931
|
].includes(r))
|
|
3926
3932
|
continue;
|
|
3927
3933
|
if (r === "items") {
|
|
3928
|
-
d.push(...
|
|
3934
|
+
d.push(...he(s.items, u.items, u._id, u.version || "1"));
|
|
3929
3935
|
continue;
|
|
3930
3936
|
}
|
|
3931
3937
|
const t = s[r] ?? null, i = u[r] ?? null;
|
|
3932
3938
|
if (r === "effectiveAt" && t && typeof t == "string") {
|
|
3933
|
-
const o = new Date(
|
|
3934
|
-
if (
|
|
3939
|
+
const o = new Date(ae(u._id));
|
|
3940
|
+
if (ee(o, new Date(t)))
|
|
3935
3941
|
continue;
|
|
3936
3942
|
}
|
|
3937
3943
|
if (r === "effectiveAt" && t !== i) {
|
|
@@ -3939,7 +3945,7 @@ function Jn(s, u) {
|
|
|
3939
3945
|
continue;
|
|
3940
3946
|
const o = t && typeof t == "string" ? new Date(t).toISOString() : null, m = i && typeof i == "string" ? new Date(i).toISOString() : null;
|
|
3941
3947
|
d.push({
|
|
3942
|
-
type:
|
|
3948
|
+
type: be.PURCHASE_ORDER_UPDATED,
|
|
3943
3949
|
message: q("Purchase Order", s.netSuite.id, r, m, o),
|
|
3944
3950
|
data: {
|
|
3945
3951
|
field: r,
|
|
@@ -3949,7 +3955,7 @@ function Jn(s, u) {
|
|
|
3949
3955
|
});
|
|
3950
3956
|
}
|
|
3951
3957
|
}
|
|
3952
|
-
return d.push(...
|
|
3958
|
+
return d.push(...Vt((u == null ? void 0 : u.deliveryOrder) ?? [], s.deliveryOrder ?? [], u ? (u == null ? void 0 : u.version) || "1" : s.version)), d;
|
|
3953
3959
|
}
|
|
3954
3960
|
g(Jn, "detectPurchaseOrderConflicts");
|
|
3955
3961
|
function Wn(s, u, d, c) {
|
|
@@ -3959,7 +3965,7 @@ function Wn(s, u, d, c) {
|
|
|
3959
3965
|
throw new Error("No order lines found");
|
|
3960
3966
|
if (r) {
|
|
3961
3967
|
for (const t of u)
|
|
3962
|
-
if (t.type ===
|
|
3968
|
+
if (t.type === be.PURCHASE_ORDER_UPDATED) {
|
|
3963
3969
|
const i = t.data.field, o = t.data.incomingValue, m = r[i];
|
|
3964
3970
|
o !== m && (r = {
|
|
3965
3971
|
...r,
|
|
@@ -3979,18 +3985,18 @@ function Wn(s, u, d, c) {
|
|
|
3979
3985
|
}
|
|
3980
3986
|
for (const t of u)
|
|
3981
3987
|
switch (t.type) {
|
|
3982
|
-
case
|
|
3983
|
-
const i = new Date(
|
|
3988
|
+
case be.PURCHASE_ORDER_CREATED:
|
|
3989
|
+
const i = new Date(ae(d._id)), o = new Date(d.effectiveAt);
|
|
3984
3990
|
r = {
|
|
3985
3991
|
...d,
|
|
3986
|
-
_id: d._id ||
|
|
3987
|
-
prefix:
|
|
3992
|
+
_id: d._id || L({
|
|
3993
|
+
prefix: $.Enum.purchaseOrder
|
|
3988
3994
|
}),
|
|
3989
|
-
effectiveAt:
|
|
3995
|
+
effectiveAt: ee(i, o) ? void 0 : o.toISOString(),
|
|
3990
3996
|
items: n
|
|
3991
3997
|
};
|
|
3992
3998
|
break;
|
|
3993
|
-
case
|
|
3999
|
+
case be.PURCHASE_ORDER_UPDATED:
|
|
3994
4000
|
if (r) {
|
|
3995
4001
|
const m = t.data.field, l = t.data.incomingValue;
|
|
3996
4002
|
r = {
|
|
@@ -4007,22 +4013,22 @@ function Wn(s, u, d, c) {
|
|
|
4007
4013
|
}, r;
|
|
4008
4014
|
}
|
|
4009
4015
|
g(Wn, "resolvePurchaseOrderConflicts");
|
|
4010
|
-
var
|
|
4016
|
+
var ke;
|
|
4011
4017
|
(function(s) {
|
|
4012
4018
|
s.UNIT_CREATED = "UNIT_CREATED", s.UNIT_UPDATED = "UNIT_UPDATED", s.UNIT_DELETED = "UNIT_DELETED";
|
|
4013
|
-
})(
|
|
4014
|
-
var
|
|
4019
|
+
})(ke || (ke = {}));
|
|
4020
|
+
var Ie;
|
|
4015
4021
|
(function(s) {
|
|
4016
4022
|
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";
|
|
4017
|
-
})(
|
|
4023
|
+
})(Ie || (Ie = {}));
|
|
4018
4024
|
var Qn = 'Record [$] unif of measure on line [$], field "$" changed from "$" to "$"';
|
|
4019
|
-
function
|
|
4020
|
-
const d = Object.keys(
|
|
4025
|
+
function qt(s, u) {
|
|
4026
|
+
const d = Object.keys(Mt.shape), c = [];
|
|
4021
4027
|
for (const r of u) {
|
|
4022
4028
|
const n = s.measurements.find((t) => t.nsConfig.netSuiteId === r.nsConfig.netSuiteId);
|
|
4023
4029
|
if (!n)
|
|
4024
4030
|
c.push({
|
|
4025
|
-
type:
|
|
4031
|
+
type: Ie.UNIT_OF_MEASUREMENT_CREATED,
|
|
4026
4032
|
message: `NetSuite Measurement ${r.nsConfig.netSuiteId} does not exist in existing unit ${s.name} ${s.nsConfig.netSuiteId})`,
|
|
4027
4033
|
data: r
|
|
4028
4034
|
});
|
|
@@ -4034,8 +4040,8 @@ function Bt(s, u) {
|
|
|
4034
4040
|
if (!P.isEqual(i, o)) {
|
|
4035
4041
|
let m = o, l = i;
|
|
4036
4042
|
typeof i == "object" && (m = JSON.stringify(o), l = JSON.stringify(i)), c.push({
|
|
4037
|
-
type:
|
|
4038
|
-
message:
|
|
4043
|
+
type: Ie.UNIT_OF_MEASUREMENT_UPDATED,
|
|
4044
|
+
message: oe(Qn, [
|
|
4039
4045
|
"Unit Of Measure",
|
|
4040
4046
|
`${r.nsConfig.netSuiteId}`,
|
|
4041
4047
|
t,
|
|
@@ -4054,35 +4060,35 @@ function Bt(s, u) {
|
|
|
4054
4060
|
}
|
|
4055
4061
|
for (const r of s.measurements)
|
|
4056
4062
|
u.find((t) => t.nsConfig.netSuiteId === r.nsConfig.netSuiteId) || c.push({
|
|
4057
|
-
type:
|
|
4063
|
+
type: Ie.UNIT_OF_MEASUREMENT_DELETED,
|
|
4058
4064
|
message: `Unit Of Measure [${r.nsConfig.netSuiteId}] doesn't exist in incoming units`,
|
|
4059
4065
|
data: r
|
|
4060
4066
|
});
|
|
4061
4067
|
return c;
|
|
4062
4068
|
}
|
|
4063
|
-
g(
|
|
4069
|
+
g(qt, "detectUnitOfMeasureConflicts");
|
|
4064
4070
|
function Zn(s, u) {
|
|
4065
4071
|
const d = [];
|
|
4066
4072
|
if (!u)
|
|
4067
4073
|
d.push({
|
|
4068
|
-
type:
|
|
4074
|
+
type: ke.UNIT_CREATED,
|
|
4069
4075
|
message: `Unit type [${s.nsConfig.netSuiteId}] config doesn't exist`,
|
|
4070
4076
|
data: s
|
|
4071
4077
|
});
|
|
4072
4078
|
else {
|
|
4073
|
-
const c = Object.keys(
|
|
4079
|
+
const c = Object.keys(Ut.shape);
|
|
4074
4080
|
for (const r of c) {
|
|
4075
4081
|
if (r === "nsConfig" || r === "_id")
|
|
4076
4082
|
continue;
|
|
4077
4083
|
if (r === "measurements") {
|
|
4078
|
-
d.push(...
|
|
4084
|
+
d.push(...qt(u, s.measurements));
|
|
4079
4085
|
continue;
|
|
4080
4086
|
}
|
|
4081
4087
|
const n = s[r] ?? null, t = u[r] ?? null;
|
|
4082
4088
|
if (!P.isEqual(n, t)) {
|
|
4083
4089
|
let i = t, o = n;
|
|
4084
4090
|
d.push({
|
|
4085
|
-
type:
|
|
4091
|
+
type: ke.UNIT_UPDATED,
|
|
4086
4092
|
message: q("Unit Type", s.nsConfig.netSuiteId, r, i, o),
|
|
4087
4093
|
data: {
|
|
4088
4094
|
field: r,
|
|
@@ -4096,34 +4102,34 @@ function Zn(s, u) {
|
|
|
4096
4102
|
return d;
|
|
4097
4103
|
}
|
|
4098
4104
|
g(Zn, "detectUnitTypeConflicts");
|
|
4099
|
-
function
|
|
4105
|
+
function Ht(s, u) {
|
|
4100
4106
|
if (u.length === 0)
|
|
4101
4107
|
return s;
|
|
4102
4108
|
const d = [
|
|
4103
4109
|
...s
|
|
4104
4110
|
];
|
|
4105
4111
|
for (const c of u) {
|
|
4106
|
-
if (c.type ===
|
|
4112
|
+
if (c.type === Ie.UNIT_OF_MEASUREMENT_CREATED && d.push(c.data), c.type === Ie.UNIT_OF_MEASUREMENT_UPDATED) {
|
|
4107
4113
|
const r = d.findIndex((n) => n.nsConfig.netSuiteId === c.data.config.netSuiteId);
|
|
4108
4114
|
r !== -1 && (d[r][c.data.field] = c.data.incomingValue);
|
|
4109
4115
|
}
|
|
4110
|
-
if (c.type ===
|
|
4116
|
+
if (c.type === Ie.UNIT_OF_MEASUREMENT_DELETED) {
|
|
4111
4117
|
const r = d.findIndex((n) => n.nsConfig.netSuiteId === c.data.nsConfig.netSuiteId);
|
|
4112
4118
|
r !== -1 && d.splice(r, 1);
|
|
4113
4119
|
}
|
|
4114
4120
|
}
|
|
4115
4121
|
return d;
|
|
4116
4122
|
}
|
|
4117
|
-
g(
|
|
4123
|
+
g(Ht, "resolveUnitOfMeasurementConflicts");
|
|
4118
4124
|
function Xn(s, u, d) {
|
|
4119
4125
|
let c = d;
|
|
4120
|
-
const r =
|
|
4126
|
+
const r = Ht((d == null ? void 0 : d.measurements) || u.measurements, s);
|
|
4121
4127
|
for (const n of s)
|
|
4122
4128
|
switch (n.type) {
|
|
4123
|
-
case
|
|
4129
|
+
case ke.UNIT_CREATED:
|
|
4124
4130
|
c = u;
|
|
4125
4131
|
break;
|
|
4126
|
-
case
|
|
4132
|
+
case ke.UNIT_UPDATED:
|
|
4127
4133
|
const t = n.data.field, i = n.data.incomingValue;
|
|
4128
4134
|
c = {
|
|
4129
4135
|
...c,
|
|
@@ -4144,26 +4150,26 @@ function Xn(s, u, d) {
|
|
|
4144
4150
|
};
|
|
4145
4151
|
}
|
|
4146
4152
|
g(Xn, "resolveUnitTypeConflicts");
|
|
4147
|
-
var
|
|
4153
|
+
var Se;
|
|
4148
4154
|
(function(s) {
|
|
4149
4155
|
s.PURCHASE_ORDER_CREATED = "PURCHASE_ORDER_CREATED", s.PURCHASE_ORDER_UPDATED = "PURCHASE_ORDER_UPDATED";
|
|
4150
|
-
})(
|
|
4156
|
+
})(Se || (Se = {}));
|
|
4151
4157
|
function ei(s, u) {
|
|
4152
4158
|
var c;
|
|
4153
4159
|
const d = [];
|
|
4154
4160
|
if (u || d.push({
|
|
4155
|
-
type:
|
|
4161
|
+
type: Se.PURCHASE_ORDER_CREATED,
|
|
4156
4162
|
message: "Purchase order not found",
|
|
4157
4163
|
data: s
|
|
4158
4164
|
}), !u)
|
|
4159
|
-
return d.push(...
|
|
4165
|
+
return d.push(...he(s.items, [], "", "2")), d;
|
|
4160
4166
|
if (u) {
|
|
4161
|
-
const r = Object.keys(
|
|
4167
|
+
const r = Object.keys(tt.shape);
|
|
4162
4168
|
for (const n of r) {
|
|
4163
4169
|
if (n === "_id" || n === "_rev" || n === "templateDoc" || n === "template" || n === "deliveryFullfillment" || n === "deliveryOrder" || n === "supplier" || n === "seqNumber" || n === "version")
|
|
4164
4170
|
continue;
|
|
4165
4171
|
if (n === "items") {
|
|
4166
|
-
d.push(...
|
|
4172
|
+
d.push(...he(s.items, u.items, u._id, u.version || "2"));
|
|
4167
4173
|
continue;
|
|
4168
4174
|
}
|
|
4169
4175
|
let t = s[n] ?? null;
|
|
@@ -4174,8 +4180,8 @@ function ei(s, u) {
|
|
|
4174
4180
|
continue;
|
|
4175
4181
|
}
|
|
4176
4182
|
if (n === "effectiveAt" && t && typeof t == "string") {
|
|
4177
|
-
const o = new Date(
|
|
4178
|
-
|
|
4183
|
+
const o = new Date(ae(u._id));
|
|
4184
|
+
ee(o, new Date(t)) && (t = null);
|
|
4179
4185
|
}
|
|
4180
4186
|
if (!P.isEqual(t, i)) {
|
|
4181
4187
|
let o = i, m = t;
|
|
@@ -4189,14 +4195,14 @@ function ei(s, u) {
|
|
|
4189
4195
|
}
|
|
4190
4196
|
if (n === "effectiveAt") {
|
|
4191
4197
|
if (!i) {
|
|
4192
|
-
const l = new Date(
|
|
4198
|
+
const l = new Date(ae(u._id));
|
|
4193
4199
|
if (typeof t == "string" && new Date(t).toDateString() === new Date(l).toDateString())
|
|
4194
4200
|
continue;
|
|
4195
4201
|
}
|
|
4196
4202
|
o = i && typeof i == "string" ? new Date(i).toISOString() : null, m = t && typeof t == "string" ? new Date(t).toISOString() : null;
|
|
4197
4203
|
}
|
|
4198
4204
|
d.push({
|
|
4199
|
-
type:
|
|
4205
|
+
type: Se.PURCHASE_ORDER_UPDATED,
|
|
4200
4206
|
message: q("Inventory Transfer", (c = s.netSuite) == null ? void 0 : c.id, n, o, m),
|
|
4201
4207
|
data: {
|
|
4202
4208
|
field: n,
|
|
@@ -4219,7 +4225,7 @@ function ti(s, u, d, c) {
|
|
|
4219
4225
|
return c;
|
|
4220
4226
|
if (r) {
|
|
4221
4227
|
for (const t of u)
|
|
4222
|
-
if (t.type ===
|
|
4228
|
+
if (t.type === Se.PURCHASE_ORDER_UPDATED) {
|
|
4223
4229
|
const i = t.data.field, o = t.data.incomingValue;
|
|
4224
4230
|
r = {
|
|
4225
4231
|
...r,
|
|
@@ -4233,18 +4239,18 @@ function ti(s, u, d, c) {
|
|
|
4233
4239
|
}
|
|
4234
4240
|
for (const t of u)
|
|
4235
4241
|
switch (t.type) {
|
|
4236
|
-
case
|
|
4237
|
-
const i = new Date(
|
|
4242
|
+
case Se.PURCHASE_ORDER_CREATED:
|
|
4243
|
+
const i = new Date(ae(d._id)), o = new Date(d.effectiveAt);
|
|
4238
4244
|
r = {
|
|
4239
4245
|
...d,
|
|
4240
|
-
_id: d._id ||
|
|
4241
|
-
prefix:
|
|
4246
|
+
_id: d._id || L({
|
|
4247
|
+
prefix: $.Enum.purchaseOrder
|
|
4242
4248
|
}),
|
|
4243
|
-
effectiveAt:
|
|
4249
|
+
effectiveAt: ee(i, o) ? void 0 : o.toISOString(),
|
|
4244
4250
|
items: n
|
|
4245
4251
|
};
|
|
4246
4252
|
break;
|
|
4247
|
-
case
|
|
4253
|
+
case Se.PURCHASE_ORDER_UPDATED:
|
|
4248
4254
|
if (r) {
|
|
4249
4255
|
const m = t.data.field, l = t.data.incomingValue, f = r[m];
|
|
4250
4256
|
if (m === "version" && l !== f)
|
|
@@ -4262,11 +4268,11 @@ function ti(s, u, d, c) {
|
|
|
4262
4268
|
}, r;
|
|
4263
4269
|
}
|
|
4264
4270
|
g(ti, "resolveInventoryTransferConflicts");
|
|
4265
|
-
var
|
|
4271
|
+
var Y;
|
|
4266
4272
|
(function(s) {
|
|
4267
4273
|
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";
|
|
4268
|
-
})(
|
|
4269
|
-
var ni =
|
|
4274
|
+
})(Y || (Y = {}));
|
|
4275
|
+
var ni = Pe.pick({
|
|
4270
4276
|
code: !0,
|
|
4271
4277
|
name: !0,
|
|
4272
4278
|
defaultCost: !0,
|
|
@@ -4275,7 +4281,7 @@ var ni = Fe.pick({
|
|
|
4275
4281
|
unit: !0,
|
|
4276
4282
|
valuation: !0,
|
|
4277
4283
|
customAttributes: !0
|
|
4278
|
-
}), ii =
|
|
4284
|
+
}), ii = et.omit({
|
|
4279
4285
|
netSuiteId: !0,
|
|
4280
4286
|
businessId: !0,
|
|
4281
4287
|
skuCache: !0,
|
|
@@ -4289,11 +4295,11 @@ var ni = Fe.pick({
|
|
|
4289
4295
|
});
|
|
4290
4296
|
function si(s) {
|
|
4291
4297
|
const u = [], { incoming: d, current: c } = s;
|
|
4292
|
-
if (d.itemType !==
|
|
4298
|
+
if (d.itemType !== F.Enum.InvtPart)
|
|
4293
4299
|
throw new Error("[detectInventoryChildItemConflicts] only supports InvtPart child items");
|
|
4294
4300
|
if (!c)
|
|
4295
4301
|
return u.push({
|
|
4296
|
-
type:
|
|
4302
|
+
type: Y.INVENTORY_ITEM_CREATED,
|
|
4297
4303
|
message: `InvtPart Child Item [${d.netSuiteId}] config doesn't exist`,
|
|
4298
4304
|
data: d
|
|
4299
4305
|
}), u;
|
|
@@ -4301,7 +4307,7 @@ function si(s) {
|
|
|
4301
4307
|
for (const n of r) {
|
|
4302
4308
|
const t = d[n] ?? null, i = c[n] ?? null;
|
|
4303
4309
|
P.isEqual(t, i) || u.push({
|
|
4304
|
-
type:
|
|
4310
|
+
type: Y.INVENTORY_ITEM_UPDATED,
|
|
4305
4311
|
message: q("InvtPart Child Item", d.netSuiteId, n, i, t),
|
|
4306
4312
|
data: {
|
|
4307
4313
|
field: n,
|
|
@@ -4315,11 +4321,11 @@ function si(s) {
|
|
|
4315
4321
|
g(si, "detectInventoryChildItemConflicts");
|
|
4316
4322
|
function oi(s) {
|
|
4317
4323
|
const u = [], { incoming: d, current: c } = s;
|
|
4318
|
-
if (d.itemType !==
|
|
4324
|
+
if (d.itemType !== F.Enum.InvtPart)
|
|
4319
4325
|
throw new Error("[detectInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
4320
4326
|
if (!c)
|
|
4321
4327
|
return u.push({
|
|
4322
|
-
type:
|
|
4328
|
+
type: Y.INVENTORY_ITEM_CREATED,
|
|
4323
4329
|
message: `Inventory Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4324
4330
|
data: d
|
|
4325
4331
|
}), u;
|
|
@@ -4327,7 +4333,7 @@ function oi(s) {
|
|
|
4327
4333
|
for (const t of r) {
|
|
4328
4334
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4329
4335
|
P.isEqual(i, o) || u.push({
|
|
4330
|
-
type:
|
|
4336
|
+
type: Y.INVENTORY_ITEM_UPDATED,
|
|
4331
4337
|
message: q("Inventory Parent Item", d.netSuiteId, t, o, i),
|
|
4332
4338
|
data: {
|
|
4333
4339
|
field: t,
|
|
@@ -4340,7 +4346,7 @@ function oi(s) {
|
|
|
4340
4346
|
for (const t of n) {
|
|
4341
4347
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4342
4348
|
P.isEqual(i, o) || u.push({
|
|
4343
|
-
type:
|
|
4349
|
+
type: Y.INVENTORY_ITEM_SKU_UPDATED,
|
|
4344
4350
|
message: q("Inventory Parent Item", d.netSuiteId, t, o, i),
|
|
4345
4351
|
data: {
|
|
4346
4352
|
field: t,
|
|
@@ -4353,19 +4359,19 @@ function oi(s) {
|
|
|
4353
4359
|
}
|
|
4354
4360
|
g(oi, "detectInventoryParentItemConflicts");
|
|
4355
4361
|
function ai(s, u, d) {
|
|
4356
|
-
if (u.itemType !==
|
|
4362
|
+
if (u.itemType !== F.Enum.InvtPart)
|
|
4357
4363
|
throw new Error("[resolveInventoryParentItemConflicts] only supports InvtPart parent items");
|
|
4358
|
-
if (s.some((n) => n.type ===
|
|
4364
|
+
if (s.some((n) => n.type === Y.INVENTORY_ITEM_CREATED))
|
|
4359
4365
|
return u;
|
|
4360
4366
|
let r = d;
|
|
4361
4367
|
for (const n of s)
|
|
4362
|
-
if (n.type ===
|
|
4368
|
+
if (n.type === Y.INVENTORY_ITEM_UPDATED) {
|
|
4363
4369
|
const t = n.data.field;
|
|
4364
4370
|
r = {
|
|
4365
4371
|
...r,
|
|
4366
4372
|
[t]: n.data.incomingValue
|
|
4367
4373
|
};
|
|
4368
|
-
} else if (n.type ===
|
|
4374
|
+
} else if (n.type === Y.INVENTORY_ITEM_SKU_UPDATED) {
|
|
4369
4375
|
const t = n.data.field;
|
|
4370
4376
|
r = {
|
|
4371
4377
|
...r,
|
|
@@ -4382,13 +4388,13 @@ function ai(s, u, d) {
|
|
|
4382
4388
|
}
|
|
4383
4389
|
g(ai, "resolveInventoryParentItemConflicts");
|
|
4384
4390
|
function ui(s, u, d) {
|
|
4385
|
-
if (u.itemType !==
|
|
4391
|
+
if (u.itemType !== F.Enum.InvtPart)
|
|
4386
4392
|
throw new Error("[resolveInventoryChildItemConflicts] only supports InvtPart child items");
|
|
4387
|
-
if (s.some((n) => n.type ===
|
|
4393
|
+
if (s.some((n) => n.type === Y.INVENTORY_ITEM_CREATED))
|
|
4388
4394
|
return u;
|
|
4389
4395
|
let r = d;
|
|
4390
4396
|
for (const n of s)
|
|
4391
|
-
if (n.type ===
|
|
4397
|
+
if (n.type === Y.INVENTORY_ITEM_UPDATED) {
|
|
4392
4398
|
const t = n.data.field;
|
|
4393
4399
|
r = {
|
|
4394
4400
|
...r,
|
|
@@ -4398,11 +4404,11 @@ function ui(s, u, d) {
|
|
|
4398
4404
|
return r;
|
|
4399
4405
|
}
|
|
4400
4406
|
g(ui, "resolveInventoryChildItemConflicts");
|
|
4401
|
-
var
|
|
4407
|
+
var J;
|
|
4402
4408
|
(function(s) {
|
|
4403
4409
|
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";
|
|
4404
|
-
})(
|
|
4405
|
-
var di =
|
|
4410
|
+
})(J || (J = {}));
|
|
4411
|
+
var di = Pe.pick({
|
|
4406
4412
|
code: !0,
|
|
4407
4413
|
name: !0,
|
|
4408
4414
|
defaultCost: !0,
|
|
@@ -4411,7 +4417,7 @@ var di = Fe.pick({
|
|
|
4411
4417
|
unit: !0,
|
|
4412
4418
|
valuation: !0,
|
|
4413
4419
|
customAttributes: !0
|
|
4414
|
-
}), ci =
|
|
4420
|
+
}), ci = et.omit({
|
|
4415
4421
|
netSuiteId: !0,
|
|
4416
4422
|
businessId: !0,
|
|
4417
4423
|
skuCache: !0,
|
|
@@ -4425,11 +4431,11 @@ var di = Fe.pick({
|
|
|
4425
4431
|
});
|
|
4426
4432
|
function mi(s) {
|
|
4427
4433
|
const u = [], { incoming: d, current: c } = s;
|
|
4428
|
-
if (d.itemType !==
|
|
4434
|
+
if (d.itemType !== F.Enum.Assembly)
|
|
4429
4435
|
throw new Error("[detectAssemblyChildItemConflicts] only supports Assembly child items");
|
|
4430
4436
|
if (!c)
|
|
4431
4437
|
return u.push({
|
|
4432
|
-
type:
|
|
4438
|
+
type: J.ASSEMBLY_ITEM_CREATED,
|
|
4433
4439
|
message: `Assembly Child Item [${d.netSuiteId}] config doesn't exist`,
|
|
4434
4440
|
data: d
|
|
4435
4441
|
}), u;
|
|
@@ -4437,7 +4443,7 @@ function mi(s) {
|
|
|
4437
4443
|
for (const n of r) {
|
|
4438
4444
|
const t = d[n] ?? null, i = c[n] ?? null;
|
|
4439
4445
|
P.isEqual(t, i) || u.push({
|
|
4440
|
-
type:
|
|
4446
|
+
type: J.ASSEMBLY_ITEM_UPDATED,
|
|
4441
4447
|
message: q("Assembly Child Item", d.netSuiteId, n, i, t),
|
|
4442
4448
|
data: {
|
|
4443
4449
|
field: n,
|
|
@@ -4451,11 +4457,11 @@ function mi(s) {
|
|
|
4451
4457
|
g(mi, "detectAssemblyChildItemConflicts");
|
|
4452
4458
|
function fi(s) {
|
|
4453
4459
|
const u = [], { incoming: d, current: c } = s;
|
|
4454
|
-
if (d.itemType !==
|
|
4460
|
+
if (d.itemType !== F.Enum.Assembly)
|
|
4455
4461
|
throw new Error("[detectAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
4456
4462
|
if (!c)
|
|
4457
4463
|
return u.push({
|
|
4458
|
-
type:
|
|
4464
|
+
type: J.ASSEMBLY_ITEM_CREATED,
|
|
4459
4465
|
message: `Assembly Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4460
4466
|
data: d
|
|
4461
4467
|
}), u;
|
|
@@ -4463,7 +4469,7 @@ function fi(s) {
|
|
|
4463
4469
|
for (const t of r) {
|
|
4464
4470
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4465
4471
|
P.isEqual(i, o) || u.push({
|
|
4466
|
-
type:
|
|
4472
|
+
type: J.ASSEMBLY_ITEM_UPDATED,
|
|
4467
4473
|
message: q("Assembly Parent Item", d.netSuiteId, t, o, i),
|
|
4468
4474
|
data: {
|
|
4469
4475
|
field: t,
|
|
@@ -4476,7 +4482,7 @@ function fi(s) {
|
|
|
4476
4482
|
for (const t of n) {
|
|
4477
4483
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4478
4484
|
P.isEqual(i, o) || u.push({
|
|
4479
|
-
type:
|
|
4485
|
+
type: J.ASSEMBLY_ITEM_SKU_UPDATED,
|
|
4480
4486
|
message: q("Assembly Parent Item", d.netSuiteId, t, o, i),
|
|
4481
4487
|
data: {
|
|
4482
4488
|
field: t,
|
|
@@ -4489,19 +4495,19 @@ function fi(s) {
|
|
|
4489
4495
|
}
|
|
4490
4496
|
g(fi, "detectAssemblyParentItemConflicts");
|
|
4491
4497
|
function Ii(s, u, d) {
|
|
4492
|
-
if (u.itemType !==
|
|
4498
|
+
if (u.itemType !== F.Enum.Assembly)
|
|
4493
4499
|
throw new Error("[resolveAssemblyParentItemConflicts] only supports Assembly parent items");
|
|
4494
|
-
if (s.some((n) => n.type ===
|
|
4500
|
+
if (s.some((n) => n.type === J.ASSEMBLY_ITEM_CREATED))
|
|
4495
4501
|
return u;
|
|
4496
4502
|
let r = d;
|
|
4497
4503
|
for (const n of s)
|
|
4498
|
-
if (n.type ===
|
|
4504
|
+
if (n.type === J.ASSEMBLY_ITEM_UPDATED) {
|
|
4499
4505
|
const t = n.data.field;
|
|
4500
4506
|
r = {
|
|
4501
4507
|
...r,
|
|
4502
4508
|
[t]: n.data.incomingValue
|
|
4503
4509
|
};
|
|
4504
|
-
} else if (n.type ===
|
|
4510
|
+
} else if (n.type === J.ASSEMBLY_ITEM_SKU_UPDATED) {
|
|
4505
4511
|
const t = n.data.field;
|
|
4506
4512
|
r = {
|
|
4507
4513
|
...r,
|
|
@@ -4518,13 +4524,13 @@ function Ii(s, u, d) {
|
|
|
4518
4524
|
}
|
|
4519
4525
|
g(Ii, "resolveAssemblyParentItemConflicts");
|
|
4520
4526
|
function pi(s, u, d) {
|
|
4521
|
-
if (u.itemType !==
|
|
4527
|
+
if (u.itemType !== F.Enum.Assembly)
|
|
4522
4528
|
throw new Error("[resolveAssemblyChildItemConflicts] only supports Assembly child items");
|
|
4523
|
-
if (s.some((n) => n.type ===
|
|
4529
|
+
if (s.some((n) => n.type === J.ASSEMBLY_ITEM_CREATED))
|
|
4524
4530
|
return u;
|
|
4525
4531
|
let r = d;
|
|
4526
4532
|
for (const n of s)
|
|
4527
|
-
if (n.type ===
|
|
4533
|
+
if (n.type === J.ASSEMBLY_ITEM_UPDATED) {
|
|
4528
4534
|
const t = n.data.field;
|
|
4529
4535
|
r = {
|
|
4530
4536
|
...r,
|
|
@@ -4534,11 +4540,11 @@ function pi(s, u, d) {
|
|
|
4534
4540
|
return r;
|
|
4535
4541
|
}
|
|
4536
4542
|
g(pi, "resolveAssemblyChildItemConflicts");
|
|
4537
|
-
var
|
|
4543
|
+
var pe;
|
|
4538
4544
|
(function(s) {
|
|
4539
4545
|
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";
|
|
4540
|
-
})(
|
|
4541
|
-
var yi =
|
|
4546
|
+
})(pe || (pe = {}));
|
|
4547
|
+
var yi = Pe.pick({
|
|
4542
4548
|
code: !0,
|
|
4543
4549
|
name: !0,
|
|
4544
4550
|
defaultCost: !0,
|
|
@@ -4547,7 +4553,7 @@ var yi = Fe.pick({
|
|
|
4547
4553
|
unit: !0,
|
|
4548
4554
|
valuation: !0,
|
|
4549
4555
|
customAttributes: !0
|
|
4550
|
-
}), gi =
|
|
4556
|
+
}), gi = et.omit({
|
|
4551
4557
|
netSuiteId: !0,
|
|
4552
4558
|
businessId: !0,
|
|
4553
4559
|
skuCache: !0,
|
|
@@ -4556,11 +4562,11 @@ var yi = Fe.pick({
|
|
|
4556
4562
|
});
|
|
4557
4563
|
function Ei(s) {
|
|
4558
4564
|
const u = [], { incoming: d, current: c } = s;
|
|
4559
|
-
if (d.itemType !==
|
|
4565
|
+
if (d.itemType !== F.Enum.Service)
|
|
4560
4566
|
throw new Error("[detectServiceParentItemConflicts] only supports Service parent items");
|
|
4561
4567
|
if (!c)
|
|
4562
4568
|
return u.push({
|
|
4563
|
-
type:
|
|
4569
|
+
type: pe.SERVICE_ITEM_CREATED,
|
|
4564
4570
|
message: `Service Parent Item [${d.netSuiteId}] config doesn't exist`,
|
|
4565
4571
|
data: d
|
|
4566
4572
|
}), u;
|
|
@@ -4568,7 +4574,7 @@ function Ei(s) {
|
|
|
4568
4574
|
for (const t of r) {
|
|
4569
4575
|
const i = d[t] ?? null, o = c[t] ?? null;
|
|
4570
4576
|
P.isEqual(i, o) || u.push({
|
|
4571
|
-
type:
|
|
4577
|
+
type: pe.SERVICE_ITEM_UPDATED,
|
|
4572
4578
|
message: q("Service Parent Item", d.netSuiteId, t, o, i),
|
|
4573
4579
|
data: {
|
|
4574
4580
|
field: t,
|
|
@@ -4581,7 +4587,7 @@ function Ei(s) {
|
|
|
4581
4587
|
for (const t of n) {
|
|
4582
4588
|
const i = d.skuCache[t] ?? null, o = c.skuCache[t] ?? null;
|
|
4583
4589
|
P.isEqual(i, o) || u.push({
|
|
4584
|
-
type:
|
|
4590
|
+
type: pe.SERVICE_ITEM_SKU_UPDATED,
|
|
4585
4591
|
message: q("Service Parent Item", d.netSuiteId, t, o, i),
|
|
4586
4592
|
data: {
|
|
4587
4593
|
field: t,
|
|
@@ -4595,13 +4601,13 @@ function Ei(s) {
|
|
|
4595
4601
|
g(Ei, "detectServiceParentItemConflicts");
|
|
4596
4602
|
function _i(s, u, d) {
|
|
4597
4603
|
var n, t;
|
|
4598
|
-
if (u.itemType !==
|
|
4604
|
+
if (u.itemType !== F.Enum.Service)
|
|
4599
4605
|
throw new Error("[resolveServiceParentItemConflicts] only supports Service parent items");
|
|
4600
|
-
if (s.some((i) => i.type ===
|
|
4606
|
+
if (s.some((i) => i.type === pe.SERVICE_ITEM_CREATED))
|
|
4601
4607
|
return u;
|
|
4602
4608
|
let r = d;
|
|
4603
4609
|
for (const i of s)
|
|
4604
|
-
if (i.type ===
|
|
4610
|
+
if (i.type === pe.SERVICE_ITEM_UPDATED) {
|
|
4605
4611
|
const o = i.data.field;
|
|
4606
4612
|
o === "customFields" ? r = {
|
|
4607
4613
|
...r,
|
|
@@ -4614,7 +4620,7 @@ function _i(s, u, d) {
|
|
|
4614
4620
|
...r,
|
|
4615
4621
|
[o]: i.data.incomingValue
|
|
4616
4622
|
};
|
|
4617
|
-
} else if (i.type ===
|
|
4623
|
+
} else if (i.type === pe.SERVICE_ITEM_SKU_UPDATED) {
|
|
4618
4624
|
const o = i.data.field;
|
|
4619
4625
|
r = {
|
|
4620
4626
|
...r,
|
|
@@ -4633,15 +4639,15 @@ g(_i, "resolveServiceParentItemConflicts");
|
|
|
4633
4639
|
function bi(s, u, d, c, r) {
|
|
4634
4640
|
const n = {}, t = {};
|
|
4635
4641
|
for (const o of u) {
|
|
4636
|
-
const m =
|
|
4642
|
+
const m = _e(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4637
4643
|
n[o.id] = m;
|
|
4638
4644
|
}
|
|
4639
4645
|
for (const o of d) {
|
|
4640
|
-
const m =
|
|
4646
|
+
const m = _e(r.sku ?? [], r.unit ?? [], c, o.item.items);
|
|
4641
4647
|
t[o.id] = m;
|
|
4642
4648
|
}
|
|
4643
4649
|
return {
|
|
4644
|
-
orderItemMapping:
|
|
4650
|
+
orderItemMapping: _e(r.sku ?? [], r.unit ?? [], c, s.item.items),
|
|
4645
4651
|
orderItemMappingByFulfillment: n,
|
|
4646
4652
|
orderItemMappingByReceipt: t
|
|
4647
4653
|
};
|
|
@@ -4650,24 +4656,24 @@ g(bi, "prepareTransferOrderTransformContext");
|
|
|
4650
4656
|
function Si(s, u, d, c) {
|
|
4651
4657
|
const r = {};
|
|
4652
4658
|
for (const t of u) {
|
|
4653
|
-
const i =
|
|
4659
|
+
const i = _e(c.sku ?? [], c.unit ?? [], d, t.item.items);
|
|
4654
4660
|
r[t.id] = i;
|
|
4655
4661
|
}
|
|
4656
4662
|
return {
|
|
4657
|
-
orderItemMapping:
|
|
4663
|
+
orderItemMapping: _e(c.sku ?? [], c.unit ?? [], d, s.item.items),
|
|
4658
4664
|
orderItemMappingByReceipt: r
|
|
4659
4665
|
};
|
|
4660
4666
|
}
|
|
4661
4667
|
g(Si, "preparePurchaseOrderTransformContext");
|
|
4662
|
-
function
|
|
4668
|
+
function hi(s, u, d) {
|
|
4663
4669
|
return {
|
|
4664
|
-
orderItemMapping:
|
|
4670
|
+
orderItemMapping: _e(d.sku ?? [], d.unit ?? [], u, s.inventory.items)
|
|
4665
4671
|
};
|
|
4666
4672
|
}
|
|
4667
|
-
g(
|
|
4668
|
-
function
|
|
4673
|
+
g(hi, "prepareInventoryTransferTransformContext");
|
|
4674
|
+
function vi(s, u) {
|
|
4669
4675
|
const d = s;
|
|
4670
|
-
d.version =
|
|
4676
|
+
d.version = X.Enum[1];
|
|
4671
4677
|
const c = /* @__PURE__ */ new Set(), r = [], n = [];
|
|
4672
4678
|
for (const t of d.items) {
|
|
4673
4679
|
c.has(t.sku._id) && n.push(`"${t.sku.name}" (${t.sku._id})`), c.add(t.sku._id);
|
|
@@ -4706,18 +4712,18 @@ function hi(s, u) {
|
|
|
4706
4712
|
} : void 0
|
|
4707
4713
|
};
|
|
4708
4714
|
}
|
|
4709
|
-
g(
|
|
4715
|
+
g(vi, "transformPurchaseOrderToV1");
|
|
4710
4716
|
function Ti(s, u) {
|
|
4711
|
-
const d = new Date(
|
|
4712
|
-
if (
|
|
4717
|
+
const d = new Date(ae(s._id));
|
|
4718
|
+
if (ee(d, u)) return !0;
|
|
4713
4719
|
const c = s.deliveryFullfillment || [], r = s.deliveryOrder || [];
|
|
4714
4720
|
for (const n of c) {
|
|
4715
4721
|
const t = new Date(n.createdAt);
|
|
4716
|
-
if (
|
|
4722
|
+
if (ee(t, u)) return !0;
|
|
4717
4723
|
}
|
|
4718
4724
|
for (const n of r) {
|
|
4719
4725
|
const t = new Date(n.createdAt);
|
|
4720
|
-
if (
|
|
4726
|
+
if (ee(t, u)) return !0;
|
|
4721
4727
|
}
|
|
4722
4728
|
return !1;
|
|
4723
4729
|
}
|
|
@@ -4740,7 +4746,7 @@ function Di(s) {
|
|
|
4740
4746
|
};
|
|
4741
4747
|
}
|
|
4742
4748
|
g(Di, "transformParentToFdoNetSuiteItem");
|
|
4743
|
-
function
|
|
4749
|
+
function Ni(s) {
|
|
4744
4750
|
var u, d;
|
|
4745
4751
|
return {
|
|
4746
4752
|
name: s.name,
|
|
@@ -4757,11 +4763,11 @@ function Ci(s) {
|
|
|
4757
4763
|
cogsAccount: s.cogsAccount
|
|
4758
4764
|
};
|
|
4759
4765
|
}
|
|
4760
|
-
g(
|
|
4761
|
-
const de =
|
|
4762
|
-
const d =
|
|
4766
|
+
g(Ni, "transformChildToFdoNetSuiteItem");
|
|
4767
|
+
const de = tn((s, u) => {
|
|
4768
|
+
const d = Ce(), c = sn();
|
|
4763
4769
|
return u.onError(async (r) => {
|
|
4764
|
-
if (r instanceof
|
|
4770
|
+
if (r instanceof nn)
|
|
4765
4771
|
throw c == null || c.open({
|
|
4766
4772
|
title: r.title,
|
|
4767
4773
|
message: r.message,
|
|
@@ -4887,22 +4893,22 @@ const de = en((s, u) => {
|
|
|
4887
4893
|
},
|
|
4888
4894
|
urls: s
|
|
4889
4895
|
};
|
|
4890
|
-
}),
|
|
4896
|
+
}), Ci = { class: "flex flex-col" }, Ai = { class: "text-sm" }, Mi = { class: "text-sm" }, Ui = { class: "text-sm" }, ki = { class: "flex flex-col gap-2 mt-2" }, wi = { class: "text-xs" }, Ri = { class: "text-xs flex items-center gap-1" }, Fi = { class: "text-xs" }, xi = { class: "text-xs" }, Pi = {
|
|
4891
4897
|
key: 0,
|
|
4892
4898
|
class: "text-xs"
|
|
4893
|
-
},
|
|
4899
|
+
}, Oi = {
|
|
4894
4900
|
key: 0,
|
|
4895
4901
|
class: "text-sm text-gray-400"
|
|
4896
4902
|
}, Li = {
|
|
4897
4903
|
key: 0,
|
|
4898
4904
|
class: "mt-2 flex flex-col"
|
|
4899
|
-
}, $i = { class: "text-xs text-gray-400" }, ji = { class: "text-xs text-gray-400" }, Vi = { class: "text-xs text-gray-400" }, Bi = { class: "text-xs text-gray-400" }, qi = {
|
|
4905
|
+
}, $i = { class: "text-xs text-gray-400" }, ji = { class: "text-xs text-gray-400 flex items-center gap-1" }, Vi = { class: "text-xs text-gray-400" }, Bi = { class: "text-xs text-gray-400" }, qi = {
|
|
4900
4906
|
key: 0,
|
|
4901
4907
|
class: "text-xs text-gray-400"
|
|
4902
4908
|
}, Hi = {
|
|
4903
4909
|
class: "flex flex-col w-full gap-2",
|
|
4904
4910
|
style: { "margin-left": "15px" }
|
|
4905
|
-
}, Ki = { class: "flex flex-col gap-3" },
|
|
4911
|
+
}, Ki = { class: "flex flex-col gap-3" }, zi = /* @__PURE__ */ on({
|
|
4906
4912
|
__name: "NetSuiteCustomCodeSelection",
|
|
4907
4913
|
props: {
|
|
4908
4914
|
readonly: { type: Boolean },
|
|
@@ -4911,28 +4917,29 @@ const de = en((s, u) => {
|
|
|
4911
4917
|
},
|
|
4912
4918
|
emits: ["update:modelValue"],
|
|
4913
4919
|
setup(s, { emit: u }) {
|
|
4914
|
-
const d = s, c = u, r = Ge(!1), n =
|
|
4920
|
+
const d = s, c = u, r = Ge(!1), n = Ee(() => d.sku._id ? i.customFieldOptions[d.sku._id] ?? [] : []), t = Ge({
|
|
4915
4921
|
code: "",
|
|
4916
4922
|
name: "",
|
|
4917
4923
|
childName: ""
|
|
4918
|
-
}), i = Yi(), o =
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4924
|
+
}), i = Yi(), o = Ce();
|
|
4925
|
+
function m(f) {
|
|
4926
|
+
var p, y;
|
|
4927
|
+
const a = `business_${((p = o.currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, I = Fe[a];
|
|
4928
|
+
return f === "-" ? (I == null ? void 0 : I.code) ?? "externalId" : ((y = I == null ? void 0 : I.child) == null ? void 0 : y.code) ?? (I == null ? void 0 : I.code) ?? "externalId";
|
|
4929
|
+
}
|
|
4923
4930
|
function l(f) {
|
|
4924
4931
|
return `Overwrite with "${f ?? "N/A"}"`;
|
|
4925
4932
|
}
|
|
4926
4933
|
return (f, a) => {
|
|
4927
|
-
const I =
|
|
4928
|
-
return
|
|
4934
|
+
const I = De("FmButton"), p = De("FmLabel"), y = De("FmIcon"), _ = De("FmTooltip"), b = De("FmSelect"), S = De("FmDialog");
|
|
4935
|
+
return G(), He(S, {
|
|
4929
4936
|
modelValue: r.value,
|
|
4930
|
-
"onUpdate:modelValue": a[4] || (a[4] = (
|
|
4937
|
+
"onUpdate:modelValue": a[4] || (a[4] = (E) => r.value = E),
|
|
4931
4938
|
overlay: !0,
|
|
4932
4939
|
dismissAway: !0
|
|
4933
4940
|
}, {
|
|
4934
|
-
"dialog-button":
|
|
4935
|
-
|
|
4941
|
+
"dialog-button": H(() => [
|
|
4942
|
+
Q(I, {
|
|
4936
4943
|
class: "delete-button",
|
|
4937
4944
|
label: "NetSuite",
|
|
4938
4945
|
type: "button",
|
|
@@ -4944,121 +4951,159 @@ const de = en((s, u) => {
|
|
|
4944
4951
|
})
|
|
4945
4952
|
})
|
|
4946
4953
|
]),
|
|
4947
|
-
"dialog-header":
|
|
4954
|
+
"dialog-header": H(() => a[5] || (a[5] = [
|
|
4948
4955
|
w("div", null, "NetSuite Custom Info", -1)
|
|
4949
4956
|
])),
|
|
4950
|
-
"dialog-footer":
|
|
4957
|
+
"dialog-footer": H(() => [
|
|
4951
4958
|
w("div", Hi, [
|
|
4952
|
-
f.readonly ?
|
|
4959
|
+
f.readonly ? ge("", !0) : (G(), ue($e, { key: 0 }, [
|
|
4953
4960
|
a[17] || (a[17] = w("span", { class: "text-sm mb-2 font-bold" }, " This will overwrite the code and uom only.", -1)),
|
|
4954
4961
|
w("div", Ki, [
|
|
4955
|
-
|
|
4962
|
+
Q(I, {
|
|
4956
4963
|
class: "sm:w-full xs:w-full",
|
|
4957
4964
|
label: l(t.value.code),
|
|
4958
4965
|
size: "md",
|
|
4959
4966
|
variant: "destructive",
|
|
4960
4967
|
onClick: a[2] || (a[2] = () => {
|
|
4961
4968
|
r.value = !1;
|
|
4962
|
-
const
|
|
4963
|
-
(
|
|
4969
|
+
const E = d.sku.unit.measurements.find(
|
|
4970
|
+
(v) => v.id === t.value.fmMeasurementId
|
|
4964
4971
|
);
|
|
4965
|
-
c("update:modelValue", d.sku, t.value.code,
|
|
4972
|
+
c("update:modelValue", d.sku, t.value.code, E);
|
|
4966
4973
|
})
|
|
4967
4974
|
}, null, 8, ["label"])
|
|
4968
4975
|
])
|
|
4969
4976
|
], 64)),
|
|
4970
|
-
|
|
4977
|
+
Q(I, {
|
|
4971
4978
|
class: "ml-auto sm:w-full xs:w-full",
|
|
4972
4979
|
label: "Close",
|
|
4973
4980
|
size: "md",
|
|
4974
4981
|
variant: "primary",
|
|
4975
|
-
onClick: a[3] || (a[3] = (
|
|
4982
|
+
onClick: a[3] || (a[3] = (E) => r.value = !1)
|
|
4976
4983
|
})
|
|
4977
4984
|
])
|
|
4978
4985
|
]),
|
|
4979
|
-
default:
|
|
4986
|
+
default: H(() => [
|
|
4980
4987
|
w("div", null, [
|
|
4981
|
-
w("div",
|
|
4982
|
-
|
|
4983
|
-
default:
|
|
4984
|
-
|
|
4988
|
+
w("div", Ci, [
|
|
4989
|
+
Q(p, null, {
|
|
4990
|
+
default: H(() => a[6] || (a[6] = [
|
|
4991
|
+
K("Code")
|
|
4985
4992
|
])),
|
|
4986
4993
|
_: 1
|
|
4987
4994
|
}),
|
|
4988
|
-
w("span", Ai,
|
|
4989
|
-
|
|
4990
|
-
default:
|
|
4991
|
-
|
|
4995
|
+
w("span", Ai, O(f.sku.code), 1),
|
|
4996
|
+
Q(p, null, {
|
|
4997
|
+
default: H(() => a[7] || (a[7] = [
|
|
4998
|
+
K("Name")
|
|
4992
4999
|
])),
|
|
4993
5000
|
_: 1
|
|
4994
5001
|
}),
|
|
4995
|
-
w("span", Mi,
|
|
4996
|
-
|
|
4997
|
-
default:
|
|
4998
|
-
|
|
5002
|
+
w("span", Mi, O(f.sku.name), 1),
|
|
5003
|
+
Q(p, null, {
|
|
5004
|
+
default: H(() => a[8] || (a[8] = [
|
|
5005
|
+
K("Unit")
|
|
4999
5006
|
])),
|
|
5000
5007
|
_: 1
|
|
5001
5008
|
}),
|
|
5002
|
-
w("span", Ui,
|
|
5009
|
+
w("span", Ui, O(f.sku.unit.name), 1)
|
|
5003
5010
|
]),
|
|
5004
|
-
f.readonly ? (
|
|
5011
|
+
f.readonly ? (G(), ue($e, { key: 0 }, [
|
|
5005
5012
|
a[14] || (a[14] = w("hr", { class: "my-2" }, null, -1)),
|
|
5006
|
-
|
|
5007
|
-
default:
|
|
5008
|
-
|
|
5013
|
+
Q(p, null, {
|
|
5014
|
+
default: H(() => a[9] || (a[9] = [
|
|
5015
|
+
K("Custom Codes")
|
|
5009
5016
|
])),
|
|
5010
5017
|
_: 1
|
|
5011
5018
|
}),
|
|
5012
5019
|
w("div", ki, [
|
|
5013
|
-
(
|
|
5014
|
-
key:
|
|
5020
|
+
(G(!0), ue($e, null, an(n.value, (E, v) => (G(), ue("div", {
|
|
5021
|
+
key: v,
|
|
5015
5022
|
class: "rounded border-1 flex flex-col p-2"
|
|
5016
5023
|
}, [
|
|
5017
5024
|
w("span", wi, [
|
|
5018
5025
|
a[10] || (a[10] = w("b", null, "Child Name:", -1)),
|
|
5019
|
-
|
|
5026
|
+
K(" " + O(E.value.childName), 1)
|
|
5020
5027
|
]),
|
|
5021
5028
|
w("span", Ri, [
|
|
5022
|
-
w("b", null, "Custom code (" +
|
|
5023
|
-
|
|
5029
|
+
w("b", null, "Custom code (" + O(pt(It)(m(E.value.childName))) + "):", 1),
|
|
5030
|
+
K(" " + O(E.value.code) + " ", 1),
|
|
5031
|
+
E.value.externalId && E.value.childName !== "-" ? (G(), He(_, {
|
|
5032
|
+
key: 0,
|
|
5033
|
+
placement: "top",
|
|
5034
|
+
"z-index": 9999
|
|
5035
|
+
}, {
|
|
5036
|
+
content: H(() => [
|
|
5037
|
+
K("External ID: " + O(E.value.externalId), 1)
|
|
5038
|
+
]),
|
|
5039
|
+
default: H(() => [
|
|
5040
|
+
Q(y, {
|
|
5041
|
+
name: "info",
|
|
5042
|
+
size: "sm",
|
|
5043
|
+
color: "info",
|
|
5044
|
+
outline: ""
|
|
5045
|
+
})
|
|
5046
|
+
]),
|
|
5047
|
+
_: 2
|
|
5048
|
+
}, 1024)) : ge("", !0)
|
|
5024
5049
|
]),
|
|
5025
5050
|
w("span", Fi, [
|
|
5026
5051
|
a[11] || (a[11] = w("b", null, "Custom name:", -1)),
|
|
5027
|
-
|
|
5052
|
+
K(" " + O(E.value.name), 1)
|
|
5028
5053
|
]),
|
|
5029
|
-
w("span",
|
|
5054
|
+
w("span", xi, [
|
|
5030
5055
|
a[12] || (a[12] = w("b", null, "UOM:", -1)),
|
|
5031
|
-
|
|
5056
|
+
K(" " + O(E.value.fmMeasurementAbbrev ?? d.sku.unit.abbrev), 1)
|
|
5032
5057
|
]),
|
|
5033
|
-
|
|
5058
|
+
E.value.remark ? (G(), ue("span", Pi, [
|
|
5034
5059
|
a[13] || (a[13] = w("b", null, "Remark:", -1)),
|
|
5035
|
-
|
|
5036
|
-
])) :
|
|
5060
|
+
K(" " + O(E.value.remark), 1)
|
|
5061
|
+
])) : ge("", !0)
|
|
5037
5062
|
]))), 128)),
|
|
5038
|
-
n.value.length === 0 ? (
|
|
5063
|
+
n.value.length === 0 ? (G(), ue("span", Oi, "No custom code found.")) : ge("", !0)
|
|
5039
5064
|
])
|
|
5040
|
-
], 64)) : (
|
|
5065
|
+
], 64)) : (G(), ue($e, { key: 1 }, [
|
|
5041
5066
|
a[16] || (a[16] = w("hr", { class: "my-2" }, null, -1)),
|
|
5042
|
-
|
|
5043
|
-
default:
|
|
5044
|
-
|
|
5067
|
+
Q(p, null, {
|
|
5068
|
+
default: H(() => a[15] || (a[15] = [
|
|
5069
|
+
K("Custom Code")
|
|
5045
5070
|
])),
|
|
5046
5071
|
_: 1
|
|
5047
5072
|
}),
|
|
5048
|
-
|
|
5073
|
+
Q(b, {
|
|
5049
5074
|
modelValue: t.value,
|
|
5050
|
-
"onUpdate:modelValue": a[1] || (a[1] = (
|
|
5075
|
+
"onUpdate:modelValue": a[1] || (a[1] = (E) => t.value = E),
|
|
5051
5076
|
items: n.value,
|
|
5052
5077
|
placeholder: "Select NetSuite Custom Code",
|
|
5053
5078
|
class: "w-full mt-2"
|
|
5054
5079
|
}, null, 8, ["modelValue", "items"]),
|
|
5055
|
-
t.value ? (
|
|
5056
|
-
w("span", $i, "Child Name: " +
|
|
5057
|
-
w("span", ji,
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5080
|
+
t.value ? (G(), ue("div", Li, [
|
|
5081
|
+
w("span", $i, "Child Name: " + O(t.value.childName), 1),
|
|
5082
|
+
w("span", ji, [
|
|
5083
|
+
K("Custom code (" + O(pt(It)(m(t.value.childName))) + "): " + O(t.value.code) + " ", 1),
|
|
5084
|
+
t.value.externalId && t.value.childName !== "-" ? (G(), He(_, {
|
|
5085
|
+
key: 0,
|
|
5086
|
+
placement: "top",
|
|
5087
|
+
"z-index": 9999
|
|
5088
|
+
}, {
|
|
5089
|
+
content: H(() => [
|
|
5090
|
+
K("External ID: " + O(t.value.externalId), 1)
|
|
5091
|
+
]),
|
|
5092
|
+
default: H(() => [
|
|
5093
|
+
Q(y, {
|
|
5094
|
+
name: "info",
|
|
5095
|
+
size: "sm",
|
|
5096
|
+
color: "info",
|
|
5097
|
+
outline: ""
|
|
5098
|
+
})
|
|
5099
|
+
]),
|
|
5100
|
+
_: 1
|
|
5101
|
+
})) : ge("", !0)
|
|
5102
|
+
]),
|
|
5103
|
+
w("span", Vi, "Custom name: " + O(t.value.name), 1),
|
|
5104
|
+
w("span", Bi, "UOM: " + O(t.value.fmMeasurementAbbrev ?? d.sku.unit.abbrev), 1),
|
|
5105
|
+
t.value.remark ? (G(), ue("span", qi, "Remark: " + O(t.value.remark), 1)) : ge("", !0)
|
|
5106
|
+
])) : ge("", !0)
|
|
5062
5107
|
], 64))
|
|
5063
5108
|
])
|
|
5064
5109
|
]),
|
|
@@ -5066,7 +5111,7 @@ const de = en((s, u) => {
|
|
|
5066
5111
|
}, 8, ["modelValue"]);
|
|
5067
5112
|
};
|
|
5068
5113
|
}
|
|
5069
|
-
}),
|
|
5114
|
+
}), Fe = {
|
|
5070
5115
|
/// TH - Zus (Dev)
|
|
5071
5116
|
business_67e6a27d0d160c001c0fb938: {
|
|
5072
5117
|
code: "pktCode",
|
|
@@ -5096,9 +5141,29 @@ const de = en((s, u) => {
|
|
|
5096
5141
|
business_69c26a6ce0c953001bceb402: {
|
|
5097
5142
|
code: "externalId",
|
|
5098
5143
|
name: "name"
|
|
5144
|
+
},
|
|
5145
|
+
// ID - Zus (Dev)
|
|
5146
|
+
business_69ca1d9dcd37b3001c45526e: {
|
|
5147
|
+
code: "externalId",
|
|
5148
|
+
name: "name",
|
|
5149
|
+
child: {
|
|
5150
|
+
code: "custitem_indonesia_code",
|
|
5151
|
+
name: "custitem_indonesia_name",
|
|
5152
|
+
externalId: "externalId"
|
|
5153
|
+
}
|
|
5154
|
+
},
|
|
5155
|
+
// ID - Zus (Prod)
|
|
5156
|
+
business_69a52259743e2d001de70116: {
|
|
5157
|
+
code: "externalId",
|
|
5158
|
+
name: "name",
|
|
5159
|
+
child: {
|
|
5160
|
+
code: "custitem_indonesia_code",
|
|
5161
|
+
name: "custitem_indonesia_name",
|
|
5162
|
+
externalId: "externalId"
|
|
5163
|
+
}
|
|
5099
5164
|
}
|
|
5100
5165
|
};
|
|
5101
|
-
function
|
|
5166
|
+
function Gi() {
|
|
5102
5167
|
return {
|
|
5103
5168
|
setting: {
|
|
5104
5169
|
_id: "",
|
|
@@ -5119,22 +5184,22 @@ function zi() {
|
|
|
5119
5184
|
itemReplicas: []
|
|
5120
5185
|
};
|
|
5121
5186
|
}
|
|
5122
|
-
const
|
|
5187
|
+
const N = Ge(Gi());
|
|
5123
5188
|
function Yi() {
|
|
5124
|
-
const s =
|
|
5125
|
-
() =>
|
|
5189
|
+
const s = rn(), u = Ee(() => N.value.setting.items.groupBy("netSuiteId", (i) => i.id)), d = Ee(() => N.value.setting.units.flatMap((i) => i.measurements).groupBy("netSuiteId", (i) => i.id)), c = Ee(() => N.value.setting.items.groupBy((i) => i.id)), r = Ee(
|
|
5190
|
+
() => N.value.setting.units.groupBy(
|
|
5126
5191
|
(i) => i.netSuiteId,
|
|
5127
5192
|
(i) => s.unitById[i.id]
|
|
5128
5193
|
)
|
|
5129
|
-
), n =
|
|
5194
|
+
), n = Ee(
|
|
5130
5195
|
() => Ji({
|
|
5131
5196
|
units: s.unitById,
|
|
5132
5197
|
skus: s.skus,
|
|
5133
|
-
settingOptions:
|
|
5198
|
+
settingOptions: N.value.skuOptions,
|
|
5134
5199
|
customFields: Wi
|
|
5135
5200
|
})
|
|
5136
|
-
), t =
|
|
5137
|
-
() =>
|
|
5201
|
+
), t = Ee(
|
|
5202
|
+
() => N.value.setting.units.flatMap(
|
|
5138
5203
|
(i) => i.measurements.map((o) => {
|
|
5139
5204
|
var m;
|
|
5140
5205
|
return {
|
|
@@ -5172,7 +5237,7 @@ function Yi() {
|
|
|
5172
5237
|
continue;
|
|
5173
5238
|
const I = l.measurement, p = l.code;
|
|
5174
5239
|
if (!a.find(
|
|
5175
|
-
(
|
|
5240
|
+
(_) => _.value.code === p && _.value.fmMeasurementId === (I == null ? void 0 : I.id)
|
|
5176
5241
|
)) {
|
|
5177
5242
|
if (!I) {
|
|
5178
5243
|
o[m] = `Invalid custom code "${p}" for base unit "${f.unit.abbrev}".`;
|
|
@@ -5190,9 +5255,9 @@ function Yi() {
|
|
|
5190
5255
|
id: "netsuite-verify",
|
|
5191
5256
|
cell: (o) => {
|
|
5192
5257
|
const m = s.skuById[o.row.original.sku._id];
|
|
5193
|
-
return un(
|
|
5258
|
+
return un(zi, {
|
|
5194
5259
|
sku: m,
|
|
5195
|
-
settingOptions:
|
|
5260
|
+
settingOptions: N.value.skuOptions,
|
|
5196
5261
|
"onUpdate:modelValue": (l, f, a) => {
|
|
5197
5262
|
i.onUpdate(o.row.index, l, f, a);
|
|
5198
5263
|
}
|
|
@@ -5202,29 +5267,29 @@ function Yi() {
|
|
|
5202
5267
|
} : {};
|
|
5203
5268
|
},
|
|
5204
5269
|
get skuSettingOptions() {
|
|
5205
|
-
return
|
|
5270
|
+
return N.value.skuOptions;
|
|
5206
5271
|
},
|
|
5207
5272
|
// state
|
|
5208
5273
|
get inventoryTransferOutEnabled() {
|
|
5209
5274
|
return dn().isNetSuiteInventoryTransferOutEnabled;
|
|
5210
5275
|
},
|
|
5211
5276
|
get isReady() {
|
|
5212
|
-
return
|
|
5277
|
+
return N.value.isReady;
|
|
5213
5278
|
},
|
|
5214
5279
|
get isEnabled() {
|
|
5215
|
-
return
|
|
5280
|
+
return N.value.setting.enable;
|
|
5216
5281
|
},
|
|
5217
5282
|
get isBusinessLocation() {
|
|
5218
|
-
return
|
|
5283
|
+
return we().businessLevel;
|
|
5219
5284
|
},
|
|
5220
5285
|
get businessSubsidiaryId() {
|
|
5221
|
-
return
|
|
5286
|
+
return N.value.setting.subsidiaryId;
|
|
5222
5287
|
},
|
|
5223
5288
|
get businessSubsidiaryName() {
|
|
5224
|
-
return
|
|
5289
|
+
return N.value.businessSubsidiaryName;
|
|
5225
5290
|
},
|
|
5226
5291
|
get state() {
|
|
5227
|
-
return
|
|
5292
|
+
return N.value;
|
|
5228
5293
|
},
|
|
5229
5294
|
get netSuiteItemIdToSkuId() {
|
|
5230
5295
|
return u.value;
|
|
@@ -5242,21 +5307,21 @@ function Yi() {
|
|
|
5242
5307
|
return t.value;
|
|
5243
5308
|
},
|
|
5244
5309
|
get configuredLocations() {
|
|
5245
|
-
return
|
|
5310
|
+
return N.value.setting.locations;
|
|
5246
5311
|
},
|
|
5247
5312
|
get currentLocationSetting() {
|
|
5248
|
-
const o =
|
|
5313
|
+
const o = we().currentLocationDBName;
|
|
5249
5314
|
return this.getNetSuiteLocation(o);
|
|
5250
5315
|
},
|
|
5251
5316
|
get isCurrentLocationBindedToNetSuite() {
|
|
5252
5317
|
return this.currentLocationSetting !== void 0;
|
|
5253
5318
|
},
|
|
5254
5319
|
getNetSuiteVendor(i) {
|
|
5255
|
-
return
|
|
5320
|
+
return N.value.setting.vendors.find((o) => o.id === i);
|
|
5256
5321
|
},
|
|
5257
5322
|
getNetSuiteLocation(i) {
|
|
5258
5323
|
const [o, m] = i.split("_");
|
|
5259
|
-
return
|
|
5324
|
+
return N.value.setting.locations.find((f) => f.id == m && f.type == o);
|
|
5260
5325
|
},
|
|
5261
5326
|
getSubsidiaryFullName(i) {
|
|
5262
5327
|
if (!i)
|
|
@@ -5265,7 +5330,7 @@ function Yi() {
|
|
|
5265
5330
|
name: "",
|
|
5266
5331
|
fullName: ""
|
|
5267
5332
|
};
|
|
5268
|
-
const { flat: o } =
|
|
5333
|
+
const { flat: o } = te(N.value.setting.subsidiaries), m = o.find((l) => l.id === i);
|
|
5269
5334
|
return {
|
|
5270
5335
|
id: m == null ? void 0 : m.id,
|
|
5271
5336
|
name: (m == null ? void 0 : m.name) || "",
|
|
@@ -5280,7 +5345,7 @@ function Yi() {
|
|
|
5280
5345
|
name: "",
|
|
5281
5346
|
fullName: ""
|
|
5282
5347
|
};
|
|
5283
|
-
const o = ((f =
|
|
5348
|
+
const o = ((f = N.value.setting.locations.find((a) => a.netSuiteId === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat: m } = te(N.value.setting.subsidiaries), l = m.find((a) => a.id === o);
|
|
5284
5349
|
return {
|
|
5285
5350
|
id: l == null ? void 0 : l.id,
|
|
5286
5351
|
name: (l == null ? void 0 : l.name) || "",
|
|
@@ -5289,9 +5354,9 @@ function Yi() {
|
|
|
5289
5354
|
},
|
|
5290
5355
|
currentLocationSubsidiary() {
|
|
5291
5356
|
var I;
|
|
5292
|
-
const i =
|
|
5357
|
+
const i = we(), o = i.currentLocation.doc._id, m = i.currentLocation.type, l = ((I = N.value.setting.locations.find(
|
|
5293
5358
|
(p) => p.id === o && p.type == m
|
|
5294
|
-
)) == null ? void 0 : I.subsidiaryId) ?? null, { flat: f } =
|
|
5359
|
+
)) == null ? void 0 : I.subsidiaryId) ?? null, { flat: f } = te(N.value.setting.subsidiaries), a = f.find((p) => p.id === l);
|
|
5295
5360
|
return {
|
|
5296
5361
|
id: a == null ? void 0 : a.id,
|
|
5297
5362
|
name: (a == null ? void 0 : a.name) || "",
|
|
@@ -5300,7 +5365,7 @@ function Yi() {
|
|
|
5300
5365
|
},
|
|
5301
5366
|
currentVendorSubsidiary(i) {
|
|
5302
5367
|
var f;
|
|
5303
|
-
const o = ((f =
|
|
5368
|
+
const o = ((f = N.value.setting.vendors.find((a) => a.id === i)) == null ? void 0 : f.subsidiaryId) ?? null, { flat: m } = te(N.value.setting.subsidiaries), l = m.find((a) => a.id === o);
|
|
5304
5369
|
return {
|
|
5305
5370
|
id: l == null ? void 0 : l.id,
|
|
5306
5371
|
name: (l == null ? void 0 : l.name) || "",
|
|
@@ -5308,7 +5373,7 @@ function Yi() {
|
|
|
5308
5373
|
};
|
|
5309
5374
|
},
|
|
5310
5375
|
get subsidiaryOptions() {
|
|
5311
|
-
const { flat: i } =
|
|
5376
|
+
const { flat: i } = te(N.value.setting.subsidiaries);
|
|
5312
5377
|
return i.map((o) => ({
|
|
5313
5378
|
label: `${" ".repeat(o.depth)}${o.name}`,
|
|
5314
5379
|
value: {
|
|
@@ -5318,17 +5383,17 @@ function Yi() {
|
|
|
5318
5383
|
}));
|
|
5319
5384
|
},
|
|
5320
5385
|
getBusinessSubsidiaryTree() {
|
|
5321
|
-
const { tree: i } =
|
|
5322
|
-
|
|
5323
|
-
|
|
5386
|
+
const { tree: i } = te(
|
|
5387
|
+
N.value.setting.subsidiaries,
|
|
5388
|
+
N.value.setting.subsidiaryId
|
|
5324
5389
|
);
|
|
5325
5390
|
return i;
|
|
5326
5391
|
},
|
|
5327
5392
|
getBusinessSubsidiaryPath() {
|
|
5328
|
-
if (!
|
|
5393
|
+
if (!N.value.setting.subsidiaryId)
|
|
5329
5394
|
return [];
|
|
5330
|
-
const { flat: i } =
|
|
5331
|
-
let m =
|
|
5395
|
+
const { flat: i } = te(N.value.setting.subsidiaries), o = [];
|
|
5396
|
+
let m = N.value.setting.subsidiaryId;
|
|
5332
5397
|
for (; m; ) {
|
|
5333
5398
|
o.unshift(m);
|
|
5334
5399
|
const l = i.find((f) => f.id === m);
|
|
@@ -5337,33 +5402,33 @@ function Yi() {
|
|
|
5337
5402
|
return o;
|
|
5338
5403
|
},
|
|
5339
5404
|
getAvailableItems(i) {
|
|
5340
|
-
const { available: o, flatMapping: m } =
|
|
5341
|
-
|
|
5405
|
+
const { available: o, flatMapping: m } = te(
|
|
5406
|
+
N.value.setting.subsidiaries,
|
|
5342
5407
|
i
|
|
5343
5408
|
);
|
|
5344
|
-
return
|
|
5409
|
+
return N.value.setting.items.filter(
|
|
5345
5410
|
(l) => l.subsidiaryIds.some((f) => l.includeChildren && m[f] && m[f].some((a) => o.includes(a)) || o.includes(f))
|
|
5346
5411
|
).map((l) => l.id);
|
|
5347
5412
|
},
|
|
5348
5413
|
getAvailableMeasurements(i, o) {
|
|
5349
|
-
const m =
|
|
5414
|
+
const m = N.value.setting.items.find((a) => a.id === i);
|
|
5350
5415
|
if (!m)
|
|
5351
5416
|
return [];
|
|
5352
|
-
const { available: l, flatMapping: f } =
|
|
5353
|
-
|
|
5417
|
+
const { available: l, flatMapping: f } = te(
|
|
5418
|
+
N.value.setting.subsidiaries,
|
|
5354
5419
|
o
|
|
5355
5420
|
);
|
|
5356
5421
|
if (m.includeChildren) {
|
|
5357
|
-
const I =
|
|
5422
|
+
const I = N.value.setting.childItems.filter((p) => {
|
|
5358
5423
|
let y = p.subsidiaryIds;
|
|
5359
5424
|
if (p.includeChildren == !0)
|
|
5360
|
-
for (const
|
|
5361
|
-
y = y.concat(f[
|
|
5362
|
-
return y = [...new Set(y)], p.parentNetSuiteId === m.netSuiteId && y.some((
|
|
5425
|
+
for (const _ of p.subsidiaryIds)
|
|
5426
|
+
y = y.concat(f[_]);
|
|
5427
|
+
return y = [...new Set(y)], p.parentNetSuiteId === m.netSuiteId && y.some((_) => l.includes(_));
|
|
5363
5428
|
}).flatMap((p) => p.unitTypeId);
|
|
5364
|
-
return
|
|
5429
|
+
return N.value.setting.units.filter((p) => I.includes(p.netSuiteId)).flatMap((p) => p.measurements).map((p) => p.id);
|
|
5365
5430
|
}
|
|
5366
|
-
return
|
|
5431
|
+
return N.value.setting.units.filter((a) => a.netSuiteId === m.unitTypeId).flatMap((a) => a.measurements).map((a) => a.id);
|
|
5367
5432
|
},
|
|
5368
5433
|
async readSetting() {
|
|
5369
5434
|
var o;
|
|
@@ -5371,19 +5436,19 @@ function Yi() {
|
|
|
5371
5436
|
try {
|
|
5372
5437
|
const m = await i.readSetting();
|
|
5373
5438
|
if (m) {
|
|
5374
|
-
if (this.state.setting = m, (o =
|
|
5375
|
-
const { flat: f, tree: a } =
|
|
5439
|
+
if (this.state.setting = m, (o = N.value.setting.subsidiaries) != null && o.length) {
|
|
5440
|
+
const { flat: f, tree: a } = te(N.value.setting.subsidiaries);
|
|
5376
5441
|
for (const p of m.vendors) {
|
|
5377
|
-
const y = f.find((
|
|
5442
|
+
const y = f.find((_) => _.id === p.subsidiaryId);
|
|
5378
5443
|
this.state.vendorSubsidiary[p.id] = (y == null ? void 0 : y.fullName) || "";
|
|
5379
5444
|
}
|
|
5380
5445
|
for (const p of m.items) {
|
|
5381
5446
|
const y = [];
|
|
5382
|
-
for (const
|
|
5383
|
-
const S = f.find((
|
|
5447
|
+
for (const b of p.subsidiaryIds) {
|
|
5448
|
+
const S = f.find((E) => E.id === b);
|
|
5384
5449
|
S && y.push(S.fullName || "");
|
|
5385
5450
|
}
|
|
5386
|
-
const
|
|
5451
|
+
const _ = Kt(
|
|
5387
5452
|
a,
|
|
5388
5453
|
p.subsidiaryIds,
|
|
5389
5454
|
p.includeChildren
|
|
@@ -5391,22 +5456,22 @@ function Yi() {
|
|
|
5391
5456
|
this.state.skuSubsidiaries[p.id] = {
|
|
5392
5457
|
includeChildren: p.includeChildren,
|
|
5393
5458
|
flattenedSubsidiaryNames: y,
|
|
5394
|
-
subsidiaryTree:
|
|
5459
|
+
subsidiaryTree: _
|
|
5395
5460
|
};
|
|
5396
5461
|
}
|
|
5397
5462
|
const I = f.find(
|
|
5398
|
-
(p) => p.id ===
|
|
5463
|
+
(p) => p.id === N.value.setting.subsidiaryId
|
|
5399
5464
|
);
|
|
5400
5465
|
this.state.businessSubsidiaryName = (I == null ? void 0 : I.fullName) || "";
|
|
5401
5466
|
}
|
|
5402
|
-
const l =
|
|
5467
|
+
const l = N.value.setting.units.reduce(
|
|
5403
5468
|
(f, a) => (f[a.netSuiteId] = a, f),
|
|
5404
5469
|
{}
|
|
5405
5470
|
);
|
|
5406
|
-
this.state.skuOptions =
|
|
5471
|
+
this.state.skuOptions = N.value.setting.items.reduce(
|
|
5407
5472
|
(f, a) => (f[a.id] = {
|
|
5408
5473
|
item: a,
|
|
5409
|
-
childItems:
|
|
5474
|
+
childItems: N.value.setting.childItems.filter(
|
|
5410
5475
|
(I) => I.parentNetSuiteId === a.netSuiteId
|
|
5411
5476
|
),
|
|
5412
5477
|
unit: l[a.unitTypeId] || {
|
|
@@ -5462,7 +5527,7 @@ function Yi() {
|
|
|
5462
5527
|
const o = de();
|
|
5463
5528
|
let m = i.locationId;
|
|
5464
5529
|
if (!m) {
|
|
5465
|
-
const l =
|
|
5530
|
+
const l = we(), f = l.currentLocation.doc._id;
|
|
5466
5531
|
m = `${l.currentLocation.type}_${f}`;
|
|
5467
5532
|
}
|
|
5468
5533
|
await o.syncPurchaseOrder({
|
|
@@ -5471,26 +5536,29 @@ function Yi() {
|
|
|
5471
5536
|
});
|
|
5472
5537
|
},
|
|
5473
5538
|
getItemCustomCode(i, o) {
|
|
5474
|
-
var p;
|
|
5475
|
-
const l = `business_${((p =
|
|
5539
|
+
var p, y, _;
|
|
5540
|
+
const l = `business_${((p = Ce().currentBusiness.value) == null ? void 0 : p._id) ?? ""}`, f = Fe[l], a = c.value.get(i._id);
|
|
5476
5541
|
let I = null;
|
|
5477
5542
|
if (a && a.length > 0) {
|
|
5478
|
-
const
|
|
5479
|
-
|
|
5480
|
-
const E =
|
|
5481
|
-
var
|
|
5482
|
-
return
|
|
5483
|
-
}),
|
|
5543
|
+
const b = a[0], S = f.code;
|
|
5544
|
+
b[S] && (I = b[S]);
|
|
5545
|
+
const E = N.value.setting.units.find((U) => {
|
|
5546
|
+
var h;
|
|
5547
|
+
return U.id === ((h = i.unit) == null ? void 0 : h._id);
|
|
5548
|
+
}), v = b.netSuiteId;
|
|
5484
5549
|
if (o) {
|
|
5485
|
-
const
|
|
5486
|
-
if (
|
|
5487
|
-
const
|
|
5488
|
-
(
|
|
5489
|
-
var
|
|
5490
|
-
return (
|
|
5550
|
+
const U = E == null ? void 0 : E.measurements.find((h) => h.id === o);
|
|
5551
|
+
if (U) {
|
|
5552
|
+
const h = ["ZPH"], A = N.value.setting.childItems.filter(
|
|
5553
|
+
(D) => D.parentNetSuiteId === v && D.unitTypeId === (E == null ? void 0 : E.netSuiteId) && D.unitOfMeasureId === U.netSuiteId && D.externalId && !h.some((T) => {
|
|
5554
|
+
var R;
|
|
5555
|
+
return (R = D.externalId) == null ? void 0 : R.startsWith(T);
|
|
5491
5556
|
})
|
|
5492
5557
|
)[0];
|
|
5493
|
-
|
|
5558
|
+
if (A) {
|
|
5559
|
+
const D = ((y = f.child) == null ? void 0 : y.code) ?? f.code, T = A[D] ?? ((_ = A.customAttributes) == null ? void 0 : _[D]);
|
|
5560
|
+
T && (I = T);
|
|
5561
|
+
}
|
|
5494
5562
|
}
|
|
5495
5563
|
}
|
|
5496
5564
|
}
|
|
@@ -5500,18 +5568,18 @@ function Yi() {
|
|
|
5500
5568
|
return await de().getNetSuiteLocationOptions();
|
|
5501
5569
|
},
|
|
5502
5570
|
async getItemAverageCosts() {
|
|
5503
|
-
const i = de(), m =
|
|
5571
|
+
const i = de(), m = we().currentLocation.doc._id;
|
|
5504
5572
|
return await i.getItemAverageCosts(m);
|
|
5505
5573
|
}
|
|
5506
5574
|
};
|
|
5507
5575
|
}
|
|
5508
|
-
function
|
|
5576
|
+
function Kt(s, u, d) {
|
|
5509
5577
|
return s.map((c) => {
|
|
5510
|
-
const r = u.includes(c.id), n =
|
|
5578
|
+
const r = u.includes(c.id), n = Kt(c.children, u);
|
|
5511
5579
|
return { ...c, children: n, isAssigned: r };
|
|
5512
5580
|
}).filter(Boolean);
|
|
5513
5581
|
}
|
|
5514
|
-
function
|
|
5582
|
+
function te(s, u) {
|
|
5515
5583
|
const d = [], c = [];
|
|
5516
5584
|
function r(o, m, l = !1) {
|
|
5517
5585
|
return s.filter((a) => a.parentId === m).map((a) => ((l || a.id === u || !u) && d.push(a.id), {
|
|
@@ -5551,41 +5619,41 @@ function Ji(s) {
|
|
|
5551
5619
|
code: l,
|
|
5552
5620
|
name: m,
|
|
5553
5621
|
childName: "-",
|
|
5554
|
-
externalId: o.item
|
|
5622
|
+
externalId: u("externalId", o.item)
|
|
5555
5623
|
}
|
|
5556
5624
|
}, a = o.childItems.reduce(
|
|
5557
5625
|
(I, p) => {
|
|
5558
|
-
const y = u("code", void 0, p),
|
|
5559
|
-
(
|
|
5626
|
+
const y = u("code", void 0, p), _ = u("name", void 0, p), b = o.unit.measurements.find(
|
|
5627
|
+
(h) => h.netSuiteId === p.unitOfMeasureId
|
|
5560
5628
|
);
|
|
5561
|
-
let S = i.unit.measurements.find((
|
|
5562
|
-
if (!
|
|
5563
|
-
const
|
|
5564
|
-
if (
|
|
5565
|
-
const
|
|
5566
|
-
(
|
|
5567
|
-
),
|
|
5568
|
-
(
|
|
5629
|
+
let S = i.unit.measurements.find((h) => h.id === (b == null ? void 0 : b.id)), E, v = S == null ? void 0 : S.abbrev;
|
|
5630
|
+
if (!b) {
|
|
5631
|
+
const h = o.units[p.unitTypeId];
|
|
5632
|
+
if (h) {
|
|
5633
|
+
const k = n[h.id], A = h == null ? void 0 : h.measurements.find(
|
|
5634
|
+
(T) => T.netSuiteId === p.unitOfMeasureId
|
|
5635
|
+
), D = k == null ? void 0 : k.measurements.find(
|
|
5636
|
+
(T) => T.id === (A == null ? void 0 : A.id)
|
|
5569
5637
|
);
|
|
5570
|
-
if (
|
|
5571
|
-
const
|
|
5572
|
-
(
|
|
5638
|
+
if (D) {
|
|
5639
|
+
const T = i.unit.measurements.find(
|
|
5640
|
+
(R) => R.name === D.name
|
|
5573
5641
|
);
|
|
5574
|
-
|
|
5642
|
+
T ? (v = `${T == null ? void 0 : T.abbrev} ⚠️`, S = T) : v = `Fallback to "${i.unit.abbrev}" (⚠️ Not match with any measurement name)`, E = `UOM "${D.abbrev}" is from "${k.name}"`;
|
|
5575
5643
|
}
|
|
5576
5644
|
}
|
|
5577
5645
|
}
|
|
5578
|
-
const
|
|
5646
|
+
const U = p.name || "N/A (childName not found)";
|
|
5579
5647
|
return I.push({
|
|
5580
|
-
label: `${
|
|
5648
|
+
label: `${U} (${y})`,
|
|
5581
5649
|
value: {
|
|
5582
5650
|
code: y,
|
|
5583
|
-
name:
|
|
5584
|
-
childName:
|
|
5585
|
-
externalId:
|
|
5651
|
+
name: _,
|
|
5652
|
+
childName: U,
|
|
5653
|
+
externalId: u("externalId", void 0, p),
|
|
5586
5654
|
fmMeasurementId: S == null ? void 0 : S.id,
|
|
5587
|
-
fmMeasurementAbbrev:
|
|
5588
|
-
remark:
|
|
5655
|
+
fmMeasurementAbbrev: v,
|
|
5656
|
+
remark: E
|
|
5589
5657
|
}
|
|
5590
5658
|
}), I;
|
|
5591
5659
|
},
|
|
@@ -5597,19 +5665,40 @@ function Ji(s) {
|
|
|
5597
5665
|
}
|
|
5598
5666
|
const Wi = {
|
|
5599
5667
|
code: (s, u) => {
|
|
5600
|
-
var n;
|
|
5601
|
-
const c = `business_${((n =
|
|
5602
|
-
|
|
5668
|
+
var n, t, i;
|
|
5669
|
+
const c = `business_${((n = Ce().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = Fe[c];
|
|
5670
|
+
if (s) {
|
|
5671
|
+
const o = (r == null ? void 0 : r.code) ?? "externalId";
|
|
5672
|
+
return s[o] ?? s.externalId ?? "N/A";
|
|
5673
|
+
}
|
|
5674
|
+
if (u) {
|
|
5675
|
+
const o = ((t = r == null ? void 0 : r.child) == null ? void 0 : t.code) ?? (r == null ? void 0 : r.code) ?? "externalId", m = u[o] ?? ((i = u.customAttributes) == null ? void 0 : i[o]);
|
|
5676
|
+
return m || (u.externalId ?? "N/A");
|
|
5677
|
+
}
|
|
5678
|
+
return "N/A";
|
|
5603
5679
|
},
|
|
5604
5680
|
name: (s, u) => {
|
|
5605
|
-
var n;
|
|
5606
|
-
const c = `business_${((n =
|
|
5607
|
-
|
|
5681
|
+
var n, t, i;
|
|
5682
|
+
const c = `business_${((n = Ce().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = Fe[c];
|
|
5683
|
+
if (s) {
|
|
5684
|
+
const o = (r == null ? void 0 : r.name) ?? "name";
|
|
5685
|
+
return s[o] ?? s.name ?? "N/A";
|
|
5686
|
+
}
|
|
5687
|
+
if (u) {
|
|
5688
|
+
const o = ((t = r == null ? void 0 : r.child) == null ? void 0 : t.name) ?? (r == null ? void 0 : r.name) ?? "name", m = u[o] ?? ((i = u.customAttributes) == null ? void 0 : i[o]);
|
|
5689
|
+
return m || (u.name ?? "N/A");
|
|
5690
|
+
}
|
|
5691
|
+
return "N/A";
|
|
5692
|
+
},
|
|
5693
|
+
externalId: (s, u) => {
|
|
5694
|
+
var n, t, i;
|
|
5695
|
+
const c = `business_${((n = Ce().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = (i = (t = Fe[c]) == null ? void 0 : t.child) == null ? void 0 : i.externalId;
|
|
5696
|
+
return r && u && u[r] ? u[r] : "";
|
|
5608
5697
|
}
|
|
5609
5698
|
};
|
|
5610
5699
|
export {
|
|
5611
|
-
|
|
5612
|
-
|
|
5700
|
+
Ye as S,
|
|
5701
|
+
zi as _,
|
|
5613
5702
|
de as a,
|
|
5614
5703
|
Yi as u
|
|
5615
5704
|
};
|