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
Binary file not shown.
Binary file not shown.
12 changes: 8 additions & 4 deletions src/Apps/W1/Quality Management/app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
"help": "https://go.microsoft.com/fwlink/?linkid=2338953",
"url": "https://go.microsoft.com/fwlink/?LinkId=724011",
"logo": "ExtensionLogo.png",
"dependencies": [],
"dependencies": [
{
"id": "5a0b41e9-7a42-4123-d521-2265186cfb31",
"name": "Contoso Coffee Demo Dataset",
"publisher": "Microsoft",
"version": "28.0.0.0"
}
],
"screenshots": [],
"platform": "28.0.0.0",
"application": "28.0.0.0",
Expand All @@ -26,9 +33,6 @@
"includeSourceInSymbolFile": true,
"allowDownloadingSource": true
},
"resourceFolders": [
"Resources"
],
"features": [
"NoImplicitWith",
"TranslationFile"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@ using Microsoft.Inventory.Tracking;
using Microsoft.Inventory.Transfer;
using Microsoft.Manufacturing.Document;
using Microsoft.Purchases.Document;
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.Document;
using Microsoft.QualityManagement.Setup;
using Microsoft.Sales.Document;
using Microsoft.Warehouse.Document;
using Microsoft.Warehouse.Journal;
using Microsoft.Warehouse.Ledger;
using System.IO;
using System.Utilities;

/// <summary>
/// Contains helper functions to use for automatic configuration.
Expand Down Expand Up @@ -1784,101 +1779,4 @@ codeunit 20402 "Qlty. Auto Configure"
QltyInspectSrcFldConf.Insert();
end;
end;

/// <summary>
/// GuessDoesAppearToBeSetup will guess if the system appears to be setup.
/// Use this if you need to not just make sure that Quality Management is installed but some basic setup has been done.
/// </summary>
/// <returns>Return value of type Boolean.</returns>
procedure GuessDoesAppearToBeSetup(): Boolean
var
QltyInspectionGenRule: Record "Qlty. Inspection Gen. Rule";
QltyInspectionTemplateHdr: Record "Qlty. Inspection Template Hdr.";
QltyTest: Record "Qlty. Test";
QltyInspectionResult: Record "Qlty. Inspection Result";
begin
case true of
QltyInspectionGenRule.IsEmpty(),
QltyInspectionTemplateHdr.IsEmpty(),
QltyTest.IsEmpty(),
QltyInspectionResult.IsEmpty():
exit(false);
end;

exit(true);
end;

/// <summary>
/// GuessDoesAppearToBeUsed will guess if it's used.
/// Use this if you need to guess if the system is not just probably setup enough, but also appears to have actual usage.
/// </summary>
/// <returns>Return value of type Boolean.</returns>
procedure GuessDoesAppearToBeUsed(): Boolean
var
QltyInspectionLine: Record "Qlty. Inspection Line";
begin
exit(QltyInspectionLine.Count() > 2);
end;

/// <summary>
/// Apply any settings files from the public endpoint
/// </summary>
/// <param name="CurrentCommit">Boolean.</param>
procedure ApplyGettingStartedData(CurrentCommit: Boolean)
begin
if CurrentCommit then
Commit();
ApplyConfigurationPackage();
if CurrentCommit then
Commit();
end;

/// <summary>
/// Apply the configuration package.
/// </summary>
procedure ApplyConfigurationPackage()
begin
ApplyConfigurationPackageFromResource(ResourceBasedInstallFileTok);
UpdateResultCategoryOnResultsInSystem();
end;

local procedure UpdateResultCategoryOnResultsInSystem()
var
QltyInspectionResult: Record "Qlty. Inspection Result";
begin
QltyInspectionResult.SetRange("Result Category", QltyInspectionResult."Result Category"::Uncategorized);
if QltyInspectionResult.FindSet(true) then
repeat
case QltyInspectionResult.Code of
'PASS', 'GOOD', 'ACCEPTABLE':
begin
QltyInspectionResult."Result Category" := QltyInspectionResult."Result Category"::Acceptable;
QltyInspectionResult.Modify(false);
end;
'FAIL', 'BAD', 'UNACCEPTABLE', 'ERROR', 'REJECT':
begin
QltyInspectionResult."Result Category" := QltyInspectionResult."Result Category"::"Not acceptable";
QltyInspectionResult.Modify(false);
end;
end;
until QltyInspectionResult.Next() = 0;
end;

/// <summary>
/// Apply the supplied configuration package.
/// </summary>
/// <param name="ResourcePath">reference to the internal resource location</param>
procedure ApplyConfigurationPackageFromResource(ResourcePath: Text)
var
TempBlob: Codeunit "Temp Blob";
ConfigPackageImport: Codeunit "Config. Package - Import";
InStreamFromResource: InStream;
OutStreamToConfigPackage: OutStream;
begin
TempBlob.CreateInStream(InStreamFromResource);
TempBlob.CreateOutStream(OutStreamToConfigPackage);
NavApp.GetResource(ResourcePath, InStreamFromResource);
CopyStream(OutStreamToConfigPackage, InStreamFromResource);
ConfigPackageImport.ImportAndApplyRapidStartPackageStream(TempBlob);
end;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// ------------------------------------------------------------------------------------------------
namespace Microsoft.QualityManagement.Setup.SetupWizard;

using Microsoft.DemoTool;
using Microsoft.QualityManagement.Configuration;
using Microsoft.QualityManagement.Configuration.GenerationRule;
using Microsoft.QualityManagement.Document;
Expand Down Expand Up @@ -69,25 +70,33 @@ page 20438 "Qlty. Management Setup Wizard"
InstructionalText = 'This wizard will guide you through the initial setup required to perform quality inspections.';
}
}
group(SettingsFor_StepGettingStarted)
group(DemoData)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get this reviewed by the UX team

{
Caption = 'Apply Getting Started Data?';
Visible = (StepGettingStarted = CurrentStepCounter);
InstructionalText = 'Would you like to apply getting started data?';
Caption = 'Demo data for Quality Management';
Visible = (StepDemoData = CurrentStepCounter);

group(SettingsFor_ApplyConfigurationPackage)
group(DemoDataIntroduction)
{
Caption = 'What Is Getting Started Data?';
InstructionalText = 'Getting started data for Quality Management will include basic setup data and also some useful examples or other demonstration data. Getting Started data can help you get running quickly, or help you with evaluating if the application is a fit more quickly. Very basic setup data for common integration scenarios will still be applied if you choose not to apply the getting started data. If you do not want this data, or if you have been previously set up then do not apply this configuration.';
Caption = 'Demo data for Quality Management';
InstructionalText = 'The Quality Management application includes demo data available as a Contoso Demo Tool module. Here is how to get started with it.';
}

field(ChooseApplyConfigurationPackage; ApplyConfigurationPackage)
{
ApplicationArea = Basic, Suite;
OptionCaption = 'Apply Getting Started Data,Do Not Apply Configuration';
Caption = 'Getting Started Data?';
ShowCaption = false;
ToolTip = 'Specifies a configuration package of getting-started data is available to automatically apply.';
}
group(DemoDataInstructions)
{
Caption = 'How to?';
InstructionalText = 'Navigate to the Contoso Demo Tool page. Then, select the Quality Management module, and click on the Generate action. This will install demo data including sample inspection templates, inspection generation rules, and quality inspections.';
}
field(LinkToContosoDemoToolPage; LinkToContosoDemoToolPageLbl)
{
Caption = 'Navigate to Contoso Demo Tool';
ShowCaption = false;
Editable = false;
ApplicationArea = QualityManagement;

trigger OnDrillDown()
begin
Page.RunModal(Page::"Contoso Demo Tool");
end;
}
}
group(SettingsFor_StepWhatAreYouMakingQltyInspectionsFor)
Expand Down Expand Up @@ -499,19 +508,19 @@ page 20438 "Qlty. Management Setup Wizard"
IsPremiumExperienceEnabled: Boolean;
TopBannerVisible: Boolean;
StepWelcome: Integer;
StepGettingStarted: Integer;
StepDemoData: Integer;
StepReceivingConfig: Integer;
StepWhatAreYouMakingQltyInspectionsFor: Integer;
StepProductionConfig: Integer;
StepShowInspections: Integer;
StepDone: Integer;
MaxStep: Integer;
ApplyConfigurationPackage: Option "Apply Getting Started Data","Do Not Apply Configuration.";
ReRunThisWizardWithMorePermissionErr: Label 'It looks like you need more permissions to run this wizard successfully. Please ask your Business Central administrator to grant more permission.';
FinishWizardLbl: Label 'Finish wizard.', Locked = true;
QualityManagementTok: Label 'Quality Management', Locked = true;
QualityInspectionsLbl: Label 'Quality Inspections', Locked = true;
QualityInspectionGenerationRulesLbl: Label 'Quality Inspection Generation Rules', Locked = true;
LinkToContosoDemoToolPageLbl: Label 'Open Contoso Demo Tool', Locked = true;

trigger OnInit();
begin
Expand All @@ -520,7 +529,7 @@ page 20438 "Qlty. Management Setup Wizard"
CopyPreviousSetup();

StepWelcome := 1;
StepGettingStarted := 2;
StepDemoData := 2;
StepWhatAreYouMakingQltyInspectionsFor := 3;
StepProductionConfig := 4;
StepReceivingConfig := 5;
Expand Down Expand Up @@ -555,8 +564,6 @@ page 20438 "Qlty. Management Setup Wizard"
end;

local procedure ChangeToStep(Step: Integer);
var
GuidedExperience: Codeunit "Guided Experience";
begin
if Step < 1 then
Step := 1;
Expand All @@ -580,13 +587,6 @@ page 20438 "Qlty. Management Setup Wizard"
Commit();

QltyAutoConfigure.EnsureBasicSetupExists(false);
if GuidedExperience.IsAssistedSetupComplete(ObjectType::Page, Page::"Qlty. Management Setup Wizard") or
QltyAutoConfigure.GuessDoesAppearToBeSetup() or
QltyAutoConfigure.GuessDoesAppearToBeUsed()
then
ApplyConfigurationPackage := ApplyConfigurationPackage::"Do Not Apply Configuration."
else
ApplyConfigurationPackage := ApplyConfigurationPackage::"Apply Getting Started Data";
end;
StepWhatAreYouMakingQltyInspectionsFor:
begin
Expand Down Expand Up @@ -630,13 +630,9 @@ page 20438 "Qlty. Management Setup Wizard"
case LeavingThisStep of
StepWelcome:
Commit();
StepGettingStarted:
StepDemoData:
begin
GetLatestSetupRecord(true, true);
if ApplyConfigurationPackage = ApplyConfigurationPackage::"Apply Getting Started Data" then begin
QltyAutoConfigure.ApplyGettingStartedData(true);
Commit();
end;
Commit();
GetLatestSetupRecord(false, true);
end;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.DemoData.QualityManagement;

using Microsoft.DemoTool.Helpers;
using Microsoft.QualityManagement.Configuration.Result;

codeunit 5216 "Create Quality Insp. Result"
{
InherentEntitlements = X;
InherentPermissions = X;

trigger OnRun()
var
ContosoQualityManagement: Codeunit "Contoso Quality Management";
begin
ContosoQualityManagement.InsertQualityInspectionResult(Fail(), FailDescLbl, 1, Enum::"Qlty. Result Copy Behavior"::"Automatically copy the result", Enum::"Qlty. Result Visibility"::"Configuration only", '<>0', '<>""', 'No', Enum::"Qlty. Result Category"::"Not acceptable", Enum::"Qlty. Result Finish Allowed"::"Allow Finish");
ContosoQualityManagement.InsertQualityInspectionResult(InProgress(), InProgressDescLbl, 0, Enum::"Qlty. Result Copy Behavior"::"Automatically copy the result", Enum::"Qlty. Result Visibility"::"Configuration only", '', '', '', Enum::"Qlty. Result Category"::Uncategorized, Enum::"Qlty. Result Finish Allowed"::"Allow Finish");
ContosoQualityManagement.InsertQualityInspectionResult(Pass(), PassDescLbl, 2, Enum::"Qlty. Result Copy Behavior"::"Automatically copy the result", Enum::"Qlty. Result Visibility"::Promoted, '<>0', '<>""', 'Yes', Enum::"Qlty. Result Category"::Acceptable, Enum::"Qlty. Result Finish Allowed"::"Allow Finish");
end;

procedure Fail(): Code[20]
begin
exit(FailTok);
end;

procedure InProgress(): Code[20]
begin
exit(InProgressTok);
end;

procedure Pass(): Code[20]
begin
exit(PassTok);
end;

var
FailTok: Label 'FAIL', MaxLength = 20;
InProgressTok: Label 'INPROGRESS', MaxLength = 20;
PassTok: Label 'PASS', MaxLength = 20;

FailDescLbl: Label 'Fail', MaxLength = 100;
InProgressDescLbl: Label 'In Progress', MaxLength = 100;
PassDescLbl: Label 'Pass', MaxLength = 100;
}
Loading
Loading