我如何在ShipmentEntry acumatica中使用InvoiceShipment委托PXOverride

时间:2019-07-17 20:32:59

标签: delegates acumatica

在acumatica的6.1版中,我实现了InvoiceShipment的委托过程来验证更新的库存,但在acumatica的6.1版中,但是在18.117.0016版中,该方法未执行

我尝试了两种不同的形式,但是该方法未执行

1。

public delegate void InvoiceShipmentDelegate(SOInvoiceEntry docgraph, SOShipment shiporder, DateTime invoiceDate, DocumentList<ARInvoice, SOInvoice> list);
        [PXOverride]
        public void InvoiceShipment(SOInvoiceEntry docgraph, SOShipment shiporder, DateTime invoiceDate, DocumentList<ARInvoice, SOInvoice> list, InvoiceShipmentDelegate baseMethod)
        {
            SOOrderShipment envio = PXSelect<SOOrderShipment, Where<SOOrderShipment.shipmentNbr, Equal<Required<SOOrderShipment.shipmentNbr>>>>.Select(Base, shiporder.ShipmentNbr);

            if (string.IsNullOrEmpty(envio.InvtRefNbr))
            {
                throw new PXException("No se puede preparar la factura, el inventario no ha sido actualizado");
            }

            baseMethod?.Invoke(docgraph, shiporder, invoiceDate, list);

        }

2。

public void InvoiceShipment(SOInvoiceEntry docgraph, SOShipment shiporder, DateTime invoiceDate, DocumentList<ARInvoice, SOInvoice> list, 
                                 Action<SOInvoiceEntry, SOShipment, DateTime, DocumentList<ARInvoice, SOInvoice>> baseInvoiceShipment)
        {
            SOOrderShipment envio = PXSelect<SOOrderShipment, Where<SOOrderShipment.shipmentNbr, Equal<Required<SOOrderShipment.shipmentNbr>>>>.Select(Base, shiporder.ShipmentNbr);
            if (string.IsNullOrEmpty(envio.InvtRefNbr))
            {
                throw new PXException("No se puede preparar la factura, el inventario no ha sido actualizado");
            }
            baseInvoiceShipment(docgraph, shiporder, invoiceDate, list);

    }

我如何执行此委托方法

1 个答案:

答案 0 :(得分:0)

该方法的签名似乎已更改(已添加PXQuickProcess.ActionFlow)。因为您要覆盖旧的未使用签名,所以不会调用它。使用此签名,它应该调用您的替代:

public virtual void InvoiceShipment(SOInvoiceEntry docgraph, SOShipment shiporder, DateTime invoiceDate, DocumentList<ARInvoice, SOInvoice> list, PXQuickProcess.ActionFlow quickProcessFlow)
{ //... }

您可以查看SOShipmentEntry源代码以获取对InvoiceShipment的任何引用,以查看此更改。我正在为这个示例查看18.120.0006。