如何通过客户导入场景自动扩展到供应商

DCh*_*gar 1 c# acumatica acumatica-kb

如何通过 Acumatica 中的导入场景导入同时归类为客户和供应商的企业帐户?

DCh*_*gar 5

开箱即用Extend To Vendor用操作不能在导入场景中使用,因为它会重定向到包含预填充数据的供应商屏幕,并且用户必须手动保存供应商。

在下面的代码片段中,我们正在创建一个新的隐藏操作,该操作调用基本“将客户扩展到供应商”操作并保留供应商数据,而不是重定向到供应商屏幕。

using System;
using System.Collections;
using PX.Data;
using PX.Objects.AR;

namespace PXExtendCustomerToVendorExtPkg
{
    public class CustomerMaintPXExt : PXGraphExtension<CustomerMaint>
    {
        public PXAction<Customer> extendToVendorPXExt;
        [PXUIField(DisplayName = "Extend To Vendor Ext",
                   MapEnableRights = PXCacheRights.Select, 
                   MapViewRights = PXCacheRights.Select, 
                   Visible = false)]
        [PXButton]
        public virtual IEnumerable ExtendToVendorPXExt(PXAdapter adapter)
        {
            try
            {
                if (Base.extendToVendor.GetEnabled())
                    Base.extendToVendor.Press();
            }
            catch (Exception ex)
            {
                if (ex is PXRedirectRequiredException)
                {
                    PXRedirectRequiredException rdEx = (PXRedirectRequiredException)ex;
                    rdEx.Graph.Actions.PressSave();
                }
                else
                    throw ex;
            }
            return adapter.Get();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

发布定制后,修改Import ScenarioCustomersSM206025)并Extend To Vendor Ext在保存操作后添加新操作。

在此输入图像描述

下载定制包