Is there a way to improve this dynamic topology update work

I am working on installing AX 2009. The goal is to update the WMSOrderTrans table. Here is what I got so far:

WMSOrderTrans   wmsOrderTrans;
;

while select wmsOrderTrans
{
    if (wmsOrderTrans.BBBpackingSlipExists())
    {
        ttsBegin;
        wmsOrderTrans.selectForUpdate(true);
        wmsOrderTrans.BBBPackingSlipExists  =   NoYes::Yes;
        wmsOrderTrans.doUpdate();
        ttsCommit;
    }
}

The task takes about an hour to complete the test. This makes me worry about performance on a production system.

Currently, the code is written in such a way as to have minimal locking problems (selectForUpdate is executed for each line if it needs to be updated and then immediately executed). The reason is that users will work in the system when the work is done.

My question is: if there is a reasonable way to implement this task with less transaction costs.

while select forUpdate ...

... , , .

.


BBBPackingSlipExists:

display boolean BBBpackingSlipExists()
    {
    InventDim               inventDimCur;
    InventDim               inventDimPackSlip;
    InventTrans             inventTransPackSlip;

    ;

    select firstonly RecId from inventTransPackSlip
        where inventTransPackSlip.InventTransId == this.inventTransId
            && (inventTransPackSlip.StatusIssue == StatusIssue::Deducted
                || inventTransPackSlip.StatusIssue == StatusIssue::Sold)
            && !inventTransPackSlip.PackingSlipReturned
        exists join inventDimCur
            where inventDimCur.inventDimId == this.inventDimId
        exists join inventDimPackSlip
            where inventDimPackSlip.inventDimId == inventTransPackSlip.inventDimId
                && inventDimCur.inventSerialId  == inventDimPackSlip.inventSerialId
    ;
if (inventTransPackSlip.RecId != 0 && this.isReserved)
{
    return true;
}
return false;

}

+4
1

, - . , , 2009 ( 2012 ), , , .

, isreserved, packingslipexists

static void Job250(Args _args)
{
    WMSOrderTrans           wmsOrderTrans;
    InventDim               inventDimCur;
    InventDim               inventDimPackSlip;
    InventTrans             inventTransPackSlip;
    ;
    wmsOrderTrans.skipDatabaseLog(true);
    wmsOrderTrans.skipDataMethods(true);
    wmsOrderTrans.skipEvents(true);
    update_recordset wmsOrderTrans setting BBBPackingSlipExists  = NoYes::Yes
        where wmsOrderTrans.isReserved
        exists join inventTransPackSlip
        where inventTransPackSlip.InventTransId == wmsOrderTrans.inventTransId
          && (inventTransPackSlip.StatusIssue == StatusIssue::Deducted
           || inventTransPackSlip.StatusIssue == StatusIssue::Sold)
          && !inventTransPackSlip.PackingSlipReturned
        exists join inventDimCur
        where inventDimCur.inventDimId == wmsOrderTrans.inventDimId
        exists join inventDimPackSlip
        where inventDimPackSlip.inventDimId == inventTransPackSlip.inventDimId
           && inventDimCur.inventSerialId  == inventDimPackSlip.inventSerialId;       
}

update_recordset skip *

+12

Source: https://habr.com/ru/post/1617383/


All Articles