Dynamics AX 2012 Form 简单查询

1、查询按钮方法:

void clicked()
{
    super();

    element.executeQuery();
}

2、executeQuery方法(Form方法),setTmpData为tmp(InMenory)类型表方法

public void executeQuery()
{
    TEK_InventSumShelfLifeTmp l_table;

    TEK_InventSumShelfLifeTmp.setTmpData(this.populateRecords());
    TEK_InventSumShelfLifeTmp_ds.research();
}

3、populateRecords方法(Form方法)

private TEK_InventSumShelfLifeTmp populateRecords()
{
    TEK_InventSumShelfLifeTmp   l_ret;
    InventTable                 l_item;
    InventDim                   l_dim;
    InventBatch                 l_batch;
    InventSum                   l_inv;

    date l_date;
    l_date = AsOfDate.dateValue();
    while select ItemId
    from l_item
        where l_item.TEK_ShelfLife > 0
        join l_inv
        where l_inv.ItemId == l_item.ItemId
        && l_inv.PostedQty + l_inv.Received - l_inv.Deducted
           + l_inv.Registered - l_inv.Picked > 0
        join l_dim
        where l_inv.InventDimId == l_dim.inventDimId
        join l_batch
        where l_dim.inventBatchId == l_batch.inventBatchId
        && l_batch.itemId == l_item.ItemId
        && l_batch.expDate <= endmth(l_date)
    {
        l_ret.clear();
        l_ret.ItemId = l_item.ItemId;
        l_ret.ItemName = l_inv.itemName();
        l_ret.ItemDescription = l_inv.TEK_ItemDescription();
        l_ret.UnitId = l_item.inventUnitId();
        l_ret.InventLocationId = l_dim.InventLocationId;
        l_ret.wMSLocationId = l_dim.wMSLocationId;
        l_ret.InventBatchId = l_dim.inventBatchId;

        //InventQtyPhysicalOnhand = this.PostedQty + this.Received - this.Deducted + this.Registered - this.Picked;
        l_ret.InventQty = l_inv.PostedQty + l_inv.Received - l_inv.Deducted
                            + l_inv.Registered - l_inv.Picked;
        l_ret.ExpirationDate = l_batch.expDate;
        l_ret.insert();
    }
    return l_ret;
}


    Danzel
    Danzel管理员

    • 声明:本文由Danzel于2020-12-28转载(优化),转载须经原站同意并注明出处。
    • 本文地址:http://maryd.cn/?id=148
    上一篇:VendInvoiceJour,VendInvoiceTrans(AX 2012)的AccountingDistribution查询
    下一篇:MySql数据库导入sql错误 Unknown collation: 'utf8mb4_0900_ai_ci'

    留言评论

    暂无留言
    取消
    扫码支持