/**
- @NApiVersion 2.x
- @NScriptType Restlet
*/
define([‘N/log’, ‘N/record’],
function (log, record) {
function post(params) {
log.debug('参数', params)
var recordObj = record.create({
type: record.Type.INVENTORY_ITEM,
isDynamic: true
});
recordObj.setText({
fieldId: 'itemid',
text: params.code,
});
recordObj.setText({
fieldId: 'custitem_k_parent_sku',
text: params.spuCode,
});
recordObj.setText({
fieldId: 'displayname',
text: params.name,
});
recordObj.setText({
fieldId: 'custitem_14k_price',
text: params.price,
});
//面料型号
recordObj.setText({
fieldId: 'custitem_k_fabric_sku',
text: params.shellFabricModel,
});
//面料用量
recordObj.setText({
fieldId: 'custitem_k_fabric_dosage',
text: params.shellFabricQty,
});
//成分
recordObj.setText({
fieldId: 'custitem_k_fabric_content',
text: params.composition,
});
//毛重
recordObj.setText({
fieldId: 'custitem_k_weight',
text: params.packWeight,
});
//单个体积汇总
recordObj.setText({
fieldId: 'custitem_k_cbm',
text: params.packSkuVolume,
});
//单个sku包装数
recordObj.setText({
fieldId: 'custitem_k_individual',
text: params.packSkuNum,
});
//包装体积
recordObj.setText({
fieldId: 'custitem_k_1cbm',
text: params.packVolume,
});
//SCM 运营方式为自营
recordObj.setValue({
fieldId: 'custitem_k_agent_operation',
value: 1,
});
//是否包括附属公司 true false
recordObj.setValue({
fieldId: 'includechildren',
value: true,
});
//产品类型 SCM产品类型写死为家具
recordObj.setValue({
fieldId: 'custitem_k_sku_leixing',
value: 1,
});
//采购/库存 追踪到岸成本 追踪到岸成本写死true
recordObj.setValue({
fieldId: 'tracklandedcost',
value: true,
});
// 保存
var recordId = recordObj.save({
enableSourcing: true,
ignoreMandatoryFields: true
});
return recordId;
}
return {
post: post
};
});