Procházet zdrojové kódy

fix(bpm): 修复入库流程中包装单位与规格参数获取错误

- 修复打包单位取值逻辑,优先使用 filtersItem.packingUnit,其次使用 newSpecificationOption 中的转换单位
- 补充产品列表缺少的 quantity 和 unit 字段
- 修复颜色、机型取值未安全处理空字符串分割的问题
- 统一代码缩进与格式
yusheng před 1 dnem
rodič
revize
fe01df906a

+ 2 - 1
src/views/bpm/handleTask/components/productionWarehousing/detailDialog.vue

@@ -225,7 +225,8 @@
               productCode: item.categoryCode,
               productId: item.categoryId,
               packingQuantity: item.packingCount,
-              packingUnit:item.packingUnit||item.measuringUnit
+              // quantity: item.quantity,
+              // packingUnit:item.packingUnit||item.measuringUnit
             };
           });
         }

+ 47 - 23
src/views/bpm/stockManagement/storage.vue

@@ -1876,7 +1876,8 @@
                     filtersItem &&
                     filtersItem.isAllPackageData &&
                     filtersItem.isAllPackageData == 1
-                      ? filtersItem.packingUnit
+                      ? filtersItem.packingUnit ||
+                        newSpecificationOption[1]?.packingUnit
                       : item.packingUnit, // 单位
 
                   unit:
@@ -1899,8 +1900,12 @@
                       ? filtersItem.measuringUnit
                       : item.measuringUnit, // 计量单位
                   unitId: filtersItem.purchaseUnitId || filtersItem.saleUnitId,
-                  modelKey: filtersItem.modelKey ? filtersItem.modelKey?.split(',')?.[0] || '' : '', // 机型
-                  colorKey: filtersItem.colorKey ? filtersItem.colorKey?.split(',')?.[0] || '' : '', // 颜色
+                  modelKey: filtersItem.modelKey
+                    ? filtersItem.modelKey?.split(',')?.[0] || ''
+                    : '', // 机型
+                  colorKey: filtersItem.colorKey
+                    ? filtersItem.colorKey?.split(',')?.[0] || ''
+                    : '', // 颜色
                   measureType: item.measureType, // 计量方式
                   netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
                   singleWeight: singleWeight || 0, // 单重重量
@@ -2041,6 +2046,7 @@
               // );
 
               // 生成产品列表
+              let newSpecificationOption = [];
               this.productList = mergedList.map((filtersItem, index) => {
                 let item = res.find(
                   (detailItem) =>
@@ -2088,7 +2094,7 @@
                   })
                   .filter((item) => !!item);
 
-                const newSpecificationOption = packingSpecificationItem;
+                newSpecificationOption = packingSpecificationItem;
 
                 // 换算重量
                 let weight = 0;
@@ -2161,7 +2167,11 @@
                       break;
                   }
                 }
-                let packingUnit = filtersItem.packingUnit;
+                let packingUnit =
+                  filtersItem.packingUnit ||
+                  newSpecificationOption[1]?.conversionUnit ||
+                  '';
+
                 let singleWeight = filtersItem.singleWeight || 0; // 单重重量
 
                 return {
@@ -2214,6 +2224,10 @@
                     ? filtersItem.quantity
                     : filtersItem.quantity || this.form.totalCount, // 计量数量
                   measureUnit: filtersItem.measuringUnit, // 计量单位
+                  quantity: this.isMoreProduct
+                    ? filtersItem.quantity
+                    : filtersItem.quantity || this.form.totalCount, // 数量
+                  unit: filtersItem.measuringUnit, // 单位
                   measureType: item.measureType, // 计量方式
                   netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
                   weight: weight || 0, // 重量
@@ -2221,7 +2235,9 @@
                   weightUnit: item.weightUnit, // 重量单位
                   totalMoney: filtersItem.totalPrice, // 总价
                   unitPrice: filtersItem.unitPrice, // 单价
-                  reelSpecification: filtersItem.reelSpecification || filtersItem.extInfo?.reelSpecification, // 盘具
+                  reelSpecification:
+                    filtersItem.reelSpecification ||
+                    filtersItem.extInfo?.reelSpecification, // 盘具
                   purpose: '', // 用途
                   isUnpack: item.isUnpack, // 是否允许拆包
                   warehouseId: this.isMoreProduct
@@ -2378,11 +2394,17 @@
                     item.specification || this.productList[0].specification, // 规格
                   brandNum: item.productBrand || this.productList[0].brandNum, // 牌号
                   colorKey:
-                    (item.colorKey ? item.colorKey?.split(',')?.[0] || '' : '') ||
-                    this.productList[0].colorKey?.split(',')?.[0] || '', // 颜色
+                    (item.colorKey
+                      ? item.colorKey?.split(',')?.[0] || ''
+                      : '') ||
+                    this.productList[0].colorKey?.split(',')?.[0] ||
+                    '', // 颜色
                   modelKey:
-                    (item.modelKey ? item.modelKey?.split(',')?.[0] || '' : '') ||
-                    this.productList[0].modelKey?.split(',')?.[0] || '', // 机型
+                    (item.modelKey
+                      ? item.modelKey?.split(',')?.[0] || ''
+                      : '') ||
+                    this.productList[0].modelKey?.split(',')?.[0] ||
+                    '', // 机型
                   parentIndex: this.isMoreProduct
                     ? this.productList.find(
                         (val) => val.categoryCode == item.productCode
@@ -2394,7 +2416,9 @@
                     item.packingCode ||
                     packingCodeList[index]?.onlyCode, // 包装编码
                   packingQuantity: 1, // 包装数量
-                  packingUnit: item.packingUnit, // 单位
+                  packingUnit:
+                    item.packingUnit ||
+                    newSpecificationOption[1]?.conversionUnit, // 单位
                   measureQuantity: item.quantity || item.measureQuantity, // 计量数量
                   measureUnit: item.measuringUnit || item.measureUnit, // 计量单位
                   supplierCode: item.supplierCode,
@@ -2416,7 +2440,8 @@
                   materielDesignation:
                     item.materielDesignation || item.extInfo?.materielCode, // 物料代号
                   engrave: item.engrave || item.extInfo?.engrave, // 刻码
-                  reelSpecification: item.reelSpecification || item.extInfo?.reelSpecification, // 盘具
+                  reelSpecification:
+                    item.reelSpecification || item.extInfo?.reelSpecification, // 盘具
                   isUnpack: item.isUnpack || this.productList[0].isUnpack, // 是否允许拆包
                   productionDate: productionDate, // 生产日期
                   purchaseDate: purchaseDate, // 采购时间
@@ -3657,11 +3682,11 @@
               );
 
               this.$refs.wareHouseDailogRef.open(
-                                  num,
-                  row.measureQuantity,
-                  idx,
-                  row.warehouseId,
-                  row.warehouseName + ''
+                num,
+                row.measureQuantity,
+                idx,
+                row.warehouseId,
+                row.warehouseName + ''
               );
               // if (packingBoolen) {
               //   console.log(
@@ -4055,8 +4080,7 @@
            *                     : row.packingSpecificationOption[1].conversionUnit: row.measureUnit: packingBoolen ? filterArr[0].conversionUnit : row.packingUnit,
            */
           if (row.isUnpack) {
-              item.packingUnit =
-                row.packingSpecificationOption[1].conversionUnit;
+            item.packingUnit = row.packingSpecificationOption[1].conversionUnit;
             // // 第二层条件: packingBoolen
             // if (packingBoolen) {
             //   // 空值保护: 确保 filterArr[0] 存在
@@ -4084,10 +4108,10 @@
               ? Number(item.measureQuantity)
               : 0;
           } else {
-                 item.weight = this.$math.format(
-                (row.singleWeight || 0) * item.measureQuantity,
-                14
-              );
+            item.weight = this.$math.format(
+              (row.singleWeight || 0) * item.measureQuantity,
+              14
+            );
             // console.log('计量单位为不为KG类======================');
             // // 计量单位为不为KG类,重新统计计算
             // let inBoolen = !!this.getDict(