/* * 添加物料 * mat -- 物料详情 * matList -- 已添加物料 * */ function matCheck(mat, matList) { let newMatList = [], add = true; if (matList.length > 0) { for (let item of matList) { if (item.matnr == mat.matnr) { if (item.batch == mat.batch) { add = false item.count = item.count + mat.count } else { } } } } if (add) { matList.unshift(mat) } return matList } module.exports = { matCheck: matCheck, }