在创建直接发货PO时更新POOrder中的用户定义字段 [英] Updating User defined field in POOrder while creating Drop ship PO

查看:118
本文介绍了在创建直接发货PO时更新POOrder中的用户定义字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须重写功能以基于销售价格保证金低于一定百分比来创建直接发货PO并更新PO表中的自定义字段。我已经遍历了POCreate的源代码。
通过静态函数

I have to override function to create drop ship PO and update custom field in PO Table based on sales price margin goes below certain percentage. I have gone through the source code for POCreate. The PO is created through static function

public static PXRedirectRequiredException CreatePOOrders(List<POFixedDemand> list, DateTime? PurchDate, bool extSort)

如何覆盖并添加逻辑以创建直升飞机订单?

How to override and add my logic to creating drop-ship PO?

推荐答案

最好的方法是在所需的事件上附加事件处理程序。这不是一个简单的案例,但这是我几个月前写的一个例子。此代码更改了POLine描述,以在最后添加 Test。您也可以使用它来填充自定义字段。

The best way would be to attach event handlers on what you need. This is not a simple case but here's an example I wrote a couple months ago. This code is changing the POLine description to add "Test" at the end. You could use it populate your custom fields too.

public class POCreateExt : PXGraphExtension<POCreate>
{
    public override void Initialize()
    {
        PXGraph.InstanceCreated.AddHandler<POOrderEntry>((graph) =>
        {
            graph.RowUpdating.AddHandler<POLine>((sender, e) =>
            {
                POLine line = e.NewRow as POLine;
                POOrderEntry.SOLineSplit3 soLine = PXResult<POOrderEntry.SOLineSplit3>.Current;
                line.TranDesc = soLine.TranDesc + " TEST ";
            });
        });
    }
}

这篇关于在创建直接发货PO时更新POOrder中的用户定义字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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