Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Prototyping/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
//https://businesscentral.dynamics.com/2384b7c3-109e-4c22-8731-4394fb3aa627/QA_Feature?company=PrintVis%20Inc.&page=2500&dc=0&bookmark=18_zpQ1dwCRhyKkVlN-IUu7elgqmuaGXA
//https://businesscentral.dynamics.com/2384b7c3-109e-4c22-8731-4394fb3aa627/JH-Test
"name": "Microsoft cloud sandbox",
"request": "launch",
"type": "al",
"environmentType": "Sandbox",
"environmentName": "JH-Test",
"tenant": "2384b7c3-109e-4c22-8731-4394fb3aa627",
"startupObjectId": 22,
"startupObjectType": "Page",
"breakOnError": "All",
"launchBrowser": true,
"enableLongRunningSqlStatements": true,
"enableSqlInformationDebugger": true
}
]
}
67 changes: 67 additions & 0 deletions Prototyping/PVSJobItemMinReelWidth.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
codeunit 50103 "PVS Job Item Min Reel Width"
{
[EventSubscriber(ObjectType::Table, Database::"PVS Job Item", 'OnAfterValidateEvent', 'Final Format Code', false, false)]
local procedure OnAfterValidateFormatCode(var Rec: Record "PVS Job Item"; var xRec: Record "PVS Job Item")
begin
CalcMinReelWidth(Rec);
end;

[EventSubscriber(ObjectType::Table, Database::"PVS Job Item", 'OnAfterValidateEvent', 'Controlling Sheet Unit', false, false)]
local procedure OnAfterValidateControllingSheetUnit(var Rec: Record "PVS Job Item"; var xRec: Record "PVS Job Item")
begin
CalcMinReelWidth(Rec);
end;

[EventSubscriber(ObjectType::Table, Database::"PVS Job Item", 'OnAfterValidateEvent', 'Imposition Type', false, false)]
local procedure OnAfterValidateImpositionType(var Rec: Record "PVS Job Item"; var xRec: Record "PVS Job Item")
begin
CalcMinReelWidth(Rec);
end;

[EventSubscriber(ObjectType::Table, Database::"PVS Job Item", 'OnAfterValidateEvent', 'Front Overfold', false, false)]
local procedure OnAfterValidateFrontOverfold(var Rec: Record "PVS Job Item"; var xRec: Record "PVS Job Item")
begin
CalcMinReelWidth(Rec);
end;

local procedure CalcMinReelWidth(var Rec: Record "PVS Job Item")
var
ImpositionRec: Record "PVS Imposition Code";
Guard: Codeunit "PVS Min Reel Width Guard";
LeavesWidth: Decimal;
begin
if Guard.IsCalcInProgress() then
exit;

if not ComponentTypeIsInside(Rec."Component Type") then
exit;

Rec.CalcFields("Controlling Sheet Unit");
if (Rec."Final Format Code" = '') or (Rec."Controlling Sheet Unit" = '') or (Rec."Imposition Type" = '') then
exit;

if not ImpositionRec.Get(Rec."Imposition Type") then
exit;

LeavesWidth := ImpositionRec."Leaves Width";

Guard.SetCalcInProgress(true);
if TryApplyMinReelWidth(Rec, LeavesWidth) then; // errors silenced; execution always reaches the next line
Guard.SetCalcInProgress(false);
end;

[TryFunction]
local procedure TryApplyMinReelWidth(var Rec: Record "PVS Job Item"; LeavesWidth: Decimal)
begin
// Direct assignment does not fire OnValidate; no recursion risk here
Rec."Minimum Reel Width" :=
(LeavesWidth * Rec.Width) +
((LeavesWidth / 2) * (Rec."Front Overfold" + Rec."Milling Depth"));
end;

local procedure ComponentTypeIsInside(ComponentType: Code[10]): Boolean
begin
// Matches component types whose code contains 'INSIDE', consistent with the '*INSIDE*' filter in the spec
exit(StrPos(UpperCase(ComponentType), 'INSIDE') > 0);
end;
}
26 changes: 26 additions & 0 deletions Prototyping/PVSJobItemMinReelWidth.TableExt.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
tableextension 50100 "PVS Job Item Min Reel Width" extends "PVS Job Item"
{
fields
{
field(50100; "Minimum Reel Width"; Decimal)
{
Caption = 'Minimum Reel Width';
DataClassification = CustomerContent;
ToolTip = 'Minimum Reel Width in mm';

trigger OnValidate()
var
Diff: Decimal;
Guard: Codeunit "PVS Min Reel Width Guard";
begin
if Guard.IsCalcInProgress() then
exit;
// xRec holds the pre-validate value; Diff is 0 when unchanged (e.g. first-time insert)
Diff := Rec."Minimum Reel Width" - xRec."Minimum Reel Width";
if (Diff <> 0) and (xRec."Minimum Reel Width" <> 0) then
// Per spec: the difference (new - old) is added 1:1 to Front Overfold
Rec."Front Overfold" := Rec."Front Overfold" + Diff;
end;
}
}
}
15 changes: 15 additions & 0 deletions Prototyping/PVSJobItemsListPart.PageExt.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pageextension 50101 "PVS Job Items ListPart Ext" extends "PVS Job Items ListPart"
{
layout
{
addafter(ImpositionType)
{
field("Minimum Reel Width"; Rec."Minimum Reel Width")
{
ApplicationArea = All;
Caption = 'Minimum Reel Width';
ToolTip = 'Minimum Reel Width in mm';
}
}
}
}
17 changes: 17 additions & 0 deletions Prototyping/PVSMinReelWidthGuard.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
codeunit 50101 "PVS Min Reel Width Guard"
{
SingleInstance = true;

var
CalcInProgress: Boolean;

procedure SetCalcInProgress(Value: Boolean)
begin
CalcInProgress := Value;
end;

procedure IsCalcInProgress(): Boolean
begin
exit(CalcInProgress);
end;
}
10 changes: 10 additions & 0 deletions Prototyping/Thirsday25App.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"folders": [
{
"path": "Thirsday25App"
}
],
"settings": {
"al.enableCodeAnalysis": false
}
}
39 changes: 39 additions & 0 deletions Prototyping/Thirsday25App/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "2d9f26a9-f8e2-4695-9dc7-16f8ad2b28fe",
"name": "Thirsday25 app",
"publisher": "PrintVis",
"version": "1.0.0.0",
"brief": "",
"description": "",
"privacyStatement": "",
"EULA": "",
"help": "",
"url": "",
"logo": "",
"dependencies": [
{
"id": "5452f323-059e-499a-9753-5d2c07eef904",
"name": "PrintVis",
"publisher": "PrintVis A/S",
"version": "28.0.0.0"
}
],
"screenshots": [],
"platform": "1.0.0.0",
"application": "28.0.0.0",
"idRanges": [
{
"from": 51000,
"to": 51999
}
],
"resourceExposurePolicy": {
"allowDebugging": true,
"allowDownloadingSource": true,
"includeSourceInSymbolFile": true
},
"runtime": "16.0",
"features": [
"NoImplicitWith"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
codeunit 50102 "THR Thursday25 Install"
{
Subtype = Install;

trigger OnInstallAppPerCompany()
begin
end;
}
Loading