//native
type SageIntacct = {
token: string
}
/**
* Create an item warehouse inventory information object
* Creates a new item warehouse inventory information object.
Permissions and other requirements
SubscriptionInventory Control, Order Entry, or Purchasing
User typeBusiness, Project Manager, Employee, Warehouse
PermissionsAdd, Edit Items
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
item?: { key?: string; id?: string; href?: string }
warehouse?: { key?: string; id?: string; href?: string }
storageArea?: string
inventoryCycle?: { key?: string; id?: string; href?: string }
economicOrderQuantity?: number
standardCost?: string
lastCost?: string
averageCost?: string
reorderMethod?: 'economicQuantity' | 'maxStockLevel' | 'reorderPoint'
reorderPoint?: number
reorderQuantity?: number
minOrderQuantity?: number
maxOrderQuantity?: number
maximumStock?: number
minimumStock?: number
lastSoldDate?: string
lastReceivedDate?: string
defaultBin?: { key?: string; id?: string; href?: string }
warehouseLocation?: {
key?: string
id?: string
currency?: string
href?: string
}
safetyStock?: number
replenishmentMethod?:
| 'reorderPoint'
| 'demandForecastBySingleValue'
| 'demandForecastByFluctuatingValues'
enableReplenishment?: false | true
onOrder?: number
inTransit?: number
onHand?: number
onHold?: number
reserved?: number
allocated?: number
unCommitted?: number
href?: string
itemWarehouseVendor?: {
key?: string
id?: string
itemWarehouse?: { key?: string; id?: string; href?: string }
vendor?: { key?: string; id?: string; href?: string }
stockNumber?: string
leadTime?: number
demandForecastDuringLeadTime?: number
economicalOrderQuantity?: number
vendorMinimumOrderQuantity?: number
bestPrice?: string
latestPrice?: string
unitOfMeasure?: { key?: string; id?: string; href?: string }
conversionFactor?: string
isPreferredVendor?: false | true
href?: string
}[]
standardCostEntries?: {
key?: string
id?: string
href?: string
effectiveStartDate?: string
standardCost?: string
itemWarehouse?: {
key?: string
id?: string
href?: string
itemId?: string
warehouseId?: string
}
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
}[]
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
} & {}
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/inventory-control/item-warehouse-inventory`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago