|
|
@@ -1,9 +1,13 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="top_fixed">
|
|
|
- <el-button type="primary" size="mini">一键投料(报工)</el-button>
|
|
|
- <el-button type="primary" size="mini">清空缓存</el-button>
|
|
|
- <el-button type="primary" size="mini">缓存</el-button>
|
|
|
+ <el-button type="primary" size="mini" @click="save(2)"
|
|
|
+ >一键投料(报工)</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="mini"
|
|
|
+ >清空缓存</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" size="mini" @click="save(1)">缓存</el-button>
|
|
|
</div>
|
|
|
|
|
|
<div class="feed_box">
|
|
|
@@ -95,6 +99,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { workorderList } from '@/api/produce/workOrder';
|
|
|
+ import { batchSave, feedSaveCache } from '@/api/produce/feeding';
|
|
|
|
|
|
import pickingList from '../picking/pickingList.vue';
|
|
|
|
|
|
@@ -272,6 +277,41 @@
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+
|
|
|
+ async save(type) {
|
|
|
+ this.List.forEach((f) => {
|
|
|
+ f.instanceList.forEach((e) => {
|
|
|
+ if (Object.prototype.hasOwnProperty.call(e, 'type')) {
|
|
|
+ e.extInfo['type'] = e.type;
|
|
|
+ }
|
|
|
+ e.extInfo['isConsumable'] = e.isConsumable;
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ const isCache = await this.checkCache(type);
|
|
|
+
|
|
|
+ if (!isCache) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ batchSave(this.List).then((res) => {
|
|
|
+ this.$message.success('投料成功');
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ checkCache(type) {
|
|
|
+
|
|
|
+ return new Promise((resolve) => {
|
|
|
+ if (type == 1) {
|
|
|
+ feedSaveCache(this.List).then((rr) => {
|
|
|
+ this.$message.success('已经缓存');
|
|
|
+ });
|
|
|
+ resolve(false);
|
|
|
+ } else if (type == 2) {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|