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

批量选择仓库;入库申请

yijing 1 год назад
Родитель
Сommit
ffc5971112

+ 82 - 53
src/views/warehouseManagement/stockManagement/add.vue

@@ -83,7 +83,7 @@
               @click="listSaveArrs">批量保存</el-button>
             <el-button v-if="productList.length != 0 && this.packingList.length == 0" type="success" plain
               style="margin-bottom: 20px; float: right; margin-right: 20px" size="mini"
-              @click="handleWareHouse(productList[0])">批量选择仓库</el-button>
+              @click="handleWareHouse(productList, '', 'batch')">批量选择仓库</el-button>
             <el-table :header-cell-style="rowClass" :max-height="300" border ref="productListTable" :data="productList"
               tooltip-effect="dark">
               <el-table-column label="序号" type="index" width="50" align="center">
@@ -290,19 +290,19 @@
           </el-table-column>
           <el-table-column label="序号" type="index" width="50">
           </el-table-column>
-          <el-table-column label="编码" prop="categoryCode" width="130" :show-overflow-tooltip="true"></el-table-column>
-          <el-table-column label="名称" prop="categoryName" width="150" :show-overflow-tooltip="true"></el-table-column>
-          <el-table-column label="批次号" prop="batchNo" width="70"></el-table-column>
-          <el-table-column label="包装编码" prop="packageNo" width="200" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="批次号" prop="batchNo" width="80" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="包装编码" prop="packageNo" width="130" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="名称" prop="categoryName" width="120" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="编码" prop="categoryCode" width="120" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="型号" prop="categoryModel" width="80" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="规格" prop="specification" width="80" :show-overflow-tooltip="true"></el-table-column>
+          <el-table-column label="牌号" prop="brandNum" width="80" :show-overflow-tooltip="true"></el-table-column>
+
           <el-table-column label="包装数量" prop="packingQuantity" width="80"></el-table-column>
           <el-table-column label="包装单位" prop="packingUnit"></el-table-column>
           <el-table-column label="计量数量" prop="measureQuantity" :show-overflow-tooltip="true"></el-table-column>
           <el-table-column label="计量单位" prop="measureUnit"></el-table-column>
-          <!-- <el-table-column label="允许拆包" prop="isUnpack">
-            <template slot-scope="{ row, $index }">
-              {{ row.isUnpack ? '是' : '否' }}
-            </template>
-          </el-table-column> -->
+
           <el-table-column label="仓库" :show-overflow-tooltip="true" prop="warehouseName" width="200"></el-table-column>
           <el-table-column label="供应商" align="center" prop="supplierName" width="200" :show-overflow-tooltip="true">
           </el-table-column>
@@ -323,17 +323,6 @@
             </template>
           </el-table-column>
           <el-table-column label="客户代号" prop="clientCode">
-            <!-- <template slot-scope="{ row, $index }">
-              <el-input
-                v-if="!row.isPack"
-                :ref="'packing_clientCode' + $index"
-                @keyup.native="
-                  moveFocus($event, $index, 'packing_clientCode', '包装', row)
-                "
-                v-model="row.extInfo.clientCode"
-              ></el-input>
-              <span v-else> {{ row.extInfo.clientCode }}</span>
-            </template> -->
           </el-table-column>
           <el-table-column label="刻码" prop="engrave" width="140">
             <template slot-scope="{ row, $index }">
@@ -1800,6 +1789,7 @@ export default {
     },
     // 添加物品明细
     async addGoods(data) {
+      console.log(data, 'datadatadatadatadatadatadata111')
       this.proData = data;
       // 获取批次号
       const batchNo = await getCode('lot_number_code');
@@ -1836,6 +1826,7 @@ export default {
               index +
               1
               : this.productList.length + index,
+
           categoryId: item.id, // 物品id
           categoryName: item.name, // 物品名称
           categoryCode: item.code, // 物品编码
@@ -2231,11 +2222,12 @@ export default {
     // 生成包装
     generateWrappers(row, productIndex, packingCodeList) {
 
-      if (!row.isUnpack) {
-        // 直接生成物品层数据,不生成包装层
+      // 判断是否拆包,如果是不拆包,计量单位=包装单位,则不生成包装层数据
+      if (!row.isUnpack && row.measureUnit == row.packingUnit) {
+        // 直接生成物品层数据
         this.productList[productIndex].measureQuantity = row.measureQuantity;
         this.productList[productIndex].weight = row.weight;
-        return; // 跳过生成包装明细
+        return;
       }
 
       console.log('包装数据--------', row);
@@ -2377,7 +2369,9 @@ export default {
           }
         }
         console.log(filterArr[0], 'filterArr[0]')
+
         let item = {
+
           index: row.index + '-' + index, // 包装索引
           warehouseId: row.warehouseId, // 仓库id
           warehouseName: row.warehouseName, // 仓库名称
@@ -2545,13 +2539,12 @@ export default {
       this.deletePackingAndMaterial(row);
     },
     // 打开仓库弹框
-    handleWareHouse(row, idx) {
-      console.log(row, `rowrowrowrow打开仓库弹框`)
+    handleWareHouse(row, idx, type) {
+
       if (row.isSave) {
         return false;
       }
 
-
       let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
         .dictValue;
       let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
@@ -2559,7 +2552,7 @@ export default {
       console.log(packingBoolen, 'packingBoolen')
       console.log(measureBoolen, 'measureBoolen')
 
-      if (idx > -1) {
+      if (idx > -1 && type != 'batch') {
         if (row.packingQuantity > 0) {
           console.log(packingBoolen, '111')
           if (!row.isUnpack && row.measureUnit == row.packingUnit) {
@@ -2634,39 +2627,75 @@ export default {
           this.$message.error('请先填写包装数量!');
         }
       } else {
+        //批量
+        console.log(row, `row`)
+        console.log(idx, `idx`)
+        console.log(type, 'type')
         // 批量设置
         let boolen = this.productList.every(
           (item) =>
             item.packingQuantity == this.productList[0].packingQuantity
         );
+        console.log(boolen, 'boolen')
         if (boolen) {
-          if (row.packingQuantity > 0) {
-            if (packingBoolen) {
-              let filterArr = row.packingSpecificationOption.filter(
-                (item) => {
-                  return (
-                    item.packingUnit == row.packingUnit &&
-                    item.packingUnit != item.conversionUnit
-                  );
-                }
-              );
-              let num = Math.ceil(
-                row.packingQuantity / filterArr[0].packageCell
-              );
-              this.$refs.wareHouseDailogRef.open(num, idx);
-            } else {
-              this.$refs.wareHouseDailogRef.open(
-                row.isUnpack
-                  ? measureBoolen
-                    ? row.packingQuantity
-                    : row.measureQuantity
-                  : row.packingQuantity,
-                idx
-              );
-            }
+
+          if (row.some(item => !item.packingQuantity)) {
+            this.$message.error('请先填写所有行的包装数量!');
+            return;
+          }
+          console.log(packingBoolen, 'packingBoolen')
+          if (packingBoolen) {
+            let filterArr = row.packingSpecificationOption.filter(
+              (item) => {
+                return (
+                  item.packingUnit == row.packingUnit &&
+                  item.packingUnit != item.conversionUnit
+                );
+              }
+            );
+            let num = Math.ceil(
+              row.packingQuantity / filterArr[0].packageCell
+            );
+            let mNum = row?.measureQuantity
+            this.$refs.wareHouseDailogRef.open(num, mNum, idx);
           } else {
-            this.$message.error('请先填写包装数量!');
+            //如果此行不拆包,并且测量单位=包装单位 packingQuantity=0
+
+            row.forEach(item => {
+              if (!item.isUnpack && item.measureUnit === item.packingUnit) {
+                item.packingQuantity2 = 0;
+              } else {
+                item.packingQuantity2 = item.packingQuantity;
+              }
+            });
+            console.log(row, 'rowrowrowrowrowrow我看看')
+            const pNum = row.reduce((sum, item) => {
+              if (item.packingQuantity2 !== undefined && item.packingQuantity2 !== null) {
+                return sum + Number(item.packingQuantity2);
+              }
+              return sum;
+            }, 0);
+
+            const mNum = row.reduce((sum, item) => {
+              if (item.measureQuantity !== undefined && item.measureQuantity !== null) {
+                return sum + Number(item.measureQuantity);
+              }
+              return sum;
+            }, 0);
+            console.log(pNum, 'pppp')
+            console.log(mNum, 'mmmmm')
+            // row.isUnpack
+            //     ? measureBoolen
+            //       ? row.packingQuantity
+            //       : row.measureQuantity
+            //     : row.packingQuantity,
+            this.$refs.wareHouseDailogRef.open(
+              pNum,
+              mNum,
+              0
+            );
           }
+
         } else {
           this.$message.error('请保证产品包装数量一致!');
         }

+ 4 - 3
src/views/warehouseManagement/stockManagement/components/selectType.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
-    <el-dialog :title="`${title}信息`" append-to-body :close-on-click-modal="false" :visible="visibleDialog"
-      :before-close="closeWindows" width="80vw">
+    <ele-modal width="80vw" :visible="visibleDialog" :append-to-body="true" :close-on-click-modal="false"
+      custom-class="ele-dialog-form" :title="`${title}信息`" :before-close="closeWindows" :maxable="true">
       <div class="search_box">
         <el-row :gutter="15">
           <el-col :span="6">
@@ -65,7 +65,7 @@
         <el-button type="primary" @click="onConfirm">确定</el-button>
         <el-button @click="closeWindows">关闭</el-button>
       </div>
-    </el-dialog>
+    </ele-modal>
   </div>
 </template>
 
@@ -213,6 +213,7 @@ export default {
       this.$emit('update:visibleDialog', false);
       this.pages.pageNum = 1;
     },
+
     handleCurrentChange(e) {
       this.initData();
     },