Page 7345 Pick Worksheet, source in 29
Source29
src/Layers/W1/BaseApp/Warehouse/Worksheet/PickWorksheet.Page.al660 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.Warehouse.Worksheet;
using Microsoft.Foundation.UOM;
using Microsoft.Inventory.Item;
using Microsoft.Inventory.Ledger;
using Microsoft.Warehouse.Activity;
using Microsoft.Warehouse.CrossDock;
using Microsoft.Warehouse.Journal;
using Microsoft.Warehouse.Ledger;
using Microsoft.Warehouse.Request;
using Microsoft.Warehouse.Structure;
using System.Environment;
using System.Environment.Configuration;
using System.Integration;
using System.Integration.Excel;
page 7345 "Pick Worksheet"
{
ApplicationArea = Warehouse;
Caption = 'Pick Worksheets';
DataCaptionFields = Name;
InsertAllowed = false;
PageType = Worksheet;
AboutTitle = 'About Pick Worksheets';
AboutText = 'Create and manage pick worksheets to efficiently prepare, sort, and generate pick documents in bulk for released warehouse shipments, optimizing item handling and warehouse operations.';
RefreshOnActivate = true;
SaveValues = true;
SourceTable = "Whse. Worksheet Line";
SourceTableView = sorting("Worksheet Template Name", Name, "Location Code", "Sorting Sequence No.");
UsageCategory = Tasks;
layout
{
area(content)
{
field(CurrentWkshName; CurrentWkshName)
{
ApplicationArea = Warehouse;
Caption = 'Batch Name';
Lookup = true;
ToolTip = 'Specifies the name of the journal batch, a personalized journal layout, that the journal is based on.';
trigger OnLookup(var Text: Text): Boolean
begin
CurrPage.SaveRecord();
Rec.LookupWhseWkshName(Rec, CurrentWkshName, CurrentLocationCode);
CurrPage.Update(false);
end;
trigger OnValidate()
begin
Rec.CheckWhseWkshName(CurrentWkshName, CurrentLocationCode, Rec);
CurrentWkshNameOnAfterValidate();
end;
}
field(CurrentLocationCode; CurrentLocationCode)
{
ApplicationArea = Warehouse;
Caption = 'Location Code';
Editable = false;
ToolTip = 'Specifies the location where the warehouse activity takes place. ';
}
field(CurrentSortingMethod; CurrentSortingMethod)
{
ApplicationArea = Warehouse;
Caption = 'Sorting Method';
ToolTip = 'Specifies the method by which the movement lines are sorted.';
trigger OnValidate()
begin
CurrentSortingMethodOnAfterValidate();
end;
}
repeater(Control1)
{
ShowCaption = false;
field("Whse. Document Type"; Rec."Whse. Document Type")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("WhseDocumentType"; WhseDocumentType)
{
ApplicationArea = Warehouse;
Caption = 'Whse. Document Type';
ToolTip = 'Specifies the type of warehouse document this line is associated with.';
trigger OnValidate()
begin
Rec.Validate("Whse. Document Type", WhseDocumentType);
end;
}
field("Whse. Document No."; Rec."Whse. Document No.")
{
ApplicationArea = Warehouse;
}
field("Whse. Document Line No."; Rec."Whse. Document Line No.")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Item No."; Rec."Item No.")
{
ApplicationArea = Warehouse;
Editable = false;
trigger OnValidate()
begin
Rec.GetItem(Rec."Item No.", ItemDescription);
end;
}
field("Variant Code"; Rec."Variant Code")
{
ApplicationArea = Planning;
Editable = false;
Visible = false;
}
field(Description; Rec.Description)
{
ApplicationArea = Warehouse;
Editable = false;
}
field("Description 2"; Rec."Description 2")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("To Zone Code"; Rec."To Zone Code")
{
ApplicationArea = Warehouse;
Editable = false;
Visible = false;
}
field("To Bin Code"; Rec."To Bin Code")
{
ApplicationArea = Warehouse;
Editable = false;
Visible = false;
}
field("Shelf No."; Rec."Shelf No.")
{
ApplicationArea = Warehouse;
Visible = false;
}
field(Quantity; Rec.Quantity)
{
ApplicationArea = Warehouse;
Editable = false;
}
field("Qty. to Handle"; Rec."Qty. to Handle")
{
ApplicationArea = Warehouse;
trigger OnValidate()
begin
QtytoHandleOnAfterValidate();
end;
}
field("Qty. Outstanding"; Rec."Qty. Outstanding")
{
ApplicationArea = Warehouse;
}
field(AvailableQtyToPickExcludingQCBins; Rec.AvailableQtyToPickForCurrentLine())
{
ApplicationArea = Warehouse;
AutoFormatType = 0;
Caption = 'Available Qty. to Pick';
DecimalPlaces = 0 : 5;
Editable = false;
ToolTip = 'Specifies the quantity on the pick worksheet line that is available to pick. This quantity includes released warehouse shipment lines.';
}
field("Due Date"; Rec."Due Date")
{
ApplicationArea = Warehouse;
}
field("Unit of Measure Code"; Rec."Unit of Measure Code")
{
ApplicationArea = Warehouse;
Editable = false;
}
field("Shipping Advice"; Rec."Shipping Advice")
{
ApplicationArea = Warehouse;
}
field("Destination Type"; Rec."Destination Type")
{
ApplicationArea = Warehouse;
}
field("Destination No."; Rec."Destination No.")
{
ApplicationArea = Warehouse;
}
field("Source Document"; Rec."Source Document")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Source No."; Rec."Source No.")
{
ApplicationArea = Warehouse;
Visible = false;
}
field("Source Line No."; Rec."Source Line No.")
{
ApplicationArea = Warehouse;
Visible = false;
}
field(QtyCrossDockedUOM; QtyCrossDockedUOM)
{
ApplicationArea = Warehouse;
AutoFormatType = 0;
Caption = 'Qty. on Cross-Dock Bin';
DecimalPlaces = 0 : 5;
Editable = false;
ToolTip = 'Specifies the quantity of items to be cross-docked.';
trigger OnDrillDown()
begin
CrossDockMgt.ShowBinContentsCrossDocked(Rec."Item No.", Rec."Variant Code", Rec."Unit of Measure Code", Rec."Location Code", true);
end;
}
field(QtyCrossDockedUOMBase; QtyCrossDockedUOMBase)
{
ApplicationArea = Warehouse;
AutoFormatType = 0;
Caption = 'Qty. on Cross-Dock (Base)';
DecimalPlaces = 0 : 5;
Editable = false;
ToolTip = 'Specifies the quantity of items to be cross-docked.';
Visible = false;
trigger OnDrillDown()
begin
CrossDockMgt.ShowBinContentsCrossDocked(Rec."Item No.", Rec."Variant Code", Rec."Unit of Measure Code", Rec."Location Code", true);
end;
}
field(QtyCrossDockedAllUOMBase; QtyCrossDockedAllUOMBase)
{
ApplicationArea = Warehouse;
AutoFormatType = 0;
Caption = 'Qty. on Cross-Dock Bin (Base all UOM)';
DecimalPlaces = 0 : 5;
Editable = false;
ToolTip = 'Specifies the quantity of items to be cross-docked. ';
Visible = false;
trigger OnDrillDown()
begin
CrossDockMgt.ShowBinContentsCrossDocked(Rec."Item No.", Rec."Variant Code", Rec."Unit of Measure Code", Rec."Location Code", false);
end;
}
}
group(Control22)
{
ShowCaption = false;
fixed(Control1900669001)
{
ShowCaption = false;
group("Item Description")
{
Caption = 'Item Description';
field(ItemDescription; ItemDescription)
{
ApplicationArea = Warehouse;
Editable = false;
ShowCaption = false;
}
}
}
}
}
area(factboxes)
{
part(Control8; "Lot Numbers by Bin FactBox")
{
ApplicationArea = ItemTracking;
SubPageLink = "Item No." = field("Item No."),
"Variant Code" = field("Variant Code"),
"Location Code" = field("Location Code");
Visible = false;
}
systempart(Control1900383207; Links)
{
ApplicationArea = RecordLinks;
Visible = false;
}
systempart(Control1905767507; Notes)
{
ApplicationArea = Notes;
Visible = false;
}
}
}
actions
{
area(navigation)
{
group("&Line")
{
Caption = '&Line';
Image = Line;
action("Source &Document Line")
{
ApplicationArea = Warehouse;
Caption = 'Source &Document Line';
Image = SourceDocLine;
ToolTip = 'View the line on a released source document that the warehouse activity is for. ';
trigger OnAction()
begin
WMSMgt.ShowSourceDocLine(
Rec."Source Type", Rec."Source Subtype", Rec."Source No.", Rec."Source Line No.", Rec."Source Subline No.");
end;
}
action("Whse. Document Line")
{
ApplicationArea = Warehouse;
Caption = 'Whse. Document Line';
Image = Line;
ToolTip = 'View the line on another warehouse document that the warehouse activity is for.';
trigger OnAction()
begin
WMSMgt.ShowWhseActivityDocLine(
Rec."Whse. Document Type", Rec."Whse. Document No.", Rec."Whse. Document Line No.");
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;
}
}
group("&Item")
{
Caption = '&Item';
Image = Item;
action(Card)
{
ApplicationArea = Warehouse;
Caption = 'Card';
Image = EditLines;
RunObject = Page "Item Card";
RunPageLink = "No." = field("Item No.");
ShortCutKey = 'Shift+F7';
ToolTip = 'View or change detailed information about the record on the document or journal line.';
}
action("Warehouse Entries")
{
ApplicationArea = Warehouse;
Caption = 'Warehouse Entries';
Image = BinLedger;
RunObject = Page "Warehouse Entries";
RunPageLink = "Item No." = field("Item No."),
"Variant Code" = field("Variant Code"),
"Location Code" = field("Location Code");
RunPageView = sorting("Item No.", "Location Code", "Variant Code", "Bin Type Code", "Unit of Measure Code", "Lot No.", "Serial No.");
ShortCutKey = 'Ctrl+F7';
ToolTip = 'View completed warehouse activities related to the document.';
}
action("Ledger E&ntries")
{
ApplicationArea = Warehouse;
Caption = 'Ledger E&ntries';
Image = CustomerLedger;
RunObject = Page "Item Ledger Entries";
RunPageLink = "Item No." = field("Item No."),
"Variant Code" = field("Variant Code"),
"Location Code" = field("Location Code");
RunPageView = sorting("Item No.");
ToolTip = 'View the history of transactions that have been posted for the selected record.';
}
action("Bin Contents")
{
ApplicationArea = Warehouse;
Caption = 'Bin Contents';
Image = BinContent;
RunObject = Page "Bin Contents List";
RunPageLink = "Location Code" = field("Location Code"),
"Item No." = field("Item No."),
"Variant Code" = field("Variant Code");
RunPageView = sorting("Location Code", "Item No.", "Variant Code");
ToolTip = 'View items in the bin if the selected line contains a bin code.';
}
}
}
area(processing)
{
group("F&unctions")
{
Caption = 'F&unctions';
Image = "Action";
action("Get Warehouse Documents")
{
ApplicationArea = Warehouse;
Caption = 'Get Warehouse Documents';
Ellipsis = true;
Image = GetSourceDoc;
ShortCutKey = 'Shift+F11';
ToolTip = 'Select a warehouse document to pick for, such as a warehouse shipment.';
trigger OnAction()
var
RetrieveWhsePickDoc: Codeunit "Get Source Doc. Outbound";
begin
RetrieveWhsePickDoc.GetSingleWhsePickDoc(
CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode);
Rec.SortWhseWkshLines(
CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode, CurrentSortingMethod);
OnAfterActionGetWarehouseDocuments(CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode, CurrentSortingMethod);
end;
}
action("Autofill Qty. to Handle")
{
ApplicationArea = Warehouse;
Caption = 'Autofill Qty. to Handle';
Image = AutofillQtyToHandle;
ToolTip = 'Have the system enter the outstanding quantity in the Qty. to Handle field.';
trigger OnAction()
var
PickWkshLine: Record "Whse. Worksheet Line";
begin
PickWkshLine.Copy(Rec);
Rec.AutofillQtyToHandle(PickWkshLine);
end;
}
action("Delete Qty. to Handle")
{
ApplicationArea = Warehouse;
Caption = 'Delete Qty. to Handle';
Image = DeleteQtyToHandle;
ToolTip = 'Have the system clear the value in the Qty. To Handle field. ';
trigger OnAction()
var
PickWkshLine: Record "Whse. Worksheet Line";
begin
PickWkshLine.Copy(Rec);
Rec.DeleteQtyToHandle(PickWkshLine);
end;
}
action(CreatePick)
{
ApplicationArea = Warehouse;
Caption = 'Create Pick';
Ellipsis = true;
Image = CreateInventoryPickup;
ToolTip = 'Create warehouse pick documents for the specified picks. ';
trigger OnAction()
begin
CODEUNIT.Run(CODEUNIT::"Whse. Create Pick", Rec);
end;
}
}
group("Page")
{
Caption = 'Page';
action(EditInExcel)
{
ApplicationArea = Basic, Suite;
Caption = 'Edit in Excel';
Image = Excel;
ToolTip = 'Send the data in the worksheet to an Excel file for analysis or editing.';
Visible = IsSaaSExcelAddinEnabled;
AccessByPermission = System "Allow Action Export To Excel" = X;
trigger OnAction()
var
EditinExcel: Codeunit "Edit in Excel";
EditinExcelFilters: Codeunit "Edit in Excel Filters";
ODataUtility: Codeunit "ODataUtility";
begin
EditinExcelFilters.AddFieldV2(ODataUtility.ExternalizeName(Rec.FieldName(Rec.Name)), Enum::"Edit in Excel Filter Type"::Equal, CurrentWkshName, Enum::"Edit in Excel Edm Type"::"Edm.String");
EditinExcelFilters.AddFieldV2(ODataUtility.ExternalizeName(Rec.FieldName(Rec."Worksheet Template Name")), Enum::"Edit in Excel Filter Type"::Equal, CurrentWkshTemplateName, Enum::"Edit in Excel Edm Type"::"Edm.String");
EditinExcelFilters.AddFieldV2(ODataUtility.ExternalizeName(Rec.FieldName(Rec."Location Code")), Enum::"Edit in Excel Filter Type"::Equal, CurrentLocationCode, Enum::"Edit in Excel Edm Type"::"Edm.String");
EditinExcel.EditPageInExcel(Text.CopyStr(CurrPage.Caption, 1, 240), Page::"Pick Worksheet", EditInExcelFilters, StrSubstNo(ExcelFileNameTxt, CurrentWkshName, CurrentWkshTemplateName));
end;
}
}
}
area(Promoted)
{
group(Category_Process)
{
Caption = 'Process', Comment = 'Generated from the PromotedActionCategories property index 1.';
actionref(CreatePick_Promoted; CreatePick)
{
}
actionref("Get Warehouse Documents_Promoted"; "Get Warehouse Documents")
{
}
group("Category_Qty. to Handle")
{
Caption = 'Qty. to Handle';
ShowAs = SplitButton;
actionref("Autofill Qty. to Handle_Promoted"; "Autofill Qty. to Handle")
{
}
actionref("Delete Qty. to Handle_Promoted"; "Delete Qty. to Handle")
{
}
}
}
group(Category_Category4)
{
Caption = 'Line', Comment = 'Generated from the PromotedActionCategories property index 3.';
actionref("Item &Tracking Lines_Promoted"; "Item &Tracking Lines")
{
}
actionref("Source &Document Line_Promoted"; "Source &Document Line")
{
}
actionref("Whse. Document Line_Promoted"; "Whse. Document Line")
{
}
actionref("Warehouse Entries_Promoted"; "Warehouse Entries")
{
}
}
group(Category_Category5)
{
Caption = 'Item', Comment = 'Generated from the PromotedActionCategories property index 4.';
}
group(Category_Report)
{
Caption = 'Report', Comment = 'Generated from the PromotedActionCategories property index 2.';
}
}
}
trigger OnAfterGetCurrRecord()
begin
Rec.GetItem(Rec."Item No.", ItemDescription);
WhseDocumentType := Rec."Whse. Document Type";
end;
trigger OnAfterGetRecord()
begin
CrossDockMgt.CalcCrossDockedItems(
Rec."Item No.", Rec."Variant Code", Rec."Unit of Measure Code", Rec."Location Code",
QtyCrossDockedUOMBase, QtyCrossDockedAllUOMBase);
QtyCrossDockedUOM := 0;
if Rec."Qty. per Unit of Measure" <> 0 then
QtyCrossDockedUOM := Round(QtyCrossDockedUOMBase / Rec."Qty. per Unit of Measure", UOMMgt.QtyRndPrecision());
WhseDocumentType := Rec."Whse. Document Type";
end;
trigger OnDeleteRecord(): Boolean
begin
ItemDescription := '';
end;
trigger OnOpenPage()
var
ClientTypeManagement: Codeunit "Client Type Management";
ServerSetting: Codeunit "Server Setting";
WhseWkshSelected: Boolean;
begin
IsSaaSExcelAddinEnabled := ServerSetting.GetIsSaasExcelAddinEnabled();
// if called from API (such as edit-in-excel), do not filter
if ClientTypeManagement.GetCurrentClientType() = CLIENTTYPE::ODataV4 then
exit;
if OpenedFromDrillDown then begin // Drill down handles the filtering on the record
CurrentWkshName := DrillDownCurrentWkshName;
CurrentWkshTemplateName := DrillDownCurrentWkshTemplateName;
CurrentLocationCode := DrillDownCurrentLocationCode;
exit;
end;
OpenedFromBatch := (Rec.Name <> '') and (Rec."Worksheet Template Name" = '');
if OpenedFromBatch then begin
CurrentWkshName := Rec.Name;
CurrentLocationCode := Rec."Location Code";
Rec.OpenWhseWksh(Rec, CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode);
exit;
end;
Rec.TemplateSelection(PAGE::"Pick Worksheet", 1, Rec, WhseWkshSelected);
if not WhseWkshSelected then
Error('');
Rec.OpenWhseWksh(Rec, CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode);
end;
var
WMSMgt: Codeunit "WMS Management";
CrossDockMgt: Codeunit "Whse. Cross-Dock Management";
UOMMgt: Codeunit "Unit of Measure Management";
ExcelFileNameTxt: Label 'Pick Worksheet - WorksheetName %1 - WorksheetTemplateName %2', Comment = '%1 = Worksheet Name; %2 = Worksheet Template Name';
QtyCrossDockedUOM: Decimal;
QtyCrossDockedAllUOMBase: Decimal;
QtyCrossDockedUOMBase: Decimal;
OpenedFromBatch: Boolean;
OpenedFromDrillDown: Boolean;
DrillDownCurrentWkshTemplateName: Code[10];
DrillDownCurrentWkshName: Code[10];
DrillDownCurrentLocationCode: Code[10];
IsSaaSExcelAddinEnabled: Boolean;
WhseDocumentType: Enum "Warehouse Pick Document Type";
protected var
CurrentWkshTemplateName: Code[10];
CurrentWkshName: Code[10];
CurrentLocationCode: Code[10];
CurrentSortingMethod: Enum "Whse. Activity Sorting Method";
ItemDescription: Text[100];
protected procedure QtytoHandleOnAfterValidate()
begin
CurrPage.Update();
end;
protected procedure CurrentWkshNameOnAfterValidate()
begin
CurrPage.SaveRecord();
Rec.SetWhseWkshName(CurrentWkshName, CurrentLocationCode, Rec);
CurrPage.Update(false);
end;
protected procedure CurrentSortingMethodOnAfterValidate()
begin
Rec.SortWhseWkshLines(CurrentWkshTemplateName, CurrentWkshName, CurrentLocationCode, CurrentSortingMethod);
CurrPage.Update(false);
Rec.SetCurrentKey("Worksheet Template Name", Name, "Location Code", "Sorting Sequence No.");
end;
internal procedure DrillDownFromCalculationSummary(var WhseWorksheetLine: Record "Whse. Worksheet Line")
begin
WhseWorksheetLine.CheckWhseWkshName(WhseWorksheetLine.Name, WhseWorksheetLine."Location Code", WhseWorksheetLine);
DrillDownCurrentWkshTemplateName := WhseWorksheetLine."Worksheet Template Name";
DrillDownCurrentWkshName := WhseWorksheetLine.Name;
DrillDownCurrentLocationCode := WhseWorksheetLine."Location Code";
OpenedFromDrillDown := true;
end;
[IntegrationEvent(false, false)]
local procedure OnAfterActionGetWarehouseDocuments(WhseWkshTemplate: Code[10]; WhseWkshName: Code[10]; LocationCode: Code[10]; SortingMethod: Enum "Whse. Activity Sorting Method")
begin
end;
}