Acumatica 如何通过图形插入客户位置

Acumatica 如何通过图形插入客户位置,acumatica,Acumatica,您好,我的头撞在墙上,试图找到正确的方法,使用图形插入客户位置。我目前正在使用PX.Objects.CR.CustomerLocationMaint图。但当我插入或设置当前位置时,它总是空的 这是我的密码 private PX.Objects.CR.Location UpdateCustomerLocation(PX.Objects.AR.Customer cust, ListingRead currentListing, ListingContactRelnListing

您好,我的头撞在墙上,试图找到正确的方法,使用图形插入客户位置。我目前正在使用PX.Objects.CR.CustomerLocationMaint图。但当我插入或设置当前位置时,它总是空的

这是我的密码

          private PX.Objects.CR.Location UpdateCustomerLocation(PX.Objects.AR.Customer cust, ListingRead currentListing, ListingContactRelnListing contact)
    {

        PX.Objects.AR.CustomerLocationMaint g = new PX.Objects.AR.CustomerLocationMaint();

        g.Clear(PXClearOption.ClearAll);

        g.BusinessAccount.Current = cust;

        PX.Objects.CR.Location loc = new PX.Objects.CR.Location();

        loc.BAccountID = cust.BAccountID;
        loc.LocationCD = "RL" + contact.contact.id;
        loc.Descr = currentListing.property.system_search_key;
        loc.DefContactID = cust.DefContactID;

        loc.IsActive = true;
        loc.LocType = "CU";

        g.Location.Current = loc;
        loc = g.Location.Insert(loc);

        PX.Objects.CR.Address addr = new PX.Objects.CR.Address();

        addr.BAccountID = cust.BAccountID;
        addr.AddressType = "BS";
        addr.CountryID = "NZ";
        addr.AddressLine1 = currentListing.property.adr_street_number + " " + currentListing.property.adr_street_name;
        addr.AddressLine2 = currentListing.property.adr_suburb_or_town;
        addr.AddressLine3 = currentListing.property.adr_state_or_region;

        addr = g.Address.Insert(addr);

        loc.DefAddressID = addr.AddressID;
        g.Location.Update(loc);

        g.Actions.PressSave();

        return loc;
    }

你的意思是在g.Address.Insert(addr)之后;地址为空?在g.Location之后。插入(loc)loc为空。我想知道我是否应该使用CustomerMaint图来代替?试试loc=g.Location.Insert(loc);刚设置完BAccountID。然后设置其他值并将记录更新为缓存。