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 @@ -5,6 +5,7 @@
namespace Microsoft.Manufacturing.Subcontracting;

using Microsoft.Foundation.Company;
using Microsoft.Manufacturing.Setup;
using System.Environment.Configuration;

codeunit 99001502 "Subc. Business Setup Ext."
Expand All @@ -19,7 +20,7 @@ codeunit 99001502 "Subc. Business Setup Ext."
var
ManualSetupCategory: Enum "Manual Setup Category";
begin
sender.InsertManualSetup(SubcontractingLbl, SubcontractingLbl, SubcontractingDescriptionLbl, 0, ObjectType::Page, Page::"Subc. Management Setup", ManualSetupCategory::Uncategorized, SubcontractingKeyWordsLbl);
sender.InsertManualSetup(SubcontractingLbl, SubcontractingLbl, SubcontractingDescriptionLbl, 0, ObjectType::Page, Page::"Manufacturing Setup", ManualSetupCategory::Uncategorized, SubcontractingKeyWordsLbl);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

$\textbf{🟡\ Medium\ Severity\ —\ Upgrade} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Manual Setup entry opens unscoped Manufacturing Setup

The "Subcontracting App" manual setup entry now navigates users to the generic Manufacturing Setup page instead of the former dedicated Subc. Management Setup page. Users searching for subcontracting configuration will land on a page that exposes all manufacturing settings, making it easy to accidentally modify unrelated fields.

Recommendation:

  • If a subcontracting-specific setup page is not yet ready, consider either removing the manual setup registration entirely until a replacement page exists, or routing to a page that filters to only the subcontracting-relevant fields.
Suggested change
sender.InsertManualSetup(SubcontractingLbl, SubcontractingLbl, SubcontractingDescriptionLbl, 0, ObjectType::Page, Page::"Manufacturing Setup", ManualSetupCategory::Uncategorized, SubcontractingKeyWordsLbl);
// Option A: Remove the manual setup registration until a dedicated page is available
// (delete the OnRegisterManualSetup event subscriber)
// Option B: Keep but update the description to clarify the page scope
sender.InsertManualSetup(SubcontractingLbl, SubcontractingLbl, ManufacturingSetupDescriptionLbl, 0, ObjectType::Page, Page::"Manufacturing Setup", ManualSetupCategory::Manufacturing, SubcontractingKeyWordsLbl);

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

end;

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Company-Initialize", OnCompanyInitialize, '', false, false)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ codeunit 99001503 "Subcontracting Comp. Init."

procedure CreateBasicSubcontractingMgtSetup()
begin
CreateSubcontractingManagementSetup();
InitializeManufacturingSetupDefaults();
end;

local procedure CreateSubcontractingManagementSetup()
local procedure InitializeManufacturingSetupDefaults()
var
ManufacturingSetup: Record "Manufacturing Setup";
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ permissionset 99001503 "Subcontract. - Edit"
IncludedPermissionSets = "Subcontract. - Read";

Permissions =
tabledata "Subc. Management Setup" = IMD,
tabledata "Subcontractor Price" = IMD,
tabledata "Subcontractor WIP Ledger Entry" = IMD;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ permissionset 99001501 "Subcontract. - Objs"
Access = Internal;
Permissions =
// Tables
table "Subc. Management Setup" = X,
table "Subcontractor Price" = X,
table "Subcontractor WIP Ledger Entry" = X,

Expand All @@ -23,17 +22,13 @@ permissionset 99001501 "Subcontract. - Objs"
codeunit "Subc. Calc BOM Tree Ext." = X,
codeunit "Subc. Calc Subcontracts Ext." = X,
codeunit "Subc. Carry Out Action Ext." = X,
codeunit "Subc. Create Prod. Ord. Opt." = X,
codeunit "Subc. Create Prod. Rtng. Ext." = X,
codeunit "Subc. CrPurchSubcon(Yes/No)" = X,
codeunit "Subc. DirectTransferLine Ext." = X,
codeunit "Subc. Comp. Factbox Mgmt." = X,
codeunit "Subc. ProdO. Factbox Mgmt." = X,
codeunit "Subc. Purch. Factbox Mgmt." = X,
codeunit "Subc. Routing Factbox Mgmt." = X,
codeunit "Subc. ItemChargeAssPurchExt" = X,
codeunit "Subc. Item Extension" = X,
codeunit "Subc. ItemJnlCheckExt" = X,
codeunit "Subc. ItemJnlPostLine Ext" = X,
codeunit "Subc. Notification Mgmt." = X,
codeunit "Subc. Planning Comp. Ext." = X,
Expand All @@ -42,7 +37,6 @@ permissionset 99001501 "Subcontract. - Objs"
codeunit "Subc. Prod. Order Comp. Ext." = X,
codeunit "Subc. Prod. Order Rtng. Ext." = X,
codeunit "Subc. Prod. Ord. Comp. Res." = X,
codeunit "Subc. ProdOrderCreateBind" = X,
codeunit "Subc. Purch. Post Ext" = X,
codeunit "Subc. Purchase Header Ext" = X,
codeunit "Subc. Purchase Line Ext" = X,
Expand All @@ -53,8 +47,6 @@ permissionset 99001501 "Subcontract. - Objs"
codeunit "Subcontracting Management" = X,
codeunit "Subcontracting Management Ext." = X,
codeunit "Subc. Synchronize Management" = X,
codeunit "Subc. Temp Data Initializer" = X,
codeunit "Subc. TempProdOrdBind" = X,
codeunit "Subc. Transfer Line Ext." = X,
codeunit "Subc. Transfer Rcpt Line Ext." = X,
codeunit "Subc. Transfer Shpt Line Ext." = X,
Expand All @@ -64,7 +56,6 @@ permissionset 99001501 "Subcontract. - Objs"
codeunit "Subc. Trans Rcpt Header Ext" = X,
codeunit "Subc. Trans Shpt Header Ext" = X,
codeunit "Subc. Vendor Extension" = X,
codeunit "Subc. Version Mgmt." = X,
codeunit "Subc. WhsePostReceipt Ext" = X,
codeunit "Subc. WhsePurchRelease Ext" = X,
codeunit "Subc. Work Center Extension" = X,
Expand All @@ -79,15 +70,9 @@ permissionset 99001501 "Subcontract. - Objs"
codeunit "Subc. WIP Item Ledg Find Entry" = X,

// Pages
page "Subc. Management Setup" = X,
page "Subc. Prod. Order Components" = X,
page "Subc. Purchase Line Factbox" = X,
page "Subc. PurchProvisionWizard" = X,
page "Subc. Routing Info Factbox" = X,
page "Subc. Temp BOM Lines" = X,
page "Subc. Temp Prod Order Comp" = X,
page "Subc. TempProdOrdRtngLines" = X,
page "Subc. Temp Routing Lines" = X,
page "Subc. Transfer Line Factbox" = X,
page "Subcontractor Prices" = X,
page "Subc. WIP Adjustment" = X,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ permissionset 99001502 "Subcontract. - Read"
IncludedPermissionSets = "Subcontract. - Objs";

Permissions =
tabledata "Subc. Management Setup" = R,
tabledata "Subcontractor Price" = R,
tabledata "Subcontractor WIP Ledger Entry" = R;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Manufacturing.Subcontracting;

using Microsoft.Manufacturing.Setup;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.History;

codeunit 99001536 "Subc. ItemChargeAssPurchExt"
{
var
SubcManagementSetup: Record "Subc. Management Setup";
ManufacturingSetup: Record "Manufacturing Setup";

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Item Charge Assgnt. (Purch.)", OnBeforeCreateRcptChargeAssgnt, '', false, false)]
local procedure "Item Charge Assgnt. (Purch.)_OnBeforeCreateRcptChargeAssgnt"(var FromPurchRcptLine: Record "Purch. Rcpt. Line"; ItemChargeAssignmentPurch: Record "Item Charge Assignment (Purch)"; var IsHandled: Boolean)
begin
if not SubcManagementSetup.ItemChargeToRcptSubReferenceEnabled() then
if not ManufacturingSetup.ItemChargeToRcptSubReferenceEnabled() then
exit;

IsHandled := true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ using Microsoft.Inventory.Ledger;
using Microsoft.Inventory.Posting;
using Microsoft.Inventory.Tracking;
using Microsoft.Manufacturing.Capacity;
using Microsoft.Manufacturing.Setup;
using Microsoft.Purchases.Document;
using Microsoft.Purchases.History;
using Microsoft.Purchases.Posting;
codeunit 99001535 "Subc. Purch. Post Ext"
{
var
SubcManagementSetup: Record "Subc. Management Setup";
ManufacturingSetup: Record "Manufacturing Setup";

[EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch.-Post", OnBeforeItemJnlPostLine, '', false, false)]
local procedure "Purch.-Post_OnBeforeItemJnlPostLine"(var ItemJournalLine: Record "Item Journal Line"; TempItemChargeAssignmentPurch: Record "Item Charge Assignment (Purch)" temporary)
Expand All @@ -44,7 +45,7 @@ codeunit 99001535 "Subc. Purch. Post Ext"
var
PurchRcptLine: Record "Purch. Rcpt. Line";
begin
if not SubcManagementSetup.ItemChargeToRcptSubReferenceEnabled() then
if not ManufacturingSetup.ItemChargeToRcptSubReferenceEnabled() then
exit;
if ItemJournalLine."Item Charge No." = '' then
exit;
Expand All @@ -60,7 +61,7 @@ codeunit 99001535 "Subc. Purch. Post Ext"
var
UnitofMeasureManagement: Codeunit "Unit of Measure Management";
begin
if not SubcManagementSetup.ItemChargeToRcptSubReferenceEnabled() then
if not ManufacturingSetup.ItemChargeToRcptSubReferenceEnabled() then
exit;

if PurchRcptLine."Quantity (Base)" = 0 then
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ using Microsoft.Purchases.Document;
codeunit 99001508 "Subc. Price Management"
{
var
SubcManagementSetup: Record "Subc. Management Setup";
ManufacturingSetup: Record "Manufacturing Setup";

procedure ApplySubcontractorPricingToProdOrderRouting(var ProdOrderLine: Record "Prod. Order Line"; var RoutingLine: Record "Routing Line"; var ProdOrderRoutingLine: Record "Prod. Order Routing Line")
var
SubcontractorPrice: Record "Subcontractor Price";
WorkCenter: Record "Work Center";
begin
if not SubcManagementSetup.Get() then
if not ManufacturingSetup.Get() then
exit;

if ProdOrderRoutingLine.Type <> "Capacity Type Routing"::"Work Center" then
Expand Down Expand Up @@ -67,7 +67,7 @@ codeunit 99001508 "Subc. Price Management"
SubcontractorPrice: Record "Subcontractor Price";
WorkCenter: Record "Work Center";
begin
if not SubcManagementSetup.Get() then
if not ManufacturingSetup.Get() then
exit;

if RoutingLine.Type <> "Capacity Type Routing"::"Work Center" then
Expand Down Expand Up @@ -108,7 +108,6 @@ codeunit 99001508 "Subc. Price Management"
procedure CalcStandardCostOnAfterCalcRtngLineCost(RoutingLine: Record "Routing Line"; MfgItemQtyBase: Decimal; var SLSub: Decimal)
var
Item: Record Item;
ManufacturingSetup: Record "Manufacturing Setup";
WorkCenter: Record "Work Center";
MfgCostCalculationMgt: Codeunit "Mfg. Cost Calculation Mgt.";
SubcSessionState: Codeunit "Subc. Session State";
Expand All @@ -122,7 +121,7 @@ codeunit 99001508 "Subc. Price Management"
UnitCost: Decimal;
UnitCostCalculationType: Enum "Unit Cost Calculation Type";
begin
if not SubcManagementSetup.Get() then
if not ManufacturingSetup.Get() then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

$\textbf{🟡\ Medium\ Severity\ —\ Performance} \quad \color{gray}{\texttt{\small Iteration\ 1}}$

Double Get() on same record in CalcStandardCost

In CalcStandardCostOnAfterCalcRtngLineCost, the instance variable ManufacturingSetup is fetched with ManufacturingSetup.Get() at line 124 as an early-exit guard (loading all fields), and then fetched again with ManufacturingSetup.SetLoadFields("Cost Incl. Setup") + ManufacturingSetup.Get() at lines 158–159. The second fetch is redundant since the record is already loaded.

Recommendation:

  • Remove the early-exit ManufacturingSetup.Get() at line 124 and instead consolidate to a single SetLoadFields + Get() call before the first field access, or check existence separately without a full load.
Suggested change
if not ManufacturingSetup.Get() then
begin
ManufacturingSetup.SetLoadFields("Cost Incl. Setup");
if not ManufacturingSetup.Get() then
exit;
// ... rest of guard checks ...
// Use ManufacturingSetup."Cost Incl. Setup" directly — no second Get() needed

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why

exit;

if RoutingLine.Type <> "Capacity Type Routing"::"Work Center" then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,4 @@ codeunit 99001560 "Subc. Purch. Factbox Mgmt."
TransferLine.SetFilter("Operation No.", '<>%1', '');
TransferLine.SetFilter("Routing No.", '<>%1', '');
end;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ using System.Utilities;
codeunit 99001557 "Subc. Purchase Order Creator"
{
var
SubcManagementSetup: Record "Subc. Management Setup";
ManufacturingSetup: Record "Manufacturing Setup";
PageManagement: Codeunit "Page Management";
UnitofMeasureManagement: Codeunit "Unit of Measure Management";
HasSubManagementSetup: Boolean;
HasManufacturingSetup: Boolean;
OperationNo: Code[10];
PurchOrderCreatedTxt: Label '%1 Purchase Order(s) created.\\Do you want to view them?', Comment = '%1 = No of Purchase Order(s) created.';
Expand Down Expand Up @@ -113,7 +111,7 @@ codeunit 99001557 "Subc. Purchase Order Creator"
SubContractorWorkCenterNo: Code[20];
DimensionSetIDArr: array[10] of Integer;
begin
GetSubmanagementSetup();
GetManufacturingSetup();
ProdOrderRoutingLine.SetLoadFields("Work Center No.", Status, "Prod. Order No.", "Routing Link Code");
if ProdOrderRoutingLine.Get("Production Order Status"::Released, RequisitionLine."Prod. Order No.", RequisitionLine."Routing Reference No.", RequisitionLine."Routing No.", RequisitionLine."Operation No.") then begin
WorkCenter.SetLoadFields("Subcontractor No.");
Expand Down Expand Up @@ -359,14 +357,6 @@ codeunit 99001557 "Subc. Purchase Order Creator"
exit(BaseQuantityToPurch);
end;

local procedure GetSubmanagementSetup()
begin
if HasSubManagementSetup then
exit;
if SubcManagementSetup.Get() then
HasSubManagementSetup := true;
end;

local procedure GetManufacturingSetup()
begin
if HasManufacturingSetup then
Expand Down
Loading
Loading