feat(退火操作): 新增退火操作事件记录功能

添加退火操作事件API及页面,实现退火炉操作记录功能
在计划管理页面增加操作事件记录,包括入炉、完成、添加和解绑操作
This commit is contained in:
2026-04-16 17:12:08 +08:00
parent 28622a2b16
commit edcbf7a5f1
4 changed files with 506 additions and 8 deletions

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询退火操作事件列表
export function listAnnealOperateEvent(query) {
return request({
url: '/wms/annealOperateEvent/list',
method: 'get',
params: query
})
}
// 查询退火操作事件详细
export function getAnnealOperateEvent(eventId) {
return request({
url: '/wms/annealOperateEvent/' + eventId,
method: 'get'
})
}
// 新增退火操作事件
export function addAnnealOperateEvent(data) {
return request({
url: '/wms/annealOperateEvent',
method: 'post',
data: data
})
}
// 修改退火操作事件
export function updateAnnealOperateEvent(data) {
return request({
url: '/wms/annealOperateEvent',
method: 'put',
data: data
})
}
// 删除退火操作事件
export function delAnnealOperateEvent(eventId) {
return request({
url: '/wms/annealOperateEvent/' + eventId,
method: 'delete'
})
}

View File

@@ -264,6 +264,7 @@ import { listAnnealFurnace } from "@/api/wms/annealFurnace";
import { listMaterialCoil } from "@/api/wms/coil";
import { listWarehouse } from '@/api/wms/warehouse'
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { addAnnealOperateEvent } from "@/api/wms/annealOperateEvent";
export default {
name: "AnnealPlan",
@@ -388,6 +389,7 @@ export default {
this.completeLoading = true;
listAnnealPlanCoils(this.currentPlan.planId).then(response => {
this.completeCoils = (response.data || []).map(item => ({
...item,
coilId: item.coilId,
enterCoilNo: item.enterCoilNo,
warehouseId: item.logicWarehouseId || null
@@ -543,6 +545,14 @@ export default {
});
this.loading = true;
await inFurnace({ planId: row.planId });
// 炉火开始加工
const targetFurnaceName = this.furnaceOptions.find(item => item.furnaceId === row.targetFurnaceId)?.furnaceName || '';
addAnnealOperateEvent({
annealFurnaceId: row.targetFurnaceId,
operateType: 'IN',
operateContent: '退火炉' + targetFurnaceName + '开始加工',
})
// anneal-todo: 新增操作事件
this.loading = false;
row.status = 2;
@@ -571,6 +581,12 @@ export default {
locations: locations
}).then(() => {
// anneal-todo: 新增操作事件
const targetFurnaceName = this.furnaceOptions.find(item => item.furnaceId === this.currentPlan.targetFurnaceId)?.furnaceName || '';
addAnnealOperateEvent({
annealFurnaceId: this.currentPlan.targetFurnaceId,
operateType: 'COMPLETE',
operateContent: '退火炉' + targetFurnaceName + '完成加工。',
})
this.$message.success('已完成');
this.completeOpen = false;
this.getList();

View File

@@ -67,8 +67,8 @@
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(scope.row)">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(scope.row)">删除</el-button>
<el-button size="mini" type="text" icon="el-icon-s-operation"
@click.stop="openStatusDialog(scope.row)">状态</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-s-operation"
@click.stop="openStatusDialog(scope.row)">状态</el-button> -->
<!-- <el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-flag"
:disabled="!scope.row.coilCount" @click.stop="handleInFurnace(scope.row)">入炉</el-button> -->
<el-button v-if="scope.row.status === 2" size="mini" type="text" icon="el-icon-check"
@@ -153,6 +153,12 @@
</div> -->
</div>
<el-table :data="coilList" v-loading="coilLoading" class="light-table">
<el-table-column label="钢卷层级" align="center" width="80">
<template slot-scope="scope">
<el-input v-model="scope.row.furnaceLevel" placeholder="请输入钢卷层级"
@change="handlePLanCoilChange(scope.row)" />
</template>
</el-table-column>
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo" />
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
@@ -166,7 +172,7 @@
</el-table-column>
<el-table-column label="操作" align="center" width="100">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleUnbind(scope.row)">
<el-button v-if="currentPlan.status === 0" size="mini" type="text" icon="el-icon-delete" @click="handleUnbind(scope.row)">
{{ unbindLabel(currentPlan.status) }}
</el-button>
</template>
@@ -208,13 +214,13 @@
:value="item.furnaceId" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<!-- <el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请选择">
<el-option label="未开始" :value="0" />
<el-option label="进行中" :value="2" />
<el-option label="已完成" :value="3" />
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
@@ -226,7 +232,7 @@
</el-dialog>
<el-dialog title="更新状态" :visible.sync="statusOpen" width="360px" append-to-body>
<el-form label-width="90px">
<!-- <el-form label-width="90px">
<el-form-item label="状态">
<el-select v-model="statusForm.status" placeholder="请选择">
<el-option label="未开始" :value="0" />
@@ -234,7 +240,7 @@
<el-option label="已完成" :value="3" />
</el-select>
</el-form-item>
</el-form>
</el-form> -->
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitStatus"> </el-button>
<el-button @click="statusOpen = false"> </el-button>
@@ -244,10 +250,11 @@
</template>
<script>
import { listAnnealPlan, getAnnealPlan, addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan";
import { listAnnealPlan, getAnnealPlan, updateAnnealPlanCoil ,addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan";
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
import { listMaterialCoil } from "@/api/wms/coil";
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { addAnnealOperateEvent } from "@/api/wms/annealOperateEvent";
export default {
name: "AnnealPlan",
@@ -344,6 +351,13 @@ export default {
this.resetMaterialForm();
this.handleMaterialQuery();
},
handlePLanCoilChange(row) {
updateAnnealPlanCoil(row).then(() => {
this.$message.success('已更新');
}).finally(() => {
this.loadPlanCoils();
});
},
openCompleteDialog() {
if (!this.currentPlan.planId) {
this.$message.warning('请先选择计划');
@@ -382,7 +396,15 @@ export default {
coilId: item.coilId
}).then(() => {
this.$message.success('已加入计划');
// 查找对应id退火炉的名称
const targetFurnaceName = this.furnaceOptions.find(item => item.furnaceId === this.currentPlan.targetFurnaceId)?.furnaceName || '';
// anneal-todo: 新增操作事件
addAnnealOperateEvent({
annealFurnaceId: this.currentPlan.targetFurnaceId,
operateType: 'ADD',
operateContent: '钢卷号' + item.enterCoilNo + '加入退火炉' + targetFurnaceName,
coilId: item.coilId,
})
this.loadPlanCoils();
}).finally(() => {
this.coilLoading = false;
@@ -560,7 +582,15 @@ export default {
});
}).then(() => {
this.$message.success('解绑成功');
// 查找对应id退火炉的名称
const targetFurnaceName = this.furnaceOptions.find(item => item.furnaceId === this.currentPlan.targetFurnaceId)?.furnaceName || '';
// anneal-todo: 新增操作事件
addAnnealOperateEvent({
annealFurnaceId: this.currentPlan.targetFurnaceId,
operateType: 'UNBIND',
operateContent: '钢卷号' + row.enterCoilNo + '解绑退火炉' + targetFurnaceName,
coilId: row.coilId,
})
this.loadPlanCoils();
});
},

View File

@@ -0,0 +1,408 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="退火炉" prop="annealFurnaceId">
<el-select
v-model="queryParams.annealFurnaceId"
placeholder="请选择退火炉"
clearable
@keyup.enter.native="handleQuery"
>
<el-option
v-for="item in annealFurnaceList"
:key="item.furnaceId"
:label="item.furnaceName"
:value="item.furnaceId"
/>
</el-select>
</el-form-item>
<el-form-item label="操作类型" prop="operateType">
<el-select
v-model="queryParams.operateType"
placeholder="请选择操作类型"
clearable
@keyup.enter.native="handleQuery"
>
<el-option
label="新增"
value="ADD"
/>
<el-option
label="解绑"
value="UNBIND"
/>
<el-option
label="入炉"
value="IN"
/>
<el-option
label="完成"
value="COMPLETE"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>补录</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="annealOperateEventList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键ID" align="center" prop="eventId" v-if="true"/> -->
<el-table-column label="退火炉" align="center" prop="annealFurnaceName">
<template slot-scope="scope">
{{ getAnnealFurnaceName(scope.row.annealFurnaceId) || '-' }}
</template>
</el-table-column>
<el-table-column label="操作类型" align="center" prop="operateType">
<template slot-scope="scope">
{{ getOperateTypeName(scope.row.operateType) || '-' }}
</template>
</el-table-column>
<el-table-column label="操作描述" align="center" prop="operateContent" />
<!-- <el-table-column label="钢卷ID(可选)" align="center" prop="coilId" /> -->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作人" align="center" prop="createBy" />
<el-table-column label="操作时间" align="center" prop="createTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改退火操作事件对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="退火炉" prop="annealFurnaceId">
<el-select v-model="form.annealFurnaceId" placeholder="请选择退火炉">
<el-option v-for="item in annealFurnaceList" :key="item.furnaceId" :label="item.furnaceName" :value="item.furnaceId" />
</el-select>
</el-form-item>
<el-form-item label="操作描述">
<el-input type="textarea" v-model="form.operateContent" placeholder="请输入操作描述" />
</el-form-item>
<el-form-item label="操作类型" prop="operateType">
<el-select v-model="form.operateType" placeholder="请选择操作类型" clearable>
<el-option
label="新增"
value="ADD"
/>
<el-option
label="解绑"
value="UNBIND"
/>
<el-option
label="入炉"
value="IN"
/>
<el-option
label="完成"
value="COMPLETE"
/>
</el-select>
</el-form-item>
<el-form-item label="操作人" prop="createBy">
<el-input v-model="form.createBy" placeholder="请输入操作人" />
</el-form-item>
<el-form-item label="操作时间" prop="createTime">
<el-date-picker
v-model="form.createTime"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择操作时间"
/>
</el-form-item>
<!-- <el-form-item label="钢卷ID(可选)" prop="coilId">
<el-input v-model="form.coilId" placeholder="请输入钢卷ID(可选)" />
</el-form-item> -->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listAnnealOperateEvent, getAnnealOperateEvent, delAnnealOperateEvent, addAnnealOperateEvent, updateAnnealOperateEvent } from "@/api/wms/annealOperateEvent";
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
export default {
name: "AnnealOperateEvent",
data() {
return {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 退火操作事件表格数据
annealOperateEventList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
annealFurnaceId: undefined,
operateType: undefined,
operateContent: undefined,
coilId: undefined,
},
// 表单参数
form: {},
// 表单校验
rules: {
eventId: [
{ required: true, message: "主键ID不能为空", trigger: "blur" }
],
annealFurnaceId: [
{ required: true, message: "退火炉ID不能为空", trigger: "blur" }
],
operateType: [
{ required: true, message: "操作类型 如:START/PAUSE/STOP/FEED/TAKE/RESET不能为空", trigger: "change" }
],
operateContent: [
{ required: true, message: "操作内容描述不能为空", trigger: "blur" }
],
coilId: [
{ required: true, message: "钢卷ID(可选)不能为空", trigger: "blur" }
],
delFlag: [
{ required: true, message: "删除标志不能为空", trigger: "blur" }
],
// remark: [
// { required: true, message: "备注不能为空", trigger: "blur" }
// ],
createBy: [
{ required: true, message: "操作人不能为空", trigger: "blur" }
],
createTime: [
{ required: true, message: "操作时间不能为空", trigger: "blur" }
],
updateTime: [
{ required: true, message: "更新时间不能为空", trigger: "blur" }
],
},
// 退火炉列表
annealFurnaceList: [],
};
},
created() {
this.getList();
this.getAnnealFurnaceList();
},
methods: {
/** 查询退火操作事件列表 */
getList() {
this.loading = true;
listAnnealOperateEvent(this.queryParams).then(response => {
this.annealOperateEventList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询退火炉列表 */
getAnnealFurnaceList() {
listAnnealFurnace({ pageNum: 1, pageSize: 10000 }).then(response => {
this.annealFurnaceList = response.rows;
});
},
/** 获取退火炉名称 */
getAnnealFurnaceName(furnaceId) {
const item = this.annealFurnaceList.find(item => item.furnaceId === furnaceId);
return item ? item.furnaceName : '-';
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
/** 获取操作类型名称 */
getOperateTypeName(operateType) {
const map = {
'ADD': '新增',
'UNBIND': '解绑',
'IN': '入炉',
'COMPLETE': '完成',
}
return map[operateType] || '-';
},
// 表单重置
reset() {
this.form = {
eventId: undefined,
annealFurnaceId: undefined,
operateType: undefined,
operateContent: undefined,
coilId: undefined,
delFlag: undefined,
remark: undefined,
createTime: undefined,
createBy: undefined,
updateTime: undefined,
updateBy: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.eventId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加退火操作事件";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const eventId = row.eventId || this.ids
getAnnealOperateEvent(eventId).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改退火操作事件";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.eventId != null) {
updateAnnealOperateEvent(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addAnnealOperateEvent(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const eventIds = row.eventId || this.ids;
this.$modal.confirm('是否确认删除退火操作事件编号为"' + eventIds + '"的数据项?').then(() => {
this.loading = true;
return delAnnealOperateEvent(eventIds);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('wms/annealOperateEvent/export', {
...this.queryParams
}, `annealOperateEvent_${new Date().getTime()}.xlsx`)
}
}
};
</script>