<template>
|
<div>
|
<vol-box
|
v-model="showDetialBox"
|
:lazy="true"
|
width="400px"
|
:padding="15"
|
title="选择机械手"
|
>
|
<div>
|
<el-form>
|
<el-form-item required label="机械手:">
|
<el-select v-model="selectedRobot" placeholder="请选择机械手" style="width: 100%">
|
<el-option
|
v-for="item in robotList"
|
:key="item.robotCode"
|
:label="item.robotName"
|
:value="item.robotCode"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
</div>
|
<template #footer>
|
<el-button type="primary" size="small" @click="submit">确认</el-button>
|
<el-button type="danger" size="small" @click="close">关闭</el-button>
|
</template>
|
</vol-box>
|
</div>
|
</template>
|
|
<script>
|
import VolBox from "@/components/basic/VolBox.vue";
|
export default {
|
components: { VolBox },
|
data() {
|
return {
|
showDetialBox: false,
|
robotList: [
|
{ robotCode: '注液组盘机械手', robotName: '注液组盘机械手' },
|
{ robotCode: '高温换盘机械手', robotName: '高温换盘机械手' },
|
{ robotCode: '化成换盘机械手', robotName: '化成换盘机械手' },
|
{ robotCode: '拆盘机械手', robotName: '拆盘机械手' },
|
{ robotCode: '成品组盘机械手', robotName: '成品组盘机械手' }
|
],
|
selectedRobot: '',
|
currentRow: null,
|
actionType: null // 'bind' or 'unbind'
|
};
|
},
|
methods: {
|
open(action, row) {
|
this.actionType = action;
|
this.currentRow = row;
|
this.selectedRobot = '';
|
this.showDetialBox = true;
|
},
|
close() {
|
this.showDetialBox = false;
|
},
|
async submit() {
|
if (!this.selectedRobot) {
|
return this.$message.error("请选择机械手");
|
}
|
|
this.showDetialBox = false;
|
|
try {
|
if (this.actionType === 'bind') {
|
// 组盘确认
|
await this.$confirm(
|
`确认执行托盘组盘操作?\n托盘编号:${this.currentRow.palletCode}\n机械手:${this.selectedRobot}`,
|
"组盘确认",
|
{
|
confirmButtonText: "确认",
|
cancelButtonText: "取消",
|
type: "warning"
|
}
|
);
|
|
const result = await this.http.post("/api/StockInfoDetail/BindContainer", {
|
palletCode: this.currentRow.palletCode,
|
robotCode: this.selectedRobot
|
}, "正在调用MES接口...");
|
|
if (result.status) {
|
this.$Message.success(result.message || "托盘组盘成功");
|
this.$parent.$refs.table.load();
|
} else {
|
this.$error(result.message || "托盘组盘失败");
|
}
|
} else if (this.actionType === 'unbind') {
|
// 拆盘确认
|
await this.$confirm(
|
`确认执行托盘拆盘操作?\n托盘编号:${this.currentRow.palletCode}\n机械手:${this.selectedRobot}`,
|
"拆盘确认",
|
{
|
confirmButtonText: "确认",
|
cancelButtonText: "取消",
|
type: "warning"
|
}
|
);
|
|
const result = await this.http.post("/api/StockInfoDetail/UnbindContainer", {
|
palletCode: this.currentRow.palletCode,
|
robotCode: this.selectedRobot
|
}, "正在调用MES接口...");
|
|
if (result.status) {
|
this.$Message.success(result.message || "托盘拆盘成功");
|
this.$parent.$refs.table.load();
|
} else {
|
this.$error(result.message || "托盘拆盘失败");
|
}
|
}
|
} catch (error) {
|
if (error !== "cancel") {
|
this.$error(error.message || "网络错误,请稍后重试");
|
}
|
}
|
}
|
}
|
};
|
</script>
|