yusheng il y a 2 semaines
Parent
commit
ddc8566918
1 fichiers modifiés avec 57 ajouts et 62 suppressions
  1. 57 62
      src/views/warehouseManagement/stockManagement/add.vue

+ 57 - 62
src/views/warehouseManagement/stockManagement/add.vue

@@ -3027,7 +3027,7 @@
         }
 
         // 判断单位和计量单位是否为不拆物料层规格
-        let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
+        let packingBoolen = !!this.getDict('不拆物料层规格', row.unit)
           .dictValue;
         let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
           .dictValue;
@@ -3311,71 +3311,66 @@
               }
             }
 
-            let outBoolen = !!this.getDict('不拆物料层规格', item.measureUnit)
-              .dictValue;
-            //计量单位等于重量单位
+         
             if (row.weightUnit == row.measureUnit) {
               item.weight = item.measureQuantity
                 ? Number(item.measureQuantity)
                 : 0;
-            } else if (outBoolen) {
-              // 计量单位为KG类,直接替换
-              item.weight = item.measureQuantity
-                ? Number(item.measureQuantity)
-                : 0;
-            } else {
-              console.log('计量单位为不为KG类======================');
-              // 计量单位为不为KG类,重新统计计算
-              let inBoolen = !!this.getDict(
-                '不拆物料层规格',
-                item.packingSpecificationOption[0].packageUnit
-              ).dictValue;
-              let startIndex = item.packingSpecificationOption.findIndex(
-                (ite) => {
-                  return (
-                    item.measureUnit == ite.packingUnit &&
-                    ite.packingUnit != ite.conversionUnit
-                  );
-                }
-              );
-
-              let endIndex = item.packingSpecificationOption.findIndex(
-                (ite) => item.packingUnit == ite.conversionUnit
-              );
-              if (measureBoolen) {
-                let total = item.packingQuantity
-                  ? Number(item.packingQuantity)
-                  : 0;
-                for (; startIndex < endIndex; endIndex--) {
-                  total = this.$math.format(
-                    item.packingSpecificationOption[endIndex].packageCell *
-                      total,
-                    14
-                  );
-                }
-                if (inBoolen) {
-                  // 第二层为KG类
-                  item.weight = total ? Number(total) : 0;
-                } else {
-                  // 第二层不为KG类
-                  item.weight = this.$math.format(total * item.netWeight, 14);
-                }
-              } else if (!measureBoolen) {
-                if (inBoolen) {
-                  // 第二层为KG类
-                  item.weight = item.measureQuantity
-                    ? Number(item.measureQuantity)
-                    : 0;
-                } else {
-                  // 第二层不为KG类
-                  if (row.singleWeight && item.measureQuantity) {
-                    item.weight =
-                      Number(item.measureQuantity) * Number(row.singleWeight);
-                  } else {
-                    item.weight = item.weight || 0;
-                  }
-                }
-              }
+            } else { 
+              //单位不相等 物品层总重除包装层计量
+               item.weight=this.$math.format(row.weight/item.measureQuantity, 14);
+              // console.log('计量单位为不为KG类======================');
+              // // 计量单位为不为KG类,重新统计计算
+              // let inBoolen = !!this.getDict(
+              //   '不拆物料层规格',
+              //   item.packingSpecificationOption[0].packageUnit
+              // ).dictValue;
+              // let startIndex = item.packingSpecificationOption.findIndex(
+              //   (ite) => {
+              //     return (
+              //       item.measureUnit == ite.packingUnit &&
+              //       ite.packingUnit != ite.conversionUnit
+              //     );
+              //   }
+              // );
+
+              // let endIndex = item.packingSpecificationOption.findIndex(
+              //   (ite) => item.packingUnit == ite.conversionUnit
+              // );
+              // if (measureBoolen) {
+              //   let total = item.packingQuantity
+              //     ? Number(item.packingQuantity)
+              //     : 0;
+              //   for (; startIndex < endIndex; endIndex--) {
+              //     total = this.$math.format(
+              //       item.packingSpecificationOption[endIndex].packageCell *
+              //         total,
+              //       14
+              //     );
+              //   }
+              //   if (inBoolen) {
+              //     // 第二层为KG类
+              //     item.weight = total ? Number(total) : 0;
+              //   } else {
+              //     // 第二层不为KG类
+              //     item.weight = this.$math.format(total * item.netWeight, 14);
+              //   }
+              // } else if (!measureBoolen) {
+              //   if (inBoolen) {
+              //     // 第二层为KG类
+              //     item.weight = item.measureQuantity
+              //       ? Number(item.measureQuantity)
+              //       : 0;
+              //   } else {
+              //     // 第二层不为KG类
+              //     if (row.singleWeight && item.measureQuantity) {
+              //       item.weight =
+              //         Number(item.measureQuantity) * Number(row.singleWeight);
+              //     } else {
+              //       item.weight = item.weight || 0;
+              //     }
+              //   }
+              // }
             }
             packingList.push(item);
           }