最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

Multiple EcoResItemColorName lookups in the same form

网络文摘 William 2047浏览 0评论

We’ve recently discussed a situation a work, where more than one ItemId and Color lookup was used on the same form.

Form with two ItemIds and two EcoResItemColorNames

The EcoResItemColorName data type uses the  InventProductDimensionLookup to display the available colors for the item. However, if there are multiple items on a form and multiple color lookups the lookups always present the available color values for the first item.

Multiple Color Lookups on a form displays the wrong values

The InventProductDimensionLookup form uses the InventDimCtrl_Frm_Lookup controller class. The init() method
is used to determines the ItemId.

callerHasItemId     = this.callerItemFieldId() != 0;
if (! callerHasItemId)
{
    callerItemIdMethod  = formHasMethod(callingElement.args().caller(),
                                        identifierStr(itemId));
    if (callerItemIdMethod)
    {
        callerHasItemId = true;
    }
}

callerHasInventDimParm  = formHasMethod(callingElement.args().caller(),
                        InventDimCtrl_Frm::inventDimSetupObjectMethod());

callerWMSPalletIdMethod = formHasMethod(callingElement.args().caller(),
                                        identifierStr(wmsPalletId));

super();

If there is no ItemId in the caller form, the init() code checks for an itemId() method on the caller form. This can be used to provide the correct ItemId for each of the lookups.

  1. Rename ItemId to ItemId1
  2. Declare an ItemId variable activeItemId in the forms ClassDeclaration

    public class FormRun extends ObjectRun
    {
        ItemId activeItemId;
    }

  3. Overwrite each lookup() method on the EcoResItemColorFields in the form
  4. Set the activeItemId variable to the corresponding ItemId, e.g. ItemId1 for EcorResColorName1 and ItemId2 for EcoResColorName2

    public void lookup()
    {
        activeItemId = MultiItemColor.ItemId2;

        super();
    }

  5. Create an itemId() method on the form that returns the value of the Itemid variable

    public ItemId itemId()
    {
        return activeItemId;
    }

 

So the correct colors are displayed in the lookup

Multiple Color Lookups on a form


发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址