How to end a quarantine order through x++ code?

Hi,

I've a customized form that will reduce onhand quantity by posting a pickinglist journal and when i enter a negative quantity it will create a quarantine order for that item though web service

I need to end that quarantine order through code

This is my class that i'm passing values from webpage to ax:

public void insertcreatetool(str location,str itemid,str prodid,str wrkctr,str wrkctrname,str empid,real qty,real onhand)
{
    ProdJournalTable    prodJournalTable;
    ProdJournalBOM      prodJournalBOM;
    toolitemlocationmaster tilm;
    inventdim           invdim;
    ProdTable           prodTable;
    ToolConsumption tcm;
    ProdJournalCheckPostBOM     prodJournalCheckPostbom;
    str message;
    Inventquarantinemultiend iqe=new Inventquarantinemultiend();
    SysFormRun_doRe                 sysFormRun_doRe;
    InventQuarantineOrder inq;
    Args args;
    ;
    breakpoint;
    select tcm;
    tcm.Location=location;
    tcm.ToolID=itemid;
    tcm.ProdID=prodid;
    tcm.wrkCtrId=wrkctr;
    tcm.wrkCtrName=wrkctrname;
    tcm.EmplId=empid;
    tcm.Qty=qty;
    tcm.OnHandWhenPicked=onhand;
    tcm.insert();
    message="Inserted and Journal Created in Tool Consumption";
        prodJournalTable.clear();
        prodJournalTable.initValue();
        prodJournalTable.JournalType    = ProdJournalType::Picklist;
        prodJournalTable.JournalNameId  = 'pickJrnl';
        prodJournalTable.Description    = " Prod pick list journal";
        prodJournalTable.ProdId         = tcm.ProdID;
        prodJournalTable.VoucherDraw    = JournalVoucherDraw::Post;
        prodJournalTable.NumOfLines = 1;
        prodJournalTable.VoucherSeqId = NumberSequenceTable::find(ProdParameters::numRefProdJournalVoucherId().NumberSequence).NumberSequence;
        prodJournalTable.insert();

        prodJournalBOM.clear();
        prodJournalBOM.initValue();
        prodJournalBOM.JournalId        = prodJournalTable.JournalId;
        prodJournalBOM.initFromInventTable(InventTable::find(tcm.ToolID));
        prodJournalBom.ProdId           = tcm.ProdID;
        prodJournalBom.LineNum          = 1;

        select tilm where tilm.InventLocationId == tcm.Location && tilm.ItemId == tcm.ToolID;
        select inventdimid from invdim where invdim.wMSLocationId == tilm.InventLocationId && invdim.InventSiteId == tilm.InventSiteId && invdim.InventLocationId == tilm.InventWarehouse;

        prodJournalBom.InventDimId      = invdim.inventDimId;//"00014332_069";
        //    prodJournalBom.TransDate        = systemDateGet();
        prodJournalBom.BOMUnitId        = "Pcs";
        prodJournalBom.BOMConsump       = tcm.Qty;
        prodJournalBom.InventConsump    = tcm.Qty;
        prodJournalBom.Comments         = "Workcenter ID: "+tcm.wrkCtrId;
        prodJournalBom.insert();

        ttsBegin;
        tcm.selectForUpdate(true);
        tcm.JournalId = prodJournalTable.JournalId;
        tcm.update();
        ttsCommit;
        try
        {
            ttsbegin;
            prodJournalCheckPostbom = prodJournalCheckPostbom::newPostJournal(tcm.JournalId,true);
            prodJournalCheckPostbom.run();
            ttscommit;
        }
        catch(Exception::Error)
        {
            continue;
        }
    
    
    iqe.run();
    ttsbegin;
    inq.selectForUpdate(true);
    inq.Status=InventQuarantineStatus::Ended;
    inq.update();
    ttscommit;

   
}

i need to end this quarantine order for this tool consumption with neegative quantity

Parents Reply Children
No Data
Related
Recommended