就像在线程标题上。如何或通过什么方式可以获取具有inventsiteid的LocationAddress信息?太多的表和视图令人困惑。我需要选择当前站点ID的站点地址。
创建此作业并将替换为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);
}
尝试了两种方法,但信息在这里没有给我任何东西。顺便说一句,我需要获取一个int64地址,因为我需要将其放入PurchCreateOrder字段中。
您是否
MySite
用网站替换了文字?该代码有效...当您说“它不起作用”时,您需要提供更多信息。您inventSite
上面的变量是否包含值?SiteLocation.Location
是位置提示。数据就在那里。调试您的代码。不好 Didnt解释得很好。它可以工作,但是..在我的位置中仅粘贴了2个位置。因此,此代码适用于20个地址中的2个。我认为应该从DIrPartyTables中获得它。他们以某种方式连接到siteid,但我找不到位置。
我需要的值必须是int64才能将其放入表单字段
编辑您的问题或提出新问题,此答案将完全解决您的问题。您的问题只是帖子的标题,再加上在正文中重复相同的问题。请参阅问一个好问题。尝试从回答这个问题的角度理解。我为该问题提供了两种正确的解决方案,然后您基本上说“它不起作用”,然后在评论中提出一个新问题。现在,这已经发生在多个问题上。这使我怀疑花在回答上的时间。