如何在自定义屏幕上实现自动生成凭证编号 [英] How to implement auto generating document number on custom screen

查看:94
本文介绍了如何在自定义屏幕上实现自动生成凭证编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个机会,例如屏幕,但我不知道如何实现为新创建的文档自动生成文档编号

I have a requirement to create a opportunity like screen and I do not know how to implement the auto generating the document number for newly created document

我很期待有人来帮助我解决这个问题。

I am looking forward someone to help me on this issue.

我使用了以下步骤,并附上了代码以供审核。我在保存而不生成数字时遇到错误

The following steps I have used and I have attached the code for review. I am getting error while saving and not generating the number


  1. 我为文档
    中的备忘录创建了编号顺序

  1. I have create a numbering sequence for Memo In document

我已经创建了用于设置序列号的DAC

I have created a DAC for Sequence number setup

public abstract class memoInOrderId : PX.Data.IBqlField
{
}
protected string _MemoInOrderId;
[PXDBString(10, IsUnicode = true)]
[PXDefault("MEMOIN")]
[PXSelector(typeof(Numbering.numberingID),
             DescriptionField = typeof(Numbering.descr))]
[PXUIField(DisplayName = "Memo In Order Nbr")]
public virtual string MemoInOrderId
{
    get
    {
        return this._MemoInOrderId;
    }
    set
    {
        this._MemoInOrderId = value;
    }
}
#endregion


  • 我有将自动生成序列号添加到MemoIn DAC

  • I have added Auto Generation Sequence number to MemoIn DAC

    `

    #region OrderNbr
        public abstract class orderNbr : PX.Data.IBqlField
        {
        }
        [PXDBString(10, IsUnicode = true, IsKey = true, InputMask = ">CCCCCCCCCCCCCCC")]
        [PXUIField(DisplayName = "Order Nbr", Visibility = PXUIVisibility.SelectorVisible)]
        [AutoNumber(typeof(MemoSetUp.memoInOrderId), typeof(AccessInfo.businessDate))]
        [PXSelector(typeof(MemoIN.orderNbr),
            new Type[]
                {
                 typeof(MemoIN.orderNbr),
                 typeof(MemoIN.orderDate),
                 typeof(MemoIN.vendorId)
                })]
        public virtual string OrderNbr { get; set; }
        #endregion
    




    1. 在配置屏幕我已在文档

    备注在文档中,我遇到以下错误

    While saving the Memo In document I am getting the following error

    我注意到订单号未初始化为 NEW,并且显示为 SELECT

    I have noticed the Order number is not initialized to "NEW" and it is showing "SELECT"

    我已经通过CASetup,CMSetup,ARSetup DAC代码,无法

    I have gone through CASetup , CMSetup , ARSetup DAC code and not able to figure out the difference.

    推荐答案

    如果要使用编号顺序,在Acumatica中非常简单。您应该在某处有一个设置/首选项字段,该字段定义将用于文档编号字段的编号顺序。

    If we want to use a numbering sequence it is very straight forward in Acumatica. You should have a setup/preferences field somewhere that defines which numbering sequence you will use for your document number field.

    这里是一个使用选择器来设置字段的示例选择一个编号顺序:

    Here is an example of a setup field using a selector to pick a numbering sequence:

    // Setup field indicating which numbering sequence to use.
    public abstract class myNumberingID : PX.Data.IBqlField
    {
    }
    protected String _MyNumberingID;
    [PXDBString(10, IsUnicode = true)]
    [PXSelector(typeof(Numbering.numberingID), DescriptionField = typeof(Numbering.descr))]
    [PXUIField(DisplayName = "My Numbering Sequence")]
    public virtual String MyNumberingID
    {
        get
        {
            return this._MyNumberingID;
        }
        set
        {
            this._MyNumberingID = value;
        }
    }
    

    接下来,在文档编号字段中,您将使用 AutoNumberAttribute 将字段定义为编号序列的使用者。下面是一个使用上面的设置表中配置的定义的数字序列的数字字段的示例(假定DAC /表 MySetup中存在 MyNumberingID)。

    Next, in your document number field you will use the AutoNumberAttribute to define the field as a consumer of a numbering sequence. Below is an example of a number field using the defined number sequence configured in the setup table above (Assumes "MyNumberingID" exists in DAC/Table "MySetup").

    // Field using the numbering sequence...
    public abstract class myNumberField : PX.Data.IBqlField
    {
    }
    protected String _MyNumberField;
    [PXDBString(15, IsUnicode = true, IsKey = true, InputMask = ">CCCCCCCCCCCCCCC")]
    [PXUIField(DisplayName = "My Number", Visibility = PXUIVisibility.SelectorVisible)]
    [AutoNumber(typeof (MySetup.myNumberingID), typeof (AccessInfo.businessDate))]
    [PXDefault]
    public virtual String MyNumberField
    {
        get
        {
            return this._MyNumberField;
        }
        set
        {
            this._MyNumberField = value;
        }
    }
    

    编辑:请确保在构建文档的图形中将PXSetup视图包括到设置表中。

    Edit: Make sure in the graph building the documents to include a PXSetup view to the setup table.

    现在,当您在包含您的数字字段的DAC上插入并保留新记录时,下一个编号顺序值将被使用(除非为手动编号配置了编号顺序,否则用户必须提供一个值)。

    Now when you insert and persist a new record on the DAC that contains your number field, the next numbering sequence value will be used (unless the numbering sequence is configured for manual numbering then the user must provide a value).

    对于具有多个编号的更复杂的配置根据特定条件/字段值使用的编号顺序,您可以查看 PX.Objects.IN.INRegister.RefNbr 的示例。查看 INDocType.Numbering 以及它如何根据 INRegister.docType 更改编号顺序(如下所示)。另一个示例是与销售订单文档相关的销售订单订单类型。

    For a more complex configuration when there are multiple numbering sequences used based on specific conditions/field values, you can look at PX.Objects.IN.INRegister.RefNbr for an example. Look at INDocType.Numbering and how it changes the numbering sequence based on INRegister.docType (shown below). Another example would be sales order order types related to the sales order document.

    public class NumberingAttribute : AutoNumberAttribute
    {
        public NumberingAttribute()
            : base(typeof(INRegister.docType), typeof(INRegister.tranDate),
                new string[] { Issue, Receipt, Transfer, Adjustment, Production, Change, Disassembly },
                new Type[] { typeof(INSetup.issueNumberingID), typeof(INSetup.receiptNumberingID), typeof(INSetup.receiptNumberingID), typeof(INSetup.adjustmentNumberingID), typeof(INSetup.kitAssemblyNumberingID), typeof(INSetup.kitAssemblyNumberingID), typeof(INSetup.kitAssemblyNumberingID) }) { ; }
    }
    

    这篇关于如何在自定义屏幕上实现自动生成凭证编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆