gpt4 book ai didi

acumatica - 混合手动\自动编号序列

转载 作者:行者123 更新时间:2023-12-02 22:40:17 24 4
gpt4 key购买 nike

在编号顺序设置 (CS201010) 中,有一个手动编号选项。

enter image description here

但是,取决于文档类型。在某些情况下,引用编号可以留空。如果它是空白的,我希望自动编号启动。或者在保存文档之前调用 NextNumber() 函数。是否可以 ?我该怎么做?

目前,如果我强制执行自动编号。例如,它不允许我在引用号上输入任​​何内容。

TIA

最佳答案

有两种方法:简单和稍微复杂一点。简单的一个将附加到 FieldDefaulting,并在该事件内部检查该字段是否为空,然后为其分配一些值。更好地适应 Acumatica 风格的另一种方法是实现您自己的 AutoNumbering 属性,然后将该 Autonumbering 属性应用到您的 DAC 类。注意:您可以使用 PXCacheExtension 将 Acumatica 自动编号属性替换为您的属性

下面是删除默认自动编号并通过 FieldDefaulting 实现自动编号的代码示例:

public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
[PXDBString(15, InputMask = ">CCCCCCCCCCCCCCC", IsKey = true, IsUnicode = true)]
[PXDefault]
[PXUIField(DisplayName = "Reference Nbr.", TabOrder = 1, Visibility = PXUIVisibility.SelectorVisible)]
//[ARInvoiceType.RefNbr(typeof(Search2<ARRegisterAlias.refNbr, InnerJoinSingleTable<ARInvoice, On<ARInvoice.docType, Equal<ARRegisterAlias.docType>, And<ARInvoice.refNbr, Equal<ARRegisterAlias.refNbr>>>, InnerJoinSingleTable<Customer, On<ARRegisterAlias.customerID, Equal<Customer.bAccountID>>>>, Where<ARRegisterAlias.docType, Equal<Optional<ARInvoice.docType>>, And2<Where<ARRegisterAlias.origModule, Equal<BatchModule.moduleAR>, Or<ARRegisterAlias.released, Equal<True>>>, And<Match<Customer, Current<AccessInfo.userName>>>>>, OrderBy<Desc<ARRegisterAlias.refNbr>>>), Filterable = true, IsPrimaryViewCompatible = true)]
//[ARInvoiceType.Numbering]
//This is example of throwing away Acumatica autonumbering
//[ARInvoiceNbr]
[PXFieldDescription]
protected void ARInvoice_RefNbr_Cacheattached()
{

}

protected void ARInvoice_RefNbr_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e)
{
//here you can implement your way of initialization of this field

}
}

或者使用属性,您可以尝试这样的操作:

//somewhere in your code
public class RickAutonumberingAttribute : ARInvoiceNbrAttribute
{
//Here you'll need to play with implementation of your autonumbering
}

public class ARInvoiceEntryExt : PXGraphExtension<ARInvoiceEntry>
{
[PXDBString(15, InputMask = ">CCCCCCCCCCCCCCC", IsKey = true, IsUnicode = true)]
[PXDefault]
[PXUIField(DisplayName = "Reference Nbr.", TabOrder = 1, Visibility = PXUIVisibility.SelectorVisible)]
[ARInvoiceType.RefNbr(typeof(Search2<ARRegisterAlias.refNbr, InnerJoinSingleTable<ARInvoice, On<ARInvoice.docType, Equal<ARRegisterAlias.docType>, And<ARInvoice.refNbr, Equal<ARRegisterAlias.refNbr>>>, InnerJoinSingleTable<Customer, On<ARRegisterAlias.customerID, Equal<Customer.bAccountID>>>>, Where<ARRegisterAlias.docType, Equal<Optional<ARInvoice.docType>>, And2<Where<ARRegisterAlias.origModule, Equal<BatchModule.moduleAR>, Or<ARRegisterAlias.released, Equal<True>>>, And<Match<Customer, Current<AccessInfo.userName>>>>>, OrderBy<Desc<ARRegisterAlias.refNbr>>>), Filterable = true, IsPrimaryViewCompatible = true)]
//[ARInvoiceType.Numbering]
//This is example of throwing away Acumatica autonumbering
[RickAutonumberingAttribute]
[PXFieldDescription]
protected void ARInvoice_RefNbr_Cacheattached()
{
}

}

关于acumatica - 混合手动\自动编号序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48145342/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com