ysy 1 rok temu
rodzic
commit
dc6ab2ea99

+ 14 - 0
src/api/produce/picking.js

@@ -0,0 +1,14 @@
+import request from '@/utils/request';
+
+
+
+// 领料保存
+export async function batchSave(data) {
+    const res = await request.post(`/pda/mes/pickorder/batchSave`, data);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+    return Promise.reject(new Error(res.data.message));
+  }
+  
+ 

+ 29 - 0
src/views/produce/components/common.js

@@ -0,0 +1,29 @@
+export const typeName = {
+  1: "物料",
+  2: "在制品",
+  3: "零部件",
+  4: "生产设备",
+  5: "模具",
+  6: "备品备件",
+  7: "周转车",
+  8: "舟皿",
+  9: "产品",
+  10: "消耗材料",
+  11: "干燥区",
+  12: "质检",
+  13: "包装材料",
+  14: "生产辅助设备",
+  15: "仪表计量设备",
+  16: "办公设备",
+  17: "客户",
+  18: "房屋、建筑物",
+  19: "供应商",
+  20: "工装夹具",
+  21: "半成品",
+  22: "会计科目",
+  23: "费用类型",
+  24: "周转盘",
+  25: "文档",
+  26: "废品",
+  99: "其他"
+}

+ 42 - 3
src/views/produce/components/picking/index.vue

@@ -24,7 +24,7 @@
           </el-col>
 
           <el-col :span="6">
-            <el-form-item label="领料单" prop="pickName" label-width="90px">
+            <el-form-item label="领料单名称" prop="pickName" label-width="90px">
               <el-input v-model="item.pickName"></el-input>
             </el-form-item>
           </el-col>
@@ -69,7 +69,13 @@
             style="width: 100%"
             stripe
           >
-            <el-table-column label="序号" type="index" width="50">
+            <el-table-column label="序号" type="index" width="120">
+              <template slot-scope="{ row, $index }">
+                {{ $index }}
+                <el-tag type="warning">{{
+                  typeName[Number(row.rootCategoryLevelId)]
+                }}</el-tag>
+              </template>
             </el-table-column>
 
             <el-table-column label="编码" prop="assetCode">
@@ -87,13 +93,27 @@
             <el-table-column label="数量" prop="demandQuantity">
               <template slot-scope="{ row, $index }">
                 <el-form-item>
-                  <el-input v-model="row.demandQuantity" size="mini">
+                  <el-input
+                    v-model="row.demandQuantity"
+                    @input="
+                      row.demandQuantity > row.availableCountBase
+                        ? (row.demandQuantity = row.availableCountBase)
+                        : row.demandQuantity
+                    "
+                    size="mini"
+                  >
                     <template slot="append">{{ row.unit }}</template>
                   </el-input>
                 </el-form-item>
               </template>
             </el-table-column>
 
+            <el-table-column label="计量库存数量" prop="availableCountBase">
+              <template slot-scope="{ row, $index }">
+                {{ row.availableCountBase }} {{ row.measuringUnit }}
+              </template>
+            </el-table-column>
+
             <el-table-column label="领料仓库" prop="warehouseId">
               <template slot-scope="{ row, $index }">
                 <div v-if="row.warehouseList">
@@ -134,6 +154,8 @@
 <script>
   import pickingList from './pickingList.vue';
   import { workorderList, getCode } from '@/api/produce/workOrder';
+  import { typeName } from '../common.js';
+  import { batchSave } from '@/api/produce/picking';
 
   export default {
     components: {
@@ -153,6 +175,8 @@
         workList: [],
         rules: {},
 
+        typeName,
+
         tableRules: {}
       };
     },
@@ -244,6 +268,21 @@
             return false;
           }
         }
+
+        let _arr = [];
+        _arr = this.workList.map((m) => {
+          m.instanceList = m.pickList;
+          m.workOrderId = m.id;
+          delete m.id;
+          delete m.pickList;
+          return {
+            ...m
+          };
+        });
+
+        batchSave(_arr).then((res) => {
+          console.log(res);
+        });
       }
     },
 

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

@@ -461,6 +461,9 @@
           this.$message.warning('请选择物料');
           return false;
         }
+        this.allSelection = this.allSelection.sort(
+          (a, b) => a.rootCategoryLevelId - b.rootCategoryLevelId
+        );
         this.$emit('allSelection', this.id, this.allSelection);
         this.handleClose();
       }