gpt4 book ai didi

netsuite - 无法在项目履行记录上设置库存详细信息 - Suitescript 2

转载 作者:行者123 更新时间:2023-12-04 12:47:26 66 4
gpt4 key购买 nike

在我的 内预定脚本我正在将转换后的销售订单上的项目循环到项目履行,并在循环项目时尝试设置库存详细信息。 Inventory 详细信息看起来没有任何错误或问题,但是当我尝试保存时,出现以下错误:

Please configure the inventory detail in line 2 of the item list.



第二行是我测试中唯一需要库存详细信息的项目。这是代码:
 var itemFulfillment = record.transform({
fromType: record.Type.SALES_ORDER,
fromId: salesOrder.fields.id,
toType: record.Type.ITEM_FULFILLMENT,
isDynamic: true
});

var lineCount = itemFulfillment.getLineCount({ sublistId: 'item' });

for (var i = 0; i < lineCount; i++) {
itemFulfillment.selectLine({
sublistId: 'item',
line: i
});

var remainingQty = itemFulfillment.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantityremaining'
});

itemFulfillment.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: remainingQty
});

var inventoryDetail = itemFulfillment.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'inventorydetailreq'
});

var binItem = itemFulfillment.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'binitem'
});

if (inventoryDetail === 'T' && binItem === 'T') {

var inventoryDetailRecord = itemFulfillment.getCurrentSublistSubrecord({
sublistId: 'item',
fieldId: 'inventorydetail'
});

inventoryDetailRecord.selectNewLine({
sublistId: 'inventoryassignment'
});


inventoryDetailRecord.setCurrentSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'issueinventorynumber',
value: 10154 // I know this is the serial number record internal ID for my test
});

inventoryDetailRecord.setCurrentSublistValue({
sublistId: 'inventoryassignment',
fieldId: 'quantity',
value: 1 //Again I know this so hard coded for testing
});

inventoryDetailRecord.commitLine({
sublistId: 'inventoryassignment'
});
}
}

var ifRecordId = itemFulfillment.save();

提交库存详细信息后,如果我检查 库存明细子记录我可以看到该行对应于第 2 行和正确的项目。不知道为什么当我保存它时说第 2 行需要库存!
{"type":"inventorydetail","isDynamic":true,"fields":{"itemdescription":"160W PREMIUM GRADE","nlloc":"0","nlsub":"1","trandate":"4/20/2017","_eml_nkey_":"0","type":"inventorydetail","subrecord_parent_tran_type":"ItemShip","nsapiCT":"1492728327986","sys_id":"-19281976277926580","nluser":"-4","nldept":"0","subrecord_transform_from_parent_id":"305887","subrecord_transform_from_parent_tran_type":"SalesOrd","tolocationusesbins":"F","item":"3312","quantity":"1.0","sys_parentid":"19281975969964536","templatestored":"F","entryformquerystring":"orderline=2&unit=&item=3312&quantity=1&subrecord_transform_from_parent_id=305887&trandate=4/20/2017&location=25&uitype=LOH_STRICT_VALIDATION&subrecord_transform_from_parent_tran_type=salesord&subrecord_parent_tran_type=itemship","nlrole":"3","uitype":"LOH_STRICT_VALIDATION","baserecordtype":"inventorydetail","baseunitquantity":"1.0","totalquantity":"1","orderline":"2","haslines":"T","tolocation":"-1","customform":"-10820","location":"25"},"sublists":{"inventoryassignment":{"currentline":{"binnumber":"","binnumber_display":"","existinginventorynumber":"","expirationdate":"","internalid":"-1","inventorydetail":"-1","issueinventorynumber":"","lotquantityavailable":"","quantity":"1","quantityavailable":"","receiptinventorynumber":"","sys_id":"-19281976361182898","sys_parentid":"-19281976277926580","tobinnumber":"","tobinnumber_display":"","#":"2"},"line 1":{"binnumber":"25","binnumber_display":"","existinginventorynumber":"10154","expirationdate":"","internalid":"10154.0","inventorydetail":"-1","issueinventorynumber":"10154","lotquantityavailable":"","quantity":"1.0","quantityavailable":"","receiptinventorynumber":"1793064_3312_NA","sys_id":"-19281976302211623","sys_parentid":"-19281976277926580","tobinnumber":"","tobinnumber_display":""}}}}

我已经尝试了我能想到的所有组合,并按照套件答案文档进行了操作。已尝试在项目详细信息/分配下的 Netsuite 记录浏览器中设置每个值,但仍然出现此错误。非常感谢帮助/见解。

最佳答案

我是DJ。我是 NetSuite 的一名软件开发人员,在 SuiteScript 记录服务平台团队工作,我只是在研究这个问题。

履行记录上的项目子列表就是我们所说的“列表机器”(与“编辑机器”相对)。前者是固定条目列表,您可以在其中编辑值但不能添加或删除行,而“编辑机器”是您还可以添加和删除行的列表。在履行记录上,项目列表是不可行编辑的种类。
inventorydetail编辑机每一行上的子记录(在项目履行记录上)仅在您以 isDynamic 的模式操作子记录时才有效。为false,因为项目机是列表机,不兼容动态子记录。不幸的是,没有办法指定 isDynamic子记录的属性,因为该属性当前是从父记录继承的。

但是,您可以 欺骗它做正确的事!因此,瑞安的第二个解决方案。此解决方案可以解决所有限制,如下所示:

  • 将销售订单转换为履行记录时,省略 isDynamic导致将履行记录创建为 DeferredDynamic (“标准”模式)记录。
  • 获取时inventorydetail子记录,它将继承 isDynamic来自父记录的属性,这意味着它将被创建为 DeferredDynamicSubrecord而不是 DynamicSubRecord .这使它与项目列表机器兼容,因此该解决方案有效。

  • 我正在与产品团队合作,看看是否有办法让 SuiteScript V2 以最适合其环境的模式(或至少是可行的模式)自动创建每个子记录。或者我们可以提供一种方法来指定 isDynamic从记录或子记录创建/获取子记录时的子记录参数。

    关于netsuite - 无法在项目履行记录上设置库存详细信息 - Suitescript 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43526532/

    66 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com