static void warehousetelephonenumber(Args _args)
{
str Warehouse;
LogisticsElectronicAddress LogisticsElectronicAddress;
LogisticsLocation LogisticsLocation;
InventLocationLogisticsLocation InventLocationLogisticsLocation;
InventLocation InventLocation;
;
Warehouse = "11";
InventLocation = InventLocation::find(Warehouse);
Select firstOnly InventLocationLogisticsLocation
where InventLocationLogisticsLocation.InventLocation == InventLocation.RecId;
if (InventLocationLogisticsLocation)
{
select firstOnly LogisticsLocation
where LogisticsLocation.ParentLocation == InventLocationLogisticsLocation.Location
&& LogisticsLocation.IsPostalAddress == NoYes::No;
if (LogisticsLocation)
{
Select firstOnly LogisticsElectronicAddress
where LogisticsElectronicAddress.Location == LogisticsLocation.RecId;
if (LogisticsElectronicAddress)
{
info(strFmt("%1", LogisticsElectronicAddress.Locator));
}
}
}
}
===============================================================
logisticsElectronicAddressLocator getElectronicAddressByType(LogisticsElectronicAddressMethodType _type)
{
InventLocationLogisticsLocation InventLocLogLocation;
LogisticsLocation logisticsLocation;
logisticsLocation contactInfoLogLoc;
LogisticsElectronicAddress logisticsElectronicAddress;
LogisticsPostalAddress logisticsPostalAddress;
;
while select firstOnly * from logisticsLocation
where logisticsLocation.IsPostalAddress == NoYes::Yes
exists join InventLocLogLocation
where InventLocLogLocation.Location == logisticsLocation.RecId
&& InventLocLogLocation.InventLocation == this.RecId
&& InventLocLogLocation.IsPrimary == NoYes::Yes
exists join LogisticsPostalAddress
where LogisticsPostalAddress.Location == logisticsLocation.RecId
&& logisticsPostalAddress.ValidFrom <= DateTimeUtil::utcNow()
&& logisticsPostalAddress.ValidTo > DateTimeUtil::utcNow()
exists join contactInfoLogLoc
where contactInfoLogLoc.ParentLocation == logisticsLocation.RecId
exists join LogisticsElectronicAddress
where LogisticsElectronicAddress.Location == contactInfoLogLoc.RecId
&& logisticsElectronicAddress.Type == _type
{
return logisticsElectronicAddress.Locator;
}
return '';
}
===============================================================
logisticsElectronicAddressLocator getElectronicAddressByType(LogisticsElectronicAddressMethodType _type)
{
InventLocationLogisticsLocation InventLocLogLocation;
LogisticsLocation logisticsLocation;
logisticsLocation contactInfoLogLoc;
LogisticsElectronicAddress logisticsElectronicAddress;
LogisticsPostalAddress logisticsPostalAddress;
;
while select firstOnly * from logisticsLocation
where logisticsLocation.IsPostalAddress == NoYes::Yes
exists join InventLocLogLocation
where InventLocLogLocation.Location == logisticsLocation.RecId
&& InventLocLogLocation.InventLocation == this.RecId
&& InventLocLogLocation.IsPrimary == NoYes::Yes
exists join LogisticsPostalAddress
where LogisticsPostalAddress.Location == logisticsLocation.RecId
&& logisticsPostalAddress.ValidFrom <= DateTimeUtil::utcNow()
&& logisticsPostalAddress.ValidTo > DateTimeUtil::utcNow()
exists join contactInfoLogLoc
where contactInfoLogLoc.ParentLocation == logisticsLocation.RecId
exists join LogisticsElectronicAddress
where LogisticsElectronicAddress.Location == contactInfoLogLoc.RecId
&& logisticsElectronicAddress.Type == _type
{
return logisticsElectronicAddress.Locator;
}
return '';
}
No comments:
Post a Comment