diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyJobQueueManagement.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyJobQueueManagement.Codeunit.al index 145374413a..94729f242c 100644 --- a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyJobQueueManagement.Codeunit.al +++ b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/JobQueue/QltyJobQueueManagement.Codeunit.al @@ -50,20 +50,22 @@ codeunit 20455 "Qlty. Job Queue Management" /// Common usage: Called when setting up inspection generation rules to ensure scheduled execution infrastructure exists. /// /// The schedule group code to check and potentially create a job queue entry for - internal procedure PromptCreateJobQueueEntryIfMissing(ScheduleGroup: Code[20]) + internal procedure PromptCreateJobQueueEntryIfMissing(ScheduleGroup: Code[20]) JobQueueEntryCreated: Boolean begin if IsJobQueueCreated(ScheduleGroup) then - exit; + exit(true); if GuiAllowed() then if not Confirm(StrSubstNo(ThereIsNoJobQueueForThisScheduleGroupYetDoYouWantToCreateQst, ScheduleGroup)) then - exit; + exit(false); CreateJobQueueEntry(ScheduleGroup); if GuiAllowed() then if Confirm(StrSubstNo(JobQueueEntryMadeDoYouWantToSeeQst, ScheduleGroup)) then RunPageLookupJobQueueEntriesForScheduleGroup(ScheduleGroup); + + exit(true); end; /// 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 39157c71ad..5c7151a0f8 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 @@ -12,7 +12,7 @@ report 20412 "Qlty. Schedule Inspection" { Caption = 'Quality Management - Schedule Inspection'; AdditionalSearchTerms = 'Periodic inspections'; - ToolTip = 'This report is intended to be scheduled in the job queue to allow the ability to schedule inspections.'; + ToolTip = 'Run this report to bulk create inspections based on generation rules for the selected template, or schedule it in the job queue for periodic inspection creation.'; ProcessingOnly = true; ApplicationArea = QualityManagement; UsageCategory = Tasks; @@ -23,7 +23,7 @@ report 20412 "Qlty. Schedule Inspection" dataitem(CurrentInspectionGenerationRule; "Qlty. Inspection Gen. Rule") { RequestFilterFields = "Schedule Group", "Template Code", Description; - DataItemTableView = where("Activation Trigger" = filter(<> Disabled), "Schedule Group" = filter(<> '')); + DataItemTableView = where("Activation Trigger" = filter(<> Disabled)); trigger OnAfterGetRecord() begin @@ -32,8 +32,6 @@ report 20412 "Qlty. Schedule Inspection" trigger OnPreDataItem() begin - if CurrentInspectionGenerationRule.GetFilter("Schedule Group") = '' then - Error(ScheduleGroupIsMandatoryErr); end; } } @@ -73,7 +71,6 @@ report 20412 "Qlty. Schedule Inspection" CreatedQltyInspectionIds: List of [Code[20]]; 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.'; - ScheduleGroupIsMandatoryErr: Label 'It is mandatory to define a schedule group on the inspection generation rule(s), and then configure the schedule with the same group. This will help make sure that inadvertent configuration does not cause excessive inspection generation.'; trigger OnInitReport() begin @@ -110,9 +107,6 @@ report 20412 "Qlty. Schedule Inspection" if QltyInspectionGenRule."Activation Trigger" = QltyInspectionGenRule."Activation Trigger"::Disabled then exit; - if QltyInspectionGenRule."Schedule Group" = '' then - exit; - QltyJobQueueManagement.CheckIfGenerationRuleCanBeScheduled(QltyInspectionGenRule); SourceRecordRef.Open(QltyInspectionGenRule."Source Table No."); @@ -120,7 +114,8 @@ report 20412 "Qlty. Schedule Inspection" SourceRecordRef.SetView(QltyInspectionGenRule."Condition Filter"); QltyInspectionGenRule.SetRecFilter(); - QltyInspectionGenRule.SetRange("Schedule Group", QltyInspectionGenRule."Schedule Group"); + if QltyInspectionGenRule."Schedule Group" <> '' then + QltyInspectionGenRule.SetRange("Schedule Group", QltyInspectionGenRule."Schedule Group"); QltyInspectionGenRule.SetRange("Template Code", QltyInspectionGenRule."Template Code"); if SourceRecordRef.FindSet() then QltyInspectionCreate.CreateMultipleInspectionsWithoutDisplaying(SourceRecordRef, GuiAllowed(), QltyInspectionGenRule, CreatedQltyInspectionIds); diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRule.Table.al b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRule.Table.al index 3d920abd90..cabcb388c2 100644 --- a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRule.Table.al +++ b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRule.Table.al @@ -65,7 +65,10 @@ table 20404 "Qlty. Inspection Gen. Rule" if Rec."Schedule Group" <> '' then begin QltyJobQueueManagement.CheckIfGenerationRuleCanBeScheduled(Rec); Rec.Modify(); - QltyJobQueueManagement.PromptCreateJobQueueEntryIfMissing(Rec."Schedule Group"); + if not QltyJobQueueManagement.PromptCreateJobQueueEntryIfMissing(Rec."Schedule Group") then begin + Rec."Schedule Group" := xRec."Schedule Group"; + Rec.Modify(); + end; end else QltyJobQueueManagement.DeleteJobQueueIfNothingElseIsUsingThisGroup(Rec, xRec."Schedule Group"); end; diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRules.Page.al b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRules.Page.al index 38b1385164..5e22a09c48 100644 --- a/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRules.Page.al +++ b/src/Apps/W1/Quality Management/app/src/Configuration/GenerationRule/QltyInspectionGenRules.Page.al @@ -160,7 +160,10 @@ page 20405 "Qlty. Inspection Gen. Rules" if Rec."Schedule Group" = '' then begin Rec."Schedule Group" := DefaultScheduleGroupLbl; Rec.Modify(false); - QltyJobQueueManagement.PromptCreateJobQueueEntryIfMissing(Rec."Schedule Group"); + if not QltyJobQueueManagement.PromptCreateJobQueueEntryIfMissing(Rec."Schedule Group") then begin + Rec."Schedule Group" := ''; + Rec.Modify(false); + end end else QltyJobQueueManagement.RunPageLookupJobQueueEntriesForScheduleGroup(Rec."Schedule Group") end; diff --git a/src/Apps/W1/Quality Management/app/src/Configuration/QltyAutoConfigure.Codeunit.al b/src/Apps/W1/Quality Management/app/src/Configuration/QltyAutoConfigure.Codeunit.al index 2f73547634..010bd4d2f9 100644 --- a/src/Apps/W1/Quality Management/app/src/Configuration/QltyAutoConfigure.Codeunit.al +++ b/src/Apps/W1/Quality Management/app/src/Configuration/QltyAutoConfigure.Codeunit.al @@ -90,6 +90,8 @@ codeunit 20402 "Qlty. Auto Configure" ProdRoutingToInspectDescriptionTxt: Label 'Prod. Order Routing Line to Inspection', MaxLength = 100; AssemblyOutputToInspectTok: Label 'ASMOUTPUTTOINSPECT', MaxLength = 20, Locked = true; AssemblyOutputToInspectDescriptionTxt: Label 'Posted Assembly Header to Inspection', MaxLength = 100; + OpenLedgerToInspectTok: Label 'ITEMLDGROPENINSPECT', MaxLength = 20, Locked = true; + OpenLedgerToInspectDescriptionTxt: Label 'Open Item Ledger Entry to Inspection', MaxLength = 100; internal procedure GetDefaultPassResult(): Text begin @@ -242,6 +244,7 @@ codeunit 20402 "Qlty. Auto Configure" CreateDefaultProductionAndAssemblyConfiguration(); CreateDefaultReceivingConfiguration(); CreateDefaultWarehousingConfiguration(); + CreateDefaultItemLedgerEntryOpenToInspectConfiguration(); end; local procedure CreateDefaultTrackingSpecificationToInspectConfiguration() @@ -1296,6 +1299,75 @@ codeunit 20402 "Qlty. Auto Configure" ''); end; + local procedure CreateDefaultItemLedgerEntryOpenToInspectConfiguration() + var + QltyInspectSourceConfig: Record "Qlty. Inspect. Source Config."; + TempItemLedgerEntry: Record "Item Ledger Entry" temporary; + TempQltyInspectionHeader: Record "Qlty. Inspection Header" temporary; + begin + EnsureSourceConfigWithFilterExists( + OpenLedgerToInspectTok, + OpenLedgerToInspectDescriptionTxt, + Database::"Item Ledger Entry", + Database::"Qlty. Inspection Header", + QltyInspectSourceConfig, + 'WHERE(Open=CONST(true))'); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Document No."), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Document No."), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Item No."), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Item No."), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Remaining Quantity"), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Quantity (Base)"), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Variant Code"), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Variant Code"), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Lot No."), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Lot No."), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Serial No."), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Serial No."), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Package No."), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Source Package No."), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo(Description), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo(Description), + ''); + EnsureSourceConfigLineExists( + QltyInspectSourceConfig, + TempItemLedgerEntry.FieldNo("Location Code"), + Database::"Qlty. Inspection Header", + TempQltyInspectionHeader.FieldNo("Location Code"), + ''); + end; + local procedure CreateDefaultProdOrderRoutingLineToItemJournalLineConfiguration() var QltyInspectSourceConfig: Record "Qlty. Inspect. Source Config.";