Sfoglia il codice sorgente

入库申请 修改

yijing 1 anno fa
parent
commit
2225a9c186

+ 34 - 16
src/views/warehouseManagement/components/WarehousingDialog.vue

@@ -2,13 +2,15 @@
   <el-dialog :visible.sync="visible" title="仓库" @before-close="cancel" width="50%" :close-on-click-modal="false">
     <el-form :model="formData" label-width="100px">
       <el-row>
-        <el-col :span="9">
+        <el-col :span="8">
           <el-form-item label="选择仓库">
             <el-select filterable v-model="warehouseId" @change="changeWarehouse">
               <el-option v-for="(item, index) in warehouseList" :key="index" :label="item.name"
                 :value="item.id"></el-option>
-            </el-select> </el-form-item></el-col>
-        <el-col :span="6">
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="4">
           <el-button type="primary" @click="addTableData">添加</el-button>
         </el-col>
         <el-col :span="6">
@@ -17,15 +19,26 @@
               {{ this.packingQuantity }}
             </span></el-form-item>
         </el-col>
+        <el-col :span="6">
+          <el-form-item label="计量数量">
+            <span class="red_color">
+              {{ this.measureQuantity }}
+            </span></el-form-item>
+        </el-col>
       </el-row>
     </el-form>
 
     <el-table :data="tableDate" style="width: 100%">
       <el-table-column label="序号" type="index"></el-table-column>
       <el-table-column label="仓库名称" prop="warehouseName"></el-table-column>
-      <el-table-column label="包装数量" prop="packingQuantity" width="300">
+      <el-table-column label="包装数量" prop="packingQuantity" >
         <template slot-scope="{ row, $index }">
-          <el-input-number v-model="row.packingQuantity" :min="1"></el-input-number>
+          <el-input-number v-model="row.packingQuantity" :min="0" size="mini" disabled></el-input-number>
+        </template>
+      </el-table-column>
+      <el-table-column label="计量数量" prop="measureQuantity" >
+        <template slot-scope="{ row, $index }">
+          <el-input-number v-model="row.measureQuantity" :min="0" size="mini" disabled></el-input-number>
         </template>
       </el-table-column>
       <el-table-column width="120" label="操作" fixed="right">
@@ -46,13 +59,14 @@ import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 export default {
   data() {
     return {
-      packingQuantity: 1,
+      packingQuantity: 0,
       tableDate: [],
       visible: false,
       warehouseList: [], //仓库
       formData: {},
       warehouseId: '',
-      currentIndex: 0
+      currentIndex: 0,
+      measureQuantity: 0
     };
   },
   methods: {
@@ -79,28 +93,30 @@ export default {
       }
     },
     addTableData() {
-      if (this.tableDate.length < this.packingQuantity) {
+      // if (this.tableDate.length < this.packingQuantity) {
         let list = this.tableDate.filter(
           (item) => item.warehouseId == this.warehouseId
         );
         if (list.length > 0) {
           return this.$message.warning('该仓库已存在!');
         }
+
         this.tableDate.push({
+          measureQuantity: this.measureQuantity,
           packingQuantity: this.packingQuantity,
           warehouseName: this.warehouseList.filter(
             (item) => item.id == this.warehouseId
           )[0].name,
           warehouseId: this.warehouseId
         });
-      } else {
-        this.$message.warning('请维护包装规格后再添加仓库!');
-      }
+      // } else {
+      //   this.$message.warning('请维护包装规格后再添加仓库!');
+      // }
     },
     delItem(index) {
-      if (index == 0 && this.tableDate.length == 1) {
-        return this.$message.warning('请至少保存一条数据!');
-      }
+      // if (index == 0 && this.tableDate.length == 1) {
+      //   return this.$message.warning('请至少保存一条数据!');
+      // }
       this.tableDate.splice(index, 1);
     },
     async getWarehouseList(categoryType) {
@@ -110,19 +126,21 @@ export default {
         return { ...item, name: item.factoryName + '-' + item.name };
       });
     },
-    open(packingQuantity, idx, warehouseId, warehouseName, categoryType) {
-      console.log('仓库id', packingQuantity, warehouseId, warehouseName);
+    open(packingQuantity, measureQuantity,idx, warehouseId, warehouseName, categoryType) {
+      console.log('仓库id', packingQuantity, measureQuantity, warehouseId, warehouseName);
 
       this.warehouseId = '';
       this.tableDate = [];
       this.currentIndex = idx;
       this.packingQuantity = packingQuantity;
+      this.measureQuantity = measureQuantity;
       this.visible = true;
       this.getWarehouseList(categoryType);
       if (warehouseId && warehouseName) {
         this.warehouseId = warehouseId;
         this.tableDate.push({
           packingQuantity: packingQuantity,
+          measureQuantity: measureQuantity,
           warehouseName: warehouseName,
           warehouseId: warehouseId
         });

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

@@ -170,21 +170,18 @@
                 :show-overflow-tooltip="true"></el-table-column>
               <el-table-column label="计量单位" align="center" prop="measureUnit"
                 :show-overflow-tooltip="true"></el-table-column>
-              <el-table-column label="单重" align="center" prop="singleWeight" :show-overflow-tooltip="true" width="120">
+              <el-table-column label="单重" align="center" prop="singleWeight" :show-overflow-tooltip="true" width="180">
                 <template slot-scope="{ row, $index }">
-                  <el-input-number :disabled="row.isSave" v-model="row.singleWeight" placeholder="请输入" :precision="2"
-                    :min="0" controls-position="right" :controls="false" style="width: 100%"></el-input-number>
-                  <template slot="append">
-                    {{ row.measureUnit }}
-                  </template>
+                  <el-input :disabled="row.isSave" v-model="row.singleWeight" placeholder="请输入" :min="0"
+                    style="width: 100%">
+                    <template slot="append"> {{ row.weightUnit + '/' + row.measureUnit }} </template>
+                  </el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="总重" align="center" prop="weight" width="120" :show-overflow-tooltip="true">
+              <el-table-column label="总重" align="center" prop="weight" width="150" :show-overflow-tooltip="true">
                 <template slot-scope="{ row, $index }">
-                  <el-input :disabled="row.isSave" v-model="row.weight" placeholder="请输入"></el-input>
-                  <template slot="append">
-                    {{ row.measureUnit }}
-                  </template>
+                  <el-input :disabled="row.isSave" v-model="row.weight" placeholder="请输入">
+                  </el-input>
                 </template>
               </el-table-column>
               <el-table-column label="重量单位" align="center" prop="weightUnit" :show-overflow-tooltip="true">
@@ -784,6 +781,7 @@ export default {
     // },
     // 计算最小单元数量
     async computeNum(row, index, isClear) {
+      console.log('row, index', row, index);
       // 清空仓库(包装数量输入)
       if (isClear) {
         if (row.packingQuantity < 0) {
@@ -794,6 +792,7 @@ export default {
       }
       //如果有包装数量和包装单位
       if (row.packingQuantity && row.packingUnit) {
+
         //获取仓库
         const res = await warehouseDefinition.list({
           inventoryType: row?.categoryLevelPathIdParent
@@ -807,6 +806,7 @@ export default {
 
           let table1 = [];
           table1.push({
+            measureQuantity: row.measureQuantity,
             packingQuantity: row.packingQuantity,
             warehouseName: name,
             warehouseId: res[0].id
@@ -852,11 +852,13 @@ export default {
         //   }
         // }
         let total = Number(row.packingQuantity);
-
+        console.log(total, '111')
         if (row.packingUnit == row.measureUnit && row.measureUnit == '立方' && row.netWeight) {
           total = Number(row.packingQuantity) * row.netWeight;
           console.log(total, '单位是立方,计量单位也是立方,如果有单重,就计量数量x单重=总重')
+          console.log(total, '2222')
         } else {
+          console.log(total, 333)
           for (; startIndex < endIndex; endIndex--) {
             total = this.$math.format(
               row.packingSpecificationOption[endIndex].packageCell * total,
@@ -864,7 +866,7 @@ export default {
             );
           }
         }
-
+        console.log(total, '444456')
         // 除了计量单位是KG以外计算总重  总重量 = 单重singleWeight * 数量measureQuantity(计量数量);
         // if (row.measuringUnit != 'KG') {
         //   row.weight = Number(row.singleWeight) * Number(row.measureQuantity);
@@ -877,10 +879,15 @@ export default {
           .dictValue;
         let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
           .dictValue;
-        if (packingBoolen || measureBoolen) {
+        console.log(packingBoolen, 'packingBoolen')
+        console.log(measureBoolen, 'measureBoolen')
+
+        if (packingBoolen && measureBoolen && row.packingUnit != 'L') {
           row.weight = total;
+          console.log(total, '6')
         } else {
           row.weight = this.$math.format(total * row.netWeight, 14);
+          console.log(total, '7')
         }
       }
     },
@@ -2196,7 +2203,10 @@ export default {
               num: packingBoolen ? packingNum : measureBoolen ? measureNum : num,
             }
           ]);
+
           this.generateWrappers(row, index, data);
+
+
           this.$set(this.productList[index], 'isSave', true);
           this.$set(this.productList[index], 'warehouseId', row.warehouseId);
           this.$set(
@@ -2220,8 +2230,15 @@ export default {
     },
     // 生成包装
     generateWrappers(row, productIndex, packingCodeList) {
-      console.log('包装数据--------', row);
 
+      if (!row.isUnpack) {
+        // 直接生成物品层数据,不生成包装层
+        this.productList[productIndex].measureQuantity = row.measureQuantity;
+        this.productList[productIndex].weight = row.weight;
+        return; // 跳过生成包装明细
+      }
+
+      console.log('包装数据--------', row);
       // console.log('包装规格----', row.packingSpecificationOption);
       console.log('计量单位----', row.measureUnit);
       let packingList = [];
@@ -2242,6 +2259,7 @@ export default {
         .dictValue;
       let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
         .dictValue;
+
       let num = row.packingQuantity;
       let filterArr = [];
       // 处理单位为KG类的情况
@@ -2532,6 +2550,8 @@ export default {
       if (row.isSave) {
         return false;
       }
+
+
       let packingBoolen = !!this.getDict('不拆物料层规格', row.packingUnit)
         .dictValue;
       let measureBoolen = !!this.getDict('不拆物料层规格', row.measureUnit)
@@ -2542,19 +2562,21 @@ export default {
       if (idx > -1) {
         if (row.packingQuantity > 0) {
           console.log(packingBoolen, '111')
+          if (!row.isUnpack && row.measureUnit == row.packingUnit) {
+            let pNum = 0;
+            let mNum = row.measureQuantity
+            this.$refs.wareHouseDailogRef.open(
+              pNum,
+              mNum,
+              idx,
+              row.warehouseId,
+              row.warehouseName + '',
+              row.categoryLevelPathIdParent
+            );
+          } else {
+            if (packingBoolen) {
+              console.log(packingBoolen, 'packingBoolen', row.packageUnit, row.isUnpack);
 
-          if (packingBoolen) {
-            console.log(packingBoolen, 'packingBoolen', row.packageUnit, row.isUnpack);
-            if (!row.isUnpack && row.packingUnit == '立方') {
-              let num = 1
-              this.$refs.wareHouseDailogRef.open(
-                num,
-                idx,
-                row.warehouseId,
-                row.warehouseName + '',
-                row.categoryLevelPathIdParent
-              );
-            } else {
               let filterArr = row.packingSpecificationOption.filter((item) => {
                 return (
                   item.packageUnit == row.packingUnit &&
@@ -2567,44 +2589,45 @@ export default {
               );
               this.$refs.wareHouseDailogRef.open(
                 num,
+                row.measureQuantity,
                 idx,
                 row.warehouseId,
                 row.warehouseName + '',
                 row.categoryLevelPathIdParent
               );
-            }
+            } else {
+              console.log(measureBoolen, 'measureBoolen');
+              let num = row.packingQuantity;
+              if (measureBoolen) {
+                let splitIndex = row.packingSpecificationOption.findIndex(
+                  (item) =>
+                    item.conversionUnit == row.packingUnit &&
+                    item.packageUnit != item.conversionUnit
+                );
+                for (; splitIndex > 1; splitIndex--) {
+                  num = this.$math.format(
+                    num *
+                    row.packingSpecificationOption[splitIndex].packageCell,
+                    14
+                  );
+                }
+                this.$refs.wareHouseDailogRef.open(
+                  num,
+                  row.measureQuantity,
+                  idx,
+                  row.warehouseId,
+                  row.warehouseName + '',
+                  row.categoryLevelPathIdParent
+                );
+              } else {
+                console.log(packingBoolen, measureBoolen, '33333');
 
-          } else {
-            console.log(measureBoolen, 'measureBoolen');
-            let num = row.packingQuantity;
-            if (measureBoolen) {
-              let splitIndex = row.packingSpecificationOption.findIndex(
-                (item) =>
-                  item.conversionUnit == row.packingUnit &&
-                  item.packageUnit != item.conversionUnit
-              );
-              for (; splitIndex > 1; splitIndex--) {
-                num = this.$math.format(
-                  num *
-                  row.packingSpecificationOption[splitIndex].packageCell,
-                  14
+                let num = Math.ceil(
+                  row.measureQuantity / row.packingSpecificationOption[1]?.packageCell
                 );
+                this.$refs.wareHouseDailogRef.open(num ? num : 0, row.measureQuantity, idx, row.warehouseId, row.warehouseName + '',
+                  row.categoryLevelPathIdParent);
               }
-              this.$refs.wareHouseDailogRef.open(
-                num,
-                idx,
-                row.warehouseId,
-                row.warehouseName + '',
-                row.categoryLevelPathIdParent
-              );
-            } else {
-              console.log(packingBoolen, measureBoolen, '33333');
-
-              let num = Math.ceil(
-                row.measureQuantity / row.packingSpecificationOption[1]?.packageCell
-              );
-              this.$refs.wareHouseDailogRef.open(num ? num : 0, idx, row.warehouseId, row.warehouseName + '',
-                row.categoryLevelPathIdParent);
             }
           }
         } else {
@@ -2654,12 +2677,15 @@ export default {
       let warehouseIds = [];
       let warehouseNames = [];
       argum.forEach((item) => {
+        console.log(item, 'itemitem')
         for (let index = 0; index < item.packingQuantity; index++) {
           warehouseIds.push(item.warehouseId);
           warehouseNames.push(item.warehouseName);
         }
       });
       console.log(argum, 'argumargumargumargumargumargum');
+      console.log(idx, 'idxidxidxidx')
+      console.log(this.productList, 'productList')
       if (idx > -1) {
         this.$set(
           this.productList[idx],

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

@@ -38,8 +38,7 @@
             <el-table-column prop="brandNum" label="牌号" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column prop="modelType" label="型号" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column prop="specification" label="规格" :show-overflow-tooltip="true"></el-table-column>
-            <el-table-column v-for="(item, index) in newColumns" :label="item.label" :align="item.align"
-              :prop="item.prop" :show-overflow-tooltip="item.showOverflowTooltip"></el-table-column>
+
             <el-table-column prop="measuringUnit" label="计量单位" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column prop="weightUnit" label="重量单位" :show-overflow-tooltip="true"></el-table-column>
             <el-table-column prop="roughWeight" label="毛重" :show-overflow-tooltip="true"></el-table-column>
@@ -51,6 +50,8 @@
                 {{ row.isUnpack ? '是' : '否' }}
               </template>
             </el-table-column>
+            <el-table-column v-for="(item, index) in newColumns" :label="item.label" :align="item.align"
+              :prop="item.prop" :show-overflow-tooltip="item.showOverflowTooltip"></el-table-column>
           </el-table>
           <div class="right mt10">
             <el-pagination background layout="total, sizes, prev, pager, next, jumper" :total="total"