13. November 2008 17:05
14. November 2008 13:55
14. November 2008 14:11
14. November 2008 14:27
18. November 2008 12:43
GetItem;
IF Item."Item Tracking Code" = '' THEN
EXIT;
GetTransHeader;
TransHeader.TESTFIELD("Posting Date");
TestStatusOpen;
TempTrkgSpec.RESET;
TempTrkgSpec.DELETEALL;
CLEAR(ReserveTransferLine);
ReserveTransferLine.InitTrackingSpecification(
Rec,
SourceTrkgSpec,
AvailDate,
0 {Direction::Outbound});
NextTrackingNo := 1;
ReserveTransferLine.DeleteLine(Rec);
IF NOT ItemTrkgMgtPhysInvtLine.LocationIsBinMandatory("Transfer-from Code") THEN BEGIN
ItemLedgEntry.RESET;
ItemLedgEntry.SETCURRENTKEY(
"Item No.", "Entry Type", "Variant Code", "Drop Shipment", "Location Code", "Posting Date");
ItemLedgEntry.SETRANGE("Item No.", "Item No.");
ItemLedgEntry.SETRANGE("Variant Code", "Variant Code");
ItemLedgEntry.SETRANGE("Location Code", "Transfer-from Code");
ItemLedgEntry.SETRANGE("Posting Date", 0D, TransHeader."Posting Date");
IF ItemLedgEntry.FIND('-') THEN REPEAT
IF NOT FindTrackingSpec(SourceTrkgSpec, ItemLedgEntry."Serial No.", ItemLedgEntry."Lot No.", TempTrkgSpec)
THEN BEGIN
TempTrkgSpec := SourceTrkgSpec;
TempTrkgSpec.VALIDATE("Lot No.", ItemLedgEntry."Lot No.");
TempTrkgSpec.VALIDATE("Serial No.", ItemLedgEntry."Serial No.");
TempTrkgSpec.VALIDATE("Quantity (Base)", ItemLedgEntry.Quantity);
TempTrkgSpec."Entry No." := NextTrackingNo;
TempTrkgSpec.INSERT;
NextTrackingNo += 1;
END ELSE BEGIN
TempTrkgSpec."Quantity (Base)" += ItemLedgEntry.Quantity;
TempTrkgSpec.VALIDATE("Quantity (Base)");
TempTrkgSpec.MODIFY;
END;
UNTIL ItemLedgEntry.NEXT = 0;
END ELSE BEGIN
WhseEntry.RESET;
WhseEntry.SETCURRENTKEY(
"Location Code", "Bin Code", "Item No.", "Variant Code");
WhseEntry.SETRANGE("Location Code", "Transfer-from Code");
WhseEntry.SETRANGE("Bin Code", "Transfer-from Bin Code");
WhseEntry.SETRANGE("Item No.", "Item No.");
WhseEntry.SETRANGE("Variant Code", "Variant Code");
WhseEntry.SETRANGE("Registering Date", 0D, TransHeader."Posting Date");
IF WhseEntry.FIND('-') THEN
REPEAT
IF NOT FindTrackingSpec(SourceTrkgSpec, WhseEntry."Serial No.", WhseEntry."Lot No.", TempTrkgSpec)
THEN BEGIN
TempTrkgSpec := SourceTrkgSpec;
TempTrkgSpec.VALIDATE("Lot No.", WhseEntry."Lot No.");
TempTrkgSpec.VALIDATE("Serial No.", WhseEntry."Serial No.");
TempTrkgSpec.VALIDATE("Quantity (Base)", WhseEntry."Qty. (Base)");
TempTrkgSpec."Entry No." := NextTrackingNo;
TempTrkgSpec.INSERT;
NextTrackingNo += 1;
END ELSE BEGIN
TempTrkgSpec."Quantity (Base)" += WhseEntry."Qty. (Base)";
TempTrkgSpec.VALIDATE("Quantity (Base)");
TempTrkgSpec.MODIFY;
END;
UNTIL WhseEntry.NEXT = 0;
END;
// Necessary in order not to reserve Lot Nos. with Quantity = 0
// Notwendig für individuelll angepasste Funktion
// ItemTrkgLines.RegisterItemTrackingLines
TempTrkgSpec.RESET;
IF TempTrkgSpec.FINDSET THEN
REPEAT
IF TempTrkgSpec."Quantity (Base)" <> 0 THEN BEGIN
i += 1;
TempTrkgSpec2 := TempTrkgSpec;
TempTrkgSpec2."Entry No." := i;
TempTrkgSpec2.INSERT;
END;
UNTIL TempTrkgSpec.NEXT = 0;
CLEAR(ItemTrkgLines);
ItemTrkgLines.SetBlockCommit(TRUE);
ItemTrkgLines.RegisterItemTrackingLines(SourceTrkgSpec, AvailDate, TempTrkgSpec2); // Hier Anpassungen notwendig
// Parameter:
// SourceTrkgSpec : Record "Tracking Specification";
// SerialNo : Code[20];
// LotNo : Code[30];
// VAR TempTargetTrkgSpec : TEMPORARY Record "Tracking Specification"
WITH TempTargetTrkgSpec DO BEGIN
RESET;
SETRANGE("Source Type", SourceTrkgSpec."Source Type");
SETRANGE("Source Subtype", SourceTrkgSpec."Source Subtype");
SETRANGE("Source ID", SourceTrkgSpec."Source ID");
SETRANGE("Source Ref. No.", SourceTrkgSpec."Source Ref. No.");
SETRANGE("Serial No.", SerialNo);
SETRANGE("Lot No.", LotNo);
EXIT(FINDFIRST);
END;
ItemTrkgLines.RegisterItemTrackingLines