隐藏过去复制选项中的自定义字段

时间:2019-05-22 16:40:21

标签: acumatica

如何在复制和过去时隐藏字段。该字段是销售订单扩展的一部分。DAC。

我尝试了[PXCopyPasteHiddenFields(typeof(PSSOOrderExtNV.usrIsInHandsDate))],但遇到以下编译错误。

错误CS0592属性'PXCopyPasteHiddenFields'在此声明类型上无效。它仅对“类,字段”声明有效。

我尝试覆盖方法CopyPasteGetScript,但没有得到想要的结果。

public delegate void CopyPasteGetScriptDelegate(Boolean isImportSimple, List<Command> script, List<Container> containers);
    [PXOverride]
    public void CopyPasteGetScript(Boolean isImportSimple, List<Command> script, List<Container> containers, CopyPasteGetScriptDelegate baseMethod)
    {
        baseMethod(isImportSimple, script, containers);
        SOOrder order = Base.Document.Current;
        if(Base.Document.Cache.GetStatus(order) == PXEntryStatus.Inserted)
        {
            PSSOOrderExtNV extn = PXCache<SOOrder>.GetExtension<PSSOOrderExtNV>(order);
            extn.UsrHoldUntil = null;
            extn.UsrReadyforProductionapproval = null;
            extn.UsrReadyForProduction = null;
            extn.UsrIsOrdered = null;
            extn.UsrIsAllocated = null;
            extn.UsrEmbPaperReceived = null;
            extn.UsrEmbGoodsReceived = null;
            extn.UsrWorksheetPrinted = null;
            extn.UsrGoodsOnCarts = null;
            Base.Document.Update(order);
        }
    }

更新

我在SOOrderEntry的图形扩展中将代码修改如下。编译时不会给出错误,但是会将值复制到新顺序。

        [PXCopyPasteHiddenFields(typeof(SOOrder.cancelled), typeof(SOOrder.preAuthTranNumber), typeof(SOOrder.ownerID), typeof(SOOrder.workgroupID), 
                             typeof(PSSOOrderExtNV.usrHoldUntil),typeof(PSSOOrderExtNV.usrReadyForProduction),typeof(PSSOOrderExtNV.usrReadyforProductionapproval),typeof(PSSOOrderExtNV.usrIsOrdered),
                             typeof(PSSOOrderExtNV.usrIsAllocated),typeof(PSSOOrderExtNV.usrEmbPaperReceived),typeof(PSSOOrderExtNV.usrEmbGoodsReceived),typeof(PSSOOrderExtNV.usrWorksheetPrinted),
                             typeof(PSSOOrderExtNV.usrGoodsOnCarts))]
    public PXSelect<SOOrder, Where<SOOrder.orderType, Equal<Current<SOOrder.orderType>>, And<SOOrder.orderNbr, Equal<Current<SOOrder.orderNbr>>>>> CurrentDocument;

1 个答案:

答案 0 :(得分:0)

PXCopyPasteHiddenFields属性通常会修饰DataView。

“销售订单”图中的此示例从“交易数据”视图中隐藏SOLine.Completed字段:

[PXViewName(Messages.SOLine)]
[PXImport(typeof(SOOrder))]
[PXCopyPasteHiddenFields(typeof(SOLine.completed))]
public PXOrderedSelect<SOOrder, SOLine,
    Where<SOLine.orderType, Equal<Current<SOOrder.orderType>>,
        And<SOLine.orderNbr, Equal<Current<SOOrder.orderNbr>>>>,
    OrderBy<Asc<SOLine.orderType, Asc<SOLine.orderNbr, Asc<SOLine.sortOrder, Asc<SOLine.lineNbr>>>>>> Transactions;