Mass Assign Serial Numbers

matttraxmatttrax Member Posts: 2,309
I'm trying to come up with a good way to assign serial numbers to every item on an order that requires them in one step. Currently you would have to go into Line --> Item Tracking Lines for every single line. This is a problem and takes too much time if you have a big order.

I'm thinking a link on the Order button, but I can't come up with a good way to do the code behind it. I want to build on what is already there, but almost all of the code is in Form 6510 - Item Tracking Lines.

I've looked at the code behind how this works, but I can't think of a way to do it for multiple items and then open the form. Or better yet not open the form at all and just pretend like I clicked on Functions --> Assign Serial from that form.

Has anyone else done this before? Do you have any suggestions or a best practice way to implement this? Any comments are helpful. Thanks.

Comments

  • ssinglassingla Member Posts: 2,973
    Not exactly the same.

    We did a modification to track the Raw Material with the Lot Number of the Finished Goods. Manufacturing module was not in place and we assigned the lot number of the Finished Goods i.e. Positive adjustment in the Item Journal Line to all the negative adjustment line in the batch.

    But assigning number in the serial order will be different :mrgreen:
    CA Sandeep Singla
    http://ssdynamics.co.in
  • SavatageSavatage Member Posts: 7,142
    I'm not familiar with the use of serial numbers but I was thinking a button on the header.
    IF NOT DIALOG.CONFIRM("Would You Like To Get Serial Numbers For These Items",TRUE) 
     THEN EXIT
     ELSE
      SalesLine.RESET;
      SalesLine.SETRANGE("Document Type","Document Type");
      SalesLine.SETRANGE("Document No.","No.");
      IF SalesLine.FIND('-') THEN
        REPEAT
          //Your Code To Get The Serial Info LIke How (Functions --> Assign Serial) Works
         SalesLine.MODIFY(TRUE);
        UNTIL SalesLine.NEXT = 0;
    
    That's if it uses sales line?? Not Sure, but the rest works 8)
  • ssinglassingla Member Posts: 2,973
    I wonder if Sales Line stores the Serial No. info.

    For a order of 10 items there can be 10 serial number..... :-k
    CA Sandeep Singla
    http://ssdynamics.co.in
  • SavatageSavatage Member Posts: 7,142
    The sales line was an excample - not sure how serials work but I can Mass change "lines" with the Repeat->Until statement.
    Then he'll have to figure a way in code of how the assigning can work "every time"!
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Why not use the standard Navision function of assigning custom S/N?

    When you're at the item tracking line, click on Function --> Create Customized S/N. Then it'll assign the S/Ns you want.
  • SavatageSavatage Member Posts: 7,142
    matttrax wrote:
    This is a problem and takes too much time if you have a big order.

    :-k
  • Alex_ChowAlex_Chow Member Posts: 5,063
    Use the standard feature out of the box. Why try to reinvent the wheel?
  • matttraxmatttrax Member Posts: 2,309
    I think most of the latter comments missed the point of the post. I know I can do it from the Item Tracking Window. The point is what if you have 50 lines on an order, each of which requires you to assign serial numbers. You have to manually click Line --> Item Tracking Lines, then Functions --> Assign Serial or Create Customized Serial. That's 4 clicks a line, or 200 clicks on a 50 line order. 200 clicks vs. 2 clicks is a lot of time saved for the user.

    So it's not about how you do it now, or reinventing anything. It's about coming up with a way to make the user's job quicker so that they can process more orders in a given amount of time. I think it's a legitimate mod request.

    Anyway, it seems like most people are not familiar with serialized inventory, but if someone is and has any suggestions I'd love to hear them. This mod is a lot more complicated that I thought it would be. Thanks for the help everyone.
  • kinekine Member Posts: 12,562
    Yes, the serial no. and lot no. are implemented in a way, which is not easy to modify (too much code on forms etc.).

    But there is easy way how to "assign" new lot/ser no. for some purchase/sales line. The base is these two functions:
    CreateReservEntryFor(
        ForType,ForSubtype,ForID,ForBatchName,ForProdOrderLine,ForRefNo,
        ForQtyPerUOM,Quantity,ForSerialNo,ForLotNo,ForExpirationDate);
    
    CreateEntry(ItemNo,VariantCode,LocationCode,Description,ExpectedReceiptDate,
        ShipmentDate,TransferredFromEntryNo,Status);
    

    from codeunit 99000830 Create Reserv. Entry. If you call these two functions, the codeunit will create the correct entry for you.

    Than code for creating the tracking line for purchase lie can look like:
    CreateReservEntry.SetDates(
      0D,"Expiration Date");
    
    CreateReservEntry.CreateReservEntryFor(
      DATABASE::"Purchase Line",
      "Document Type",
      "Document No.",
      '',
      0,
      "Line No.",
      "Qty. per Unit of Measure",
      "Qty. to Receive (Base)",
      '',
      LotNo,
      "Expiration Date");
    CreateReservEntry.CreateEntry("No.",
      "Variant Code",
      "Location Code",
      Description,
      "Expected Receipt Date",
      "Order Date",0,2);
    

    If you create some batch doing that for each line you need for each lot/ser no. you need to assign, and if you add all the tests and other code (e.g. for testing if some lot/ser no. is already assigned, received etc.) you are done.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • girish.joshigirish.joshi Member Posts: 407
    Kine's method is what I've used in the past. You can use your own functions to create the reservation entry by hand too.

    The nice thing about this method is that it work well with the normal user process. Once the reservation entries are created, if the user goes back to the item tracking lines they just appear because they are created on the fly based on the reservation entries.
  • kinekine Member Posts: 12,562
    The example of the code is inspired by code executed when you close the form with Item Tracking. It is the core of the proces saving the temporary data into reservation entry. It means it is "standard" code for doing that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.