仅在用户与DAC中的字段交互后才会将数据插入自定义DAC

时间:2017-04-14 21:21:13

标签: acumatica

当我创建新发票或从SOOrderEntry->发货 - >发票准备发票时,我在SOInvoiceEntry.cs上遇到问题,在用户点击另一个相关字段之前,尚未输入invoiceNbr那个DAC

在按下与DAC关联的字段之前

before pressing a field associated with the DAC

按下与DAC关联的字段后 enter image description here

我创建了一个名为UsrKSFSCCom的新DAC

在dac中有许多isKey字段

[PXDBString(50, IsKey = true, IsUnicode = true, InputMask = "")]
[PXDBDefault(typeof(ARInvoice.refNbr))]
[PXUIField(DisplayName = "InvoiceNbr")]
    public string UsrInvoiceNbr { get; set; }

    public class usrInvoiceNbr : IBqlField{}

我有一个ARInvoice_Rowselecting事件处理程序设置如下

    protected virtual void ARInvoice_RowSelecting(PXCache sender, PXRowSelectingEventArgs e, PXRowSelecting InvokeBaseHandler)
    {
        if (InvokeBaseHandler != null)
            InvokeBaseHandler(sender, e);
        ARRegister row = (ARRegister)e.Row;
        if (row == null) return;
        ARRegisterExt rowExt = PXCache<ARRegister>.GetExtension<ARRegisterExt>(row);

        ARTran invoiceCust = PXSelect<ARTran,
                                        Where<ARTran.refNbr,
                                        Equal<Required<ARTran.refNbr>>>>.Select(Base, row.RefNbr);
        if (invoiceCust == null)
            return;
        SOOrder salesOrd = PXSelect<SOOrder,
                                    Where<SOOrder.orderNbr,
                                    Equal<Required<SOOrder.orderNbr>>>>.Select(Base, invoiceCust.SOOrderNbr);

        UsrKSFSCCom fscComDef = PXSelect<UsrKSFSCCom,
                                Where<UsrKSFSCCom.usrInvoiceNbr,
                                Equal<Current<ARInvoice.refNbr>>>>.Select(Base, row.RefNbr);

        if (salesOrd == null)
            return;

        SOOrderExt saleOrdExt = PXCache<SOOrder>.GetExtension<SOOrderExt>(salesOrd);
        fscComDef.UsrInRep = saleOrdExt.UsrInRep;
        fscComDef.UsrInCom = saleOrdExt.UsrInCom;
        fscComDef.UsrManRep = saleOrdExt.UsrManRep;
        fscComDef.UsrManCom = saleOrdExt.UsrManCom;
        fscComDef.UsrMiscRep = saleOrdExt.UsrMiscRep;
        fscComDef.UsrMiscCom = saleOrdExt.UsrMiscCom;
        fscComDef.UsrOutRep = saleOrdExt.UsrOutRep;
        fscComDef.UsrOutCom = saleOrdExt.UsrOutCom;
        fscComDef.UsrIndirectCust = saleOrdExt.UsrIndirectCust;
        fscComDef.UsrOverBool = saleOrdExt.UsrOverBool;
        fscComDef.UsrOverAmt = saleOrdExt.UsrOverAmt;
        fscComDef.UsrOverageCom = saleOrdExt.UsrOverageCom;
    }

问题是RowSelecting事件处理程序在一个条件下工作,用户必须单击其中一个关联的字段,然后从所选行中显示记录。我是否通过PXDefault错误地定义了默认值?感谢您的任何意见,谢谢。

1 个答案:

答案 0 :(得分:0)

Per Dmitry建议,在这个Base.Caches [typeof(UsrKSFSCCom)]中添加。在RowSelecting事件处理程序结束时更新(fscComDef)。