2016-09-20 85 views
1

我需要使用批號編號組裝/物料清單配置詳細信息。並且我嘗試了下面的代碼來實現它。Netsuite(庫存明細)

 var recordScreate = nlapiCreateRecord('inventoryadjustment') 
     recordScreate.setFieldValue('account', 850); 
     recordScreate.setFieldValue('adjlocation', locationSvalue); 
     recordScreate.setFieldValue('custbody_cseg1', jbSvalue); 


     recordScreate.setCurrentLineItemValue('inventory', 'item', fgSvalue); 
     recordScreate.setCurrentLineItemValue('inventory', 'location',locationSvalue); 
     recordScreate.setCurrentLineItemValue('inventory', 'adjustqtyby',-hproductionSscrap);`` 



     var inventoryDetail = recordScreate.createCurrentLineItemSubrecord('inventory', 'inventorydetail'); 
     inventoryDetail.selectNewLineItem('inventoryassignment'); 
     inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'issueinventorynumber',2793); 
     inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', -hproductionSscrap); 
     inventoryDetail.commitLineItem('inventoryassignment'); 
     inventoryDetail.commit(); 

     recordScreate.commitLineItem('inventory');` 

和我得到了錯誤_「無效issueinventorynumber參考關鍵詞2793.0」誰能請幫助,在此對解決這一問題。

回答

1

嘿,夥計們感謝您的支持。最後我得到了答案。記錄存在。我做了ID ...

我剛剛過去了ID爲字符串格式不整數,如「2739」,而不是2739 ..修正代碼如下...

var recordScreate = nlapiCreateRecord('inventoryadjustment') 
    recordScreate.setFieldValue('account', 850); 
    recordScreate.setFieldValue('adjlocation', locationSvalue); 
    recordScreate.setFieldValue('custbody_cseg1', jbSvalue); 


    recordScreate.setCurrentLineItemValue('inventory', 'item', fgSvalue); 
    recordScreate.setCurrentLineItemValue('inventory', 'location',locationSvalue); 
    recordScreate.setCurrentLineItemValue('inventory', 'adjustqtyby',-hproductionSscrap);`` 



    var inventoryDetail = recordScreate.createCurrentLineItemSubrecord('inventory', 'inventorydetail'); 
    inventoryDetail.selectNewLineItem('inventoryassignment'); 
    inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'issueinventorynumber','2793'); 
    inventoryDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', -hproductionSscrap); 
    inventoryDetail.commitLineItem('inventoryassignment'); 
    inventoryDetail.commit(); 

    recordScreate.commitLineItem('inventory'); 
0

「2739」不是有效issueinventorynumber內部ID。仔細檢查您正在寫入的字段,並驗證該值是否存在,以及您是否有權訪問該字段。

0

錯誤_「無效issueinventorynumber參考關鍵詞2793.0」,是因爲沒有正確提供批號ID發生....

對於獲得的批號正確的ID - >轉到您地塊項目record->然後在庫存詳細信息子標籤下點擊您要選擇的庫存調整的批號 - >新彈出窗口將出現,在彈出窗口的URL末尾,您將看到類似'id = & l = T'其中201將是您的ID。