查找物料/仓库的总可用物理和可用物理

时间:2022-01-27 16:57:56

I have a method for a display field which does the following;

我有一个显示字段的方法,它执行以下操作;

return InventSum::find(_salesLine.ItemId, InventDim::_salesLine.InventDimId).AvailPhysical();

This gives me the on-hand Available Physical for the line site/warehouse/location.

这为线路站点/仓库/位置提供了现有的可用物理。

I need to see the total available for just the site/warehouse. I think I need to search inventDim by Item/Warehouse to get my inventdimid, but I cannot find the method so I am suspicious that this is incorrect.

我需要查看网站/仓库的可用总数。我想我需要通过Item / Warehouse搜索inventDim来获取我的inventdimid,但我找不到方法所以我怀疑这是不正确的。

Can anyone help?

有人可以帮忙吗?

4 个解决方案

#1


4  

My working solution...

我的工作方案......

InventDimParm       invDimParm;
InventDim           warehouseInvDim;
InventDim           salesLineInventDim;
;

salesLineInventDim = _salesLine.inventDim();

warehouseInvDim.InventSiteId = salesLineInventDim.InventSiteId;
warehouseInvDim.InventLocationId = salesLineInventDim.InventLocationId;

warehouseInvDim = InventDim::findOrCreate(warehouseInvDim);
invDimParm.initFromInventDim(InventDim::find(warehouseInvDim.inventDimId));

return InventSum::findSum(_salesLine.ItemId,warehouseInvDim,invDimParm).availOrdered();

I know this is for availOrdered() but it works exactly the same for availPhysical()

我知道这是针对availOrdered()但它对availPhysical()的工作方式完全相同

#2


2  

You should use the InventOnhand class.

您应该使用InventOnhand类。

It sums the invent on-hand values based on criteria like item id and inventory dimensions.

它根据项目ID和库存维度等标准对发明现有值进行求和。

There are lots of uses in AX, search the Class node.

AX中有很多用途,搜索Class节点。

#3


2  

The following job finds all Sales Lines with the Open Order status, which have an Available Physical quantity on hand matching all dimensions specified on the Sales Lines except location:

以下作业查找具有未结订单状态的所有销售行,其具有可用物理数量,该数量与销售行上指定的除位置之外的所有维度相匹配:

static void FindOpenSalesLineAvailPhys(Args _args)
{
    SalesLine salesline;
    InventDim inventDim;
    InventDimParm inventDimParm;
    InventOnHand inventOnHand;
    ;

    while select salesLine where salesLine.SalesStatus == SalesStatus::Backorder
    {
        inventDim = salesLine.inventDim();
        inventDimParm.initFromInventDim(inventDim);
        inventDimParm.WMSLocationIdFlag = NoYes::No;
        inventOnHand = InventOnHand::newItemDim(salesLine.ItemId, inventDim, inventDimParm);
        if (inventOnHand.availPhysical())
        {
            info(strfmt("Sales Order %1 Line %2 Item Id %3 Available Physical (ignoring Location) %4",
                salesLine.salesId, salesLine.LineNum, salesLine.ItemId, inventOnHand.availPhysical()));
        }
    }
}

#4


0  

You basically set your inventDim values the way you want to search for them, and then do an InventDim::FindOrCreate to see if either the inventory dimension already exists, or it needs to be created and a new number sequence will be consumed. This is used so that the InventDim table doesn't store every single possible combination of dimensions. Also because if you have any serialized products, it's not feasible for the table to store all of the combinations, so it only stores the ones it needs.

您基本上按照搜索它们的方式设置inventDim值,然后执行InventDim :: FindOrCreate以查看库存维度是否已存在,或者是否需要创建它并且将消耗新的数字序列。这样使用InventDim表不会存储每个可能的维度组合。另外因为如果您有任何序列化产品,表格存储所有组合是不可行的,因此它只存储它所需的组合。

InventDim   inventDim;
SalesLine   _salesLine;
;

inventDim.InventSiteId      = 'mySite';
inventDim.InventLocationId  = 'myWarehouse';
inventDim   = InventDim::findOrCreate(inventDim);

return InventSum::find(_salesLine.ItemId, inventDim.inventDimId).AvailPhysical();

#1


4  

My working solution...

我的工作方案......

InventDimParm       invDimParm;
InventDim           warehouseInvDim;
InventDim           salesLineInventDim;
;

salesLineInventDim = _salesLine.inventDim();

warehouseInvDim.InventSiteId = salesLineInventDim.InventSiteId;
warehouseInvDim.InventLocationId = salesLineInventDim.InventLocationId;

warehouseInvDim = InventDim::findOrCreate(warehouseInvDim);
invDimParm.initFromInventDim(InventDim::find(warehouseInvDim.inventDimId));

return InventSum::findSum(_salesLine.ItemId,warehouseInvDim,invDimParm).availOrdered();

I know this is for availOrdered() but it works exactly the same for availPhysical()

我知道这是针对availOrdered()但它对availPhysical()的工作方式完全相同

#2


2  

You should use the InventOnhand class.

您应该使用InventOnhand类。

It sums the invent on-hand values based on criteria like item id and inventory dimensions.

它根据项目ID和库存维度等标准对发明现有值进行求和。

There are lots of uses in AX, search the Class node.

AX中有很多用途,搜索Class节点。

#3


2  

The following job finds all Sales Lines with the Open Order status, which have an Available Physical quantity on hand matching all dimensions specified on the Sales Lines except location:

以下作业查找具有未结订单状态的所有销售行,其具有可用物理数量,该数量与销售行上指定的除位置之外的所有维度相匹配:

static void FindOpenSalesLineAvailPhys(Args _args)
{
    SalesLine salesline;
    InventDim inventDim;
    InventDimParm inventDimParm;
    InventOnHand inventOnHand;
    ;

    while select salesLine where salesLine.SalesStatus == SalesStatus::Backorder
    {
        inventDim = salesLine.inventDim();
        inventDimParm.initFromInventDim(inventDim);
        inventDimParm.WMSLocationIdFlag = NoYes::No;
        inventOnHand = InventOnHand::newItemDim(salesLine.ItemId, inventDim, inventDimParm);
        if (inventOnHand.availPhysical())
        {
            info(strfmt("Sales Order %1 Line %2 Item Id %3 Available Physical (ignoring Location) %4",
                salesLine.salesId, salesLine.LineNum, salesLine.ItemId, inventOnHand.availPhysical()));
        }
    }
}

#4


0  

You basically set your inventDim values the way you want to search for them, and then do an InventDim::FindOrCreate to see if either the inventory dimension already exists, or it needs to be created and a new number sequence will be consumed. This is used so that the InventDim table doesn't store every single possible combination of dimensions. Also because if you have any serialized products, it's not feasible for the table to store all of the combinations, so it only stores the ones it needs.

您基本上按照搜索它们的方式设置inventDim值,然后执行InventDim :: FindOrCreate以查看库存维度是否已存在,或者是否需要创建它并且将消耗新的数字序列。这样使用InventDim表不会存储每个可能的维度组合。另外因为如果您有任何序列化产品,表格存储所有组合是不可行的,因此它只存储它所需的组合。

InventDim   inventDim;
SalesLine   _salesLine;
;

inventDim.InventSiteId      = 'mySite';
inventDim.InventLocationId  = 'myWarehouse';
inventDim   = InventDim::findOrCreate(inventDim);

return InventSum::find(_salesLine.ItemId, inventDim.inventDimId).AvailPhysical();