public static LogisticsPostalAddress getPostalAddressByType(DirPartyRecId _party, LogisticsLocationRoleType _type)
{
DirPartyLocation partyLocation;
DirPartyLocationRole partyLocationRole;
LogisticsLocation location;
LogisticsLocationRole locationRole;
LogisticsPostalAddress postalAddress;
{
DirPartyLocation partyLocation;
DirPartyLocationRole partyLocationRole;
LogisticsLocation location;
LogisticsLocationRole locationRole;
LogisticsPostalAddress postalAddress;
select firstonly postalAddress
exists join location
where location.RecId == postalAddress.Location
exists join locationRole
where locationRole.Type == _type
exists join partyLocation
where partyLocation.Location == location.RecId
&& partyLocation.Party == _party
exists join partyLocationRole
where partyLocationRole.PartyLocation == partyLocation.RecId
&& partyLocationRole.LocationRole == locationRole.RecId;
exists join location
where location.RecId == postalAddress.Location
exists join locationRole
where locationRole.Type == _type
exists join partyLocation
where partyLocation.Location == location.RecId
&& partyLocation.Party == _party
exists join partyLocationRole
where partyLocationRole.PartyLocation == partyLocation.RecId
&& partyLocationRole.LocationRole == locationRole.RecId;
return postalAddress;
}
用法:
CustTable custTable = CustTable::find("C00001");
LogisticsLocationRoleType postalAddress;
postalAddress = getPostalAddressByType(custTable.Party, LogisticsLocationRoleType::Invoice);