Sfoglia il codice sorgente

解决入库添加异常以及调拨功能

huang_an 1 anno fa
parent
commit
e91a7b1b6f

+ 14 - 0
src/api/warehouseManagement/warehouseDefinition.js

@@ -150,5 +150,19 @@ export default {
     if (res.data.code == 0) {
       return res.data.data;
     }
+  },
+  // 批次调拨
+  lotAllot: async (data) => {
+    const res = await request.post(`/wms/outin/lotAllot`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+  // 包装调拨
+  packageAllot: async (data) => {
+    const res = await request.post(`/wms/outin/packageAllot`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
   }
 };

+ 1 - 0
src/views/warehouseManagement/components/selectType.vue

@@ -364,6 +364,7 @@
     .flex_right {
       flex: 1;
       margin-left: 10px;
+      overflow: hidden;
     }
   }
   .search_box {

+ 26 - 1
src/views/warehouseManagement/outgoingManagement/index.vue

@@ -125,6 +125,9 @@
         <template v-slot:bizType="{ row }">
           {{ handleBizType(row.bizType) }}
         </template>
+        <template v-slot:assetType="{ row }">
+          {{ handleAssetType(row.extInfo.assetType) }}
+        </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
           <el-link
@@ -169,6 +172,7 @@
 </template>
 
 <script>
+  import { allCategoryLevel } from '@/api/classifyManage';
   import outin from '@/api/warehouseManagement/outin';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
 
@@ -182,6 +186,7 @@
       return {
         auditStatus,
         outputSceneState,
+        codeList: [],
         tableData: [],
         fromUserList: [],
         formData: {
@@ -222,6 +227,14 @@
             showOverflowTooltip: true,
             width: 150
           },
+          {
+            prop: 'assetType',
+            slot: 'assetType',
+            label: '出库物品类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            width: 150
+          },
           // {
           //   prop: 'verifyStatus',
           //   label: '状态',
@@ -235,7 +248,8 @@
             prop: 'sourceBizNo',
             label: '来源单据',
             align: 'center',
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            width: 150
           },
 
           {
@@ -282,8 +296,19 @@
     },
     created() {
       this.getUser();
+      this.getTypeList();
     },
     methods: {
+      handleAssetType(r) {
+        const code = this.codeList.find((item) => item.dictCode == r);
+        return code?.dictValue;
+      },
+      async getTypeList() {
+        const { data } = await allCategoryLevel();
+        this.codeList = data.map((item) => {
+          return { dictCode: item.id, dictValue: item.name };
+        });
+      },
       edit(row) {
         this.$router.push({
           path: '/warehouseManagement/outgoingManagement/edit',

+ 418 - 0
src/views/warehouseManagement/stockLedger/components/allot.vue

@@ -0,0 +1,418 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    title="调拨"
+    @before-close="cancel"
+    width="80%"
+    :close-on-click-modal="false"
+  >
+    <el-table
+      class="table_box"
+      :data="checkList"
+      style="width: 100%"
+      height="300"
+    >
+      <el-table-column prop="code" label="编码"></el-table-column>
+      <el-table-column prop="name" label="名称"></el-table-column>
+      <el-table-column prop="brandNum" label="牌号"></el-table-column>
+      <el-table-column prop="brandNum" label="牌号"></el-table-column>
+      <el-table-column prop="modelType" label="型号"></el-table-column>
+      <el-table-column prop="specification" label="规格"></el-table-column>
+      <el-table-column
+        prop="packingCountBase"
+        label="包装库存数量"
+      ></el-table-column>
+      <el-table-column prop="minUnit" label="包装单位"></el-table-column>
+      <el-table-column
+        prop="minPackingCount"
+        label="最小包装单元"
+      ></el-table-column>
+      <el-table-column
+        prop="availableCountBase"
+        label="计量库存数量"
+      ></el-table-column>
+      <el-table-column prop="measuringUnit" label="计量单位"></el-table-column>
+    </el-table>
+    <el-form :model="formData" label-width="100px">
+      <el-row>
+        <el-col :span="8">
+          <el-form-item label="选择仓库">
+            <el-select
+              :disabled="tableList.length > 0"
+              filterable
+              v-model="warehouse"
+              @change="warehouseChange"
+            >
+              <el-option
+                v-for="(item, index) in warehouseList"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+                @click.native="changeWarehouse(item)"
+              ></el-option>
+            </el-select> </el-form-item
+        ></el-col>
+        <el-col :span="8">
+          <el-form-item label="选择库区">
+            <el-select
+              :disabled="tableList.length > 0"
+              filterable
+              v-model="area"
+              @change="getshelvesList"
+            >
+              <el-option
+                v-for="(item, index) in areaList"
+                :key="index"
+                :label="item.name"
+                :value="item.id"
+                @click.native="formData.area = item"
+              ></el-option>
+            </el-select> </el-form-item
+        ></el-col>
+        <el-col :span="8">
+          <el-form-item label="选择货架">
+            <el-select
+              :disabled="tableList.length > 0"
+              filterable
+              v-model="shelves"
+              @change="changeshelvesList"
+            >
+              <el-option
+                v-for="(item, index) in shelvesList"
+                :key="index"
+                :label="item.goodsshelvesCode"
+                :value="item.goodsshelvesCode"
+                @click.native="formData.shelves = item"
+              ></el-option>
+            </el-select> </el-form-item
+        ></el-col>
+      </el-row>
+    </el-form>
+    <div class="status-legend">
+      <div
+        v-for="(item, index) in warehouseDefinition_locationStatus"
+        :key="index"
+      >
+        <span :style="{ 'background-color': item.color }"></span
+        >{{ item.label }}
+      </div>
+    </div>
+    <div class="content-box">
+      <div
+        v-for="p in locationList"
+        :key="p.id"
+        class="box"
+        @click="handlCur(p)"
+        :class="{ active: cur.goodsAllocationCode == p.goodsAllocationCode }"
+        :style="{
+          'background-color': getStatus(p.allocationStatus).color,
+          cursor: [1, 2].includes(p.allocationStatus)
+            ? 'pointer'
+            : 'not-allowed'
+        }"
+      >
+        {{ p.goodsAllocationCode }}
+      </div>
+      <div class="placeholder-box"></div>
+      <div class="placeholder-box"></div>
+      <div class="placeholder-box"></div>
+      <div class="placeholder-box"></div>
+    </div>
+    <el-table :data="tableList" style="width: 100%">
+      <el-table-column label="序号" type="index"></el-table-column>
+      <el-table-column label="货位位置" prop="position">
+        <template slot-scope="scope">
+          {{ scope.row.warehouseName }} - {{ scope.row.areaName }} -
+          {{ scope.row.shelfCode }} - {{ scope.row.cargoSpaceCode }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="数量" prop="num" width="170">
+        <template slot-scope="scope">
+          <el-input v-model.trim="scope.row.num" size="mini"></el-input>
+        </template>
+      </el-table-column>
+
+      <el-table-column width="120" label="操作" fixed="right">
+        <template slot-scope="scope">
+          <el-button type="text" @click="delItem(scope.$index)" size="small"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+    <template slot="footer">
+      <el-button :loading="btnLoading" @click="handleSelect" type="primary"
+        >确认</el-button
+      >
+      <el-button @click="cancel">关闭</el-button>
+    </template>
+  </el-dialog>
+</template>
+
+<script>
+  // import { getWarehouseChildren } from '@/api/stockManagement/outgoingManagement'
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+
+  import { warehouseDefinition_locationStatus } from '@/utils/dict/warehouseDefinition';
+  import { useDict } from '@/utils/dict/index';
+  export default {
+    data() {
+      return {
+        checkList: [],
+        btnLoading: false,
+        warehouseId: '',
+        warehouseDefinition_locationStatus: [
+          { code: 1, label: '空置', color: 'rgba(202, 249, 130, 1)' },
+          { code: 2, label: '在用', color: 'rgba(129, 211, 248, 1)' },
+          { code: 3, label: '已满', color: 'rgba(255, 14, 14, 1)' },
+          { code: 4, label: '失效', color: 'rgba(215, 215, 215, 1)' }
+        ],
+        visible: false,
+        warehouseList: [], //仓库
+        areaList: [], //库区
+        areaGoodsshelvesList: [], //货架
+        allocationReqList: [], //货位
+        value: '',
+        row: {},
+        formData: {
+          warehouse: {},
+          area: {},
+          shelves: {}
+        },
+        warehouse: '',
+        area: '',
+        shelves: '',
+        cur: {
+          cargoSpaceId: ''
+        },
+        shelvesList: [],
+        locationList: [],
+        tableList: [],
+        idx: null
+      };
+    },
+    props: ['dimension'],
+    methods: {
+      delItem(index) {
+        // if (index == 0 && this.tableList.length == 1) {
+        //   return this.$message.warning('请至少保存一条数据!');
+        // }
+        this.tableList.splice(index, 1);
+      },
+      handlCur(row, num) {
+        if (![1, 2].includes(row.allocationStatus)) {
+          return;
+        }
+        this.cur = { ...row };
+        console.log('==this.formData', this.formData);
+        // let shelfId=
+        const { area, shelves, warehouse } = this.formData;
+        let warehouseId = warehouse.id;
+        let warehouseName = warehouse.name;
+
+        let areaId = area.id;
+        let areaName = area.name;
+        // ==========li
+        let shelfId = shelves.id;
+        let shelfCode = shelves.goodsshelvesCode;
+        // ==========li
+        let cargoSpaceId = this.cur.id;
+        let cargoSpaceCode = this.cur.goodsAllocationCode;
+
+        let flag = true;
+        this.tableList.forEach((f) => {
+          if (f.cargoSpaceId == cargoSpaceId && f.shelfId == shelfId) {
+            this.$message.info('请勿重复选择');
+            flag = false;
+          }
+        });
+        if (flag) {
+          this.tableList.push({
+            warehouseId: warehouseId,
+            warehouseName,
+            areaId,
+            areaName,
+            shelfId,
+            shelfCode,
+            cargoSpaceId,
+            cargoSpaceCode,
+            // num: num ? num : this.row.outInNum,
+            num: num
+          });
+        }
+      },
+      warehouseChange() {
+        this.cur = {};
+        this.shelves = '';
+        this.locationList = [];
+        this.area = '';
+      },
+      async getshelvesList(e) {
+        this.cur = {};
+        this.shelves = '';
+        this.locationList = [];
+        this.shelvesList = this.areaGoodsshelvesList.filter(
+          (i) => i.reservoirAreaCode === this.area
+        );
+        const rep = await warehouseDefinition.getListByAreaId(e);
+        this.shelvesList = rep;
+      },
+      async changeshelvesList(id) {
+        this.cur = {};
+        // this.locationList = this.allocationReqList.filter(
+        //   (i) => i.goodsAllocationCode === this.shelves
+        // );
+        const goodsId = this.shelvesList.filter((item) => {
+          return item.goodsshelvesCode == id;
+        })[0].id;
+        const res = await warehouseDefinition.getListByGoodId(goodsId);
+        this.locationList = res;
+      },
+      getStatus: useDict(warehouseDefinition_locationStatus),
+      async open(checkList) {
+        this.checkList = checkList;
+        this.locationList = [];
+        this.tableList = [];
+        this.visible = true;
+        await this._getWarehouseChildren();
+        this.formData = {
+          warehouse: {},
+          area: {},
+          shelves: {}
+        };
+        this.warehouse = '';
+        this.area = '';
+        this.shelves = '';
+      },
+      async changeWarehouse(val) {
+        this.formData.warehouse = val;
+        const res = await warehouseDefinition.getListByWarehouseId(val.id);
+        this.area = '';
+        this.shelves = '';
+        this.areaList = res || [];
+        this.areaGoodsshelvesList = res.goodsShelvesList || [];
+        this.allocationReqList = res.goodsAllocationList || [];
+        this.warehouseId = val.id;
+      },
+      async handleSelect() {
+        // if (![1, 2].includes(this.cur.warehouseStatVO.type)) {
+        //   return;
+        // }
+        // const { warehouse, area, shelves } = this.formData;
+        // this.row.warehouseId = warehouse.id;
+        // this.row.warehouseName = warehouse.name;
+        // this.row.areaId = area.id;
+        // this.row.areaName = area.name;
+        // this.row.areaCode = area.code;
+        // this.row.shelfId = shelves.id;
+        // this.row.shelfCode = shelves.code;
+        // this.row.cargoSpaceId = this.cur.id;
+        // this.row.cargoSpaceCode = this.cur.code;
+        if (this.tableList.length <= 0) {
+          return this.$message.warning('请至少添加一条数据!');
+        }
+        this.btnLoading = true;
+        try {
+          if (this.dimension == 2) {
+            // 批次
+            await warehouseDefinition.lotAllot({
+              outInDetailId: this.checkList.map((item) => item.outInDetailId),
+              pathIds: `${this.tableList[0].warehouseId},${this.tableList[0].areaId},${this.tableList[0].shelfId},${this.tableList[0].cargoSpaceId}`,
+              pathName: `${this.tableList[0].warehouseName},${this.tableList[0].areaName},${this.tableList[0].shelfCode},${this.tableList[0].cargoSpaceCode}`
+            });
+          } else if (this.dimension == 3) {
+            // 包装
+            await warehouseDefinition.packageAllot({
+              outInDetailId: this.checkList.map((item) => item.id),
+              pathIds: `${this.tableList[0].warehouseId},${this.tableList[0].areaId},${this.tableList[0].shelfId},${this.tableList[0].cargoSpaceId}`,
+              pathName: `${this.tableList[0].warehouseName},${this.tableList[0].areaName},${this.tableList[0].shelfCode},${this.tableList[0].cargoSpaceCode}`
+            });
+          }
+          this.$message.success('调拨成功');
+          this.cancel();
+          this.btnLoading = false;
+        } catch (error) {
+          this.$message.error('调拨失败');
+          this.btnLoading = false;
+        }
+        // warehouseDefinition
+        //   .lotAllot({
+        //     outInDetailId: this.checkList.map((item) => item.outInDetailId),
+        //     pathIds: `${this.tableList[0].warehouseId},${this.tableList[0].areaId},${this.tableList[0].shelfId},${this.tableList[0].cargoSpaceId}`,
+        //     pathName: `${this.tableList[0].warehouseName},${this.tableList[0].areaName},${this.tableList[0].shelfCode},${this.tableList[0].cargoSpaceCode}`
+        //   })
+        //   .then((data) => {
+        //     console.log(data);
+        //     this.$message.success('调拨成功');
+        //     this.cancel();
+        //     this.btnLoading = false;
+        //   })
+        //   .catch((err) => {
+        //     this.btnLoading = false;
+        //   });
+        // console.log(this.tableList);
+        // this.$emit('houseData', this.tableList, this.idx);
+      },
+      async _getWarehouseChildren() {
+        const res = await warehouseDefinition.list({});
+        this.warehouseList = res.map((item) => {
+          return { ...item, name: item.factoryName + '-' + item.name };
+        });
+      },
+      cancel() {
+        this.row = {};
+        this.formData = {};
+        this.warehouse = '';
+        this.area = '';
+        this.shelves = '';
+        this.visible = false;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .table_box {
+    margin-bottom: 20px;
+  }
+  .status-legend {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin: 12px 0;
+    div {
+      margin: 0 12px;
+    }
+    span {
+      display: inline-block;
+      width: 13px;
+      height: 13px;
+      margin: 0 4px;
+    }
+  }
+
+  .content-box {
+    display: flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+    max-height: 40vh;
+    overflow: auto;
+    .box {
+      cursor: pointer;
+      width: 134px;
+      height: 64px;
+      background-clip: content-box;
+      margin-bottom: 4px;
+      line-height: 64px;
+      text-align: center;
+      &:hover,
+      &.active {
+        box-shadow: 2px 2px 2px 2px #ccc;
+      }
+    }
+    .placeholder-box {
+      width: 134px;
+    }
+  }
+</style>

+ 27 - 5
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -19,11 +19,9 @@
       @select-all="changeSelectAll"
     >
       <!-- 表头工具栏 -->
-      <template
-        v-if="selectedDime == 3 || selectedDime == 4"
-        v-slot:toolbar="{ row }"
-      >
+      <template v-slot:toolbar="{ row }">
         <el-button
+          v-if="selectedDime == 3 || selectedDime == 4"
           size="small"
           :disabled="checkRadioData.length == 0"
           icon="el-icon-set-up"
@@ -32,6 +30,16 @@
         >
           打印条码
         </el-button>
+        <el-button
+          v-if="selectedDime == 2 || selectedDime == 3"
+          size="small"
+          :disabled="checkRadioData.length == 0"
+          icon="el-icon-set-up"
+          class="ele-btn-icon"
+          @click="showAllot()"
+        >
+          调拨
+        </el-button>
       </template>
       <!-- 批次号 -->
       <template v-slot:batchNo="{ row }">
@@ -134,10 +142,12 @@
     <print ref="printRef" :dimension="selectedDime"></print>
     <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
     <printTg ref="printTgRef" :dimension="selectedDime"></printTg>
+    <allot ref="allotRef" :dimension="selectedDime"></allot>
   </div>
 </template>
 
 <script>
+  import allot from './allot.vue';
   import print from './print.vue';
   import printSr from './printSr.vue';
   import printTg from './printTg.vue';
@@ -157,7 +167,7 @@
   import { getBatchDetails } from '@/api/classifyManage/index';
 
   export default {
-    components: { ItemSearch, print, printSr, printTg },
+    components: { ItemSearch, print, printSr, printTg, allot },
     props: {
       // 机构id
       organizationId: [Number, String],
@@ -295,6 +305,12 @@
           // 批次维度
           case '2':
             arr = [
+              {
+                width: 45,
+                type: 'selection',
+                columnKey: 'selection',
+                align: 'center'
+              },
               {
                 columnKey: 'index',
                 type: 'index',
@@ -747,10 +763,16 @@
         }
       },
       clientEnvironmentId() {
+        console.log('--------------------------');
+        debugger;
         return this.$store.state.user.info.clientEnvironmentId;
       }
     },
     methods: {
+      // 调拨
+      showAllot() {
+        this.$refs.allotRef.open(this.checkRadioData);
+      },
       // 全选
       changeSelectAll(arr) {
         console.log(arr);

+ 26 - 1
src/views/warehouseManagement/stockManagement/index.vue

@@ -166,6 +166,9 @@
         <template v-slot:bizType="{ row }">
           {{ handleBizType(row.bizType) }}
         </template>
+        <template v-slot:assetType="{ row }">
+          {{ handleAssetType(row.extInfo.assetType) }}
+        </template>
       </ele-pro-table>
     </el-card>
   </div>
@@ -173,7 +176,7 @@
 
 <script>
   import outin from '@/api/warehouseManagement/outin';
-
+  import { allCategoryLevel } from '@/api/classifyManage';
   import {
     warehousingType,
     sceneState,
@@ -189,6 +192,7 @@
         auditStatus,
         warehousingType,
         sceneState,
+        codeList: [],
         tableData: [],
         formData: {
           bizNum: '',
@@ -228,6 +232,14 @@
             showOverflowTooltip: true,
             width: 150
           },
+          {
+            prop: 'assetType',
+            slot: 'assetType',
+            label: '入库物品类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            width: 150
+          },
           {
             prop: 'sourceBizNo',
             label: '来源单据',
@@ -279,7 +291,20 @@
         return this.$store.state.user.info.clientEnvironmentId;
       }
     },
+    mounted() {
+      this.getTypeList();
+    },
     methods: {
+      handleAssetType(r) {
+        const code = this.codeList.find((item) => item.dictCode == r);
+        return code?.dictValue;
+      },
+      async getTypeList() {
+        const { data } = await allCategoryLevel();
+        this.codeList = data.map((item) => {
+          return { dictCode: item.id, dictValue: item.name };
+        });
+      },
       submit(row) {
         this.$confirm('此操作将提交流程, 是否继续?', '提示', {
           confirmButtonText: '确定',