Hi, I am trying to assign serial numbers / lot numbers in a Production Order when the status is changed to released.
This code must be deployed in the codeunit 5407 Prod. Order Status Management in the ChangeStatusOnProdOrder procedure.
The goal of this code is simulate exactly the functions Assign Serial No /Assign Lot No implemented in page 6510 Item Tracking Lines.
But:
1. Copying de code I think it's very hard (I was trying to do that) due to the dependences of many local variables, arrays, temporary tables, defined on the page and filled when is opened and only when the page is closed is when Tracking Specification records are recorded a Reservation Entry (WritetoDatabase).
2. Maybe define a Variable with the Page 6510 but the problem I have is that all functions that work on this page are local, and I think that the local procedures can´t be called by an external codeunit.
Is there a more direct way to assign these serial numbers? or maybe I should continue developing point 1. or point 2.?
Thanks a lot.
0
Comments
WITH ProdOrderLine DO BEGIN
IF ((Quantity = 0)
OR (Quantity = xProdOrderLine.Quantity)) AND ((xProdOrderLine."Location Code" = ProdOrderLine."Location Code")) THEN
EXIT;
IF (xProdOrderLine."Location Code" <> "Location Code") OR (xProdOrderLine.Quantity > ProdOrderLine.Quantity) THEN BEGIN
ReserveProdLine.FilterReservFor(FilterReservEntry,ProdOrderLine);
FilterReservEntry.SETFILTER("Serial No.",'<>%1','');
FilterReservEntry.DELETEALL(TRUE);
END;
IF ReserveProdLine.FindReservEntry(ProdOrderLine,FilterReservEntry) THEN BEGIN
FilterReservEntry.SETFILTER("Serial No.",'<>%1','');
FilterReservEntry.CALCSUMS("Quantity (Base)");
END;
Item.GET(ProdOrderLine."Item No.");
FOR i := 1 TO ABS(FilterReservEntry."Quantity (Base)" - Quantity) DO BEGIN
CLEAR(TrackingSpecification);
ReserveProdLine.InitTrackingSpecification(ProdOrderLine,TrackingSpecification);
TrackingSpecification.VALIDATE("Quantity (Base)",1);
TrackingSpecification.SetSkipSerialNoQtyValidation(TRUE);
TrackingSpecification.VALIDATE("Serial No.",NoSeriesMgt.GetNextNo(Item."Serial Nos.",WORKDATE,TRUE));
IF ItemTrackingMgt.IsOrderNetworkEntity(TrackingSpecification."Source Type",
TrackingSpecification."Source Subtype")
THEN
CurrentEntryStatus := CurrentEntryStatus::Surplus
ELSE
CurrentEntryStatus := CurrentEntryStatus::Prospect;
CreateReservEntry.SetDates(
TrackingSpecification."Warranty Date",TrackingSpecification."Expiration Date");
CreateReservEntry.SetApplyFromEntryNo(
TrackingSpecification."Appl.-from Item Entry");
CreateReservEntry.CreateReservEntryFor(
TrackingSpecification."Source Type",
TrackingSpecification."Source Subtype",
TrackingSpecification."Source ID",
TrackingSpecification."Source Batch Name",
TrackingSpecification."Source Prod. Order Line",
TrackingSpecification."Source Ref. No.",
TrackingSpecification."Qty. per Unit of Measure",
TrackingSpecification."Quantity (Base)",
TrackingSpecification."Quantity (Base)",
TrackingSpecification."Serial No.",
TrackingSpecification."Lot No.");
CreateReservEntry.CreateEntry(TrackingSpecification."Item No.",
TrackingSpecification."Variant Code",
TrackingSpecification."Location Code",
TrackingSpecification.Description,
"Due Date",
0D,0,CurrentEntryStatus);
END;
END;
ArcherPoint, Inc http://www.archerpoint.com
Blog: http://www.navisionworld.com
skkulla
I'll try this code and now I will tell you how works!! =D> =D> =D>