我需要使用批号编号装配/物料清单详细信息配置库存明细。我尝试了以下代码来实现这一目标。
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”任何人都可以帮助解决这个问题。
答案 0 :(得分:2)
我刚刚将该id传递给 String格式而不是整数,例如" 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');
答案 1 :(得分:0)
" 2739"不是有效的issueinventorynumber内部ID。仔细检查您要写入的字段并验证该值是否存在,以及您是否可以访问它。
答案 2 :(得分:0)
Error_“无效的issueinventorynumber引用密钥2793.0”因为未正确提供批号的ID而发生....
获取批号的正确ID - >转到您的批次项目记录 - >然后在“库存明细”子选项卡下,单击要为库存调整选择的批号 - >将出现新的弹出窗口,在弹出窗口的URL末尾,您将看到id为'id = 201 & l = T',其中201将是您的ID。