feat(钢卷待操作): 新增还原已删除记录功能并优化查询

新增还原已删除钢卷待操作记录的功能,包括前后端接口实现。优化查询逻辑,支持查看已删除记录。调整页面操作状态显示为下拉选择,并增加删除/还原按钮的显示控制。同时修改多处报表页面的分页参数为9999以提高数据展示量。

修改删除标志查询条件,将已删除状态从1改为2以区分逻辑删除状态。在钢卷待操作页面增加"查看被删除操作"复选框,支持切换显示正常/已删除记录。
This commit is contained in:
砂糖
2026-03-12 16:23:45 +08:00
parent 5f8ec04a17
commit 223a745991
18 changed files with 111 additions and 33 deletions

View File

@@ -141,3 +141,12 @@ export function exportPendingAction(query) {
})
}
/**
* 还原被删除的钢卷
*/
export function restorePendingAction(actionId) {
return request({
url: `/wms/coilPendingAction/restore/${actionId}`,
method: 'put'
})
}

View File

@@ -33,6 +33,9 @@
<el-button type="warning" plain icon="el-icon-refresh" size="mini" @click="handleRefresh"
:disabled="buttonLoading" v-loading="buttonLoading">刷新</el-button>
</el-col>
<el-col :span="3">
<el-checkbox v-model="rubbish" label="1" @change="getList">查看被删除操作</el-checkbox>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -59,12 +62,18 @@
</template>
</el-table-column>
<el-table-column label="操作状态" align="center" prop="actionStatus" width="100">
<el-table-column label="操作状态" align="center" prop="actionStatus" width="120">
<template slot-scope="scope">
<el-tag v-if="scope.row.actionStatus === 0" type="info" size="small">待处理</el-tag>
<el-select v-model="scope.row.actionStatus" placeholder="请选择操作状态" @change="handleStatusChange(scope.row)">
<el-option label="待处理" :value="0" />
<el-option label="处理中" :value="1" />
<el-option label="已完成" :value="2" />
<el-option label="已取消" :value="3" />
</el-select>
<!-- <el-tag v-if="scope.row.actionStatus === 0" type="info" size="small">待处理</el-tag>
<el-tag v-else-if="scope.row.actionStatus === 1" type="warning" size="small">处理中</el-tag>
<el-tag v-else-if="scope.row.actionStatus === 2" type="success" size="small">已完成</el-tag>
<el-tag v-else-if="scope.row.actionStatus === 3" type="danger" size="small">已取消</el-tag>
<el-tag v-else-if="scope.row.actionStatus === 3" type="danger" size="small">已取消</el-tag> -->
</template>
</el-table-column>
@@ -120,7 +129,8 @@
</template> -->
<!-- 已完成或已取消状态显示删除按钮 -->
<template v-if="scope.row.actionStatus === 2 || scope.row.actionStatus === 3">
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
<el-button v-if="scope.row.delFlag == 0" size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
<el-button v-if="scope.row.delFlag == 2" size="mini" type="success" icon="el-icon-refresh" @click="handleRestore(scope.row)">还原</el-button>
</template>
</template>
</el-table-column>
@@ -185,8 +195,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="buttonLoading" v-loading="buttonLoading">
</el-button>
<el-button type="primary" @click="submitForm" :disabled="buttonLoading" v-loading="buttonLoading"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@@ -201,7 +210,8 @@ import {
addPendingAction,
updatePendingAction,
startProcess,
cancelAction
cancelAction,
restorePendingAction,
} from '@/api/wms/pendingAction';
import CoilSelector from '@/components/CoilSelector';
import CoilNo from '@/components/KLPService/Renderer/CoilNo.vue';
@@ -219,6 +229,7 @@ export default {
// 遮罩层
loading: true,
buttonLoading: false,
rubbish: false,
// 选中数组
ids: [],
// 非单个禁用
@@ -293,9 +304,12 @@ export default {
getList() {
this.loading = true;
this.buttonLoading = true;
listPendingAction(this.queryParams).then(response => {
const payload = {
...this.queryParams,
includeDeleted: this.rubbish ? 2 : 0
}
listPendingAction(payload).then(response => {
console.log('response.rows', response.rows);
this.actionList = response.rows;
this.total = response.total;
this.buttonLoading = false;
@@ -340,6 +354,27 @@ export default {
this.resetForm('queryForm');
this.handleQuery();
},
handleStatusChange(row) {
// console.log(row)
updatePendingAction(row).then(response => {
this.$message.success('操作状态更新成功');
this.getList();
});
},
/** 还原按钮操作 */
handleRestore(row) {
const actionId = row.actionId;
this.$modal.confirm('是否确认还原该待操作记录?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
restorePendingAction(actionId).then(response => {
this.$message.success('还原成功');
this.getList();
});
});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.actionId);

View File

@@ -318,7 +318,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 11, // 酸轧工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -328,7 +328,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -339,7 +339,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 11, // 酸轧工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -349,7 +349,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -394,7 +394,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 11, // 酸轧工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -404,7 +404,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -323,7 +323,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 11, // 酸轧工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -333,7 +333,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -186,7 +186,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 11, // 酸轧工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -196,7 +196,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -304,7 +304,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 501, // 镀锌工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -314,7 +314,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -325,7 +325,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 501, // 镀锌工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -335,7 +335,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -381,7 +381,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 501, // 镀锌工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -391,7 +391,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -307,7 +307,7 @@ export default {
const res1 = await listPendingAction({
actionStatus: 2,
actionType: 501, // 镀锌工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -317,7 +317,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -186,7 +186,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 501, // 镀锌工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
@@ -196,7 +196,7 @@ export default {
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 120, // 分条工序
pageSize: 999,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,

View File

@@ -138,6 +138,15 @@ public class WmsCoilPendingActionController extends BaseController {
return toAjax(iWmsCoilPendingActionService.cancelAction(actionId));
}
/**
* 还原操作(将已删除的记录恢复为正常状态)
*/
@Log(title = "钢卷待操作", businessType = BusinessType.UPDATE)
@PutMapping("/restore/{actionId}")
public R<Void> restoreAction(@PathVariable("actionId") Long actionId) {
return toAjax(iWmsCoilPendingActionService.restoreAction(actionId));
}
/**
* 计算理论节拍回归默认近6个月并返回散点+拟合线
*/

View File

@@ -94,7 +94,6 @@ public class WmsCoilPendingAction extends BaseEntity {
/**
* 删除标志0=正常1=已删除)
*/
@TableLogic
private Integer delFlag;
/**

View File

@@ -200,7 +200,6 @@ public class WmsCoilPendingActionVo extends BaseEntity implements Serializable {
private String actualWarehouseName;
private Integer delFlag;
}

View File

@@ -68,6 +68,11 @@ public interface IWmsCoilPendingActionService {
*/
Boolean cancelAction(Long actionId);
/**
* 还原操作(将已删除的记录恢复为正常状态)
*/
Boolean restoreAction(Long actionId);
/**
* 计算理论节拍线性回归默认近6个月同时返回散点用于前端绘图并将结果缓存。
*/

View File

@@ -118,7 +118,7 @@ public class WmsCoilPendingActionServiceImpl implements IWmsCoilPendingActionSer
// 包含已删除记录不添加del_flag过滤查询所有记录
} else if (bo.getIncludeDeleted() == 2) {
// 仅查询已删除记录
qw.eq("wcpa.del_flag", 1);
qw.eq("wcpa.del_flag", 2);
} else {
// 默认:仅查询正常记录
qw.eq("wcpa.del_flag", 0);
@@ -281,6 +281,27 @@ public class WmsCoilPendingActionServiceImpl implements IWmsCoilPendingActionSer
return baseMapper.updateById(action) > 0;
}
/**
* 还原操作(将已删除的记录恢复为正常状态)
*/
@Override
public Boolean restoreAction(Long actionId) {
// 使用QueryWrapper查询不受逻辑删除影响检查记录是否存在且del_flag为2
WmsCoilPendingAction oldAction = baseMapper.selectOne(new QueryWrapper<WmsCoilPendingAction>()
.eq("action_id", actionId)
.eq("del_flag", 2)
.last("LIMIT 1"));
if (oldAction == null) {
throw new RuntimeException("待操作记录不存在或未被删除");
}
// 将del_flag改为0
WmsCoilPendingAction action = new WmsCoilPendingAction();
action.setActionId(actionId);
action.setDelFlag(0); // 恢复为正常状态
return baseMapper.updateById(action) > 0;
}
@Override
public TheoryCycleRegressionResultVo calcTheoryCycleRegression(Date startTime, Date endTime) {
return calcTheoryCycleRegression(startTime, endTime, true, 2000);

View File

@@ -43,6 +43,7 @@
wcpa.process_time as processTime,
wcpa.complete_time as completeTime,
wcpa.remark as remark,
wcpa.del_flag as delFlag,
wcpa.create_time as createTime,
wcpa.create_by as createBy,
wcpa.update_time as updateTime,