change warehouse in the table components of the production order

kanikakanika Member Posts: 247
Hi Experts! NAV2017

When the production order is updated and the data is written in the table of components of the order, I need the warehouse of these components to be that of the work center, because it is an external job.

I have looked at the code coverage and I think it is written to the CU 99000845 but I do not see exactly where the component reservation line is written because I have changed the code in "SetProdOrderComponent" but it does not make the reservation of the component in the work center warehouse.

I have replaced line 202
CalcReservEntry. "Location Code": = NewProdOrderComp. "Location Code"
for the code

pRutaOrden.RESET;
pRutaOrden.SETRANGE ("Prod. Order No.", NewProdOrderComp. "Prod. Order No.");
pRutaOrden.SETRANGE (Type, pRutaOrden.Type :: "Work Center");
pRutaOrden.SETRANGE ("Work Center Group Code", "EXTERNAL");
IF pRutaOrden.FINDFIRST THEN BEGIN
pCenTra.RESET;
pCenTra.SETRANGE ("Work Center Group Code", pRutaOrden. "Work Center Group Code");
pCenTra.SETRANGE ("Subcontractor No.", '<> ""');
IF pCenTra.FINDFIRST THEN
CalcReservEntry. "Location Code": = pCenTra. "Location Code";
END ELSE
CalcReservEntry. "Location Code": = NewProdOrderComp. "Location Code";

where
pRutaOrden (record, Prod. Order Routing Line)
pCenTra (record, Work Center)

Is not this Cu?
Is not it the right place?
Is not the code correct?

Thanks in advance

Best Answer

  • kanikakanika Member Posts: 247
    Answer ✓
    I finally solved this matter by putting this code in the OnInsert of the table 5407


    pRutaOF.RESET;
    pRutaOF.SETRANGE("Prod. Order No.","Prod. Order No.");
    pRutaOF.SETRANGE("Routing Reference No.","Prod. Order Line No.");
    pRutaOF.SETRANGE("Routing Link Code","Routing Link Code");
    IF pRutaOF.FINDFIRST THEN BEGIN
    IF pWorkCenter.GET(pRutaOF."Work Center No.") THEN BEGIN
    IF (pWorkCenter."Location Code"<>'') AND (pWorkCenter."Subcontractor No."<>'') THEN
    "Location Code":=pWorkCenter."Location Code";
    END;
    END;

Answers

  • HannesHolstHannesHolst Member Posts: 119
    edited 2018-02-05
    Hi,

    What is the reason, why you don't transfer the stock into the new location using a Transfer Order?
  • kanikakanika Member Posts: 247
    to avoid customer work
    if I use the transfer order they would have to do 2 + invoice, if I can do it from the production order they will save the 2 transfer orders and can invoice directly from the purchase order generated from the production order.
  • kanikakanika Member Posts: 247
    Answer ✓
    I finally solved this matter by putting this code in the OnInsert of the table 5407


    pRutaOF.RESET;
    pRutaOF.SETRANGE("Prod. Order No.","Prod. Order No.");
    pRutaOF.SETRANGE("Routing Reference No.","Prod. Order Line No.");
    pRutaOF.SETRANGE("Routing Link Code","Routing Link Code");
    IF pRutaOF.FINDFIRST THEN BEGIN
    IF pWorkCenter.GET(pRutaOF."Work Center No.") THEN BEGIN
    IF (pWorkCenter."Location Code"<>'') AND (pWorkCenter."Subcontractor No."<>'') THEN
    "Location Code":=pWorkCenter."Location Code";
    END;
    END;
Sign In or Register to comment.