我想做一个bin转移。但我不能去一个有效的例子。 当我运行以下代码时,我收到此错误“子列表库存字段inventorydetail不是子记录字段”。
我需要知道创建bin传输的正确子记录名称是什么
由于
var binTransfer = nlapiCreateRecord('bintransfer');
binTransfer.setFieldValue('subsidiary',4);
binTransfer.setFieldValue('trandate','9/11/2015');
binTransfer.setFieldValue('location',18);
var invDetail = binTransfer.createCurrentLineItemSubrecord('inventory', 'inventorydetail');
invDetail.selectNewLineItem('inventoryassignment');
invDetail.setCurrentLineItemValue('inventoryassignment', 'binnumber', 'ZB17A01' );
invDetail.setCurrentLineItemValue('inventoryassignment', 'tobinnumber', 'OZ_RECEIVING_18' );
invDetail.setCurrentLineItemValue('inventoryassignment', 'quantity', 1);
invDetail.commitLineItem('inventoryassignment');
invDetail.commit();
binTransfer.commitLineItem('inventory');
nlapiSubmitRecord( binTransfer );
答案 0 :(得分:1)
这是在NetSuite中进行bin传输的正确代码
var binTransfer = nlapiCreateRecord('bintransfer');
binTransfer.setFieldValue('subsidiary',4);
binTransfer.setFieldValue('trandate','9/11/2015');
binTransfer.setFieldValue('location',18);
binTransfer.selectNewLineItem('inventory');
binTransfer.setCurrentLineItemValue('inventory', 'item',108939);
binTransfer.setCurrentLineItemValue('inventory', 'frombins', 'ZB17A01' );
binTransfer.setCurrentLineItemValue('inventory', 'tobins', 'OZ_RECEIVING_18' );
binTransfer.setCurrentLineItemValue('inventory', 'quantity', 1);
binTransfer.commitLineItem('inventory');
nlapiSubmitRecord( binTransfer);
答案 1 :(得分:1)
" frombins"和" tobins"不对。此外,我必须配置inventorydetail以使其工作。还有一点需要注意,请注意脚本在某些(所有?)客户端脚本中不起作用:
var obj = nlapiCreateRecord('bintransfer', {recordmode:'dynamic'});
obj.setFieldValue('trandate', todaydate);
obj.setFieldValue('memo', 'PP#' + pplanid);
obj.setFieldValue('location', '55');
for(i=0; i < (inputcount + 1); i++){
var param_qtyinput = pnvl(request.getParameter('qtyinput' + i),true);
var param_binselect = request.getParameter('binselect' + i);
var param_itemid = request.getParameter('itemid' + i);
var param_frombinid = request.getParameter('frombinid' + i);
if(param_qtyinput > 0 && param_binselect != null){
obj.selectNewLineItem('inventory');
obj.setCurrentLineItemValue('inventory', 'item', param_itemid);
obj.setCurrentLineItemValue('inventory', 'quantity', param_qtyinput);
var subrecord = obj.createCurrentLineItemSubrecord('inventory', 'inventorydetail');
subrecord.selectNewLineItem('inventoryassignment');
subrecord.setCurrentLineItemValue('inventoryassignment', 'quantity', param_qtyinput);
subrecord.setCurrentLineItemValue('inventoryassignment', 'binnumber', param_frombinid);
subrecord.setCurrentLineItemValue('inventoryassignment', 'tobinnumber', param_binselect);
subrecord.commitLineItem('inventoryassignment');
subrecord.commit();
obj.commitLineItem('inventory');
}
}
var id = nlapiSubmitRecord(obj);