Создайте эту работу и замените inventSiteId
вашим сайтом.
static void Job107(Args _args)
{
InventSiteId inventSiteId = 'MySite'; // PUT YOUR SITE HERE
InventSite inventSite = InventSite::find(inventSiteId);
InventSiteLogisticsLocation siteLocation;
InventSiteLogisticsLocationRole siteLocationRole;
LogisticsLocationRole locationRole;
LogisticsPostalAddress logisticsPostalAddress;
// Method 1 - List all addresses. Refine query as needed.
while select logisticsPostalAddress
join siteLocation
order by IsPrimary desc
where logisticsPostalAddress.Location == siteLocation.Location &&
siteLocation.Site == inventSite.RecId
join siteLocationRole
where siteLocationRole.SiteLogisticsLocation == siteLocation.RecId
join locationRole
where locationRole.RecId == siteLocationRole.LocationRole
{
info(strFmt("Role: %1; Address: %2", locationRole.Type, logisticsPostalAddress.Address));
}
// Method 2; 1-liner for single address, good for just getting primary. Change role type for different addresses
info(LogisticsPostalAddress::findByLocation(InventSite::getLocationFromRole(InventSite::find(inventSiteId).RecId, LogisticsLocationRoleType::Delivery)).Address);
}