Skip to content
This repository was archived by the owner on Nov 12, 2026. It is now read-only.

Add SpencerMetrics Counter Management Features - #2

Merged
PropmanProphecy merged 1 commit into
mainfrom
Add-SpencerMetrics
Nov 10, 2026
Merged

PropmanProphecy merged 1 commit into
mainfrom
Add-SpencerMetrics

Conversation

@PropmanProphecy

Copy link
Copy Markdown
Contributor
  • Created "PVS SM Count FactBox" page to display count summaries.
  • Introduced "PVS SM Count Summary Buffer" temporary table for storing count data.
  • Developed "PVS SM Counter Entries" page for viewing counter entries.
  • Implemented "PVS SM Counter Entry" table to manage individual counter entries.
  • Added "PVS SM Counts Sum By UOM" query to aggregate counts by UOM.
  • Created "PVS SM Assign To Job Costing" page for assigning counts to job costing entries.
  • Developed "PVS SM Counter Worker" codeunit for processing counter data.
  • Implemented "PVS SM Session Manager" codeunit for managing session states.
  • Added "PVS SM Api Client" codeunit for handling API interactions with SpencerMetrics.
  • Created timer control add-in for periodic updates in the UI.
  • Extended "PVS SF Electronic Ticket" page to include count summary.
  • Extended "PVS Job Sheet" table to include SpencerMetrics key.

- Created "PVS SM Count FactBox" page to display count summaries.
- Introduced "PVS SM Count Summary Buffer" temporary table for storing count data.
- Developed "PVS SM Counter Entries" page for viewing counter entries.
- Implemented "PVS SM Counter Entry" table to manage individual counter entries.
- Added "PVS SM Counts Sum By UOM" query to aggregate counts by UOM.
- Created "PVS SM Assign To Job Costing" page for assigning counts to job costing entries.
- Developed "PVS SM Counter Worker" codeunit for processing counter data.
- Implemented "PVS SM Session Manager" codeunit for managing session states.
- Added "PVS SM Api Client" codeunit for handling API interactions with SpencerMetrics.
- Created timer control add-in for periodic updates in the UI.
- Extended "PVS SF Electronic Ticket" page to include count summary.
- Extended "PVS Job Sheet" table to include SpencerMetrics key.
Copilot AI balanced review requested due to automatic review settings November 10, 2026 16:16
@PropmanProphecy PropmanProphecy self-assigned this Nov 10, 2026
@github-actions

Copy link
Copy Markdown

Issue link validation failed - this is NOT a merge conflict. Could not find linked issues in the pull request description. Please make sure the pull request description contains a line that contains 'Fixes #' followed by the issue number being fixed (e.g. Fixes #123). The keywords Close/Closes/Closed, Fix/Fixes/Fixed, Resolve/Resolves/Resolved and Issue are also accepted (case-insensitive). Use that pattern for every issue you want to link. Once the description is updated, this check will re-run automatically.

@PropmanProphecy
PropmanProphecy merged commit 9ca1c49 into main Nov 10, 2026
4 of 5 checks passed
@PropmanProphecy
PropmanProphecy deleted the Add-SpencerMetrics branch November 10, 2026 16:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved compilation errors and critical allocation, parsing, and job-boundary defects can block the build, cause duplicate-key failures, and corrupt or lose production counts.

13 open issues
What changed in this PR

Adds a SpencerMetrics integration that collects machine counts and connects them to PrintVis shop-floor operations and job costing.

Changes:

  • Adds API polling, background session management, configuration, and session logging.
  • Introduces counter storage, live count summaries, and manual job-costing assignment.
  • Exposes order-sheet data through an API and adds installation, permissions, and project configuration.

Paths are relative to Apps/SpencerMetrics/PrintVis SpencerMetrics/.

File Description
src/​Utilities/​TimerAddIn/​timer.js Implements periodic UI refresh callbacks.
src/​Utilities/​TimerAddIn/​PVSSMTimerAddIn.ControlAddin.al Declares the timer control interface.
src/​Services/​PVSSMApiClient.Codeunit.al Authenticates, retrieves counters, and calculates deltas.
src/​PrintVisIntegration/​PVSSMSheet.TableExt.al Generates SpencerMetrics job-sheet keys.
src/​PrintVisIntegration/​PVSSMElectronicTicket.PageExt.al Adds the count summary to electronic tickets.
src/​CounterManagement/​PVSSMSessionManager.Codeunit.al Starts, stops, rotates, and logs collection sessions.
src/​CounterManagement/​PVSSMCounterWorker.Codeunit.al Runs background counter polling.
src/​CounterManagement/​PVSSMAssignToJobCosting.Page.al Provides manual count assignment.
src/​CounterManagement/​Entries/​PVSSMCountSummaryBuffer.Table.al Stores temporary summary rows.
src/​CounterManagement/​Entries/​PVSSMCountsSumByUOM.Query.al Aggregates counts by unit of measure.
src/​CounterManagement/​Entries/​PVSSMCountFactBox.Page.al Displays periodically refreshed job counts.
src/​CounterManagement/​Entries/​PVSSMCounterEntry.Table.al Stores readings, deltas, and job associations.
src/​CounterManagement/​Entries/​PVSSMCounterEntries.Page.al Displays entries and assignment actions.
src/​Core/​PVSSMInstall.Codeunit.al Enables outbound HTTP requests during installation.
src/​Core/​PVSSMEvents.Codeunit.al Exposes a request-mocking integration event.
src/​Core/​PVSSMEventHandler.Codeunit.al Connects collection and assignment to shop-floor events.
src/​Configuration/​Setup/​PVSSMSetup.Table.al Defines global API and session settings.
src/​Configuration/​Setup/​PVSSMSetup.Page.al Provides global configuration.
src/​Configuration/​SessionParameter/​PVSSMSessionParameter.Table.al Stores session context.
src/​Configuration/​SessionLog/​PVSSMSessionLog.Table.al Stores session lifecycle history.
src/​Configuration/​SessionLog/​PVSSMSessionLog.Page.al Displays session history and results.
src/​Configuration/​SessionLog/​PVSSMSessionEventType.Enum.al Defines start and stop event types.
src/​Configuration/​CostCenter/​PVSSMCostCenterSetup.Table.al Stores machine connection and polling settings.
src/​Configuration/​CostCenter/​PVSSMCostCenterSetup.Page.al Provides cost-center configuration and related actions.
src/​API/​PVSSMOrderSheetAPI.Page.al Exposes read-only order-sheet data.
Permissions/​PVSSMFULL.PermissionSet.al Grants access to integration objects and data.
app.json Defines extension metadata and dependencies.
.vscode/​settings.json Enables AL code analyzers.
.vscode/​launch.json Adds an empty debug configuration scaffold.

Review effort: Balanced

CounterEntry."Case ID" := in_Journal_EntryRec.ID;
CounterEntry."Plan ID" := in_Journal_EntryRec."Plan ID";
CounterEntry.UOM := in_Journal_EntryRec."UOM";
CounterEntry."Current Count" := -1;
CounterEntry.SetRange("Case ID", in_Journal_EntryRec.ID);
CounterEntry.SetRange("Plan ID", in_Journal_EntryRec."Plan ID");
CounterEntry.SetRange(UOM, in_Journal_EntryRec."UOM");
if CounterEntry.FindFirst() then begin
Comment on lines +93 to +97
CounterEntry.SetRange("Cost Center Code", in_CostCenterCode);
if CounterEntry.FindLast() then
NextEntryNo := CounterEntry."Entry No."
else
NextEntryNo := 0;
if (CountCostCenterTxt <> '') and (JobCostingEntry."Cost Center Code" <> CountCostCenterTxt) then
Error(CostCenterMismatchErr);

JobCostingEntry.Validate("Quantity", JobCostingEntry."Quantity" + CountQty);
Comment on lines +52 to +54
this.ParseXMLResponse(SubString, CounterEntry, SMCostCenterSetup);
SMCostCenterSetup.SetLastHeartbeat();
CounterEntry.Insert();
Subtype = Install;


trigger OnInstallAppPerDatabase()
Comment on lines +54 to +55
If not this.ResolveContext() then
exit;
Comment on lines +24 to +25
if SMCostCenterSetup.Enabled then
exit;

trigger OnBeforeInsert()
begin
this.GenerateSpencerMetricsKey(Rec);
this.Authenticate(SMSetup."Base URL", SMCostCenterSetup);

RequestUrl := this.BuildRequestUrl(SMSetup."Base URL", 'getXMLData?ApiSid=' + SMCostCenterSetup."Login Key");
Response := this.SendGetRequest(RequestUrl, Response);
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants