【问题标题】:Copy Records to another Screen in acumatica将记录复制到 acumatica 中的另一个屏幕
【发布时间】:2016-05-04 09:17:18
【问题描述】:

我有 2 个屏幕,查询和数据输入。 我想将记录从 Screen1 复制到 screen2,见下图。 scree1 and Screen2

我使用以下代码:

public PXAction<FuncLocFilter> CreateFuncLoc;
    [PXButton]
    [PXUIField(DisplayName = "Create Functional Location")]
    protected virtual void createFuncLoc()
    {
        FuncLocFilter row = Filter.Current;
        BSMTFuncLoc FnLc = new BSMTFuncLoc();

        FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();
        graph.FunLocations.Current.FuncLocCD = row.FuncLocCD;
        graph.FunLocations.Current.StructureID = row.StructureID;
        graph.FunLocations.Current.HierLevels = row.HierLevels;
        graph.FunLocations.Current.EditMask = row.EditMask;
        if (graph.FunLocations.Current != null)
        {
            throw new PXRedirectRequiredException(graph, true, "Functional Location");
        }
    }

但我遇到了如下错误: Error

有人可以帮忙解决这个看似愚蠢的问题吗?

对不起,我的英语不好.. :)

谢谢!

【问题讨论】:

    标签: c# erp acumatica


    【解决方案1】:

    以下是在 Acumatica 中通过代码/编程创建数据记录的常见模式

        public PXAction<FuncLocFilter> CreateFuncLoc;
        [PXButton]
        [PXUIField(DisplayName = "Create Functional Location")]
        protected virtual void createFuncLoc()
        {
            FuncLocFilter row = Filter.Current;
    
            // 1. Create an instance of the BLC (graph)
            FunLocEntry graph = PXGraph.CreateInstance<FunLocEntry>();
    
            // 2. Create an instance of the BSMTFuncLoc DAC, set key field values (besides the ones whose values are generated by the system), 
            //    and insert the record into the cache
            BSMTFuncLoc FnLc = new BSMTFuncLoc();
            FnLc.FuncLocCD = row.FuncLocCD;
            FnLc = graph.FunLocations.Insert(FnLc);
    
            // 3. Set non-key field values and update the record in the cache
            FnLc.StructureID = row.StructureID;
            FnLc.HierLevels = row.HierLevels;
            FnLc.EditMask = row.EditMask;
            FnLc = graph.FunLocations.Update(FnLc);
    
            // 4. Redirect
            if (graph.FunLocations.Current != null)
            {
                throw new PXRedirectRequiredException(graph, true, "Functional Location");
            }
    

    【讨论】:

    • 感谢您建议它对我有用@DChhapgar
    猜你喜欢
    • 1970-01-01
    • 2021-04-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-10
    • 1970-01-01
    • 1970-01-01
    • 2019-06-13
    • 1970-01-01
    相关资源
    最近更新 更多