PXAction似乎无能为力 [英] PXAction seemingly does nothing

查看:102
本文介绍了PXAction似乎无能为力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在按照销售订单进行自定义,我想自定义操作取消订单。我反映了代码,但只能找到它:

I am doing customization in Sales Order and I want to customize the action Cancel Order. I reflected the code but could only find this:

    public PXAction<SOOrder> cancelled;
    [PXUIField(Visible = false)]
    [PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
    protected virtual IEnumerable Cancelled(PXAdapter adapter)
    {
        return adapter.Get();
    }

自定义功能是否正确?

Is it the right function to customize?

推荐答案

这是一个很好的问题,因为它不仅涉及业务逻辑层。

It's a pretty good question because it involves more than just the business logic layer.

SOOrderEntry是一个非常强大而复杂的页面,必须处理多个状态。为此,Acumatica Framework具有一个自动化模块,该模块允许根据当前状态设置不同的值。单击取消订单时,框架触发状态更改,该状态更改在自动化定义(SM205010)和自动化步骤(SM205000)页面中定义。请查看下面的取消订单操作的定义。

SOOrderEntry is a pretty powerful and complicated page that must handle multiple states. To do so, Acumatica Framework has an Automation Module that allows to set different values depending of the current state. When you click on Cancel Order, the framework triggers a state change defined in the page Automation Definitions (SM205010) and Automation Steps (SM205000). Look at the definition of the action Cancel Order below.

您可以看到单击按钮会更改某些字段。请注意,字段已取消设置为True。字段 Cancelled 是具有以下定义的SOOrder的绑定字段:

You can see that on clicking the button, some field are changed. Please note that the field Cancelled is set to True. The field Cancelled is a bound field of SOOrder with the following definition:

    #region Cancelled

    public abstract class cancelled : PX.Data.IBqlField
    {
    }
    protected Boolean? _Cancelled;
    [PXDBBool()]
    [PXDefault(false)]
    [PXUIField(DisplayName = "Canceled")]
    public virtual Boolean? Cancelled
    {
        get
        {
            return this._Cancelled;
        }
        set
        {
            this._Cancelled = value;
        }
    }
    #endregion

现在我们了解到字段已更改,我们可以查找将处理此更改的事件处理程序。当前有一个事件处理程序(FieldVerifying),可以确保可以在取消订单之前将其取消。如果要扩展验证逻辑,则可以自定义此处理程序:

Now that we understand that a Field has been changed, we can look for event handlers that would handle this change. There is currently an event handler (FieldVerifying) that would ensure the order can be canceled before doing so. If you want to extend the validation logic you can customize this handler:

protected virtual void SOOrder_Cancelled_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)

如果您希望添加一个在取消成功后会发生的事件,则可以创建一个新事件事件处理程序(FieldUpdated):

If you'd prefer to add an event that would occur if the cancelation succeeded, you can create a new event handler (FieldUpdated):

protected virtual void SOOrder_Cancelled_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)

您找到的代码只是一个占位符,用于创建按钮,并允许框架在您按下按钮时触发自动化步骤。

The code you found is only a placeholder to create a button and allow the framework to trigger the automation step when you press it.

这篇关于PXAction似乎无能为力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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