diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyScheduleInspection.Report.al b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyScheduleInspection.Report.al
index 5c7151a0f8..57ab1fe26a 100644
--- a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyScheduleInspection.Report.al
+++ b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyScheduleInspection.Report.al
@@ -68,7 +68,7 @@ report 20412 "Qlty. Schedule Inspection"
QltyManagementSetup: Record "Qlty. Management Setup";
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
ShowWarningIfCreateInspection: Boolean;
- CreatedQltyInspectionIds: List of [Code[20]];
+ CreatedQltyInspectionIds: List of [RecordId];
ZeroInspectionsCreatedMsg: Label 'No inspections were created.';
SomeInspectionsWereCreatedQst: Label '%1 inspections were created. Do you want to see them?', Comment = '%1=the count of inspections that were created.';
diff --git a/src/Apps/W1/Quality Management/app/src/Document/QltyInspectionCreate.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Document/QltyInspectionCreate.Codeunit.al
index d500bc2660..0bfdc496a2 100644
--- a/src/Apps/W1/Quality Management/app/src/Document/QltyInspectionCreate.Codeunit.al
+++ b/src/Apps/W1/Quality Management/app/src/Document/QltyInspectionCreate.Codeunit.al
@@ -272,7 +272,6 @@ codeunit 20404 "Qlty. Inspection - Create"
RelatedItem: Record Item;
QltyPermissionMgmt: Codeunit "Qlty. Permission Mgmt.";
QltyStartWorkflow: Codeunit "Qlty. Start Workflow";
- QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
RecordRefToBufferTriggeringRecord: RecordRef;
OriginalRecordId: RecordId;
NullRecordId: RecordId;
@@ -358,12 +357,8 @@ codeunit 20404 "Qlty. Inspection - Create"
if IsNewlyCreatedInspection then
QltyStartWorkflow.StartWorkflowInspectionCreated(QltyInspectionHeader);
- if GuiAllowed() and not PreventShowingGeneratedInspectionEvenIfConfigured
- and (QltyInspectionHeader."No." <> '') then
- if IsManualCreation then
- Page.Run(Page::"Qlty. Inspection", QltyInspectionHeader)
- else
- QltyNotificationMgmt.NotifyInspectionCreated(QltyInspectionHeader);
+ if IsManualCreation then
+ DisplayInspectionIfConfigured(IsManualCreation, QltyInspectionHeader);
end else begin
LogCreateInspectionProblem(TargetRecordRef, UnableToCreateInspectionForErr, Format(OriginalRecordId));
if IsManualCreation and (not AvoidThrowingErrorWhenPossible) then
@@ -839,7 +834,7 @@ codeunit 20404 "Qlty. Inspection - Create"
internal procedure CreateMultipleInspectionsForMultipleRecords(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary)
var
- CreatedQltyInspectionIds: List of [Code[20]];
+ CreatedQltyInspectionIds: List of [RecordId];
begin
CreateMultipleInspectionsWithoutDisplaying(SetOfRecordsRecordRef, IsManualCreation, TempFiltersQltyInspectionGenRule, CreatedQltyInspectionIds);
@@ -847,23 +842,35 @@ codeunit 20404 "Qlty. Inspection - Create"
DisplayInspectionsIfConfigured(IsManualCreation, CreatedQltyInspectionIds);
end;
- internal procedure DisplayInspectionsIfConfigured(IsManualCreation: Boolean; var CreatedQltyInspectionIds: List of [Code[20]])
+ internal procedure DisplayInspectionIfConfigured(IsManualCreation: Boolean; CreatedQltyInspectionHeader: Record "Qlty. Inspection Header")
+ var
+ CreatedQltyInspectionIds: List of [RecordId];
+ begin
+ CreatedQltyInspectionIds.Add(CreatedQltyInspectionHeader.RecordId);
+ DisplayInspectionsIfConfigured(IsManualCreation, CreatedQltyInspectionIds);
+ end;
+
+ internal procedure DisplayInspectionsIfConfigured(IsManualCreation: Boolean; var CreatedQltyInspectionIds: List of [RecordId])
var
CreatedQltyInspectionHeader: Record "Qlty. Inspection Header";
QltyNotificationMgmt: Codeunit "Qlty. Notification Mgmt.";
- InspectionNo: Code[20];
+ InspectionRecordId: RecordId;
PipeSeparatedFilter: Text;
begin
+ if PreventShowingGeneratedInspectionEvenIfConfigured then
+ exit;
QltyManagementSetup.Get();
if GuiAllowed() then begin
- foreach InspectionNo in CreatedQltyInspectionIds do
- if InspectionNo <> '' then begin
- if StrLen(PipeSeparatedFilter) > 1 then
- PipeSeparatedFilter += '|';
- PipeSeparatedFilter += InspectionNo;
- end;
+ foreach InspectionRecordId in CreatedQltyInspectionIds do
+ if CreatedQltyInspectionHeader.Get(InspectionRecordId) then
+ if CreatedQltyInspectionHeader."No." <> '' then begin
+ if StrLen(PipeSeparatedFilter) > 1 then
+ PipeSeparatedFilter += '|';
+ PipeSeparatedFilter += CreatedQltyInspectionHeader."No.";
+ end;
+ Clear(CreatedQltyInspectionHeader);
CreatedQltyInspectionHeader.SetFilter("No.", PipeSeparatedFilter);
if CreatedQltyInspectionIds.Count() = 1 then begin
CreatedQltyInspectionHeader.SetCurrentKey("No.", "Re-inspection No.");
@@ -889,7 +896,7 @@ codeunit 20404 "Qlty. Inspection - Create"
///
///
///
- internal procedure CreateMultipleInspectionsWithoutDisplaying(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var CreatedQltyInspectionIds: List of [Code[20]])
+ internal procedure CreateMultipleInspectionsWithoutDisplaying(var SetOfRecordsRecordRef: RecordRef; IsManualCreation: Boolean; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var CreatedQltyInspectionIds: List of [RecordId])
var
TempCopyOfSingleRecordRecordRef: RecordRef;
ParentRecordRef: RecordRef;
@@ -929,7 +936,7 @@ codeunit 20404 "Qlty. Inspection - Create"
end;
end;
- local procedure CreateInspectionForSelfOrDirectParent(var TempSelfRecordRef: RecordRef; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var FoundParentRecordRef: RecordRef; var CreatedQltyInspectionIds: List of [Code[20]]; PreventInspectionFromDisplayingEvenIfConfigured: Boolean; IsManualCreation: Boolean) InspectionCreatedCount: Integer
+ local procedure CreateInspectionForSelfOrDirectParent(var TempSelfRecordRef: RecordRef; var TempFiltersQltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule" temporary; var FoundParentRecordRef: RecordRef; var CreatedQltyInspectionIds: List of [RecordId]; PreventInspectionFromDisplayingEvenIfConfigured: Boolean; IsManualCreation: Boolean) InspectionCreatedCount: Integer
var
LastCreatedQltyInspectionHeader2: Record "Qlty. Inspection Header";
Item: Record Item;
@@ -1007,8 +1014,8 @@ codeunit 20404 "Qlty. Inspection - Create"
if LocalQltyInspectionCreate.CreateInspectionWithMultiVariants(ParentRecordRef, TempSelfRecordRef, VariantEmptyOrTrackingSpecification, Dummy4Variant, IsManualCreation, TempFiltersQltyInspectionGenRule) then
if LocalQltyInspectionCreate.GetCreatedInspection(LastCreatedQltyInspectionHeader2) then begin
InspectionCreatedCount += 1;
- if not CreatedQltyInspectionIds.Contains(LastCreatedQltyInspectionHeader2."No.") then
- CreatedQltyInspectionIds.Add(LastCreatedQltyInspectionHeader2."No.");
+ if not CreatedQltyInspectionIds.Contains(LastCreatedQltyInspectionHeader2.RecordId) then
+ CreatedQltyInspectionIds.Add(LastCreatedQltyInspectionHeader2.RecordId);
end;
until RelatedReservFilterReservationEntry.Next() = 0;
end else begin
@@ -1021,8 +1028,8 @@ codeunit 20404 "Qlty. Inspection - Create"
if LocalQltyInspectionCreate.CreateInspectionWithMultiVariants(TempSelfRecordRef, ParentRecordRef, Dummy4Variant, Dummy4Variant, IsManualCreation, TempFiltersQltyInspectionGenRule) then
if LocalQltyInspectionCreate.GetCreatedInspection(LastCreatedQltyInspectionHeader2) then begin
InspectionCreatedCount += 1;
- if not CreatedQltyInspectionIds.Contains(LastCreatedQltyInspectionHeader2."No.") then
- CreatedQltyInspectionIds.Add(LastCreatedQltyInspectionHeader2."No.");
+ if not CreatedQltyInspectionIds.Contains(LastCreatedQltyInspectionHeader2.RecordId) then
+ CreatedQltyInspectionIds.Add(LastCreatedQltyInspectionHeader2.RecordId);
end;
end;
end;
diff --git a/src/Apps/W1/Quality Management/app/src/Integration/Assembly/QltyAssemblyIntegration.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Integration/Assembly/QltyAssemblyIntegration.Codeunit.al
index a5f042e93d..f998ba69dc 100644
--- a/src/Apps/W1/Quality Management/app/src/Integration/Assembly/QltyAssemblyIntegration.Codeunit.al
+++ b/src/Apps/W1/Quality Management/app/src/Integration/Assembly/QltyAssemblyIntegration.Codeunit.al
@@ -19,6 +19,11 @@ using Microsoft.Warehouse.Journal;
///
codeunit 20412 "Qlty. Assembly Integration"
{
+ SingleInstance = true;
+
+ var
+ ListOfCreatedInspectionIds: List of [RecordId];
+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Assembly-Post", 'OnAfterPost', '', true, true)]
local procedure HandleOnAfterPost(var AssemblyHeader: Record "Assembly Header"; var AssemblyLine: Record "Assembly Line"; PostedAssemblyHeader: Record "Posted Assembly Header"; var ItemJnlPostLine: Codeunit "Item Jnl.-Post Line"; var ResJnlPostLine: Codeunit "Res. Jnl.-Post Line"; var WhseJnlRegisterLine: Codeunit "Whse. Jnl.-Register Line")
var
@@ -45,11 +50,15 @@ codeunit 20412 "Qlty. Assembly Integration"
if not TempSpecTrackingSpecification.IsEmpty() then
repeat
+ Clear(QltyInspectionHeader);
HasInspection := QltyInspectionCreate.CreateInspectionWithMultiVariants(PostedAssemblyHeader, TempSpecTrackingSpecification, AssemblyHeader, UnusedVariant1, false, QltyInspectionGenRule);
if HasInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- QltyInspectionHeader."Source Quantity (Base)" := TempSpecTrackingSpecification."Quantity (Base)";
- QltyInspectionHeader.Modify(false);
+ if QltyInspectionHeader."No." <> '' then begin
+ QltyInspectionHeader."Source Quantity (Base)" := TempSpecTrackingSpecification."Quantity (Base)";
+ QltyInspectionHeader.Modify(false);
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId);
+ end;
end;
OnAfterAttemptCreateInspectionFromPostedAssembly(AssemblyHeader, PostedAssemblyHeader, TempSpecTrackingSpecification, QltyInspectionHeader);
until TempSpecTrackingSpecification.Next(-1) = 0
@@ -59,10 +68,23 @@ codeunit 20412 "Qlty. Assembly Integration"
if IsHandled then
exit;
HasInspection := QltyInspectionCreate.CreateInspectionWithMultiVariants(PostedAssemblyHeader, AssemblyHeader, UnusedVariant1, UnusedVariant2, false, TempQltyInspectionGenRule);
- if HasInspection then
+ if HasInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
+ if QltyInspectionHeader."No." <> '' then
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId);
+ end;
OnAfterAttemptCreateInspectionFromPostedAssembly(AssemblyHeader, PostedAssemblyHeader, TempSpecTrackingSpecification, QltyInspectionHeader);
end;
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Assembly-Post", 'OnBeforePost', '', true, true)]
+ local procedure HandleOnBeforePost(var AssemblyHeader: Record "Assembly Header")
+ begin
+ Clear(ListOfCreatedInspectionIds);
end;
///
diff --git a/src/Apps/W1/Quality Management/app/src/Integration/Manufacturing/QltyManufacturIntegration.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Integration/Manufacturing/QltyManufacturIntegration.Codeunit.al
index a5ba82153e..bf7fe0bf9d 100644
--- a/src/Apps/W1/Quality Management/app/src/Integration/Manufacturing/QltyManufacturIntegration.Codeunit.al
+++ b/src/Apps/W1/Quality Management/app/src/Integration/Manufacturing/QltyManufacturIntegration.Codeunit.al
@@ -19,8 +19,11 @@ using Microsoft.QualityManagement.Setup;
///
codeunit 20407 "Qlty. Manufactur. Integration"
{
+ SingleInstance = true;
+
var
QltyTraversal: Codeunit "Qlty. Traversal";
+ ListOfCreatedInspectionIds: List of [RecordId];
///
/// We subscribe to OnAfterPostOutput to see if we need to create an inspection related to the output.
@@ -347,7 +350,6 @@ codeunit 20407 "Qlty. Manufactur. Integration"
TempTrackingSpecification: Record "Tracking Specification" temporary;
QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
ProdOrderLineReserve: Codeunit "Prod. Order Line-Reserve";
- ListOfInspectionIds: List of [RecordId];
HasReservationEntries: Boolean;
IsHandled: Boolean;
CreatedAtLeastOneInspectionForRoutingLine: Boolean;
@@ -359,7 +361,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
OnBeforeProductionAttemptCreateReleaseAutomaticInspection(ProductionOrder, IsHandled);
if IsHandled then
exit;
-
+ Clear(ListOfCreatedInspectionIds);
ProdOrderLine.SetRange(Status, ProductionOrder.Status);
ProdOrderLine.SetRange("Prod. Order No.", ProductionOrder."No.");
if ProdOrderLine.FindSet() then begin
@@ -376,6 +378,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
ReservationEntry.FindSet();
repeat
Clear(TempTrackingSpecification);
+ Clear(QltyInspectionHeader);
TempTrackingSpecification.DeleteAll(false);
TempTrackingSpecification.SetSourceFromReservEntry(ReservationEntry);
TempTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
@@ -385,7 +388,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
if MadeInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- ListOfInspectionIds.Add(QltyInspectionHeader.RecordId());
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId());
CreatedAtLeastOneInspectionForRoutingLine := true;
end;
until ReservationEntry.Next() = 0;
@@ -394,7 +397,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
if MadeInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- ListOfInspectionIds.Add(QltyInspectionHeader.RecordId());
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId());
CreatedAtLeastOneInspectionForRoutingLine := true;
end;
end;
@@ -405,6 +408,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
ReservationEntry.FindSet();
repeat
Clear(TempTrackingSpecification);
+ Clear(QltyInspectionHeader);
TempTrackingSpecification.DeleteAll(false);
TempTrackingSpecification.SetSourceFromReservEntry(ReservationEntry);
TempTrackingSpecification.CopyTrackingFromReservEntry(ReservationEntry);
@@ -414,7 +418,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
if MadeInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- ListOfInspectionIds.Add(QltyInspectionHeader.RecordId());
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId());
CreatedAtLeastOneInspectionForOrderLine := true;
end;
@@ -423,7 +427,7 @@ codeunit 20407 "Qlty. Manufactur. Integration"
MadeInspection := QltyInspectionCreate.CreateInspectionWithMultiVariants(ProdOrderLine, ProductionOrder, DummyVariant, DummyVariant, false, OptionalFiltersQltyInspectionGenRule);
if MadeInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- ListOfInspectionIds.Add(QltyInspectionHeader.RecordId());
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId());
CreatedAtLeastOneInspectionForOrderLine := true;
end;
end;
@@ -433,12 +437,15 @@ codeunit 20407 "Qlty. Manufactur. Integration"
MadeInspection := QltyInspectionCreate.CreateInspectionWithMultiVariants(ProductionOrder, DummyVariant, DummyVariant, DummyVariant, false, OptionalFiltersQltyInspectionGenRule);
if MadeInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
- ListOfInspectionIds.Add(QltyInspectionHeader.RecordId());
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId());
CreatedInspectionForProdOrder := MadeInspection;
end;
end;
-
- OnAfterProductionAttemptCreateReleaseAutomaticInspection(ProductionOrder, CreatedAtLeastOneInspectionForRoutingLine, CreatedAtLeastOneInspectionForOrderLine, CreatedInspectionForProdOrder, ListOfInspectionIds);
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ OnAfterProductionAttemptCreateReleaseAutomaticInspection(ProductionOrder, CreatedAtLeastOneInspectionForRoutingLine, CreatedAtLeastOneInspectionForOrderLine, CreatedInspectionForProdOrder);
end;
///
@@ -470,12 +477,32 @@ codeunit 20407 "Qlty. Manufactur. Integration"
else
HasInspection := QltyInspectionCreate.CreateInspectionWithMultiVariants(ItemLedgerEntry, ItemJournalLine, ProdOrderLine, DummyVariant, false, OptionalFiltersQltyInspectionGenRule);
- if HasInspection then
+ if HasInspection then begin
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
+ if QltyInspectionHeader."No." <> '' then
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId);
+ end;
OnAfterProductionAttemptCreateAutomaticInspection(ProdOrderRoutingLine, ItemLedgerEntry, ProdOrderLine, ItemJournalLine);
end;
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Batch", 'OnBeforeCode', '', false, false)]
+ local procedure HandleOnBeforeCode(var ItemJournalLine: Record "Item Journal Line"; var ItemLedgerEntry: Record "Item Ledger Entry")
+ begin
+ Clear(ListOfCreatedInspectionIds);
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Batch", 'OnAfterPostJnlLines', '', true, true)]
+ local procedure HandleOnAfterPostJnlLines(var ItemJournalBatch: Record "Item Journal Batch"; var ItemJournalLine: Record "Item Journal Line"; ItemRegNo: Integer; WhseRegNo: Integer; var WindowIsOpen: Boolean)
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ end;
+
///
/// OnBeforeProductionAttemptCreatePostAutomaticInspection is called before attempting to automatically create an inspection for production related events prior to posting to posting.
///
@@ -519,9 +546,8 @@ codeunit 20407 "Qlty. Manufactur. Integration"
/// A flag indicating if at least one inspection for the production order routing line was created
/// A flag indicating if at least one inspection for the production order line was created
/// A flag indicating if at least one inspection for the production order was created
- /// A list of record ids of the inspections that were created
[IntegrationEvent(false, false)]
- local procedure OnAfterProductionAttemptCreateReleaseAutomaticInspection(var ProductionOrder: Record "Production Order"; CreatedAtLeastOneInspectionForRoutingLine: Boolean; CreatedAtLeastOneInspectionForOrderLine: Boolean; CreatedInspectionForProdOrder: Boolean; ListOfInspectionIds: List of [RecordId])
+ local procedure OnAfterProductionAttemptCreateReleaseAutomaticInspection(var ProductionOrder: Record "Production Order"; CreatedAtLeastOneInspectionForRoutingLine: Boolean; CreatedAtLeastOneInspectionForOrderLine: Boolean; CreatedInspectionForProdOrder: Boolean)
begin
end;
diff --git a/src/Apps/W1/Quality Management/app/src/Integration/Warehouse/QltyWarehouseIntegration.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Integration/Warehouse/QltyWarehouseIntegration.Codeunit.al
index 0ca1151dc0..cf71f2a87b 100644
--- a/src/Apps/W1/Quality Management/app/src/Integration/Warehouse/QltyWarehouseIntegration.Codeunit.al
+++ b/src/Apps/W1/Quality Management/app/src/Integration/Warehouse/QltyWarehouseIntegration.Codeunit.al
@@ -4,6 +4,8 @@
// ------------------------------------------------------------------------------------------------
namespace Microsoft.QualityManagement.Integration.Warehouse;
+using Microsoft.Inventory.Journal;
+using Microsoft.Inventory.Posting;
using Microsoft.Inventory.Tracking;
using Microsoft.Inventory.Transfer;
using Microsoft.Purchases.Document;
@@ -12,11 +14,17 @@ using Microsoft.QualityManagement.Document;
using Microsoft.QualityManagement.Setup;
using Microsoft.QualityManagement.Utilities;
using Microsoft.Sales.Document;
+using Microsoft.Warehouse.Activity;
using Microsoft.Warehouse.Journal;
using Microsoft.Warehouse.Ledger;
codeunit 20438 "Qlty. Warehouse Integration"
{
+ SingleInstance = true;
+
+ var
+ ListOfCreatedInspectionIds: List of [RecordId];
+
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse. Jnl.-Register Line", 'OnAfterInsertWhseEntry', '', true, true)]
local procedure HandleOnAfterInsertWhseEntry(var WarehouseEntry: Record "Warehouse Entry"; var WarehouseJournalLine: Record "Warehouse Journal Line")
var
@@ -63,15 +71,20 @@ codeunit 20438 "Qlty. Warehouse Integration"
TempTrackingSpecification.Reset();
if TempTrackingSpecification.FindSet() then
repeat
+ Clear(QltyInspectionHeader);
if QltyInspectionCreate.CreateInspectionWithMultiVariants(WarehouseEntry, WarehouseJournalLine, TempTrackingSpecification, DummyVariant, false, QltyInspectionGenRule) then begin
HasInspection := true;
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
+ if QltyInspectionHeader."No." <> '' then
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId);
end;
until TempTrackingSpecification.Next() = 0
else
if QltyInspectionCreate.CreateInspectionWithMultiVariants(WarehouseEntry, WarehouseJournalLine, DummyVariant, DummyVariant, false, QltyInspectionGenRule) then begin
HasInspection := true;
QltyInspectionCreate.GetCreatedInspection(QltyInspectionHeader);
+ if QltyInspectionHeader."No." <> '' then
+ ListOfCreatedInspectionIds.Add(QltyInspectionHeader.RecordId);
end;
OnAfterWarehouseAttemptCreateInspectionWithWhseJournalLine(HasInspection, QltyInspectionHeader, WarehouseEntry, WarehouseJournalLine, DoNotSendSourceVariant);
@@ -148,6 +161,57 @@ codeunit 20438 "Qlty. Warehouse Integration"
until ReservationEntry.Next() = 0;
end;
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Activity-Register", 'OnBeforeCode', '', true, true)]
+ local procedure HandleOnBeforeCodeWhseActivityRegister(var WarehouseActivityLine: Record "Warehouse Activity Line")
+ begin
+ Clear(ListOfCreatedInspectionIds);
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse.-Activity-Register", 'OnAfterRegisterWhseActivity', '', true, true)]
+ local procedure HandleOnAfterRegisterWhseActivity(var WarehouseActivityHeader: Record "Warehouse Activity Header")
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Batch", 'OnBeforePostWhseJnlLines', '', true, true)]
+ local procedure HandleOnBeforePostWhseJnlLines(ItemJnlLine: Record "Item Journal Line"; var TempTrackingSpecification: Record "Tracking Specification" temporary; ItemJnlTemplateType: Enum "Item Journal Template Type"; ToTransfer: Boolean; var IsHandled: Boolean)
+ begin
+ Clear(ListOfCreatedInspectionIds);
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Jnl.-Post Batch", 'OnPostLinesOnAfterPostWhseJnlLine', '', true, true)]
+ local procedure HandleOnPostLinesOnAfterPostWhseJnlLine(var ItemJournalLine: Record "Item Journal Line"; CommitIsSuppressed: Boolean)
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse. Jnl.-Register Batch", 'OnBeforeCode', '', true, true)]
+ local procedure HandleOnBeforeCodeWhseJnlRegisterBatch(var WarehouseJournalLine: Record "Warehouse Journal Line"; var HideDialog: Boolean; var SuppressCommit: Boolean; var IsHandled: Boolean)
+ begin
+ Clear(ListOfCreatedInspectionIds);
+ end;
+
+ [EventSubscriber(ObjectType::Codeunit, Codeunit::"Whse. Jnl.-Register Batch", 'OnAfterCode', '', true, true)]
+ local procedure HandleOnAfterCodeWhseJnlRegisterBatch(var WarehouseJournalLine: Record "Warehouse Journal Line"; WarehouseJournalBatch: Record "Warehouse Journal Batch"; WhseRegNo: Integer)
+ var
+ QltyInspectionCreate: Codeunit "Qlty. Inspection - Create";
+ begin
+ if ListOfCreatedInspectionIds.Count() > 0 then begin
+ QltyInspectionCreate.DisplayInspectionsIfConfigured(false, ListOfCreatedInspectionIds);
+ Clear(ListOfCreatedInspectionIds);
+ end;
+ end;
+
///
/// This occurs before an inspection is about to be created with a warehouse entry.
///