Procházet zdrojové kódy

快捷出库统计数量

lxf před 1 rokem
rodič
revize
f1a8fb90cf
1 změnil soubory, kde provedl 32 přidání a 0 odebrání
  1. 32 0
      src/views/production/operation/batching/quick.vue

+ 32 - 0
src/views/production/operation/batching/quick.vue

@@ -4,6 +4,7 @@
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
         <template #inOutStorageBomList>
           <div style="width: 100%; padding: 0 20px">
+            <div style="margin-bottom: 10px">{{ statisticalQuantity() }}</div>
             <el-table :data="formData.data.inOutStorageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
               <el-table-column type="expand">
                 <template #default="props">
@@ -299,6 +300,37 @@ const changeWarehouse = (val, item, index) => {
     formData.data.inOutStorageBomList[index].surplusStock = 0;
   }
 };
+const statisticalQuantity = () => {
+  let quantity = 0;
+  let material = {};
+  if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
+    for (let i = 0; i < formData.data.inOutStorageBomList.length; i++) {
+      if (formData.data.inOutStorageBomList[i].orderList && formData.data.inOutStorageBomList[i].orderList.length > 0) {
+        if (formData.data.inOutStorageBomList[i].quantity) {
+          quantity = Number(Math.round(quantity + formData.data.inOutStorageBomList[i].quantity));
+        }
+      } else {
+        if (material[formData.data.inOutStorageBomList[i].bomClassifyId]) {
+          material[formData.data.inOutStorageBomList[i].bomClassifyId].quantity = Number(
+            Math.round(material[formData.data.inOutStorageBomList[i].bomClassifyId].quantity + formData.data.inOutStorageBomList[i].quantity)
+          );
+        } else {
+          material[formData.data.inOutStorageBomList[i].bomClassifyId] = {
+            name: formData.data.inOutStorageBomList[i].bomClassifyName,
+            quantity: formData.data.inOutStorageBomList[i].quantity,
+          };
+        }
+      }
+    }
+  }
+  let text = "主材数量: " + quantity;
+  for (let key in material) {
+    if (key && material[key].name) {
+      text = text + ", " + material[key].name + ": " + material[key].quantity;
+    }
+  }
+  return text;
+};
 </script>
 
 <style lang="scss" scoped>