Page 901 Assembly Order Subform, source in 29
Source29
src/Layers/W1/BaseApp/Assembly/Document/AssemblyOrderSubform.Page.al629 lines, Copyright (c) Microsoft Corporation. MIT
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------
namespace Microsoft.Assembly.Document;
using Microsoft.Assembly.Comment;
using Microsoft.Finance.Dimension;
using Microsoft.Inventory.Availability;
using Microsoft.Inventory.Item;
using Microsoft.Inventory.Location;
page 901 "Assembly Order Subform"
{
AutoSplitKey = true;
Caption = 'Lines';
DelayedInsert = true;
PageType = ListPart;
PopulateAllFields = true;
SourceTable = "Assembly Line";
layout
{
area(content)
{
repeater(Group)
{
field("Avail. Warning"; Rec."Avail. Warning")
{
ApplicationArea = Assembly;
BlankZero = true;
DrillDown = true;
trigger OnDrillDown()
begin
Rec.ShowAvailabilityWarningPage();
end;
}
field(Type; Rec.Type)
{
ApplicationArea = Assembly;
}
field("No."; Rec."No.")
{
ApplicationArea = Assembly;
trigger OnValidate()
var
Item: Record "Item";
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
ReserveItem();
if Rec."Variant Code" = '' then
VariantCodeMandatory := Item.IsVariantMandatory(Rec.Type = Rec.Type::Item, Rec."No.");
end;
}
field(Description; Rec.Description)
{
ApplicationArea = Assembly;
}
field("Description 2"; Rec."Description 2")
{
ApplicationArea = Assembly;
Visible = false;
}
field("Variant Code"; Rec."Variant Code")
{
ApplicationArea = Planning;
ShowMandatory = VariantCodeMandatory;
trigger OnValidate()
var
Item: Record "Item";
begin
ReserveItem();
if Rec."Variant Code" = '' then
VariantCodeMandatory := Item.IsVariantMandatory(Rec.Type = Rec.Type::Item, Rec."No.");
end;
}
field("Location Code"; Rec."Location Code")
{
ApplicationArea = Location;
trigger OnValidate()
begin
Rec.ShowShortcutDimCode(ShortcutDimCode);
ReserveItem();
end;
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ApplicationArea = Assembly;
trigger OnValidate()
begin
ReserveItem();
end;
}
field("Quantity per"; Rec."Quantity per")
{
ApplicationArea = Assembly;
trigger OnValidate()
begin
ReserveItem();
end;
}
field(Quantity; Rec.Quantity)
{
ApplicationArea = Assembly;
trigger OnValidate()
begin
ReserveItem();
end;
}
field("Quantity to Consume"; Rec."Quantity to Consume")
{
ApplicationArea = Assembly;
}
field("Consumed Quantity"; Rec."Consumed Quantity")
{
ApplicationArea = Assembly;
}
field("Remaining Quantity"; Rec."Remaining Quantity")
{
ApplicationArea = Assembly;
}
field("Qty. Picked"; Rec."Qty. Picked")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Pick Qty."; Rec."Pick Qty.")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Assembly;
Visible = false;
trigger OnValidate()
begin
ReserveItem();
end;
}
field("Lead-Time Offset"; Rec."Lead-Time Offset")
{
ApplicationArea = Assembly;
Visible = false;
}
field("Bin Code"; Rec."Bin Code")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Inventory Posting Group"; Rec."Inventory Posting Group")
{
ApplicationArea = Assembly;
Visible = false;
}
field("Unit Cost"; Rec."Unit Cost")
{
ApplicationArea = Assembly;
}
field("Cost Amount"; Rec."Cost Amount")
{
ApplicationArea = Assembly;
}
field("Reserved Quantity"; Rec."Reserved Quantity")
{
ApplicationArea = Reservation;
}
field(Reserve; Rec.Reserve)
{
ApplicationArea = Reservation;
Visible = false;
trigger OnValidate()
begin
ReserveItem();
end;
}
field(ReservationStatusField; ReservationStatusField)
{
ApplicationArea = Reservation;
Caption = 'Reservation Status';
Editable = false;
OptionCaption = ' ,Partial,Full';
ToolTip = 'Specifies if the value in the Quantity field on the assembly order line is fully or partially reserved.';
Visible = false;
}
field("Qty. per Unit of Measure"; Rec."Qty. per Unit of Measure")
{
ApplicationArea = Assembly;
}
field("Resource Usage Type"; Rec."Resource Usage Type")
{
ApplicationArea = Assembly;
}
field("Appl.-to Item Entry"; Rec."Appl.-to Item Entry")
{
ApplicationArea = Assembly;
}
field("Appl.-from Item Entry"; Rec."Appl.-from Item Entry")
{
ApplicationArea = Assembly;
}
field("Gen. Bus. Posting Group"; Rec."Gen. Bus. Posting Group")
{
ApplicationArea = Assembly;
Visible = false;
}
field("Shortcut Dimension 1 Code"; Rec."Shortcut Dimension 1 Code")
{
ApplicationArea = Dimensions;
Visible = false;
}
field("Shortcut Dimension 2 Code"; Rec."Shortcut Dimension 2 Code")
{
ApplicationArea = Dimensions;
Visible = false;
}
field("ShortcutDimCode[3]"; ShortcutDimCode[3])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,3';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(3),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible3;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(3, ShortcutDimCode[3]);
end;
}
field("ShortcutDimCode[4]"; ShortcutDimCode[4])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,4';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(4),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible4;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(4, ShortcutDimCode[4]);
end;
}
field("ShortcutDimCode[5]"; ShortcutDimCode[5])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,5';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(5),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible5;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(5, ShortcutDimCode[5]);
end;
}
field("ShortcutDimCode[6]"; ShortcutDimCode[6])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,6';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(6),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible6;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(6, ShortcutDimCode[6]);
end;
}
field("ShortcutDimCode[7]"; ShortcutDimCode[7])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,7';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(7),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible7;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(7, ShortcutDimCode[7]);
end;
}
field("ShortcutDimCode[8]"; ShortcutDimCode[8])
{
ApplicationArea = Dimensions;
CaptionClass = '1,2,8';
TableRelation = "Dimension Value".Code where("Global Dimension No." = const(8),
"Dimension Value Type" = const(Standard),
Blocked = const(false));
Visible = DimVisible8;
trigger OnValidate()
begin
Rec.ValidateShortcutDimCode(8, ShortcutDimCode[8]);
end;
}
}
}
}
actions
{
area(processing)
{
group("&Line")
{
Caption = '&Line';
Image = Line;
group("Item Availability by")
{
Caption = 'Item Availability by';
Image = ItemAvailability;
action("Event")
{
ApplicationArea = Assembly;
Caption = 'Event';
Image = "Event";
ToolTip = 'View how the actual and the projected available balance of an item will develop over time according to supply and demand events.';
trigger OnAction()
begin
AssemblyAvailabilityMgt.ShowItemAvailabilityFromAsmLine(Rec, "Item Availability Type"::"Event");
end;
}
action(Period)
{
ApplicationArea = Assembly;
Caption = 'Period';
Image = Period;
ToolTip = 'View the projected quantity of the item over time according to time periods, such as day, week, or month.';
trigger OnAction()
begin
AssemblyAvailabilityMgt.ShowItemAvailabilityFromAsmLine(Rec, "Item Availability Type"::Period);
end;
}
action(Variant)
{
ApplicationArea = Planning;
Caption = 'Variant';
Image = ItemVariant;
ToolTip = 'View or edit the item''s variants. Instead of setting up each color of an item as a separate item, you can set up the various colors as variants of the item.';
trigger OnAction()
begin
AssemblyAvailabilityMgt.ShowItemAvailabilityFromAsmLine(Rec, "Item Availability Type"::Variant);
end;
}
action(Location)
{
AccessByPermission = TableData Location = R;
ApplicationArea = Location;
Caption = 'Location';
Image = Warehouse;
ToolTip = 'View the actual and projected quantity of the item per location.';
trigger OnAction()
begin
AssemblyAvailabilityMgt.ShowItemAvailabilityFromAsmLine(Rec, "Item Availability Type"::Location);
end;
}
action(Lot)
{
ApplicationArea = ItemTracking;
Caption = 'Lot';
Image = LotInfo;
RunObject = Page "Item Availability by Lot No.";
RunPageLink = "No." = field("No."),
"Location Filter" = field("Location Code"),
"Variant Filter" = field("Variant Code");
ToolTip = 'View the current and projected quantity of the item in each lot.';
}
action("BOM Level")
{
ApplicationArea = Assembly;
Caption = 'BOM Level';
Image = BOMLevel;
ToolTip = 'View availability figures for items on bills of materials that show how many units of a parent item you can make based on the availability of child items.';
trigger OnAction()
begin
AssemblyAvailabilityMgt.ShowItemAvailabilityFromAsmLine(Rec, "Item Availability Type"::BOM);
end;
}
}
action("Reservation Entries")
{
AccessByPermission = TableData Item = R;
ApplicationArea = Reservation;
Caption = 'Reservation Entries';
Image = ReservationLedger;
ToolTip = 'View the entries for every reservation that is made, either manually or automatically.';
trigger OnAction()
begin
Rec.ShowReservationEntries(true);
end;
}
action("Item Tracking Lines")
{
ApplicationArea = ItemTracking;
Caption = 'Item &Tracking Lines';
Image = ItemTrackingLines;
ShortCutKey = 'Ctrl+Alt+I';
ToolTip = 'View or edit serial, lot and package numbers that are assigned to the item on the document or journal line.';
trigger OnAction()
begin
Rec.OpenItemTrackingLines();
end;
}
action("Show Warning")
{
ApplicationArea = Assembly;
Caption = 'Show Warning';
Image = ShowWarning;
ToolTip = 'View details about availability issues.';
trigger OnAction()
begin
Rec.ShowAvailabilityWarningPage();
end;
}
action(Dimensions)
{
AccessByPermission = TableData Dimension = R;
ApplicationArea = Dimensions;
Caption = 'Dimensions';
Image = Dimensions;
ShortCutKey = 'Alt+D';
ToolTip = 'View or edit dimensions, such as area, project, or department, that you can assign to sales and purchase documents to distribute costs and analyze transaction history.';
trigger OnAction()
begin
Rec.ShowDimensions();
end;
}
action("Co&mments")
{
ApplicationArea = Comments;
Caption = 'Co&mments';
Image = ViewComments;
RunObject = Page "Assembly Comment Sheet";
RunPageLink = "Document Type" = field("Document Type"),
"Document No." = field("Document No."),
"Document Line No." = field("Line No.");
ToolTip = 'View or add comments for the record.';
}
action(AssemblyBOM)
{
ApplicationArea = Assembly;
Caption = 'Assembly BOM';
Image = AssemblyBOM;
ToolTip = 'View or edit the bill of material that specifies which items and resources are required to assemble the assembly item.';
trigger OnAction()
begin
Rec.ShowAssemblyList();
end;
}
}
group("F&unctions")
{
Caption = 'F&unctions';
Image = "Action";
action(SelectItemSubstitution)
{
ApplicationArea = Assembly;
Caption = 'Select Item Substitution';
Image = SelectItemSubstitution;
ToolTip = 'Select another item that has been set up to be traded instead of the original item if it is unavailable.';
trigger OnAction()
begin
CurrPage.SaveRecord();
Rec.ShowItemSub();
CurrPage.Update(true);
if (Rec.Reserve = Rec.Reserve::Always) and (Rec."No." <> xRec."No.") then begin
Rec.AutoReserve();
CurrPage.Update(false);
end;
end;
}
action(ExplodeBOM)
{
ApplicationArea = Assembly;
Caption = 'E&xplode BOM';
Image = ExplodeBOM;
ToolTip = 'Insert new lines for the components on the bill of materials, for example to sell the parent item as a kit. CAUTION: The line for the parent item will be deleted and represented by a description only. To undo, you must delete the component lines and add a line the parent item again.';
trigger OnAction()
begin
Rec.ExplodeAssemblyList();
CurrPage.Update();
end;
}
action("Reserve Item")
{
ApplicationArea = Reservation;
Caption = '&Reserve';
Ellipsis = true;
Image = Reserve;
ToolTip = 'Reserve the quantity that is required on the document line that you opened this window for.';
trigger OnAction()
begin
Rec.ShowReservation();
end;
}
action("Order &Tracking")
{
ApplicationArea = Planning;
Caption = 'Order &Tracking';
Image = OrderTracking;
ToolTip = 'Tracks the connection of a supply to its corresponding demand. This can help you find the original demand that created a specific production order or purchase order.';
trigger OnAction()
begin
Rec.ShowTracking();
end;
}
}
}
}
trigger OnAfterGetRecord()
var
Item: Record "Item";
begin
Rec.UpdateAndPersistAvailWarning();
Rec.ShowShortcutDimCode(ShortcutDimCode);
ReservationStatusField := Rec.ReservationStatus();
if Rec."Variant Code" = '' then
VariantCodeMandatory := Item.IsVariantMandatory(Rec.Type = Rec.Type::Item, Rec."No.");
end;
trigger OnDeleteRecord(): Boolean
var
AssemblyLineReserve: Codeunit "Assembly Line-Reserve";
begin
if (Rec.Quantity <> 0) and Rec.ItemExists(Rec."No.") then begin
Commit();
if not AssemblyLineReserve.DeleteLineConfirm(Rec) then
exit(false);
AssemblyLineReserve.DeleteLine(Rec);
end;
end;
trigger OnNewRecord(BelowxRec: Boolean)
begin
Clear(ShortcutDimCode);
end;
trigger OnOpenPage()
begin
SetDimensionsVisibility();
end;
var
AssemblyAvailabilityMgt: Codeunit "Assembly Availability Mgt.";
ReservationStatusField: Option " ",Partial,Full;
VariantCodeMandatory: Boolean;
protected var
ShortcutDimCode: array[8] of Code[20];
DimVisible1: Boolean;
DimVisible2: Boolean;
DimVisible3: Boolean;
DimVisible4: Boolean;
DimVisible5: Boolean;
DimVisible6: Boolean;
DimVisible7: Boolean;
DimVisible8: Boolean;
protected procedure ReserveItem()
begin
if Rec.Type <> Rec.Type::Item then
exit;
if (Rec."Remaining Quantity (Base)" <> xRec."Remaining Quantity (Base)") or
(Rec."No." <> xRec."No.") or
(Rec."Location Code" <> xRec."Location Code") or
(Rec."Variant Code" <> xRec."Variant Code") or
(Rec."Due Date" <> xRec."Due Date") or
((Rec.Reserve <> xRec.Reserve) and (Rec."Remaining Quantity (Base)" <> 0))
then
if Rec.Reserve = Rec.Reserve::Always then begin
CurrPage.SaveRecord();
Rec.AutoReserve();
CurrPage.Update(false);
end;
ReservationStatusField := Rec.ReservationStatus();
end;
local procedure SetDimensionsVisibility()
var
DimMgt: Codeunit DimensionManagement;
begin
DimVisible1 := false;
DimVisible2 := false;
DimVisible3 := false;
DimVisible4 := false;
DimVisible5 := false;
DimVisible6 := false;
DimVisible7 := false;
DimVisible8 := false;
DimMgt.UseShortcutDims(
DimVisible1, DimVisible2, DimVisible3, DimVisible4, DimVisible5, DimVisible6, DimVisible7, DimVisible8);
Clear(DimMgt);
end;
}