feat(wms): 新增钢卷告警历史批量处理功能
新增批量处理历史告警接口,支持将今天以前的告警标记为指定状态,前端添加对应操作按钮,可一键处理或忽略历史告警
This commit is contained in:
@@ -44,6 +44,15 @@ export function batchHandleMaterial(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 批量处理历史告警(标记今天以前的所有记录为指定状态)
|
||||
export function batchHandleHistory(data) {
|
||||
return request({
|
||||
url: '/wms/materialWarning/batchHandleHistory',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除钢卷通用维度告警(长度/厚度/宽度)
|
||||
export function delMaterialWarning(warningId) {
|
||||
return request({
|
||||
|
||||
@@ -63,6 +63,24 @@
|
||||
@click="handleBatchIgnore"
|
||||
>批量忽略</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-finished"
|
||||
size="mini"
|
||||
@click="handleBatchProcessHistory"
|
||||
>处理历史告警</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
@click="handleBatchIgnoreHistory"
|
||||
>忽略历史告警</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialWarningList" @selection-change="handleSelectionChange" :row-class-name="getRowClassName">
|
||||
@@ -178,7 +196,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMaterialWarning, getMaterialWarning, delMaterialWarning, addMaterialWarning, updateMaterialWarning, batchHandleMaterial } from "@/api/wms/materialWarning";
|
||||
import { listMaterialWarning, getMaterialWarning, delMaterialWarning, addMaterialWarning, updateMaterialWarning, batchHandleMaterial, batchHandleHistory } from "@/api/wms/materialWarning";
|
||||
|
||||
export default {
|
||||
name: "MaterialWarning",
|
||||
@@ -390,6 +408,34 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 处理历史告警按钮操作(批量标记今天以前的所有记录为已处理) */
|
||||
handleBatchProcessHistory() {
|
||||
this.$modal.confirm('确认将今天以前的所有告警标记为已处理?').then(() => {
|
||||
this.loading = true;
|
||||
return batchHandleHistory({ warningStatus: 1 });
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.$modal.msgSuccess("处理历史告警成功");
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 忽略历史告警按钮操作(批量标记今天以前的所有记录为已忽略) */
|
||||
handleBatchIgnoreHistory() {
|
||||
this.$modal.confirm('确认将今天以前的所有告警标记为已忽略?').then(() => {
|
||||
this.loading = true;
|
||||
return batchHandleHistory({ warningStatus: 2 });
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.$modal.msgSuccess("忽略历史告警成功");
|
||||
this.getList();
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
|
||||
@@ -128,6 +128,16 @@ public class WmsMaterialWarningController extends BaseController {
|
||||
return toAjax(iWmsMaterialWarningService.batchHandle(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理历史告警(标记今天以前的所有记录为指定状态)
|
||||
*/
|
||||
@Log(title = "钢卷通用维度告警批量处理历史", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/batchHandleHistory")
|
||||
public R<Void> batchHandleHistory(@Validated @RequestBody WmsMaterialWarningBo bo) {
|
||||
return toAjax(iWmsMaterialWarningService.batchHandleHistory(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除钢卷通用维度告警(长度/厚度/宽度)
|
||||
*
|
||||
|
||||
@@ -54,6 +54,11 @@ public interface IWmsMaterialWarningService {
|
||||
*/
|
||||
Boolean batchHandle(WmsMaterialWarningBo bo);
|
||||
|
||||
/**
|
||||
* 批量处理历史告警(标记今天以前的所有记录为指定状态)
|
||||
*/
|
||||
Boolean batchHandleHistory(WmsMaterialWarningBo bo);
|
||||
|
||||
/**
|
||||
* 检查钢卷长度/厚度偏差并批量插入告警记录
|
||||
* 在 calculateTheoretical 计算出理论长度和理论厚度后调用
|
||||
|
||||
@@ -174,6 +174,24 @@ public class WmsMaterialWarningServiceImpl implements IWmsMaterialWarningService
|
||||
return baseMapper.update(null, luw) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理历史告警(标记今天以前的所有记录为指定状态)
|
||||
*/
|
||||
@Override
|
||||
public Boolean batchHandleHistory(WmsMaterialWarningBo bo) {
|
||||
bo.setHandleBy(LoginHelper.getNickName());
|
||||
bo.setHandleTime(DateUtils.getNowDate());
|
||||
java.util.Date todayStart = DateUtils.toDate(java.time.LocalDate.now());
|
||||
LambdaUpdateWrapper<WmsMaterialWarning> luw = Wrappers.lambdaUpdate();
|
||||
luw.set(WmsMaterialWarning::getWarningStatus, bo.getWarningStatus())
|
||||
.set(StringUtils.isNotBlank(bo.getHandleBy()), WmsMaterialWarning::getHandleBy, bo.getHandleBy())
|
||||
.set(bo.getHandleTime() != null, WmsMaterialWarning::getHandleTime, bo.getHandleTime())
|
||||
.set(StringUtils.isNotBlank(bo.getHandleRemark()), WmsMaterialWarning::getHandleRemark, bo.getHandleRemark())
|
||||
.lt(WmsMaterialWarning::getCreateTime, todayStart)
|
||||
.eq(WmsMaterialWarning::getWarningStatus, 0);
|
||||
return baseMapper.update(null, luw) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查钢卷长度/厚度偏差并批量插入告警记录
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user