如何将库存可用性状态添加到自定义网格,如 SO301000 [英] How do I add the Inventory Availability Status to Custom Grid like SO301000

查看:13
本文介绍了如何将库存可用性状态添加到自定义网格,如 SO301000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在添加一个自定义屏幕,该屏幕利用页面上已定义网格的行中的站点 ID 和库存 ID.我们想添加库存可用性详细信息,如 SO301000(销售订单输入图表)所示.

We are adding a custom screen that utilizes Site ID and Inventory ID in the row of the defined grid on the page. We would like to add the Inventory Availability details as shown on SO301000 (Sales Order Entry graph).

A) 如何访问网格的状态区域以放置文本.B) 对于 SO301000 上使用的文本,我是否可以访问标准方法.

A) How do I access the status area of the grid to place text. B) Is there a standard method that I can access for the text used on SO301000.

推荐答案

该功能称为 StatusField.

您在网格 ASPX 控件上定义状态字段:

You define the status field on the grid ASPX control:

<px:PXGrid ID="grid" runat="server" DataSourceID="ds" StatusField="Availability">

可以通过 FieldSelecting 事件设置:

It can be set with a FieldSelecting event:

public void SOLine_Availability_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)

销售订单屏幕将其与分配自定义数据视图混为一谈,使其难以重复使用:

Sales order screen lumps it with the allocation custom data view which makes it hard to re-use:

public LSSOLine lsselect;

LSSOLine 类中,您将找到计算值的 Availability_FieldSelecting 方法:

In LSSOLine class you'll find the Availability_FieldSelecting method that computes the value:

public override void Availability_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
    var fetchMode = ((SOLine) e.Row)?.Completed == true
        ? AvailabilityFetchMode.None
        : AvailabilityFetchMode.ExcludeCurrent;
    IQtyAllocated availability = AvailabilityFetch(sender, (SOLine)e.Row, fetchMode | AvailabilityFetchMode.TryOptimize);

    if (availability != null)
    {
        PXResult<InventoryItem, INLotSerClass> item = ReadInventoryItem(sender, ((SOLine)e.Row).InventoryID);

        decimal unitRate = INUnitAttribute.ConvertFromBase<SOLine.inventoryID, SOLine.uOM>(sender, e.Row, 1m, INPrecision.NOROUND);
        availability.QtyOnHand = PXDBQuantityAttribute.Round((decimal)availability.QtyOnHand * unitRate);
        availability.QtyAvail = PXDBQuantityAttribute.Round((decimal)availability.QtyAvail * unitRate);
        availability.QtyNotAvail = PXDBQuantityAttribute.Round((decimal)availability.QtyNotAvail * unitRate);
        availability.QtyHardAvail = PXDBQuantityAttribute.Round((decimal)availability.QtyHardAvail * unitRate);

        if(IsAllocationEntryEnabled)
        {
            Decimal? allocated = PXDBQuantityAttribute.Round((decimal)(((SOLine)e.Row).LineQtyHardAvail ?? 0m) * unitRate); ;
            e.ReturnValue = PXMessages.LocalizeFormatNoPrefix(Messages.Availability_AllocatedInfo,
                    sender.GetValue<SOLine.uOM>(e.Row), FormatQty(availability.QtyOnHand), FormatQty(availability.QtyAvail), FormatQty(availability.QtyHardAvail), FormatQty(allocated));
        }
        else
            e.ReturnValue = PXMessages.LocalizeFormatNoPrefix(Messages.Availability_Info,
                    sender.GetValue<SOLine.uOM>(e.Row), FormatQty(availability.QtyOnHand), FormatQty(availability.QtyAvail), FormatQty(availability.QtyHardAvail));


        AvailabilityCheck(sender, (SOLine)e.Row, availability);
    }
    else
    {
        //handle missing UOM
        INUnitAttribute.ConvertFromBase<SOLine.inventoryID, SOLine.uOM>(sender, e.Row, 0m, INPrecision.QUANTITY);
        e.ReturnValue = string.Empty;
    }

    base.Availability_FieldSelecting(sender, e);
}

我建议不要使用 LSSOLine,只需复制它的 FieldSelecting 方法.

I would advise to skip using LSSOLine and just copy it's FieldSelecting method.

在另一个答案中更详细地记录了该方法:https://stackoverflow.com/a/45034612/7376238

That approach is documented in more detail in this other answer: https://stackoverflow.com/a/45034612/7376238

这篇关于如何将库存可用性状态添加到自定义网格,如 SO301000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆