程式碼:
void BooksStockUpdate(string xWO_No, decimal xWO_Qty)
{
//表頭
head = Map();
head.put("date",zoho.currentdate.tostring("yyyy-MM-dd"));
head.put("reason","xxxxx");
head.put("reference_number","xxxxx");
head.put("adjustment_type","quantity");
head.put("description","xxxxx");
//表身
iteml = list();
iteml.clear();
for each WOD in F_WODetail[WO_No = WO.ID]
{
IM_No_BooksID = F_Item[ID = WOD.IM_No].Books_ID; 'Item寫入必需寫入ID
ii = Map();
ii.put("item_id",品目ID);
ii.put("quantity_adjusted",調整數量);
ii.put("unit","qty");
ii.put("is_combo_product",false);
ii.put("adjustment_account_id",帳目ID);
ii.put("warehouse_id",倉庫ID);
iteml.add(ii);
}
head.put("line_items",iteml);
data = Map();
data.put("JSONString",head);
aaa = invokeurl
[
url :"https://inventory.zoho.com/api/v1/inventoryadjustments?organization_id=ORG_ID"
type :POST
parameters:data
connection:"Connection Name"
];
if (aaa.get("code")=0)
{
success message ""
}
else
{
alert ""
}
}