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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
/// <param name="ScheduleGroup">The schedule group code to check and potentially create a job queue entry for</param>
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;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -32,8 +32,6 @@ report 20412 "Qlty. Schedule Inspection"

trigger OnPreDataItem()
begin
if CurrentInspectionGenerationRule.GetFilter("Schedule Group") = '' then
Error(ScheduleGroupIsMandatoryErr);
end;
}
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -110,17 +107,15 @@ 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.");
if QltyInspectionGenRule."Condition Filter" <> '' then
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -242,6 +244,7 @@ codeunit 20402 "Qlty. Auto Configure"
CreateDefaultProductionAndAssemblyConfiguration();
CreateDefaultReceivingConfiguration();
CreateDefaultWarehousingConfiguration();
CreateDefaultItemLedgerEntryOpenToInspectConfiguration();
end;

local procedure CreateDefaultTrackingSpecificationToInspectConfiguration()
Expand Down Expand Up @@ -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.";
Expand Down
Loading