Assign Serial/Lot No. auto
ignasijuan
Member Posts: 21
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.
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
-
Recently i used below code to assign serial no. to the prod. order line, you might need to tweak this little bit since i am using the serial nos (no. series) on the item card to assign the serial no.
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;0 -
Thanks Suresh!
I'll try this code and now I will tell you how works!! =D> =D> =D>0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions