我在使用 AX 2012 时尝试通过 AIF 导入一些产品。如果我没有设置默认的购买/销售/发明站点和位置,它工作正常,但是当我尝试设置它们时,我得到以下异常抛出:
Cannot create a record in Item purchase order settings (OST).
The record already exists.
Error found when validating record.
Cannot edit a record in Item purchase order settings (InventItemPurchSetup). Item number:
1472, 00000002_078.
The record already exists.
我要上传的项目的 ItemId 为 1472,因此它在异常中
这是代码(我将只显示购买设置,因为销售和发明几乎相同):
inventTable[0].InventItemPurchSetup = new[] {
new AxdEntity_InventItemPurchSetup {
ItemId = inventTable[0].ItemId,
InventDimPurchSetup = new[] {
new AxdEntity_InventDimPurchSetup
{
InventDimId = "AllBlank2"
}
},
DefaultInventDimPurchSetup = new[] {
new AxdEntity_DefaultInventDimPurchSetup
{
InventDimId = "AllBlank2",
InventSiteId = "OST"
}
}
},
new AxdEntity_InventItemPurchSetup {
ItemId = inventTable[0].ItemId,
InventDimPurchSetup = new[] {
new AxdEntity_InventDimPurchSetup
{
InventSiteId = "OST"
}
},
DefaultInventDimPurchSetup = new[] {
new AxdEntity_DefaultInventDimPurchSetup
{
InventLocationId = "PER"
}
}
}
};
任何想法我做错了什么?