695593266@qq.com 8 месяцев назад
Родитель
Сommit
8196716e21

+ 55 - 3
src/views/produce/components/jobBooking/components/batchPackagingGrouping.vue

@@ -148,6 +148,10 @@
                       }}{{ row.extInfo.weightUnit }}</span
                     >
                   </template>
+
+                  <template v-slot:feedQuantity="{ row, $index }">
+                    <span>{{ row.feedQuantity }}{{ row.unit }}</span>
+                  </template>
                 </ele-pro-table>
 
                 <!-- <template v-slot:newWeight="{ row, $index }">
@@ -316,7 +320,7 @@
               </template>
 
               <template v-slot:feedQuantity="{ row, $index }">
-                <span>{{ row.feedQuantity }}</span>
+                <span>{{ row.feedQuantity }}{{ row.unit }}</span>
               </template>
 
               <template v-slot:reportWeight="{ row, $index }">
@@ -461,12 +465,24 @@
             console.log(newVal.product, 'newVal.product');
             this.newCategoryId = newVal.product[0].categoryId;
             this.formedNumLast = newVal.product.reduce((acc, pro) => {
-              return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
+              return pro.feedQuantity &&
+                (!pro.extInfo.isQualified ||
+                  pro.extInfo.isQualified == 1 ||
+                  pro.extInfo.isQualified == 3) &&
+                !pro.extInfo.isLoss
+                ? this.add(acc, Number(pro.feedQuantity))
+                : acc;
             }, 0);
           } else if (newVal.semiProductList && newVal.semiProductList.length) {
             this.newCategoryId = newVal.semiProductList[0].categoryId;
             this.formedNumLast = newVal.semiProductList.reduce((acc, pro) => {
-              return pro.feedQuantity ? acc + Number(pro.feedQuantity) : acc;
+              return pro.feedQuantity &&
+                (!pro.extInfo.isQualified ||
+                  pro.extInfo.isQualified == 1 ||
+                  pro.extInfo.isQualified == 3) &&
+                !pro.extInfo.isLoss
+                ? this.add(acc, Number(pro.feedQuantity))
+                : acc;
             }, 0);
           } else {
             this.formedNumLast = 0;
@@ -474,6 +490,10 @@
           if (newVal.isUnpack == '1') {
             this.packageDispositionFn();
           }
+
+          if (this.isNewUnpack == 1) {
+            this.checkUnpackProduction();
+          }
         },
         deep: true,
         immediate: true
@@ -932,6 +952,38 @@
         });
       },
 
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      sub(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
       checkUnpack() {
         this.$confirm('此操作将进行拆包, 是否继续?', '提示', {
           confirmButtonText: '确定',

+ 4 - 1
src/views/produce/components/jobBooking/components/detailPackagingGrouping.vue

@@ -292,7 +292,10 @@
             row-key="index"
           >
             <template v-slot:feedQuantity="{ row, $index }">
-              <span>{{ row.feedQuantity }}{{ row.packingUnit }}</span>
+              <span
+                >{{ row.feedQuantity
+                }}{{ row.packageQuantity ? row.packingUnit : row.unit }}</span
+              >
             </template>
 
             <template v-slot:packageQuantity="{ row, $index }">

+ 0 - 6
src/views/produce/components/jobBooking/components/jobBom.vue

@@ -304,21 +304,15 @@
                   item.extInfo.isQualified == 3) &&
                 !item.extInfo.isLoss
               ) {
-                // formedNum = formedNum + Number(item.feedQuantity);
                 formedNum = this.add(formedNum, Number(item.feedQuantity));
               } else if (!item.extInfo.isLoss) {
                 if (item.extInfo.notType == 5 || item.extInfo.notType == 8) {
-                  // formedNum = formedNum + Number(item.feedQuantity);
-
                   formedNum = this.add(formedNum, Number(item.feedQuantity));
                 } else {
-                  // notFormedNum = notFormedNum + Number(item.feedQuantity);
-                  // if (!item.extInfo.isLoss) {
                   notFormedNum = this.add(
                     notFormedNum,
                     Number(item.feedQuantity)
                   );
-                  // }
                 }
               } else if (item.extInfo.isLoss == 1) {
                 lossNum = this.add(lossNum, Number(item.feedQuantity));

+ 7 - 0
src/views/produce/components/warehousing/components/detailsBom.vue

@@ -78,6 +78,12 @@
         />
       </template>
 
+      <template v-slot:quantity="{ row, $index }">
+        <div class="content_num"
+          >{{ row.quantity }} {{ row.measuringUnit }}</div
+        >
+      </template>
+
       <template v-slot:materielCode="{ row, $index }">
         <span v-if="isDetails">{{ row.extInfo.materielCode }}</span>
         <el-input
@@ -98,6 +104,7 @@
           placeholder="请输入客户代号"
         />
       </template>
+
       <!-- <template v-slot:deviceId="{ row, $index }">
         <el-select
           v-if="deviceList?.length > 0"