whycq
2024-03-28 1d5b60515b80cf400b214a5f565792c212fe6f2e
static/js/util.js
New file
@@ -0,0 +1,32 @@
/*
*   添加物料
*    mat -- 物料详情
*    matList -- 已添加物料
*
*/
function matCheck(mat, matList) {
   // console.log("matList:" + matList);
   // console.log("mat:" + JSON.stringify(mat));
   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,
}