diff --git a/src/Apps/W1/Quality Management/QMWorkspace.code-workspace b/src/Apps/W1/Quality Management/QMWorkspace.code-workspace
index 213cdab1dd..871a345fd3 100644
--- a/src/Apps/W1/Quality Management/QMWorkspace.code-workspace
+++ b/src/Apps/W1/Quality Management/QMWorkspace.code-workspace
@@ -1,12 +1,16 @@
{
"folders": [
{
- "name": "Quality Management - App",
- "path": "app"
+ "name": "Quality Management - App",
+ "path": "app"
},
{
- "name": "Quality Management - Test",
- "path": "test"
+ "name": "Quality Management - Test",
+ "path": "test"
+ },
+ {
+ "name": "Quality Management - Test Library",
+ "path": "Test Library"
}
- ]
+ ]
}
\ No newline at end of file
diff --git a/src/Apps/W1/Quality Management/Test Library/ExtensionLogo.png b/src/Apps/W1/Quality Management/Test Library/ExtensionLogo.png
new file mode 100644
index 0000000000..4d2c9a626c
Binary files /dev/null and b/src/Apps/W1/Quality Management/Test Library/ExtensionLogo.png differ
diff --git a/src/Apps/W1/Quality Management/Test Library/app.json b/src/Apps/W1/Quality Management/Test Library/app.json
new file mode 100644
index 0000000000..13971746a0
--- /dev/null
+++ b/src/Apps/W1/Quality Management/Test Library/app.json
@@ -0,0 +1,60 @@
+{
+ "id": "9c32d4af-77d5-4fba-a3de-361805163a00",
+ "name": "Quality Management Test Library",
+ "publisher": "Microsoft",
+ "version": "28.0.0.0",
+ "brief": "Test library for Quality Management",
+ "description": "Test library for Quality Management",
+ "contextSensitiveHelpUrl": "https://go.microsoft.com/fwlink/?linkid=2338953",
+ "privacyStatement": "https://go.microsoft.com/fwlink/?LinkId=724009",
+ "EULA": "https://go.microsoft.com/fwlink/?linkid=2182906",
+ "help": "https://go.microsoft.com/fwlink/?linkid=2338953",
+ "url": "https://go.microsoft.com/fwlink/?LinkId=724011",
+ "logo": "ExtensionLogo.png",
+ "dependencies": [
+ {
+ "id": "bc7b3891-f61b-4883-bbb3-384cdef88bec",
+ "name": "Quality Management",
+ "publisher": "Microsoft",
+ "version": "28.0.0.0"
+ },
+ {
+ "id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
+ "publisher": "Microsoft",
+ "name": "Tests-TestLibraries",
+ "version": "28.0.0.0"
+ },
+ {
+ "id": "dd0be2ea-f733-4d65-bb34-a28f4624fb14",
+ "publisher": "Microsoft",
+ "name": "Library Assert",
+ "version": "28.0.0.0"
+ }
+ ],
+ "screenshots": [],
+ "application": "28.0.0.0",
+ "platform": "28.0.0.0",
+ "target": "OnPrem",
+ "idRanges": [
+ {
+ "from": 139940,
+ "to": 139949
+ }
+ ],
+ "resourceExposurePolicy": {
+ "allowDebugging": true,
+ "allowDownloadingSource": true,
+ "includeSourceInSymbolFile": true
+ },
+ "internalsVisibleTo": [
+ {
+ "id": "aa5fc5d3-ef4e-4b03-8512-9c584cdc1ceb",
+ "name": "Quality Management-Tests",
+ "publisher": "Microsoft"
+ }
+ ],
+ "features": [
+ "NoImplicitWith",
+ "TranslationFile"
+ ]
+}
\ No newline at end of file
diff --git a/src/Apps/W1/Quality Management/Test Library/src/QltyInspectionUtility.Codeunit.al b/src/Apps/W1/Quality Management/Test Library/src/QltyInspectionUtility.Codeunit.al
new file mode 100644
index 0000000000..c40218432d
--- /dev/null
+++ b/src/Apps/W1/Quality Management/Test Library/src/QltyInspectionUtility.Codeunit.al
@@ -0,0 +1,1611 @@
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+namespace Microsoft.Test.QualityManagement.TestLibraries;
+
+using Microsoft.Foundation.Company;
+using Microsoft.Foundation.NoSeries;
+using Microsoft.Inventory.Item;
+using Microsoft.Inventory.Journal;
+using Microsoft.Inventory.Location;
+using Microsoft.Inventory.Setup;
+using Microsoft.Inventory.Tracking;
+using Microsoft.Manufacturing.Document;
+using Microsoft.Purchases.Document;
+using Microsoft.QualityManagement.Configuration;
+using Microsoft.QualityManagement.Configuration.GenerationRule;
+using Microsoft.QualityManagement.Configuration.Result;
+using Microsoft.QualityManagement.Configuration.SourceConfiguration;
+using Microsoft.QualityManagement.Configuration.Template;
+using Microsoft.QualityManagement.Configuration.Template.Test;
+using Microsoft.QualityManagement.Dispositions;
+using Microsoft.QualityManagement.Dispositions.InventoryAdjustment;
+using Microsoft.QualityManagement.Dispositions.Move;
+using Microsoft.QualityManagement.Dispositions.Purchase;
+using Microsoft.QualityManagement.Dispositions.PutAway;
+using Microsoft.QualityManagement.Dispositions.Transfer;
+using Microsoft.QualityManagement.Document;
+using Microsoft.QualityManagement.Integration.Inventory;
+using Microsoft.QualityManagement.Integration.Utilities;
+using Microsoft.QualityManagement.Setup;
+using Microsoft.QualityManagement.Setup.ApplicationAreas;
+using Microsoft.QualityManagement.Utilities;
+using Microsoft.Warehouse.Journal;
+using Microsoft.Warehouse.Ledger;
+using Microsoft.Warehouse.Setup;
+using System.Reflection;
+using System.TestLibraries.Security.AccessControl;
+using System.TestLibraries.Utilities;
+
+codeunit 139940 "Qlty. Inspection Utility"
+{
+ var
+ LibraryAssert: Codeunit "Library Assert";
+ LibraryUtility: Codeunit "Library - Utility";
+ NoSeriesCodeunit: Codeunit "No. Series";
+ DefaultResult2PassCodeLbl: Label 'PASS', Locked = true;
+
+ internal procedure EnsureSetupExists()
+ var
+ QltyManagementSetup: Record "Qlty. Management Setup";
+ QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
+ UserPermissionsLibrary: Codeunit "User Permissions Library";
+ begin
+ QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyManagementSetup.Get();
+ QltyManagementSetup."When to show inspections" := QltyManagementSetup."When to show inspections"::"Do not show created inspections";
+ QltyManagementSetup.Modify();
+
+ UserPermissionsLibrary.AssignPermissionSetToUser(UserSecurityId(), 'QltyGeneral');
+ end;
+
+ internal procedure CreateABasicTemplateAndInstanceOfAInspection(var OutCreatedQltyInspectionHeader: Record "Qlty. Inspection Header"; var OutQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.")
+ var
+ ProdOrderRoutingLine: Record "Prod. Order Routing Line";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
+ QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ ProdOrderRoutingLineRecordRefRecordRef: RecordRef;
+ OrdersList: List of [Code[20]];
+ ProductionOrder: Code[20];
+ ClaimedInspectionWasCreated: Boolean;
+ BeforeCount: Integer;
+ AfterCount: Integer;
+ begin
+ QltyInspectionUtility.EnsureSetupExists();
+
+ QltyInspectionUtility.CreateTemplate(OutQltyInspectionTemplateHdr, 3);
+
+ QltyInspectionUtility.CreatePrioritizedRule(OutQltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
+
+ QltyProdOrderGenerator.Init(100);
+ QltyProdOrderGenerator.ToggleAllSources(false);
+ QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
+ QltyProdOrderGenerator.Generate(2, OrdersList);
+ LibraryAssert.AreEqual(2, OrdersList.Count(), 'Common inspection generation. Inspection generator did not make the expected amount of production orders.');
+ OrdersList.Get(1, ProductionOrder);
+ ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
+ ProdOrderRoutingLine.FindLast();
+
+ OutCreatedQltyInspectionHeader.Reset();
+ BeforeCount := OutCreatedQltyInspectionHeader.Count();
+
+ ProdOrderRoutingLineRecordRefRecordRef.GetTable(ProdOrderRoutingLine);
+ ClaimedInspectionWasCreated := QltyInspectionCreate.CreateInspection(ProdOrderRoutingLineRecordRefRecordRef, true);
+
+ OutCreatedQltyInspectionHeader.Reset();
+ AfterCount := OutCreatedQltyInspectionHeader.Count();
+
+ LibraryAssert.AreEqual((BeforeCount + 1), AfterCount, 'Expected overall inspections');
+ OutCreatedQltyInspectionHeader.SetRange("Source Document No.", ProdOrderRoutingLine."Prod. Order No.");
+ LibraryAssert.AreEqual((1), OutCreatedQltyInspectionHeader.Count(), 'There should be exactly one inspection for this operation.');
+ LibraryAssert.IsTrue(ClaimedInspectionWasCreated, 'An inspection flag should have been created');
+
+ QltyInspectionCreate.GetCreatedInspection(OutCreatedQltyInspectionHeader);
+ end;
+
+ internal procedure CreateTemplate(var OutQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; HowManyFields: Integer)
+ var
+ IgnoredQltyTest: Record "Qlty. Test";
+ ToTemplateRecordRef: RecordRef;
+ FieldNumberToCreate: Integer;
+ begin
+ Clear(OutQltyInspectionTemplateHdr);
+ OutQltyInspectionTemplateHdr.Init();
+ ToTemplateRecordRef.GetTable(OutQltyInspectionTemplateHdr);
+ FillTextField(ToTemplateRecordRef, OutQltyInspectionTemplateHdr.FieldNo("Code"), true);
+ FillTextField(ToTemplateRecordRef, OutQltyInspectionTemplateHdr.FieldNo(Description), true);
+ ToTemplateRecordRef.SetTable(OutQltyInspectionTemplateHdr);
+ OutQltyInspectionTemplateHdr.Insert(true);
+ if HowManyFields > 0 then
+ for FieldNumberToCreate := 1 to HowManyFields do
+ CreateTestAndAddToTemplate(OutQltyInspectionTemplateHdr, IgnoredQltyTest, "Qlty. Test Value Type"::"Value Type Text")
+ end;
+
+ internal procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; QltyTestValueType: Enum "Qlty. Test Value Type")
+ var
+ IgnoredQltyTest: Record "Qlty. Test";
+ QltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
+ begin
+ Clear(QltyInspectionTemplateLine);
+ CreateTest(IgnoredQltyTest, QltyTestValueType);
+ QltyInspectionTemplateLine.Init();
+ QltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
+ QltyInspectionTemplateLine.InitLineNoIfNeeded();
+ QltyInspectionTemplateLine.Validate("Test Code", IgnoredQltyTest.Code);
+ QltyInspectionTemplateLine.Insert(true);
+ end;
+
+ internal procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; var OutQltyTest: Record "Qlty. Test"; QltyTestValueType: Enum "Qlty. Test Value Type")
+ var
+ QltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
+ begin
+ Clear(QltyInspectionTemplateLine);
+ CreateTest(OutQltyTest, QltyTestValueType);
+ QltyInspectionTemplateLine.Init();
+ QltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
+ QltyInspectionTemplateLine.InitLineNoIfNeeded();
+ QltyInspectionTemplateLine.Validate("Test Code", OutQltyTest.Code);
+ QltyInspectionTemplateLine.Insert(true);
+ end;
+
+ internal procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; QltyTestValueType: Enum "Qlty. Test Value Type"; var QltyTest: Record "Qlty. Test"; var OutQltyInspectionTemplateLine: Record "Qlty. Inspection Template Line")
+ begin
+ Clear(OutQltyInspectionTemplateLine);
+ CreateTest(QltyTest, QltyTestValueType);
+ OutQltyInspectionTemplateLine.Init();
+ OutQltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
+ OutQltyInspectionTemplateLine.InitLineNoIfNeeded();
+ OutQltyInspectionTemplateLine.Validate("Test Code", QltyTest.Code);
+ OutQltyInspectionTemplateLine.Insert(true);
+ end;
+
+ internal procedure CreateTest(var QltyTest: Record "Qlty. Test"; QltyTestValueType: Enum "Qlty. Test Value Type")
+ var
+ QltyInspectionResult: Record "Qlty. Inspection Result";
+ ToFieldRecordRef: RecordRef;
+ begin
+ Clear(QltyTest);
+ QltyTest.Init();
+ QltyTest."Test Value Type" := QltyTestValueType;
+ ToFieldRecordRef.GetTable(QltyTest);
+ FillTextField(ToFieldRecordRef, QltyTest.FieldNo(Code), true);
+ FillTextField(ToFieldRecordRef, QltyTest.FieldNo(Description), true);
+ ToFieldRecordRef.SetTable(QltyTest);
+ QltyTest.Insert();
+
+ if QltyInspectionResult.Get(DefaultResult2PassCodeLbl) then
+ case QltyTestValueType of
+ QltyTestValueType::"Value Type Text", QltyTestValueType::"Value Type Text Expression":
+ QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>HARDCODEDFAIL', true);
+ QltyTestValueType::"Value Type Decimal", QltyTestValueType::"Value Type Integer":
+ QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>-123', true);
+ QltyTestValueType::"Value Type Boolean":
+ QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>FALSE', true);
+ end;
+ end;
+
+ internal procedure CreatePrioritizedRule(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; SourceTableNo: Integer)
+ var
+ QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
+ begin
+ CreatePrioritizedRule(InExistingQltyInspectionTemplateHdr, SourceTableNo, QltyInspectionGenRule);
+ end;
+
+ internal procedure CreatePrioritizedRule(var InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; SourceTableNo: Integer; var OutQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule")
+ var
+ FindLowestQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
+ begin
+ if InExistingQltyInspectionTemplateHdr.Code = '' then
+ CreateTemplate(InExistingQltyInspectionTemplateHdr, 0);
+
+ FindLowestQltyInspectionGenRule.ModifyAll("Activation Trigger", FindLowestQltyInspectionGenRule."Activation Trigger"::Disabled);
+
+ FindLowestQltyInspectionGenRule.Reset();
+ FindLowestQltyInspectionGenRule.SetCurrentKey("Sort Order");
+
+ OutQltyInspectionGenRule.Init();
+ if FindLowestQltyInspectionGenRule.FindFirst() then
+ OutQltyInspectionGenRule."Sort Order" := FindLowestQltyInspectionGenRule."Sort Order" - 1;
+
+ OutQltyInspectionGenRule."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
+ OutQltyInspectionGenRule."Source Table No." := SourceTableNo;
+ OutQltyInspectionGenRule.Insert(true);
+ end;
+
+ internal procedure CreateItemJournalTemplateAndBatch(TemplateType: Enum "Item Journal Entry Type"; var OutItemJournalBatch: Record "Item Journal Batch")
+ var
+ ItemJournalTemplate: Record "Item Journal Template";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ LibraryInventory.CreateItemJournalTemplateByType(ItemJournalTemplate, TemplateType);
+ LibraryInventory.CreateItemJournalBatch(OutItemJournalBatch, ItemJournalTemplate.Name);
+ end;
+
+ local procedure FillTextField(RecordVariant: Variant; FieldNo: Integer; Validate: Boolean)
+ var
+ DataTypeManagement: Codeunit "Data Type Management";
+ RecordRef: RecordRef;
+ FieldRef: FieldRef;
+ Data: Text;
+ begin
+ DataTypeManagement.GetRecordRef(RecordVariant, RecordRef);
+ FieldRef := RecordRef.Field(FieldNo);
+ if not (FieldRef.Type in [FieldType::Code, FieldType::Text]) then
+ Error('FillTextField should only be called on code or text fields. Table %1, field %2, type %3', RecordRef.Number(), FieldNo, FieldRef.Type);
+ if FieldRef.Length < 10 then
+ Error('Unexpected length of %4 for Table %1, field %2, type %3', RecordRef.Number(), FieldNo, FieldRef.Type, FieldRef.Length);
+
+ FillText(FieldRef.Length, Data);
+ if Validate then
+ FieldRef.Validate(Data)
+ else
+ FieldRef.Value(Data);
+ end;
+
+ local procedure FillText(NumberOfCharacters: Integer; var Out: Text)
+ var
+ CompanyInformation: Record "Company Information";
+ Now: DateTime;
+ CompanyCreated: DateTime;
+ igIntMilliseconds: BigInteger;
+ CharactersToGenerate: Integer;
+ RandomCharacters: Text;
+ SequenceNumber: Integer;
+ begin
+ if NumberOfCharacters < 0 then
+ Error('FillText is being called incorrectly, NumberOfCharacters must be > 0');
+
+ if not NumberSequence.Exists('QualityManagementAutoTests') then
+ NumberSequence.Insert('QualityManagementAutoTests');
+ SequenceNumber := NumberSequence.Next('QualityManagementAutoTests', true);
+
+ Clear(Out);
+ Now := System.CurrentDateTime();
+ CompanyInformation.Get();
+ CompanyCreated := CompanyInformation.SystemCreatedAt;
+ Out += format(SequenceNumber, 0, 9);
+
+ igIntMilliseconds := (Now - CompanyCreated);
+ Out += format(igIntMilliseconds, 0, 9);
+
+ CharactersToGenerate := NumberOfCharacters - strlen(Out);
+ if CharactersToGenerate > 0 then begin
+ GenerateRandomCharacters(CharactersToGenerate, RandomCharacters);
+ Out := Out + RandomCharacters;
+ end;
+
+ if (strlen(Out) > NumberOfCharacters) then begin
+ Out := CopyStr(Out, strlen(Out), NumberOfCharacters);
+ exit;
+ end;
+ end;
+
+ ///
+ /// Intentionally not using RandText() from Library - Random, because it's not random based on how it
+ /// generates text with the guids, making collision counts very high.
+ ///
+ ///
+ ///
+ internal procedure GenerateRandomCharacters(NumberOfCharacters: Integer; var Out: Text)
+ var
+ LibraryRandom: Codeunit "Library - Random";
+ CharSet: Text[36];
+ Index: Integer;
+ begin
+ Clear(Out);
+ CharSet := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
+
+ LibraryRandom.Init();
+
+ for Index := 1 to NumberOfCharacters do
+ Out += CopyStr(CharSet, LibraryRandom.RandIntInRange(1, 36), 1);
+ end;
+
+ ///
+ /// Creates a lot no. series and a lot-tracked item
+ ///
+ ///
+ internal procedure CreateLotTrackedItem(var OutItem: Record Item)
+ var
+ NoSeries: Record "No. Series";
+ begin
+ CreateLotTrackedItem(OutItem, NoSeries);
+ end;
+
+ ///
+ /// Creates a lot no. series and a lot-tracked item
+ ///
+ ///
+ internal procedure CreateLotTrackedItem(var OutItem: Record Item; var OutLotNoSeries: Record "No. Series")
+ var
+ InventorySetup: Record "Inventory Setup";
+ ItemNoSeries: Record "No. Series";
+ ItemNoSeriesLine: Record "No. Series Line";
+ LotNoSeriesLine: Record "No. Series Line";
+ LotItemTrackingCode: Record "Item Tracking Code";
+ LibraryItemTracking: Codeunit "Library - Item Tracking";
+ LibraryUtility2: Codeunit "Library - Utility";
+ LibraryInventory: Codeunit "Library - Inventory";
+ StartingNo: Code[20];
+ EndingNo: Code[20];
+ begin
+ LibraryUtility2.CreateNoSeries(ItemNoSeries, true, true, false);
+ GetCode20NoSeries('IL', StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeriesLine(ItemNoSeriesLine, ItemNoSeries.Code, StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeries(OutLotNoSeries, true, true, false);
+ GetCode20NoSeries('L', StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeriesLine(LotNoSeriesLine, OutLotNoSeries.Code, StartingNo, EndingNo);
+
+ LibraryItemTracking.CreateItemTrackingCode(LotItemTrackingCode, false, true, false);
+
+ InventorySetup.Get();
+ InventorySetup.Validate("Item Nos.", ItemNoSeries.Code);
+ InventorySetup.Modify(true);
+
+ LibraryInventory.CreateTrackedItem(OutItem, OutLotNoSeries.Code, '', LotItemTrackingCode.Code);
+ OutItem.Rename(NoSeriesCodeunit.PeekNextNo(ItemNoSeries.Code));
+ OutItem.Modify();
+
+ OutItem.Validate("Unit Cost", 1.234);
+ OutItem.Validate("Unit Price", 2.2345);
+ OutItem.Modify();
+ end;
+
+ ///
+ /// Creates a serial no. series and a serial-tracked item
+ ///
+ ///
+ internal procedure CreateSerialTrackedItem(var OutItem: Record Item)
+ var
+ NoSeries: Record "No. Series";
+ begin
+ CreateSerialTrackedItem(OutItem, NoSeries);
+ end;
+
+ ///
+ /// Creates a serial no. series and a serial-tracked item
+ ///
+ ///
+ internal procedure CreateSerialTrackedItem(var OutItem: Record Item; var OutSerialNoSeries: Record "No. Series")
+ var
+ InventorySetup: Record "Inventory Setup";
+ ItemNoSeries: Record "No. Series";
+ ItemNoSeriesLine: Record "No. Series Line";
+ SerialNoSeriesLine: Record "No. Series Line";
+ SerialItemTrackingCode: Record "Item Tracking Code";
+ LibraryItemTracking: Codeunit "Library - Item Tracking";
+ LibraryUtility2: Codeunit "Library - Utility";
+ LibraryInventory: Codeunit "Library - Inventory";
+ StartingNo: Code[20];
+ EndingNo: Code[20];
+ begin
+ LibraryUtility2.CreateNoSeries(ItemNoSeries, true, true, false);
+ GetCode20NoSeries('IS', StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeriesLine(ItemNoSeriesLine, ItemNoSeries.Code, StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeries(OutSerialNoSeries, true, true, false);
+ GetCode20NoSeries('S', StartingNo, EndingNo);
+ LibraryUtility2.CreateNoSeriesLine(SerialNoSeriesLine, OutSerialNoSeries.Code, StartingNo, EndingNo);
+
+ LibraryItemTracking.CreateItemTrackingCode(SerialItemTrackingCode, true, false, false);
+
+ InventorySetup.Get();
+ InventorySetup.Validate("Item Nos.", ItemNoSeries.Code);
+ InventorySetup.Modify(true);
+
+ LibraryInventory.CreateTrackedItem(OutItem, '', OutSerialNoSeries.Code, SerialItemTrackingCode.Code);
+ OutItem.Rename(NoSeriesCodeunit.PeekNextNo(ItemNoSeries.Code));
+
+ OutItem.Modify();
+
+ OutItem.Validate("Unit Cost", 1.234);
+ OutItem.Validate("Unit Price", 2.2345);
+ OutItem.Modify();
+ end;
+
+ ///
+ /// Creates a package no. series and a package-tracked item
+ ///
+ ///
+ internal procedure CreatePackageTrackedItemWithNoSeries(var OutItem: Record Item; var OutPackageNoSeries: Record "No. Series")
+ var
+ InventorySetup: Record "Inventory Setup";
+ PackageNoSeriesLine: Record "No. Series Line";
+ PackageItemTrackingCode: Record "Item Tracking Code";
+ LibraryItemTracking: Codeunit "Library - Item Tracking";
+ LibraryUtility2: Codeunit "Library - Utility";
+ LibraryInventory: Codeunit "Library - Inventory";
+ StartingNo: Code[20];
+ EndingNo: Code[20];
+ begin
+ InventorySetup.Get();
+ GetCode20NoSeries('P', StartingNo, EndingNo);
+ if InventorySetup."Package Nos." <> '' then begin
+ OutPackageNoSeries.Get(InventorySetup."Package Nos.");
+ PackageNoSeriesLine.SetRange(PackageNoSeriesLine."Series Code");
+ if PackageNoSeriesLine.Count = 0 then
+ LibraryUtility2.CreateNoSeriesLine(PackageNoSeriesLine, OutPackageNoSeries.Code, StartingNo, EndingNo);
+ end else begin
+ LibraryUtility2.CreateNoSeries(OutPackageNoSeries, true, true, false);
+ LibraryUtility2.CreateNoSeriesLine(PackageNoSeriesLine, OutPackageNoSeries.Code, StartingNo, EndingNo);
+ InventorySetup.Validate("Package Nos.", OutPackageNoSeries.Code);
+ InventorySetup.Modify(true);
+ end;
+ LibraryItemTracking.CreateItemTrackingCode(PackageItemTrackingCode, false, false, true);
+
+ LibraryInventory.CreateItem(OutItem);
+ OutItem.Validate("Item Tracking Code", PackageItemTrackingCode.Code);
+ OutItem.Validate("Unit Cost", 1.234);
+ OutItem.Validate("Unit Price", 2.2345);
+ OutItem.Modify();
+ end;
+
+ ///
+ /// Sets user as warehouse employee for location
+ ///
+ ///
+ internal procedure SetCurrLocationWhseEmployee(Location: Code[10])
+ var
+ WhseWarehouseEmployee: Record "Warehouse Employee";
+ begin
+ WhseWarehouseEmployee.Validate("User ID", UserId());
+ WhseWarehouseEmployee.Validate("Location Code", Location);
+ WhseWarehouseEmployee.Default := true;
+ if WhseWarehouseEmployee.Insert() then;
+ end;
+
+ ///
+ /// Creates Quality Inspection from purchase line for tracked item
+ ///
+ ///
+ ///
+ ///
+ internal procedure CreateInspectionWithPurchaseLineAndTracking(PurOrdPurchaseLine: Record "Purchase Line"; ReservationEntry: Record "Reservation Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ SpecTrackingSpecification: Record "Tracking Specification";
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ PurchaseLineRecordRef: RecordRef;
+ UnusedVariant1: Variant;
+ UnusedVariant2: Variant;
+ InspectionCreated: Boolean;
+ begin
+ PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
+ SpecTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
+ InspectionCreated := QltyInspectionCreate.CreateInspectionWithMultiVariantsAndTemplate(PurchaseLineRecordRef, SpecTrackingSpecification, UnusedVariant1, UnusedVariant2, true, '');
+ LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
+
+ QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
+ LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
+ end;
+
+ ///
+ /// Creates Quality Inspection from warehouse entry for tracked item
+ ///
+ ///
+ ///
+ ///
+ internal procedure CreateInspectionWithWarehouseEntryAndTracking(WarehouseEntry: Record "Warehouse Entry"; ReservationEntry: Record "Reservation Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ SpecTrackingSpecification: Record "Tracking Specification";
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ RecordRef: RecordRef;
+ UnusedVariant1: Variant;
+ UnusedVariant2: Variant;
+ InspectionCreated: Boolean;
+ begin
+ RecordRef.GetTable(WarehouseEntry);
+ SpecTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
+ InspectionCreated := QltyInspectionCreate.CreateInspectionWithMultiVariantsAndTemplate(RecordRef, SpecTrackingSpecification, UnusedVariant1, UnusedVariant2, true, '');
+ LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
+
+ QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
+ LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
+ end;
+
+ ///
+ /// Creates Quality Inspection from purchase line for untracked item
+ ///
+ ///
+ /// The specific template to use.
+ ///
+ internal procedure CreateInspectionWithPurchaseLine(PurOrdPurchaseLine: Record "Purchase Line"; SpecificTemplate: Code[20]; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ PurchaseLineRecordRef: RecordRef;
+ InspectionCreated: Boolean;
+ begin
+ PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
+ InspectionCreated := QltyInspectionCreate.CreateInspectionWithSpecificTemplate(PurchaseLineRecordRef, true, SpecificTemplate);
+ LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
+
+ QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
+ LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
+ end;
+
+ ///
+ /// Creates Quality Inspection for warehouse entry for untracked item
+ ///
+ ///
+ ///
+ internal procedure CreateInspectionWithWarehouseEntry(WarehouseEntry: Record "Warehouse Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ RecordRef: RecordRef;
+ InspectionCreated: Boolean;
+ begin
+ RecordRef.GetTable(WarehouseEntry);
+ InspectionCreated := QltyInspectionCreate.CreateInspection(RecordRef, true);
+ LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
+
+ QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
+ LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
+ end;
+
+ ///
+ /// Creates Quality Inspection from a RecordRef with option to prevent displaying inspection.
+ /// Useful for tests that need to suppress UI dialogs during inspection creation.
+ ///
+ /// The source record reference.
+ /// If true, prevents displaying inspection even if configured.
+ /// If true, raises an error when no matching rule is found.
+ /// The created inspection header.
+ internal procedure CreateInspectionWithPreventDisplaying(SourceRecordRef: RecordRef; PreventDisplaying: Boolean; RaiseErrorIfNoRuleFound: Boolean; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ QltyInspectionCreate.SetPreventDisplayingInspectionEvenIfConfigured(PreventDisplaying);
+ QltyInspectionCreate.CreateInspection(SourceRecordRef, RaiseErrorIfNoRuleFound);
+ QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
+ end;
+
+ ///
+ /// This works around a flaw in "Library - Warehouse"::CreateWhseJournalLine where it only supports the item template and does insufficient filtering.
+ /// It's otherwise nearly identical to CreateReclassWhseJournalLine from "Library - Warehouse"::CreateWhseJournalLine
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ internal procedure CreateReclassWhseJournalLine(var ReclassWarehouseJournalLine: Record "Warehouse Journal Line"; JournalTemplateName: Code[10]; JournalBatchName: Code[10]; LocationCode: Code[10]; ZoneCode: Code[10]; BinCode: Code[20]; EntryType: Option; ItemNo: Code[20]; NewQuantity: Decimal)
+ var
+ QltyManagementSetup: Record "Qlty. Management Setup";
+ BatchNoSeries: Record "No. Series";
+ WarehouseJournalBatch: Record "Warehouse Journal Batch";
+ BatchGeneratorNoSeries: Codeunit "No. Series";
+ RecordRef: RecordRef;
+ DocumentNo: Code[20];
+ begin
+ ReclassWarehouseJournalLine.LockTable(true);
+ QltyManagementSetup.LockTable();
+ if not WarehouseJournalBatch.Get(JournalTemplateName, JournalBatchName, LocationCode) then begin
+ WarehouseJournalBatch.Init();
+ WarehouseJournalBatch.Validate("Journal Template Name", JournalTemplateName);
+ WarehouseJournalBatch.SetupNewBatch();
+ WarehouseJournalBatch.Validate(Name, JournalBatchName);
+ WarehouseJournalBatch.Validate(Description, JournalBatchName + ' journal');
+ WarehouseJournalBatch.Validate("Location Code", LocationCode);
+ WarehouseJournalBatch.Insert(true);
+ end;
+
+ ReclassWarehouseJournalLine.Validate("Journal Template Name", JournalTemplateName);
+ ReclassWarehouseJournalLine.Validate("Journal Batch Name", JournalBatchName);
+ ReclassWarehouseJournalLine.Validate("Location Code", LocationCode);
+ ReclassWarehouseJournalLine.Validate("Zone Code", ZoneCode);
+ ReclassWarehouseJournalLine.Validate("Bin Code", BinCode);
+
+ ReclassWarehouseJournalLine.SetUpNewLine(ReclassWarehouseJournalLine);
+
+ RecordRef.GetTable(ReclassWarehouseJournalLine);
+ ReclassWarehouseJournalLine.Validate("Line No.", LibraryUtility.GetNewLineNo(RecordRef, ReclassWarehouseJournalLine.FieldNo("Line No.")));
+ ReclassWarehouseJournalLine.Insert(true);
+ ReclassWarehouseJournalLine.Validate("Registering Date", WorkDate());
+ ReclassWarehouseJournalLine.Validate("Entry Type", EntryType);
+ if BatchNoSeries.Get(WarehouseJournalBatch."No. Series") then
+ DocumentNo := BatchGeneratorNoSeries.PeekNextNo(WarehouseJournalBatch."No. Series", ReclassWarehouseJournalLine."Registering Date")
+ else
+ DocumentNo := 'Default Document No.';
+ ReclassWarehouseJournalLine.Validate("Whse. Document No.", DocumentNo);
+ ReclassWarehouseJournalLine.Validate("Item No.", ItemNo);
+ ReclassWarehouseJournalLine.Validate(Quantity, NewQuantity);
+ ReclassWarehouseJournalLine.Modify(true);
+ end;
+
+ internal procedure ClearResultLotSettings(var QltyInspectionResult: Record "Qlty. Inspection Result")
+ begin
+ QltyInspectionResult."Lot Allow Sales" := QltyInspectionResult."Lot Allow Sales"::Allow;
+ QltyInspectionResult."Lot Allow Assembly Consumption" := QltyInspectionResult."Lot Allow Assembly Consumption"::Allow;
+ QltyInspectionResult."Lot Allow Assembly Output" := QltyInspectionResult."Lot Allow Assembly Output"::Allow;
+ QltyInspectionResult."Lot Allow Consumption" := QltyInspectionResult."Lot Allow Consumption"::Allow;
+ QltyInspectionResult."Lot Allow Invt. Movement" := QltyInspectionResult."Lot Allow Invt. Movement"::Allow;
+ QltyInspectionResult."Lot Allow Invt. Pick" := QltyInspectionResult."Lot Allow Invt. Pick"::Allow;
+ QltyInspectionResult."Lot Allow Invt. Put-Away" := QltyInspectionResult."Lot Allow Invt. Put-Away"::Allow;
+ QltyInspectionResult."Lot Allow Movement" := QltyInspectionResult."Lot Allow Movement"::Allow;
+ QltyInspectionResult."Lot Allow Output" := QltyInspectionResult."Lot Allow Output"::Allow;
+ QltyInspectionResult."Lot Allow Pick" := QltyInspectionResult."Lot Allow Pick"::Allow;
+ QltyInspectionResult."Lot Allow Purchase" := QltyInspectionResult."Lot Allow Purchase"::Allow;
+ QltyInspectionResult."Lot Allow Put-Away" := QltyInspectionResult."Lot Allow Put-Away"::Allow;
+ QltyInspectionResult."Lot Allow Transfer" := QltyInspectionResult."Lot Allow Transfer"::Allow;
+ QltyInspectionResult.Modify();
+ end;
+
+ internal procedure ClearSetupTriggerDefaults(var QltyManagementSetup: Record "Qlty. Management Setup")
+ begin
+ QltyManagementSetup."Purchase Trigger" := QltyManagementSetup."Purchase Trigger"::NoTrigger;
+ QltyManagementSetup."Sales Return Trigger" := QltyManagementSetup."Sales Return Trigger"::NoTrigger;
+ QltyManagementSetup."Warehouse Receive Trigger" := QltyManagementSetup."Warehouse Receive Trigger"::NoTrigger;
+ QltyManagementSetup."Warehouse Trigger" := QltyManagementSetup."Warehouse Trigger"::NoTrigger;
+ QltyManagementSetup."Transfer Trigger" := QltyManagementSetup."Transfer Trigger"::NoTrigger;
+ QltyManagementSetup."Production Trigger" := QltyManagementSetup."Production Trigger"::NoTrigger;
+ QltyManagementSetup."Assembly Trigger" := QltyManagementSetup."Assembly Trigger"::NoTrigger;
+ QltyManagementSetup.Modify();
+ end;
+
+ internal procedure CreatePackageTracking(var PackageNoSeries: Record "No. Series"; var PackageNoSeriesLine: Record "No. Series Line"; var PackageItemTrackingCode: Record "Item Tracking Code")
+ var
+ InventorySetup: Record "Inventory Setup";
+ LibraryItemTracking: Codeunit "Library - Item Tracking";
+ begin
+ InventorySetup.Get();
+ if InventorySetup."Package Nos." <> '' then begin
+ PackageNoSeries.Get(InventorySetup."Package Nos.");
+ PackageNoSeriesLine.SetRange(PackageNoSeriesLine."Series Code");
+ if not PackageNoSeriesLine.FindFirst() then
+ LibraryUtility.CreateNoSeriesLine(PackageNoSeriesLine, PackageNoSeries.Code, PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '0'), PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '9'));
+ end else begin
+ LibraryUtility.CreateNoSeries(PackageNoSeries, true, true, false);
+ LibraryUtility.CreateNoSeriesLine(PackageNoSeriesLine, PackageNoSeries.Code, PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '0'), PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '9'));
+ InventorySetup.Validate("Package Nos.", PackageNoSeries.Code);
+ InventorySetup.Modify(true);
+ end;
+ LibraryItemTracking.CreateItemTrackingCode(PackageItemTrackingCode, false, false, true);
+ end;
+
+ internal procedure CreateLotTrackedItemWithVariant(var LotTrackedItem: Record Item; var OutOptionalItemVariant: Code[10])
+ var
+ ItemVariant: Record "Item Variant";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ CreateLotTrackedItem(LotTrackedItem);
+ OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, LotTrackedItem."No.");
+ LotTrackedItem.Modify(true);
+ end;
+
+ internal procedure CreateSerialTrackedItemWithVariant(var SerialTrackedItem: Record Item; var OutOptionalItemVariant: Code[10])
+ var
+ ItemVariant: Record "Item Variant";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ CreateSerialTrackedItem(SerialTrackedItem);
+ OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, SerialTrackedItem."No.");
+ SerialTrackedItem.Modify(true);
+ end;
+
+ internal procedure CreateSerialTrackedItemWithVariant(var SerialTrackedItem: Record Item; SerialNoSeries: Code[20]; SerialTrackingCode: Code[10]; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
+ var
+ ItemVariant: Record "Item Variant";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ CreateSerialTrackedItem(SerialTrackedItem);
+ OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, SerialTrackedItem."No.");
+ end;
+
+ internal procedure CreatePackageTrackedItem(var PackageTrackedItem: Record Item; PackageTrackingCode: Code[10]; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
+ var
+ ItemVariant: Record "Item Variant";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ LibraryInventory.CreateItem(PackageTrackedItem);
+ OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, PackageTrackedItem."No.");
+ PackageTrackedItem.Validate("Item Tracking Code", PackageTrackingCode);
+ PackageTrackedItem.Validate("Unit Cost", UnitCost);
+ PackageTrackedItem.Modify(true);
+ end;
+
+ internal procedure CreateUntrackedItem(var UntrackedItem: Record Item; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
+ var
+ ItemVariant: Record "Item Variant";
+ LibraryInventory: Codeunit "Library - Inventory";
+ begin
+ LibraryInventory.CreateItem(UntrackedItem);
+ OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, UntrackedItem."No.");
+ UntrackedItem.Validate("Unit Cost", UnitCost);
+ UntrackedItem.Modify(true);
+ end;
+
+ internal procedure GetCode20NoSeries(InPrefix: Text; var OutStart: Code[20]; var OutEnd: Code[20])
+ var
+ Temp: Text;
+ begin
+ Temp :=
+ InPrefix + Format(CurrentDateTime(), 0, '') +
+ GetNextSequenceNoAsText(InPrefix, 3);
+ OutStart := CopyStr(Temp.PadRight(MaxStrLen(OutStart), '1'), 1, MaxStrLen(OutStart));
+ OutEnd := CopyStr(Temp.PadRight(MaxStrLen(OutEnd), '9'), 1, MaxStrLen(OutEnd));
+ end;
+
+ local procedure GetNextSequenceNoAsText(SequenceKey: Text; PadSize: Integer) Out: Text;
+ var
+ QltySessionHelper: Codeunit "Qlty. Session Helper";
+ BigResult: BigInteger;
+ CurrentSessionValue: Text;
+ PreviousessionDateTime: DateTime;
+ Sequence: BigInteger;
+ begin
+ SequenceKey := SequenceKey + Format(CurrentDateTime(), 0, '');
+ CurrentSessionValue := QltySessionHelper.GetSessionValue(SequenceKey);
+ PreviousessionDateTime := CurrentDateTime();
+ if CurrentSessionValue <> '' then
+ Evaluate(PreviousessionDateTime, CurrentSessionValue, 9);
+ QltySessionHelper.SetSessionValue(SequenceKey, Format(CurrentDateTime(), 0, 9));
+
+ if PreviousessionDateTime <> 0DT then
+ BigResult := CurrentDateTime() - PreviousessionDateTime;
+
+ if not NumberSequence.Exists(SequenceKey, true) then
+ NumberSequence.Insert(SequenceKey, BigResult);
+
+ Sequence := NumberSequence.Next(SequenceKey);
+ if Sequence < BigResult then
+ NumberSequence.Restart(SequenceKey, BigResult);
+
+ Sequence := NumberSequence.Next(SequenceKey);
+ Out := Format(Sequence, 0, 9);
+ Out := Out.PadLeft(PadSize, '0');
+ end;
+
+ internal procedure CreateWarehouseReceiptSetup(var CreatedQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry")
+ begin
+ CreateWarehouseReceiptSetup(CreatedQltyInspectionGenRule, OutPurchaseLine, OutReservationEntry, 123);
+ end;
+
+ internal procedure CreateWarehouseReceiptSetup(var CreatedQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry"; Quantity: Decimal)
+ var
+ Item: Record Item;
+ Location: Record Location;
+ QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
+ PurchaseHeader: Record "Purchase Header";
+ LibraryWarehouse: Codeunit "Library - Warehouse";
+ OrdQltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
+ begin
+ EnsureSetupExists();
+ LibraryWarehouse.CreateFullWMSLocation(Location, 1);
+ CreateTemplate(QltyInspectionTemplateHdr, 1);
+ CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Purchase Line", CreatedQltyInspectionGenRule);
+
+ CreatedQltyInspectionGenRule."Purchase Trigger" := CreatedQltyInspectionGenRule."Purchase Trigger"::OnPurchaseOrderPostReceive;
+ CreatedQltyInspectionGenRule.Modify();
+
+ CreateLotTrackedItem(Item);
+
+ Item.SetRecFilter();
+ CreatedQltyInspectionGenRule."Item Filter" := CopyStr(Item.GetView(), 1, MaxStrLen(CreatedQltyInspectionGenRule."Item Filter"));
+ CreatedQltyInspectionGenRule."Activation Trigger" := CreatedQltyInspectionGenRule."Activation Trigger"::"Manual or Automatic";
+ CreatedQltyInspectionGenRule."Purchase Trigger" := CreatedQltyInspectionGenRule."Purchase Trigger"::OnPurchaseOrderPostReceive;
+ CreatedQltyInspectionGenRule.Modify();
+
+ OrdQltyPurOrderGenerator.CreatePurchaseOrder(Quantity, Location, Item, PurchaseHeader, OutPurchaseLine, OutReservationEntry);
+ end;
+
+ ///
+ /// Wrapper for internal procedure IsQualityManagementApplicationAreaEnabled from Qlty. Application Area Mgmt. codeunit.
+ ///
+ /// True if Quality Management application area is enabled.
+ internal procedure IsQualityManagementApplicationAreaEnabled(): Boolean
+ var
+ QltyApplicationAreaMgmt: Codeunit "Qlty. Application Area Mgmt.";
+ begin
+ exit(QltyApplicationAreaMgmt.IsQualityManagementApplicationAreaEnabled());
+ end;
+
+ #region Qlty. Auto Configure Wrappers
+
+ ///
+ /// Wrapper for internal procedure EnsureBasicSetupExists from Qlty. Auto Configure codeunit.
+ /// Ensures that basic quality management setup exists.
+ ///
+ /// Whether to show UI during setup.
+ internal procedure EnsureBasicSetupExists(ShowUI: Boolean)
+ var
+ QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
+ begin
+ QltyAutoConfigure.EnsureBasicSetupExists(ShowUI);
+ end;
+
+ ///
+ /// Wrapper for internal procedure GetDefaultPassResult from Qlty. Auto Configure codeunit.
+ /// Returns the default PASS result code.
+ ///
+ /// The default PASS result code.
+ internal procedure GetDefaultPassResult(): Code[20]
+ var
+ QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
+ ResultCode: Code[20];
+ begin
+ ResultCode := CopyStr(QltyAutoConfigure.GetDefaultPassResult(), 1, MaxStrLen(ResultCode));
+ exit(ResultCode);
+ end;
+
+ #endregion Qlty. Auto Configure Wrappers
+
+ #region Qlty. Result Evaluation Wrappers
+
+ ///
+ /// Wrapper for internal procedure CheckIfValueIsDecimal from Qlty. Result Evaluation codeunit.
+ ///
+ /// The value to check.
+ /// The acceptable value condition.
+ /// True if the value matches the condition, false otherwise.
+ internal procedure CheckIfValueIsDecimal(ValueToCheck: Text; AcceptableValue: Text): Boolean
+ var
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ exit(QltyResultEvaluation.CheckIfValueIsDecimal(ValueToCheck, AcceptableValue));
+ end;
+
+ ///
+ /// Wrapper for internal procedure CheckIfValueIsInteger from Qlty. Result Evaluation codeunit.
+ ///
+ /// The value to check.
+ /// The acceptable value condition.
+ /// True if the value matches the condition, false otherwise.
+ internal procedure CheckIfValueIsInteger(ValueToCheck: Text; AcceptableValue: Text): Boolean
+ var
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ exit(QltyResultEvaluation.CheckIfValueIsInteger(ValueToCheck, AcceptableValue));
+ end;
+
+ ///
+ /// Wrapper for internal procedure CheckIfValueIsString from Qlty. Result Evaluation codeunit.
+ /// Uses default case sensitivity (Sensitive).
+ ///
+ /// The value to check.
+ /// The acceptable value condition.
+ /// True if the value matches the condition, false otherwise.
+ internal procedure CheckIfValueIsString(ValueToCheck: Text; AcceptableValue: Text): Boolean
+ var
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ exit(QltyResultEvaluation.CheckIfValueIsString(ValueToCheck, AcceptableValue));
+ end;
+
+ ///
+ /// Wrapper for internal procedure CheckIfValueIsString from Qlty. Result Evaluation codeunit.
+ ///
+ /// The value to check.
+ /// The acceptable value condition.
+ /// The case sensitivity option.
+ /// True if the value matches the condition, false otherwise.
+ internal procedure CheckIfValueIsString(ValueToCheck: Text; AcceptableValue: Text; QltyCaseSensitivity: Enum "Qlty. Case Sensitivity"): Boolean
+ var
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ exit(QltyResultEvaluation.CheckIfValueIsString(ValueToCheck, AcceptableValue, QltyCaseSensitivity));
+ end;
+
+ ///
+ /// Wrapper for internal procedure ValidateQltyInspectionLine from Qlty. Result Evaluation codeunit.
+ /// Validates an inspection line using the single-parameter internal signature.
+ ///
+ /// The inspection line to validate.
+ internal procedure ValidateQltyInspectionLine(var QltyInspectionLine: Record "Qlty. Inspection Line")
+ var
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ QltyResultEvaluation.ValidateQltyInspectionLine(QltyInspectionLine);
+ end;
+
+ ///
+ /// Wrapper for internal procedure ValidateAllowableValuesOnTest from Qlty. Result Evaluation codeunit.
+ /// Validates allowable values on a test with inspection header context only.
+ ///
+ /// The test record to validate.
+ /// The inspection header context.
+ internal procedure ValidateAllowableValuesOnTest(var QltyTest: Record "Qlty. Test"; var QltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyInspectionLine: Record "Qlty. Inspection Line";
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ QltyResultEvaluation.ValidateAllowableValuesOnTest(QltyTest, QltyInspectionHeader, QltyInspectionLine);
+ end;
+
+ ///
+ /// Wrapper for internal procedure EvaluateResult from Qlty. Result Evaluation codeunit.
+ /// Evaluates result without inspection line context (passing empty line record).
+ ///
+ /// The inspection header.
+ /// The result condition configuration.
+ /// The test value type.
+ /// The value to evaluate.
+ /// The case sensitivity option.
+ /// The result code.
+ internal procedure EvaluateResult(var QltyInspectionHeader: Record "Qlty. Inspection Header"; var QltyIResultConditConf: Record "Qlty. I. Result Condit. Conf."; QltyTestValueType: Enum "Qlty. Test Value Type"; Value: Text; QltyCaseSensitivity: Enum "Qlty. Case Sensitivity"): Code[20]
+ var
+ QltyInspectionLine: Record "Qlty. Inspection Line";
+ QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ begin
+ exit(QltyResultEvaluation.EvaluateResult(QltyInspectionHeader, QltyInspectionLine, QltyIResultConditConf, QltyTestValueType, Value, QltyCaseSensitivity));
+ end;
+
+ #endregion Qlty. Result Evaluation Wrappers
+
+ #region Qlty. Notification Mgmt. Wrappers
+
+ ///
+ /// Wrapper for internal procedure NotifyDoYouWantToAssignToYourself from Qlty. Notification Mgmt. codeunit.
+ ///
+ /// The inspection header record.
+ internal procedure NotifyDoYouWantToAssignToYourself(QltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
+ begin
+ QltyNotificationMgmt.NotifyDoYouWantToAssignToYourself(QltyInspectionHeader);
+ end;
+
+ ///
+ /// Wrapper for internal procedure HandleOpenDocument from Qlty. Notification Mgmt. codeunit.
+ ///
+ /// The notification that triggered the action.
+ internal procedure HandleOpenDocument(NotificationToShow: Notification)
+ var
+ QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
+ begin
+ QltyNotificationMgmt.HandleOpenDocument(NotificationToShow);
+ end;
+
+ ///
+ /// Wrapper for internal procedure HandleNotificationActionAssignToSelf from Qlty. Notification Mgmt. codeunit.
+ ///
+ /// The notification that triggered the action.
+ internal procedure HandleNotificationActionAssignToSelf(NotificationToShow: Notification)
+ var
+ QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
+ begin
+ QltyNotificationMgmt.HandleNotificationActionAssignToSelf(NotificationToShow);
+ end;
+
+ ///
+ /// Wrapper for internal procedure HandleNotificationActionIgnore from Qlty. Notification Mgmt. codeunit.
+ ///
+ /// The notification that triggered the action.
+ internal procedure HandleNotificationActionIgnore(NotificationToShow: Notification)
+ var
+ QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
+ begin
+ QltyNotificationMgmt.HandleNotificationActionIgnore(NotificationToShow);
+ end;
+
+ #endregion Qlty. Notification Mgmt. Wrappers
+
+ #region Qlty. Inspection - Create Wrappers
+
+ ///
+ /// Wrapper for internal procedure FindExistingInspectionWithMultipleVariants from Qlty. Inspection - Create codeunit.
+ /// Finds existing inspections based on the multiple variants supplied.
+ ///
+ /// If true, raises an error when no matching rule is found.
+ /// The main reference variant.
+ /// Optional second variant.
+ /// Optional third variant.
+ /// Optional fourth variant.
+ /// The found inspection header.
+ /// True if an existing inspection was found.
+ internal procedure FindExistingInspectionWithMultipleVariants(RaiseErrorIfNoRuleIsFound: Boolean; ReferenceVariant: Variant; OptionalVariant2: Variant; OptionalVariant3: Variant; OptionalVariant4: Variant; var QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ exit(QltyInspectionCreate.FindExistingInspectionWithMultipleVariants(RaiseErrorIfNoRuleIsFound, ReferenceVariant, OptionalVariant2, OptionalVariant3, OptionalVariant4, QltyInspectionHeader));
+ end;
+
+ ///
+ /// Wrapper for internal procedure FindExistingInspection from Qlty. Inspection - Create codeunit.
+ /// Finds existing inspections based on RecordRef parameters.
+ ///
+ /// If true, raises an error when no matching rule is found.
+ /// The main target record that the inspection will be created against.
+ /// Optional second RecordRef.
+ /// Optional third RecordRef.
+ /// Optional fourth RecordRef.
+ /// The found inspection header.
+ /// True if an existing inspection was found.
+ internal procedure FindExistingInspection(RaiseErrorIfNoRuleIsFound: Boolean; TargetRecordRef: RecordRef; Optional2RecordRef: RecordRef; Optional3RecordRef: RecordRef; Optional4RecordRef: RecordRef; var QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ exit(QltyInspectionCreate.FindExistingInspection(RaiseErrorIfNoRuleIsFound, TargetRecordRef, Optional2RecordRef, Optional3RecordRef, Optional4RecordRef, QltyInspectionHeader));
+ end;
+
+ #endregion Qlty. Inspection - Create Wrappers
+
+ #region Qlty. Traversal Wrappers
+
+ ///
+ /// Wrapper for internal procedure FindRelatedItem from Qlty. Traversal codeunit (4 optional variants version).
+ /// Searches for a related Item record by sequentially checking supplied record variants.
+ ///
+ /// Output parameter that will contain the found Item record.
+ /// Primary record reference to search from.
+ /// Second optional variant to search.
+ /// Third optional variant to search.
+ /// Fourth optional variant to search.
+ /// True if an Item was found; False otherwise.
+ internal procedure FindRelatedItem(var Item: Record Item; TargetRecordRef: RecordRef; Optional2Variant: Variant; Optional3Variant: Variant; Optional4Variant: Variant): Boolean
+ var
+ QltyTraversal: Codeunit "Qlty. Traversal";
+ begin
+ exit(QltyTraversal.FindRelatedItem(Item, TargetRecordRef, Optional2Variant, Optional3Variant, Optional4Variant));
+ end;
+
+ ///
+ /// Wrapper for internal procedure FindRelatedItem from Qlty. Traversal codeunit (5 optional variants version).
+ /// Searches for a related Item record by sequentially checking supplied record variants.
+ ///
+ /// Output parameter that will contain the found Item record.
+ /// Primary record reference to search from.
+ /// Second optional variant to search.
+ /// Third optional variant to search.
+ /// Fourth optional variant to search.
+ /// Fifth optional variant to search.
+ /// True if an Item was found; False otherwise.
+ internal procedure FindRelatedItem(var Item: Record Item; TargetRecordRef: RecordRef; Optional2Variant: Variant; Optional3Variant: Variant; Optional4Variant: Variant; Optional5Variant: Variant): Boolean
+ var
+ QltyTraversal: Codeunit "Qlty. Traversal";
+ begin
+ exit(QltyTraversal.FindRelatedItem(Item, TargetRecordRef, Optional2Variant, Optional3Variant, Optional4Variant, Optional5Variant));
+ end;
+
+ #endregion Qlty. Traversal Wrappers
+
+ #region Qlty. Inspect. Source Config. Helpers
+
+ ///
+ /// Creates and inserts a source configuration record with randomized code and description.
+ /// This helper procedure encapsulates the boilerplate code for creating source configurations.
+ ///
+ /// The source configuration record to populate and insert (var parameter).
+ /// The source table number.
+ /// The target type (Chained table, Inspection, or Item Tracking only).
+ /// The target table number.
+ internal procedure CreateSourceConfig(var QltyInspectSourceConfig: Record "Qlty. Inspect. Source Config."; FromTableNo: Integer; ToType: Enum "Qlty. Target Type"; ToTableNo: Integer)
+ var
+ ConfigCode: Text;
+ begin
+ QltyInspectSourceConfig.Init();
+ GenerateRandomCharacters(MaxStrLen(QltyInspectSourceConfig.Code), ConfigCode);
+ QltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(QltyInspectSourceConfig.Code));
+ QltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(QltyInspectSourceConfig.Description));
+ QltyInspectSourceConfig.Validate("From Table No.", FromTableNo);
+ QltyInspectSourceConfig."To Type" := ToType;
+ QltyInspectSourceConfig.Validate("To Table No.", ToTableNo);
+ QltyInspectSourceConfig.Insert();
+ end;
+
+ #endregion Qlty. Inspect. Source Config. Helpers
+
+ #region Qlty. Inspect. Source Config. Wrappers
+
+ ///
+ /// Wrapper for internal QltyInspectSourceConfig.DetectInterestingConfiguration.
+ /// Detects if the source configuration has interesting (potentially problematic) table configurations.
+ ///
+ /// The source configuration record to check.
+ internal procedure DetectInterestingConfiguration(var QltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.")
+ begin
+ QltyInspectSourceConfig.DetectInterestingConfiguration();
+ end;
+
+ #endregion Qlty. Inspect. Source Config. Wrappers
+
+ #region Qlty. Inspect. Src. Fld. Conf. Helpers
+
+ ///
+ /// Creates and inserts a source field configuration record.
+ /// This helper procedure encapsulates the boilerplate code for creating field configurations,
+ /// calling the internal InitLineNoIfNeeded procedure.
+ ///
+ /// The code of the parent source configuration.
+ /// The source table number.
+ /// The source field number.
+ /// The target type (Chained table, Inspection, or Item Tracking only).
+ /// The target table number.
+ /// The target field number.
+ internal procedure CreateSourceFieldConfig(SourceConfigCode: Code[20]; FromTableNo: Integer; FromFieldNo: Integer; ToType: Enum "Qlty. Target Type"; ToTableNo: Integer;
+ ToFieldNo: Integer)
+ var
+ QltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
+ begin
+ Clear(QltyInspectSrcFldConf);
+ QltyInspectSrcFldConf.Init();
+ QltyInspectSrcFldConf.Code := SourceConfigCode;
+ QltyInspectSrcFldConf.InitLineNoIfNeeded();
+ QltyInspectSrcFldConf."From Table No." := FromTableNo;
+ QltyInspectSrcFldConf."From Field No." := FromFieldNo;
+ QltyInspectSrcFldConf."To Type" := ToType;
+ QltyInspectSrcFldConf."To Table No." := ToTableNo;
+ QltyInspectSrcFldConf."To Field No." := ToFieldNo;
+ QltyInspectSrcFldConf.Insert();
+ end;
+
+ ///
+ /// Creates and inserts a source field configuration record by resolving a field name.
+ /// This overload is useful when the same field is used for both source and target (e.g., inspection-to-inspection mapping).
+ ///
+ /// The code of the parent source configuration.
+ /// The table number for both source and target (used for field name resolution).
+ /// The target type (Chained table, Inspection, or Item Tracking only).
+ /// The field name to resolve to a field number.
+ internal procedure CreateSourceFieldConfigByName(SourceConfigCode: Code[20]; TableNo: Integer; ToType: Enum "Qlty. Target Type"; FieldName: Text)
+ var
+ FieldRec: Record Field;
+ begin
+ FieldRec.SetRange(TableNo, TableNo);
+ FieldRec.SetRange(FieldName, FieldName);
+ FieldRec.FindFirst();
+ CreateSourceFieldConfig(SourceConfigCode, TableNo, FieldRec."No.", ToType, TableNo, FieldRec."No.");
+ end;
+
+ #endregion Qlty. Inspect. Src. Fld. Conf. Helpers
+
+ #region Qlty. Item Tracking Wrappers
+
+ ///
+ /// Wrapper for internal QltyItemTracking.IsItemTrackingUsed.
+ /// Returns true if the item is either lot, serial, or package tracked.
+ ///
+ /// The item number to check.
+ /// Temporary item tracking setup record that will contain the tracking information.
+ /// True if item tracking is used for the item.
+ internal procedure IsItemTrackingUsed(ItemNo: Code[20]; var TempItemTrackingSetup: Record "Item Tracking Setup" temporary): Boolean
+ var
+ QltyItemTracking: Codeunit "Qlty. Item Tracking";
+ begin
+ exit(QltyItemTracking.IsItemTrackingUsed(ItemNo, TempItemTrackingSetup));
+ end;
+
+ ///
+ /// Wrapper for internal QltyItemTrackingMgmt.DeleteAndRecreatePurchaseReturnOrderLineTracking.
+ /// Deletes all Reservation Entries for the line and creates a single entry with the updated quantity.
+ ///
+ /// The inspection header containing item tracking info.
+ /// The purchase return order line.
+ /// The quantity to return.
+ internal procedure DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader: Record "Qlty. Inspection Header"; ReturnOrderPurchaseLine: Record "Purchase Line"; QtyToReturn: Decimal)
+ var
+ QltyItemTrackingMgmt: Codeunit "Qlty. Item Tracking Mgmt.";
+ begin
+ QltyItemTrackingMgmt.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, ReturnOrderPurchaseLine, QtyToReturn);
+ end;
+
+ #endregion Qlty. Item Tracking Wrappers
+
+ #region Qlty. Management Setup Wrappers
+
+ ///
+ /// Wrapper for internal QltyManagementSetup.GetSetupVideoLink.
+ /// Returns the setup video link from the management setup.
+ ///
+ /// The setup record to get the video link from.
+ /// The setup video link text.
+ internal procedure GetSetupVideoLink(var QltyManagementSetup: Record "Qlty. Management Setup"): Text
+ begin
+ exit(QltyManagementSetup.GetSetupVideoLink());
+ end;
+
+ ///
+ /// Wrapper for internal QltyManagementSetup.GetBrickHeaders.
+ /// Retrieves and updates the brick header values in the setup record.
+ ///
+ /// The setup record to update with brick headers.
+ internal procedure GetBrickHeaders(var QltyManagementSetup: Record "Qlty. Management Setup")
+ begin
+ QltyManagementSetup.GetBrickHeaders(
+ QltyManagementSetup."Brick Top Left Header",
+ QltyManagementSetup."Brick Middle Left Header",
+ QltyManagementSetup."Brick Middle Right Header",
+ QltyManagementSetup."Brick Bottom Left Header",
+ QltyManagementSetup."Brick Bottom Right Header");
+ end;
+
+ ///
+ /// Wrapper for internal QltyManagementSetup.GetAppGuid.
+ /// Returns the application GUID for the Quality Management app.
+ ///
+ /// The setup record.
+ /// The application GUID.
+ internal procedure GetAppGuid(var QltyManagementSetup: Record "Qlty. Management Setup"): Guid
+ begin
+ exit(QltyManagementSetup.GetAppGuid());
+ end;
+
+ ///
+ /// Wrapper for internal QltyManagementSetup.GetVersion.
+ /// Returns the version text for the Quality Management app.
+ ///
+ /// The setup record.
+ /// The version text.
+ internal procedure GetVersion(var QltyManagementSetup: Record "Qlty. Management Setup"): Text
+ begin
+ exit(QltyManagementSetup.GetVersion());
+ end;
+
+ #endregion Qlty. Management Setup Wrappers
+
+ #region Qlty. Inspection - Create Wrappers
+
+ ///
+ /// Wrapper for internal QltyInspectionCreate.CreateMultipleInspectionsForMarkedTrackingSpecification.
+ /// Use this with Marked records.
+ ///
+ /// You must mark your records as a pre-requisite.
+ internal procedure CreateMultipleInspectionsForMarkedTrackingSpecification(var TempTrackingSpecification: Record "Tracking Specification" temporary)
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ QltyInspectionCreate.CreateMultipleInspectionsForMarkedTrackingSpecification(TempTrackingSpecification);
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords.
+ /// Creates multiple inspections for a set of records.
+ ///
+ /// RecordRef containing the records to create inspections for.
+ /// Whether this is a manual creation (affects display behavior).
+ internal procedure CreateMultipleInspectionsForMultipleRecords(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean)
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(SetOfRecordsRecordRef, IsManualCreation);
+ end;
+
+ #endregion Qlty. Inspection - Create Wrappers
+
+ #region Qlty. Disposition Wrappers
+
+ ///
+ /// Wrapper for internal QltyDispPurchaseReturn.PerformDisposition (7-argument version) and GetCreatedPurchaseReturnBuffer.
+ /// Performs disposition and returns the created purchase return buffer.
+ ///
+ internal procedure PerformPurchaseReturnDisposition(var QltyInspectionHeader: Record "Qlty. Inspection Header"; QltyQuantityBehavior: Enum "Qlty. Quantity Behavior"; OptionalSpecificQuantity: Decimal;
+ OptionalSourceLocationFilter: Text;
+ OptionalSourceBinFilter: Text;
+ ReasonCode: Code[10];
+ ExternalDocumentNo: Code[35]; var TempCreatedBufferPurchaseHeader: Record "Purchase Header" temporary): Boolean
+ var
+ QltyDispPurchaseReturn: Codeunit "Qlty. Disp. Purchase Return";
+ Result: Boolean;
+ begin
+ Result := QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, QltyQuantityBehavior, OptionalSpecificQuantity, OptionalSourceLocationFilter, OptionalSourceBinFilter, ReasonCode, ExternalDocumentNo);
+ QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempCreatedBufferPurchaseHeader);
+ exit(Result);
+ end;
+
+ ///
+ /// Wrapper for internal QltyDispNegAdjustInv.PerformDisposition (7-argument version).
+ ///
+ internal procedure PerformNegAdjustInvDisposition(var QltyInspectionHeader: Record "Qlty. Inspection Header"; OptionalSpecificQuantity: Decimal; QltyQuantityBehavior: Enum "Qlty. Quantity Behavior"; OptionalSourceLocationFilter: Text;
+ OptionalSourceBinFilter: Text;
+ PostingBehavior: Enum "Qlty. Item Adj. Post Behavior";
+ Reason: Code[10]): Boolean
+ var
+ QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
+ begin
+ exit(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, OptionalSpecificQuantity, QltyQuantityBehavior, OptionalSourceLocationFilter, OptionalSourceBinFilter, PostingBehavior, Reason));
+ end;
+
+ ///
+ /// Wrapper for internal QltyDispTransfer.PerformDisposition (7-argument version).
+ ///
+ internal procedure PerformTransferDisposition(QltyInspectionHeader: Record "Qlty. Inspection Header"; OptionalSpecificQuantity: Decimal; QltyQuantityBehavior: Enum "Qlty. Quantity Behavior"; OptionalSourceLocationFilter: Text;
+ OptionalSourceBinFilter: Text;
+ DestinationLocationCode: Code[10];
+ OptionalInTransitLocationCode: Code[10]): Boolean
+ var
+ QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
+ begin
+ exit(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, OptionalSpecificQuantity, QltyQuantityBehavior, OptionalSourceLocationFilter, OptionalSourceBinFilter, DestinationLocationCode, OptionalInTransitLocationCode));
+ end;
+
+ ///
+ /// Wrapper for internal QltyDispMoveAutoChoose.MoveInventory.
+ ///
+ internal procedure MoveInventory(QltyInspectionHeader: Record "Qlty. Inspection Header"; TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary; UseMovement: Boolean): Boolean
+ var
+ QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
+ begin
+ exit(QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, UseMovement));
+ end;
+
+ ///
+ /// Wrapper for internal QltyDispInternalPutAway.PerformDisposition (6-argument version).
+ ///
+ internal procedure PerformInternalPutAwayDisposition(QltyInspectionHeader: Record "Qlty. Inspection Header"; OptionalSpecificQuantity: Decimal; OptionalSourceLocationFilter: Text; OptionalSourceBinFilter: Text; ReleaseImmediately: Boolean; QltyQuantityBehavior: Enum "Qlty. Quantity Behavior"): Boolean
+ var
+ QltyDispInternalPutAway: Codeunit "Qlty. Disp. Internal Put-away";
+ begin
+ exit(QltyDispInternalPutAway.PerformDisposition(QltyInspectionHeader, OptionalSpecificQuantity, OptionalSourceLocationFilter, OptionalSourceBinFilter, ReleaseImmediately, QltyQuantityBehavior));
+ end;
+
+ ///
+ /// Wrapper for internal QltyDispWarehousePutAway.PerformDisposition (5-argument version).
+ ///
+ internal procedure PerformWarehousePutAwayDisposition(QltyInspectionHeader: Record "Qlty. Inspection Header"; OptionalSpecificQuantity: Decimal; OptionalSourceLocationFilter: Text; OptionalSourceBinFilter: Text; QltyQuantityBehavior: Enum "Qlty. Quantity Behavior"): Boolean
+ var
+ QltyDispWarehousePutAway: Codeunit "Qlty. Disp. Warehouse Put-away";
+ begin
+ exit(QltyDispWarehousePutAway.PerformDisposition(QltyInspectionHeader, OptionalSpecificQuantity, OptionalSourceLocationFilter, OptionalSourceBinFilter, QltyQuantityBehavior));
+ end;
+
+ ///
+ /// Wrapper for internal QltyAutoConfigure.EnsureAtLeastOneSourceConfigurationExist.
+ ///
+ internal procedure EnsureAtLeastOneSourceConfigurationExist(ForceAll: Boolean)
+ var
+ QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
+ begin
+ QltyAutoConfigure.EnsureAtLeastOneSourceConfigurationExist(ForceAll);
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.IsItemTrackingUsed (no parameters).
+ ///
+ internal procedure IsInspectionItemTrackingUsed(QltyInspectionHeader: Record "Qlty. Inspection Header"): Boolean
+ begin
+ exit(QltyInspectionHeader.IsItemTrackingUsed());
+ end;
+
+ #endregion Qlty. Disposition Wrappers
+
+ #region Qlty. Filter Helpers Wrappers
+
+ ///
+ /// Wrapper for internal QltyFilterHelpers.BuildFilter.
+ ///
+ internal procedure BuildFilter(TableNo: Integer; IncludeWhereText: Boolean; var Value: Text): Boolean
+ var
+ QltyFilterHelpers: Codeunit "Qlty. Filter Helpers";
+ begin
+ exit(QltyFilterHelpers.BuildFilter(TableNo, IncludeWhereText, Value));
+ end;
+
+ ///
+ /// Wrapper for internal QltyFilterHelpers.BuildItemAttributeFilter.
+ ///
+ internal procedure BuildItemAttributeFilter(var ItemAttributeFilter: Text)
+ var
+ QltyFilterHelpers: Codeunit "Qlty. Filter Helpers";
+ begin
+ QltyFilterHelpers.BuildItemAttributeFilter(ItemAttributeFilter);
+ end;
+
+ #endregion Qlty. Filter Helpers Wrappers
+
+ #region Qlty. Utilities Integration Wrappers
+
+ ///
+ /// Wrapper for internal QltyUtilitiesIntegration.InternalHandleOnAfterGetPageSummary.
+ ///
+ internal procedure HandleOnAfterGetPageSummary(PageId: Integer; RecId: RecordId; var JsonArray: JsonArray)
+ var
+ QltyUtilitiesIntegration: Codeunit "Qlty. Utilities Integration";
+ begin
+ QltyUtilitiesIntegration.InternalHandleOnAfterGetPageSummary(PageId, RecId, JsonArray);
+ end;
+
+ #endregion Qlty. Utilities Integration Wrappers
+
+ #region Qlty. Inspec. Gen. Rule Mgmt. Wrappers
+
+ ///
+ /// Wrapper for internal QltyInspecGenRuleMgmt.SetFilterToApplicableTemplates.
+ /// Sets the filter on the target configuration to sources that could match the supplied template.
+ ///
+ internal procedure SetFilterToApplicableTemplates(TemplateCode: Code[20]; var QltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.")
+ var
+ QltyInspecGenRuleMgmt: Codeunit "Qlty. Inspec. Gen. Rule Mgmt.";
+ begin
+ QltyInspecGenRuleMgmt.SetFilterToApplicableTemplates(TemplateCode, QltyInspectSourceConfig);
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspecGenRuleMgmt.GetFilterForAvailableConfigurations.
+ /// Returns the filter for available source configurations.
+ ///
+ internal procedure GetFilterForAvailableConfigurations(): Text
+ var
+ QltyInspecGenRuleMgmt: Codeunit "Qlty. Inspec. Gen. Rule Mgmt.";
+ begin
+ exit(QltyInspecGenRuleMgmt.GetFilterForAvailableConfigurations());
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionGenRule.SetEntryNo.
+ /// Sets the entry number for the generation rule record.
+ ///
+ internal procedure SetEntryNo(var QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule")
+ begin
+ QltyInspectionGenRule.SetEntryNo();
+ end;
+
+ #endregion Qlty. Inspec. Gen. Rule Mgmt. Wrappers
+
+ #region Qlty. Inspection Header Wrappers
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.GetReferenceRecordId.
+ /// Returns the reference record ID (SystemId) from the inspection header.
+ ///
+ /// The inspection header record.
+ /// The reference record's SystemId.
+ internal procedure GetReferenceRecordId(var QltyInspectionHeader: Record "Qlty. Inspection Header"): Guid
+ begin
+ exit(QltyInspectionHeader.GetReferenceRecordId());
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.VerifyTrackingBeforeFinish.
+ /// Verifies that item tracking (lot/serial/package) is properly set before finishing an inspection.
+ ///
+ /// The inspection header record.
+ internal procedure VerifyTrackingBeforeFinish(var QltyInspectionHeader: Record "Qlty. Inspection Header")
+ begin
+ QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.DetermineControlInformation.
+ /// Determines the control information for a custom field.
+ ///
+ /// The inspection header record.
+ /// The input text (field name).
+ internal procedure DetermineControlInformation(var QltyInspectionHeader: Record "Qlty. Inspection Header"; Input: Text)
+ begin
+ QltyInspectionHeader.DetermineControlInformation(Input);
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.GetControlCaptionClass.
+ /// Gets the caption class for a custom control field.
+ ///
+ /// The inspection header record.
+ /// The input text (field name).
+ /// The caption text.
+ internal procedure GetControlCaptionClass(var QltyInspectionHeader: Record "Qlty. Inspection Header"; Input: Text): Text
+ begin
+ exit(QltyInspectionHeader.GetControlCaptionClass(Input));
+ end;
+
+ ///
+ /// Wrapper for internal QltyInspectionHeader.GetControlVisibleState.
+ /// Gets the visibility state for a custom control field.
+ ///
+ /// The inspection header record.
+ /// The input text (field name).
+ /// True if the control should be visible.
+ internal procedure GetControlVisibleState(var QltyInspectionHeader: Record "Qlty. Inspection Header"; Input: Text): Boolean
+ begin
+ exit(QltyInspectionHeader.GetControlVisibleState(Input));
+ end;
+
+ #endregion Qlty. Inspection Header Wrappers
+
+ #region Qlty. Test Wrappers
+
+ ///
+ /// Wrapper for internal QltyTest.SuggestUnusedTestCodeFromDescription.
+ /// Suggests an unused test code based on the provided description.
+ ///
+ /// The test record.
+ /// The description to generate a code from.
+ /// The suggested test code (output).
+ internal procedure SuggestUnusedTestCodeFromDescription(var QltyTest: Record "Qlty. Test"; InputDescription: Text; var SuggestionCode: Code[20])
+ begin
+ QltyTest.SuggestUnusedTestCodeFromDescription(InputDescription, SuggestionCode);
+ end;
+
+ #endregion Qlty. Test Wrappers
+
+ #region Qlty. Misc Helpers Wrappers
+
+ ///
+ /// Wrapper for internal QltyMiscHelpers.IsNumericText.
+ /// Checks if the input text represents a numeric value.
+ ///
+ /// The text to check.
+ /// True if the text is numeric.
+ internal procedure IsNumericText(Input: Text): Boolean
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ exit(QltyMiscHelpers.IsNumericText(Input));
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax.
+ /// Attempts to parse a text range (e.g., "1..10") into min and max decimal values.
+ ///
+ /// The text containing a range in format "minValue..maxValue".
+ /// Output: The minimum value from the range.
+ /// Output: The maximum value from the range.
+ /// True if successfully parsed as a simple range.
+ internal procedure AttemptSplitSimpleRangeIntoMinMax(InputText: Text; var MinValueInRange: Decimal; var MaxValueInRange: Decimal): Boolean
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ exit(QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax(InputText, MinValueInRange, MaxValueInRange));
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.GetArbitraryMaximumRecursion.
+ /// Returns the maximum recursion depth limit for traversing multi-level table relationships.
+ ///
+ /// The maximum recursion depth allowed (currently 20 levels).
+ internal procedure GetArbitraryMaximumRecursion(): Integer
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ exit(QltyMiscHelpers.GetArbitraryMaximumRecursion());
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.GetCSVOfValuesFromRecord (internal overload).
+ /// Generates a CSV string of values for a specific field from a table with optional filtering.
+ /// Uses system-defined maximum recursion limit for record count.
+ ///
+ /// The table number to retrieve records from.
+ /// The field number whose values should be extracted.
+ /// Optional filter to apply to the table (AL filter syntax).
+ /// Comma-separated string of field values (up to system maximum records).
+ internal procedure GetCSVOfValuesFromRecord(CurrentTable: Integer; ChoiceField: Integer; TableFilter: Text): Text
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ exit(QltyMiscHelpers.GetCSVOfValuesFromRecord(CurrentTable, ChoiceField, TableFilter, GetArbitraryMaximumRecursion()));
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.GetRecordsForTableField (internal overload).
+ /// Retrieves lookup values for a quality field with context-sensitive filtering.
+ ///
+ /// The quality field configuration defining lookup table and filters.
+ /// Inspection header providing context for filter expression evaluation.
+ /// Output: Temporary buffer populated with lookup values.
+ internal procedure GetRecordsForTableField(var QltyTest: Record "Qlty. Test"; var OptionalContextQltyInspectionHeader: Record "Qlty. Inspection Header"; var TempBufferQltyLookupCode: Record "Qlty. Lookup Code" temporary)
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ QltyMiscHelpers.GetRecordsForTableField(QltyTest, OptionalContextQltyInspectionHeader, TempBufferQltyLookupCode);
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.GetDefaultMaximumRowsFieldLookup.
+ /// Returns the configured maximum rows for field lookups from Quality Management Setup.
+ ///
+ /// Maximum rows to fetch for field lookups (default 100 if not configured).
+ internal procedure GetDefaultMaximumRowsFieldLookup(): Integer
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ exit(QltyMiscHelpers.GetDefaultMaximumRowsFieldLookup());
+ end;
+
+ ///
+ /// Wrapper for QltyMiscHelpers.NavigateToFindEntries.
+ /// Opens the Navigate page to find all related entries for an Inspection's source document.
+ /// Pre-fills search criteria with test source information including item, document number, and tracking.
+ ///
+ /// The Inspection whose related entries should be found.
+ internal procedure NavigateToFindEntries(var QltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
+ begin
+ QltyMiscHelpers.NavigateToFindEntries(QltyInspectionHeader);
+ end;
+
+ #endregion Qlty. Misc Helpers Wrappers
+}
diff --git a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyProdOrderGenerator.Codeunit.al b/src/Apps/W1/Quality Management/Test Library/src/QltyProdOrderGenerator.Codeunit.al
similarity index 89%
rename from src/Apps/W1/Quality Management/test/src/TestLibraries/QltyProdOrderGenerator.Codeunit.al
rename to src/Apps/W1/Quality Management/Test Library/src/QltyProdOrderGenerator.Codeunit.al
index acce124f18..87fabdf347 100644
--- a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyProdOrderGenerator.Codeunit.al
+++ b/src/Apps/W1/Quality Management/Test Library/src/QltyProdOrderGenerator.Codeunit.al
@@ -23,7 +23,7 @@ using Microsoft.Sales.Document;
///
/// Generates random Prod. Orders and all related records for use with automated testing.
///
-codeunit 139952 "Qlty. Prod. Order Generator"
+codeunit 139942 "Qlty. Prod. Order Generator"
{
TableNo = "Production Order";
EventSubscriberInstance = Manual;
@@ -91,7 +91,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
LibrarySales.SetOrderNoSeriesInSetup();
end;
- procedure CreatePurchaseOrder(var PurchaseHeader: Record "Purchase Header"; var Vendor: Record vendor; var Item: Record Item)
+ internal procedure CreatePurchaseOrder(var PurchaseHeader: Record "Purchase Header"; var Vendor: Record vendor; var Item: Record Item)
var
PurchaseLine: Record "Purchase Line";
LibraryPurchase: Codeunit "Library - Purchase";
@@ -109,7 +109,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
///
///
///
- procedure CreateItemAndProductionOrder(var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
+ internal procedure CreateItemAndProductionOrder(var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
var
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
@@ -128,13 +128,30 @@ codeunit 139952 "Qlty. Prod. Order Generator"
OutItem.Get(OutProdProductionOrder."Source No.");
end;
+ ///
+ /// Generates production orders from Item source type and returns the list of created order codes.
+ /// This is a convenience wrapper that initializes the generator, configures it for Item source type,
+ /// and generates the specified quantity of orders.
+ ///
+ /// The number of production orders to generate.
+ /// Returns the list of generated production order codes.
+ internal procedure GenerateItemSourceProdOrders(Quantity: Integer; var OutOrdersList: List of [Code[20]])
+ var
+ QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
+ begin
+ QltyProdOrderGenerator.Init(100);
+ QltyProdOrderGenerator.ToggleAllSources(false);
+ QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
+ QltyProdOrderGenerator.Generate(Quantity, OutOrdersList);
+ end;
+
///
/// Creates Lot-Tracked Item and Production Order
///
///
///
///
- procedure CreateLotTrackedItemAndProductionOrder(var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
+ internal procedure CreateLotTrackedItemAndProductionOrder(var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
var
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
begin
@@ -147,7 +164,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
///
///
///
- procedure CreateLotTrackedItemAndProductionOrder(ProdOrderStatusToCreate: Enum "Production Order Status"; var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
+ internal procedure CreateLotTrackedItemAndProductionOrder(ProdOrderStatusToCreate: Enum "Production Order Status"; var OutItem: Record Item; var OutProdProductionOrder: Record "Production Order"; var OutProdOrderRoutingLine: Record "Prod. Order Routing Line")
var
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
begin
@@ -163,12 +180,12 @@ codeunit 139952 "Qlty. Prod. Order Generator"
OutItem.Get(OutProdProductionOrder."Source No.");
end;
- procedure CreateProdOrderLine(var ProdProductionOrder: Record "Production Order"; var Item: Record Item; Qty: Decimal; var OutProdOrderLine: Record "Prod. Order Line")
+ internal procedure CreateProdOrderLine(var ProdProductionOrder: Record "Production Order"; var Item: Record Item; Qty: Decimal; var OutProdOrderLine: Record "Prod. Order Line")
begin
LibraryManufacturing.CreateProdOrderLine(OutProdOrderLine, ProdProductionOrder.Status, ProdProductionOrder."No.", Item."No.", '', '', Qty);
end;
- procedure CreateOutputJournal(var Item: Record Item; var ProdOrderLine: Record "Prod. Order Line"; var ItemJournalBatch: Record "Item Journal Batch"; var OutItemJournalLine: Record "Item Journal Line"; OutputQty: Decimal)
+ internal procedure CreateOutputJournal(var Item: Record Item; var ProdOrderLine: Record "Prod. Order Line"; var ItemJournalBatch: Record "Item Journal Batch"; var OutItemJournalLine: Record "Item Journal Line"; OutputQty: Decimal)
var
ItemJournalTemplate: Record "Item Journal Template";
begin
@@ -295,7 +312,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
end;
end;
- procedure CreateItem(var Item: Record "Item")
+ internal procedure CreateItem(var Item: Record "Item")
var
RoutingHeader: Record "Routing Header";
begin
@@ -311,7 +328,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
SetupVAT();
end;
- procedure CreateLotTrackedItem(var Item: Record "Item")
+ internal procedure CreateLotTrackedItem(var Item: Record "Item")
var
RoutingHeader: Record "Routing Header";
begin
@@ -419,7 +436,7 @@ codeunit 139952 "Qlty. Prod. Order Generator"
RoutingLine.Modify();
end;
- procedure SetQuantity(Quantity: Decimal)
+ internal procedure SetQuantity(Quantity: Decimal)
begin
QuantityToCreate := Quantity;
end;
diff --git a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyPurOrderGenerator.Codeunit.al b/src/Apps/W1/Quality Management/Test Library/src/QltyPurOrderGenerator.Codeunit.al
similarity index 87%
rename from src/Apps/W1/Quality Management/test/src/TestLibraries/QltyPurOrderGenerator.Codeunit.al
rename to src/Apps/W1/Quality Management/Test Library/src/QltyPurOrderGenerator.Codeunit.al
index 46413567da..14445a2a2c 100644
--- a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyPurOrderGenerator.Codeunit.al
+++ b/src/Apps/W1/Quality Management/Test Library/src/QltyPurOrderGenerator.Codeunit.al
@@ -15,7 +15,7 @@ using Microsoft.QualityManagement.Document;
using Microsoft.Warehouse.Activity;
using Microsoft.Warehouse.Document;
-codeunit 139951 "Qlty. Pur. Order Generator"
+codeunit 139941 "Qlty. Pur. Order Generator"
{
var
LibraryPurchase: Codeunit "Library - Purchase";
@@ -32,7 +32,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
/// the created purchase order
/// the created purchase line
/// the last reservation entry created for the line if the item is tracked
- procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; Vendor: Record Vendor; OptionalVariant: Code[10]; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line"; var OutOptionalReservationEntry: Record "Reservation Entry")
+ internal procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; Vendor: Record Vendor; OptionalVariant: Code[10]; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line"; var OutOptionalReservationEntry: Record "Reservation Entry")
begin
LibraryPurchase.CreatePurchaseOrderWithLocation(OutOrderPurchaseHeader, Vendor."No.", Location.Code);
LibraryPurchase.CreatePurchaseLine(OutPurchaseLine, OutOrderPurchaseHeader, OutPurchaseLine.Type::Item, Item."No.", Qty);
@@ -52,7 +52,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
/// item to be purchased
/// the created purchase order
/// the created purchase line
- procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line")
+ internal procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line")
var
Vendor: Record Vendor;
ReservationEntry: Record "Reservation Entry";
@@ -70,7 +70,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
/// the created purchase order
/// the created purchase line
/// the last reservation entry created for the line if the item is tracked
- procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry")
+ internal procedure CreatePurchaseOrder(Qty: Decimal; Location: Record Location; Item: Record Item; var OutOrderPurchaseHeader: Record "Purchase Header"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry")
var
Vendor: Record Vendor;
begin
@@ -84,7 +84,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
/// purchase line
/// tracked item
/// last created reservation entry
- procedure AddTrackingForPurchaseLine(PurchaseLine: Record "Purchase Line"; Item: Record Item; var OutReservationEntry: Record "Reservation Entry")
+ internal procedure AddTrackingForPurchaseLine(PurchaseLine: Record "Purchase Line"; Item: Record Item; var OutReservationEntry: Record "Reservation Entry")
var
ItemTrackingCode: Record "Item Tracking Code";
InventorySetup: Record "Inventory Setup";
@@ -118,12 +118,12 @@ codeunit 139951 "Qlty. Pur. Order Generator"
/// location of purchase order
/// purchase order to be received
/// purchase line to be received
- procedure ReceivePurchaseOrder(Location: Record Location; var OrderPurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line")
+ internal procedure ReceivePurchaseOrder(Location: Record Location; var OrderPurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line")
begin
ReceivePurchaseLine(PurchaseLine, PurchaseLine."Outstanding Quantity");
end;
- procedure ReceivePurchaseLine(var PurchaseLine: Record "Purchase Line"; QtyToReceive: Decimal)
+ internal procedure ReceivePurchaseLine(var PurchaseLine: Record "Purchase Line"; QtyToReceive: Decimal)
var
WhseWarehouseReceiptHeader: Record "Warehouse Receipt Header";
WhseWarehouseReceiptLine: Record "Warehouse Receipt Line";
@@ -187,7 +187,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
///
///
///
- procedure CreateInspectionFromPurchaseWithUntrackedItem(var Location: Record Location; PurchaseQuantity: Decimal; var PurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
+ internal procedure CreateInspectionFromPurchaseWithUntrackedItem(var Location: Record Location; PurchaseQuantity: Decimal; var PurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
var
Item: Record Item;
LibraryInventory: Codeunit "Library - Inventory";
@@ -216,7 +216,7 @@ codeunit 139951 "Qlty. Pur. Order Generator"
///
///
///
- procedure CreateInspectionFromPurchaseWithLotTrackedItem(var Location: Record Location; PurchaseQuantity: Decimal; var PurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header"; var OutReservationEntry: Record "Reservation Entry")
+ internal procedure CreateInspectionFromPurchaseWithLotTrackedItem(var Location: Record Location; PurchaseQuantity: Decimal; var PurchaseHeader: Record "Purchase Header"; var PurchaseLine: Record "Purchase Line"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header"; var OutReservationEntry: Record "Reservation Entry")
var
Item: Record Item;
Vendor: Record Vendor;
diff --git a/src/Apps/W1/Quality Management/app/app.json b/src/Apps/W1/Quality Management/app/app.json
index 8e5209c35b..bbe7c3e9a5 100644
--- a/src/Apps/W1/Quality Management/app/app.json
+++ b/src/Apps/W1/Quality Management/app/app.json
@@ -35,8 +35,8 @@
],
"internalsVisibleTo": [
{
- "id": "aa5fc5d3-ef4e-4b03-8512-9c584cdc1ceb",
- "name": "Quality Management-Tests",
+ "id": "9c32d4af-77d5-4fba-a3de-361805163a00",
+ "name": "Quality Management Test Library",
"publisher": "Microsoft"
}
]
diff --git a/src/Apps/W1/Quality Management/test/app.json b/src/Apps/W1/Quality Management/test/app.json
index 49bdeacd6f..2d0a06860d 100644
--- a/src/Apps/W1/Quality Management/test/app.json
+++ b/src/Apps/W1/Quality Management/test/app.json
@@ -18,6 +18,12 @@
"publisher": "Microsoft",
"version": "28.0.0.0"
},
+ {
+ "id": "9c32d4af-77d5-4fba-a3de-361805163a00",
+ "name": "Quality Management Test Library",
+ "publisher": "Microsoft",
+ "version": "28.0.0.0"
+ },
{
"id": "5d86850b-0d76-4eca-bd7b-951ad998e997",
"publisher": "Microsoft",
@@ -51,7 +57,7 @@
"application": "28.0.0.0",
"idRanges": [
{
- "from": 139950,
+ "from": 139955,
"to": 139979
}
],
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestProdOrderRouting.PageExt.al b/src/Apps/W1/Quality Management/test/src/QltyTestProdOrderRouting.PageExt.al
index 88905ce304..85fa428da5 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestProdOrderRouting.PageExt.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestProdOrderRouting.PageExt.al
@@ -6,7 +6,7 @@ namespace Microsoft.Test.QualityManagement;
using Microsoft.Manufacturing.Document;
-pageextension 139950 "Qlty. Test Prod. Order Routing" extends "Prod. Order Routing"
+pageextension 139956 "Qlty. Test Prod. Order Routing" extends "Prod. Order Routing"
{
layout
{
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsCreateInspect.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsCreateInspect.Codeunit.al
index 470c0041c9..e12dc90cdb 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsCreateInspect.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsCreateInspect.Codeunit.al
@@ -31,6 +31,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
LibraryAssert: Codeunit "Library Assert";
LibraryERMCountryData: Codeunit "Library - ERM Country Data";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
CannotFindTemplateErr: Label 'Cannot find a Quality Inspection Template or Quality Inspection Generation Rule to match %1. Ensure there is a Quality Inspection Generation Rule that will match this record.', Comment = '%1=The record identifier';
ProgrammerErrNotARecordRefErr: Label 'Cannot find inspections with %1. Please supply a "Record" or "RecordRef".', Comment = '%1=the variant being supplied that is not a RecordRef. Your system might have an extension or customization that needs to be re-configured.';
UnableToCreateInspectionForRecordErr: Label 'Cannot find enough details to make an inspection for your record(s). Try making sure that there is a source configuration for your record, and then also make sure there is sufficient information in your inspection generation rules. The table involved is %1.', Comment = '%1=the table involved.';
@@ -1060,7 +1061,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
OutputItemLedgerEntry: Record "Item Ledger Entry";
Item: Record Item;
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ProductionTrigger: Enum "Qlty. Production Trigger";
ClaimedInspectionWasFoundOrCreated: Boolean;
BeforeCount: Integer;
@@ -1437,7 +1437,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
// [SCENARIO] Verify error when no generation rule exists and ThrowError is true
@@ -1464,7 +1463,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
ItemJournalLine: Record "Item Journal Line";
OutputItemLedgerEntry: Record "Item Ledger Entry";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
// [SCENARIO] Verify error when an invalid variant is provided to search function
@@ -1474,7 +1472,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 3);
// [WHEN] FindExistingInspectionWithMultipleVariants is called with an empty string variant
- asserterror QltyInspectionCreate.FindExistingInspectionWithMultipleVariants(true, '', ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, FoundQltyInspectionHeader);
+ asserterror QltyInspectionUtility.FindExistingInspectionWithMultipleVariants(true, '', ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, FoundQltyInspectionHeader);
// [THEN] An error is raised indicating the variant is not a valid RecordRef
LibraryAssert.ExpectedError(StrSubstNo(ProgrammerErrNotARecordRefErr, ''));
@@ -1490,7 +1488,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
ItemJournalLine: Record "Item Journal Line";
OutputItemLedgerEntry: Record "Item Ledger Entry";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
// [SCENARIO] Verify error when no generation rule exists and ThrowError is true
@@ -1503,7 +1500,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
QltyInspectionGenRule.DeleteAll();
// [WHEN] FindExistingInspectionWithMultipleVariants is called with ThrowError=true
- asserterror QltyInspectionCreate.FindExistingInspectionWithMultipleVariants(true, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
+ asserterror QltyInspectionUtility.FindExistingInspectionWithMultipleVariants(true, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
// [THEN] An error is raised indicating the template cannot be found
LibraryAssert.ExpectedError(StrSubstNo(CannotFindTemplateErr, ProdOrderRoutingLine.RecordId()));
@@ -1558,7 +1555,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
QltyInspectionCreate.GetCreatedInspection(CreatedQltyInspectionHeader);
// [WHEN] FindExistingInspectionWithMultipleVariants is called with the same variants
- FoundInspection := QltyInspectionCreate.FindExistingInspectionWithMultipleVariants(false, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
+ FoundInspection := QltyInspectionUtility.FindExistingInspectionWithMultipleVariants(false, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
QltyManagementSetup."Production Trigger" := ProductionTrigger;
QltyManagementSetup.Modify();
@@ -1606,7 +1603,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
ClearLastError();
// [WHEN] FindExistingInspectionWithMultipleVariants is called when no inspections have been created
- QltyInspectionCreate.FindExistingInspectionWithMultipleVariants(false, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
+ QltyInspectionUtility.FindExistingInspectionWithMultipleVariants(false, ProdOrderRoutingLine, OutputItemLedgerEntry, ItemJournalLine, ProdOrderLine, FoundQltyInspectionHeader);
QltyInspectionGenRule.Delete();
// [THEN] No inspection is found and the count matches the initial count
@@ -1647,7 +1644,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [WHEN] FindExistingInspection is called with the purchase line and tracking specification
PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1694,7 +1691,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
// [WHEN] FindExistingInspection is called with the source record
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1749,7 +1746,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [WHEN] FindExistingInspection is called with the source record
// [WHEN] FindExistingInspection is called with the source record
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1799,7 +1796,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [WHEN] FindExistingInspection is called with item tracking
// [WHEN] FindExistingInspection is called with item tracking
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1848,7 +1845,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
// [WHEN] FindExistingInspection is called with document and item information
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1894,12 +1891,12 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
// [WHEN] FindExistingInspection is called before any inspection is created
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1942,7 +1939,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
// [WHEN] FindExistingInspection is called before any inspection is created
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -1982,7 +1979,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [WHEN] FindExistingInspection is called before any inspection is created
PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -2023,7 +2020,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [WHEN] FindExistingInspection is called before any inspection is created
PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
TrackingSpecificationRecordRef.GetTable(TempSpecTrackingSpecification);
- InspectionFound := QltyInspectionCreate.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
+ InspectionFound := QltyInspectionUtility.FindExistingInspection(false, PurchaseLineRecordRef, TrackingSpecificationRecordRef, Optional3RecordRef, Optional4RecordRef, FoundQltyInspectionHeader);
QltyManagementSetup."Find Existing Behavior" := FindBehavior;
QltyManagementSetup.Modify();
@@ -2132,7 +2129,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
LibraryWarehouse: Codeunit "Library - Warehouse";
LibraryPurchase: Codeunit "Library - Purchase";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
CountBefore: Integer;
CountAfter: Integer;
begin
@@ -2177,7 +2173,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
CountBefore := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMarkedTrackingSpecification is called with the marked tracking specifications
- QltyInspectionCreate.CreateMultipleInspectionsForMarkedTrackingSpecification(TempSpecTrackingSpecification);
+ QltyInspectionUtility.CreateMultipleInspectionsForMarkedTrackingSpecification(TempSpecTrackingSpecification);
CountAfter := QltyInspectionHeader.Count();
QltyInspectionGenRule.Delete();
@@ -2217,7 +2213,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
LibraryUtility: Codeunit "Library - Utility";
LibraryItemTracking: Codeunit "Library - Item Tracking";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
CountBefore: Integer;
CountAfter: Integer;
begin
@@ -2261,7 +2256,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [GIVEN] The current count of quality inspection headers is recorded
CountBefore := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMarkedTrackingSpecification is called with the marked tracking specification
- QltyInspectionCreate.CreateMultipleInspectionsForMarkedTrackingSpecification(TempSpecTrackingSpecification);
+ QltyInspectionUtility.CreateMultipleInspectionsForMarkedTrackingSpecification(TempSpecTrackingSpecification);
CountAfter := QltyInspectionHeader.Count();
QltyInspectionGenRule.Delete();
@@ -2281,7 +2276,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
CreatedQltyInspectionHeader: Record "Qlty. Inspection Header";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ProdOrderRoutingLineRecordRef: RecordRef;
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -2316,7 +2310,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [GIVEN] The current count of quality inspection headers is recorded
BeforeCount := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMultipleRecords is called with the RecordRef containing 3 routing lines
- QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
+ QltyInspectionUtility.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
AfterCount := QltyInspectionHeader.Count();
QltyInspectionGenRule.Delete();
@@ -2341,7 +2335,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
CreatedQltyInspectionHeader: Record "Qlty. Inspection Header";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ProdOrderRoutingLineRecordRef: RecordRef;
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -2381,7 +2374,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [GIVEN] The current count of quality inspection headers is recorded
BeforeCount := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMultipleRecords is called with the RecordRef containing 3 routing lines
- QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
+ QltyInspectionUtility.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
AfterCount := QltyInspectionHeader.Count();
QltyInspectionGenRule.Delete();
@@ -2408,7 +2401,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
CreatedQltyInspectionHeader: Record "Qlty. Inspection Header";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ProdOrderRoutingLineRecordRef: RecordRef;
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -2446,7 +2438,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
// [GIVEN] The current count of quality inspection headers is recorded
BeforeCount := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMultipleRecords is called with the RecordRef containing 1 routing line
- QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
+ QltyInspectionUtility.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
AfterCount := QltyInspectionHeader.Count();
QltyInspectionGenRule.Delete();
@@ -2478,7 +2470,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
BeforeCount := QltyInspectionHeader.Count();
// [WHEN] CreateMultipleInspectionsForMultipleRecords is called with an empty RecordRef
- asserterror QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
+ asserterror QltyInspectionUtility.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
// [THEN] An error is raised indicating unable to create an inspection for the record
LibraryAssert.ExpectedError(StrSubstNo(UnableToCreateInspectionForRecordErr, ProdOrderRoutingLineRecordRef.Name));
// [THEN] No inspections are created
@@ -2494,7 +2486,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
ProdOrderLine: Record "Prod. Order Line";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ProdOrderRoutingLineRecordRef: RecordRef;
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -2527,7 +2518,7 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
end;
// [WHEN] CreateMultipleInspectionsForMultipleRecords is called without any generation rule configured
- asserterror QltyInspectionCreate.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
+ asserterror QltyInspectionUtility.CreateMultipleInspectionsForMultipleRecords(ProdOrderRoutingLineRecordRef, false);
// [THEN] An error is raised indicating unable to create an inspection for the parent or child record
LibraryAssert.ExpectedError(StrSubstNo(UnableToCreateInspectionForParentOrChildErr, ProdOrderLine.TableName, ProdOrderRoutingLineRecordRef.Name));
end;
@@ -2561,7 +2552,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
LibraryUtility: Codeunit "Library - Utility";
LibraryItemTracking: Codeunit "Library - Item Tracking";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
QltyInspectionUtility.EnsureSetupExists();
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 3);
@@ -2583,7 +2573,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
local procedure SetupCreateInspectionProductionOrder(var QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; var QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule"; var Item: Record Item; var ProdProductionOrder: Record "Production Order"; var ProdOrderRoutingLine: Record "Prod. Order Routing Line")
var
GenQltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
QltyInspectionUtility.EnsureSetupExists();
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 3);
@@ -2603,7 +2592,6 @@ codeunit 139959 "Qlty. Tests - Create Inspect."
var
ItemJournalBatch: Record "Item Journal Batch";
GenQltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
LibraryInventory: Codeunit "Library - Inventory";
begin
QltyInspectionUtility.CreateItemJournalTemplateAndBatch(Enum::"Item Journal Template Type"::Output, ItemJournalBatch);
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsDispositions.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsDispositions.Codeunit.al
index 27cb85f25b..0b1cb7c28b 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsDispositions.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsDispositions.Codeunit.al
@@ -16,7 +16,6 @@ using Microsoft.Inventory.Tracking;
using Microsoft.Inventory.Transfer;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.Vendor;
-using Microsoft.QualityManagement.Configuration;
using Microsoft.QualityManagement.Configuration.GenerationRule;
using Microsoft.QualityManagement.Configuration.SourceConfiguration;
using Microsoft.QualityManagement.Configuration.Template;
@@ -24,9 +23,6 @@ using Microsoft.QualityManagement.Dispositions;
using Microsoft.QualityManagement.Dispositions.InventoryAdjustment;
using Microsoft.QualityManagement.Dispositions.ItemTracking;
using Microsoft.QualityManagement.Dispositions.Move;
-using Microsoft.QualityManagement.Dispositions.Purchase;
-using Microsoft.QualityManagement.Dispositions.PutAway;
-using Microsoft.QualityManagement.Dispositions.Transfer;
using Microsoft.QualityManagement.Document;
using Microsoft.QualityManagement.Integration.Inventory;
using Microsoft.QualityManagement.Setup;
@@ -55,7 +51,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
LibraryRandom: Codeunit "Library - Random";
LibraryERMCountryData: Codeunit "Library - ERM Country Data";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyDispPurchaseReturn: Codeunit "Qlty. Disp. Purchase Return";
LibraryWarehouse: Codeunit "Library - Warehouse";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
ReUsedLibraryItemTracking: Codeunit "Library - Item Tracking";
@@ -127,8 +122,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
SpecificQty := 9;
// [WHEN] Purchase return disposition is performed with item tracked quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempTrackedPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo, TempTrackedPurRtnBufferPurchaseHeader);
QltyInspectionGenRule.Delete();
// [THEN] The inspection assertions verify the purchase return order was created correctly
@@ -197,26 +191,22 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with sample quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSamplePurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSamplePurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for sample quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Sample Size", QltyInspectionHeader, TempSamplePurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with passed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempPassPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempPassPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for passed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Pass Quantity", QltyInspectionHeader, TempPassPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with failed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempFailPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempFailPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for failed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Fail Quantity", QltyInspectionHeader, TempFailPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with specific quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSpecificPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSpecificPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for specific quantity is verified
VerifyInspectionAssertions(SpecificQty, QltyInspectionHeader, TempSpecificPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
end;
@@ -332,8 +322,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with item tracked quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSamplePurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSamplePurRtnBufferPurchaseHeader);
ReclassWarehouseJournalBatch.Delete();
ReclassWhseItemWarehouseJournalTemplate.Delete();
@@ -402,8 +391,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with item tracked quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempTrackedPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo, TempTrackedPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order is created correctly for full package-tracked quantity
VerifyInspectionAssertions(100, QltyInspectionHeader, TempTrackedPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
end;
@@ -476,26 +464,22 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with sample quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSamplePurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSamplePurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for sample quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Sample Size", QltyInspectionHeader, TempSamplePurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with passed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempPassPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempPassPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for passed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Pass Quantity", QltyInspectionHeader, TempPassPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with failed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempFailPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempFailPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for failed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Fail Quantity", QltyInspectionHeader, TempFailPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with specific quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSpecificPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSpecificPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for specific quantity is verified
VerifyInspectionAssertions(SpecificQty, QltyInspectionHeader, TempSpecificPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
end;
@@ -564,26 +548,22 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with sample quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSamplePurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSamplePurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for sample quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Sample Size", QltyInspectionHeader, TempSamplePurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", BasicLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with passed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempPassPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Passed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempPassPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for passed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Pass Quantity", QltyInspectionHeader, TempPassPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", BasicLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with failed quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempFailPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Failed Quantity", SpecificQty, '', '', Reason, CreditMemo, TempFailPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for failed quantity is verified
VerifyInspectionAssertions(QltyInspectionHeader."Fail Quantity", QltyInspectionHeader, TempFailPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", BasicLocation.Code, Reason);
// [WHEN] Purchase return disposition is performed with specific quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempSpecificPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo, TempSpecificPurRtnBufferPurchaseHeader);
// [THEN] The purchase return order for specific quantity is verified
VerifyInspectionAssertions(SpecificQty, QltyInspectionHeader, TempSpecificPurRtnBufferPurchaseHeader, TempSpecificPurRtnBufferPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", BasicLocation.Code, Reason);
end;
@@ -600,6 +580,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
PurOrdPurchaseLine: Record "Purchase Line";
DummyReservationEntry: Record "Reservation Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
+ TempDummyPurchaseHeader: Record "Purchase Header" temporary;
OptionalItemVariant: Code[10];
Reason: Code[10];
CreditMemo: Code[35];
@@ -643,7 +624,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is attempted on an unreceived purchase order
- asserterror QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo);
+ asserterror QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, '', '', Reason, CreditMemo, TempDummyPurchaseHeader);
// [THEN] An error is expected indicating no purchase receipt line exists
LibraryAssert.ExpectedError(StrSubstNo(NoPurchRcptLineErr, QltyInspectionHeader."Source Item No.", QltyInspectionHeader."No.", QltyInspectionHeader."Re-inspection No."));
end;
@@ -662,6 +643,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ReturnOrderPurchaseHeader: Record "Purchase Header";
DummyReservationEntry: Record "Reservation Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
+ TempDummyPurchaseHeader: Record "Purchase Header" temporary;
OptionalItemVariant: Code[10];
Reason: Code[10];
CreditMemo: Code[35];
@@ -710,7 +692,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ReturnOrderPurchaseHeader.SetRange("Document Type", ReturnOrderPurchaseHeader."Document Type"::"Return Order");
BeforeCount := ReturnOrderPurchaseHeader.Count();
// [WHEN] Purchase return disposition is performed with a filter location that has no inventory
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, FilterLocation.Code, '', Reason, CreditMemo);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Sample Quantity", SpecificQty, FilterLocation.Code, '', Reason, CreditMemo, TempDummyPurchaseHeader);
// [THEN] No purchase return order is created
LibraryAssert.AreEqual(BeforeCount, ReturnOrderPurchaseHeader.Count(), 'Should not have created a purchase return order');
end;
@@ -1020,7 +1002,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ItemJournalBatch: Record "Item Journal Batch";
AdjustmentItemJournalLine: Record "Item Journal Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
ReasonCodeToTest: Text;
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
@@ -1070,7 +1051,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Negative adjustment disposition is performed with specific quantity
- LibraryAssert.IsTrue(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
AdjustmentItemJournalLine.Get(ItemJournalTemplate.Name, ItemJournalBatch.Name, 10000);
@@ -1102,7 +1083,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseJournalBatch: Record "Warehouse Journal Batch";
AdjustmentWarehouseJournalLine: Record "Warehouse Journal Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
ReasonCodeToTest: Text;
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
@@ -1150,7 +1130,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed with specific quantity
- LibraryAssert.IsTrue(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
QltyInspectionGenRule.DeleteAll();
WarehouseJournalBatch.Delete();
@@ -1189,7 +1169,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ReclassWarehouseJournalLine: Record "Warehouse Journal Line";
ReclassWarehouseJournalWhseItemTrackingLine: Record "Whse. Item Tracking Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
ReasonCodeToTest: Text;
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
@@ -1269,7 +1248,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed for item tracked quantity
- LibraryAssert.IsTrue(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 0, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 0, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", ReasonCode.Code), 'Should have created negative adjustment');
QltyInspectionGenRule.DeleteAll();
ReclassWarehouseJournalBatch.Delete();
@@ -1306,7 +1285,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ItemJournalBatch: Record "Item Journal Batch";
ItemLedgerEntry: Record "Item Ledger Entry";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
ReasonCodeToTest: Text;
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
@@ -1354,7 +1332,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed and posted with specific quantity
- LibraryAssert.IsTrue(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::Post, ReasonCode.Code), 'Should have posted negative adjustment');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::Post, ReasonCode.Code), 'Should have posted negative adjustment');
QltyInspectionGenRule.Delete();
ItemJournalBatch.Delete();
@@ -1387,7 +1365,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseJournalTemplate: Record "Warehouse Journal Template";
WarehouseJournalBatch: Record "Warehouse Journal Batch";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
ReasonCodeToTest: Text;
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
@@ -1435,7 +1412,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed and registered with specific quantity
- LibraryAssert.IsTrue(QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::Post, ReasonCode.Code), 'Should have registered negative adjustment');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::Post, ReasonCode.Code), 'Should have registered negative adjustment');
QltyInspectionGenRule.DeleteAll();
WarehouseJournalBatch.Delete();
@@ -1463,7 +1440,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseEntry: Record "Warehouse Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Raise an error when attempting item tracked quantity disposition on untracked items
@@ -1496,7 +1472,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Negative adjustment disposition is performed with Item Tracked Quantity behavior on untracked item
- asserterror QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', QltyItemAdjPostBehavior::Post, '');
+ asserterror QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', QltyItemAdjPostBehavior::Post, '');
// [THEN] An error is raised indicating the entire lot must be written off
LibraryAssert.ExpectedError(StrSubstNo(WriteOffEntireLotErr, QltyInspectionHeader.GetFriendlyIdentifier()));
@@ -1518,7 +1494,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseJournalBatch: Record "Warehouse Journal Batch";
WarehouseJournalLine: Record "Warehouse Journal Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Exit without creating adjustment lines when no inventory is found at the filtered location
@@ -1553,7 +1528,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed with a location filter where no inventory exists
- QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", FilterLocation.Code, '', QltyItemAdjPostBehavior::"Prepare only", '');
+ QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", FilterLocation.Code, '', QltyItemAdjPostBehavior::"Prepare only", '');
WarehouseJournalLine.SetRange("Journal Template Name", WarehouseJournalTemplate.Name);
WarehouseJournalLine.SetRange("Journal Batch Name", WarehouseJournalBatch.Name);
@@ -1579,7 +1554,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
Bin: Record Bin;
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Raise an error when adjustment batch is not configured for non-directed location
@@ -1618,7 +1592,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed without adjustment batch configured
- asserterror QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
+ asserterror QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
// [THEN] An error is raised indicating the adjustment batch is missing
LibraryAssert.ExpectedError(MissingAdjBatchErr);
@@ -1637,7 +1611,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseEntry: Record "Warehouse Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Raise an error when warehouse adjustment batch is not configured for directed location
@@ -1675,7 +1648,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyManagementSetup.Modify();
// [WHEN] Negative adjustment disposition is performed without warehouse adjustment batch configured
- asserterror QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
+ asserterror QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
// [THEN] An error is raised indicating the adjustment batch is missing
LibraryAssert.ExpectedError(MissingAdjBatchErr);
@@ -1696,7 +1669,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ItemJournalTemplate: Record "Item Journal Template";
ItemJournalBatch: Record "Item Journal Batch";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Validate that an error is raised when the configured item journal batch cannot be found in a non-directed location
@@ -1742,7 +1714,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
ItemJournalBatch.Delete();
// [WHEN] Negative adjustment disposition is attempted
- asserterror QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
+ asserterror QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
// [THEN] An error is raised indicating the journal batch cannot be found
LibraryAssert.ExpectedError(StrSubstNo(CannotGetJournalBatchErr, ItemJournalTemplate.Name, QltyManagementSetup."Adjustment Batch Name", ''));
end;
@@ -1761,7 +1733,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseJournalTemplate: Record "Warehouse Journal Template";
WarehouseJournalBatch: Record "Warehouse Journal Batch";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO] Validate that an error is raised when the configured warehouse adjustment batch cannot be found in a directed location
@@ -1801,7 +1772,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseJournalBatch.Delete();
// [WHEN] Negative adjustment disposition is performed
- asserterror QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
+ asserterror QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
// [THEN] An error is raised indicating the journal batch cannot be found
LibraryAssert.ExpectedError(StrSubstNo(CannotGetJournalBatchErr, WarehouseJournalTemplate.Name, QltyManagementSetup."Whse. Adjustment Batch Name", StrSubstNo(LocationTok, Location.Code)));
end;
@@ -3968,7 +3939,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
begin
// [SCENARIO] Create a direct transfer order for untracked items from a non-directed location with bins
@@ -4003,7 +3973,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Transfer disposition is performed for 50 units to the destination location
- LibraryAssert.IsTrue(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
// [THEN] One direct transfer header is created between source and destination locations
#pragma warning disable AA0210
@@ -4039,7 +4009,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
ReleaseTransferDocument: Codeunit "Release Transfer Document";
begin
// [SCENARIO] Create, release, and post a direct transfer order for untracked items
@@ -4075,7 +4044,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Transfer disposition is performed for 50 units to create a direct transfer
- LibraryAssert.IsTrue(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
// [THEN] One direct transfer header is created between source and destination locations
#pragma warning disable AA0210
@@ -4121,7 +4090,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
begin
// [SCENARIO] Create an in-transit transfer order for lot-tracked items with variants
@@ -4165,7 +4133,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Transfer disposition is performed for 50 units to destination location with in-transit route
- LibraryAssert.IsTrue(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, ''), 'Should have created transfer.');
// [THEN] One transfer header is created with in-transit location
#pragma warning disable AA0210
@@ -4214,7 +4182,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
begin
// [SCENARIO] Create an in-transit transfer order for lot-tracked items in a directed pick and put location
@@ -4249,7 +4216,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Transfer disposition is performed for 50 units to destination location with in-transit location
- LibraryAssert.IsTrue(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, InTransitLocation.Code), 'Should have created transfer.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 50, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', DestinationLocation.Code, InTransitLocation.Code), 'Should have created transfer.');
// [THEN] One transfer header is created with in-transit location
#pragma warning disable AA0210
@@ -4302,7 +4269,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
begin
// [SCENARIO] Create transfer order with lot tracking from directed location where inventory is spread across multiple bins using in-transit location
@@ -4378,7 +4344,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Perform disposition to create transfer order with item tracked quantity
- LibraryAssert.IsTrue(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 0, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', DestinationLocation.Code, InTransitLocation.Code), 'Should have created transfer.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 0, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Item Tracked Quantity", '', '', DestinationLocation.Code, InTransitLocation.Code), 'Should have created transfer.');
// [THEN] Two transfer orders are created, one for each bin, each with correct reservation entries
@@ -4424,7 +4390,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TransferHeader: Record "Transfer Header";
TransferLine: Record "Transfer Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispTransfer: Codeunit "Qlty. Disp. Transfer";
begin
// [SCENARIO] Create transfer should exit gracefully when no inventory is found matching the location filter
@@ -4458,7 +4423,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Perform disposition is called with a location filter that does not match the inventory location
- LibraryAssert.IsFalse(QltyDispTransfer.PerformDisposition(QltyInspectionHeader, 50,
+ LibraryAssert.IsFalse(QltyInspectionUtility.PerformTransferDisposition(QltyInspectionHeader, 50,
TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', FilterLocation.Code,
DestinationLocation.Code, ''), 'Should not have created transfer.');
@@ -6476,7 +6441,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
Bin: Record Bin;
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Automatically choose warehouse reclassification to create journal entries for moving untracked items in a directed location
@@ -6522,7 +6486,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed
- QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
+ QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
// [THEN] A warehouse reclassification journal line is created with correct from/to locations and quantity
ReclassWarehouseJournalLine.SetRange("Journal Template Name", ReclassWhseItemWarehouseJournalTemplate.Name);
@@ -6559,7 +6523,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
Bin: Record Bin;
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
WhseWorksheetTemplateToUse: Text;
begin
// [SCENARIO] Automatically choose movement worksheet to create worksheet entries for moving untracked items in a directed location
@@ -6619,7 +6582,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed with worksheet preference
- QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
+ QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
// [THEN] A movement worksheet line is created with correct from/to locations and quantity
WhseWorksheetLine.SetRange("Worksheet Template Name", WhseWorksheetTemplate.Name);
@@ -6656,7 +6619,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
Bin: Record Bin;
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Automatically choose item reclassification to create journal entries for moving untracked items in a non-directed location
@@ -6702,7 +6664,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed
- QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
+ QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
// [THEN] An item reclassification journal line is created with correct from/to bins and quantity
ReclassItemJournalLine.SetRange("Journal Template Name", ReclassItemJournalTemplate.Name);
@@ -6736,7 +6698,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionHeader: Record "Qlty. Inspection Header";
InternalMovementLine: Record "Internal Movement Line";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Automatically choose internal movement to create internal movement entries for moving untracked items in a non-directed location
@@ -6785,7 +6746,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed with internal movement preference
- QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
+ QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
// [THEN] An internal movement line is created with correct from/to bins and quantity
InternalMovementLine.SetRange("Location Code", Location.Code);
@@ -6811,7 +6772,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseEntry: Record "Warehouse Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Auto choose move inventory should error when no target location or bin is specified
@@ -6844,7 +6804,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed without target location or bin
- asserterror QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
+ asserterror QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
// [THEN] An error is raised indicating there is nothing to move to
LibraryAssert.ExpectedError(StrSubstNo(ThereIsNothingToMoveToErr, QltyInspectionHeader.GetFriendlyIdentifier()));
@@ -6865,7 +6825,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseEntry: Record "Warehouse Entry";
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Auto choose move inventory should error when attempting to change locations for a directed location
@@ -6902,7 +6861,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed with a different target location
- asserterror QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
+ asserterror QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, true);
// [THEN] An error is raised indicating that bins cannot be changed between locations for directed pick and put
LibraryAssert.ExpectedError(StrSubstNo(UnableToChangeBinsBetweenLocationsBecauseDirectedPickAndPutErr, QltyInspectionHeader."No.", Location.Code, SecondLocation.Code));
@@ -6927,7 +6886,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
Bin: Record Bin;
QltyInspectionHeader: Record "Qlty. Inspection Header";
TempInstructionQltyDispositionBuffer: Record "Qlty. Disposition Buffer" temporary;
- QltyDispMoveAutoChoose: Codeunit "Qlty. Disp. Move Auto Choose";
begin
// [SCENARIO] Auto choose move inventory should error when no inventory is found matching the location filter
@@ -6979,7 +6937,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
TempInstructionQltyDispositionBuffer."Entry Behavior" := TempInstructionQltyDispositionBuffer."Entry Behavior"::"Prepare only";
// [WHEN] Auto choose move inventory is performed with a non-matching location filter
- asserterror QltyDispMoveAutoChoose.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
+ asserterror QltyInspectionUtility.MoveInventory(QltyInspectionHeader, TempInstructionQltyDispositionBuffer, false);
// [THEN] An error is raised indicating that insufficient inventory details were found
LibraryAssert.ExpectedError(StrSubstNo(RequestedBinMoveButUnableToFindSufficientDetailsErr, QltyInspectionHeader.GetFriendlyIdentifier()));
@@ -7009,7 +6967,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WhseInternalPutAwayHeader: Record "Whse. Internal Put-away Header";
WhseInternalPutAwayLine: Record "Whse. Internal Put-away Line";
WarehouseSetup: Record "Warehouse Setup";
- QltyDispInternalPutAway: Codeunit "Qlty. Disp. Internal Put-away";
BeforeCount: Integer;
begin
// [SCENARIO] Perform disposition with internal putaway creates a released internal putaway document for the specified quantity
@@ -7042,7 +6999,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
// [WHEN] Perform disposition with internal putaway is called for 50 units
BeforeCount := WhseInternalPutAwayHeader.Count();
- LibraryAssert.IsTrue(QltyDispInternalPutAway.PerformDisposition(QltyInspectionHeader, 50, '', '', true, Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim internal putaway entry created');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformInternalPutAwayDisposition(QltyInspectionHeader, 50, '', '', true, Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim internal putaway entry created');
// [THEN] One internal putaway document is created with correct quantity and released status
@@ -7068,8 +7025,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
WarehouseSetup: Record "Warehouse Setup";
PutawayWarehouseActivityHeader: Record "Warehouse Activity Header";
PutawayWarehouseActivityLine: Record "Warehouse Activity Line";
- QltyDispInternalPutAway: Codeunit "Qlty. Disp. Internal Put-away";
- QltyDispWarehousePutAway: Codeunit "Qlty. Disp. Warehouse Put-away";
BeforeCount: Integer;
begin
// [SCENARIO] Perform disposition with warehouse putaway creates a warehouse putaway activity document for the specified quantity
@@ -7101,13 +7056,13 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionUtility.CreateInspectionWithWarehouseEntry(WarehouseEntry, QltyInspectionHeader);
// [GIVEN] An internal putaway document is created for the inspection
- LibraryAssert.IsTrue(QltyDispInternalPutAway.PerformDisposition(QltyInspectionHeader, 50, '', '', true, Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim internal putaway entry created');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformInternalPutAwayDisposition(QltyInspectionHeader, 50, '', '', true, Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim internal putaway entry created');
// [WHEN] Perform disposition with warehouse putaway is called for 50 units
PutawayWarehouseActivityHeader.SetRange(Type, PutawayWarehouseActivityHeader.Type::"Put-away");
PutawayWarehouseActivityHeader.SetRange("Location Code", Location.Code);
BeforeCount := PutawayWarehouseActivityHeader.Count();
- LibraryAssert.IsTrue(QltyDispWarehousePutAway.PerformDisposition(QltyInspectionHeader, 50, '', '', Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim warehouse putaway entry created');
+ LibraryAssert.IsTrue(QltyInspectionUtility.PerformWarehousePutAwayDisposition(QltyInspectionHeader, 50, '', '', Enum::"Qlty. Quantity Behavior"::"Specific Quantity"), 'Should claim warehouse putaway entry created');
// [THEN] One warehouse putaway activity is created with correct place line quantity
LibraryAssert.AreEqual(BeforeCount + 1, PutawayWarehouseActivityHeader.Count(), 'Should have created a warehouse put-away');
@@ -7201,7 +7156,6 @@ codeunit 139960 "Qlty. Tests - Dispositions"
AdjustmentItemJournalLine: Record "Item Journal Line";
NoSeries: Record "No. Series";
NoSeriesLine: Record "No. Series Line";
- QltyDispNegAdjustInv: Codeunit "Qlty. Disp. Neg. Adjust Inv.";
QltyItemAdjPostBehavior: Enum "Qlty. Item Adj. Post Behavior";
begin
// [SCENARIO 610785] Verify user can post item journal line for negative adjustment created from quality test
@@ -7250,7 +7204,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionHeader.FindFirst();
// [WHEN] Negative adjustment disposition is performed with specific quantity
- QltyDispNegAdjustInv.PerformDisposition(QltyInspectionHeader, PurchaseLine.Quantity, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
+ QltyInspectionUtility.PerformNegAdjustInvDisposition(QltyInspectionHeader, PurchaseLine.Quantity, TempInstructionQltyDispositionBuffer."Quantity Behavior"::"Specific Quantity", '', '', QltyItemAdjPostBehavior::"Prepare only", '');
// [THEN] Post item journal line should be successful
AdjustmentItemJournalLine.Get(ItemJournalTemplate.Name, ItemJournalBatch.Name, 10000);
@@ -7316,13 +7270,13 @@ codeunit 139960 "Qlty. Tests - Dispositions"
QltyInspectionGenRule.Delete();
// [WHEN] Purchase return disposition is performed with item tracked quantity behavior
- QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo);
- QltyDispPurchaseReturn.GetCreatedPurchaseReturnBuffer(TempTrackedPurRtnBufferPurchaseHeader);
+ QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Item Tracked Quantity", SpecificQty, '', '', Reason, CreditMemo, TempTrackedPurRtnBufferPurchaseHeader);
+
// [THEN] The purchase return order is created correctly for serial-tracked items
VerifyInspectionAssertions(1, QltyInspectionHeader, TempTrackedPurRtnBufferPurchaseHeader, PurOrderPurchaseHeader, PurOrdPurchaseLine, CreditMemo, Item."No.", AdvWhseLocation.Code, Reason);
// [WHEN] Purchase return disposition with specific quantity behavior is attempted on serial-tracked items
- asserterror QltyDispPurchaseReturn.PerformDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo);
+ asserterror QltyInspectionUtility.PerformPurchaseReturnDisposition(QltyInspectionHeader, Enum::"Qlty. Quantity Behavior"::"Specific Quantity", SpecificQty, '', '', Reason, CreditMemo, TempTrackedPurRtnBufferPurchaseHeader);
// [THEN] An error is expected because no purchase receipt line exists for specific quantity with serial tracking
LibraryAssert.ExpectedError(StrSubstNo(NoPurchRcptLineErr, Item."No.", QltyInspectionHeader."No.", QltyInspectionHeader."Re-inspection No."));
end;
@@ -7360,12 +7314,11 @@ codeunit 139960 "Qlty. Tests - Dispositions"
var
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
QltyInspectionUtility2: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
QltyInspectionUtility2.EnsureSetupExists();
SpecificQltyInspectSourceConfig.SetRange("From Table No.", Database::"Purchase Line");
if SpecificQltyInspectSourceConfig.IsEmpty() then
- QltyAutoConfigure.EnsureAtLeastOneSourceConfigurationExist(false);
+ QltyInspectionUtility.EnsureAtLeastOneSourceConfigurationExist(false);
if OutQltyInspectionTemplateHdr.Code = '' then
QltyInspectionUtility2.CreateTemplate(OutQltyInspectionTemplateHdr, 3);
@@ -7391,7 +7344,7 @@ codeunit 139960 "Qlty. Tests - Dispositions"
LibraryAssert.AreEqual(PurPurchaseLine."Unit of Measure Code", RtnPurchaseLine."Unit of Measure Code", 'Return Order unit of measure does not match.');
LibraryAssert.AreEqual(PurPurchaseLine."Direct Unit Cost", RtnPurchaseLine."Direct Unit Cost", 'Return Order direct unit cost does not match.');
LibraryAssert.AreEqual(Reason, RtnPurchaseLine."Return Reason Code", 'Return Order reason code does not match.');
- if QltyInspectionHeader.IsItemTrackingUsed() then begin
+ if QltyInspectionUtility.IsInspectionItemTrackingUsed(QltyInspectionHeader) then begin
RtnReservationEntry.SetRange("Location Code", RtnPurchaseLine."Location Code");
RtnReservationEntry.SetRange("Item No.", QltyInspectionHeader."Source Item No.");
RtnReservationEntry.SetRange("Source Type", Database::"Purchase Line");
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsExpressions.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsExpressions.Codeunit.al
index b2dcf39c0b..bea2f704e9 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsExpressions.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsExpressions.Codeunit.al
@@ -63,6 +63,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
var
Item: Record Item;
TempIgnoredQltyInspectionHeader: Record "Qlty. Inspection Header" temporary;
+ TempIgnoredQltyInspectionLine: Record "Qlty. Inspection Line" temporary;
QltyExpressionMgmt: Codeunit "Qlty. Expression Mgmt.";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
begin
@@ -85,7 +86,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
// [WHEN] Text expression is evaluated with item field lookup syntax
// [THEN] Item field values are correctly retrieved and substituted into the expression
LibraryAssert.AreEqual('A turkey apple cheese is 123' + GetRegionalDecimalSeparator() + '45',
- QltyExpressionMgmt.EvaluateTextExpression('A [Item:Description 2] is [Item:Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('A [Item:Description 2] is [Item:Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'Basic item lookup a');
end;
@@ -94,6 +95,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
var
Item: Record Item;
TempIgnoredQltyInspectionHeader: Record "Qlty. Inspection Header" temporary;
+ TempIgnoredQltyInspectionLine: Record "Qlty. Inspection Line" temporary;
QltyExpressionMgmt: Codeunit "Qlty. Expression Mgmt.";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
begin
@@ -116,25 +118,25 @@ codeunit 139961 "Qlty. Tests - Expressions"
// [WHEN] Text expression is evaluated with F0 format (standard with thousands separator)
// [THEN] The value is formatted with thousands separators and decimal separator
LibraryAssert.AreEqual('F0 A turkey apple cheese is 1' + GetRegionalThousandsSeparator() + '234' + GetRegionalThousandsSeparator() + '567' + GetRegionalThousandsSeparator() + '890' + GetRegionalDecimalSeparator() + '12',
- QltyExpressionMgmt.EvaluateTextExpression('F0 A [Item:Description 2] is [Item(F0):Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('F0 A [Item:Description 2] is [Item(F0):Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'Table(F0):field');
// [WHEN] Text expression is evaluated with F1 format (no thousands separator)
// [THEN] The value is formatted without thousands separators
LibraryAssert.AreEqual('F1 A turkey apple cheese is 1234567890' + GetRegionalDecimalSeparator() + '12',
- QltyExpressionMgmt.EvaluateTextExpression('F1 A [Item:Description 2] is [Item(F1):Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('F1 A [Item:Description 2] is [Item(F1):Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'Table(F1):field');
// [WHEN] Text expression is evaluated with F2 format (plain format)
// [THEN] The value is formatted as a plain decimal number
- LibraryAssert.AreEqual('F2 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F2 A [Item:Description 2] is [Item(F2):Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ LibraryAssert.AreEqual('F2 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F2 A [Item:Description 2] is [Item(F2):Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'Table(F2):field');
// [WHEN] Text expression is evaluated with F9 format (same as F2, plain format)
// [THEN] The value is formatted as a plain decimal number
- LibraryAssert.AreEqual('F9 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F9 A [Item:Description 2] is [Item(F9):Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ LibraryAssert.AreEqual('F9 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F9 A [Item:Description 2] is [Item(F9):Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'Table(F9):field');
// [WHEN] Text expression is evaluated with legacy format syntax (ItemF)
// [THEN] The legacy syntax still works with standard formatting
LibraryAssert.AreEqual('(legacy format syntax) A turkey apple cheese is 1' + GetRegionalThousandsSeparator() + '234' + GetRegionalThousandsSeparator() + '567' + GetRegionalThousandsSeparator() + '890' + GetRegionalDecimalSeparator() + '12',
- QltyExpressionMgmt.EvaluateTextExpression('(legacy format syntax) A [Item:Description 2] is [ItemF:Unit Cost]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('(legacy format syntax) A [Item:Description 2] is [ItemF:Unit Cost]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'TableF:field');
end;
@@ -143,6 +145,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
var
Item: Record Item;
TempIgnoredQltyInspectionHeader: Record "Qlty. Inspection Header" temporary;
+ TempIgnoredQltyInspectionLine: Record "Qlty. Inspection Line" temporary;
QltyExpressionMgmt: Codeunit "Qlty. Expression Mgmt.";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
begin
@@ -165,20 +168,20 @@ codeunit 139961 "Qlty. Tests - Expressions"
// [WHEN] FORMATNUM function is used with format 0 (standard with thousands separator)
// [THEN] The value is formatted with thousands separators
LibraryAssert.AreEqual('F0 A turkey apple cheese is 1' + GetRegionalThousandsSeparator() + '234' + GetRegionalThousandsSeparator() + '567' + GetRegionalThousandsSeparator() + '890' + GetRegionalDecimalSeparator() + '12',
- QltyExpressionMgmt.EvaluateTextExpression('F0 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];0;)]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('F0 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];0;)]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'FORMATNUM-0');
// [WHEN] FORMATNUM function is used with format 1 (no thousands separator)
// [THEN] The value is formatted without thousands separators
LibraryAssert.AreEqual('F1 A turkey apple cheese is 1234567890' + GetRegionalDecimalSeparator() + '12',
- QltyExpressionMgmt.EvaluateTextExpression('F1 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];1;)]', TempIgnoredQltyInspectionHeader, true),
+ QltyExpressionMgmt.EvaluateTextExpression('F1 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];1;)]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'FORMATNUM-1');
// [WHEN] FORMATNUM function is used with format 2 (plain format)
// [THEN] The value is formatted as a plain decimal number
- LibraryAssert.AreEqual('F2 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F2 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];2; )]', TempIgnoredQltyInspectionHeader, true),
+ LibraryAssert.AreEqual('F2 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F2 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];2; )]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'FORMATNUM-2');
// [WHEN] FORMATNUM function is used with format 9 (same as format 2)
// [THEN] The value is formatted as a plain decimal number
- LibraryAssert.AreEqual('F9 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F9 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];9; )]', TempIgnoredQltyInspectionHeader, true),
+ LibraryAssert.AreEqual('F9 A turkey apple cheese is 1234567890.12', QltyExpressionMgmt.EvaluateTextExpression('F9 A [Item:Description 2] is [FORMATNUM([Item:Unit Cost];9; )]', TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine),
'FORMATNUM-9');
end;
@@ -187,6 +190,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
var
Location: Record Location;
TempIgnoredQltyInspectionHeader: Record "Qlty. Inspection Header" temporary;
+ TempIgnoredQltyInspectionLine: Record "Qlty. Inspection Line" temporary;
QltyExpressionMgmt: Codeunit "Qlty. Expression Mgmt.";
LibraryWarehouse: Codeunit "Library - Warehouse";
begin
@@ -199,7 +203,7 @@ codeunit 139961 "Qlty. Tests - Expressions"
// [WHEN] LOOKUP expression is evaluated to find location code by name
// [THEN] The correct location code is returned
- LibraryAssert.AreEqual(Location.Code, QltyExpressionMgmt.EvaluateTextExpression(StrSubstNo(LookupExpressionTok, LocationNameTok), TempIgnoredQltyInspectionHeader, false), 'should return the location code');
+ LibraryAssert.AreEqual(Location.Code, QltyExpressionMgmt.EvaluateTextExpression(StrSubstNo(LookupExpressionTok, LocationNameTok), TempIgnoredQltyInspectionHeader, TempIgnoredQltyInspectionLine), 'should return the location code');
end;
[Test]
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsFilterHelpers.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsFilterHelpers.Codeunit.al
index 3f537694bf..2d3a6312d8 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsFilterHelpers.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsFilterHelpers.Codeunit.al
@@ -33,6 +33,7 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
var
LibraryAssert: Codeunit "Library Assert";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyFilterHelpers: Codeunit "Qlty. Filter Helpers";
Code20: Code[20];
ZoneTok: Label 'PICK';
@@ -70,7 +71,7 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
Code20 := Item."No.";
// [WHEN] BuildFilter is called with no existing filter
- ClaimedFilterBuilt := QltyFilterHelpers.BuildFilter(Database::Item, false, Value);
+ ClaimedFilterBuilt := QltyInspectionUtility.BuildFilter(Database::Item, false, Value);
// [THEN] A filter is successfully built
LibraryAssert.IsTrue(ClaimedFilterBuilt, 'Should have made filter');
@@ -98,7 +99,7 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
Code20 := SecondItem."No.";
// [WHEN] BuildFilter is called with an existing filter
- ClaimedFilterBuilt := QltyFilterHelpers.BuildFilter(Database::Item, false, Value);
+ ClaimedFilterBuilt := QltyInspectionUtility.BuildFilter(Database::Item, false, Value);
// [THEN] A filter is successfully built
LibraryAssert.IsTrue(ClaimedFilterBuilt, 'Should have made filter');
@@ -1937,7 +1938,6 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
procedure EditQltyInspectionTemplate_NoFilter()
var
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
Template: Code[20];
FoundTemplate: Boolean;
begin
@@ -1960,7 +1960,6 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
procedure EditQltyInspectionTemplate_TemplateFilter()
var
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
Template: Code[20];
FoundTemplate: Boolean;
begin
@@ -2154,7 +2153,7 @@ codeunit 139962 "Qlty. Tests - Filter Helpers"
Filter := StrSubstNo(Attribute2Tok, ItemAttribute.Name, ItemAttributeValue.Value);
// [WHEN] BuildItemAttributeFilter is called to add a second attribute
- QltyFilterHelpers.BuildItemAttributeFilter(Filter);
+ QltyInspectionUtility.BuildItemAttributeFilter(Filter);
// [THEN] The filter contains both attributes
LibraryAssert.AreEqual(StrSubstNo(Attribute3Tok, ItemAttribute.Name, ItemAttributeValue.Value, SecondItemAttribute.Name, SecondItemAttributeValue.Value), Filter, 'Should match provided attributes.');
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsGenerationRule.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsGenerationRule.Codeunit.al
index 52a3afc301..cfbdad993e 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsGenerationRule.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsGenerationRule.Codeunit.al
@@ -298,7 +298,7 @@ codeunit 139955 "Qlty. Tests - Generation Rule"
// [WHEN] Filters are set to applicable templates without any generation rule
// [THEN] An error is raised indicating no compatible generation rules found
- asserterror QltyInspecGenRuleMgmt.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
+ asserterror QltyInspectionUtility.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
LibraryAssert.ExpectedError(StrSubstNo(CouldNotFindGenerationRuleErr, QltyInspectionTemplateHdr.Code));
end;
@@ -328,7 +328,7 @@ codeunit 139955 "Qlty. Tests - Generation Rule"
RecordRef.GetTable(Customer);
// [THEN] An error is raised indicating no source configuration found for the table
- asserterror QltyInspecGenRuleMgmt.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
+ asserterror QltyInspectionUtility.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
LibraryAssert.ExpectedError(StrSubstNo(CouldNotFindSourceErr, QltyInspectionTemplateHdr.Code, Database::Customer));
end;
@@ -353,12 +353,12 @@ codeunit 139955 "Qlty. Tests - Generation Rule"
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Purchase Line", QltyInspectionGenRule);
// [WHEN] Filters are set to applicable templates
- QltyInspecGenRuleMgmt.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
+ QltyInspectionUtility.SetFilterToApplicableTemplates(QltyInspectionTemplateHdr.Code, SpecificQltyInspectSourceConfig);
// [THEN] The source configuration record is filtered to the Purchase Line table
RecordRef.GetTable(SpecificQltyInspectSourceConfig);
Filter := RecordRef.GetFilters();
- LibraryAssert.IsTrue(Filter.Contains('39'), 'Filter should have Purchase Line table.');
+ LibraryAssert.IsTrue(Filter.Contains(Format(Database::"Purchase Line")), 'Filter should have Purchase Line table.');
end;
[Test]
@@ -379,7 +379,7 @@ codeunit 139955 "Qlty. Tests - Generation Rule"
SpecificQltyInspectSourceConfig.Insert();
// [WHEN] Filter for available configurations is retrieved
- Filters := QltyInspecGenRuleMgmt.GetFilterForAvailableConfigurations();
+ Filters := QltyInspectionUtility.GetFilterForAvailableConfigurations();
// [THEN] The filter contains the Purchase Line table number
LibraryAssert.IsTrue(Filters.Contains(Format(Database::"Purchase Line")), 'Should contain table no.');
@@ -391,7 +391,7 @@ codeunit 139955 "Qlty. Tests - Generation Rule"
begin
QltyInspectionGenRule.DeleteAll();
QltyInspectionGenRule.Init();
- QltyInspectionGenRule.SetEntryNo();
+ QltyInspectionUtility.SetEntryNo(QltyInspectionGenRule);
QltyInspectionGenRule.Insert();
QltyInspectionGenRule."Source Table No." := Database::"Purchase Line";
QltyInspectionGenRule."Template Code" := TemplateCode;
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsInsepctions.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsInsepctions.Codeunit.al
index 6eeb9d737d..4281f47cab 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsInsepctions.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsInsepctions.Codeunit.al
@@ -14,7 +14,6 @@ using Microsoft.QualityManagement.Configuration.GenerationRule;
using Microsoft.QualityManagement.Configuration.Template;
using Microsoft.QualityManagement.Configuration.Template.Test;
using Microsoft.QualityManagement.Document;
-using Microsoft.QualityManagement.Integration.Utilities;
using Microsoft.QualityManagement.Setup;
using Microsoft.Test.QualityManagement.TestLibraries;
using Microsoft.Utilities;
@@ -690,7 +689,6 @@ codeunit 139970 "Qlty. Tests - Insepctions"
QltyInspectionHeader: Record "Qlty. Inspection Header";
QltyManagementSetup: Record "Qlty. Management Setup";
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- QltyUtilitiesIntegration: Codeunit "Qlty. Utilities Integration";
JsonArray: JsonArray;
FieldJsonObject: JsonObject;
FieldJsonToken: JsonToken;
@@ -705,7 +703,7 @@ codeunit 139970 "Qlty. Tests - Insepctions"
QltyManagementSetup.Get();
// [GIVEN] Brick headers are configured in Quality Management setup
- QltyManagementSetup.GetBrickHeaders(QltyManagementSetup."Brick Top Left Header", QltyManagementSetup."Brick Middle Left Header", QltyManagementSetup."Brick Middle Right Header", QltyManagementSetup."Brick Bottom Left Header", QltyManagementSetup."Brick Bottom Right Header");
+ QltyInspectionUtility.GetBrickHeaders(QltyManagementSetup);
QltyManagementSetup.Modify();
// [GIVEN] A basic template and Inspection instance are created
@@ -728,7 +726,7 @@ codeunit 139970 "Qlty. Tests - Insepctions"
JsonArray.Add(FieldJsonObject);
// [WHEN] The page summary handler is invoked for the Quality Inspection
- QltyUtilitiesIntegration.InternalHandleOnAfterGetPageSummary(Page::"Qlty. Inspection", QltyInspectionHeader.RecordId(), JsonArray);
+ QltyInspectionUtility.HandleOnAfterGetPageSummary(Page::"Qlty. Inspection", QltyInspectionHeader.RecordId(), JsonArray);
// [THEN] All brick field captions are replaced with the configured brick headers from setup
foreach FieldJsonToken in JsonArray do begin
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsItemTracking.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsItemTracking.Codeunit.al
index ff9f0bcc87..4dc1dd4df7 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsItemTracking.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsItemTracking.Codeunit.al
@@ -2516,7 +2516,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
PurRtnOrderPurchaseLine.FindFirst();
// [WHEN] Tracking is deleted and recreated for purchase return order line with quantity 10
- QltyItemTrackingMgmt.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, 10);
+ QltyInspectionUtility.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, 10);
// [THEN] One reservation entry is created with correct location, lot number, and negative quantity
Clear(ReservationEntry);
@@ -2597,7 +2597,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
PurRtnOrderPurchaseLine.FindFirst();
// [WHEN] Attempting to delete and recreate tracking with negative quantity of -10
- asserterror QltyItemTrackingMgmt.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, -10);
+ asserterror QltyInspectionUtility.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, -10);
// [THEN] Error is thrown indicating negative tracking entries cannot be created
LibraryAssert.ExpectedError(StrSubstNo(NegativeTrackingErr, Item."No.", PurRtnOrderPurchaseHeader."No."));
@@ -2671,7 +2671,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
PurRtnOrderPurchaseLine.FindFirst();
// [WHEN] Attempting to delete and recreate tracking with quantity 10 for serial-tracked item
- asserterror QltyItemTrackingMgmt.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, 10);
+ asserterror QltyInspectionUtility.DeleteAndRecreatePurchaseReturnOrderLineTracking(QltyInspectionHeader, PurRtnOrderPurchaseLine, 10);
// [THEN] Error is thrown indicating serial number has already been entered
LibraryAssert.ExpectedError(StrSubstNo(SNAlreadyEnteredErr, Serial));
@@ -2931,7 +2931,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is lot-tracked
TempItemTrackingSetup."Lot No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is true indicating item is lot-tracked
LibraryAssert.IsTrue(TempItemTrackingSetup."Lot No. Required", 'Should return is lot-tracked (true)');
@@ -2951,7 +2951,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is lot-tracked
TempItemTrackingSetup."Lot No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is false indicating item is not lot-tracked
LibraryAssert.IsFalse(TempItemTrackingSetup."Lot No. Required", 'Should return is not lot-tracked (false)');
@@ -2972,7 +2972,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is serial-tracked
TempItemTrackingSetup."Serial No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is true indicating item is serial-tracked
LibraryAssert.IsTrue(TempItemTrackingSetup."Serial No. Required", 'Should return is serial-tracked (true)');
@@ -2992,7 +2992,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is serial-tracked
TempItemTrackingSetup."Serial No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is false indicating item is not serial-tracked
LibraryAssert.IsFalse(TempItemTrackingSetup."Serial No. Required", 'Should return is not serial-tracked (false)');
@@ -3013,7 +3013,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is package-tracked
TempItemTrackingSetup."Package No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is true indicating item is package-tracked
LibraryAssert.IsTrue(TempItemTrackingSetup."Package No. Required", 'Should return is package-tracked (true)');
@@ -3033,7 +3033,7 @@ codeunit 139971 "Qlty. Tests - Item Tracking"
// [WHEN] Checking if item is package-tracked
TempItemTrackingSetup."Package No. Required" := true;
- QltyItemTracking.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
+ QltyInspectionUtility.IsItemTrackingUsed(Item."No.", TempItemTrackingSetup);
// [THEN] Result is false indicating item is not package-tracked
LibraryAssert.IsFalse(TempItemTrackingSetup."Package No. Required", 'Should return is not package-tracked (false)');
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsMisc.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsMisc.Codeunit.al
index ee5ca55240..fdd2985a66 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsMisc.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsMisc.Codeunit.al
@@ -51,16 +51,11 @@ codeunit 139964 "Qlty. Tests - Misc."
var
LibraryAssert: Codeunit "Library Assert";
LibraryERMCountryData: Codeunit "Library - ERM Country Data";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
Any: Codeunit Any;
- TestNotification: Notification;
- NotificationMsg: Text;
- NotificationOptions: Dictionary of [Text, Text];
DocumentNo: Text;
FlagTestNavigateToSourceDocument: Text;
NotificationDataInspectionRecordIdTok: Label 'InspectionRecordId', Locked = true;
- AssignToSelfExpectedMessageLbl: Label 'You have altered inspection %1, would you like to assign it to yourself?', Comment = '%1=the inspection number';
- AssignToSelfLbl: Label 'Assign to myself';
- IgnoreLbl: Label 'Ignore';
Bin1Tok: Label 'Bin1';
Bin2Tok: Label 'Bin2';
EntryTypeBlockedErr: Label 'This warehouse transaction was blocked because the quality inspection %1 has the result of %2 for item %4 with tracking %5 %6, which is configured to disallow the transaction "%3". You can change whether this transaction is allowed by navigating to Quality Inspection Results.', Comment = '%1=quality inspection, %2=result, %3=entry type being blocked, %4=item, %5=lot, %6=serial';
@@ -75,7 +70,6 @@ codeunit 139964 "Qlty. Tests - Misc."
[Test]
procedure AttemptSplitSimpleRangeIntoMinMax_IntegerSimple()
var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
Min: Decimal;
Max: Decimal;
begin
@@ -86,7 +80,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] AttemptSplitSimpleRangeIntoMinMax is called with the range string
// [THEN] The function returns true and sets Min to 1 and Max to 2
Initialize();
- LibraryAssert.AreEqual(true, QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax('1..2', Min, Max), 'simple conversion');
+ LibraryAssert.AreEqual(true, QltyInspectionUtility.AttemptSplitSimpleRangeIntoMinMax('1..2', Min, Max), 'simple conversion');
LibraryAssert.AreEqual(1, Min, 'simple integer min');
LibraryAssert.AreEqual(2, Max, 'simple integer max');
end;
@@ -94,7 +88,6 @@ codeunit 139964 "Qlty. Tests - Misc."
[Test]
procedure AttemptSplitSimpleRangeIntoMinMax_IntegerNegativeValues()
var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
Min: Decimal;
Max: Decimal;
begin
@@ -105,7 +98,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] AttemptSplitSimpleRangeIntoMinMax is called with the negative range
// [THEN] The function returns true and sets Min to -5 and Max to -1
Initialize();
- LibraryAssert.AreEqual(true, QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax('-5..-1', Min, Max), 'negative');
+ LibraryAssert.AreEqual(true, QltyInspectionUtility.AttemptSplitSimpleRangeIntoMinMax('-5..-1', Min, Max), 'negative');
LibraryAssert.AreEqual(-5, Min, 'simple integer min');
LibraryAssert.AreEqual(-1, Max, 'simple integer max');
end;
@@ -113,7 +106,6 @@ codeunit 139964 "Qlty. Tests - Misc."
[Test]
procedure AttemptSplitSimpleRangeIntoMinMax_DecimalSimple()
var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
Min: Decimal;
Max: Decimal;
begin
@@ -124,7 +116,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] AttemptSplitSimpleRangeIntoMinMax is called with the decimal range
// [THEN] The function returns true and sets Min to 1.00000001 and Max to 2.999999999999
Initialize();
- LibraryAssert.AreEqual(true, QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax('1.00000001..2.999999999999', Min, Max), 'simple conversion');
+ LibraryAssert.AreEqual(true, QltyInspectionUtility.AttemptSplitSimpleRangeIntoMinMax('1.00000001..2.999999999999', Min, Max), 'simple conversion');
LibraryAssert.AreEqual(1.00000001, Min, 'simple decimal min');
LibraryAssert.AreEqual(2.999999999999, Max, 'simple decimal max');
end;
@@ -132,7 +124,6 @@ codeunit 139964 "Qlty. Tests - Misc."
[Test]
procedure AttemptSplitSimpleRangeIntoMinMax_DecimalThousands()
var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
Min: Decimal;
Max: Decimal;
begin
@@ -143,15 +134,13 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] AttemptSplitSimpleRangeIntoMinMax is called with the formatted range
// [THEN] The function returns true and correctly parses Min and Max values
Initialize();
- LibraryAssert.AreEqual(true, QltyMiscHelpers.AttemptSplitSimpleRangeIntoMinMax('1.00000001..1,234,567,890.99', Min, Max), 'simple conversion');
+ LibraryAssert.AreEqual(true, QltyInspectionUtility.AttemptSplitSimpleRangeIntoMinMax('1.00000001..1,234,567,890.99', Min, Max), 'simple conversion');
LibraryAssert.AreEqual(1.00000001, Min, 'thousands separator decimal min');
LibraryAssert.AreEqual(1234567890.99, Max, 'thousands separator decimal max');
end;
[Test]
procedure GetArbitraryMaximumRecursion()
- var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
begin
// [SCENARIO] Verify the maximum recursion depth limit
@@ -160,7 +149,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] GetArbitraryMaximumRecursion is called
// [THEN] The function returns 20 as the maximum recursion depth
Initialize();
- LibraryAssert.AreEqual(20, QltyMiscHelpers.GetArbitraryMaximumRecursion(), '20 levels of recursion maximum are expected');
+ LibraryAssert.AreEqual(20, QltyInspectionUtility.GetArbitraryMaximumRecursion(), '20 levels of recursion maximum are expected');
end;
[Test]
@@ -443,7 +432,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
LibraryPermissions: Codeunit "Library - Permissions";
@@ -628,7 +616,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] GetCSVOfValuesFromRecord is called without filter
// [THEN] The function returns a comma-separated list of all codes
OutputOne := QltyMiscHelpers.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), '', 0);
- OutputTwo := QltyMiscHelpers.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), '');
+ OutputTwo := QltyInspectionUtility.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), '');
LibraryAssert.AreEqual(OutputOne, OutputTwo, 'different approaches should be identical');
Count := FirstSalespersonPurchaser.Count();
@@ -667,7 +655,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] GetCSVOfValuesFromRecord is called with a filter view
// [THEN] The function returns only the single filtered code value
Output1 := QltyMiscHelpers.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), FirstSalespersonPurchaser.GetView(true), 0);
- Output2 := QltyMiscHelpers.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), FirstSalespersonPurchaser.GetView(false));
+ Output2 := QltyInspectionUtility.GetCSVOfValuesFromRecord(Database::"Salesperson/Purchaser", FirstSalespersonPurchaser.FieldNo(Code), FirstSalespersonPurchaser.GetView(false));
LibraryAssert.AreEqual(Output1, Output2, 'different approaches should be identical');
CountOfCommas := StrLen(Output1) - strlen(DelChr(Output1, '=', ','));
@@ -741,8 +729,6 @@ codeunit 139964 "Qlty. Tests - Misc."
procedure GetDefaultMaximumRowsFieldLookup_Defined()
var
QltyManagementSetup: Record "Qlty. Management Setup";
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
// [SCENARIO] Get maximum rows for field lookup when configured
@@ -757,15 +743,13 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] GetDefaultMaximumRowsFieldLookup is called
// [THEN] The function returns the configured value of 2
- LibraryAssert.AreEqual(2, QltyMiscHelpers.GetDefaultMaximumRowsFieldLookup(), 'simple maximum');
+ LibraryAssert.AreEqual(2, QltyInspectionUtility.GetDefaultMaximumRowsFieldLookup(), 'simple maximum');
end;
[Test]
procedure GetDefaultMaximumRowsFieldLookup_Undefined()
var
QltyManagementSetup: Record "Qlty. Management Setup";
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
begin
// [SCENARIO] Get maximum rows for field lookup when not configured
@@ -780,7 +764,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] GetDefaultMaximumRowsFieldLookup is called
// [THEN] The function returns the default value of 100
- LibraryAssert.AreEqual(100, QltyMiscHelpers.GetDefaultMaximumRowsFieldLookup(), 'simple maximum');
+ LibraryAssert.AreEqual(100, QltyInspectionUtility.GetDefaultMaximumRowsFieldLookup(), 'simple maximum');
end;
[Test]
@@ -822,7 +806,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
LibraryPermissions: Codeunit "Library - Permissions";
@@ -927,7 +910,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
LibraryPermissions: Codeunit "Library - Permissions";
@@ -1039,7 +1021,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
LibraryPermissions: Codeunit "Library - Permissions";
@@ -1128,7 +1109,7 @@ codeunit 139964 "Qlty. Tests - Misc."
TempBufferQltyLookupCode.FindFirst();
LibraryAssert.AreEqual(SalespersonPurchaser.Code, TempBufferQltyLookupCode.Code, 'first key should have been set');
- QltyMiscHelpers.GetRecordsForTableField(QltyTest, QltyInspectionHeader, TempBufferQltyLookupCode);
+ QltyInspectionUtility.GetRecordsForTableField(QltyTest, QltyInspectionHeader, TempBufferQltyLookupCode);
LibraryAssert.AreEqual(1, TempBufferQltyLookupCode.Count(), 'should have been 1 record.');
TempBufferQltyLookupCode.FindFirst();
@@ -1153,7 +1134,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
LibraryPermissions: Codeunit "Library - Permissions";
@@ -1353,8 +1333,6 @@ codeunit 139964 "Qlty. Tests - Misc."
[Test]
procedure IsNumericText()
- var
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
begin
// [SCENARIO] Validate if text contains numeric values
@@ -1363,14 +1341,14 @@ codeunit 139964 "Qlty. Tests - Misc."
// [GIVEN] Various text values (numbers, text, mixed content)
// [WHEN] IsNumericText is called with each value
// [THEN] The function returns true for numeric text, false for non-numeric text
- LibraryAssert.IsTrue(QltyMiscHelpers.IsNumericText('0'), 'zero');
- LibraryAssert.IsTrue(QltyMiscHelpers.IsNumericText('-1'), 'simple negative');
- LibraryAssert.IsTrue(QltyMiscHelpers.IsNumericText('1'), 'simple positive');
- LibraryAssert.IsTrue(QltyMiscHelpers.IsNumericText(format(123456789.1234)), 'lcoale format');
- LibraryAssert.IsTrue(QltyMiscHelpers.IsNumericText(format(123456789.1234, 0, 9)), 'ISO format');
- LibraryAssert.IsFalse(QltyMiscHelpers.IsNumericText('not a hot dog'), 'simple text');
- LibraryAssert.IsFalse(QltyMiscHelpers.IsNumericText('A1B2C3'), 'mixed');
- LibraryAssert.IsFalse(QltyMiscHelpers.IsNumericText('1+2+3=4'), 'formula');
+ LibraryAssert.IsTrue(QltyInspectionUtility.IsNumericText('0'), 'zero');
+ LibraryAssert.IsTrue(QltyInspectionUtility.IsNumericText('-1'), 'simple negative');
+ LibraryAssert.IsTrue(QltyInspectionUtility.IsNumericText('1'), 'simple positive');
+ LibraryAssert.IsTrue(QltyInspectionUtility.IsNumericText(format(123456789.1234)), 'lcoale format');
+ LibraryAssert.IsTrue(QltyInspectionUtility.IsNumericText(format(123456789.1234, 0, 9)), 'ISO format');
+ LibraryAssert.IsFalse(QltyInspectionUtility.IsNumericText('not a hot dog'), 'simple text');
+ LibraryAssert.IsFalse(QltyInspectionUtility.IsNumericText('A1B2C3'), 'mixed');
+ LibraryAssert.IsFalse(QltyInspectionUtility.IsNumericText('1+2+3=4'), 'formula');
end;
[Test]
@@ -1465,7 +1443,6 @@ codeunit 139964 "Qlty. Tests - Misc."
procedure NavigateToFindEntries()
var
TempQltyInspectionHeader: Record "Qlty. Inspection Header" temporary;
- QltyMiscHelpers: Codeunit "Qlty. Misc Helpers";
Navigate: TestPage Navigate;
begin
// [SCENARIO] Navigate to find entries from inspection header
@@ -1481,7 +1458,7 @@ codeunit 139964 "Qlty. Tests - Misc."
// [WHEN] NavigateToFindEntries is called
Navigate.Trap();
- QltyMiscHelpers.NavigateToFindEntries(TempQltyInspectionHeader);
+ QltyInspectionUtility.NavigateToFindEntries(TempQltyInspectionHeader);
// [THEN] The Navigate page opens with lot and serial number filters applied
LibraryAssert.AreEqual('SERIALGHI', Navigate.SerialNoFilter.Value, 'serial filter got set');
@@ -1624,7 +1601,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ReservationEntry: Record "Reservation Entry";
NoSeries: Codeunit "No. Series";
ItemJnlPostBatch: Codeunit "Item Jnl.-Post Batch";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
LibraryInventory: Codeunit "Library - Inventory";
LibraryItemTracking: Codeunit "Library - Item Tracking";
LibraryWarehouse: Codeunit "Library - Warehouse";
@@ -1828,7 +1804,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ToUseNoSeries: Record "No. Series";
ToUseNoSeriesLine: Record "No. Series Line";
NoSeries: Codeunit "No. Series";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
LibraryAssembly: Codeunit "Library - Assembly";
LibraryInventory: Codeunit "Library - Inventory";
LibraryItemTracking: Codeunit "Library - Item Tracking";
@@ -1936,7 +1911,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ToLoadQltyInspectionResult: Record "Qlty. Inspection Result";
QltyInspectionHeader: Record "Qlty. Inspection Header";
ReQltyInspectionHeader: Record "Qlty. Inspection Header";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryPurchase: Codeunit "Library - Purchase";
@@ -2001,7 +1975,6 @@ codeunit 139964 "Qlty. Tests - Misc."
var
QltyManagementSetup: Record "Qlty. Management Setup";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
ToLoadQltyInspectionResult: Record "Qlty. Inspection Result";
QltyInspectionHeader: Record "Qlty. Inspection Header";
@@ -2019,7 +1992,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ItemJournalBatch: Record "Item Journal Batch";
ItemJournalLine: Record "Item Journal Line";
NoSeries: Codeunit "No. Series";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryAssembly: Codeunit "Library - Assembly";
LibraryWarehouse: Codeunit "Library - Warehouse";
@@ -2030,7 +2002,6 @@ codeunit 139964 "Qlty. Tests - Misc."
UnusedVariant2: Variant;
LotNo: Code[50];
SerialNo: Code[50];
- ConfigCode: Text;
begin
// [SCENARIO] Block assembly output with "Only the most recently modified finished inspection" behavior should error
@@ -2062,57 +2033,39 @@ codeunit 139964 "Qlty. Tests - Misc."
QltyInspectionUtility.CreatePrioritizedRule(ConfigurationToLoadQltyInspectionTemplateHdr, Database::"Assembly Header", QltyInspectionGenRule);
// [GIVEN] Custom inspection source configuration for Assembly Header to Inspection created
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Assembly Header");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("Item No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Item No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("Document Type");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Type");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("Quantity to Assemble (Base)");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Quantity (Base)");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(SpecificQltyInspectSourceConfig, Database::"Assembly Header", Enum::"Qlty. Target Type"::Inspection, Database::"Qlty. Inspection Header");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("Item No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Item No."));
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("Document Type"),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Type"));
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("Quantity to Assemble (Base)"),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Quantity (Base)"));
// [GIVEN] Location created
LibraryWarehouse.CreateLocation(Location);
@@ -2200,7 +2153,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ReservationEntry: Record "Reservation Entry";
ToUseNoSeries: Record "No. Series";
WarehouseActivityLine: Record "Warehouse Activity Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryWarehouse: Codeunit "Library - Warehouse";
@@ -2287,7 +2239,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ReservationEntry: Record "Reservation Entry";
ToUseNoSeries: Record "No. Series";
WarehouseActivityLine: Record "Warehouse Activity Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
LibraryWarehouse: Codeunit "Library - Warehouse";
LibraryPurchase: Codeunit "Library - Purchase";
@@ -2369,7 +2320,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ReservationEntry: Record "Reservation Entry";
ToUseNoSeries: Record "No. Series";
WarehouseActivityLine: Record "Warehouse Activity Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryWarehouse: Codeunit "Library - Warehouse";
@@ -2474,7 +2424,6 @@ codeunit 139964 "Qlty. Tests - Misc."
InventorySetup: Record "Inventory Setup";
InventoryMovementWarehouseActivityHeader: Record "Warehouse Activity Header";
WarehouseActivityLine: Record "Warehouse Activity Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryInventory: Codeunit "Library - Inventory";
@@ -2620,7 +2569,6 @@ codeunit 139964 "Qlty. Tests - Misc."
ToUseNoSeries: Record "No. Series";
WhseMovementWarehouseActivityHeader: Record "Warehouse Activity Header";
WarehouseActivityLine: Record "Warehouse Activity Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
LibraryWarehouse: Codeunit "Library - Warehouse";
@@ -2758,13 +2706,10 @@ codeunit 139964 "Qlty. Tests - Misc."
LibraryWarehouse: Codeunit "Library - Warehouse";
LibraryPurchase: Codeunit "Library - Purchase";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
Notification: Notification;
WhseWorksheetTemplateToUse: Text;
begin
// [SCENARIO] Notification management handles opening warehouse movement document
-
Initialize();
// [GIVEN] Quality Management setup ensured
@@ -2844,64 +2789,12 @@ codeunit 139964 "Qlty. Tests - Misc."
Notification.SetData(NotificationDataRelatedRecordIdTok, Format(WhseMovementWarehouseActivityHeader.RecordId()));
// [WHEN] HandleOpenDocument is called on the notification
- QltyNotificationMgmt.HandleOpenDocument(Notification);
+ QltyInspectionUtility.HandleOpenDocument(Notification);
// [THEN] The warehouse movement document page opens and the handler validates the correct document number
LibraryAssert.AreEqual(WhseMovementWarehouseActivityHeader."No.", DocumentNo, 'Should navigate to the movement document');
end;
- [Test]
- procedure NotifyDoYouWantToAssignToYourself()
- var
- QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
- Location: Record Location;
- Item: Record Item;
- PurchaseHeader: Record "Purchase Header";
- PurchaseLine: Record "Purchase Line";
- QltyInspectionHeader: Record "Qlty. Inspection Header";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
- LibraryInventory: Codeunit "Library - Inventory";
- LibraryWarehouse: Codeunit "Library - Warehouse";
- begin
- // [SCENARIO] Notification system prompts user to assign quality inspection to themselves with correct message and action options
-
- // [GIVEN] Quality management setup with location, item, and inspection template are configured
- Initialize();
-
- QltyInspectionUtility.EnsureSetupExists();
- LibraryWarehouse.CreateLocation(Location);
- LibraryInventory.CreateItem(Item);
- QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
- QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Purchase Line", QltyInspectionGenRule);
-
- // [GIVEN] A quality inspection is created from a purchase line for an untracked item
- QltyPurOrderGenerator.CreateInspectionFromPurchaseWithUntrackedItem(Location, 100, PurchaseHeader, PurchaseLine, QltyInspectionHeader);
- QltyInspectionGenRule.Delete();
-
- // [GIVEN] Notification capture variables are cleared and subscription is set up
- NotificationMsg := '';
- Clear(NotificationOptions);
- Clear(TestNotification);
-
- BindSubscription(this);
-
- // [WHEN] The notification to assign inspection to yourself is triggered
- QltyNotificationMgmt.NotifyDoYouWantToAssignToYourself(QltyInspectionHeader);
- UnbindSubscription(this);
-
- // [THEN] The notification contains the correct message with inspection number, action options, and inspection record ID data
- LibraryAssert.AreEqual(StrSubstNo(AssignToSelfExpectedMessageLbl, QltyInspectionHeader."No."), NotificationMsg, 'Notification message should match expected pattern with inspection number');
-
- LibraryAssert.IsTrue(NotificationOptions.ContainsKey(AssignToSelfLbl), 'Notification should contain "Assign to myself" action');
- LibraryAssert.IsTrue(NotificationOptions.ContainsKey(IgnoreLbl), 'Notification should contain "Ignore" action');
-
- LibraryAssert.AreEqual(Format(QltyInspectionHeader.RecordId()), TestNotification.GetData(NotificationDataInspectionRecordIdTok), 'Notification should contain the correct inspection record ID in data');
-
- LibraryAssert.IsTrue(StrPos(NotificationMsg, QltyInspectionHeader."No.") > 0, 'Notification message should contain the inspection number');
- end;
[Test]
procedure HandleNotificationActionAssignToSelf()
@@ -2913,9 +2806,7 @@ codeunit 139964 "Qlty. Tests - Misc."
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
QltyInspectionHeader: Record "Qlty. Inspection Header";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- IWXQltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
LibraryWarehouse: Codeunit "Library - Warehouse";
LibraryInventory: Codeunit "Library - Inventory";
MockNotification: Notification;
@@ -2939,7 +2830,7 @@ codeunit 139964 "Qlty. Tests - Misc."
MockNotification.SetData(NotificationDataInspectionRecordIdTok, Format(QltyInspectionHeader.RecordId));
// [WHEN] The assign to self notification action is handled
- IWXQltyNotificationMgmt.HandleNotificationActionAssignToSelf(MockNotification);
+ QltyInspectionUtility.HandleNotificationActionAssignToSelf(MockNotification);
// [THEN] The quality inspection is assigned to the current user
QltyInspectionHeader.Get(QltyInspectionHeader."No.", QltyInspectionHeader."Re-inspection No.");
@@ -2956,9 +2847,7 @@ codeunit 139964 "Qlty. Tests - Misc."
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
QltyInspectionHeader: Record "Qlty. Inspection Header";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
LibraryWarehouse: Codeunit "Library - Warehouse";
LibraryInventory: Codeunit "Library - Inventory";
MockNotification: Notification;
@@ -2982,7 +2871,7 @@ codeunit 139964 "Qlty. Tests - Misc."
MockNotification.SetData(NotificationDataInspectionRecordIdTok, Format(QltyInspectionHeader.RecordId()));
// [WHEN] The ignore notification action is handled
- QltyNotificationMgmt.HandleNotificationActionIgnore(MockNotification);
+ QltyInspectionUtility.HandleNotificationActionIgnore(MockNotification);
// [THEN] The quality inspection is marked to prevent auto assignment
LibraryAssert.IsTrue(QltyInspectionHeader.GetPreventAutoAssignment(), 'Inspection should be ignored');
@@ -3031,13 +2920,4 @@ codeunit 139964 "Qlty. Tests - Misc."
begin
DocumentNo := WarehouseMovement."No.".Value();
end;
-
- [EventSubscriber(ObjectType::Codeunit, Codeunit::"Qlty. Notification Mgmt.", 'OnBeforeCreateActionNotification', '', true, true)]
- local procedure OnBeforeCreateActionNotification(var NotificationToShow: Notification; var CurrentMessage: Text; var AvailableOptions: Dictionary of [Text, Text]; var Handled: Boolean)
- begin
- NotificationMsg := CurrentMessage;
- NotificationOptions := AvailableOptions;
- TestNotification := NotificationToShow;
- Handled := true;
- end;
}
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al
index 416fcd1874..8a9d447b94 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsMoreTests.Codeunit.al
@@ -24,7 +24,6 @@ using Microsoft.QualityManagement.Configuration.Template;
using Microsoft.QualityManagement.Configuration.Template.Test;
using Microsoft.QualityManagement.Document;
using Microsoft.QualityManagement.Setup;
-using Microsoft.QualityManagement.Setup.ApplicationAreas;
using Microsoft.QualityManagement.Utilities;
using Microsoft.Sales.Document;
using Microsoft.Test.QualityManagement.TestLibraries;
@@ -704,7 +703,7 @@ codeunit 139965 "Qlty. Tests - More Tests"
// [WHEN] GetSetupVideoLink is called
// [THEN] An empty string is returned
- LibraryAssert.AreEqual('', QltyManagementSetup.GetSetupVideoLink(), 'Setup video link should be empty');
+ LibraryAssert.AreEqual('', QltyInspectionUtility.GetSetupVideoLink(QltyManagementSetup), 'Setup video link should be empty');
end;
[Test]
@@ -2210,7 +2209,7 @@ codeunit 139965 "Qlty. Tests - More Tests"
SpecificQltyInspectSourceConfig."From Table No." := Database::"Reservation Entry";
// [WHEN] DetectInterestingConfiguration is called
- asserterror SpecificQltyInspectSourceConfig.DetectInterestingConfiguration();
+ asserterror QltyInspectionUtility.DetectInterestingConfiguration(SpecificQltyInspectSourceConfig);
// [THEN] An error is thrown indicating interesting configuration detected
LibraryAssert.ExpectedError(InterestingDetectionErr);
@@ -2235,7 +2234,7 @@ codeunit 139965 "Qlty. Tests - More Tests"
SpecificQltyInspectSourceConfig."To Table No." := Database::"Reservation Entry";
// [WHEN] DetectInterestingConfiguration is called
- asserterror SpecificQltyInspectSourceConfig.DetectInterestingConfiguration();
+ asserterror QltyInspectionUtility.DetectInterestingConfiguration(SpecificQltyInspectSourceConfig);
// [THEN] An error is thrown indicating interesting configuration detected
LibraryAssert.ExpectedError(InterestingDetectionErr);
@@ -2344,7 +2343,6 @@ codeunit 139965 "Qlty. Tests - More Tests"
ApplicationAreaSetup: Record "Application Area Setup";
ConfPersonalizationMgt: Codeunit "Conf./Personalization Mgt.";
ApplicationAreaMgmtFacade: Codeunit "Application Area Mgmt. Facade";
- QltyApplicationAreaMgmt: Codeunit "Qlty. Application Area Mgmt.";
begin
// [SCENARIO] Quality Management application area is enabled by default on Essential experience
Initialize();
@@ -2361,7 +2359,7 @@ codeunit 139965 "Qlty. Tests - More Tests"
// [WHEN] Checking if Quality Management application area is enabled
// [THEN] The application area is enabled
- LibraryAssert.AreEqual(true, QltyApplicationAreaMgmt.IsQualityManagementApplicationAreaEnabled(), 'Should be enabled.');
+ LibraryAssert.AreEqual(true, QltyInspectionUtility.IsQualityManagementApplicationAreaEnabled(), 'Should be enabled.');
end;
local procedure Initialize()
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsResultCondition.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsResultCondition.Codeunit.al
index 8eef456f58..18299f65eb 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsResultCondition.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsResultCondition.Codeunit.al
@@ -530,7 +530,6 @@ codeunit 139956 "Qlty. Tests - Result Condition"
DummyReservationEntry: Record "Reservation Entry";
ToLoadQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
RecordRef: RecordRef;
UnusedVariant: Code[10];
TestCode: Text;
@@ -568,9 +567,7 @@ codeunit 139956 "Qlty. Tests - Result Condition"
UnusedVariant := '';
QltyPurOrderGenerator.CreatePurchaseOrder(100, Location, Item, Vendor, UnusedVariant, PurOrderPurchaseHeader, PurOrdPurchaseLine, DummyReservationEntry);
RecordRef.GetTable(PurOrdPurchaseLine);
- QltyInspectionCreate.SetPreventDisplayingInspectionEvenIfConfigured(true);
- QltyInspectionCreate.CreateInspection(RecordRef, false);
- QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
+ QltyInspectionUtility.CreateInspectionWithPreventDisplaying(RecordRef, true, false, QltyInspectionHeader);
// [WHEN] Result conditions are copied from the template line to the inspection
CondManagementQltyResultConditionMgmt.CopyResultConditionsFromTemplateToInspection(ConfigurationToLoadQltyInspectionTemplateLine, QltyInspectionLine);
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsResultEval.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsResultEval.Codeunit.al
index 338481fa41..15195903d7 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsResultEval.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsResultEval.Codeunit.al
@@ -5,7 +5,6 @@
namespace Microsoft.Test.QualityManagement;
using Microsoft.Manufacturing.Document;
-using Microsoft.QualityManagement.Configuration;
using Microsoft.QualityManagement.Configuration.GenerationRule;
using Microsoft.QualityManagement.Configuration.Result;
using Microsoft.QualityManagement.Configuration.Template;
@@ -56,7 +55,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
[Test]
procedure ValueDecimal()
var
- QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
TestValue: Text;
begin
// [SCENARIO] Validate decimal value testing with various conditions including blank values, ranges, exact matches, and comparison operators
@@ -64,49 +63,49 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [GIVEN] A result evaluation codeunit instance
// [WHEN] Testing blank and zero values with different allowable ranges
// [THEN] Blank values pass with blank allowable ranges but fail with numerical ranges, and zero passes within its valid range
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal('', ''), 'blank string with blank allowable');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal('', '0..1'), 'blank string with numerical range.');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal('0', '0..1'), 'zero numerical range.');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal('0', '-100..100'), 'zero numerical range-extended.');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal('', '-100..100'), 'blank numerical range-extended.');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal('0', ''), 'zero with blank range.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal('', ''), 'blank string with blank allowable');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal('', '0..1'), 'blank string with numerical range.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal('0', '0..1'), 'zero numerical range.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal('0', '-100..100'), 'zero numerical range-extended.');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal('', '-100..100'), 'blank numerical range-extended.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal('0', ''), 'zero with blank range.');
// [WHEN] Testing decimal value '3' with various conditions
TestValue := '3';
// [THEN] Value passes exact match, range, and comparison validations correctly
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, ''), 'Decimal basic no condition');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '3'), 'Decimal basic exact');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '000000000000000'), 'Decimal basic exact lots of precision');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, ''), 'Decimal basic no condition');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '3'), 'Decimal basic exact');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '000000000000000'), 'Decimal basic exact lots of precision');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '2' + GetRegionalDecimalSeparator() + '99999'), 'Decimal basic almost 3 under');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '00001'), 'Decimal basic almost 3 over');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '2'), 'Decimal basic not 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '<>0'), 'Decimal basic not zero');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '<>'''''), 'Decimal basic not zero, demo person special');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '>0'), 'Decimal basic more than zero');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '2' + GetRegionalDecimalSeparator() + '99999'), 'Decimal basic almost 3 under');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '00001'), 'Decimal basic almost 3 over');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '2'), 'Decimal basic not 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '<>0'), 'Decimal basic not zero');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '<>'''''), 'Decimal basic not zero, demo person special');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '>0'), 'Decimal basic more than zero');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '<=3'), 'Decimal basic lteq 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '>=3'), 'Decimal basic gteq 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '<4'), 'Decimal basic lt 4');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '>2' + GetRegionalDecimalSeparator() + '9999'), 'Decimal basic gt 2');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '<=3'), 'Decimal basic lteq 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '>=3'), 'Decimal basic gteq 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '<4'), 'Decimal basic lt 4');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '>2' + GetRegionalDecimalSeparator() + '9999'), 'Decimal basic gt 2');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '2..4'), 'Decimal basic range');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '2..4'), 'Decimal basic range');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '3..3'), 'Decimal basic range');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '3..3'), 'Decimal basic range');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '-100..2' + GetRegionalDecimalSeparator() + '9'), 'Decimal basic range less');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '-100..2' + GetRegionalDecimalSeparator() + '9'), 'Decimal basic range less');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '0001..100'), 'Decimal basic range more');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '3' + GetRegionalDecimalSeparator() + '0001..100'), 'Decimal basic range more');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '1|2|3|4'), 'Decimal basic range list');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '1|2|3|4'), 'Decimal basic range list');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsDecimal(TestValue, '1|2|4'), 'Decimal basic range list');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsDecimal(TestValue, '1|2|4'), 'Decimal basic range list');
end;
[Test]
procedure ValueInteger()
var
- QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
TestValue: Text;
begin
// [SCENARIO] Validate integer value testing with various conditions including exact matches, ranges, comparisons, and lists
@@ -116,28 +115,28 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [WHEN] Testing the integer value against various conditions
// [THEN] The value passes validation for exact matches, ranges, comparisons, and list inclusions
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, ''), 'Integer basic no condition');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger('', ''), 'Integer basic blank.');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '3'), 'Integer basic exact');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '2'), 'Integer basic not 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '<>0'), 'Integer basic not zero');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '>0'), 'Integer basic more than zero');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '<=3'), 'Integer basic lteq 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '>=3'), 'Integer basic gteq 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '<4'), 'Integer basic lt 4');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '>2'), 'Integer basic gt 2');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '2..4'), 'Integer basic range');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '3..3'), 'Integer basic range');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '-100..2'), 'Integer basic range less');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '4..100'), 'Integer basic range more');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '1|2|3|4'), 'Integer list');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsInteger(TestValue, '1|2|4'), 'Integer list missing');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, ''), 'Integer basic no condition');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger('', ''), 'Integer basic blank.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '3'), 'Integer basic exact');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '2'), 'Integer basic not 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '<>0'), 'Integer basic not zero');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '>0'), 'Integer basic more than zero');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '<=3'), 'Integer basic lteq 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '>=3'), 'Integer basic gteq 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '<4'), 'Integer basic lt 4');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '>2'), 'Integer basic gt 2');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '2..4'), 'Integer basic range');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '3..3'), 'Integer basic range');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '-100..2'), 'Integer basic range less');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '4..100'), 'Integer basic range more');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '1|2|3|4'), 'Integer list');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsInteger(TestValue, '1|2|4'), 'Integer list missing');
end;
[Test]
procedure ValueString()
var
- QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
TestValue: Text;
CaseOption: Enum "Qlty. Case Sensitivity";
DatabaseIsCaseSensitive: Boolean;
@@ -150,27 +149,27 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [WHEN] Testing string values with various conditions including wildcards and case sensitivity
// [THEN] Values pass validation for exact matches, wildcard patterns, and respect case sensitivity settings
DatabaseIsCaseSensitive := IsDatabaseCaseSensitive();
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString(TestValue, ''), 'String basic no condition');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString(TestValue, '3'), 'String basic exact');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsString(TestValue, '2'), 'String basic not 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString(TestValue, '<>0'), 'String basic not zero');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString(TestValue, '<>'''''), 'String basic not blank');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('abcdefg', '*b*'), 'String basic wildcard 1');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('abcdefg', '*g'), 'String basic wildcard 2');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'caseSensitive'), 'String case sensitive 1');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString(TestValue, ''), 'String basic no condition');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString(TestValue, '3'), 'String basic exact');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsString(TestValue, '2'), 'String basic not 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString(TestValue, '<>0'), 'String basic not zero');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString(TestValue, '<>'''''), 'String basic not blank');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('abcdefg', '*b*'), 'String basic wildcard 1');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('abcdefg', '*g'), 'String basic wildcard 2');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'caseSensitive'), 'String case sensitive 1');
if DatabaseIsCaseSensitive then begin
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive'), 'String case sensitive 2');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'CaseSensitive'), 'String case sensitive 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Insensitive), 'String case sensitive 4');
- LibraryAssert.IsFalse(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Sensitive), 'String case sensitive 5');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive'), 'String case sensitive 2');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'CaseSensitive'), 'String case sensitive 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Insensitive), 'String case sensitive 4');
+ LibraryAssert.IsFalse(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Sensitive), 'String case sensitive 5');
end else begin
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive'), 'String case sensitive 2');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'CaseSensitive'), 'String case sensitive 3');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Insensitive), 'String case sensitive 4');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Sensitive), 'String case sensitive 5');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive'), 'String case sensitive 2');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'CaseSensitive'), 'String case sensitive 3');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Insensitive), 'String case sensitive 4');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('caseSensitive', 'casesensitive', CaseOption::Sensitive), 'String case sensitive 5');
end;
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('wildCardSearch', '*ard*'), 'String wildcard 1');
- LibraryAssert.IsTrue(QltyResultEvaluation.CheckIfValueIsString('wildCardSearch', 'wild*'), 'String wildcard 2');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('wildCardSearch', '*ard*'), 'String wildcard 1');
+ LibraryAssert.IsTrue(QltyInspectionUtility.CheckIfValueIsString('wildCardSearch', 'wild*'), 'String wildcard 2');
end;
[TryFunction]
@@ -354,7 +353,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -366,14 +364,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a decimal field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, NumericalMeasureQltyTest."Test Value Type"::"Value Type Decimal", NumericalMeasureQltyTest, QltyInspectionTemplateLine);
// [GIVEN] Field-level result condition is set to 4..5 for PASS result
- NumericalMeasureQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '4..5', true);
+ NumericalMeasureQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '4..5', true);
// [GIVEN] Template-level result condition is modified to 6..7 for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
@@ -381,7 +379,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -394,10 +392,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -474,7 +469,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -486,14 +480,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a datetime field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, DateTimeQltyTest."Test Value Type"::"Value Type DateTime", DateTimeQltyTest, QltyInspectionTemplateLine);
// [GIVEN] Field-level result condition is set to '2001-02-03 01:02:03' for PASS result
- DateTimeQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '2001-02-03 01:02:03', true);
+ DateTimeQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '2001-02-03 01:02:03', true);
// [GIVEN] Template-level result condition is modified to '2004-05-06 01:02:03' for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
@@ -501,7 +495,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '2004-05-06 01:02:03');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -510,10 +504,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -566,7 +557,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -578,21 +568,21 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a date field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, DateQltyTest."Test Value Type"::"Value Type Date", DateQltyTest, QltyInspectionTemplateLine);
// [GIVEN] Field-level result condition is set to '2001-02-03' for PASS result
- DateQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '2001-02-03', true);
+ DateQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '2001-02-03', true);
// [GIVEN] Template-level result condition is modified to '2004-05-06' for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Condition Type", ToLoadToLoadToUseAsATemplateQltyIResultConditConf."Condition Type"::Template);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '2004-05-06');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -601,10 +591,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -657,7 +644,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -669,7 +655,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a boolean field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
@@ -680,7 +666,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, 'Yes');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -688,10 +674,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -747,7 +730,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -759,7 +741,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a label field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
@@ -770,10 +752,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -822,7 +801,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -834,14 +812,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with an integer field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, NumericalMeasureQltyTest."Test Value Type"::"Value Type Integer", NumericalMeasureQltyTest, QltyInspectionTemplateLine);
// [GIVEN] Field-level result condition is set to 4..5 for PASS result
- NumericalMeasureQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '4..5', true);
+ NumericalMeasureQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '4..5', true);
// [GIVEN] Template-level result condition is modified to 6..7 for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
@@ -849,7 +827,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -864,10 +842,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -933,7 +908,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -951,14 +925,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured and no blank results created
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
LibraryAssert.AreEqual(0, SanityCheckQltyInspectionResult.Count(), 'should be no blank results - b');
// [GIVEN] An inspection template with a text field is created and no blank results created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, TextQltyTest."Test Value Type"::"Value Type Text", TextQltyTest, QltyInspectionTemplateLine);
LibraryAssert.AreEqual(0, SanityCheckQltyInspectionResult.Count(), 'should be no blank results - c');
// [GIVEN] Field-level result condition is set to 'A|B|C' for PASS result
- TextQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), 'A|B|C', true);
+ TextQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), 'A|B|C', true);
// [GIVEN] Template-level result condition is modified to 'D|E' for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
@@ -966,7 +940,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, 'D|E');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -975,10 +949,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
LibraryAssert.AreEqual(0, SanityCheckQltyInspectionResult.Count(), 'should be no blank results - d');
// [GIVEN] A production order is generated
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -1013,7 +984,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [THEN] Value 'D' (in template condition) evaluates to PASS
LibraryAssert.AreEqual('PASS', QltyResultEvaluation.EvaluateResult(QltyInspectionHeader, QltyInspectionLine, QltyIResultConditConf, TextQltyTest."Test Value Type", 'D', TextQltyTest."Case Sensitive"), 'first text-method1');
// [THEN] Value 'D' evaluates to PASS using alternative evaluation method (no line parameter)
- LibraryAssert.AreEqual('PASS', QltyResultEvaluation.EvaluateResult(QltyInspectionHeader, QltyIResultConditConf, TextQltyTest."Test Value Type", 'D', TextQltyTest."Case Sensitive"), 'first text method2 test with no line.');
+ LibraryAssert.AreEqual('PASS', QltyInspectionUtility.EvaluateResult(QltyInspectionHeader, QltyIResultConditConf, TextQltyTest."Test Value Type", 'D', TextQltyTest."Case Sensitive"), 'first text method2 test with no line.');
// [THEN] Value 'e' (lowercase) with insensitive comparison evaluates to PASS
LibraryAssert.AreEqual('PASS', QltyResultEvaluation.EvaluateResult(QltyInspectionHeader, QltyInspectionLine, QltyIResultConditConf, TextQltyTest."Test Value Type", 'e', TextQltyTest."Case Sensitive"::Insensitive), 'second text lowercase insensitive ');
if DatabaseIsCaseSensitive then
@@ -1052,7 +1023,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -1064,7 +1034,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with two decimal fields is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1078,7 +1048,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", OriginalQltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", OriginalQltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", OriginalQltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1090,7 +1060,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", UsesReferenceQltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", UsesReferenceQltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", UsesReferenceQltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, StrSubstno('1..[%1]', NumericalMeasureReferenceQltyTest.Code));
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1098,10 +1068,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -1200,7 +1167,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -1212,7 +1178,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, NumericalMeasureReferenceQltyTest."Test Value Type"::"Value Type Decimal", NumericalMeasureReferenceQltyTest, OriginalQltyInspectionTemplateLine);
@@ -1223,7 +1189,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", OriginalQltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", OriginalQltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", OriginalQltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1234,16 +1200,13 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", UsesReferenceQltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", UsesReferenceQltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", UsesReferenceQltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, StrSubstno('1..{2+[%1]}', NumericalMeasureReferenceQltyTest.Code));
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -1286,7 +1249,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ExpectedQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
ActualQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Verify GetTemplateLineConfigFilters returns correct filters for template line-specific result conditions
@@ -1295,7 +1257,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a decimal field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1306,7 +1268,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", OriginalQltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", OriginalQltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", OriginalQltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1334,7 +1296,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ExpectedQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
ActualQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Verify GetFieldConfigFilters returns correct filters for field-specific result conditions
@@ -1343,7 +1304,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a decimal field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1370,7 +1331,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
DecimalQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that decimal field default values must fall within allowable values range (1..3)
@@ -1379,7 +1339,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a decimal field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1421,7 +1381,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
OptionListQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that option field default values must be one of the allowable comma-delimited options (A,B,C,D)
@@ -1430,7 +1389,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with an option field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1476,7 +1435,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
IntegerQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that integer field default values must fall within allowable values range (1..3)
@@ -1485,7 +1443,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with an integer field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1526,7 +1484,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
TextQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that text field default values must be one of the allowable pipe-delimited options (A|B|C)
@@ -1535,7 +1492,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a text field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1572,7 +1529,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
DateQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that date field default values must match the exact allowable date value
@@ -1581,7 +1537,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a date field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1618,7 +1574,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
DateTimeQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that datetime field default values must match the exact allowable datetime value
@@ -1627,7 +1582,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a datetime field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1664,7 +1619,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
BooleanQltyTest: Record "Qlty. Test";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
begin
// [SCENARIO] Validate that boolean field default values must match the allowable boolean value and accept equivalent representations
@@ -1673,7 +1627,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a boolean field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1762,7 +1716,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionLine: Record "Qlty. Inspection Line";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
@@ -1775,7 +1728,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a text field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 1);
@@ -1789,10 +1742,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -1813,14 +1763,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [WHEN] Default value is set to 'A' (in allowable values)
TextQltyTest."Default Value" := 'A';
// [THEN] Validation passes with inspection header context
- QltyResultEvaluation.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader);
+ QltyInspectionUtility.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader);
// [THEN] Validation passes with inspection header and inspection line context
QltyResultEvaluation.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader, QltyInspectionLine);
// [THEN] Default value 'D' (not in allowable values) causes error with inspection header context
ClearLastError();
TextQltyTest."Default Value" := 'D';
- asserterror QltyResultEvaluation.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader);
+ asserterror QltyInspectionUtility.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader);
// [THEN] Default value 'D' causes error with inspection header and inspection line context
asserterror QltyResultEvaluation.ValidateAllowableValuesOnTest(TextQltyTest, QltyInspectionHeader, QltyInspectionLine);
ClearLastError();
@@ -1842,7 +1792,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -1854,14 +1803,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with an integer field is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
QltyInspectionUtility.CreateTestAndAddToTemplate(QltyInspectionTemplateHdr, NumericalMeasureQltyTest."Test Value Type"::"Value Type Integer", NumericalMeasureQltyTest, QltyInspectionTemplateLine);
// [GIVEN] Field-level result condition is set to 4..5 for PASS result
- NumericalMeasureQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '4..5', true);
+ NumericalMeasureQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '4..5', true);
// [GIVEN] Template-level result condition is modified to 6..7 for PASS result
QltyInspectionTemplateLine.EnsureResultsExist(false);
@@ -1869,7 +1818,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1884,10 +1833,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -1956,7 +1902,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -1968,7 +1913,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with a decimal field and allowable values range 0..12345 is created
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
@@ -1977,14 +1922,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
NumericalMeasureQltyTest.Modify(false);
// [GIVEN] Field-level result condition is set to 4..5 for PASS result
- NumericalMeasureQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), '4..5', true);
+ NumericalMeasureQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), '4..5', true);
// [GIVEN] Template-level result condition is modified to 6..7 for PASS result
QltyInspectionTemplateLine.EnsureResultsExist(false);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Condition Type", ToLoadToLoadToUseAsATemplateQltyIResultConditConf."Condition Type"::Template);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, '6..7');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -1992,10 +1937,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -2016,7 +1958,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [WHEN] ValidateQltyInspectionLine is called with blank value
NumericMeasureQltyInspectionLine."Test Value" := '';
NumericMeasureQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
// [THEN] Result is INPROGRESS for blank value
LibraryAssert.AreEqual('INPROGRESS', NumericMeasureQltyInspectionLine."Result Code", 'blank value');
@@ -2029,14 +1971,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [THEN] Value 6 (minimum of result range) evaluates to PASS
NumericMeasureQltyInspectionLine."Test Value" := '6';
NumericMeasureQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
LibraryAssert.AreEqual('PASS', NumericMeasureQltyInspectionLine."Result Code", 'min value inspection line result');
// [THEN] Value 7.0001 (exceeding maximum) evaluates to FAIL
NumericMeasureQltyInspectionLine."Test Value" := '7.0001';
NumericMeasureQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
LibraryAssert.AreEqual('FAIL', NumericMeasureQltyInspectionLine."Result Code", 'slightly exceeding max inspection line result');
QltyResultEvaluation.ValidateInspectionLineWithAllowableValues(NumericMeasureQltyInspectionLine, QltyInspectionHeader, true, true);
LibraryAssert.AreEqual('FAIL', NumericMeasureQltyInspectionLine."Result Code", 'slightly exceeding max inspection line result');
@@ -2044,12 +1986,12 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [THEN] Value 5.999999 (below minimum) evaluates to FAIL
NumericMeasureQltyInspectionLine."Test Value" := '5.999999';
NumericMeasureQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
LibraryAssert.AreEqual('FAIL', NumericMeasureQltyInspectionLine."Result Code", 'slightly before min inspection line result');
// [THEN] Value 6.999999 (near maximum) evaluates to PASS
NumericMeasureQltyInspectionLine."Test Value" := '6.999999';
NumericMeasureQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
LibraryAssert.AreEqual('PASS', NumericMeasureQltyInspectionLine."Result Code", 'slightly before min inspection line result');
@@ -2058,7 +2000,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
NumericMeasureQltyInspectionLine.Modify(false);
ClearLastError();
- asserterror QltyResultEvaluation.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
+ asserterror QltyInspectionUtility.ValidateQltyInspectionLine(NumericMeasureQltyInspectionLine);
LibraryAssert.ExpectedError(StrSubstNo(Expected3Err, NumericMeasureQltyInspectionLine."Description"));
end;
@@ -2079,7 +2021,6 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
QltyResultEvaluation: Codeunit "Qlty. Result Evaluation";
QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
OrdersList: List of [Code[20]];
ProductionOrder: Code[20];
@@ -2091,7 +2032,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyManagementSetup.Get();
// [GIVEN] Basic quality setup is ensured
- QltyAutoConfigure.EnsureBasicSetupExists(false);
+ QltyInspectionUtility.EnsureBasicSetupExists(false);
// [GIVEN] An inspection template with an option field is created with allowable values 'A,B,C,D,E'
QltyInspectionUtility.CreateTemplate(QltyInspectionTemplateHdr, 2);
@@ -2103,14 +2044,14 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionTemplateLine.Modify(false);
// [GIVEN] Field-level result condition is set to 'A|B' for PASS result
- OptionListMeasureQltyTest.SetResultCondition(QltyAutoConfigure.GetDefaultPassResult(), 'A|B', true);
+ OptionListMeasureQltyTest.SetResultCondition(QltyInspectionUtility.GetDefaultPassResult(), 'A|B', true);
// [GIVEN] Template-level result condition is modified to 'C|D' for PASS result (overrides field-level)
QltyInspectionTemplateLine.EnsureResultsExist(false);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Condition Type", ToLoadToLoadToUseAsATemplateQltyIResultConditConf."Condition Type"::Template);
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Code", QltyInspectionTemplateLine."Template Code");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Target Line No.", QltyInspectionTemplateLine."Line No.");
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Test Code", QltyInspectionTemplateLine."Test Code");
- ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadToLoadToUseAsATemplateQltyIResultConditConf.SetRange("Result Code", QltyInspectionUtility.GetDefaultPassResult());
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.FindFirst();
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Validate(Condition, 'C|D');
ToLoadToLoadToUseAsATemplateQltyIResultConditConf.Modify();
@@ -2119,10 +2060,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
QltyInspectionUtility.CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
// [GIVEN] A production order is generated and Inspection is created with specific template
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(1, OrdersList);
+ QltyProdOrderGenerator.GenerateItemSourceProdOrders(1, OrdersList);
OrdersList.Get(1, ProductionOrder);
ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
ProdOrderRoutingLine.FindLast();
@@ -2143,7 +2081,7 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [WHEN] ValidateQltyInspectionLine is called with blank value
OptionListQltyInspectionLine."Test Value" := '';
OptionListQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
// [THEN] Result is INPROGRESS for blank value
LibraryAssert.AreEqual('INPROGRESS', OptionListQltyInspectionLine."Result Code", 'blank value');
@@ -2156,20 +2094,20 @@ codeunit 139963 "Qlty. Tests - Result Eval."
// [THEN] Value 'C' (first PASS option in template condition) evaluates to PASS
OptionListQltyInspectionLine."Test Value" := 'C';
OptionListQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
LibraryAssert.AreEqual('PASS', OptionListQltyInspectionLine."Result Code", 'one of 2 options');
// [THEN] Value 'D' (second PASS option in template condition) evaluates to PASS
OptionListQltyInspectionLine."Test Value" := 'D';
OptionListQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
LibraryAssert.AreEqual('PASS', OptionListQltyInspectionLine."Result Code", 'two of two options.');
// [THEN] Value 'A' (in allowable values but not in template PASS condition) evaluates to FAIL
OptionListQltyInspectionLine."Test Value" := 'A';
OptionListQltyInspectionLine.Modify();
- QltyResultEvaluation.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
+ QltyInspectionUtility.ValidateQltyInspectionLine(OptionListQltyInspectionLine);
LibraryAssert.AreEqual('FAIL', OptionListQltyInspectionLine."Result Code", 'allowed but failing.');
// [THEN] Value 'F' (not in allowable values) causes an error
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsTestTable.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsTestTable.Codeunit.al
index 3bddd8288f..6b3b598290 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsTestTable.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsTestTable.Codeunit.al
@@ -17,7 +17,6 @@ using Microsoft.Inventory.Transfer;
using Microsoft.Manufacturing.Document;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.Vendor;
-using Microsoft.QualityManagement.Configuration;
using Microsoft.QualityManagement.Configuration.GenerationRule;
using Microsoft.QualityManagement.Configuration.Result;
using Microsoft.QualityManagement.Configuration.SourceConfiguration;
@@ -110,11 +109,11 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyInspectionUtility.CreateABasicTemplateAndInstanceOfAInspection(QltyInspectionHeader, ConfigurationToLoadQltyInspectionTemplateHdr);
// [GIVEN] Control information is determined for Source Custom field
- QltyInspectionHeader.DetermineControlInformation(SourceCustomTok);
+ QltyInspectionUtility.DetermineControlInformation(QltyInspectionHeader, SourceCustomTok);
// [WHEN] GetControlCaptionClass is called for Source Custom field
// [THEN] The method returns "Status" as the caption
- LibraryAssert.AreEqual(StatusTok, QltyInspectionHeader.GetControlCaptionClass(SourceCustomTok), 'Should have returned "Status".');
+ LibraryAssert.AreEqual(StatusTok, QltyInspectionUtility.GetControlCaptionClass(QltyInspectionHeader, SourceCustomTok), 'Should have returned "Status".');
QltyInspectionGenRule.DeleteAll();
end;
@@ -134,11 +133,11 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyInspectionUtility.CreateABasicTemplateAndInstanceOfAInspection(QltyInspectionHeader, ConfigurationToLoadQltyInspectionTemplateHdr);
// [GIVEN] Control information is determined for Source Custom field
- QltyInspectionHeader.DetermineControlInformation(SourceCustomTok);
+ QltyInspectionUtility.DetermineControlInformation(QltyInspectionHeader, SourceCustomTok);
// [WHEN] GetControlVisibleState is called for Source Custom field
// [THEN] The method returns true indicating the control should be visible
- LibraryAssert.IsTrue(QltyInspectionHeader.GetControlVisibleState(SourceCustomTok), 'Should show Custom 1 (Status).');
+ LibraryAssert.IsTrue(QltyInspectionUtility.GetControlVisibleState(QltyInspectionHeader, SourceCustomTok), 'Should show Custom 1 (Status).');
QltyInspectionGenRule.DeleteAll();
end;
@@ -1296,7 +1295,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] VerifyTrackingBeforeFinish is called
// [THEN] Error is thrown indicating lot number is required
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
LibraryAssert.ExpectedError(StrSubstNo(ItemIsTrackingErr, QltyInspectionHeader."Source Item No.", LotTok));
end;
@@ -1328,7 +1327,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Modify();
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating missing serial number
LibraryAssert.ExpectedError(StrSubstNo(ItemIsTrackingErr, QltyInspectionHeader."Source Item No.", SerialTok));
@@ -1362,7 +1361,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Modify();
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating missing package number
LibraryAssert.ExpectedError(StrSubstNo(ItemIsTrackingErr, QltyInspectionHeader."Source Item No.", PackageTok));
@@ -1426,7 +1425,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Modify();
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient posted lot quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedErr, QltyInspectionHeader."Source Item No.", LotTok, ReservationEntry."Lot No.", 0));
@@ -1490,7 +1489,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Modify();
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient posted serial quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedErr, QltyInspectionHeader."Source Item No.", SerialTok, ReservationEntry."Serial No.", 0));
@@ -1554,7 +1553,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Modify();
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient posted package quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedErr, QltyInspectionHeader."Source Item No.", PackageTok, ReservationEntry."Package No.", 0));
@@ -1588,7 +1587,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyInspectionHeader."Source Lot No." := LotTok;
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient reserved or posted lot quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedOrUnpostedErr, QltyInspectionHeader."Source Item No.", LotTok, QltyInspectionHeader."Source Lot No.", 0));
@@ -1622,7 +1621,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyInspectionHeader."Source Serial No." := SerialTok;
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient reserved or posted serial quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedOrUnpostedErr, QltyInspectionHeader."Source Item No.", SerialTok, QltyInspectionHeader."Source Serial No.", 0));
@@ -1656,7 +1655,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyInspectionHeader."Source Package No." := PackageTok;
// [WHEN] VerifyTrackingBeforeFinish is called
- asserterror QltyInspectionHeader.VerifyTrackingBeforeFinish();
+ asserterror QltyInspectionUtility.VerifyTrackingBeforeFinish(QltyInspectionHeader);
// [THEN] Error is thrown indicating insufficient reserved or posted package quantity
LibraryAssert.ExpectedError(StrSubstNo(ItemInsufficientPostedOrUnpostedErr, QltyInspectionHeader."Source Item No.", PackageTok, QltyInspectionHeader."Source Package No.", 0));
@@ -1732,7 +1731,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] GetReferenceRecordId is called
// [THEN] The purchase line's SystemId is returned
- LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionHeader.GetReferenceRecordId(), 'Should be the same record id.');
+ LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionUtility.GetReferenceRecordId(QltyInspectionHeader), 'Should be the same record id.');
end;
[Test]
@@ -1772,7 +1771,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] GetReferenceRecordId is called
// [THEN] The purchase line's SystemId is returned
- LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionHeader.GetReferenceRecordId(), 'Should be the same record id.');
+ LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionUtility.GetReferenceRecordId(QltyInspectionHeader), 'Should be the same record id.');
end;
[Test]
@@ -1812,7 +1811,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] GetReferenceRecordId is called
// [THEN] The purchase line's SystemId is returned
- LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionHeader.GetReferenceRecordId(), 'Should be the same record id.');
+ LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionUtility.GetReferenceRecordId(QltyInspectionHeader), 'Should be the same record id.');
end;
[Test]
@@ -1852,7 +1851,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] GetReferenceRecordId is called
// [THEN] The purchase line's SystemId is returned
- LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionHeader.GetReferenceRecordId(), 'Should be the same record id.');
+ LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionUtility.GetReferenceRecordId(QltyInspectionHeader), 'Should be the same record id.');
end;
[Test]
@@ -1892,7 +1891,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
// [WHEN] GetReferenceRecordId is called
// [THEN] The purchase line's SystemId is returned
- LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionHeader.GetReferenceRecordId(), 'Should be the same record id.');
+ LibraryAssert.AreEqual(PurchaseLine.SystemId, QltyInspectionUtility.GetReferenceRecordId(QltyInspectionHeader), 'Should be the same record id.');
end;
[Test]
@@ -2544,7 +2543,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
ToLoadQltyTest.DeleteAll();
// [WHEN] SuggestUnusedTestCodeFromDescription is called with description
- ToLoadQltyTest.SuggestUnusedTestCodeFromDescription(DescriptionTxt, TestCode);
+ QltyInspectionUtility.SuggestUnusedTestCodeFromDescription(ToLoadQltyTest, DescriptionTxt, TestCode);
// [THEN] Suggested code matches expected value
LibraryAssert.AreEqual(SuggestedCodeTxtTestValueTxt, TestCode, 'Suggested code should match');
@@ -2566,7 +2565,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
ToLoadQltyTest.DeleteAll();
// [WHEN] SuggestUnusedTestCodeFromDescription is called with description
- ToLoadQltyTest.SuggestUnusedTestCodeFromDescription(DescriptionTxt, TestCode);
+ QltyInspectionUtility.SuggestUnusedTestCodeFromDescription(ToLoadQltyTest, DescriptionTxt, TestCode);
// [THEN] Suggested code matches expected value
LibraryAssert.AreEqual(SuggestedCodeTxtTestValueTxt, TestCode, 'Suggested code should match');
@@ -2588,7 +2587,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
ToLoadQltyTest.DeleteAll();
// [WHEN] SuggestUnusedTestCodeFromDescription is called with long description with special characters
- ToLoadQltyTest.SuggestUnusedTestCodeFromDescription(Description2Txt, TestCode);
+ QltyInspectionUtility.SuggestUnusedTestCodeFromDescription(ToLoadQltyTest, Description2Txt, TestCode);
// [THEN] Suggested code matches expected value (truncated and sanitized)
LibraryAssert.AreEqual(SuggestedCodeTxtTestValue2Txt, TestCode, 'Suggested code should match');
@@ -2618,7 +2617,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
ToLoadQltyTest.Insert();
// [WHEN] SuggestUnusedTestCodeFromDescription is called
- ToLoadQltyTest.SuggestUnusedTestCodeFromDescription(DescriptionTxt, TestCode);
+ QltyInspectionUtility.SuggestUnusedTestCodeFromDescription(ToLoadQltyTest, DescriptionTxt, TestCode);
// [THEN] Suggested code is incremented with suffix
LibraryAssert.AreEqual(SuggestedCodeTxtTestValueTxt + '0002', TestCode, 'Suggested code should match');
@@ -2662,7 +2661,6 @@ codeunit 139967 "Qlty. Tests - Test Table"
ToLoadQltyTest: Record "Qlty. Test";
ToLoadQltyInspectionResult: Record "Qlty. Inspection Result";
ToLoadQltyIResultConditConf: Record "Qlty. I. Result Condit. Conf.";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
QltyTestCard: TestPage "Qlty. Test Card";
TestCodeTxt: Text;
begin
@@ -2703,7 +2701,7 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyTestCard.Field1_Desc.AssistEdit();
// [GIVEN] Default pass result is retrieved
- ToLoadQltyInspectionResult.Get(QltyAutoConfigure.GetDefaultPassResult());
+ ToLoadQltyInspectionResult.Get(QltyInspectionUtility.GetDefaultPassResult());
// [GIVEN] Result condition configuration for test is retrieved
ToLoadQltyIResultConditConf.SetRange("Test Code", ToLoadQltyTest.Code);
@@ -3571,8 +3569,8 @@ codeunit 139967 "Qlty. Tests - Test Table"
QltyManagementSetup.Get();
// [WHEN] GetVersion is called and installed app record exists
- if NAVAppInstalledApp.Get(QltyManagementSetup.GetAppGuid()) then begin
- ReturnedVersion := QltyManagementSetup.GetVersion();
+ if NAVAppInstalledApp.Get(QltyInspectionUtility.GetAppGuid(QltyManagementSetup)) then begin
+ ReturnedVersion := QltyInspectionUtility.GetVersion(QltyManagementSetup);
// [THEN] Returned version contains major version number
LibraryAssert.IsTrue(ReturnedVersion.Contains(Format(NAVAppInstalledApp."Version Major")), 'Returned version should have major version');
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsTraversal.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsTraversal.Codeunit.al
index d71ee0f7bd..e1e3abafbd 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsTraversal.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsTraversal.Codeunit.al
@@ -32,6 +32,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
var
QltyTraversal: Codeunit "Qlty. Traversal";
+ QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
LibraryAssert: Codeunit "Library Assert";
[Test]
@@ -54,7 +55,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
// [WHEN] Finding related item with item record in variant 2 position
// [THEN] The traversal function successfully finds the item and returns the matching item number
- LibraryAssert.IsTrue(QltyTraversal.FindRelatedItem(FoundItem, EmptyRecordRef, RecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4), 'Should find item.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.FindRelatedItem(FoundItem, EmptyRecordRef, RecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4), 'Should find item.');
LibraryAssert.AreEqual(Item."No.", FoundItem."No.", 'Should be same item.');
end;
@@ -78,7 +79,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
// [WHEN] Finding related item with item record in variant 3 position
// [THEN] The traversal function successfully finds the item and returns the matching item number
- LibraryAssert.IsTrue(QltyTraversal.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, RecordRef, EmptyVariant3, EmptyVariant4), 'Should find item.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, RecordRef, EmptyVariant3, EmptyVariant4), 'Should find item.');
LibraryAssert.AreEqual(Item."No.", FoundItem."No.", 'Should be same item.');
end;
@@ -102,7 +103,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
// [WHEN] Finding related item with item record in variant 4 position
// [THEN] The traversal function successfully finds the item and returns the matching item number
- LibraryAssert.IsTrue(QltyTraversal.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, EmptyVariant3, RecordRef, EmptyVariant4), 'Should find item.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, EmptyVariant3, RecordRef, EmptyVariant4), 'Should find item.');
LibraryAssert.AreEqual(Item."No.", FoundItem."No.", 'Should be same item.');
end;
@@ -126,7 +127,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
// [WHEN] Finding related item with item record in variant 5 position
// [THEN] The traversal function successfully finds the item and returns the matching item number
- LibraryAssert.IsTrue(QltyTraversal.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4, RecordRef), 'Should find item.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.FindRelatedItem(FoundItem, EmptyRecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4, RecordRef), 'Should find item.');
LibraryAssert.AreEqual(Item."No.", FoundItem."No.", 'Should be same item.');
end;
@@ -558,43 +559,35 @@ codeunit 139968 "Qlty. Tests - Traversal"
procedure FindRelatedBOM_OnSourceConfig()
var
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
ProductionBOMHeader: Record "Production BOM Header";
QltyInspectionHeader: Record "Qlty. Inspection Header";
Item: Record Item;
FundProductionBOMHeader: Record "Production BOM Header";
LibraryManufacturing: Codeunit "Library - Manufacturing";
LibraryInventory: Codeunit "Library - Inventory";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant1: Variant;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related BOM from an item using source configuration mapping
// [GIVEN] A source configuration mapping from Item to Inspection with BOM field mapping
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::Item);
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::Item,
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
// [GIVEN] A field configuration mapping from Item's Production BOM No. to inspection header
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := Item.FieldNo("Production BOM No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Custom 1");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ Item.FieldNo("Production BOM No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Custom 1"));
// [WHEN] An item with a production BOM assigned
LibraryInventory.CreateItem(Item);
@@ -734,7 +727,6 @@ codeunit 139968 "Qlty. Tests - Traversal"
Location: Record Location;
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
AssemblyLine: Record "Assembly Line";
AssemblyHeader: Record "Assembly Header";
FoundItem: Record Item;
@@ -746,7 +738,6 @@ codeunit 139968 "Qlty. Tests - Traversal"
LibraryERM: Codeunit "Library - ERM";
LibraryInventory: Codeunit "Library - Inventory";
LibraryWarehouse: Codeunit "Library - Warehouse";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
@@ -754,77 +745,59 @@ codeunit 139968 "Qlty. Tests - Traversal"
EmptyVariant5: Variant;
DueDate: Date;
GenProdPostingGroup: Code[20];
- ConfigCode: Text;
begin
// [SCENARIO] Find a related item from assembly line by traversing to parent assembly header
// [GIVEN] A source configuration for chained table mapping from Assembly Header to Assembly Line
if not SpecificQltyInspectSourceConfig.IsEmpty() then
SpecificQltyInspectSourceConfig.DeleteAll();
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Assembly Header");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Assembly Line");
- SpecificQltyInspectSourceConfig.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Assembly Header",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Assembly Line");
// [GIVEN] Field configuration mapping assembly document number between header and line
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Assembly Line";
- SpecificQltyInspectSrcFldConf."To Field No." := AssemblyLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Assembly Line",
+ AssemblyLine.FieldNo("Document No."));
// [GIVEN] Field configuration mapping assembly header item number to inspection header
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyHeader.FieldNo("Item No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Item No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyHeader.FieldNo("Item No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Item No."));
// [GIVEN] A second source configuration from Assembly Line to Inspection
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Assembly Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Assembly Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
// [GIVEN] Field configurations for assembly line to inspection header fields
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := AssemblyLine.FieldNo("Line No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document Line No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyLine.FieldNo("Document No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ AssemblyLine.FieldNo("Line No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document Line No."));
// [GIVEN] An assembly order with component line is created
LibraryWarehouse.CreateLocation(Location);
@@ -840,7 +813,7 @@ codeunit 139968 "Qlty. Tests - Traversal"
// [WHEN] Finding related item from assembly line by traversing to parent header
// [THEN] The traversal function finds the item from the assembly header
- LibraryAssert.IsTrue(QltyTraversal.FindRelatedItem(FoundItem, RecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4, EmptyVariant5), 'Should find item.');
+ LibraryAssert.IsTrue(QltyInspectionUtility.FindRelatedItem(FoundItem, RecordRef, EmptyVariant2, EmptyVariant3, EmptyVariant4, EmptyVariant5), 'Should find item.');
LibraryAssert.AreEqual(AssemblyHeader."Item No.", FoundItem."No.", 'Should be same item.');
end;
@@ -850,7 +823,6 @@ codeunit 139968 "Qlty. Tests - Traversal"
Location: Record Location;
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
DummyReservationEntry: Record "Reservation Entry";
@@ -861,13 +833,11 @@ codeunit 139968 "Qlty. Tests - Traversal"
LibraryPurchase: Codeunit "Library - Purchase";
LibraryWarehouse: Codeunit "Library - Warehouse";
QltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
EmptyVariant5: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related vendor from purchase line by traversing to parent purchase header
@@ -876,76 +846,57 @@ codeunit 139968 "Qlty. Tests - Traversal"
SpecificQltyInspectSourceConfig.DeleteAll();
// [GIVEN] A source configuration for chained table mapping from Purchase Header to Purchase Line
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Purchase Header");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Purchase Line");
- SpecificQltyInspectSourceConfig.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Purchase Header",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Purchase Line");
// [GIVEN] Field configurations mapping purchase document fields between header and line
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseHeader.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Purchase Line";
- SpecificQltyInspectSrcFldConf."To Field No." := PurchaseLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseHeader.FieldNo("Document Type");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Purchase Line";
- SpecificQltyInspectSrcFldConf."To Field No." := PurchaseLine.FieldNo("Document Type");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseHeader.FieldNo("Buy-from Vendor No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Custom 1");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ PurchaseHeader.FieldNo("No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Purchase Line",
+ PurchaseLine.FieldNo("Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ PurchaseHeader.FieldNo("Document Type"),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Purchase Line",
+ PurchaseLine.FieldNo("Document Type"));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ PurchaseHeader.FieldNo("Buy-from Vendor No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Custom 1"));
// [GIVEN] A second source configuration from Purchase Line to Inspection with field mappings
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Purchase Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseLine.FieldNo("Line No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document Line No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Purchase Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ PurchaseLine.FieldNo("Document No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ PurchaseLine.FieldNo("Line No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document Line No."));
// [GIVEN] A purchase order with vendor, item, and location is created
LibraryWarehouse.CreateLocation(Location);
@@ -966,7 +917,6 @@ codeunit 139968 "Qlty. Tests - Traversal"
Location: Record Location;
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
SalesHeader: Record "Sales Header";
SalesLine: Record "Sales Line";
Item: Record Item;
@@ -975,87 +925,66 @@ codeunit 139968 "Qlty. Tests - Traversal"
LibraryInventory: Codeunit "Library - Inventory";
LibrarySales: Codeunit "Library - Sales";
LibraryWarehouse: Codeunit "Library - Warehouse";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
EmptyVariant5: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related customer from sales line by traversing to parent sales header
// [GIVEN] Source configuration for chained table mapping from Sales Header to Sales Line with field configurations
if not SpecificQltyInspectSourceConfig.IsEmpty() then
SpecificQltyInspectSourceConfig.DeleteAll();
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Sales Header");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Sales Line");
- SpecificQltyInspectSourceConfig.Insert();
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := SalesHeader.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Sales Line";
- SpecificQltyInspectSrcFldConf."To Field No." := SalesLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := SalesHeader.FieldNo("Document Type");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Sales Line";
- SpecificQltyInspectSrcFldConf."To Field No." := SalesLine.FieldNo("Document Type");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := SalesHeader.FieldNo("Sell-to Customer No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Custom 1");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Sales Header",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Sales Line");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ SalesHeader.FieldNo("No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Sales Line",
+ SalesLine.FieldNo("Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ SalesHeader.FieldNo("Document Type"),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Sales Line",
+ SalesLine.FieldNo("Document Type"));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ SalesHeader.FieldNo("Sell-to Customer No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Custom 1"));
// [GIVEN] Source configuration from Sales Line to Inspection with field mappings
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Sales Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := SalesLine.FieldNo("Document No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := SalesLine.FieldNo("Line No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document Line No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Sales Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ SalesLine.FieldNo("Document No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ SalesLine.FieldNo("Line No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document Line No."));
// [GIVEN] A sales order with customer, item, and location is created
LibraryWarehouse.CreateLocation(Location);
@@ -1076,19 +1005,16 @@ codeunit 139968 "Qlty. Tests - Traversal"
var
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
Item: Record Item;
FoundRoutingHeader: Record "Routing Header";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
EmptyVariant5: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related routing from production order routing line by traversing to parent production order
@@ -1096,79 +1022,55 @@ codeunit 139968 "Qlty. Tests - Traversal"
if not SpecificQltyInspectSourceConfig.IsEmpty() then
SpecificQltyInspectSourceConfig.DeleteAll();
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Production Order");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig.Insert();
-
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdProductionOrder.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdProductionOrder.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdProductionOrder.FieldNo("Routing No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Custom 1");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Production Order",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdProductionOrder.FieldNo("No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo("Prod. Order No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdProductionOrder.FieldNo(Status),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo(Status));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdProductionOrder.FieldNo("Routing No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Custom 1"));
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
-
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Sub Type");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Prod. Order Routing Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo("Prod. Order No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo(Status),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Sub Type"));
// [GIVEN] An item and production order with routing line are created
QltyProdOrderGenerator.CreateItemAndProductionOrder(Item, ProdProductionOrder, ProdOrderRoutingLine);
@@ -1185,20 +1087,17 @@ codeunit 139968 "Qlty. Tests - Traversal"
var
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
ProdOrderLine: Record "Prod. Order Line";
Item: Record Item;
FoundProdOrderRoutingLine: Record "Prod. Order Routing Line";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
EmptyVariant5: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related production order routing line from production order line by chained traversal
@@ -1206,67 +1105,46 @@ codeunit 139968 "Qlty. Tests - Traversal"
if not SpecificQltyInspectSourceConfig.IsEmpty() then
SpecificQltyInspectSourceConfig.DeleteAll();
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Prod. Order Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig.Insert();
-
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Prod. Order Line",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line");
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderLine.FieldNo("Prod. Order No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo("Prod. Order No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderLine.FieldNo(Status),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo(Status));
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Sub Type");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Prod. Order Routing Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo("No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo(Status),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Sub Type"));
// [GIVEN] An item and production order with routing line are created
QltyProdOrderGenerator.CreateItemAndProductionOrder(Item, ProdProductionOrder, ProdOrderRoutingLine);
@@ -1292,20 +1170,17 @@ codeunit 139968 "Qlty. Tests - Traversal"
var
QltyInspectionHeader: Record "Qlty. Inspection Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
ProdProductionOrder: Record "Production Order";
ProdOrderRoutingLine: Record "Prod. Order Routing Line";
ProdOrderLine: Record "Prod. Order Line";
Item: Record Item;
FundProductionBOMHeader: Record "Production BOM Header";
QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
RecordRef: RecordRef;
EmptyVariant2: Variant;
EmptyVariant3: Variant;
EmptyVariant4: Variant;
EmptyVariant5: Variant;
- ConfigCode: Text;
begin
// [SCENARIO] Find a related production BOM from production order routing line by chained traversal
@@ -1313,77 +1188,53 @@ codeunit 139968 "Qlty. Tests - Traversal"
if not SpecificQltyInspectSourceConfig.IsEmpty() then
SpecificQltyInspectSourceConfig.DeleteAll();
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Prod. Order Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::"Chained table";
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig.Insert();
-
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::"Chained table";
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Prod. Order Routing Line";
- SpecificQltyInspectSrcFldConf."To Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := Item.FieldNo("Production BOM No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Custom 1");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Prod. Order Line",
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line");
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderLine.FieldNo("Prod. Order No."),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo("Prod. Order No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderLine.FieldNo(Status),
+ Enum::"Qlty. Target Type"::"Chained table",
+ Database::"Prod. Order Routing Line",
+ ProdOrderRoutingLine.FieldNo(Status));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ Item.FieldNo("Production BOM No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Custom 1"));
Clear(SpecificQltyInspectSourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Prod. Order Routing Line");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo("Prod. Order No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := ProdOrderRoutingLine.FieldNo(Status);
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Sub Type");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Prod. Order Routing Line",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo("Prod. Order No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ SpecificQltyInspectSourceConfig."From Table No.",
+ ProdOrderRoutingLine.FieldNo(Status),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Sub Type"));
// [GIVEN] An item and production order with routing line and production BOM are created
QltyProdOrderGenerator.CreateItemAndProductionOrder(Item, ProdProductionOrder, ProdOrderRoutingLine);
diff --git a/src/Apps/W1/Quality Management/test/src/QltyTestsWorkflows.Codeunit.al b/src/Apps/W1/Quality Management/test/src/QltyTestsWorkflows.Codeunit.al
index da95f3b563..81a3915bfe 100644
--- a/src/Apps/W1/Quality Management/test/src/QltyTestsWorkflows.Codeunit.al
+++ b/src/Apps/W1/Quality Management/test/src/QltyTestsWorkflows.Codeunit.al
@@ -32,7 +32,6 @@ using Microsoft.Warehouse.Structure;
using Microsoft.Warehouse.Tracking;
using Microsoft.Warehouse.Worksheet;
using System.Automation;
-using System.Reflection;
using System.Security.User;
using System.TestLibraries.Utilities;
@@ -146,13 +145,8 @@ codeunit 139969 "Qlty. Tests - Workflows"
PurchaseLine: Record "Purchase Line";
ReservationEntry: Record "Reservation Entry";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
- ToLoadField: Record Field;
Workflow: Record Workflow;
QltyWorkflowSetup: Codeunit "Qlty. Workflow Setup";
- TestSourceConfigLineFieldNames: List of [Text];
- FieldName: Text;
- SourceConfig: Text;
BeforeCount: Integer;
begin
// [SCENARIO] Test-to-test source configuration is applied from a create test workflow when source inspection was filtered by status
@@ -169,36 +163,17 @@ codeunit 139969 "Qlty. Tests - Workflows"
ReUsableQltyPurOrderGenerator.CreateInspectionFromPurchaseWithLotTrackedItem(Location, 100, PurchaseHeader, PurchaseLine, OriginalQltyInspectionHeader, ReservationEntry);
// [GIVEN] An inspection-to-inspection source configuration with field mappings
- QltyInspectionUtility.GenerateRandomCharacters(20, SourceConfig);
- SpecificQltyInspectSourceConfig.Init();
- SpecificQltyInspectSourceConfig.Code := CopyStr(SourceConfig, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(SourceConfig, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- TestSourceConfigLineFieldNames.Add('Source Document No.');
- TestSourceConfigLineFieldNames.Add('Source Document Line No.');
- TestSourceConfigLineFieldNames.Add('Source Item No.');
- TestSourceConfigLineFieldNames.Add('Source Quantity (Base)');
- TestSourceConfigLineFieldNames.Add('Source Lot No.');
-
- foreach FieldName in TestSourceConfigLineFieldNames do begin
- Clear(SpecificQltyInspectSrcFldConf);
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."To Table No." := SpecificQltyInspectSourceConfig."To Table No.";
- Clear(ToLoadField);
- ToLoadField.SetRange(TableNo, Database::"Qlty. Inspection Header");
- ToLoadField.SetRange(FieldName, FieldName);
- ToLoadField.FindFirst();
- SpecificQltyInspectSrcFldConf."From Field No." := ToLoadField."No.";
- SpecificQltyInspectSrcFldConf."To Field No." := ToLoadField."No.";
- SpecificQltyInspectSrcFldConf.Insert();
- end;
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Qlty. Inspection Header",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+
+ QltyInspectionUtility.CreateSourceFieldConfigByName(SpecificQltyInspectSourceConfig.Code, Database::"Qlty. Inspection Header", Enum::"Qlty. Target Type"::Inspection, 'Source Document No.');
+ QltyInspectionUtility.CreateSourceFieldConfigByName(SpecificQltyInspectSourceConfig.Code, Database::"Qlty. Inspection Header", Enum::"Qlty. Target Type"::Inspection, 'Source Document Line No.');
+ QltyInspectionUtility.CreateSourceFieldConfigByName(SpecificQltyInspectSourceConfig.Code, Database::"Qlty. Inspection Header", Enum::"Qlty. Target Type"::Inspection, 'Source Item No.');
+ QltyInspectionUtility.CreateSourceFieldConfigByName(SpecificQltyInspectSourceConfig.Code, Database::"Qlty. Inspection Header", Enum::"Qlty. Target Type"::Inspection, 'Source Quantity (Base)');
+ QltyInspectionUtility.CreateSourceFieldConfigByName(SpecificQltyInspectSourceConfig.Code, Database::"Qlty. Inspection Header", Enum::"Qlty. Target Type"::Inspection, 'Source Lot No.');
// [GIVEN] A workflow configured to create new inspection from existing inspection
QltyInspectionUtility.CreatePrioritizedRule(ConfigurationToLoadQltyInspectionTemplateHdr, Database::"Qlty. Inspection Header");
@@ -1870,27 +1845,20 @@ codeunit 139969 "Qlty. Tests - Workflows"
QltyInspectionHeader: Record "Qlty. Inspection Header";
PurchaseHeader: Record "Purchase Header";
SpecificQltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";
- SpecificQltyInspectSrcFldConf: Record "Qlty. Inspect. Src. Fld. Conf.";
- ConfigCode: Text;
begin
- SpecificQltyInspectSourceConfig.Init();
- QltyInspectionUtility.GenerateRandomCharacters(MaxStrLen(SpecificQltyInspectSourceConfig.Code), ConfigCode);
- SpecificQltyInspectSourceConfig.Code := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Code));
- SpecificQltyInspectSourceConfig.Description := CopyStr(ConfigCode, 1, MaxStrLen(SpecificQltyInspectSourceConfig.Description));
- SpecificQltyInspectSourceConfig.Validate("From Table No.", Database::"Purchase Header");
- SpecificQltyInspectSourceConfig."To Type" := SpecificQltyInspectSourceConfig."To Type"::Inspection;
- SpecificQltyInspectSourceConfig.Validate("To Table No.", Database::"Qlty. Inspection Header");
- SpecificQltyInspectSourceConfig.Insert();
-
- SpecificQltyInspectSrcFldConf.Init();
- SpecificQltyInspectSrcFldConf.Code := SpecificQltyInspectSourceConfig.Code;
- SpecificQltyInspectSrcFldConf.InitLineNoIfNeeded();
- SpecificQltyInspectSrcFldConf."From Table No." := SpecificQltyInspectSourceConfig."From Table No.";
- SpecificQltyInspectSrcFldConf."From Field No." := PurchaseHeader.FieldNo("No.");
- SpecificQltyInspectSrcFldConf."To Type" := SpecificQltyInspectSrcFldConf."To Type"::Inspection;
- SpecificQltyInspectSrcFldConf."To Table No." := Database::"Qlty. Inspection Header";
- SpecificQltyInspectSrcFldConf."To Field No." := QltyInspectionHeader.FieldNo("Source Document No.");
- SpecificQltyInspectSrcFldConf.Insert();
+ QltyInspectionUtility.CreateSourceConfig(
+ SpecificQltyInspectSourceConfig,
+ Database::"Purchase Header",
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header");
+
+ QltyInspectionUtility.CreateSourceFieldConfig(
+ SpecificQltyInspectSourceConfig.Code,
+ Database::"Purchase Header",
+ PurchaseHeader.FieldNo("No."),
+ Enum::"Qlty. Target Type"::Inspection,
+ Database::"Qlty. Inspection Header",
+ QltyInspectionHeader.FieldNo("Source Document No."));
end;
[ConfirmHandler]
diff --git a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyInspectionUtility.Codeunit.al b/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyInspectionUtility.Codeunit.al
deleted file mode 100644
index fe39ef51b1..0000000000
--- a/src/Apps/W1/Quality Management/test/src/TestLibraries/QltyInspectionUtility.Codeunit.al
+++ /dev/null
@@ -1,767 +0,0 @@
-// ------------------------------------------------------------------------------------------------
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-// ------------------------------------------------------------------------------------------------
-namespace Microsoft.Test.QualityManagement.TestLibraries;
-
-using Microsoft.Foundation.Company;
-using Microsoft.Foundation.NoSeries;
-using Microsoft.Inventory.Item;
-using Microsoft.Inventory.Journal;
-using Microsoft.Inventory.Location;
-using Microsoft.Inventory.Setup;
-using Microsoft.Inventory.Tracking;
-using Microsoft.Manufacturing.Document;
-using Microsoft.Purchases.Document;
-using Microsoft.QualityManagement.Configuration;
-using Microsoft.QualityManagement.Configuration.GenerationRule;
-using Microsoft.QualityManagement.Configuration.Result;
-using Microsoft.QualityManagement.Configuration.Template;
-using Microsoft.QualityManagement.Configuration.Template.Test;
-using Microsoft.QualityManagement.Document;
-using Microsoft.QualityManagement.Setup;
-using Microsoft.QualityManagement.Utilities;
-using Microsoft.Warehouse.Journal;
-using Microsoft.Warehouse.Ledger;
-using Microsoft.Warehouse.Setup;
-using System.Reflection;
-using System.TestLibraries.Security.AccessControl;
-using System.TestLibraries.Utilities;
-
-codeunit 139950 "Qlty. Inspection Utility"
-{
- var
- LibraryAssert: Codeunit "Library Assert";
- LibraryUtility: Codeunit "Library - Utility";
- NoSeriesCodeunit: Codeunit "No. Series";
- DefaultResult2PassCodeLbl: Label 'PASS', Locked = true;
-
- procedure EnsureSetupExists()
- var
- QltyManagementSetup: Record "Qlty. Management Setup";
- QltyAutoConfigure: Codeunit "Qlty. Auto Configure";
- UserPermissionsLibrary: Codeunit "User Permissions Library";
- begin
- QltyAutoConfigure.EnsureBasicSetupExists(false);
- QltyManagementSetup.Get();
- QltyManagementSetup."When to show inspections" := QltyManagementSetup."When to show inspections"::"Do not show created inspections";
- QltyManagementSetup.Modify();
-
- UserPermissionsLibrary.AssignPermissionSetToUser(UserSecurityId(), 'QltyGeneral');
- end;
-
- procedure CreateABasicTemplateAndInstanceOfAInspection(var OutCreatedQltyInspectionHeader: Record "Qlty. Inspection Header"; var OutQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.")
- var
- ProdOrderRoutingLine: Record "Prod. Order Routing Line";
- QltyInspectionUtility: Codeunit "Qlty. Inspection Utility";
- QltyProdOrderGenerator: Codeunit "Qlty. Prod. Order Generator";
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
- ProdOrderRoutingLineRecordRefRecordRef: RecordRef;
- OrdersList: List of [Code[20]];
- ProductionOrder: Code[20];
- ClaimedInspectionWasCreated: Boolean;
- BeforeCount: Integer;
- AfterCount: Integer;
- begin
- QltyInspectionUtility.EnsureSetupExists();
-
- QltyInspectionUtility.CreateTemplate(OutQltyInspectionTemplateHdr, 3);
-
- QltyInspectionUtility.CreatePrioritizedRule(OutQltyInspectionTemplateHdr, Database::"Prod. Order Routing Line");
-
- QltyProdOrderGenerator.Init(100);
- QltyProdOrderGenerator.ToggleAllSources(false);
- QltyProdOrderGenerator.ToggleSourceType("Prod. Order Source Type"::Item, true);
- QltyProdOrderGenerator.Generate(2, OrdersList);
- LibraryAssert.AreEqual(2, OrdersList.Count(), 'Common inspection generation. Inspection generator did not make the expected amount of production orders.');
- OrdersList.Get(1, ProductionOrder);
- ProdOrderRoutingLine.SetRange("Prod. Order No.", ProductionOrder);
- ProdOrderRoutingLine.FindLast();
-
- OutCreatedQltyInspectionHeader.Reset();
- BeforeCount := OutCreatedQltyInspectionHeader.Count();
-
- ProdOrderRoutingLineRecordRefRecordRef.GetTable(ProdOrderRoutingLine);
- ClaimedInspectionWasCreated := QltyInspectionCreate.CreateInspection(ProdOrderRoutingLineRecordRefRecordRef, true);
-
- OutCreatedQltyInspectionHeader.Reset();
- AfterCount := OutCreatedQltyInspectionHeader.Count();
-
- LibraryAssert.AreEqual((BeforeCount + 1), AfterCount, 'Expected overall inspections');
- OutCreatedQltyInspectionHeader.SetRange("Source Document No.", ProdOrderRoutingLine."Prod. Order No.");
- LibraryAssert.AreEqual((1), OutCreatedQltyInspectionHeader.Count(), 'There should be exactly one inspection for this operation.');
- LibraryAssert.IsTrue(ClaimedInspectionWasCreated, 'An inspection flag should have been created');
-
- QltyInspectionCreate.GetCreatedInspection(OutCreatedQltyInspectionHeader);
- end;
-
- procedure CreateTemplate(var OutQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; HowManyFields: Integer)
- var
- IgnoredQltyTest: Record "Qlty. Test";
- ToTemplateRecordRef: RecordRef;
- FieldNumberToCreate: Integer;
- begin
- Clear(OutQltyInspectionTemplateHdr);
- OutQltyInspectionTemplateHdr.Init();
- ToTemplateRecordRef.GetTable(OutQltyInspectionTemplateHdr);
- FillTextField(ToTemplateRecordRef, OutQltyInspectionTemplateHdr.FieldNo("Code"), true);
- FillTextField(ToTemplateRecordRef, OutQltyInspectionTemplateHdr.FieldNo(Description), true);
- ToTemplateRecordRef.SetTable(OutQltyInspectionTemplateHdr);
- OutQltyInspectionTemplateHdr.Insert(true);
- if HowManyFields > 0 then
- for FieldNumberToCreate := 1 to HowManyFields do
- CreateTestAndAddToTemplate(OutQltyInspectionTemplateHdr, IgnoredQltyTest, "Qlty. Test Value Type"::"Value Type Text")
- end;
-
- procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; QltyTestValueType: Enum "Qlty. Test Value Type")
- var
- IgnoredQltyTest: Record "Qlty. Test";
- QltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
- begin
- Clear(QltyInspectionTemplateLine);
- CreateTest(IgnoredQltyTest, QltyTestValueType);
- QltyInspectionTemplateLine.Init();
- QltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
- QltyInspectionTemplateLine.InitLineNoIfNeeded();
- QltyInspectionTemplateLine.Validate("Test Code", IgnoredQltyTest.Code);
- QltyInspectionTemplateLine.Insert(true);
- end;
-
- procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; var OutQltyTest: Record "Qlty. Test"; QltyTestValueType: Enum "Qlty. Test Value Type")
- var
- QltyInspectionTemplateLine: Record "Qlty. Inspection Template Line";
- begin
- Clear(QltyInspectionTemplateLine);
- CreateTest(OutQltyTest, QltyTestValueType);
- QltyInspectionTemplateLine.Init();
- QltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
- QltyInspectionTemplateLine.InitLineNoIfNeeded();
- QltyInspectionTemplateLine.Validate("Test Code", OutQltyTest.Code);
- QltyInspectionTemplateLine.Insert(true);
- end;
-
- procedure CreateTestAndAddToTemplate(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; QltyTestValueType: Enum "Qlty. Test Value Type"; var QltyTest: Record "Qlty. Test"; var OutQltyInspectionTemplateLine: Record "Qlty. Inspection Template Line")
- begin
- Clear(OutQltyInspectionTemplateLine);
- CreateTest(QltyTest, QltyTestValueType);
- OutQltyInspectionTemplateLine.Init();
- OutQltyInspectionTemplateLine."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
- OutQltyInspectionTemplateLine.InitLineNoIfNeeded();
- OutQltyInspectionTemplateLine.Validate("Test Code", QltyTest.Code);
- OutQltyInspectionTemplateLine.Insert(true);
- end;
-
- procedure CreateTest(var QltyTest: Record "Qlty. Test"; QltyTestValueType: Enum "Qlty. Test Value Type")
- var
- QltyInspectionResult: Record "Qlty. Inspection Result";
- ToFieldRecordRef: RecordRef;
- begin
- Clear(QltyTest);
- QltyTest.Init();
- QltyTest."Test Value Type" := QltyTestValueType;
- ToFieldRecordRef.GetTable(QltyTest);
- FillTextField(ToFieldRecordRef, QltyTest.FieldNo(Code), true);
- FillTextField(ToFieldRecordRef, QltyTest.FieldNo(Description), true);
- ToFieldRecordRef.SetTable(QltyTest);
- QltyTest.Insert();
-
- if QltyInspectionResult.Get(DefaultResult2PassCodeLbl) then
- case QltyTestValueType of
- QltyTestValueType::"Value Type Text", QltyTestValueType::"Value Type Text Expression":
- QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>HARDCODEDFAIL', true);
- QltyTestValueType::"Value Type Decimal", QltyTestValueType::"Value Type Integer":
- QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>-123', true);
- QltyTestValueType::"Value Type Boolean":
- QltyTest.SetResultCondition(DefaultResult2PassCodeLbl, '<>FALSE', true);
- end;
- end;
-
- procedure CreatePrioritizedRule(InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; SourceTableNo: Integer)
- var
- QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
- begin
- CreatePrioritizedRule(InExistingQltyInspectionTemplateHdr, SourceTableNo, QltyInspectionGenRule);
- end;
-
- procedure CreatePrioritizedRule(var InExistingQltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr."; SourceTableNo: Integer; var OutQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule")
- var
- FindLowestQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
- begin
- if InExistingQltyInspectionTemplateHdr.Code = '' then
- CreateTemplate(InExistingQltyInspectionTemplateHdr, 0);
-
- FindLowestQltyInspectionGenRule.ModifyAll("Activation Trigger", FindLowestQltyInspectionGenRule."Activation Trigger"::Disabled);
-
- FindLowestQltyInspectionGenRule.Reset();
- FindLowestQltyInspectionGenRule.SetCurrentKey("Sort Order");
-
- OutQltyInspectionGenRule.Init();
- if FindLowestQltyInspectionGenRule.FindFirst() then
- OutQltyInspectionGenRule."Sort Order" := FindLowestQltyInspectionGenRule."Sort Order" - 1;
-
- OutQltyInspectionGenRule."Template Code" := InExistingQltyInspectionTemplateHdr.Code;
- OutQltyInspectionGenRule."Source Table No." := SourceTableNo;
- OutQltyInspectionGenRule.Insert(true);
- end;
-
- procedure CreateItemJournalTemplateAndBatch(TemplateType: Enum "Item Journal Entry Type"; var OutItemJournalBatch: Record "Item Journal Batch")
- var
- ItemJournalTemplate: Record "Item Journal Template";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- LibraryInventory.CreateItemJournalTemplateByType(ItemJournalTemplate, TemplateType);
- LibraryInventory.CreateItemJournalBatch(OutItemJournalBatch, ItemJournalTemplate.Name);
- end;
-
- local procedure FillTextField(RecordVariant: Variant; FieldNo: Integer; Validate: Boolean)
- var
- DataTypeManagement: Codeunit "Data Type Management";
- RecordRef: RecordRef;
- FieldRef: FieldRef;
- Data: Text;
- begin
- DataTypeManagement.GetRecordRef(RecordVariant, RecordRef);
- FieldRef := RecordRef.Field(FieldNo);
- if not (FieldRef.Type in [FieldType::Code, FieldType::Text]) then
- Error('FillTextField should only be called on code or text fields. Table %1, field %2, type %3', RecordRef.Number(), FieldNo, FieldRef.Type);
- if FieldRef.Length < 10 then
- Error('Unexpected length of %4 for Table %1, field %2, type %3', RecordRef.Number(), FieldNo, FieldRef.Type, FieldRef.Length);
-
- FillText(FieldRef.Length, Data);
- if Validate then
- FieldRef.Validate(Data)
- else
- FieldRef.Value(Data);
- end;
-
- local procedure FillText(NumberOfCharacters: Integer; var Out: Text)
- var
- CompanyInformation: Record "Company Information";
- Now: DateTime;
- CompanyCreated: DateTime;
- igIntMilliseconds: BigInteger;
- CharactersToGenerate: Integer;
- RandomCharacters: Text;
- SequenceNumber: Integer;
- begin
- if NumberOfCharacters < 0 then
- Error('FillText is being called incorrectly, NumberOfCharacters must be > 0');
-
- if not NumberSequence.Exists('QualityManagementAutoTests') then
- NumberSequence.Insert('QualityManagementAutoTests');
- SequenceNumber := NumberSequence.Next('QualityManagementAutoTests', true);
-
- Clear(Out);
- Now := System.CurrentDateTime();
- CompanyInformation.Get();
- CompanyCreated := CompanyInformation.SystemCreatedAt;
- Out += format(SequenceNumber, 0, 9);
-
- igIntMilliseconds := (Now - CompanyCreated);
- Out += format(igIntMilliseconds, 0, 9);
-
- CharactersToGenerate := NumberOfCharacters - strlen(Out);
- if CharactersToGenerate > 0 then begin
- GenerateRandomCharacters(CharactersToGenerate, RandomCharacters);
- Out := Out + RandomCharacters;
- end;
-
- if (strlen(Out) > NumberOfCharacters) then begin
- Out := CopyStr(Out, strlen(Out), NumberOfCharacters);
- exit;
- end;
- end;
-
- ///
- /// Intentionally not using RandText() from Library - Random, because it's not random based on how it
- /// generates text with the guids, making collision counts very high.
- ///
- ///
- ///
- procedure GenerateRandomCharacters(NumberOfCharacters: Integer; var Out: Text)
- var
- LibraryRandom: Codeunit "Library - Random";
- CharSet: Text[36];
- Index: Integer;
- begin
- Clear(Out);
- CharSet := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
-
- LibraryRandom.Init();
-
- for Index := 1 to NumberOfCharacters do
- Out += CopyStr(CharSet, LibraryRandom.RandIntInRange(1, 36), 1);
- end;
-
- ///
- /// Creates a lot no. series and a lot-tracked item
- ///
- ///
- procedure CreateLotTrackedItem(var OutItem: Record Item)
- var
- NoSeries: Record "No. Series";
- begin
- CreateLotTrackedItem(OutItem, NoSeries);
- end;
-
- ///
- /// Creates a lot no. series and a lot-tracked item
- ///
- ///
- procedure CreateLotTrackedItem(var OutItem: Record Item; var OutLotNoSeries: Record "No. Series")
- var
- InventorySetup: Record "Inventory Setup";
- ItemNoSeries: Record "No. Series";
- ItemNoSeriesLine: Record "No. Series Line";
- LotNoSeriesLine: Record "No. Series Line";
- LotItemTrackingCode: Record "Item Tracking Code";
- LibraryItemTracking: Codeunit "Library - Item Tracking";
- LibraryUtility2: Codeunit "Library - Utility";
- LibraryInventory: Codeunit "Library - Inventory";
- StartingNo: Code[20];
- EndingNo: Code[20];
- begin
- LibraryUtility2.CreateNoSeries(ItemNoSeries, true, true, false);
- GetCode20NoSeries('IL', StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeriesLine(ItemNoSeriesLine, ItemNoSeries.Code, StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeries(OutLotNoSeries, true, true, false);
- GetCode20NoSeries('L', StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeriesLine(LotNoSeriesLine, OutLotNoSeries.Code, StartingNo, EndingNo);
-
- LibraryItemTracking.CreateItemTrackingCode(LotItemTrackingCode, false, true, false);
-
- InventorySetup.Get();
- InventorySetup.Validate("Item Nos.", ItemNoSeries.Code);
- InventorySetup.Modify(true);
-
- LibraryInventory.CreateTrackedItem(OutItem, OutLotNoSeries.Code, '', LotItemTrackingCode.Code);
- OutItem.Rename(NoSeriesCodeunit.PeekNextNo(ItemNoSeries.Code));
- OutItem.Modify();
-
- OutItem.Validate("Unit Cost", 1.234);
- OutItem.Validate("Unit Price", 2.2345);
- OutItem.Modify();
- end;
-
- ///
- /// Creates a serial no. series and a serial-tracked item
- ///
- ///
- procedure CreateSerialTrackedItem(var OutItem: Record Item)
- var
- NoSeries: Record "No. Series";
- begin
- CreateSerialTrackedItem(OutItem, NoSeries);
- end;
-
- ///
- /// Creates a serial no. series and a serial-tracked item
- ///
- ///
- procedure CreateSerialTrackedItem(var OutItem: Record Item; var OutSerialNoSeries: Record "No. Series")
- var
- InventorySetup: Record "Inventory Setup";
- ItemNoSeries: Record "No. Series";
- ItemNoSeriesLine: Record "No. Series Line";
- SerialNoSeriesLine: Record "No. Series Line";
- SerialItemTrackingCode: Record "Item Tracking Code";
- LibraryItemTracking: Codeunit "Library - Item Tracking";
- LibraryUtility2: Codeunit "Library - Utility";
- LibraryInventory: Codeunit "Library - Inventory";
- StartingNo: Code[20];
- EndingNo: Code[20];
- begin
- LibraryUtility2.CreateNoSeries(ItemNoSeries, true, true, false);
- GetCode20NoSeries('IS', StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeriesLine(ItemNoSeriesLine, ItemNoSeries.Code, StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeries(OutSerialNoSeries, true, true, false);
- GetCode20NoSeries('S', StartingNo, EndingNo);
- LibraryUtility2.CreateNoSeriesLine(SerialNoSeriesLine, OutSerialNoSeries.Code, StartingNo, EndingNo);
-
- LibraryItemTracking.CreateItemTrackingCode(SerialItemTrackingCode, true, false, false);
-
- InventorySetup.Get();
- InventorySetup.Validate("Item Nos.", ItemNoSeries.Code);
- InventorySetup.Modify(true);
-
- LibraryInventory.CreateTrackedItem(OutItem, '', OutSerialNoSeries.Code, SerialItemTrackingCode.Code);
- OutItem.Rename(NoSeriesCodeunit.PeekNextNo(ItemNoSeries.Code));
-
- OutItem.Modify();
-
- OutItem.Validate("Unit Cost", 1.234);
- OutItem.Validate("Unit Price", 2.2345);
- OutItem.Modify();
- end;
-
- ///
- /// Creates a package no. series and a package-tracked item
- ///
- ///
- procedure CreatePackageTrackedItemWithNoSeries(var OutItem: Record Item; var OutPackageNoSeries: Record "No. Series")
- var
- InventorySetup: Record "Inventory Setup";
- PackageNoSeriesLine: Record "No. Series Line";
- PackageItemTrackingCode: Record "Item Tracking Code";
- LibraryItemTracking: Codeunit "Library - Item Tracking";
- LibraryUtility2: Codeunit "Library - Utility";
- LibraryInventory: Codeunit "Library - Inventory";
- StartingNo: Code[20];
- EndingNo: Code[20];
- begin
- InventorySetup.Get();
- GetCode20NoSeries('P', StartingNo, EndingNo);
- if InventorySetup."Package Nos." <> '' then begin
- OutPackageNoSeries.Get(InventorySetup."Package Nos.");
- PackageNoSeriesLine.SetRange(PackageNoSeriesLine."Series Code");
- if PackageNoSeriesLine.Count = 0 then
- LibraryUtility2.CreateNoSeriesLine(PackageNoSeriesLine, OutPackageNoSeries.Code, StartingNo, EndingNo);
- end else begin
- LibraryUtility2.CreateNoSeries(OutPackageNoSeries, true, true, false);
- LibraryUtility2.CreateNoSeriesLine(PackageNoSeriesLine, OutPackageNoSeries.Code, StartingNo, EndingNo);
- InventorySetup.Validate("Package Nos.", OutPackageNoSeries.Code);
- InventorySetup.Modify(true);
- end;
- LibraryItemTracking.CreateItemTrackingCode(PackageItemTrackingCode, false, false, true);
-
- LibraryInventory.CreateItem(OutItem);
- OutItem.Validate("Item Tracking Code", PackageItemTrackingCode.Code);
- OutItem.Validate("Unit Cost", 1.234);
- OutItem.Validate("Unit Price", 2.2345);
- OutItem.Modify();
- end;
-
- ///
- /// Sets user as warehouse employee for location
- ///
- ///
- procedure SetCurrLocationWhseEmployee(Location: Code[10])
- var
- WhseWarehouseEmployee: Record "Warehouse Employee";
- begin
- WhseWarehouseEmployee.Validate("User ID", UserId());
- WhseWarehouseEmployee.Validate("Location Code", Location);
- WhseWarehouseEmployee.Default := true;
- if WhseWarehouseEmployee.Insert() then;
- end;
-
- ///
- /// Creates Quality Inspection from purchase line for tracked item
- ///
- ///
- ///
- ///
- procedure CreateInspectionWithPurchaseLineAndTracking(PurOrdPurchaseLine: Record "Purchase Line"; ReservationEntry: Record "Reservation Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
- var
- SpecTrackingSpecification: Record "Tracking Specification";
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
- PurchaseLineRecordRef: RecordRef;
- UnusedVariant1: Variant;
- UnusedVariant2: Variant;
- InspectionCreated: Boolean;
- begin
- PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
- SpecTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
- InspectionCreated := QltyInspectionCreate.CreateInspectionWithMultiVariantsAndTemplate(PurchaseLineRecordRef, SpecTrackingSpecification, UnusedVariant1, UnusedVariant2, true, '');
- LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
-
- QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
- LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
- end;
-
- ///
- /// Creates Quality Inspection from warehouse entry for tracked item
- ///
- ///
- ///
- ///
- procedure CreateInspectionWithWarehouseEntryAndTracking(WarehouseEntry: Record "Warehouse Entry"; ReservationEntry: Record "Reservation Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
- var
- SpecTrackingSpecification: Record "Tracking Specification";
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
- RecordRef: RecordRef;
- UnusedVariant1: Variant;
- UnusedVariant2: Variant;
- InspectionCreated: Boolean;
- begin
- RecordRef.GetTable(WarehouseEntry);
- SpecTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
- InspectionCreated := QltyInspectionCreate.CreateInspectionWithMultiVariantsAndTemplate(RecordRef, SpecTrackingSpecification, UnusedVariant1, UnusedVariant2, true, '');
- LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
-
- QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
- LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
- end;
-
- ///
- /// Creates Quality Inspection from purchase line for untracked item
- ///
- ///
- /// The specific template to use.
- ///
- procedure CreateInspectionWithPurchaseLine(PurOrdPurchaseLine: Record "Purchase Line"; SpecificTemplate: Code[20]; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
- var
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
- PurchaseLineRecordRef: RecordRef;
- InspectionCreated: Boolean;
- begin
- PurchaseLineRecordRef.GetTable(PurOrdPurchaseLine);
- InspectionCreated := QltyInspectionCreate.CreateInspectionWithSpecificTemplate(PurchaseLineRecordRef, true, SpecificTemplate);
- LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
-
- QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
- LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
- end;
-
- ///
- /// Creates Quality Inspection for warehouse entry for untracked item
- ///
- ///
- ///
- procedure CreateInspectionWithWarehouseEntry(WarehouseEntry: Record "Warehouse Entry"; var OutQltyInspectionHeader: Record "Qlty. Inspection Header")
- var
- QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
- RecordRef: RecordRef;
- InspectionCreated: Boolean;
- begin
- RecordRef.GetTable(WarehouseEntry);
- InspectionCreated := QltyInspectionCreate.CreateInspection(RecordRef, true);
- LibraryAssert.IsTrue(InspectionCreated, 'Quality Inspection not created.');
-
- QltyInspectionCreate.GetCreatedInspection(OutQltyInspectionHeader);
- LibraryAssert.RecordCount(OutQltyInspectionHeader, 1);
- end;
-
- ///
- /// This works around a flaw in "Library - Warehouse"::CreateWhseJournalLine where it only supports the item template and does insufficient filtering.
- /// It's otherwise nearly identical to CreateReclassWhseJournalLine from "Library - Warehouse"::CreateWhseJournalLine
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- procedure CreateReclassWhseJournalLine(var ReclassWarehouseJournalLine: Record "Warehouse Journal Line"; JournalTemplateName: Code[10]; JournalBatchName: Code[10]; LocationCode: Code[10]; ZoneCode: Code[10]; BinCode: Code[20]; EntryType: Option; ItemNo: Code[20]; NewQuantity: Decimal)
- var
- QltyManagementSetup: Record "Qlty. Management Setup";
- BatchNoSeries: Record "No. Series";
- WarehouseJournalBatch: Record "Warehouse Journal Batch";
- BatchGeneratorNoSeries: Codeunit "No. Series";
- RecordRef: RecordRef;
- DocumentNo: Code[20];
- begin
- ReclassWarehouseJournalLine.LockTable(true);
- QltyManagementSetup.LockTable();
- if not WarehouseJournalBatch.Get(JournalTemplateName, JournalBatchName, LocationCode) then begin
- WarehouseJournalBatch.Init();
- WarehouseJournalBatch.Validate("Journal Template Name", JournalTemplateName);
- WarehouseJournalBatch.SetupNewBatch();
- WarehouseJournalBatch.Validate(Name, JournalBatchName);
- WarehouseJournalBatch.Validate(Description, JournalBatchName + ' journal');
- WarehouseJournalBatch.Validate("Location Code", LocationCode);
- WarehouseJournalBatch.Insert(true);
- end;
-
- ReclassWarehouseJournalLine.Validate("Journal Template Name", JournalTemplateName);
- ReclassWarehouseJournalLine.Validate("Journal Batch Name", JournalBatchName);
- ReclassWarehouseJournalLine.Validate("Location Code", LocationCode);
- ReclassWarehouseJournalLine.Validate("Zone Code", ZoneCode);
- ReclassWarehouseJournalLine.Validate("Bin Code", BinCode);
-
- ReclassWarehouseJournalLine.SetUpNewLine(ReclassWarehouseJournalLine);
-
- RecordRef.GetTable(ReclassWarehouseJournalLine);
- ReclassWarehouseJournalLine.Validate("Line No.", LibraryUtility.GetNewLineNo(RecordRef, ReclassWarehouseJournalLine.FieldNo("Line No.")));
- ReclassWarehouseJournalLine.Insert(true);
- ReclassWarehouseJournalLine.Validate("Registering Date", WorkDate());
- ReclassWarehouseJournalLine.Validate("Entry Type", EntryType);
- if BatchNoSeries.Get(WarehouseJournalBatch."No. Series") then
- DocumentNo := BatchGeneratorNoSeries.PeekNextNo(WarehouseJournalBatch."No. Series", ReclassWarehouseJournalLine."Registering Date")
- else
- DocumentNo := 'Default Document No.';
- ReclassWarehouseJournalLine.Validate("Whse. Document No.", DocumentNo);
- ReclassWarehouseJournalLine.Validate("Item No.", ItemNo);
- ReclassWarehouseJournalLine.Validate(Quantity, NewQuantity);
- ReclassWarehouseJournalLine.Modify(true);
- end;
-
- procedure ClearResultLotSettings(var QltyInspectionResult: Record "Qlty. Inspection Result")
- begin
- QltyInspectionResult."Lot Allow Sales" := QltyInspectionResult."Lot Allow Sales"::Allow;
- QltyInspectionResult."Lot Allow Assembly Consumption" := QltyInspectionResult."Lot Allow Assembly Consumption"::Allow;
- QltyInspectionResult."Lot Allow Assembly Output" := QltyInspectionResult."Lot Allow Assembly Output"::Allow;
- QltyInspectionResult."Lot Allow Consumption" := QltyInspectionResult."Lot Allow Consumption"::Allow;
- QltyInspectionResult."Lot Allow Invt. Movement" := QltyInspectionResult."Lot Allow Invt. Movement"::Allow;
- QltyInspectionResult."Lot Allow Invt. Pick" := QltyInspectionResult."Lot Allow Invt. Pick"::Allow;
- QltyInspectionResult."Lot Allow Invt. Put-Away" := QltyInspectionResult."Lot Allow Invt. Put-Away"::Allow;
- QltyInspectionResult."Lot Allow Movement" := QltyInspectionResult."Lot Allow Movement"::Allow;
- QltyInspectionResult."Lot Allow Output" := QltyInspectionResult."Lot Allow Output"::Allow;
- QltyInspectionResult."Lot Allow Pick" := QltyInspectionResult."Lot Allow Pick"::Allow;
- QltyInspectionResult."Lot Allow Purchase" := QltyInspectionResult."Lot Allow Purchase"::Allow;
- QltyInspectionResult."Lot Allow Put-Away" := QltyInspectionResult."Lot Allow Put-Away"::Allow;
- QltyInspectionResult."Lot Allow Transfer" := QltyInspectionResult."Lot Allow Transfer"::Allow;
- QltyInspectionResult.Modify();
- end;
-
- procedure ClearSetupTriggerDefaults(var QltyManagementSetup: Record "Qlty. Management Setup")
- begin
- QltyManagementSetup."Purchase Trigger" := QltyManagementSetup."Purchase Trigger"::NoTrigger;
- QltyManagementSetup."Sales Return Trigger" := QltyManagementSetup."Sales Return Trigger"::NoTrigger;
- QltyManagementSetup."Warehouse Receive Trigger" := QltyManagementSetup."Warehouse Receive Trigger"::NoTrigger;
- QltyManagementSetup."Warehouse Trigger" := QltyManagementSetup."Warehouse Trigger"::NoTrigger;
- QltyManagementSetup."Transfer Trigger" := QltyManagementSetup."Transfer Trigger"::NoTrigger;
- QltyManagementSetup."Production Trigger" := QltyManagementSetup."Production Trigger"::NoTrigger;
- QltyManagementSetup."Assembly Trigger" := QltyManagementSetup."Assembly Trigger"::NoTrigger;
- QltyManagementSetup.Modify();
- end;
-
- procedure CreatePackageTracking(var PackageNoSeries: Record "No. Series"; var PackageNoSeriesLine: Record "No. Series Line"; var PackageItemTrackingCode: Record "Item Tracking Code")
- var
- InventorySetup: Record "Inventory Setup";
- LibraryItemTracking: Codeunit "Library - Item Tracking";
- begin
- InventorySetup.Get();
- if InventorySetup."Package Nos." <> '' then begin
- PackageNoSeries.Get(InventorySetup."Package Nos.");
- PackageNoSeriesLine.SetRange(PackageNoSeriesLine."Series Code");
- if not PackageNoSeriesLine.FindFirst() then
- LibraryUtility.CreateNoSeriesLine(PackageNoSeriesLine, PackageNoSeries.Code, PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '0'), PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '9'));
- end else begin
- LibraryUtility.CreateNoSeries(PackageNoSeries, true, true, false);
- LibraryUtility.CreateNoSeriesLine(PackageNoSeriesLine, PackageNoSeries.Code, PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '0'), PadStr(Format(CurrentDateTime(), 0, 'P'), 19, '9'));
- InventorySetup.Validate("Package Nos.", PackageNoSeries.Code);
- InventorySetup.Modify(true);
- end;
- LibraryItemTracking.CreateItemTrackingCode(PackageItemTrackingCode, false, false, true);
- end;
-
- procedure CreateLotTrackedItemWithVariant(var LotTrackedItem: Record Item; var OutOptionalItemVariant: Code[10])
- var
- ItemVariant: Record "Item Variant";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- CreateLotTrackedItem(LotTrackedItem);
- OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, LotTrackedItem."No.");
- LotTrackedItem.Modify(true);
- end;
-
- procedure CreateSerialTrackedItemWithVariant(var SerialTrackedItem: Record Item; var OutOptionalItemVariant: Code[10])
- var
- ItemVariant: Record "Item Variant";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- CreateSerialTrackedItem(SerialTrackedItem);
- OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, SerialTrackedItem."No.");
- SerialTrackedItem.Modify(true);
- end;
-
- procedure CreateSerialTrackedItemWithVariant(var SerialTrackedItem: Record Item; SerialNoSeries: Code[20]; SerialTrackingCode: Code[10]; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
- var
- ItemVariant: Record "Item Variant";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- CreateSerialTrackedItem(SerialTrackedItem);
- OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, SerialTrackedItem."No.");
- end;
-
- procedure CreatePackageTrackedItem(var PackageTrackedItem: Record Item; PackageTrackingCode: Code[10]; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
- var
- ItemVariant: Record "Item Variant";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- LibraryInventory.CreateItem(PackageTrackedItem);
- OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, PackageTrackedItem."No.");
- PackageTrackedItem.Validate("Item Tracking Code", PackageTrackingCode);
- PackageTrackedItem.Validate("Unit Cost", UnitCost);
- PackageTrackedItem.Modify(true);
- end;
-
- procedure CreateUntrackedItem(var UntrackedItem: Record Item; UnitCost: Decimal; var OutOptionalItemVariant: Code[10])
- var
- ItemVariant: Record "Item Variant";
- LibraryInventory: Codeunit "Library - Inventory";
- begin
- LibraryInventory.CreateItem(UntrackedItem);
- OutOptionalItemVariant := LibraryInventory.CreateItemVariant(ItemVariant, UntrackedItem."No.");
- UntrackedItem.Validate("Unit Cost", UnitCost);
- UntrackedItem.Modify(true);
- end;
-
- procedure GetCode20NoSeries(InPrefix: Text; var OutStart: Code[20]; var OutEnd: Code[20])
- var
- Temp: Text;
- begin
- Temp :=
- InPrefix + Format(CurrentDateTime(), 0, '') +
- GetNextSequenceNoAsText(InPrefix, 3);
- OutStart := CopyStr(Temp.PadRight(MaxStrLen(OutStart), '1'), 1, MaxStrLen(OutStart));
- OutEnd := CopyStr(Temp.PadRight(MaxStrLen(OutEnd), '9'), 1, MaxStrLen(OutEnd));
- end;
-
- local procedure GetNextSequenceNoAsText(SequenceKey: Text; PadSize: Integer) Out: Text;
- var
- QltySessionHelper: Codeunit "Qlty. Session Helper";
- BigResult: BigInteger;
- CurrentSessionValue: Text;
- PreviousessionDateTime: DateTime;
- Sequence: BigInteger;
- begin
- SequenceKey := SequenceKey + Format(CurrentDateTime(), 0, '');
- CurrentSessionValue := QltySessionHelper.GetSessionValue(SequenceKey);
- PreviousessionDateTime := CurrentDateTime();
- if CurrentSessionValue <> '' then
- Evaluate(PreviousessionDateTime, CurrentSessionValue, 9);
- QltySessionHelper.SetSessionValue(SequenceKey, Format(CurrentDateTime(), 0, 9));
-
- if PreviousessionDateTime <> 0DT then
- BigResult := CurrentDateTime() - PreviousessionDateTime;
-
- if not NumberSequence.Exists(SequenceKey, true) then
- NumberSequence.Insert(SequenceKey, BigResult);
-
- Sequence := NumberSequence.Next(SequenceKey);
- if Sequence < BigResult then
- NumberSequence.Restart(SequenceKey, BigResult);
-
- Sequence := NumberSequence.Next(SequenceKey);
- Out := Format(Sequence, 0, 9);
- Out := Out.PadLeft(PadSize, '0');
- end;
-
- procedure CreateWarehouseReceiptSetup(var CreatedQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry")
- begin
- CreateWarehouseReceiptSetup(CreatedQltyInspectionGenRule, OutPurchaseLine, OutReservationEntry, 123);
- end;
-
- procedure CreateWarehouseReceiptSetup(var CreatedQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule"; var OutPurchaseLine: Record "Purchase Line"; var OutReservationEntry: Record "Reservation Entry"; Quantity: Decimal)
- var
- Item: Record Item;
- Location: Record Location;
- QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
- PurchaseHeader: Record "Purchase Header";
- LibraryWarehouse: Codeunit "Library - Warehouse";
- OrdQltyPurOrderGenerator: Codeunit "Qlty. Pur. Order Generator";
- begin
- EnsureSetupExists();
- LibraryWarehouse.CreateFullWMSLocation(Location, 1);
- CreateTemplate(QltyInspectionTemplateHdr, 1);
- CreatePrioritizedRule(QltyInspectionTemplateHdr, Database::"Purchase Line", CreatedQltyInspectionGenRule);
-
- CreatedQltyInspectionGenRule."Purchase Trigger" := CreatedQltyInspectionGenRule."Purchase Trigger"::OnPurchaseOrderPostReceive;
- CreatedQltyInspectionGenRule.Modify();
-
- CreateLotTrackedItem(Item);
-
- Item.SetRecFilter();
- CreatedQltyInspectionGenRule."Item Filter" := CopyStr(Item.GetView(), 1, MaxStrLen(CreatedQltyInspectionGenRule."Item Filter"));
- CreatedQltyInspectionGenRule."Activation Trigger" := CreatedQltyInspectionGenRule."Activation Trigger"::"Manual or Automatic";
- CreatedQltyInspectionGenRule."Purchase Trigger" := CreatedQltyInspectionGenRule."Purchase Trigger"::OnPurchaseOrderPostReceive;
- CreatedQltyInspectionGenRule.Modify();
-
- OrdQltyPurOrderGenerator.CreatePurchaseOrder(Quantity, Location, Item, PurchaseHeader, OutPurchaseLine, OutReservationEntry);
- end;
-}