我一直在努力让 Exact Online Api 工作。应该可以通过 API 制作物品,但 API 不允许我制作 1。
由于较早的问题,我被建议切换到非官方的 picquer 库:在这里找到。
我得到以下代码:
$itemModel->CostPriceNew = $newPrice;
$itemModel->CostPriceStandard = $standardPrice;
$itemModel->Description = $description;
$itemModel->Code = $code;
$itemModel->SearchCode = $searchCode;
$itemModel->IsSalesItem = false;
$itemModel->IsPurchaseItem = true;
$itemModel->Unit = 'pc';
$itemModel->IsTime = false;
$itemModel->CostPriceCurrency = 'EUR';
$itemModel->IsStockItem = false;
$itemModel->IsSubcontractedItem = false;
$itemModel->IsPackageItem = false;
$itemModel->IsSerialItem = false;
$itemModel->IsSerialNumberItem = false;
$itemModel->IsFractionAllowedItem = false;
$itemModel->StartDate = $startDate;
$itemModel->EndDate = $endDate;
$itemModel->ItemGroup = $itemGroup;
$itemModel->save();
当文档(确切的 Api 项目信息)说只需要 2 个时,我发现需要这么多令人沮丧。
无论如何,代码出错了:
$itemModel->Unit = 'pc';
错误 500:出现问题。将尽快调查此问题的原因。
我仔细检查了代码是否存在,并更改为不同的代码。制作了一个自定义代码进行测试。如果我删除该行,它会给我错误
错误 500:必需:单位
如果我将代码更改为不存在的代码:
错误 500:无效参考:单位
为了测试,我在 Exact 网站上制作了一个产品。我通过 API 检索到它并将该单元提供给我的新产品。弹出同样的错误。
我做了一张票,但 Exact 找不到他们这边的任何问题。
有人遇到过这种情况并有解决方案吗?
编辑:我的json:
{
"ExtraDescription": "Child from 75 . Number 24 out of 25",
"CostPriceNew": 170,
"CostPriceStandard": 170,
"Description": "Vrouwentongen",
"Code": "3255",
"SearchCode": "3255",
"IsSalesItem": false,
"IsPurchaseItem": true,
"Unit": "pc",
"IsTime": false,
"CostPriceCurrency": "EUR",
"IsStockItem": false,
"IsSubcontractedItem": false,
"IsPackageItem": false,
"IsSerialItem": false,
"IsSerialNumberItem": false,
"IsFractionAllowedItem": false,
"StartDate": "2005-01-01T12:00",
"EndDate": "2030-12-12T12:00",
"ItemGroup": "4078e7a5-a61c-4751-8875-875f36810554",
"IsBatchNumberItem": 0,
"Class_01": null,
"Class_02": null,
"Class_03": null,
"Class_04": null,
"Class_05": null,
"CopyRemarks": 0,
"Created": null,
"CreatorFullName": null,
"Creator": null,
"Division": null,
"FreeBoolField_01": null,
"FreeBoolField_02": null,
"FreeBoolField_03": null,
"FreeBoolField_04": null,
"FreeBoolField_05": null,
"FreeDateField_01": null,
"FreeDateField_02": null,
"FreeDateField_03": null,
"FreeDateField_04": null,
"FreeDateField_05": null,
"FreeNumberField_01": null,
"FreeNumberField_02": null,
"FreeNumberField_03": null,
"FreeNumberField_04": null,
"FreeNumberField_05": null,
"FreeNumberField_06": null,
"FreeNumberField_07": null,
"FreeNumberField_08": null,
"FreeTextField_01": null,
"FreeTextField_02": null,
"FreeTextField_03": null,
"FreeTextField_04": null,
"FreeTextField_05": null,
"FreeTextField_06": null,
"FreeTextField_07": null,
"FreeTextField_08": null,
"FreeTextField_09": null,
"FreeTextField_10": null,
"GLCostsCode": null,
"GLCostsDescription": null,
"GLCosts": null,
"GLRevenueCode": null,
"GLRevenueDescription": null,
"GLRevenue": null,
"GLStockCode": null,
"GLStockDescription": null,
"GLStock": null,
"ID": "eece9df4-bf5d-4986-8429-76beb6e519cc",
"IsBatchItem": 0,
"IsMakeItem": 0,
"IsNewContract": 0,
"IsOnDemandItem": 0,
"IsRegistrationCodeItem": 0,
"IsWebshopItem": 0,
"ItemGroupCode": null,
"ItemGroupDescription": null,
"Modified": null,
"ModifierFullName": null,
"Modifier": null,
"Notes": null,
"SalesVatCodeDescription": null,
"SalesVatCode": null,
"SecurityLevel": null,
"UnitDescription": null
}