Anywhere Mobility Studio Documentation
WMS Function List for warehouse functionality
The following list shows a collection of standard functions available in Business Integration Solutions for Microsoft Dynamics 365 Business Central. The functions from ANY are registered in the same way, codeunit WMS Function List is registered during product installation.
DAW_IsBinMandatory
Code
procedure DAW_IsBinMandatory(LocationCode: Code[10]): Boolean
var
Location: Record "Location";
begin
//**********************************************************
// category : Warehouse
// description: Returns true when a bin is mandatory for a location
//**********************************************************
if Location.GET(LocationCode) then
exit(Location."Bin Mandatory");
end;
DAW_IsShipmentBinConstant
code
```cal procedure DAW_IsShipmentBinConstant(LocationCode: Code[10]): Boolean var Location: Record "Location"; begin //********************************************************** // category : Warehouse // description: Returns true when a shipment bin cannot be changed //********************************************************** if Location.GET(LocationCode) then exit(Location."Bin Mandatory" and Location."Require Pick"); end; ```DAW_CheckAvailQtyToTake
code
procedure DAW_CheckAvailQtyToTake(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20]; UoM: Code[20]; ReqQuantity: Decimal; LotNo: Code[20]; SerialNo: Code[20]; ShowError: Boolean; AlternativeError: Text) Available: Decimal
var
BinContent: Record "Bin Content";
Item: Record Item;
DoesntExistErr: Label '%1 No. %2 doesn''t exist', Comment = '%1 = Replaced by the item table caption, %2 = Replaced by the item id';
NotEnoughErr: Label 'Not enough inventory available to take for item %1; available inventory to take is %2', Comment = '%1 = Replaced by the item id, %2 = Replaced by the item stock';
begin
//**********************************************************
// category : Warehouse
// description: Returns the available quantity to take for an item at a bin
//**********************************************************
if Item.GET(ItemNo) then begin
BinContent.SETRANGE("Location Code", LocationCode);
BinContent.SETRANGE("Bin Code", BinCode);
BinContent.SETRANGE("Item No.", Item."No.");
BinContent.SETRANGE("Unit of Measure Code", UoM);
if LotNo <> '' then
BinContent.SETFILTER("Lot No. Filter", LotNo);
if SerialNo <> '' then
BinContent.SETFILTER("Serial No. Filter", SerialNo);
if BinContent.FINDFIRST() then
Available := BinContent.CalcQtyAvailToTakeUOM();
if (ReqQuantity > Available) or (Available = 0) then
if ShowError then begin
if AlternativeError = '' then
AlternativeError := StrSubstNo(NotEnoughErr, Item."No.", Available);
Error(AlternativeError);
end;
end else
Error(DoesntExistErr, Item.TABLECAPTION(), ItemNo);
end;
DAW_CheckSuggestedBin
code
procedure DAW_CheckSuggestedBin(ItemNo: Code[20]; LocationCode: Code[10]; BinCode: Code[20]; LotNo: Code[20]; SerialNo: Code[20]): Code[20]
var
BinContent: Record "Bin Content";
begin
//**********************************************************
// category : Warehouse
// description: Check if a suggested bin is still valid when tracking details have been altered.
//**********************************************************
BinContent.SETRANGE("Item No.", ItemNo);
BinContent.SETRANGE("Location Code", LocationCode);
BinContent.SETRANGE("Bin Code", BinCode);
if LotNo <> '' then
BinContent.SETFILTER("Lot No. Filter", LotNo);
if SerialNo <> '' then
BinContent.SETFILTER("Serial No. Filter", SerialNo);
BinContent.SETFILTER(Quantity, '>%1', 0);
if not BinContent.ISEMPTY then
exit(BinCode);
end;
DAW_ValidBin
code
procedure DAW_ValidBin(LocationCode: Code[10]; BinCode: Code[20])
var
Location: Record "Location";
BinErr: Label 'The %1 %2 may not be used in this transaction.', Comment = '%1 = Replaced by the adjustment bin code caption, %2 = Replaced by the bin code';
begin
//**********************************************************
// category : Warehouse
// description: Use this function to see if a bin is NOT the adjustment BIN
//**********************************************************
Location.GET(LocationCode);
if BinCode = Location."Adjustment Bin Code" then
Error(BinErr, Location.FIELDCAPTION("Adjustment Bin Code"), BinCode);
end;
DAW_GetWhseRcptLineFromItemNo
code
```cal procedure DAW_GetWhseRcptLineFromItemNo(WhseReceiptNo: Code[20]; ItemNo: Code[20]) LineNo: Integer var Item: Record Item; WhseReceiptLine: Record "Warehouse Receipt Line"; LineHandledErr: Label ': The item is completely handled.'; InvalidLineErr: Label ': The selected Item could not be found on the document.'; begin //********************************************************** // category : Warehouse // description: Validate the scanned item against the specified warehouse receipt header. //********************************************************** if Item.GET(ItemNo) then begin WhseReceiptLine.SETRANGE("No.", WhseReceiptNo); WhseReceiptLine.SETRANGE("Item No.", ItemNo); if WhseReceiptLine.FINDSET() then begin repeat if WhseReceiptLine."Qty. Outstanding" <> WhseReceiptLine."Qty. to Receive" then LineNo := WhseReceiptLine."Line No."; until (LineNo <> 0) or (WhseReceiptLine.NEXT() = 0); if LineNo = 0 then Error(strsubstno(InvalidItemErr, LineHandledErr)); end else Error(Strsubstno(InvalidItemErr, InvalidLineErr)); end else Error(Strsubstno(InvalidItemErr, '')); end; ```DAW_GetWhseShptLineFromItemNo
code
procedure DAW_GetWhseShptLineFromItemNo(WhseShipmentNo: Code[20]; ItemNo: Code[20]) LineNo: Integer
var
WhseShipmentLine: Record "Warehouse Shipment Line";
Item: Record Item;
LineHandledErr: Label ': The item is completely handled.';
InvalidLineErr: Label ': The selected Item could not be found on the document.';
begin
//**********************************************************
// category : Warehouse
// description: Validate the scanned item against the specified warehouse shipment header.
//**********************************************************
if Item.GET(ItemNo) then begin
WhseShipmentLine.SETRANGE("No.", WhseShipmentNo);
WhseShipmentLine.SETRANGE("Item No.", ItemNo);
if WhseShipmentLine.FINDSET() then begin
repeat
if WhseShipmentLine."Qty. Outstanding" > WhseShipmentLine."Qty. to Ship" then
LineNo := WhseShipmentLine."Line No.";
until (LineNo <> 0) or (WhseShipmentLine.NEXT() = 0);
if LineNo = 0 then
Error(Strsubstno(InvalidItemErr, LineHandledErr));
end else
Error(Strsubstno(InvalidItemErr, InvalidLineErr));
end else
Error(Strsubstno(InvalidItemErr, ''));
end;
DAW_WhseShipmentReadyForShip
code
```cal procedure DAW_WhseShipmentReadyForShip(WhseShipmentNo: Code[20]; ErrorMessage: Text) Ready: Boolean var Location: Record "Location"; WMSShipmentHeader: Record "Warehouse Shipment Header"; begin //********************************************************** // category : Warehouse // description: Return true when (a part of) the shipment is ready to ship //********************************************************** WMSShipmentHeader.GET(WhseShipmentNo); Location.GET(WMSShipmentHeader."Location Code"); if Location."Require Pick" then begin Ready := (WMSShipmentHeader."Document Status" > WMSShipmentHeader."Document Status"::" "); end else Ready := true; if not Ready and (ErrorMessage <> '') then Error(ErrorMessage); end; ```DAW_WhseShptValidSNTracking
code
procedure DAW_WhseShptValidSNTracking(ShipmentNo: Code[20]; LineNo: Integer; LotNo: Code[20]; SerialNo: Code[20])
var
WhseShipmentLine: Record "Warehouse Shipment Line";
WMSFunctionList: Codeunit "ANY WMS Function List";
TrackNotPickedErr: Label 'The Serial No. %1 is not picked for this Shipment', Comment = '%1 = Replaced by the serial number';
begin
//**********************************************************
// category : Warehouse
// description: Use this function when confirming a serialno on a warehouse shipment document
//**********************************************************
WhseShipmentLine.GET(ShipmentNo, LineNo);
if not WMSFunctionList.WMSShipmentValidItemTracking(WhseShipmentLine, SerialNo, LotNo) then
Error(TrackNotPickedErr, SerialNo);
end;
DAW_WhseShptValidLotTracking
code
procedure DAW_WhseShptValidLotTracking(ShipmentNo: Code[20]; LineNo: Integer; LotNo: Code[20])
var
WhseShipmentLine: Record "Warehouse Shipment Line";
WMSFunctionList: Codeunit "ANY WMS Function List";
TrackNotPickedErr: Label 'The Lot No. %1 is not picked for this Shipment', Comment = '%1 = Replaced by the lot number';
begin
//**********************************************************
// category : Warehouse
// description: Use this function when confirming a lotno on a warehouse shipment document
//**********************************************************
WhseShipmentLine.GET(ShipmentNo, LineNo);
if not WMSFunctionList.WMSShipmentValidItemTracking(WhseShipmentLine, '', LotNo) then
Error(TrackNotPickedErr, LotNo);
end;
DAW_GetWhseActivityLineNo
code
procedure DAW_GetWhseActivityLineNo(ActivityType: Text[20]; HeaderNo: Code[20]; LineNo: Integer; ItemNo: Code[20]; SerialNo: Code[20]; LotNo: Code[20]; QtyToHandle: Decimal): Integer
var
Item: Record Item;
WhseActivityLine: Record "Warehouse Activity Line";
LineHandledErr: Label ': The item is completely handled.';
InvalidLineErr: Label ': The selected Item could not be found on the document.';
begin
//**********************************************************
// category : Warehouse
// description: Validate the scanned item against the specified warehouse activity header.
//**********************************************************
if Item.GET(ItemNo) then begin
WhseActivityLine.SETRANGE("No.", HeaderNo);
WhseActivityLine.SETRANGE("Item No.", ItemNo);
if QtyToHandle > 0 then
WhseActivityLine.SETRANGE("Qty. to Handle", QtyToHandle);
if LineNo > 0 then begin
WhseActivityLine.SETRANGE("Line No.", LineNo);
if WhseActivityLine.FINDFIRST() then
exit(LineNo);
WhseActivityLine.SETRANGE("Line No.");
LineNo := 0;
end;
if SerialNo <> '' then
WhseActivityLine.SETRANGE("Serial No.", SerialNo);
if LotNo <> '' then
WhseActivityLine.SETRANGE("Lot No.", LotNo);
Evaluate(WhseActivityLine."Activity Type", ActivityType);
WhseActivityLine.SETRANGE("Activity Type", WhseActivityLine."Activity Type");
WhseActivityLine.SETRANGE("Breakbulk No.", 0);
if WhseActivityLine."Activity Type" in [WhseActivityLine."Activity Type"::Movement, WhseActivityLine."Activity Type"::"Invt. Movement"] then
Error('Function GetWhseActivityLineNo does not support activity lines of type %1', WhseActivityLine."Activity Type");
if WhseActivityLine."Activity Type" in [WhseActivityLine."Activity Type"::"Put-away", WhseActivityLine."Activity Type"::"Invt. Put-away"] then
WhseActivityLine.SETFILTER("Action Type", '%1|%2', WhseActivityLine."Action Type"::" ", WhseActivityLine."Action Type"::Place)
else
WhseActivityLine.SETFILTER("Action Type", '%1|%2', WhseActivityLine."Action Type"::" ", WhseActivityLine."Action Type"::Take);
if WhseActivityLine.FINDSET() then begin
repeat
if WhseActivityLine."Qty. to Handle" < WhseActivityLine."Qty. Outstanding" then
LineNo := WhseActivityLine."Line No.";
until (LineNo <> 0) or (WhseActivityLine.NEXT() = 0);
if LineNo = 0 then
Error(InvalidItemErr, LineHandledErr);
end else
Error(InvalidItemErr, InvalidLineErr);
end else
Error(InvalidItemErr, '');
exit(LineNo);
end;
DAW_GetWhseJnlLineNo
code
procedure DAW_GetWhseJnlLineNo(JournalTemplateName: Code[10]; JournalBatchname: Code[10]; LocationCode: Code[10]; ItemNo: Code[20]; BinCode: Code[20]; SerialNo: Code[20]; LotNo: Code[20]): Integer
var
WhseJournalLine: Record "Warehouse Journal Line";
begin
//**********************************************************
// category : Warehouse
// description: Gets the warehouse journal line for an item
//**********************************************************
WhseJournalLine.SETRANGE("Journal Template Name", JournalTemplateName);
WhseJournalLine.SETRANGE("Journal Batch Name", JournalBatchname);
WhseJournalLine.SETRANGE("Location Code", LocationCode);
WhseJournalLine.SETRANGE("Item No.", ItemNo);
if BinCode <> '' then
WhseJournalLine.SETRANGE("Bin Code", BinCode);
if SerialNo <> '' then
WhseJournalLine.SETRANGE("Serial No.", SerialNo);
if LotNo <> '' then
WhseJournalLine.SETRANGE("Lot No.", LotNo);
if WhseJournalLine.FINDFIRST then
exit(WhseJournalLine."Line No.");
end;
DAW_CheckWhseJnlLine
code
procedure DAW_CheckWhseJnlLine(JournalTemplateName: Code[10]; JournalBatchname: Code[10]; LocationCode: Code[10]; LineNo: Integer; ItemNo: Code[20]; BinCode: Code[20]; SerialNo: Code[20]; LotNo: Code[20])
var
WhseJournalLine: Record "Warehouse Journal Line";
InvalidLineErr: Label ': The selected Item could not be found on the document.';
InvalidBinErr: Label ': The item was not found on bin %1', Comment = '%1 = Replaced by the bin code';
InvalidSerialErr: Label ': Serial %1 is incorrect.', Comment = '%1 = Replaced by the serial number';
InvalidLotErr: Label ': Lot %1 is incorrect', Comment = '%1 = Replaced by the lot number';
ItemErr: Label ': %1', Comment = '%1 = Replaced by the item id';
begin
//**********************************************************
// category : Warehouse
// description: Use this fuction to validate the item details to a warehouse journal line
//**********************************************************
if WhseJournalLine.GET(JournalTemplateName, JournalBatchname, LocationCode, LineNo) then begin
if WhseJournalLine."Item No." <> ItemNo then
Error(InvalidItemErr, StrSubstNo(ItemErr, ItemNo));
if (BinCode <> '') and (WhseJournalLine."Bin Code" <> BinCode) then
Error(InvalidItemErr, StrSubstNo(InvalidBinErr, BinCode));
if (SerialNo <> '') and (WhseJournalLine."Serial No." <> SerialNo) then
Error(InvalidItemErr, StrSubstNo(InvalidSerialErr, SerialNo));
if (LotNo <> '') and (WhseJournalLine."Lot No." <> LotNo) then
Error(InvalidItemErr, StrSubstNo(InvalidLotErr, LotNo));
end else
Error(InvalidItemErr, InvalidLineErr);
end;
DAW_CalcWhseCountedQty
code
procedure DAW_CalcWhseCountedQty(JournalTemplateName: Code[10]; JournalBatchname: Code[10]; LocationCode: Code[10]; LineNo: Integer; ItemNo: Code[20]; ReasonCode: Code[20]) QtyCounted: Decimal
var
WhseJournalLine: Record "Warehouse Journal Line";
ItemErr: Label ': %1', Comment = '%1 = Replaced by the item id';
begin
//**********************************************************
// category : Warehouse
// description: Returns the quantity already counted for a warehouse journal line
//**********************************************************
if WhseJournalLine.GET(JournalTemplateName, JournalBatchname, LocationCode, LineNo) then
if WhseJournalLine."Item No." <> ItemNo then
Error(InvalidItemErr, StrSubstNo(ItemErr, ItemNo))
else
if WhseJournalLine."Reason Code" = ReasonCode then begin
QtyCounted := WhseJournalLine."Qty. (Phys. Inventory)";
if (WhseJournalLine."Qty. (Calculated)" = 0) and (WhseJournalLine."Qty. (Phys. Inventory)" = 0) then
QtyCounted := WhseJournalLine.Quantity;
end;
end;
DAW_IsLotTrackedItem
code
procedure DAW_IsLotTrackedItem(ItemNo: Code[20]): Boolean
var
Item: Record Item;
ItemTrackingCode: Record "Item Tracking Code";
begin
//**********************************************************
// category : Tracking
// description: Use this function to determine if lottracking is required for item.
//**********************************************************
if Item.GET(ItemNo) then
if ItemTrackingCode.GET(Item."Item Tracking Code") then
exit(ItemTrackingCode."Lot Specific Tracking")
end;
DAW_IsSNTrackedItem
code
procedure DAW_IsSNTrackedItem(ItemNo: Code[20]): Boolean
var
Item: Record Item;
ItemTrackingCode: Record "Item Tracking Code";
begin
//**********************************************************
// category : Tracking
// description: Use this function to determine if serialtracking is required for item.
//**********************************************************
if Item.GET(ItemNo) then
if ItemTrackingCode.GET(Item."Item Tracking Code") then
exit(ItemTrackingCode."SN Specific Tracking");
end;
DAW_LotTrackingApplies
code
procedure DAW_LotTrackingApplies(ItemNo: Code[20]; Sourcetype: Integer; SourceSubType: Text; WhseDocument: Boolean): Boolean
var
WhseActivityLine: Record "Warehouse Activity Line";
WMSFunctionList: Codeunit "ANY WMS Function List";
begin
//**********************************************************
// category : Tracking
// description: Based on documenttype and tracking settings, determines if a lotno is required.
//**********************************************************
Evaluate(WhseActivityLine."Source Subtype", SourceSubType);
exit(WMSFunctionList.TrackingApplies(ItemNo, Sourcetype, WhseActivityLine."Source Subtype", false, WhseDocument));
end;
DAW_SNTrackingApplies
code
procedure DAW_SNTrackingApplies(ItemNo: Code[20]; Sourcetype: Integer; SourceSubType: Text; WhseDocument: Boolean): Boolean
var
WhseActivityLine: Record "Warehouse Activity Line";
WMSFunctionList: Codeunit "ANY WMS Function List";
begin
//**********************************************************
// category : Tracking
// description: Based on documenttype and tracking settings, determines if a serialno is required.
//**********************************************************
Evaluate(WhseActivityLine."Source Subtype", SourceSubType);
exit(WMSFunctionList.TrackingApplies(ItemNo, Sourcetype, WhseActivityLine."Source Subtype", true, WhseDocument));
end;
DAW_TrackingExists
code
procedure DAW_TrackingExists(ItemNo: Code[20]; "Table": Integer; DocumentType: Integer; DocumentNo: Code[20]; DocumentLineNo: Integer; LotNo: Code[20]; SerialNo: Code[20]): Boolean
var
item: Record Item;
WMSFunctionList: Codeunit "ANY WMS Function List";
LotTracking: Boolean;
begin
//**********************************************************
// category : Tracking
// description: Checks if the provided item tracking details exist.
//**********************************************************
item.GET(ItemNo);
LotTracking := WMSFunctionList.TrackingApplies(ItemNo, Table, DocumentType, false, false);
if LotTracking and (LotNo = '') then begin
item.TESTFIELD("Lot Nos.");
LotNo := 'New Lot';
end;
if WMSFunctionList.TrackingApplies(ItemNo, Table, DocumentType, true, false) and (SerialNo = '') then begin
if not LotTracking then
item.TESTFIELD("Serial Nos.");
SerialNo := 'New Serial';
end;
exit(WMSFunctionList.TrackingExists(item."No.", Table, DocumentType, DocumentNo, DocumentLineNo, LotNo, SerialNo));
end;
DAW_GetTrackingQuantity
code
procedure DAW_GetTrackingQuantity(ItemNo: Code[20]; "Table": Integer; DocumentType: Integer; DocumentNo: Code[20]; DocumentLineNo: Integer; LotNo: Code[20]; SerialNo: Code[20]; DocumentBatch: Code[10]; ProdOrderLineNo: Integer): Decimal
var
TempTrackSpec: Record "Tracking Specification" temporary;
WMSFunctionList: Codeunit "ANY WMS Function List";
begin
//**********************************************************
// category : Tracking
// description: Retrieves the quantity tracked for provided item tracking details
//**********************************************************
TempTrackSpec."Item No." := ItemNo;
TempTrackSpec."Source Type" := Table;
TempTrackSpec."Source Subtype" := DocumentType;
TempTrackSpec."Source ID" := DocumentNo;
TempTrackSpec."Source Ref. No." := DocumentLineNo;
TempTrackSpec."Lot No." := LotNo;
TempTrackSpec."Serial No." := SerialNo;
TempTrackSpec."Source Batch Name" := DocumentBatch;
TempTrackSpec."Source Prod. Order Line" := ProdOrderLineNo;
exit(WMSFunctionList.GetTrackingQty(TempTrackSpec));
end;
DAW_GetTrackedQuantity
code
procedure DAW_GetTrackedQuantity(ItemNo: Code[20]; LotNo: Code[20]; SerialNo: Code[20]; LocationCode: Code[20]; BinCode: Code[20]): Decimal
var
TempTrackSpec: Record "Tracking Specification" temporary;
WMSFunctionList: Codeunit "ANY WMS Function List";
begin
//**********************************************************
// category : Tracking
// description: Retrieves the quantity tracked on a specified location
//**********************************************************
TempTrackSpec."Item No." := ItemNo;
TempTrackSpec."Lot No." := LotNo;
TempTrackSpec."Serial No." := SerialNo;
TempTrackSpec."Location Code" := CopyStr(LocationCode, 1, 10);
TempTrackSpec."Bin Code" := BinCode;
exit(WMSFunctionList.GetTrackedQuantity(TempTrackSpec));
end;
DAW_IsValidSerialNo
code
procedure DAW_IsValidSerialNo(ActivityType: Text; ActivityNo: Code[20]; LineNo: Integer; SerialNo: Code[20]; LocationCode: Code[10]; ZoneCode: Code[10]; ItemNo: Code[20])
var
WhseActLine: Record "Warehouse Activity Line";
BinContent: Record "Bin Content";
SerialDefinedErr: Label 'Serial No. %1 is already defined on line %2', Comment = '%1 = Replaced by the serial number, %2 = Replaced by the line number';
SerialNoLocationErr: Label 'Serial No. %1 is not available on location %2', Comment = '%1 = Replaced by the serial number, %2 = Replaced by the location code';
begin
//**********************************************************
// category : Tracking
// description: Check if a serial number is available for a warehouse document
//**********************************************************
WhseActLine.RESET();
Evaluate(WhseActLine."Activity Type", ActivityType);
if SerialNo <> '' then
if WhseActLine.GET(WhseActLine."Activity Type", ActivityNo, LineNo) then begin
WhseActLine.SETRANGE("No.", WhseActLine."No.");
WhseActLine.SETFILTER("Line No.", '<>%1', LineNo);
WhseActLine.SETRANGE("Item No.", ItemNo);
WhseActLine.SETRANGE("Serial No.", SerialNo);
WhseActLine.SETRANGE("Activity Type", WhseActLine."Activity Type");
WhseActLine.SETRANGE("Action Type", WhseActLine."Action Type");
if WhseActLine.FINDFIRST() then
Error(SerialDefinedErr, WhseActLine."Serial No.", WhseActLine."Line No.");
end;
if not (WhseActLine."Activity Type" = WhseActLine."Activity Type"::"Invt. Put-away") then
if LocationCode <> '' then begin
BinContent.SETRANGE("Location Code", LocationCode);
if ZoneCode <> '' then
BinContent.SETRANGE("Zone Code", ZoneCode);
BinContent.SETFILTER("Serial No. Filter", SerialNo);
BinContent.SETFILTER(Quantity, '<>0');
BinContent.SETRANGE("Item No.", ItemNo);
if BinContent.ISEMPTY() then
Error(SerialNoLocationErr, SerialNo, BinContent."Location Code");
end;
end;
DAW_CheckDuplicateSerialNo
code
procedure DAW_CheckDuplicateSerialNo(ItemNo: Code[20]; "Table": Integer; DocumentType: Integer; SerialNo: Code[20])
var
WMSFunctionList: Codeunit "ANY WMS Function List";
begin
//**********************************************************
// category : Tracking
// description: Checks if a serialno is already present on a document
//**********************************************************
WMSFunctionList.CheckDuplicateSerialNo(ItemNo, SerialNo, Table, DocumentType);
end;
DAW_CheckTrackingBuffer
code
procedure DAW_CheckTrackingBuffer(SessionID: Text; LotNo: Code[20]; SerialNo: Code[20]): Boolean
var
SourceTrackingLine: Record "ANY Source Item Trck. Line";
sessionUID: Guid;
begin
//**********************************************************
// category : Tracking
// description: Checks if tracking details are available in the tracking buffer
//**********************************************************
Evaluate(sessionUID, SessionID);
SourceTrackingLine.SetRange("Created By", sessionUID);
if LotNo <> '' then
SourceTrackingLine.SetRange("Lot No.", LotNo);
if SerialNo <> '' then
SourceTrackingLine.SetRange("Serial No.", SerialNo);
exit(SourceTrackingLine.FindFirst());
end;
DAW_IsBinMovementBlocked
code
procedure DAW_IsBinMovementBlocked(BinCode: Code[20]; ItemNo: Code[20]; VariantCode: Code[10]; UOM: Code[10]; Direction: Text): Boolean
var
BinContent: Record "Bin Content";
rDirection: Record "Bin Content";
FunctionErr: Label 'An error has occured when calling DAW_IsBinContentMovementBlocked: %1', Comment = '%1 = Replaced by the movement direction';
invalidDirectionErr: Label '%1 is not a valid direction.', Comment = '%1 = Replaced by the movement direction';
NoBinContentErr: Label 'Bin Content does not exist.';
begin
//**********************************************************
// category : Warehouse
// description: Returns true when a bin is blocked for all or specified direction
//**********************************************************
rDirection."Block Movement" := rDirection."Block Movement"::All;
if Direction <> '' then
if not Evaluate(rDirection."Block Movement", Direction) then
Error(FunctionErr, StrSubstNo(invalidDirectionErr, Direction));
BinContent.SETRANGE("Bin Code", BinCode);
BinContent.SETRANGE("Item No.", ItemNo);
if VariantCode <> '' then
BinContent.SETRANGE("Variant Code", VariantCode);
if UOM <> '' then
BinContent.SETRANGE("Unit of Measure Code", UOM);
if not BinContent.FINDFIRST() then
Error(FunctionErr, NoBinContentErr);
if BinContent."Block Movement" in [rDirection."Block Movement"::All, rDirection."Block Movement"] then
exit(true)
else
exit(false);
end;
DAW_GetLotForSerialNo
code
procedure DAW_GetLotForSerialNo(WhseActType: Text; WhseActNo: Code[20]; WhseActLineNo: Integer; SerialNo: Code[20]): Code[20]
var
WarehouseActivityLine: Record "Warehouse Activity Line";
tempTrackingSpecification: Record "Tracking Specification" temporary;
tempEntrySummary: Record "Entry Summary" temporary;
ReservEntry: Record "Reservation Entry";
TableRefFunctions: Codeunit "TIC Table Ref Functions";
ANYItemTrackingList: Codeunit "ANY Source Item Tracking List";
activity: Integer;
ErrMessage: Text;
LocalWhseActType: Text[250];
FunctionErr: Label 'Could not get Lot for Serial No.';
ParamErr: Label 'Invalid parameter %1 %2', Comment = '%1 = Replaced by the WhseActType, %2 = Replaced by the warehouse activity type';
InvalidLineErr: Label 'Coult not retrieve %1', Comment = '%1 = Replaced by the line number';
begin
//**********************************************************
// category : Tracking
// description: Looks for Lot no. related to Serial No.
//**********************************************************
LocalWhseActType := CopyStr(WhseActType, 1, 250);
activity := TableRefFunctions.CheckOption(LocalWhseActType, DATABASE::"Warehouse Activity Line", 1, false);
if activity = -1 then begin
ErrMessage := FunctionErr + StrSubstNo(ParamErr, 'WhseActType', WhseActType);
Error(ErrMessage);
end;
WarehouseActivityLine."Activity Type" := activity;
if WarehouseActivityLine.GET(WarehouseActivityLine."Activity Type", WhseActNo, WhseActLineNo) then begin
ANYItemTrackingList.InitTrackingSpecFromWhseActivLine(tempTrackingSpecification, WarehouseActivityLine);
ANYItemTrackingList.RetrieveLookupData(tempTrackingSpecification, tempEntrySummary);
tempTrackingSpecification.RESET();
tempTrackingSpecification.SETCURRENTKEY("Lot No.", "Serial No.");
tempTrackingSpecification.SETRANGE("Serial No.", SerialNo);
if tempTrackingSpecification.FINDFIRST() then
exit(CopyStr(tempTrackingSpecification."Lot No.", 1, 20))
else begin
ReservEntry.SETCURRENTKEY(
"Item No.", "Variant Code", "Location Code", "Item Tracking", "Reservation Status", "Lot No.", "Serial No.");
ReservEntry.SETRANGE("Item No.", tempTrackingSpecification."Item No.");
ReservEntry.SETRANGE("Variant Code", tempTrackingSpecification."Variant Code");
ReservEntry.SETRANGE("Location Code", tempTrackingSpecification."Location Code");
ReservEntry.SETFILTER("Item Tracking", '<>%1', ReservEntry."Item Tracking"::None);
ReservEntry.SETRANGE("Serial No.", SerialNo);
if ReservEntry.FINDLAST() then
exit(CopyStr(ReservEntry."Lot No.", 1, 20));
end;
end else begin
ErrMessage := FunctionErr + StrSubstNo(InvalidLineErr, WarehouseActivityLine.TABLECAPTION());
Error(ErrMessage);
end;
end;
DAW_CalcUOMQty
code
procedure DAW_CalcUOMQty(ToUOM: Code[10]; ItemCode: Code[10]; QtyToHandle: Text; FromUOM: Code[10]): Decimal
var
ItemUOM: Record "Item Unit of Measure";
BinContent: Record "Bin Content";
FromItemUOM: Record "Item Unit of Measure";
DecQtyToHandle: Decimal;
begin
//**********************************************************
// category : Warehouse
// description: Calculates Quantity based on new Unit of Measure.
//**********************************************************
Clear(BinContent);
Evaluate(DecQtyToHandle, QtyToHandle);
ItemUOM.GET(ItemCode, ToUOM);
FromItemUOM.GET(ItemCode, FromUOM);
exit(Round(DecQtyToHandle * (FromItemUOM."Qty. per Unit of Measure" / ItemUOM."Qty. per Unit of Measure"), 0.00001));
end;
DAW_ValidateQtytoHandle
code
procedure DAW_ValidateQtytoHandle(QtyToHandle: Text; ItemCode: Code[10]; ToUOM: Code[10]; Qty: Text; DocNo: Code[20]; LineNo: Text): Boolean
var
ItemUOM: Record "Item Unit of Measure";
WhseActivityLine: Record "Warehouse Activity Line";
DecQty: Decimal;
IntLineNo: Integer;
begin
//**********************************************************
// category : Warehouse
// description: Validates Quantity to Handle against calculated Quantity based on new Unit of Measure.
//**********************************************************
Evaluate(IntLineNo, LineNo);
Evaluate(DecQty, QtyToHandle);
WhseActivityLine.RESET();
WhseActivityLine.SETRANGE("No.", DocNo);
WhseActivityLine.SETRANGE("Line No.", IntLineNo);
WhseActivityLine.SETRANGE("Item No.", ItemCode);
if WhseActivityLine.FINDFIRST() then
if (ItemUOM.GET(ItemCode, ToUOM)) then
if (DecQty > (WhseActivityLine."Qty. (Base)" / ItemUOM."Qty. per Unit of Measure")) then
exit(false)
else
exit(true);
end;
DAW_CheckforSameUOM
code
procedure DAW_CheckforSameUOM(FromUOM: Text; ToUOM: Text): Boolean
begin
//**********************************************************
// category : Warehouse
// description: throws an error if From UOM & To UOM are same
//**********************************************************
if FromUOM = ToUOM then
exit(false)
else
exit(true);
end;
DAW_GetTransShipTrackingQuantity
code
procedure DAW_GetTransShipTrackingQuantity(ItemNo: Code[20]; "Table": Integer; DocumentType: Integer; DocumentNo: Code[20]; DocumentLineNo: Integer; LotNo: Code[20]; SerialNo: Code[20]; DocumentBatch: Code[10]; ProdOrderLineNo: Integer): Decimal
var
tempTrackSpecification: Record "Tracking Specification" temporary;
WMSFunctionList: Codeunit "ANY WMS Function List";
Direction: Integer;
begin
//**********************************************************
// category : Tracking
// description: Retrieves the quantity tracked for provided item tracking details
//**********************************************************
tempTrackSpecification."Item No." := ItemNo;
tempTrackSpecification."Source Type" := Table;
tempTrackSpecification."Source Subtype" := DocumentType;// ignore
tempTrackSpecification."Source ID" := DocumentNo;
tempTrackSpecification."Source Ref. No." := DocumentLineNo;
tempTrackSpecification."Lot No." := LotNo;
tempTrackSpecification."Serial No." := SerialNo;
tempTrackSpecification."Source Batch Name" := DocumentBatch;
tempTrackSpecification."Source Prod. Order Line" := ProdOrderLineNo;//
Direction := 0;
exit(WMSFunctionList.GetTransferTrackingQty(tempTrackSpecification, Direction));
end;
DAW_GetTransReceiveTrackingQuantity
code
procedure DAW_GetTransReceiveTrackingQuantity(ItemNo: Code[20]; "Table": Integer; DocumentType: Integer; DocumentNo: Code[20]; DocumentLineNo: Integer; LotNo: Code[20]; SerialNo: Code[20]; DocumentBatch: Code[10]; ProdOrderLineNo: Integer): Decimal
var
tempTrackSpecification: Record "Tracking Specification" temporary;
WMSFunctionList: Codeunit "ANY WMS Function List";
Direction: Integer;
begin
//**********************************************************
// category : Tracking
// description: Retrieves the quantity tracked for provided item tracking details
//**********************************************************
tempTrackSpecification."Item No." := ItemNo;
tempTrackSpecification."Source Type" := Table;
tempTrackSpecification."Source Subtype" := DocumentType;// ignore
tempTrackSpecification."Source ID" := DocumentNo;
tempTrackSpecification."Source Ref. No." := DocumentLineNo;
tempTrackSpecification."Lot No." := LotNo;
tempTrackSpecification."Serial No." := SerialNo;
tempTrackSpecification."Source Batch Name" := DocumentBatch;
tempTrackSpecification."Source Prod. Order Line" := ProdOrderLineNo;//
Direction := 1;
exit(WMSFunctionList.GetTransferTrackingQty(tempTrackSpecification, Direction));
end;
DAW_GetWhseActLineBreakBulkActive
code
procedure DAW_GetWhseActLineBreakBulkActive(ActivityType: Code[20]; ActivityNo: Code[20]; ActivityLineNo: Integer): Boolean
var
WhseActLine: Record "Warehouse Activity Line";
WMSFunctionsList: Codeunit "ANY WMS Function List";
lActivityType: Option " ","Put-away",Pick,Movement,"Invt. Put-away","Invt. Pick","Invt. Movement";
begin
//**********************************************************
// category : Warehouse
// description: returns a yes or no if activity block breakbulk applies to this warehouse.
//**********************************************************
Evaluate(lActivityType, ActivityType);
if WhseActLine.GET(lActivityType, ActivityNo, ActivityLineNo) then
exit(WMSFunctionsList.WhseActLineHasBreakBulk(WhseActLine));
end;
DAW_GetWhseActLineBreakBulkRemark
code
procedure DAW_GetWhseActLineBreakBulkRemark(ActivityType: Code[20]; ActivityNo: Code[20]; ActivityLineNo: Integer; ActionType: Code[20]): Text
var
WhseActLine: Record "Warehouse Activity Line";
WMSFunctionsList: Codeunit "ANY WMS Function List";
lActivityType: Option " ","Put-away",Pick,Movement,"Invt. Put-away","Invt. Pick","Invt. Movement";
lActionType: Option " ",Take,Place;
begin
//**********************************************************
// category : Warehouse
// description: returns a text of the breakbulk rule.
//**********************************************************
Evaluate(lActivityType, ActivityType);
Evaluate(lActionType, ActionType);
if WhseActLine.GET(lActivityType, ActivityNo, ActivityLineNo) then
if WMSFunctionsList.WhseActLineHasBreakBulk(WhseActLine) and (lActionType > 0) then
exit(WMSFunctionsList.WhseActLineComposeRemark(lActionType, WhseActLine));
end;
DAW_ClearTrackingBuffer
code
procedure DAW_ClearTrackingBuffer(CurrSession: Text)
var
SourceItemTrackingLine: Record "ANY Source Item Trck. Line";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Removes tracking data from buffertable
//**********************************************************
Evaluate(SessionGuid, CurrSession);
SourceItemTrackingLine.SetRange("Created By", SessionGuid);
if not SourceItemTrackingLine.IsEmpty() then
SourceItemTrackingLine.DeleteAll();
end;
DAW_SetTrackingBufferForSalesLine
code
procedure DAW_SetTrackingBufferForSalesLine(DocType: Integer; DocNo: Code[20]; LineNo: Integer; SessionID: Text)
var
SalesLine: Record "Sales Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on a Sales Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if SalesLine.GET(DocType, DocNo, LineNo) then
SourceItemTrackingList.FillBufferForSalesLine(SalesLine, SessionGuid);
end;
DAW_SetTrackingBufferForPurchLine
code
procedure DAW_SetTrackingBufferForPurchLine(DocType: Integer; DocNo: Code[20]; LineNo: Integer; SessionID: Text)
var
PurchaseLine: Record "Purchase Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on a Purchase Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if PurchaseLine.GET(DocType, DocNo, LineNo) then
SourceItemTrackingList.FillBufferForPurchLine(PurchaseLine, SessionGuid);
end;
DAW_SetTrackingBufferForItemJrnlLine
code
procedure DAW_SetTrackingBufferForItemJrnlLine(JnlTemplate: Code[10]; JnlBatch: Code[10]; LineNo: Integer; SessionID: Text)
var
ItemJournalLine: Record "Item Journal Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on an Item Journal Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if ItemJournalLine.GET(JnlTemplate, JnlBatch, LineNo) then
SourceItemTrackingList.FillBufferForItemJnlLine(ItemJournalLine, SessionGuid);
end;
DAW_SetTrackingBufferForItemJournalData
code
procedure DAW_SetTrackingBufferForItemJournalData(JnlTemplate: Code[10]; JnlBatch: Code[10]; LineNo: Integer; ItemNo: Code[20]; LocationCode: Code[20]; SessionID: Text)
var
ItemJournalLine: Record "Item Journal Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on an Item Journal Line
//**********************************************************
ItemJournalLine."Journal Template Name" := JnlTemplate;
ItemJournalLine."Journal Batch Name" := JnlBatch;
ItemJournalLine."Line No." := LineNo;
ItemJournalLine."Item No." := ItemNo;
ItemJournalLine."Location Code" := LocationCode;
Evaluate(SessionGuid, SessionID);
SourceItemTrackingList.FillBufferForItemJnlLine(ItemJournalLine, SessionGuid);
end;
DAW_SetTrackingBufferForWhseReceiptLine
code
procedure DAW_SetTrackingBufferForWhseReceiptLine(ReceiptNo: Code[20]; LineNo: Integer; SessionID: Text)
var
WarehouseReceiptLine: Record "Warehouse Receipt Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data for a Whse Receipt Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if WarehouseReceiptLine.GET(ReceiptNo, LineNo) then
SourceItemTrackingList.FillBufferForWhseReceiptLine(WarehouseReceiptLine, SessionGuid);
end;
DAW_SetTrackingBufferForWhseShipLine
code
procedure DAW_SetTrackingBufferForWhseShipLine(ShipNo: Code[20]; LineNo: Integer; SessionID: Text)
var
WarehouseShipmentLine: Record "Warehouse Shipment Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on a Whse Shipment Line
//**********************************************************.
Evaluate(SessionGuid, SessionID);
if WarehouseShipmentLine.GET(ShipNo, LineNo) then
SourceItemTrackingList.FillBufferForWhseShptLine(WarehouseShipmentLine, SessionGuid);
end;
DAW_SetTrackingBufferForWhseActLine
code
procedure DAW_SetTrackingBufferForWhseActLine(ActivityType: Integer; ActivityNo: Code[20]; LineNo: Integer; SessionID: Text)
var
WarehouseActivityLine: Record "Warehouse Activity Line";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on a Whse Activity Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if WarehouseActivityLine.GET(ActivityType, ActivityNo, LineNo) then
SourceItemTrackingList.FillBufferForWhseActLine(WarehouseActivityLine, SessionGuid);
end;
DAW_SetTrackingBufferForTransferLine
code
procedure DAW_SetTrackingBufferForTransferLine(DocumentNo: Code[20]; LineNo: Integer; Direction: Integer; SessionId: Text)
var
TransferLine: Record "Transfer Line";
SourceItemTrackingList: Codeunit "ANY Tr.Ship Item Track List";
RecRef: RecordRef;
TransferDirection: Enum "Transfer Direction";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on a Transfer Line
//**********************************************************
Evaluate(SessionGuid, SessionID);
if TransferLine.GET(DocumentNo, LineNo) then begin
RecRef.GetTable(TransferLine);
Evaluate(TransferDirection, Format(Direction));
SourceItemTrackingList.RetrieveTransLineItemTracking(RecRef, TransferDirection, SessionID);
end;
end;
DAW_SetTrackingBufferForBinContent
code
procedure DAW_SetTrackingBufferForBinContent(LocationCode: Code[10]; BinCode: Code[20]; ItemNo: Code[20]; VariantCode: Code[10]; UoMCode: Code[10]; SessionID: Text)
var
BinContent: Record "Bin Content";
SourceItemTrackingList: Codeunit "ANY Source Item Tracking List";
SessionGuid: Guid;
begin
//**********************************************************
// category : Tracking
// description: Fills Trackingbuffer with lookup data based on Bin Content
//**********************************************************
Evaluate(SessionGuid, SessionID);
BinContent.SETRANGE("Item No.", ItemNo);
BinContent.SETRANGE("Location Code", LocationCode);
BinContent.SETRANGE("Bin Code", BinCode);
if VariantCode <> '' then
BinContent.SETRANGE("Variant Code", VariantCode);
if UoMCode <> '' then
BinContent.SETRANGE("Unit of Measure Code", UoMCode);
if BinContent.FINDFIRST() then
SourceItemTrackingList.FillBufferForBinContent(BinContent, SessionGuid);
end;