Updating User defined field in POOrder while creating Drop ship PO

主宰稳场 提交于 2019-12-22 19:14:31

问题


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?


回答1:


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 ";
            });
        });
    }
}


来源:https://stackoverflow.com/questions/37249625/updating-user-defined-field-in-poorder-while-creating-drop-ship-po

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!