@acorex-platform/module-maintenance-management-client 2.0.0-next.4 → 2.0.0-next.41
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/fesm2022/{acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-CGjcOjjv.mjs → acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-CMjwhuja.mjs} +120 -45
- package/fesm2022/acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-CMjwhuja.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-plan.mjs +36 -3
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-plan.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template.mjs +2 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-maintenance-template.mjs.map +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-order.mjs +40 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entities-work-order.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-Dgu63wyv.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-Bx9MxLUv.mjs} +27 -27
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-Dgu63wyv.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-acorex-platform-module-maintenance-management-client-contracts-entity-catalog-Bx9MxLUv.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity-CePSpBHM.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity-utPvjK0d.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity-CePSpBHM.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-asset-type.entity-utPvjK0d.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-Bfvk4GcQ.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-CjXMqoVR.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-Bfvk4GcQ.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type-resource.entity-CjXMqoVR.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-Jy3BDuNN.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-xd9Ndgtv.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-Jy3BDuNN.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-activity-type.entity-xd9Ndgtv.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-CCgWn686.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-BusczvwU.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-CCgWn686.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-cause.entity-BusczvwU.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-r_GaKV4C.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-C4KvWylB.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-r_GaKV4C.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-detection.entity-C4KvWylB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-BC8cmP-E.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-DF9hZx2J.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-BC8cmP-E.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-effect.entity-DF9hZx2J.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-DkyVyX8d.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-8UBje6Su.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-DkyVyX8d.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mechanism.entity-8UBje6Su.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-WxiHq42o.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-yRTQAyko.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-WxiHq42o.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-asset-type.entity-yRTQAyko.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-B1yGBbFQ.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-DXyhOs6U.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-B1yGBbFQ.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-mechanism.entity-DXyhOs6U.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-Bquvs5zg.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-Bg0sEyhC.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-Bquvs5zg.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode-solution.entity-Bg0sEyhC.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-DU4i03Hi.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-8vtPt32E.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-DU4i03Hi.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-mode.entity-8vtPt32E.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-DvO7KoEq.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-lWUS5cqB.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-DvO7KoEq.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-cause.entity-lWUS5cqB.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-DK702y8j.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-BeYDyYIP.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-DK702y8j.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-effect.entity-BeYDyYIP.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-Dua1ufeE.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-WmzOTNUb.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-Dua1ufeE.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register-mechanism.entity-WmzOTNUb.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-Cs-SLfHm.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-4yVX8hcW.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-Cs-SLfHm.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-register.entity-4yVX8hcW.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-C-vkhC0g.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-BwI7_hp6.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-C-vkhC0g.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-severity.entity-BwI7_hp6.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DEcLe9MD.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DeFleWQY.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DEcLe9MD.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-failure-type.entity-DeFleWQY.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-R0UVSWKi.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-BtmSifCl.mjs} +38 -5
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-BtmSifCl.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-C3KERG4U.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-Bwkfjbaa.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-C3KERG4U.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-activity-type.entity-Bwkfjbaa.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-EXXJjDYH.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-Cvs1sPVm.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-EXXJjDYH.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-failure-mode.entity-Cvs1sPVm.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-CrMPuOD8.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-BVWy5cHU.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-CrMPuOD8.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template-resource.entity-BVWy5cHU.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-Bn2DAaNN.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-GL5jpQ5e.mjs} +4 -3
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-GL5jpQ5e.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-DS8_oRB7.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-qd2E7poM.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-DS8_oRB7.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-type.entity-qd2E7poM.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-DS1RPQ-I.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-dzXPaasH.mjs} +42 -3
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-dzXPaasH.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-BUMsgLTC.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-BRuQuZkI.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-BUMsgLTC.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-package.entity-BRuQuZkI.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-V0CqICBq.mjs → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-DJJkz8QA.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-V0CqICBq.mjs.map → acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-report.entity-DJJkz8QA.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog.mjs +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts.mjs +908 -126
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts.mjs.map +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-BXKKfu4I.mjs → acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-BlB-A6oM.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-BXKKfu4I.mjs.map → acorex-platform-module-maintenance-management-client-create-or-get-work-report-draft.activity-BlB-A6oM.mjs.map} +1 -1
- package/fesm2022/{acorex-platform-module-maintenance-management-client-maintenance-interval-widget-edit.component-Be1Nup4H.mjs → acorex-platform-module-maintenance-management-client-maintenance-interval-widget-edit.component-Bb4qMani.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-maintenance-interval-widget-edit.component-Be1Nup4H.mjs.map → acorex-platform-module-maintenance-management-client-maintenance-interval-widget-edit.component-Bb4qMani.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-open-work-order-checklist-form.command-WS9Q-ddj.mjs +744 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-open-work-order-checklist-form.command-WS9Q-ddj.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-BJUgm59a.mjs → acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-DfC490ds.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-BJUgm59a.mjs.map → acorex-platform-module-maintenance-management-client-record-work-report-assessment.activity-DfC490ds.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-sign-off-work-order.command-DZxPc93J.mjs +342 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-sign-off-work-order.command-DZxPc93J.mjs.map +1 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-start-work-order-flow-id.util-CuUi8LBT.mjs +123 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-start-work-order-flow-id.util-CuUi8LBT.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-start-work-order-flow.command-Bg1do_Uu.mjs → acorex-platform-module-maintenance-management-client-start-work-order-flow.command-BoSHBoC_.mjs} +274 -130
- package/fesm2022/acorex-platform-module-maintenance-management-client-start-work-order-flow.command-BoSHBoC_.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-CSKzwPjv.mjs → acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-DCQzsQ8Y.mjs} +28 -7
- package/fesm2022/acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-DCQzsQ8Y.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-B8vjsOI_.mjs → acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-By4k3XGG.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-B8vjsOI_.mjs.map → acorex-platform-module-maintenance-management-client-update-work-order-in-progress.activity-By4k3XGG.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-work-order-status-patch.util-BGY7nYJK.mjs +53 -0
- package/fesm2022/acorex-platform-module-maintenance-management-client-work-order-status-patch.util-BGY7nYJK.mjs.map +1 -0
- package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-DG80hqRj.mjs → acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-DJs3fcuz.mjs} +2 -2
- package/fesm2022/{acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-DG80hqRj.mjs.map → acorex-platform-module-maintenance-management-client-work-order-workflow-column.component-DJs3fcuz.mjs.map} +1 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client.mjs +1 -1
- package/i18n/en-AU/maintenance-management.json +96 -5
- package/i18n/en-US/maintenance-management.json +96 -5
- package/i18n/fa-IR/maintenance-management.json +96 -5
- package/package.json +3 -2
- package/types/acorex-platform-module-maintenance-management-client-contracts.d.ts +381 -99
- package/types/acorex-platform-module-maintenance-management-client.d.ts +3 -2
- package/fesm2022/acorex-platform-module-maintenance-management-client-acorex-platform-module-maintenance-management-client-CGjcOjjv.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-plan.entity-R0UVSWKi.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-maintenance-template.entity-Bn2DAaNN.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-contracts-entity-catalog-work-order.entity-DS1RPQ-I.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-start-work-order-flow.command-Bg1do_Uu.mjs.map +0 -1
- package/fesm2022/acorex-platform-module-maintenance-management-client-update-work-order-completed.activity-CSKzwPjv.mjs.map +0 -1
|
@@ -5,6 +5,12 @@ const MM_CATALOG_SCOPE_MN = 'maintenance-management.mn';
|
|
|
5
5
|
const AXMMaintenanceManagementCommandKeys = {
|
|
6
6
|
WorkOrder: {
|
|
7
7
|
StartFlow: 'MaintenanceManagement.WorkOrder:StartFlow',
|
|
8
|
+
/** Interval in-progress card. Delegated (`:`) so the task board does not resume the workflow. */
|
|
9
|
+
OpenForm: 'MaintenanceManagement.WorkOrder:OpenForm',
|
|
10
|
+
/** Interval card. Opens the existing signature dialog, then asks the server to complete the work order. */
|
|
11
|
+
SignOff: 'MaintenanceManagement.WorkOrder:SignOff',
|
|
12
|
+
/** Server completion for an interval checklist sign-off. Not registered on the client. */
|
|
13
|
+
CompleteIntervalSignOff: 'MaintenanceManagement.WorkOrder:CompleteIntervalSignOff',
|
|
8
14
|
},
|
|
9
15
|
WorkReport: {
|
|
10
16
|
FillCompletion: 'MaintenanceManagement.WorkReport:FillCompletion',
|
|
@@ -26,129 +32,6 @@ const AXMMaintenanceManagementCommandKeys = {
|
|
|
26
32
|
const AXM_MAINTENANCE_INTERVAL_CHECK_COMMAND_KEY = AXMMaintenanceManagementCommandKeys.MaintenanceIntervalCheck;
|
|
27
33
|
//#endregion
|
|
28
34
|
|
|
29
|
-
const AXMMaintenanceManagementFeatureKeys = {
|
|
30
|
-
Management: 'MaintenanceManagement:Feature:Management',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const AXMMaintenanceManagementMenuKeys = {
|
|
34
|
-
Root: 'MaintenanceManagement:Menu',
|
|
35
|
-
// MainPlanEquipmentMaintenanceSectionGroup: 'MaintenanceManagement:Menu:MainPlanEquipment:MaintenanceSectionGroup',
|
|
36
|
-
// PlanEquipmentMaintenanceSectionGroup: 'MaintenanceManagement:Menu:PlantEquipment:MaintenanceSectionGroup',
|
|
37
|
-
Activities: 'MaintenanceManagement:Menu:Activities',
|
|
38
|
-
Failures: 'MaintenanceManagement:Menu:Failures',
|
|
39
|
-
ActivityCategories: 'MaintenanceManagement:Menu:ActivityCategories',
|
|
40
|
-
ActivityTypes: 'MaintenanceManagement:Menu:ActivityTypes',
|
|
41
|
-
MaintenanceTypes: 'MaintenanceManagement:Menu:MaintenanceTypes',
|
|
42
|
-
MaintenancePlans: 'MaintenanceManagement:Menu:MaintenancePlans',
|
|
43
|
-
MaintenancePlansList: 'MaintenanceManagement:Menu:MaintenancePlans:List',
|
|
44
|
-
WorkPackages: 'MaintenanceManagement:Menu:WorkPackages',
|
|
45
|
-
WorkOrders: 'MaintenanceManagement:Menu:WorkOrders',
|
|
46
|
-
WorkReports: 'MaintenanceManagement:Menu:WorkReports',
|
|
47
|
-
MaintenanceTemplates: 'MaintenanceManagement:Menu:MaintenanceTemplates',
|
|
48
|
-
MaintenanceTemplateActivityTypes: 'MaintenanceManagement:Menu:MaintenanceTemplateActivityTypes',
|
|
49
|
-
MaintenanceTemplateResources: 'MaintenanceManagement:Menu:MaintenanceTemplateResources',
|
|
50
|
-
MaintenanceTemplateFailureModes: 'MaintenanceManagement:Menu:MaintenanceTemplateFailureModes',
|
|
51
|
-
FailureCauses: 'MaintenanceManagement:Menu:FailureCauses',
|
|
52
|
-
FailureMechanisms: 'MaintenanceManagement:Menu:FailureMechanisms',
|
|
53
|
-
FailureDetections: 'MaintenanceManagement:Menu:FailureDetections',
|
|
54
|
-
FailureEffects: 'MaintenanceManagement:Menu:FailureEffects',
|
|
55
|
-
FailureSeverities: 'MaintenanceManagement:Menu:FailureSeverities',
|
|
56
|
-
FailureTypes: 'MaintenanceManagement:Menu:FailureTypes',
|
|
57
|
-
FailureModes: 'MaintenanceManagement:Menu:FailureModes',
|
|
58
|
-
FailureRegisters: 'MaintenanceManagement:Menu:FailureRegisters',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Assets & Maintenance capabilities used by this module.
|
|
63
|
-
* Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).
|
|
64
|
-
*/
|
|
65
|
-
const AXPAssetsMaintenancePermissionKeys = {
|
|
66
|
-
Access: 'AssetsMaintenance:Permission:Access',
|
|
67
|
-
MaintainAssets: 'AssetsMaintenance:Permission:MaintainAssets',
|
|
68
|
-
MaintainMaintenance: 'AssetsMaintenance:Permission:MaintainMaintenance',
|
|
69
|
-
Setup: 'AssetsMaintenance:Permission:Setup',
|
|
70
|
-
};
|
|
71
|
-
const cap = AXPAssetsMaintenancePermissionKeys.MaintainMaintenance;
|
|
72
|
-
function entityCrud() {
|
|
73
|
-
return {
|
|
74
|
-
Management: cap,
|
|
75
|
-
View: cap,
|
|
76
|
-
Create: cap,
|
|
77
|
-
Update: cap,
|
|
78
|
-
Delete: cap,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated Prefer {@link AXPAssetsMaintenancePermissionKeys}.
|
|
83
|
-
* Legacy nested shape kept so existing imports compile during migration.
|
|
84
|
-
*/
|
|
85
|
-
const AXMMaintenanceManagementPermissionKeys = {
|
|
86
|
-
MaintenanceManagement: {
|
|
87
|
-
Management: cap,
|
|
88
|
-
ActivityCategory: entityCrud(),
|
|
89
|
-
MaintenanceType: entityCrud(),
|
|
90
|
-
MaintenanceTemplate: entityCrud(),
|
|
91
|
-
MaintenancePlan: entityCrud(),
|
|
92
|
-
WorkPackage: entityCrud(),
|
|
93
|
-
WorkOrder: entityCrud(),
|
|
94
|
-
WorkReport: entityCrud(),
|
|
95
|
-
MaintenanceTemplateActivityType: entityCrud(),
|
|
96
|
-
MaintenanceTemplateResource: entityCrud(),
|
|
97
|
-
MaintenanceTemplateFailureMode: entityCrud(),
|
|
98
|
-
ActivityType: entityCrud(),
|
|
99
|
-
ActivityTypeAssetType: entityCrud(),
|
|
100
|
-
ActivityTypeResource: entityCrud(),
|
|
101
|
-
FailureCause: entityCrud(),
|
|
102
|
-
FailureMechanism: entityCrud(),
|
|
103
|
-
FailureDetection: entityCrud(),
|
|
104
|
-
FailureEffect: entityCrud(),
|
|
105
|
-
FailureSeverity: entityCrud(),
|
|
106
|
-
FailureType: entityCrud(),
|
|
107
|
-
FailureMode: entityCrud(),
|
|
108
|
-
FailureRegister: entityCrud(),
|
|
109
|
-
},
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
//#region ---- Status names ----
|
|
113
|
-
var AXMWorkOrderStatus;
|
|
114
|
-
(function (AXMWorkOrderStatus) {
|
|
115
|
-
AXMWorkOrderStatus["Planned"] = "planned";
|
|
116
|
-
AXMWorkOrderStatus["Scheduled"] = "scheduled";
|
|
117
|
-
AXMWorkOrderStatus["Assigned"] = "assigned";
|
|
118
|
-
AXMWorkOrderStatus["InProgress"] = "in-progress";
|
|
119
|
-
AXMWorkOrderStatus["OnHold"] = "on-hold";
|
|
120
|
-
AXMWorkOrderStatus["Completed"] = "completed";
|
|
121
|
-
AXMWorkOrderStatus["SignedOff"] = "signed-off";
|
|
122
|
-
AXMWorkOrderStatus["Cancelled"] = "cancelled";
|
|
123
|
-
})(AXMWorkOrderStatus || (AXMWorkOrderStatus = {}));
|
|
124
|
-
//#endregion
|
|
125
|
-
|
|
126
|
-
//#region ---- Source type enum ----
|
|
127
|
-
var AXMWorkOrderSourceType;
|
|
128
|
-
(function (AXMWorkOrderSourceType) {
|
|
129
|
-
AXMWorkOrderSourceType["Manual"] = "manual";
|
|
130
|
-
AXMWorkOrderSourceType["MaintenancePlan"] = "maintenance-plan";
|
|
131
|
-
AXMWorkOrderSourceType["CreateAsset"] = "create-asset";
|
|
132
|
-
AXMWorkOrderSourceType["FailureRegister"] = "failure-register";
|
|
133
|
-
})(AXMWorkOrderSourceType || (AXMWorkOrderSourceType = {}));
|
|
134
|
-
//#endregion
|
|
135
|
-
|
|
136
|
-
//#region ---- Status names ----
|
|
137
|
-
var AXMFailureRegisterStatus;
|
|
138
|
-
(function (AXMFailureRegisterStatus) {
|
|
139
|
-
AXMFailureRegisterStatus["Reported"] = "reported";
|
|
140
|
-
AXMFailureRegisterStatus["UnderReview"] = "underReview";
|
|
141
|
-
AXMFailureRegisterStatus["WorkOrderRequired"] = "workOrderRequired";
|
|
142
|
-
AXMFailureRegisterStatus["WorkOrderCreated"] = "workOrderCreated";
|
|
143
|
-
AXMFailureRegisterStatus["InProgress"] = "inProgress";
|
|
144
|
-
AXMFailureRegisterStatus["Resolved"] = "resolved";
|
|
145
|
-
AXMFailureRegisterStatus["FollowUpRequired"] = "followUpRequired";
|
|
146
|
-
AXMFailureRegisterStatus["Rejected"] = "rejected";
|
|
147
|
-
AXMFailureRegisterStatus["Duplicate"] = "duplicate";
|
|
148
|
-
AXMFailureRegisterStatus["Closed"] = "closed";
|
|
149
|
-
})(AXMFailureRegisterStatus || (AXMFailureRegisterStatus = {}));
|
|
150
|
-
//#endregion
|
|
151
|
-
|
|
152
35
|
//#region ----- Constants -----
|
|
153
36
|
/** Widget name for the maintenance interval editor. Kind strings match `AXMAssetIntervalKind`. */
|
|
154
37
|
const AXM_MAINTENANCE_INTERVAL_WIDGET = 'maintenance-interval-editor';
|
|
@@ -220,6 +103,20 @@ function emptyAXMMaintenanceIntervalDraft() {
|
|
|
220
103
|
}
|
|
221
104
|
//#endregion
|
|
222
105
|
//#region ----- Normalize -----
|
|
106
|
+
function scheduleMode(value) {
|
|
107
|
+
if (!value || typeof value !== 'object') {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
110
|
+
const mode = value.mode;
|
|
111
|
+
return typeof mode === 'string' ? mode.trim() : '';
|
|
112
|
+
}
|
|
113
|
+
function scheduleStartDate(value) {
|
|
114
|
+
if (!value || typeof value !== 'object') {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
const start = value.startCondition;
|
|
118
|
+
return start?.startDate ?? null;
|
|
119
|
+
}
|
|
223
120
|
function isSchedule(value) {
|
|
224
121
|
if (!value || typeof value !== 'object') {
|
|
225
122
|
return false;
|
|
@@ -280,8 +177,17 @@ function buildAXMMaintenanceIntervalConfig(supportedIntervalKinds, draft) {
|
|
|
280
177
|
const triggers = [];
|
|
281
178
|
const errors = [];
|
|
282
179
|
if (supported.has('schedule') && draft.scheduleEnabled) {
|
|
283
|
-
|
|
284
|
-
|
|
180
|
+
const schedule = draft.schedule;
|
|
181
|
+
if (schedule && scheduleMode(schedule) === 'specific-date') {
|
|
182
|
+
if (readIntervalDate(scheduleStartDate(schedule))) {
|
|
183
|
+
triggers.push({ kind: 'schedule', schedule });
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
errors.push({ kind: 'schedule', code: 'date' });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (isSchedule(schedule)) {
|
|
190
|
+
triggers.push({ kind: 'schedule', schedule });
|
|
285
191
|
}
|
|
286
192
|
else {
|
|
287
193
|
errors.push({ kind: 'schedule', code: 'schedule' });
|
|
@@ -418,6 +324,882 @@ function draftFromAXMMaintenanceIntervalConfig(value, supportedIntervalKinds) {
|
|
|
418
324
|
}
|
|
419
325
|
//#endregion
|
|
420
326
|
|
|
327
|
+
//#region ----- Constants -----
|
|
328
|
+
/** Seeded inspection workflow. It collects meters and does not replace interval-plan triggers. */
|
|
329
|
+
const AXM_INSPECTION_WORK_ORDER_WORKFLOW_NAME = 'maintenance-inspection-work-order';
|
|
330
|
+
const AXM_INSPECTION_USAGE_KINDS_INPUT = 'usageKinds';
|
|
331
|
+
const DEFAULT_USAGE_KIND = 'distance';
|
|
332
|
+
function readKindToken(value) {
|
|
333
|
+
if (typeof value === 'string') {
|
|
334
|
+
return value.trim();
|
|
335
|
+
}
|
|
336
|
+
if (value && typeof value === 'object' && 'id' in value && typeof value.id === 'string') {
|
|
337
|
+
return value.id.trim();
|
|
338
|
+
}
|
|
339
|
+
return '';
|
|
340
|
+
}
|
|
341
|
+
/** Meter kinds an asset type can collect. Schedule and date stay on the plan, not on this input. */
|
|
342
|
+
function collectableUsageKinds(supported) {
|
|
343
|
+
const kinds = [];
|
|
344
|
+
for (const kind of supported) {
|
|
345
|
+
if (isAXMMaintenanceMeterKind(kind) && !kinds.includes(kind)) {
|
|
346
|
+
kinds.push(kind);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return kinds;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Readings to collect for one inspection template or instance.
|
|
353
|
+
* An empty selection defaults to distance when that meter is supported.
|
|
354
|
+
* Distance cannot stay selected when the asset type does not support it.
|
|
355
|
+
*/
|
|
356
|
+
function resolveInspectionUsageKinds(value, supported) {
|
|
357
|
+
const allowed = collectableUsageKinds(supported);
|
|
358
|
+
if (value != null && !Array.isArray(value)) {
|
|
359
|
+
return { kinds: [], issue: 'unsupported' };
|
|
360
|
+
}
|
|
361
|
+
const selected = [];
|
|
362
|
+
for (const item of Array.isArray(value) ? value : []) {
|
|
363
|
+
const token = readKindToken(item);
|
|
364
|
+
if (!token) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (!isAXMMaintenanceMeterKind(token) || !allowed.includes(token)) {
|
|
368
|
+
return { kinds: [], issue: token === DEFAULT_USAGE_KIND ? 'distance-unsupported' : 'unsupported' };
|
|
369
|
+
}
|
|
370
|
+
if (!selected.includes(token)) {
|
|
371
|
+
selected.push(token);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
if (selected.length === 0) {
|
|
375
|
+
if (!allowed.includes(DEFAULT_USAGE_KIND)) {
|
|
376
|
+
return { kinds: [], issue: 'distance-unsupported' };
|
|
377
|
+
}
|
|
378
|
+
return { kinds: [DEFAULT_USAGE_KIND], issue: null };
|
|
379
|
+
}
|
|
380
|
+
return { kinds: selected, issue: null };
|
|
381
|
+
}
|
|
382
|
+
function readInspectionUsageKinds(source) {
|
|
383
|
+
const workflowInstance = source?.['workflowInstance'] && typeof source['workflowInstance'] === 'object'
|
|
384
|
+
? source['workflowInstance']
|
|
385
|
+
: source;
|
|
386
|
+
const workflowState = workflowInstance?.['workflowState'] && typeof workflowInstance['workflowState'] === 'object'
|
|
387
|
+
? workflowInstance['workflowState']
|
|
388
|
+
: null;
|
|
389
|
+
const input = workflowState?.['input'] && typeof workflowState['input'] === 'object'
|
|
390
|
+
? workflowState['input']
|
|
391
|
+
: null;
|
|
392
|
+
const raw = input?.[AXM_INSPECTION_USAGE_KINDS_INPUT] ?? source?.[AXM_INSPECTION_USAGE_KINDS_INPUT];
|
|
393
|
+
if (!Array.isArray(raw)) {
|
|
394
|
+
return [];
|
|
395
|
+
}
|
|
396
|
+
return raw.map(readKindToken).filter((kind) => isAXMMaintenanceMeterKind(kind));
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
|
|
400
|
+
//#region ----- Constants -----
|
|
401
|
+
/** Bookmark action that starts an interval work order. */
|
|
402
|
+
const AXM_INTERVAL_START_FLOW_ACTION_NAME = 'start-flow';
|
|
403
|
+
/** Bookmark action that opens the in-progress checklist form. */
|
|
404
|
+
const AXM_INTERVAL_OPEN_FORM_ACTION_NAME = 'open-form';
|
|
405
|
+
/** Bookmark action that collects a signature and completes the interval work order. */
|
|
406
|
+
const AXM_INTERVAL_SIGN_OFF_ACTION_NAME = 'sign-off';
|
|
407
|
+
/** Seeded interval workflow name. The task-board card belongs to this instance. */
|
|
408
|
+
const AXM_INTERVAL_WORK_ORDER_WORKFLOW_NAME = 'maintenance-interval-work-order';
|
|
409
|
+
const AXM_INTERVAL_DUE_ACTIVITY_ID = 'intervalDueHumanTask';
|
|
410
|
+
/** Workflow variable / instance property for the checklist case of this work order. */
|
|
411
|
+
const AXM_INTERVAL_CHECKLIST_CASE_ID = 'assessmentCaseId';
|
|
412
|
+
/** Workflow variable / instance property for the checklist session of this work order. */
|
|
413
|
+
const AXM_INTERVAL_CHECKLIST_SESSION_ID = 'assessmentSessionId';
|
|
414
|
+
/** Workflow variable storing the template questionnaire this occurrence was opened against. */
|
|
415
|
+
const AXM_INTERVAL_CHECKLIST_QUESTIONNAIRE_ID = 'checklistQuestionnaireId';
|
|
416
|
+
/** Short-lived claim so concurrent Open Form clicks create one case and session. */
|
|
417
|
+
const AXM_INTERVAL_CHECKLIST_CLAIM = 'checklistOccurrenceClaim';
|
|
418
|
+
const AXM_INTERVAL_IN_PROGRESS_TASK_DESCRIPTION = '@maintenance-management:work-orders.tasks.interval-due.in-progress-description';
|
|
419
|
+
const AXM_INTERVAL_COMPLETED_TASK_DESCRIPTION = '@maintenance-management:work-orders.tasks.interval-due.completed-description';
|
|
420
|
+
const AXM_INTERVAL_CANCELLED_TASK_DESCRIPTION = '@maintenance-management:work-orders.tasks.interval-due.cancelled-description';
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region ----- Checklist id -----
|
|
423
|
+
function isRecord(value) {
|
|
424
|
+
return value != null && typeof value === 'object' && !Array.isArray(value);
|
|
425
|
+
}
|
|
426
|
+
function resolveChecklistId(value) {
|
|
427
|
+
if (typeof value === 'string') {
|
|
428
|
+
const trimmed = value.trim();
|
|
429
|
+
// An unevaluated workflow expression is not a questionnaire.
|
|
430
|
+
if (!trimmed || trimmed.includes('{{')) {
|
|
431
|
+
return '';
|
|
432
|
+
}
|
|
433
|
+
return trimmed;
|
|
434
|
+
}
|
|
435
|
+
if (isRecord(value)) {
|
|
436
|
+
return resolveChecklistId(value['id']);
|
|
437
|
+
}
|
|
438
|
+
return '';
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Questionnaire for this interval occurrence.
|
|
442
|
+
* `workflowState.input.checklist` wins over a task-action or command fallback.
|
|
443
|
+
*/
|
|
444
|
+
function readIntervalChecklistId(source, fallback) {
|
|
445
|
+
const workflowInstance = isRecord(source?.['workflowInstance'])
|
|
446
|
+
? source['workflowInstance']
|
|
447
|
+
: source;
|
|
448
|
+
const workflowState = isRecord(workflowInstance?.['workflowState'])
|
|
449
|
+
? workflowInstance['workflowState']
|
|
450
|
+
: null;
|
|
451
|
+
const input = isRecord(workflowState?.['input']) ? workflowState['input'] : null;
|
|
452
|
+
const properties = isRecord(workflowState?.['properties'])
|
|
453
|
+
? workflowState['properties']
|
|
454
|
+
: null;
|
|
455
|
+
return (resolveChecklistId(input?.['checklist']) ||
|
|
456
|
+
resolveChecklistId(input?.['preChecklistQuestionnaireId']) ||
|
|
457
|
+
resolveChecklistId(properties?.[AXM_INTERVAL_CHECKLIST_QUESTIONNAIRE_ID]) ||
|
|
458
|
+
resolveChecklistId(properties?.['checklist']) ||
|
|
459
|
+
resolveChecklistId(fallback));
|
|
460
|
+
}
|
|
461
|
+
function readChecklistIdFromTaskActions(actions) {
|
|
462
|
+
if (!isRecord(actions)) {
|
|
463
|
+
return '';
|
|
464
|
+
}
|
|
465
|
+
const lists = [actions['prefix'], actions['suffix']];
|
|
466
|
+
for (const list of lists) {
|
|
467
|
+
if (!Array.isArray(list)) {
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
for (const item of list) {
|
|
471
|
+
if (!isRecord(item) || !isRecord(item['command'])) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
const options = isRecord(item['command']['options']) ? item['command']['options'] : null;
|
|
475
|
+
const checklist = resolveChecklistId(options?.['checklist']);
|
|
476
|
+
if (checklist) {
|
|
477
|
+
return checklist;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return '';
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region ----- Task action -----
|
|
485
|
+
function buildIntervalWorkOrderOpenFormAction(input) {
|
|
486
|
+
return {
|
|
487
|
+
name: AXM_INTERVAL_OPEN_FORM_ACTION_NAME,
|
|
488
|
+
title: '@maintenance-management:work-orders.tasks.actions.open-form',
|
|
489
|
+
icon: 'fa-light fa-file-lines',
|
|
490
|
+
color: 'primary',
|
|
491
|
+
priority: 'primary',
|
|
492
|
+
command: {
|
|
493
|
+
name: AXMMaintenanceManagementCommandKeys.WorkOrder.OpenForm,
|
|
494
|
+
options: {
|
|
495
|
+
data: { id: input.workOrderId },
|
|
496
|
+
checklist: input.checklist,
|
|
497
|
+
...(input.usageKinds ? { usageKinds: input.usageKinds } : {}),
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
function buildIntervalWorkOrderSignOffAction(input) {
|
|
503
|
+
return {
|
|
504
|
+
name: AXM_INTERVAL_SIGN_OFF_ACTION_NAME,
|
|
505
|
+
title: '@maintenance-management:work-orders.tasks.actions.sign-off',
|
|
506
|
+
icon: 'fa-light fa-file-signature',
|
|
507
|
+
color: 'primary',
|
|
508
|
+
priority: 'primary',
|
|
509
|
+
command: {
|
|
510
|
+
name: AXMMaintenanceManagementCommandKeys.WorkOrder.SignOff,
|
|
511
|
+
options: {
|
|
512
|
+
data: { id: input.workOrderId },
|
|
513
|
+
checklist: input.checklist,
|
|
514
|
+
...(input.usageKinds ? { usageKinds: input.usageKinds } : {}),
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function isIntervalStartFlowAction(action) {
|
|
520
|
+
if (!isRecord(action)) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
const command = isRecord(action['command']) ? action['command'] : null;
|
|
524
|
+
const commandName = typeof command?.['name'] === 'string' ? command['name'].trim() : '';
|
|
525
|
+
const name = typeof action['name'] === 'string' ? action['name'].trim() : '';
|
|
526
|
+
return name === AXM_INTERVAL_START_FLOW_ACTION_NAME || commandName === AXMMaintenanceManagementCommandKeys.WorkOrder.StartFlow;
|
|
527
|
+
}
|
|
528
|
+
function isIntervalSignOffAction(action) {
|
|
529
|
+
if (!isRecord(action)) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
const command = isRecord(action['command']) ? action['command'] : null;
|
|
533
|
+
const commandName = typeof command?.['name'] === 'string' ? command['name'].trim() : '';
|
|
534
|
+
const name = typeof action['name'] === 'string' ? action['name'].trim() : '';
|
|
535
|
+
return name === AXM_INTERVAL_SIGN_OFF_ACTION_NAME || commandName === AXMMaintenanceManagementCommandKeys.WorkOrder.SignOff;
|
|
536
|
+
}
|
|
537
|
+
function isIntervalOpenFormAction(action) {
|
|
538
|
+
if (!isRecord(action)) {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
const command = isRecord(action['command']) ? action['command'] : null;
|
|
542
|
+
const commandName = typeof command?.['name'] === 'string' ? command['name'].trim() : '';
|
|
543
|
+
const name = typeof action['name'] === 'string' ? action['name'].trim() : '';
|
|
544
|
+
return name === AXM_INTERVAL_OPEN_FORM_ACTION_NAME || commandName === AXMMaintenanceManagementCommandKeys.WorkOrder.OpenForm;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Replaces Start Flow with a single Open Form action.
|
|
548
|
+
* A second call refreshes that action and does not add another button.
|
|
549
|
+
*/
|
|
550
|
+
function replaceIntervalStartFlowActions(actions, openFormAction) {
|
|
551
|
+
const prefixSource = Array.isArray(actions?.prefix) ? actions.prefix : [];
|
|
552
|
+
const suffixSource = Array.isArray(actions?.suffix) ? actions.suffix : [];
|
|
553
|
+
let changed = false;
|
|
554
|
+
let placed = false;
|
|
555
|
+
const rewrite = (list) => {
|
|
556
|
+
const next = [];
|
|
557
|
+
for (const item of list) {
|
|
558
|
+
if (isIntervalStartFlowAction(item) || isIntervalOpenFormAction(item)) {
|
|
559
|
+
changed = true;
|
|
560
|
+
if (!placed) {
|
|
561
|
+
next.push(openFormAction);
|
|
562
|
+
placed = true;
|
|
563
|
+
}
|
|
564
|
+
continue;
|
|
565
|
+
}
|
|
566
|
+
next.push(item);
|
|
567
|
+
}
|
|
568
|
+
return next;
|
|
569
|
+
};
|
|
570
|
+
const prefix = rewrite(prefixSource);
|
|
571
|
+
const suffix = rewrite(suffixSource);
|
|
572
|
+
if (!placed) {
|
|
573
|
+
suffix.push(openFormAction);
|
|
574
|
+
changed = true;
|
|
575
|
+
}
|
|
576
|
+
return { prefix, suffix, changed };
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Completed and cancelled checklists reopen read-only. In Progress stays editable. Planned stays unavailable.
|
|
580
|
+
* Accepts the stored status string or a status object (`name` / `id`).
|
|
581
|
+
* Any other status cannot open this card's form.
|
|
582
|
+
*/
|
|
583
|
+
function resolveIntervalChecklistViewerMode(statusId) {
|
|
584
|
+
const status = readStatusName(statusId);
|
|
585
|
+
if (status === 'completed' || status === 'cancelled') {
|
|
586
|
+
return 'readonly';
|
|
587
|
+
}
|
|
588
|
+
if (status === 'in-progress') {
|
|
589
|
+
return 'editable';
|
|
590
|
+
}
|
|
591
|
+
return 'unavailable';
|
|
592
|
+
}
|
|
593
|
+
/** Status plugin values are a name string or an object with `name` / `id`. */
|
|
594
|
+
function readStatusName(value, seen) {
|
|
595
|
+
if (typeof value === 'string') {
|
|
596
|
+
return value.trim();
|
|
597
|
+
}
|
|
598
|
+
if (value == null || typeof value !== 'object' || Array.isArray(value)) {
|
|
599
|
+
return '';
|
|
600
|
+
}
|
|
601
|
+
if (seen?.has(value)) {
|
|
602
|
+
return '';
|
|
603
|
+
}
|
|
604
|
+
const next = seen ?? new Set();
|
|
605
|
+
next.add(value);
|
|
606
|
+
const record = value;
|
|
607
|
+
return (readStatusName(record['name'], next) ||
|
|
608
|
+
readStatusName(record['id'], next) ||
|
|
609
|
+
readStatusName(record['statusId'], next) ||
|
|
610
|
+
readStatusName(record['status'], next));
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* In Progress cards show Open Form, then Sign Off.
|
|
614
|
+
* Completed cards keep Open Form and drop Sign Off. Other actions, including History, stay where they are.
|
|
615
|
+
*/
|
|
616
|
+
function applyIntervalWorkOrderCardActions(actions, mode, input) {
|
|
617
|
+
const openForm = buildIntervalWorkOrderOpenFormAction(input);
|
|
618
|
+
const desired = mode === 'in-progress'
|
|
619
|
+
? [openForm, buildIntervalWorkOrderSignOffAction(input)]
|
|
620
|
+
: [openForm];
|
|
621
|
+
const prefixSource = Array.isArray(actions?.prefix) ? actions.prefix : [];
|
|
622
|
+
const suffixSource = Array.isArray(actions?.suffix) ? actions.suffix : [];
|
|
623
|
+
let changed = false;
|
|
624
|
+
let placed = false;
|
|
625
|
+
const isManaged = (item) => isIntervalStartFlowAction(item) || isIntervalOpenFormAction(item) || isIntervalSignOffAction(item);
|
|
626
|
+
const rewrite = (list) => {
|
|
627
|
+
const next = [];
|
|
628
|
+
for (const item of list) {
|
|
629
|
+
if (isManaged(item)) {
|
|
630
|
+
changed = true;
|
|
631
|
+
if (!placed) {
|
|
632
|
+
next.push(...desired);
|
|
633
|
+
placed = true;
|
|
634
|
+
}
|
|
635
|
+
continue;
|
|
636
|
+
}
|
|
637
|
+
next.push(item);
|
|
638
|
+
}
|
|
639
|
+
return next;
|
|
640
|
+
};
|
|
641
|
+
const prefix = rewrite(prefixSource);
|
|
642
|
+
const suffix = rewrite(suffixSource);
|
|
643
|
+
if (!placed) {
|
|
644
|
+
suffix.push(...desired);
|
|
645
|
+
changed = true;
|
|
646
|
+
}
|
|
647
|
+
return { prefix, suffix, changed: changed || !sameJson(actions, { prefix, suffix }) };
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Cancellation from workflow-activity:sign-off is success:true with metadata.outcome Cancelled.
|
|
651
|
+
* Only an explicit Signed outcome with a signature continues.
|
|
652
|
+
*/
|
|
653
|
+
function readSignOffActivityOutcome(result) {
|
|
654
|
+
const outcome = text$1(result?.metadata?.outcome);
|
|
655
|
+
if (result?.success === false) {
|
|
656
|
+
return outcome === 'Cancelled' ? 'Cancelled' : 'Failed';
|
|
657
|
+
}
|
|
658
|
+
if (!result || outcome === 'Cancelled' || outcome !== 'Signed') {
|
|
659
|
+
return 'Cancelled';
|
|
660
|
+
}
|
|
661
|
+
const data = isRecord(result.data) ? result.data : null;
|
|
662
|
+
return text$1(data?.['signature']) ? 'Signed' : 'Cancelled';
|
|
663
|
+
}
|
|
664
|
+
function rewriteIntervalCardBookmarks(input) {
|
|
665
|
+
const workflowInstance = isRecord(input.instance['workflowInstance'])
|
|
666
|
+
? input.instance['workflowInstance']
|
|
667
|
+
: input.instance;
|
|
668
|
+
const bookmarks = readBookmarkList(workflowInstance['bookmarks']);
|
|
669
|
+
const definitionId = text$1(input.instance['definitionId']) || text$1(workflowInstance['definitionId']);
|
|
670
|
+
const checklist = readIntervalChecklistId(input.instance, readChecklistFromBookmarks(bookmarks));
|
|
671
|
+
const usageKinds = readInspectionUsageKinds(input.instance).join(',');
|
|
672
|
+
const selected = new Set(selectIntervalBookmarks(bookmarks, input.workOrderId, text$1(input.sourceBookmarkId), definitionId).map((bookmark) => text$1(bookmark['id'])));
|
|
673
|
+
if (selected.size === 0) {
|
|
674
|
+
return { bookmarks, changed: false };
|
|
675
|
+
}
|
|
676
|
+
const inspectionCard = definitionId === AXM_INSPECTION_WORK_ORDER_WORKFLOW_NAME;
|
|
677
|
+
const description = input.mode === 'cancelled'
|
|
678
|
+
? inspectionCard
|
|
679
|
+
? '@maintenance-management:work-orders.tasks.inspection.cancelled-description'
|
|
680
|
+
: AXM_INTERVAL_CANCELLED_TASK_DESCRIPTION
|
|
681
|
+
: inspectionCard
|
|
682
|
+
? input.mode === 'completed'
|
|
683
|
+
? '@maintenance-management:work-orders.tasks.inspection.completed-description'
|
|
684
|
+
: '@maintenance-management:work-orders.tasks.inspection.in-progress-description'
|
|
685
|
+
: input.mode === 'completed'
|
|
686
|
+
? AXM_INTERVAL_COMPLETED_TASK_DESCRIPTION
|
|
687
|
+
: AXM_INTERVAL_IN_PROGRESS_TASK_DESCRIPTION;
|
|
688
|
+
const statusId = input.mode === 'completed' ? 'completed' : input.mode === 'cancelled' ? 'cancelled' : 'in-progress';
|
|
689
|
+
let changed = false;
|
|
690
|
+
const next = bookmarks.map((bookmark) => {
|
|
691
|
+
if (!selected.has(text$1(bookmark['id']))) {
|
|
692
|
+
return bookmark;
|
|
693
|
+
}
|
|
694
|
+
const payload = readPayload(bookmark);
|
|
695
|
+
if (!payload) {
|
|
696
|
+
return bookmark;
|
|
697
|
+
}
|
|
698
|
+
const before = JSON.stringify(payload);
|
|
699
|
+
if (input.mode === 'in-progress' && text$1(input.assigneeUserId)) {
|
|
700
|
+
payload['assignedUserIds'] = [text$1(input.assigneeUserId)];
|
|
701
|
+
}
|
|
702
|
+
const context = isRecord(payload['context']) ? { ...payload['context'] } : {};
|
|
703
|
+
const actions = isRecord(payload['actions']) ? payload['actions'] : {};
|
|
704
|
+
const replaced = applyIntervalWorkOrderCardActions({
|
|
705
|
+
prefix: Array.isArray(actions['prefix']) ? actions['prefix'] : [],
|
|
706
|
+
suffix: Array.isArray(actions['suffix']) ? actions['suffix'] : [],
|
|
707
|
+
}, input.mode, { workOrderId: input.workOrderId, checklist, ...(usageKinds ? { usageKinds } : {}) });
|
|
708
|
+
payload['actions'] = { prefix: replaced.prefix, suffix: replaced.suffix };
|
|
709
|
+
payload['description'] = description;
|
|
710
|
+
if (text$1(input.dueDate)) {
|
|
711
|
+
payload['dueDate'] = text$1(input.dueDate);
|
|
712
|
+
}
|
|
713
|
+
if (input.mode === 'cancelled') {
|
|
714
|
+
payload['waitingResolved'] = true;
|
|
715
|
+
payload['resolvedReason'] = text$1(input.resolvedReason) || 'deadline-expiry';
|
|
716
|
+
}
|
|
717
|
+
payload['context'] = {
|
|
718
|
+
...context,
|
|
719
|
+
workOrderId: input.workOrderId,
|
|
720
|
+
statusId,
|
|
721
|
+
...(checklist ? { checklist } : {}),
|
|
722
|
+
...(usageKinds ? { usageKinds } : {}),
|
|
723
|
+
};
|
|
724
|
+
if (JSON.stringify(payload) !== before) {
|
|
725
|
+
changed = true;
|
|
726
|
+
}
|
|
727
|
+
return {
|
|
728
|
+
...bookmark,
|
|
729
|
+
payload,
|
|
730
|
+
payloadJson: JSON.stringify(payload),
|
|
731
|
+
};
|
|
732
|
+
});
|
|
733
|
+
return { bookmarks: next, changed };
|
|
734
|
+
}
|
|
735
|
+
function readBookmarkList(value) {
|
|
736
|
+
if (!Array.isArray(value)) {
|
|
737
|
+
return [];
|
|
738
|
+
}
|
|
739
|
+
return value.map((item) => (isRecord(item) ? { ...item } : null)).filter((item) => !!item);
|
|
740
|
+
}
|
|
741
|
+
function readPayload(bookmark) {
|
|
742
|
+
if (isRecord(bookmark['payload'])) {
|
|
743
|
+
return { ...bookmark['payload'] };
|
|
744
|
+
}
|
|
745
|
+
const payloadJson = bookmark['payloadJson'];
|
|
746
|
+
if (typeof payloadJson !== 'string' || !payloadJson.trim()) {
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
try {
|
|
750
|
+
const parsed = JSON.parse(payloadJson);
|
|
751
|
+
return isRecord(parsed) ? { ...parsed } : null;
|
|
752
|
+
}
|
|
753
|
+
catch {
|
|
754
|
+
return null;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function readChecklistFromBookmarks(bookmarks) {
|
|
758
|
+
for (const bookmark of bookmarks) {
|
|
759
|
+
const payload = readPayload(bookmark);
|
|
760
|
+
const fromActions = readChecklistIdFromTaskActions(payload?.['actions']);
|
|
761
|
+
if (fromActions) {
|
|
762
|
+
return fromActions;
|
|
763
|
+
}
|
|
764
|
+
const context = isRecord(payload?.['context']) ? payload?.['context'] : null;
|
|
765
|
+
const fromContext = text$1(context?.['checklist']);
|
|
766
|
+
if (fromContext) {
|
|
767
|
+
return fromContext;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return '';
|
|
771
|
+
}
|
|
772
|
+
function selectIntervalBookmarks(bookmarks, workOrderId, sourceBookmarkId, definitionId) {
|
|
773
|
+
const active = bookmarks.filter((bookmark) => bookmark['isConsumed'] !== true && bookmark['consumed'] !== true);
|
|
774
|
+
if (sourceBookmarkId) {
|
|
775
|
+
const byId = active.filter((bookmark) => text$1(bookmark['id']) === sourceBookmarkId);
|
|
776
|
+
if (byId.length > 0) {
|
|
777
|
+
return byId;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (definitionId !== AXM_INTERVAL_WORK_ORDER_WORKFLOW_NAME &&
|
|
781
|
+
definitionId !== AXM_INSPECTION_WORK_ORDER_WORKFLOW_NAME) {
|
|
782
|
+
return [];
|
|
783
|
+
}
|
|
784
|
+
const byWorkOrder = active.filter((bookmark) => bookmarkReferencesWorkOrder(bookmark, workOrderId));
|
|
785
|
+
if (byWorkOrder.length > 0) {
|
|
786
|
+
return byWorkOrder;
|
|
787
|
+
}
|
|
788
|
+
const humanTasks = active.filter((bookmark) => {
|
|
789
|
+
if (text$1(bookmark['activityId']) === AXM_INTERVAL_DUE_ACTIVITY_ID) {
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
const payload = readPayload(bookmark);
|
|
793
|
+
return text$1(payload?.['activityType']) === 'workflow-activity:human-task';
|
|
794
|
+
});
|
|
795
|
+
return humanTasks.length === 1 ? humanTasks : [];
|
|
796
|
+
}
|
|
797
|
+
function bookmarkReferencesWorkOrder(bookmark, workOrderId) {
|
|
798
|
+
const payload = readPayload(bookmark);
|
|
799
|
+
const context = isRecord(payload?.['context']) ? payload?.['context'] : null;
|
|
800
|
+
return text$1(context?.['workOrderId']) === workOrderId;
|
|
801
|
+
}
|
|
802
|
+
function sameJson(left, right) {
|
|
803
|
+
return JSON.stringify(left ?? null) === JSON.stringify(right ?? null);
|
|
804
|
+
}
|
|
805
|
+
//#endregion
|
|
806
|
+
//#region ----- Occurrence identity -----
|
|
807
|
+
function text$1(value) {
|
|
808
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
809
|
+
}
|
|
810
|
+
function createdStamp(row) {
|
|
811
|
+
const auditAt = row.auditInfo?.created?.at;
|
|
812
|
+
if (typeof auditAt === 'string' && auditAt.trim()) {
|
|
813
|
+
return auditAt.trim();
|
|
814
|
+
}
|
|
815
|
+
if (auditAt instanceof Date && !Number.isNaN(auditAt.getTime())) {
|
|
816
|
+
return auditAt.toISOString();
|
|
817
|
+
}
|
|
818
|
+
if (typeof row.createdAt === 'string' && row.createdAt.trim()) {
|
|
819
|
+
return row.createdAt.trim();
|
|
820
|
+
}
|
|
821
|
+
return '';
|
|
822
|
+
}
|
|
823
|
+
/** Earliest created row, then lowest id. Rows without an id are ignored. */
|
|
824
|
+
function pickCanonicalChecklistRow(rows) {
|
|
825
|
+
const withId = rows.filter((row) => text$1(row.id));
|
|
826
|
+
if (withId.length === 0) {
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
return [...withId].sort((left, right) => {
|
|
830
|
+
const leftAt = createdStamp(left);
|
|
831
|
+
const rightAt = createdStamp(right);
|
|
832
|
+
if (leftAt && rightAt && leftAt !== rightAt) {
|
|
833
|
+
return leftAt < rightAt ? -1 : 1;
|
|
834
|
+
}
|
|
835
|
+
if (leftAt && !rightAt) {
|
|
836
|
+
return -1;
|
|
837
|
+
}
|
|
838
|
+
if (!leftAt && rightAt) {
|
|
839
|
+
return 1;
|
|
840
|
+
}
|
|
841
|
+
const leftId = text$1(left.id);
|
|
842
|
+
const rightId = text$1(right.id);
|
|
843
|
+
if (leftId === rightId) {
|
|
844
|
+
return 0;
|
|
845
|
+
}
|
|
846
|
+
return leftId < rightId ? -1 : 1;
|
|
847
|
+
})[0];
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* A checklist occurrence is this work order plus its template questionnaire and the session's own case.
|
|
851
|
+
* Questionnaire id alone is not enough.
|
|
852
|
+
*/
|
|
853
|
+
function isWorkOrderChecklistOccurrence(input) {
|
|
854
|
+
const workOrderId = text$1(input.workOrderId);
|
|
855
|
+
const questionnaireId = text$1(input.questionnaireId);
|
|
856
|
+
const subjectType = text$1(input.subjectType);
|
|
857
|
+
const caseId = text$1(input.assessmentCase?.['id']);
|
|
858
|
+
const sessionCaseId = text$1(input.session?.['caseId']);
|
|
859
|
+
if (!workOrderId || !questionnaireId || !subjectType || !caseId || !sessionCaseId || sessionCaseId !== caseId) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
if (text$1(input.assessmentCase?.['questionnaireId']) !== questionnaireId) {
|
|
863
|
+
return false;
|
|
864
|
+
}
|
|
865
|
+
const subject = isRecord(input.assessmentCase?.['subjectRef'])
|
|
866
|
+
? input.assessmentCase?.['subjectRef']
|
|
867
|
+
: null;
|
|
868
|
+
return text$1(subject?.['type']) === subjectType && text$1(subject?.['id']) === workOrderId;
|
|
869
|
+
}
|
|
870
|
+
//#endregion
|
|
871
|
+
|
|
872
|
+
const AXMMaintenanceManagementFeatureKeys = {
|
|
873
|
+
Management: 'MaintenanceManagement:Feature:Management',
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
const AXMMaintenanceManagementMenuKeys = {
|
|
877
|
+
Root: 'MaintenanceManagement:Menu',
|
|
878
|
+
// MainPlanEquipmentMaintenanceSectionGroup: 'MaintenanceManagement:Menu:MainPlanEquipment:MaintenanceSectionGroup',
|
|
879
|
+
// PlanEquipmentMaintenanceSectionGroup: 'MaintenanceManagement:Menu:PlantEquipment:MaintenanceSectionGroup',
|
|
880
|
+
Activities: 'MaintenanceManagement:Menu:Activities',
|
|
881
|
+
Failures: 'MaintenanceManagement:Menu:Failures',
|
|
882
|
+
ActivityCategories: 'MaintenanceManagement:Menu:ActivityCategories',
|
|
883
|
+
ActivityTypes: 'MaintenanceManagement:Menu:ActivityTypes',
|
|
884
|
+
MaintenanceTypes: 'MaintenanceManagement:Menu:MaintenanceTypes',
|
|
885
|
+
MaintenancePlans: 'MaintenanceManagement:Menu:MaintenancePlans',
|
|
886
|
+
MaintenancePlansList: 'MaintenanceManagement:Menu:MaintenancePlans:List',
|
|
887
|
+
WorkPackages: 'MaintenanceManagement:Menu:WorkPackages',
|
|
888
|
+
WorkOrders: 'MaintenanceManagement:Menu:WorkOrders',
|
|
889
|
+
WorkReports: 'MaintenanceManagement:Menu:WorkReports',
|
|
890
|
+
MaintenanceTemplates: 'MaintenanceManagement:Menu:MaintenanceTemplates',
|
|
891
|
+
MaintenanceTemplateActivityTypes: 'MaintenanceManagement:Menu:MaintenanceTemplateActivityTypes',
|
|
892
|
+
MaintenanceTemplateResources: 'MaintenanceManagement:Menu:MaintenanceTemplateResources',
|
|
893
|
+
MaintenanceTemplateFailureModes: 'MaintenanceManagement:Menu:MaintenanceTemplateFailureModes',
|
|
894
|
+
FailureCauses: 'MaintenanceManagement:Menu:FailureCauses',
|
|
895
|
+
FailureMechanisms: 'MaintenanceManagement:Menu:FailureMechanisms',
|
|
896
|
+
FailureDetections: 'MaintenanceManagement:Menu:FailureDetections',
|
|
897
|
+
FailureEffects: 'MaintenanceManagement:Menu:FailureEffects',
|
|
898
|
+
FailureSeverities: 'MaintenanceManagement:Menu:FailureSeverities',
|
|
899
|
+
FailureTypes: 'MaintenanceManagement:Menu:FailureTypes',
|
|
900
|
+
FailureModes: 'MaintenanceManagement:Menu:FailureModes',
|
|
901
|
+
FailureRegisters: 'MaintenanceManagement:Menu:FailureRegisters',
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Assets & Maintenance capabilities used by this module.
|
|
906
|
+
* Domain capability keys for this module. Root groups live in `AXPCommonPermissionGroupKeys` (common contracts).
|
|
907
|
+
*/
|
|
908
|
+
const AXPAssetsMaintenancePermissionKeys = {
|
|
909
|
+
Access: 'AssetsMaintenance:Permission:Access',
|
|
910
|
+
MaintainAssets: 'AssetsMaintenance:Permission:MaintainAssets',
|
|
911
|
+
MaintainMaintenance: 'AssetsMaintenance:Permission:MaintainMaintenance',
|
|
912
|
+
Setup: 'AssetsMaintenance:Permission:Setup',
|
|
913
|
+
};
|
|
914
|
+
const cap = AXPAssetsMaintenancePermissionKeys.MaintainMaintenance;
|
|
915
|
+
function entityCrud() {
|
|
916
|
+
return {
|
|
917
|
+
Management: cap,
|
|
918
|
+
View: cap,
|
|
919
|
+
Create: cap,
|
|
920
|
+
Update: cap,
|
|
921
|
+
Delete: cap,
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* @deprecated Prefer {@link AXPAssetsMaintenancePermissionKeys}.
|
|
926
|
+
* Legacy nested shape kept so existing imports compile during migration.
|
|
927
|
+
*/
|
|
928
|
+
const AXMMaintenanceManagementPermissionKeys = {
|
|
929
|
+
MaintenanceManagement: {
|
|
930
|
+
Management: cap,
|
|
931
|
+
ActivityCategory: entityCrud(),
|
|
932
|
+
MaintenanceType: entityCrud(),
|
|
933
|
+
MaintenanceTemplate: entityCrud(),
|
|
934
|
+
MaintenancePlan: entityCrud(),
|
|
935
|
+
WorkPackage: entityCrud(),
|
|
936
|
+
WorkOrder: entityCrud(),
|
|
937
|
+
WorkReport: entityCrud(),
|
|
938
|
+
MaintenanceTemplateActivityType: entityCrud(),
|
|
939
|
+
MaintenanceTemplateResource: entityCrud(),
|
|
940
|
+
MaintenanceTemplateFailureMode: entityCrud(),
|
|
941
|
+
ActivityType: entityCrud(),
|
|
942
|
+
ActivityTypeAssetType: entityCrud(),
|
|
943
|
+
ActivityTypeResource: entityCrud(),
|
|
944
|
+
FailureCause: entityCrud(),
|
|
945
|
+
FailureMechanism: entityCrud(),
|
|
946
|
+
FailureDetection: entityCrud(),
|
|
947
|
+
FailureEffect: entityCrud(),
|
|
948
|
+
FailureSeverity: entityCrud(),
|
|
949
|
+
FailureType: entityCrud(),
|
|
950
|
+
FailureMode: entityCrud(),
|
|
951
|
+
FailureRegister: entityCrud(),
|
|
952
|
+
},
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
//#region ---- Status names ----
|
|
956
|
+
var AXMWorkOrderStatus;
|
|
957
|
+
(function (AXMWorkOrderStatus) {
|
|
958
|
+
AXMWorkOrderStatus["Planned"] = "planned";
|
|
959
|
+
AXMWorkOrderStatus["Scheduled"] = "scheduled";
|
|
960
|
+
AXMWorkOrderStatus["Assigned"] = "assigned";
|
|
961
|
+
AXMWorkOrderStatus["InProgress"] = "in-progress";
|
|
962
|
+
AXMWorkOrderStatus["OnHold"] = "on-hold";
|
|
963
|
+
AXMWorkOrderStatus["Completed"] = "completed";
|
|
964
|
+
AXMWorkOrderStatus["SignedOff"] = "signed-off";
|
|
965
|
+
AXMWorkOrderStatus["Cancelled"] = "cancelled";
|
|
966
|
+
})(AXMWorkOrderStatus || (AXMWorkOrderStatus = {}));
|
|
967
|
+
//#endregion
|
|
968
|
+
|
|
969
|
+
//#region ---- Source type enum ----
|
|
970
|
+
var AXMWorkOrderSourceType;
|
|
971
|
+
(function (AXMWorkOrderSourceType) {
|
|
972
|
+
AXMWorkOrderSourceType["Manual"] = "manual";
|
|
973
|
+
AXMWorkOrderSourceType["MaintenancePlan"] = "maintenance-plan";
|
|
974
|
+
AXMWorkOrderSourceType["CreateAsset"] = "create-asset";
|
|
975
|
+
AXMWorkOrderSourceType["FailureRegister"] = "failure-register";
|
|
976
|
+
})(AXMWorkOrderSourceType || (AXMWorkOrderSourceType = {}));
|
|
977
|
+
//#endregion
|
|
978
|
+
|
|
979
|
+
//#region ---- Status names ----
|
|
980
|
+
var AXMFailureRegisterStatus;
|
|
981
|
+
(function (AXMFailureRegisterStatus) {
|
|
982
|
+
AXMFailureRegisterStatus["Reported"] = "reported";
|
|
983
|
+
AXMFailureRegisterStatus["UnderReview"] = "underReview";
|
|
984
|
+
AXMFailureRegisterStatus["WorkOrderRequired"] = "workOrderRequired";
|
|
985
|
+
AXMFailureRegisterStatus["WorkOrderCreated"] = "workOrderCreated";
|
|
986
|
+
AXMFailureRegisterStatus["InProgress"] = "inProgress";
|
|
987
|
+
AXMFailureRegisterStatus["Resolved"] = "resolved";
|
|
988
|
+
AXMFailureRegisterStatus["FollowUpRequired"] = "followUpRequired";
|
|
989
|
+
AXMFailureRegisterStatus["Rejected"] = "rejected";
|
|
990
|
+
AXMFailureRegisterStatus["Duplicate"] = "duplicate";
|
|
991
|
+
AXMFailureRegisterStatus["Closed"] = "closed";
|
|
992
|
+
})(AXMFailureRegisterStatus || (AXMFailureRegisterStatus = {}));
|
|
993
|
+
//#endregion
|
|
994
|
+
|
|
995
|
+
//#endregion
|
|
996
|
+
//#region ----- Snapshot -----
|
|
997
|
+
function readCompletion(value) {
|
|
998
|
+
if (!Array.isArray(value)) {
|
|
999
|
+
return [];
|
|
1000
|
+
}
|
|
1001
|
+
const readings = [];
|
|
1002
|
+
for (const item of value) {
|
|
1003
|
+
if (!item || typeof item !== 'object') {
|
|
1004
|
+
continue;
|
|
1005
|
+
}
|
|
1006
|
+
const record = item;
|
|
1007
|
+
const kind = record['kind'];
|
|
1008
|
+
const unit = record['unit'];
|
|
1009
|
+
const currentValue = record['currentValue'];
|
|
1010
|
+
const capturedAt = record['capturedAt'];
|
|
1011
|
+
if (typeof kind !== 'string' ||
|
|
1012
|
+
!isAXMMaintenanceMeterKind(kind) ||
|
|
1013
|
+
typeof unit !== 'string' ||
|
|
1014
|
+
!isAXMMaintenanceIntervalUnitForKind(kind, unit) ||
|
|
1015
|
+
typeof currentValue !== 'number' ||
|
|
1016
|
+
typeof capturedAt !== 'string') {
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
1019
|
+
readings.push({ kind, unit: unit, currentValue, capturedAt });
|
|
1020
|
+
}
|
|
1021
|
+
return readings;
|
|
1022
|
+
}
|
|
1023
|
+
function readDrafts(value, capturedAt) {
|
|
1024
|
+
if (!Array.isArray(value)) {
|
|
1025
|
+
return [];
|
|
1026
|
+
}
|
|
1027
|
+
const readings = [];
|
|
1028
|
+
for (const item of value) {
|
|
1029
|
+
if (!item || typeof item !== 'object') {
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
const record = item;
|
|
1033
|
+
const kind = record['kind'];
|
|
1034
|
+
const unit = record['unit'];
|
|
1035
|
+
const rawValue = record['value'] ?? record['currentValue'];
|
|
1036
|
+
if (typeof kind !== 'string' || !isAXMMaintenanceMeterKind(kind) || typeof unit !== 'string' || typeof rawValue !== 'number') {
|
|
1037
|
+
continue;
|
|
1038
|
+
}
|
|
1039
|
+
if (!isAXMMaintenanceIntervalUnitForKind(kind, unit)) {
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
const readingAt = typeof record['readingAt'] === 'string' && record['readingAt'].trim() ? record['readingAt'] : capturedAt;
|
|
1043
|
+
readings.push({
|
|
1044
|
+
kind: kind,
|
|
1045
|
+
unit: unit,
|
|
1046
|
+
currentValue: rawValue,
|
|
1047
|
+
capturedAt: readingAt,
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
return readings;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Completed work orders keep the readings captured at completion.
|
|
1054
|
+
* A draft submitted with the task wins over a later live asset meter.
|
|
1055
|
+
* Live meters are used only when the task has not submitted readings yet.
|
|
1056
|
+
*/
|
|
1057
|
+
function resolveWorkOrderCompletionUsageSnapshot(input) {
|
|
1058
|
+
const existing = readCompletion(input.existing);
|
|
1059
|
+
if (existing.length > 0) {
|
|
1060
|
+
return { readings: existing, source: 'existing' };
|
|
1061
|
+
}
|
|
1062
|
+
const drafts = readDrafts(input.drafts, input.capturedAt);
|
|
1063
|
+
if (drafts.length > 0) {
|
|
1064
|
+
return { readings: drafts, source: 'submitted' };
|
|
1065
|
+
}
|
|
1066
|
+
return { readings: [...input.live], source: 'live' };
|
|
1067
|
+
}
|
|
1068
|
+
function missingRequiredTaskReadings(requiredKinds, drafts) {
|
|
1069
|
+
const present = new Set(readDrafts(drafts, new Date(0).toISOString()).map((reading) => reading.kind));
|
|
1070
|
+
return requiredKinds.filter((kind) => isAXMMaintenanceMeterKind(kind) && !present.has(kind));
|
|
1071
|
+
}
|
|
1072
|
+
//#endregion
|
|
1073
|
+
|
|
1074
|
+
//#region ----- Constants -----
|
|
1075
|
+
const AXM_SCHEDULED_OCCURRENCE_BATCH_SIZE = 25;
|
|
1076
|
+
const AXM_DEADLINE_EXPIRY_REASON = 'deadline-expiry';
|
|
1077
|
+
const AXM_SCHEDULE_CHANGED_REASON = 'schedule-changed';
|
|
1078
|
+
const CLAIM_LEASE_MS = 2 * 60 * 1000;
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region ----- Identity -----
|
|
1081
|
+
function scheduledOccurrenceKey(planId, scheduledStart) {
|
|
1082
|
+
return `${planId}:${scheduledStart}`;
|
|
1083
|
+
}
|
|
1084
|
+
function meterOccurrenceKey(planId, signature) {
|
|
1085
|
+
return `${planId}:meter:${signature}`;
|
|
1086
|
+
}
|
|
1087
|
+
/** Stable id so two runners inserting the same occurrence collide instead of duplicating it. */
|
|
1088
|
+
function stableOccurrenceId(key) {
|
|
1089
|
+
let hash = 0x811c9dc5;
|
|
1090
|
+
for (let index = 0; index < key.length; index += 1) {
|
|
1091
|
+
hash ^= key.charCodeAt(index);
|
|
1092
|
+
hash = Math.imul(hash, 0x01000193);
|
|
1093
|
+
}
|
|
1094
|
+
const hex = (hash >>> 0).toString(16).padStart(8, '0').repeat(4).slice(0, 32);
|
|
1095
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-a${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
|
|
1096
|
+
}
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region ----- Reconcile -----
|
|
1099
|
+
function reconcileScheduleOccurrences(desired, existing) {
|
|
1100
|
+
const desiredByKey = new Map(desired.map((item) => [item.key, item]));
|
|
1101
|
+
const desiredByStart = new Map(desired.map((item) => [Date.parse(item.scheduledStart), item]));
|
|
1102
|
+
const consumed = new Set();
|
|
1103
|
+
const resume = [];
|
|
1104
|
+
const supersede = [];
|
|
1105
|
+
for (const row of existing) {
|
|
1106
|
+
const start = Date.parse(row.scheduledStart ?? '');
|
|
1107
|
+
const match = (row.occurrenceKey && desiredByKey.get(row.occurrenceKey))
|
|
1108
|
+
|| (Number.isFinite(start) ? desiredByStart.get(start) : undefined);
|
|
1109
|
+
if (match) {
|
|
1110
|
+
consumed.add(match.key);
|
|
1111
|
+
if (!row.workflowInstanceId && !isHistory(row.statusId)) {
|
|
1112
|
+
resume.push({ id: row.id, occurrence: match });
|
|
1113
|
+
}
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
if (row.autoGenerated && row.occurrenceKey && !isHistory(row.statusId) && !isStarted(row.statusId)) {
|
|
1117
|
+
supersede.push(row);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return {
|
|
1121
|
+
create: desired.filter((item) => !consumed.has(item.key)),
|
|
1122
|
+
resume,
|
|
1123
|
+
supersede,
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function takeOccurrenceBatch(items, cursor, size = AXM_SCHEDULED_OCCURRENCE_BATCH_SIZE) {
|
|
1127
|
+
return items.filter((item) => item.index >= cursor).slice(0, size);
|
|
1128
|
+
}
|
|
1129
|
+
function isHistory(statusId) {
|
|
1130
|
+
return statusId === AXMWorkOrderStatus.Completed
|
|
1131
|
+
|| statusId === AXMWorkOrderStatus.SignedOff
|
|
1132
|
+
|| statusId === AXMWorkOrderStatus.Cancelled;
|
|
1133
|
+
}
|
|
1134
|
+
function isStarted(statusId) {
|
|
1135
|
+
return statusId === AXMWorkOrderStatus.InProgress || statusId === AXMWorkOrderStatus.OnHold;
|
|
1136
|
+
}
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region ----- Window -----
|
|
1139
|
+
function scheduledTaskWindow(input) {
|
|
1140
|
+
const start = Date.parse(text(input.scheduledStart));
|
|
1141
|
+
const deadline = Date.parse(text(input.signOffDeadline));
|
|
1142
|
+
const hasStart = Number.isFinite(start);
|
|
1143
|
+
const hasDeadline = Number.isFinite(deadline);
|
|
1144
|
+
if (!hasStart && !hasDeadline) {
|
|
1145
|
+
return 'unscheduled';
|
|
1146
|
+
}
|
|
1147
|
+
const now = input.now.getTime();
|
|
1148
|
+
if (hasStart && now < start) {
|
|
1149
|
+
return 'before';
|
|
1150
|
+
}
|
|
1151
|
+
if (hasDeadline && now > deadline) {
|
|
1152
|
+
return 'after';
|
|
1153
|
+
}
|
|
1154
|
+
return 'open';
|
|
1155
|
+
}
|
|
1156
|
+
function canMutateScheduledTask(input) {
|
|
1157
|
+
if (!text(input.occurrenceKey) && !text(input.signOffDeadline)) {
|
|
1158
|
+
return true;
|
|
1159
|
+
}
|
|
1160
|
+
return scheduledTaskWindow(input) === 'open';
|
|
1161
|
+
}
|
|
1162
|
+
function isDeadlineCancellationPatch(patch) {
|
|
1163
|
+
const reason = text(patch['cancellationReason']);
|
|
1164
|
+
return text(patch['statusId']) === AXMWorkOrderStatus.Cancelled
|
|
1165
|
+
&& (reason === AXM_DEADLINE_EXPIRY_REASON || reason === AXM_SCHEDULE_CHANGED_REASON)
|
|
1166
|
+
&& typeof patch['cancelledAt'] === 'string'
|
|
1167
|
+
&& !('draftUsageReadings' in patch)
|
|
1168
|
+
&& !('completionUsageReadings' in patch)
|
|
1169
|
+
&& !('intervalStatesProgression' in patch);
|
|
1170
|
+
}
|
|
1171
|
+
function buildDeadlineCancellationPatch(claim, cancelledAt) {
|
|
1172
|
+
return {
|
|
1173
|
+
statusId: AXMWorkOrderStatus.Cancelled,
|
|
1174
|
+
cancellationReason: claim.outcome === AXM_SCHEDULE_CHANGED_REASON ? AXM_SCHEDULE_CHANGED_REASON : AXM_DEADLINE_EXPIRY_REASON,
|
|
1175
|
+
cancelledAt,
|
|
1176
|
+
outcomeClaim: claim,
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
function decideScheduledOutcome(input) {
|
|
1180
|
+
const status = text(input.statusId);
|
|
1181
|
+
if (status === AXMWorkOrderStatus.Completed || status === AXMWorkOrderStatus.SignedOff) {
|
|
1182
|
+
return input.incoming === 'signed' ? 'accept' : 'reject';
|
|
1183
|
+
}
|
|
1184
|
+
if (status === AXMWorkOrderStatus.Cancelled && input.incoming === 'signed') {
|
|
1185
|
+
return 'reject';
|
|
1186
|
+
}
|
|
1187
|
+
const claim = input.claim;
|
|
1188
|
+
if (!claim || !text(claim.outcome) || !text(claim.at)) {
|
|
1189
|
+
return 'accept';
|
|
1190
|
+
}
|
|
1191
|
+
const age = input.now.getTime() - Date.parse(claim.at);
|
|
1192
|
+
const fresh = Number.isFinite(age) && age >= 0 && age < (input.leaseMs ?? CLAIM_LEASE_MS);
|
|
1193
|
+
if (!fresh || claim.outcome === input.incoming) {
|
|
1194
|
+
return 'accept';
|
|
1195
|
+
}
|
|
1196
|
+
return 'reject';
|
|
1197
|
+
}
|
|
1198
|
+
function text(value) {
|
|
1199
|
+
return typeof value === 'string' ? value.trim() : '';
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
|
|
421
1203
|
//#region ---- Root Configuration ----
|
|
422
1204
|
const config = {
|
|
423
1205
|
i18n: 'maintenance-management',
|
|
@@ -793,5 +1575,5 @@ function resolveMaintenanceIntervalStates(value) {
|
|
|
793
1575
|
* Generated bundle index. Do not edit.
|
|
794
1576
|
*/
|
|
795
1577
|
|
|
796
|
-
export { AXMFailureRegisterStatus, AXMMaintenanceIntervalTriggerLogic, AXMMaintenanceIntervalUnit, AXMMaintenanceManagementCommandKeys, AXMMaintenanceManagementFeatureKeys, AXMMaintenanceManagementMenuKeys, AXMMaintenanceManagementPermissionKeys, AXMWorkOrderSourceType, AXMWorkOrderStatus, AXM_MAINTENANCE_INTERVAL_CHECK_COMMAND_KEY, AXM_MAINTENANCE_INTERVAL_KINDS, AXM_MAINTENANCE_INTERVAL_STATE_ERRORS, AXM_MAINTENANCE_INTERVAL_STATE_KINDS, AXM_MAINTENANCE_INTERVAL_WIDGET, AXPAssetsMaintenancePermissionKeys, MM_CATALOG_SCOPE_MN, MaintenanceManagementManifest, RootConfig, buildAXMMaintenanceIntervalConfig, defaultAXMMaintenanceIntervalUnit, draftFromAXMMaintenanceIntervalConfig, emptyAXMMaintenanceIntervalConfig, emptyAXMMaintenanceIntervalDraft, isAXMMaintenanceIntervalKind, isAXMMaintenanceIntervalUnitForKind, isAXMMaintenanceMeterKind, readIntervalDate, readMaintenanceIntervalStates, readMaintenancePlanCalendarSchedule, resolveMaintenanceIntervalStates };
|
|
1578
|
+
export { AXMFailureRegisterStatus, AXMMaintenanceIntervalTriggerLogic, AXMMaintenanceIntervalUnit, AXMMaintenanceManagementCommandKeys, AXMMaintenanceManagementFeatureKeys, AXMMaintenanceManagementMenuKeys, AXMMaintenanceManagementPermissionKeys, AXMWorkOrderSourceType, AXMWorkOrderStatus, AXM_DEADLINE_EXPIRY_REASON, AXM_INSPECTION_USAGE_KINDS_INPUT, AXM_INSPECTION_WORK_ORDER_WORKFLOW_NAME, AXM_INTERVAL_CANCELLED_TASK_DESCRIPTION, AXM_INTERVAL_CHECKLIST_CASE_ID, AXM_INTERVAL_CHECKLIST_CLAIM, AXM_INTERVAL_CHECKLIST_QUESTIONNAIRE_ID, AXM_INTERVAL_CHECKLIST_SESSION_ID, AXM_INTERVAL_COMPLETED_TASK_DESCRIPTION, AXM_INTERVAL_IN_PROGRESS_TASK_DESCRIPTION, AXM_INTERVAL_OPEN_FORM_ACTION_NAME, AXM_INTERVAL_SIGN_OFF_ACTION_NAME, AXM_INTERVAL_START_FLOW_ACTION_NAME, AXM_INTERVAL_WORK_ORDER_WORKFLOW_NAME, AXM_MAINTENANCE_INTERVAL_CHECK_COMMAND_KEY, AXM_MAINTENANCE_INTERVAL_KINDS, AXM_MAINTENANCE_INTERVAL_STATE_ERRORS, AXM_MAINTENANCE_INTERVAL_STATE_KINDS, AXM_MAINTENANCE_INTERVAL_WIDGET, AXM_SCHEDULED_OCCURRENCE_BATCH_SIZE, AXM_SCHEDULE_CHANGED_REASON, AXPAssetsMaintenancePermissionKeys, MM_CATALOG_SCOPE_MN, MaintenanceManagementManifest, RootConfig, applyIntervalWorkOrderCardActions, buildAXMMaintenanceIntervalConfig, buildDeadlineCancellationPatch, buildIntervalWorkOrderOpenFormAction, buildIntervalWorkOrderSignOffAction, canMutateScheduledTask, collectableUsageKinds, decideScheduledOutcome, defaultAXMMaintenanceIntervalUnit, draftFromAXMMaintenanceIntervalConfig, emptyAXMMaintenanceIntervalConfig, emptyAXMMaintenanceIntervalDraft, isAXMMaintenanceIntervalKind, isAXMMaintenanceIntervalUnitForKind, isAXMMaintenanceMeterKind, isDeadlineCancellationPatch, isIntervalOpenFormAction, isIntervalSignOffAction, isIntervalStartFlowAction, isWorkOrderChecklistOccurrence, meterOccurrenceKey, missingRequiredTaskReadings, pickCanonicalChecklistRow, readChecklistIdFromTaskActions, readInspectionUsageKinds, readIntervalChecklistId, readIntervalDate, readMaintenanceIntervalStates, readMaintenancePlanCalendarSchedule, readSignOffActivityOutcome, reconcileScheduleOccurrences, replaceIntervalStartFlowActions, resolveChecklistId, resolveInspectionUsageKinds, resolveIntervalChecklistViewerMode, resolveMaintenanceIntervalStates, resolveWorkOrderCompletionUsageSnapshot, rewriteIntervalCardBookmarks, scheduledOccurrenceKey, scheduledTaskWindow, stableOccurrenceId, takeOccurrenceBatch };
|
|
797
1579
|
//# sourceMappingURL=acorex-platform-module-maintenance-management-client-contracts.mjs.map
|