Netsuite(库存明细)

Netsuite (Inventory Details)

我需要使用 批次编号 Assembly/Bill 的材料 详细信息来配置库存详细信息。我尝试了以下代码来实现这一点。

        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');`

我得到了 Error_ "Invalid issueinventorynumber reference key 2793.0" 谁能帮忙解决这个问题。

“2739”不是有效的 issueinventorynumber 内部 ID。仔细检查您正在写入的字段并确认该值存在,并且您可以访问它。

Error_ "Invalid issueinventorynumber reference key 2793.0" 因为批号的 id 提供不正确....

为了获得正确的批号编号--> 转到你的批次项目记录--> 然后在库存详细信息子选项卡下单击你想要 select 进行库存调整的批号--> 新的弹出窗口 window 将出现,在弹出窗口 window 的 URL 末尾,您将看到类似于 'id=201&l=T' 的 ID,其中 201 将是您的 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');