2016-02-04 41 views
2

我必須通過代碼設置InventLocation 地址。 通過代碼我知道如何找到InventLocation地址,但如果它不在那裏,我想創建它。如何通過代碼設置InventLocation地址?

我的代碼是這樣的:

InventLocation invLocationTable; 
LogisticsPostalAddress logisticsPostalAddress; 

invLocationTable = InventLocation::find(MYinvLocationId); 
logisticsPostalAddress = LogisticsLocationEntity::findPostalAddress(invLocationTable, LogisticsLocationRoleType::None); 

if (!logisticsPostalAddress) 
{ 
// Here I want to create/set the InventLocation adress, but I don't know how to do it. 
} 

是否有可能創造呢?

回答

0

您的InventLocation.RecId需要在InventLocationLogisticsLocation.Location中引用,因此很顯然,此表需要插入一條記錄。下一個參考將位於InventLocationLogisticsLocationRole.LocationLogisticsLocation中,同樣需要記錄。最後,在LogisticsPostalAddress.Location中引用。

因此,首先插入InventLocationLogisticsLocation,然後插入InventLocationLogisticsLocationRole,最後插入LogisticsPostalAddress。

此外請確保您將角色類型定義爲無,否則您可能會丟失位置郵政地址中的記錄。

+0

嗨@Kevin Kabatra,謝謝。好方法! – ulisses

相關問題