Просмотр исходного кода

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wt

huang_an 1 год назад
Родитель
Сommit
bb31ffb635
1 измененных файлов с 67 добавлено и 27 удалено
  1. 67 27
      src/views/bpm/stockManagement/storage.vue

+ 67 - 27
src/views/bpm/stockManagement/storage.vue

@@ -932,7 +932,8 @@
       sourceBizNo: { type: String, default: '' },
       detailList: { type: Array, default: () => [] },
       saleProductList: { type: Array, default: () => [] },
-      detailProductList: { type: Array, default: () => [] }
+      detailProductList: { type: Array, default: () => [] },
+      isMoreProduct: { type: Boolean, default:false }, //多产品包装明细
     },
     data() {
       return {
@@ -1269,8 +1270,18 @@
               warehouseIds.push(this.form.warehouseId);
               warehouseNames.push(this.form.warehouseName);
             }
+            if(this.isMoreProduct){
+              this.formData.extInfo.assetType=[]
+              res.map(item=>{
+                this.formData.extInfo.assetType.push(item.categoryLevelPathIdParent)
+              })
+              this.formData.extInfo.assetType = Array.from(
+                  new Set(...this.formData.extInfo.assetType)
+               );
+              }
             // 生成产品列表
             this.productList = res.map((item, index) => {
+              
               // 显示规格
               let packingSpecificationLabel = this.packingSpecificationOption[
                 index
@@ -1331,10 +1342,9 @@
                   this.packingSpecificationOption[index], // 包装规格选项
                 packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
                 // minPackingQuantity: 1, // 最小包装单元数量
-                packingQuantity:
-                  this.detailList.length || this.form.detailList.length, // 包装数量
+                packingQuantity:this.isMoreProduct?this.detailList.filter(val=>val.productCode==item.code).length:this.detailList.length || this.form.detailList.length, // 包装数量
                 packingUnit: item.packingUnit, // 单位
-                measureQuantity: this.form.totalCount, // 计量数量
+                measureQuantity: this.isMoreProduct?this.getMeasureQuantity(item.code):this.form.totalCount, // 计量数量
                 measureUnit: item.measuringUnit, // 计量单位
                 netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
                 weight: weight, // 重量
@@ -1343,22 +1353,28 @@
                 price: item.price, // 单价
                 purpose: '', // 用途
                 isUnpack: item.isUnpack, // 是否允许拆包
-                warehouseId: this.form.warehouseId, // 仓库id
-                warehouseName: this.form.warehouseName, // 仓库名称
+                warehouseId:this.isMoreProduct?this.detailList.find(val=>val.productCode==item.code)?.warehouseId:this.form.warehouseId, // 仓库id
+                warehouseName: this.isMoreProduct?this.detailList.find(val=>val.productCode==item.code)?.warehouseName:this.form.warehouseName, // 仓库名称
                 warehouseIds,
                 warehouseNames
               };
             });
-            console.log(this.productList);
-            // 生成包装编码
-            const { data } = await storageApi.getAssetNum([
+           let getAssetNumPr=this.isMoreProduct? this.detailList.map(val=>{
+            return {
+                assetCode:val.productCode,
+                batchNum: val.productBrand,
+                num: 1
+              }
+           }):[
               {
                 assetCode:
                   this.productList[0].categoryCode + this.productList[0].index,
                 batchNum: this.productList[0].batchNo,
                 num: this.detailList.length
               }
-            ]);
+            ]
+            // 生成包装编码
+            const { data } = await storageApi.getAssetNum(getAssetNumPr);
             let packingCodeList = data;
             console.log('包装编码-------------------------', packingCodeList);
             // 生产包装
@@ -1402,30 +1418,30 @@
                 this.curDateType = 'purchaseDate';
               }
               return {
-                index: this.productList[0].index + '-' + index, // 包装索引
-                warehouseId: this.productList[0].warehouseIds[index], // 仓库id
-                warehouseName: this.productList[0].warehouseNames[index], // 仓库名称
-                categoryName: this.productList[0].categoryName, // 产品名称
-                categoryCode: this.productList[0].categoryCode, // 产品编码
-                categoryModel: this.productList[0].categoryModel, // 物品型号
-                specification: this.productList[0].specification, // 规格
-                brandNum: this.productList[0].brandNum, // 牌号
-                parentIndex: this.productList[0].index, // 产品索引
+                index: this.isMoreProduct?this.productList.find(val=>val.categoryCode==item.productCode).index+'-'+index:this.productList[0].index + '-' + index, // 包装索引
+                warehouseId:item.warehouseId|| this.productList[0].warehouseIds[index], // 仓库id
+                warehouseName:item.warehouseName|| this.productList[0].warehouseNames[index], // 仓库名称
+                categoryName: item.productName||this.productList[0].categoryName, // 产品名称
+                categoryCode: item.productCode||this.productList[0].categoryCode, // 产品编码
+                categoryModel:item.modelType|| this.productList[0].categoryModel, // 物品型号
+                specification: item.specification||this.productList[0].specification, // 规格
+                brandNum: item.productBrand||this.productList[0].brandNum, // 牌号
+                parentIndex: this.isMoreProduct?this.productList.find(val=>val.categoryCode==item.productCode).index:this.productList[0].index, // 产品索引
                 batchNo: this.productList[0].batchNo, // 批次号
-                packageNo: packingCodeList[index].onlyCode, // 包装编码
+                packageNo:packingCodeList[index].onlyCode, // 包装编码
                 packingQuantity: 1, // 包装数量
                 packingUnit: item.packingUnit, // 单位
                 measureQuantity: item.quantity, // 计量数量
                 measureUnit: item.measuringUnit, // 计量单位
                 weight: item.packingWeight, // 重量
-                weightUnit: this.productList[0].weightUnit, // 重量单位
-                packingSpecificationOption:
-                  this.productList[0].packingSpecificationOption, // 包装规格
+                weightUnit: item.weightUnit||this.productList[0].weightUnit, // 重量单位
+                packingSpecificationOption:this.isMoreProduct?this.productList.find(val=>val.categoryCode==item.productCode)?.packingSpecificationOption:this.productList[0].packingSpecificationOption, // 包装规格
+                  
                 netWeight: this.productList[0].netWeight, // 净重
-                barcodes: item.sendCode, // 发货条码
-                clientCode: item.extInfo.clientCode, // 客户代号
-                materielDesignation: item.extInfo.materielCode, // 物料代号
-                engrave: item.extInfo.engrave, // 刻码
+                barcodes: item.barcodes||item.sendCode, // 发货条码
+                clientCode: item.clientCode||item.extInfo?.clientCode, // 客户代号
+                materielDesignation:item.materielDesignation|| item.extInfo?.materielCode, // 物料代号
+                engrave: item.engrave||item.extInfo?.engrave, // 刻码
                 isUnpack: this.productList[0].isUnpack, // 是否允许拆包
                 productionDate: productionDate, // 生产日期
                 purchaseDate: purchaseDate, // 采购时间
@@ -1437,6 +1453,29 @@
           });
         }
       },
+     //获取计量数量
+     getMeasureQuantity(code){
+          let measureQuantity=0
+          this.detailList.forEach(item=>{
+            if(code==item.productCode){
+              measureQuantity+=item.quantity
+            }
+            
+          })
+         return measureQuantity
+     },
+         //多产品明细数据转换
+    async getDetailsVal(code,productBrand) {
+       const {data} =await storageApi.getAssetNum([
+              {
+                assetCode:code,
+                batchNum: 1,
+                num: 1
+              }
+            ]);
+            console.log(data)
+           return data[0].onlyCode
+      },
       // 获取当前时间函数
       getNowDate() {
         let date = new Date(),
@@ -1733,6 +1772,7 @@
           });
           obj.warehouseIds = warehouseId;
           obj.warehouseNames = warehouseName;
+          obj._packingList=_packingList
           console.log('yyyyy', obj);
           setTimeout(() => {
             resolve(obj);