fix(自动拆包机上料):AGV任务指令修改

This commit is contained in:
liaohechuan 2025-05-13 09:34:42 +08:00
parent 6eaa84d27e
commit ab642017c4
5 changed files with 587 additions and 7 deletions

View File

@ -12,13 +12,14 @@ export function getByLot(lotNo, resource) {
})
}
export function listNewTask(resource, subResource) {
export function listNewTask(resource, subResource, taskStatus) {
return request({
url: iep('/z-task-detail/list-new-task'),
method: 'get',
params: {
resource: resource,
subResource: subResource
subResource: subResource,
taskStatus: taskStatus
}
})
}

View File

@ -217,8 +217,9 @@ export default {
let me = this;
let resource = me.mainForm.resource;
let subResource = me.mainForm.subResource;
let taskStatus = me.mainForm.taskStatus;
showLoading();
listNewTask(resource, subResource).then(response => {
listNewTask(resource, subResource, taskStatus).then(response => {
hideLoading();
me.taskList = response.data.data;
})

View File

@ -33,6 +33,11 @@
:form="agvTaskCommandForm"
@doConfirm="agvTaskCommandConfirm"
></agvTaskCommand>
<agvTaskCommandMaterial
:close-visible.sync="agvTaskCommandMaterialDialogVisible"
:form="agvTaskCommandMaterialForm"
@doConfirm="agvTaskCommandMaterialConfirm"
></agvTaskCommandMaterial>
<basic-container>
<el-form ref="formObj" :model="formObj" :rules="rules" label-width="auto">
<el-row>
@ -122,14 +127,15 @@
style="width: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; margin-top: 5px;">
<el-button type="primary" @click="upItem()">上料</el-button>
<el-button type="primary" @click="downItem()">下料</el-button>
<el-button type="primary" @click="doAgvTaskCommand()">AGV任务指令</el-button>
<!-- <el-button type="primary" @click="doAgvTaskCommand()">AGV任务指令</el-button>-->
<el-button type="primary" @click="doAgvTaskCommandMaterial()">AGV任务指令</el-button>
</div>
</basic-container>
</div>
</template>
<script>
import {isBlank, trimString} from '@/util/string'
import {isBlank} from '@/util/string'
import {showLoading, hideLoading} from '@/const/loading'
import {mapGetters} from 'vuex'
import {listByActivityId} from "@/api/admin/activity-option";
@ -157,13 +163,13 @@ import {dateFormat} from "@/util/date";
import {getStore} from "@/util/store";
import {fetchItemList} from "@/api/admin/dict";
import agvTaskCommand from "@/views/mes/wip/resource-feeding-extension/content/agv-task-command.vue";
import {getByLot} from "@/api/mes/wip-nalinv/task-detail";
import agvTaskCommandMaterial from "@/views/mes/wip/resource-feeding-extension/task/agv-task-command.vue";
const uuid = require('uuid');
export default {
name: 'resource-feeding-extension',
components: {agvTaskCommand},
components: {agvTaskCommand, agvTaskCommandMaterial},
data() {
return {
formObj: {},
@ -221,6 +227,12 @@ export default {
subResource: '',
taskStatus: '0'
},
agvTaskCommandMaterialDialogVisible: false,
agvTaskCommandMaterialForm: {
resource: '',
subResource: '',
taskStatus: '0'
},
agvTaskTypeList: []
}
},
@ -660,6 +672,18 @@ export default {
},
agvTaskCommandConfirm() {
},
doAgvTaskCommandMaterial() {
if (isBlank(this.formObj.resource)) {
return this.$message.error('请选择设备')
}
this.agvTaskCommandMaterialDialogVisible = true;
Object.assign(this.agvTaskCommandMaterialForm, this.formObj);
this.agvTaskCommandMaterialForm.agvTaskTypeList = this.agvTaskTypeList;
this.$set(this.agvTaskCommandMaterialForm, "id", uuid.v4());
},
agvTaskCommandMaterialConfirm() {
},
// 取得字典項目列表 (option用)
getDictItemList() {

View File

@ -0,0 +1,222 @@
<template>
<div class="execution">
<el-dialog
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
v-el-drag-dialog
:fullscreen="false"
:visible.sync="visible"
:append-to-body="true"
title="AGV原料粒子人工呼叫"
@close="visible = false"
center
top="100px"
>
<div class="execution">
<el-form
ref="form"
:model="mainForm"
:rules="rules"
label-width="140px"
label-suffix=":"
>
<el-row :gutter="5">
<el-col :span="12">
<el-form-item label="设备编号" prop="resource">
<el-input v-model="mainForm.resource" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上料点" prop="subResource">
<el-input v-model="mainForm.subResource" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务类别" prop="taskType">
<el-select v-model="mainForm.taskType" @change="handleTaskTypeChange" :disabled="true">
<el-option v-for="item in taskTypeList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务类型" prop="taskTypeId">
<el-select v-model="mainForm.taskTypeId">
<el-option v-for="item in taskTypeIdList" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务标识" prop="taskMark">
<el-select v-model="mainForm.taskMark">
<el-option key="A" label="大卷" value="A"/>
<el-option key="B" label="小卷" value="B"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="AGV自动呼叫阈值" prop="taskTriggerValue">
<el-input v-model="mainForm.taskTriggerValue" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div style="width: 100%; display: flex; justify-content: center; margin-top: 20px">
<span slot="footer" class="dialog-footer">
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="handleConfirm"
>确认呼叫
</el-button>
<el-button icon="el-icon-circle-close" size="small" @click="closeForm"
>{{ $t('crud.cancelBtn') }}
</el-button>
</span>
</div>
</el-dialog>
</div>
</template>
<script>
import {clearValidate, copyJSON} from '@/util/util'
import {showLoading, hideLoading} from '@/const/loading'
import {agvReelingManualCall, reelingComplete} from '@/api/mes/wip-nalinv/jm-auto-reeling';
import {findResourceList as fetchResourceList} from "@/api/mes/pms/resrce";
import {getByCode as getFastCode} from '@/api/mes/sys/fast-code-detail';
import {isBlank} from "@/util/string";
export default {
components: {},
props: {
closeVisible: Boolean,
form: Object,
showTitle: String
},
data() {
return {
rules: {
taskType: [{required: true, message: '任务类别不能为空', trigger: ['change']}],
taskTypeId: [{required: true, message: '任务类型不能为空', trigger: ['change']}],
taskMark: [{required: true, message: '任务标识', trigger: ['change']}]
},
visible: false,
open: '',
mainForm: this.form,
taskTypeList: [],
taskTypeIdList: []
}
},
watch: {
'form.id': {
handler() {
this.mainForm = this.form
this.processTaskTypeList()
this.handleTaskTypeChange(this.form.taskType, true)
this.setAgvAutomaticCallThreshold(this.form.subResource)
this.$nextTick(() => {
clearValidate.call(this, 'form', ['taskType', 'taskTypeId', 'taskMark'])
})
},
immediate: true,
},
closeVisible: {
handler() {
this.visible = this.closeVisible
},
},
},
methods: {
processTaskTypeList() {
let me = this
let taskTypeList = me.mainForm.taskTypeList;
me.taskTypeList = [];
if(taskTypeList && taskTypeList.length > 0) {
let taskStatusCodeList = []
for(let i = 0; i < taskTypeList.length; i++) {
let record = taskTypeList[i]
let taskType = record.ef1
if(taskStatusCodeList.indexOf(taskType) < 0) {
taskStatusCodeList.push(taskType)
me.taskTypeList.push({
value: taskType,
label: record.ef2
})
}
}
}
},
handleTaskTypeChange(value, init) {
let me = this;
if(me.taskTypeIdList && me.taskTypeIdList.length > 0 && init) {
return;
}
let taskTypeList = me.mainForm.taskTypeList;
me.taskTypeIdList = [];
me.mainForm.taskTypeId = '';
if(taskTypeList && taskTypeList.length > 0) {
for(let i = 0; i < taskTypeList.length; i++) {
let record = taskTypeList[i];
let taskType = record.ef1;
if(taskType === value) {
me.taskTypeIdList.push({
value: record.ef3,
label: record.ef4
})
}
}
}
},
setAgvAutomaticCallThreshold(resrce) {
let params = {
fastCode: 'SLOT_DELIVERY_RULES',
code: resrce
};
showLoading();
getFastCode(params).then(response => {
hideLoading();
let data = response.data.data;
this.mainForm.taskTriggerValue = data ? data.ef1 : '';
}).catch(() => {
hideLoading();
})
},
handleConfirm() {
let me = this;
this.$refs['form'].validate((valid) => {
if (valid) {
let me = this;
let params = Object.assign({}, me.mainForm);
params.resrce = params.resource;
showLoading();
agvReelingManualCall(params).then(res => {
hideLoading();
if (res.data.code !== 0) {
return this.$message.error(res.data.msg);
}
this.$message.success('呼叫成功');
this.doConfirm(res.data.data);
}).catch(err => {
hideLoading();
});
}
})
},
closeForm() {
this.visible = false
this.$set(this, 'mainForm', {})
this.$emit('update:closeVisible', false)
this.$emit('afterClose', true)
},
doConfirm() {
this.$emit('doConfirm', this.mainForm)
this.closeForm()
}
},
}
</script>

View File

@ -0,0 +1,332 @@
<template>
<div class="execution">
<el-dialog
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
v-el-drag-dialog
:fullscreen="false"
:visible.sync="visible"
:append-to-body="true"
title="AGV任务指令"
@close="visible = false"
center
top="100px"
>
<div class="execution">
<input-select-dialog
:modal-obj="resourceDialogObj"
:modal-fetch-fun="resourceDialogFetchFun"
:modal-show.sync="resourceDialogVisible"
@inputDialogSelected="resourceSelected"
>
</input-select-dialog>
<!-- 附属设备弹窗 -->
<input-select-dialog
:modal-obj="subResourceDialogObj"
:modal-fetch-fun="subResourceDialogFetchFun"
:modal-show.sync="subResourceShow"
@inputDialogSelected="subResourceSelected"
></input-select-dialog>
<agvDeliveryCall
:close-visible.sync="agvDeliveryCallDialogVisible"
:form="agvDeliveryCallForm"
@doConfirm="agvDeliveryCallConfirm"
></agvDeliveryCall>
<el-form
ref="form"
:model="mainForm"
:rules="rules"
label-width="140px"
label-suffix=":"
>
<el-row :gutter="5">
<el-col :span="12">
<el-form-item label="设备编号" prop="resource">
<el-input v-model="mainForm.resource" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="上料点" prop="subResource">
<el-input v-model="mainForm.subResource" readonly>
<i
slot="suffix"
class="el-input__icon el-icon-copy-document"
@click.stop="showDialog('subResource')"
></i>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务状态" prop="taskStatus">
<el-select v-model="mainForm.taskStatus">
<el-option label="已创建" value="0"></el-option>
<el-option label="已完成" value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-button type="primary" icon="el-icon-circle-close" size="small" @click="getTaskDetailList">搜索</el-button>
</el-col>
</el-row>
</el-form>
<el-table ref="taskListTable" :data="taskList" height="330" border>
<el-table-column label="序号" align="center" prop="seq" width="50">
<template v-slot:default="scope">
{{ getSeq(scope.$index) }}
</template>
</el-table-column>
<el-table-column label="任务类别" align="center" prop="taskType">
<template v-slot:default="scope">
{{convertTaskType(scope.row.taskType)}}
</template>
</el-table-column>
<el-table-column label="任务类型" align="center" prop="taskTypeId">
<template v-slot:default="scope">
{{convertTaskTypeId(scope.row.taskTypeId)}}
</template>
</el-table-column>
<el-table-column label="任务编号" align="center" prop="taskId"/>
<el-table-column label="任务标识" align="center" prop="taskMark">
<template v-slot:default="scope">
{{convertTaskMark(scope.row.taskMark)}}
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="taskStatus">
<template v-slot:default="scope">
{{scope.row.taskStatus === '0' ? '已创建' : scope.row.taskStatus === '1' ? '已完成' : '未知'}}
</template>
</el-table-column>
<el-table-column label="任务请求时间" align="center" prop="requestDate" width="140"/>
<el-table-column label="任务完成时间" align="center" prop="completedDate" width="140"/>
</el-table>
</div>
<div style="width: 100%; display: flex; justify-content: center; margin-top: 20px">
<span slot="footer" class="dialog-footer">
<el-button
type="primary"
icon="el-icon-circle-plus-outline"
size="small"
@click="handleAgvDeliveryCall"
>AGV原料粒子人工呼叫
</el-button>
<el-button icon="el-icon-circle-close" size="small" @click="closeForm"
>{{ $t('crud.cancelBtn') }}
</el-button>
</span>
</div>
</el-dialog>
</div>
</template>
<script>
import {clearValidate} from '@/util/util'
import {showLoading, hideLoading} from '@/const/loading'
import {agvReelingManualCall} from '@/api/mes/wip-nalinv/jm-auto-reeling';
import {findResourceList as fetchResourceList} from "@/api/mes/pms/resrce";
import {getByCode as getFastCode} from '@/api/mes/sys/fast-code-detail';
import {listNewTask} from "@/api/mes/wip-nalinv/task-detail";
import {subResource} from "@/api/mes/smd/eqp-combine";
import agvDeliveryCall from "@/views/mes/wip/resource-feeding-extension/content/agv-delivery-call.vue";
import {subResourceDialogObj} from "@/views/mes/wip/resource-feeding-extension/init";
import {isBlank} from "@/util/string";
const uuid = require('uuid');
export default {
components: {agvDeliveryCall},
props: {
closeVisible: Boolean,
form: Object,
showTitle: String
},
data() {
return {
rules: {},
visible: false,
open: '',
mainForm: this.form,
resourceDialogVisible: false,
resourceDialogFetchFun: fetchResourceList,
resourceDialogObj: {
condition: 'searchText',
tableColumn: [
{ prop: 'resrce', label: 'mes.pms.resource', width: '200' },
{ prop: 'description', label: 'mes.description' },
],
title: 'mes.pms.resource',
},
subResourceShow: false,
subResourceDialogObj,
subResourceDialogFetchFun: subResource,
taskList: [],
agvDeliveryCallDialogVisible: false,
agvDeliveryCallForm: {
id: '',
resource: '',
subResource: '',
taskType: '1',
taskTypeId: '',
taskMark: '',
taskTriggerValue: null
}
}
},
watch: {
form: {
handler() {
this.mainForm = this.form
this.getTaskDetailList()
this.$nextTick(() => {
clearValidate.call(this, 'form', ['taskType', 'taskTypeId', 'taskDestination'])
})
},
deep: true,
},
closeVisible: {
handler() {
this.visible = this.closeVisible
},
},
},
methods: {
//显示设备弹窗框
showResourceDialog() {
let me = this;
me.resourceDialogObj.queryParam = {
workCenter: '',
operation: me.mainForm.operation,
fab: me.mainForm.fab
};
this.resourceDialogVisible = true;
},
// 開窗
showDialog(key) {
let me = this;
switch (key) {
case 'subResource':
if (isBlank(me.mainForm.resource)) {
return this.$message.error('请先选择设备')
}
this.subResourceDialogObj.queryParam = {
resrce: me.mainForm.resource,
subEqpType: me.mainForm.subResourceType
}
this.subResourceShow = true
break;
}
},
// 上料点選擇開窗資料
subResourceSelected(row) {
let me = this;
me.mainForm.subResource = row.resrce;
},
resourceSelected(row) {
let me = this;
me.mainForm.taskDestination = row.resrce;
me.mainForm.taskDestinationDesc = row.description;
me.setAgvAutomaticCallThreshold(row.resrce);
},
getTaskDetailList() {
let me = this;
let resource = me.mainForm.resource;
let subResource = me.mainForm.subResource;
let taskStatus = me.mainForm.taskStatus;
showLoading();
listNewTask(resource, subResource, taskStatus).then(response => {
hideLoading();
me.taskList = response.data.data;
})
.catch(() => {
hideLoading();
});
},
setAgvAutomaticCallThreshold(resrce) {
let params = {
fastCode: 'SLOT_DELIVERY_RULES',
code: resrce
};
showLoading();
getFastCode(params).then(response => {
hideLoading();
let data = response.data.data;
this.mainForm.taskTriggerValue = data ? data.ef1 : '';
}).catch(() => {
hideLoading();
})
},
handleAgvDeliveryCall() {
this.agvDeliveryCallDialogVisible = true;
Object.assign(this.agvDeliveryCallForm, this.mainForm);
this.agvDeliveryCallForm.taskTypeList = this.mainForm.agvTaskTypeList;
this.$set(this.agvDeliveryCallForm, "id", uuid.v4());
},
agvDeliveryCallConfirm() {
this.getTaskDetailList();
},
handleConfirm() {
let me = this;
this.$refs['form'].validate((valid) => {
if (valid) {
let me = this;
let params = Object.assign({}, me.mainForm);
showLoading();
agvReelingManualCall(params).then(res => {
hideLoading();
if (res.data.code !== 0) {
return this.$message.error(res.data.msg);
}
this.$message.success('呼叫成功');
this.doConfirm(res.data.data);
}).catch(err => {
hideLoading();
});
}
})
},
getSeq(index) {
// 序号从 1 开始
return index + 1;
},
convertTaskType(taskType) {
let taskTypeList = this.mainForm.agvTaskTypeList;
if(taskTypeList && taskTypeList.length > 0) {
for(let i = 0; i < taskTypeList.length; i++) {
if(taskTypeList[i].ef1 === taskType) {
return taskTypeList[i].ef2;
}
}
}
return taskType;
},
convertTaskTypeId(taskTypeId) {
let taskTypeList = this.mainForm.agvTaskTypeList;
if(taskTypeList && taskTypeList.length > 0) {
for(let i = 0; i < taskTypeList.length; i++) {
if(taskTypeList[i].ef3 === taskTypeId) {
return taskTypeList[i].ef4;
}
}
}
return taskTypeId;
},
convertTaskMark(taskMark) {
if(taskMark === 'A') {
return '大卷';
} else if(taskMark === 'B') {
return '小卷';
}
return taskMark;
},
closeForm() {
this.visible = false
this.$set(this, 'mainForm', {})
this.$emit('update:closeVisible', false)
this.$emit('afterClose', true)
},
doConfirm() {
this.$emit('doConfirm', this.mainForm)
this.closeForm()
}
},
}
</script>