فهرست منبع

新增领料列表

ysy 2 سال پیش
والد
کامیت
b3adb4306f

+ 26 - 0
src/api/produce/workOrder.js

@@ -10,3 +10,29 @@ export async function workorderPage(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+
+// 查询库存台账首页列表
+
+export async function pageeLedgerMain(data) {
+  const res = await request.get('/wms/outin/getRealTimeInventory', {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 父级ID查询分类树
+export async function treeByPid(data) {
+  const res = await request.get('/pda/main/categoryLevel/pdaTreeByPid', {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 118 - 0
src/views/produce/components/assetTree.vue

@@ -0,0 +1,118 @@
+<template>
+  <div class="tree-wrapper">
+    <el-tree
+      :data="treeList"
+      :props="defaultProps"
+      v-loading="treeLoading"
+      :node-key="nodeKey"
+      ref="tree"
+      :highlight-current="true"
+      :expand-on-click-node="false"
+      @node-click="handleNodeClick"
+      :default-expanded-keys="current && current.id ? [current.id] : []"
+    >
+    </el-tree>
+  </div>
+</template>
+
+<script>
+  import { treeByPid } from '@/api/produce/workOrder';
+
+  export default {
+    props: {
+      defaultProps: {
+        type: Object,
+        default: function () {
+          return {
+            children: 'children',
+            value: 'id',
+            label: 'name'
+          };
+        }
+      },
+
+      // 初始请求treeList
+      init: {
+        type: Boolean,
+        default: true
+      },
+
+      treeIds: {
+        type: String,
+        default: ''
+      },
+      nodeKey: {
+        type: String,
+        default: 'id'
+      }
+    },
+    data() {
+      return {
+        treeList: [],
+        treeLoading: false,
+        current: {},
+        currentKey: ''
+      };
+    },
+    mounted() {
+      if (this.init) {
+        this.getTreeData();
+      }
+    },
+    methods: {
+      // 获取树结构数据
+      async getTreeData() {
+        try {
+          this.treeLoading = true;
+
+          const res = await treeByPid({ ids: this.treeIds });
+          this.treeLoading = false;
+          if (res?.code === '0') {
+            this.treeList = res.data;
+            this.$emit('setRootId', res.data[0]);
+
+            this.$nextTick(() => {
+              // 默认高亮第一级树节点
+              if (this.treeList[0]) {
+                this.setCurrentKey(this.treeList[0]);
+                this.current = this.treeList[0];
+              }
+            });
+            return this.treeList;
+          }
+        } catch (error) {
+          console.log(error);
+        }
+        this.treeLoading = false;
+      },
+
+      handleNodeClick(data, node) {
+        this.$emit('handleNodeClick', data, node);
+      },
+      // 设置默认高亮行
+      setCurrentKey(id) {
+        this.currentKey = id;
+        this.$refs.tree.setCurrentKey(this.currentKey);
+      },
+
+      // 获取树的选中状态
+      getSelectList() {
+        const selectList = this.$refs.tree.getCurrentNode();
+        return selectList;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree-wrapper {
+    width: 100%;
+    height: 100%;
+    overflow: auto;
+
+    :deep(.el-tree) {
+      display: inline-block;
+      min-width: 100%;
+    }
+  }
+</style>

+ 7 - 5
src/views/produce/components/footBtn.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="foot_box">
-      <div v-for="(item, index) in btnList" :key="index" class="btn" :style="{'background': item.bjColor}">
+      <div v-for="(item, index) in btnList" :key="index" class="btn" :style="{'background': item.bjColor}" @click="footClick(item.type)">
         <img src="../../../assets/Frame.png" class="Frame">
         {{ item.name }}
       </div>
@@ -14,18 +14,18 @@ export default {
           btnList: [
             {
                 name: '领料',
-                type: '',
+                type: 'pick',
                 bjColor: '#FC1B75'
             },
             {
                 name: '投料',
-                type: '',
+                type: 'feed',
                 bjColor: '#FBD114'
             },
 
             {
                 name: '报工',
-                type: '',
+                type: 'job',
                 bjColor: '#157A2C'
             },
 
@@ -73,7 +73,9 @@ export default {
 
     },
     methods: {
-
+        footClick(type) {
+            this.$emit('footBtn', type);
+        }
     }
 };
 </script>

+ 118 - 0
src/views/produce/components/picking/index.vue

@@ -0,0 +1,118 @@
+<template>
+  <el-dialog
+    title="领料"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+  >
+    <div v-for="(item, index) in workList" :key="index">
+      <div class="table_box">
+        <div class="row">
+          <div class="col">
+            <div class="name">生产工单号</div>
+            <div class="content">{{ item.code }}</div>
+          </div>
+          <div class="col">
+            <div class="name">产品编码</div>
+            <div class="content">{{ item.productCode }}</div>
+          </div>
+          <div class="col">
+            <div class="name">产品名称</div>
+            <div class="content">{{ item.productName }}</div>
+          </div>
+          <div class="col">
+            <div class="name">批号</div>
+            <div class="content">{{ item.batchNo }}</div>
+          </div>
+          <div class="col pd6">
+            <el-button type="primary" size="mini" @click="openPicking(item.workOrderId, item)">领料</el-button>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <pickingList ref="pickingListRef"></pickingList>
+  </el-dialog>
+</template>
+
+<script>
+import pickingList from './pickingList.vue'
+  export default {
+    components: {
+      pickingList
+    },
+    props: {
+      workList: {
+        type: Array,
+        default() {
+          return [];
+        }
+      }
+    },
+    data() {
+      return {
+        visible: true
+      };
+    },
+
+    watch: {},
+    methods: {
+      handleClose() {
+        this.$emit('close', false);
+      },
+
+      openPicking(workOrderId, item) {
+        this.$refs.pickingListRef.open(workOrderId, item);
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .table_box {
+    border: 1px solid #acd4b5;
+
+    &:last-child {
+      border-bottom: none;
+    }
+
+    .row {
+      width: 100%;
+      display: flex;
+    }
+    .col {
+      width: calc(100% / 5);
+      display: flex;
+      align-items: center;
+      min-width: 200px;
+      min-height: 32px;
+      border-bottom: 1px solid #acd4b5;
+      border-right: 1px solid #acd4b5;
+
+      &:last-child {
+        border-right: none;
+      }
+      .name {
+        display: flex;
+        align-items: center;
+        padding: 4px;
+        width: 80px;
+        height: 100%;
+        background-color: #fafafa;
+        color: #909399;
+      }
+
+      .content {
+        padding: 4px 6px;
+        color: #000;
+      }
+    }
+
+    .pd6 {
+      padding: 0 6px;
+    }
+  }
+</style>

+ 240 - 0
src/views/produce/components/picking/pickingList.vue

@@ -0,0 +1,240 @@
+<template>
+  <el-dialog
+    title="领料列表"
+    :visible.sync="visible"
+    v-if="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="75%"
+  >
+    <el-card shadow="never">
+      <pickingListSearch @search="reload" ref="searchRef" />
+
+      <ele-split-layout
+        width="244px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+        <div class="ele-border-lighter split-layout-right-content">
+          <AssetTree
+            ref="assetTreeRef"
+            :treeIds="treeIds"
+            @handleNodeClick="handleNodeClick"
+            @setRootId="setRootId"
+          />
+        </div>
+        <!-- 表格 -->
+        <template v-slot:content>
+          <ele-pro-table
+            ref="table"
+            :columns="columns"
+            :datasource="datasource"
+            row-key="id"
+            height="calc(100vh - 350px)"
+            class="dict-table"
+          >
+          </ele-pro-table>
+        </template>
+      </ele-split-layout>
+    </el-card>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import AssetTree from '../../components/assetTree.vue';
+  import pickingListSearch from './pickingListSearch.vue';
+  import { pageeLedgerMain } from '@/api/produce/workOrder';
+
+  export default {
+    components: { AssetTree, pickingListSearch },
+    props: {},
+    data() {
+      return {
+        visible: false,
+
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'index',
+            type: 'index',
+            width: 45,
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            prop: 'code',
+            label: '编码'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号'
+          },
+
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'measuringUnit',
+            label: '计量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'weightUnit',
+            label: '重量单位',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'roughWeight',
+            label: '毛重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'netWeight',
+            label: '净重',
+            showOverflowTooltip: true,
+            minWidth: 90
+          },
+
+          {
+            prop: 'packingUnit',
+            align: 'center',
+            label: '包装单位',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'categoryLevelPath',
+            label: '分类',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            action: 'action',
+            slot: 'action',
+            align: 'center',
+            label: '选择'
+          }
+        ],
+
+        treeIds: '1, 5, 7, 8, 10, 13, 14, 23, 26, 9, 28',
+        categoryLevelId: null,
+        isCategory: true
+      };
+    },
+
+    watch: {},
+    methods: {
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+        let URL = pageeLedgerMain;
+
+        if (this.isCategory) {
+          return URL({
+            ...where,
+            pageNum: page,
+            size: limit,
+            categoryLevelId: this.categoryLevelId || 9,
+            dimension: 1
+          });
+        } else {
+          return URL({
+            ...where,
+            pageNum: page,
+            categoryLevelId: this.categoryLevelId || 9,
+            size: limit,
+            dimension: 1
+          });
+        }
+      },
+      handleNodeClick(data) {
+        this.isCategory = true;
+        this.categoryLevelId = data.id;
+        this.$refs.table.reload({ pageNum: 1 });
+      },
+      setRootId(data) {
+        this.categoryLevelId = data.id;
+        // this.$refs.table.reload({ pageNum: 1 });
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.isCategory = false;
+        this.$refs.table.reload({ pageNum: 1, where: where });
+      },
+      open(id, item) {
+        if (item) {
+        }
+        this.visible = true;
+      },
+
+      handleClose() {
+        this.visible = false;
+      },
+      selected() {
+        if (!this.current) {
+          return this.$message.warning('请选择工作中心');
+        }
+        this.$emit('changeProduct', this.title, this.current, this.idx);
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    height: 500px;
+    overflow: auto;
+  }
+
+  .table_col {
+    padding-left: 10px;
+
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 90 - 0
src/views/produce/components/picking/pickingListSearch.vue

@@ -0,0 +1,90 @@
+<!-- 搜索表单 -->
+<template>
+    <el-form
+      label-width="77px"
+      class="ele-form-search"
+      @keyup.enter.native="search"
+      @submit.native.prevent
+    >
+      <el-row :gutter="10">
+        <el-col v-bind="styleResponsive ? { md: 6 } : { span: 6 }">
+          <el-form-item label="关键字">
+            <el-input clearable v-model="where.keyWord" placeholder="请输入" />
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { md: 4 } : { md: 4 }">
+          <div class="ele-form-actions">
+            <el-button
+              type="primary"
+              icon="el-icon-search"
+              class="ele-btn-icon"
+              @click="search"
+            >
+              查询
+            </el-button>
+  
+            <el-button
+              @click="reset"
+              icon="el-icon-refresh"
+              class="ele-btn-icon"
+              size="medium"
+              >重置</el-button
+            >
+          </div>
+        </el-col>
+      </el-row>
+    </el-form>
+  </template>
+  
+  <script>
+    export default {
+      data () {
+        // 默认表单数据
+        const defaultWhere = {
+            code: '',
+      
+        };
+        return {
+          defaultWhere,
+          // 表单数据
+          where: { ...defaultWhere },
+  
+        };
+      },
+      computed: {
+        // 是否开启响应式布局
+        styleResponsive () {
+          return this.$store.state.theme.styleResponsive;
+        }
+      },
+      created() {
+      },
+      methods: {
+  
+        /* 搜索 */
+        search () {
+  
+          this.$emit('search', this.where);
+        },
+        /*  重置 */
+        reset () {
+          this.where = { ...this.defaultWhere };
+          this.search();
+        },
+        reset2 () {
+          this.where = { ...this.defaultWhere };
+  
+        }
+      }
+    };
+  </script>
+  
+  <style>
+    .ele-form-actions {
+      display: inline-block;
+      transform: translate(0);
+      transition: all;
+    }
+  </style>
+  

+ 17 - 4
src/views/produce/components/produceOrder.vue

@@ -2,8 +2,10 @@
   <ele-pro-table
     ref="table"
     :columns="columns"
-    height="32vh"
+    height="320px"
     :datasource="datasource"
+    :selection.sync="selection"
+    @selection-change="handleSelectionChange"
     cache-key="produceOrderZ"
     highlight-current-row
     @row-click="rowClick"
@@ -22,21 +24,27 @@
     components: {},
     data() {
       return {
-        loading: false
+        loading: false,
+        selection: []
       };
     },
     computed: {
       // 表格列配置
       columns() {
         return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
           {
             columnKey: 'index',
             label: '序号',
             type: 'index',
             width: 55,
             align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
+            showOverflowTooltip: true
           },
           {
             prop: 'batchNo',
@@ -90,6 +98,8 @@
         ];
       }
     },
+
+    watch: {},
     created() {},
     methods: {
       /* 表格数据源 */
@@ -107,6 +117,9 @@
           this.$refs.table.reload({ page: 1, where });
         });
       },
+      handleSelectionChange(val) {
+        this.$emit('workSelect', val);
+      },
 
       rowClick() {}
     }

+ 51 - 8
src/views/produce/index.vue

@@ -6,16 +6,27 @@
       <div class="main">
         <div class="left_main">
           <div class="top">
-          <produceOrder></produceOrder>
+            <produceOrder @workSelect="workSelect"></produceOrder>
           </div>
           <div class="bottom">
             <productionResource></productionResource>
           </div>
         </div>
-        <div class="right_main"></div>
+        <div class="right_main">
+          {{ operationType }}
+        </div>
       </div>
-      <footBtn></footBtn>
+      <footBtn @footBtn="footBtn"></footBtn>
     </div>
+
+
+       <!--领料弹框 -->
+    <picking
+      v-if="pickingShow"
+      @close="pickingClose"
+      :workList="workList"
+    ></picking>
+ 
   </div>
 </template>
 
@@ -24,19 +35,53 @@
   import footBtn from './components/footBtn.vue';
   import produceOrder from './components/produceOrder.vue';
   import productionResource from './components/productionResource/index.vue';
+
+  import picking from './components/picking/index.vue';
   export default {
     components: {
       Search,
       footBtn,
       produceOrder,
-      productionResource
+      productionResource,
+
+      picking
     },
     data() {
       return {
-        loading: false
+        loading: false,
+        operationType: null,
+        workList: [],
+
+        pickingShow: false
       };
     },
 
+    created() {
+      this.operationType = null;
+      this.workList = [];
+    },
+    methods: {
+      workSelect(data) {
+        this.workList = data;
+      },
+
+      footBtn(t) {
+        this.operationType = t;
+        if (t == 'pick') {
+          if (this.workList.length == 0) {
+            this.$message.warning('请选择工单列表');
+            return false;
+          }
+
+          this.pickingShow = true;
+        }
+      },
+
+      pickingClose() {
+        this.pickingShow = false;
+      }
+    },
+
     mounted() {
       this.$nextTick(() => {
         const targetElements =
@@ -72,7 +117,7 @@
     display: none !important;
   }
 
-  .c_title{
+  .c_title {
     color: #157a2c;
     font-size: 18px;
     font-weight: bold;
@@ -92,7 +137,6 @@
     scrollbar-color: #40a9ff transparent; /* 设置滚动条颜色和轨道颜色(同样,浏览器兼容性) */
   }
 
-
   .main {
     width: 100%;
     min-width: 1280px;
@@ -113,7 +157,6 @@
       width: 100%;
       height: calc((100vh - 70px - 50px - 80px - 20px) / 2);
       overflow: hidden;
-
     }
     .bottom {
       width: 100%;