<template>
<div class="auto-alarm-page-main">
<!-- <div class="page-header">
<el-button class="return-main-page" @click="returnMainPage">
<< 返回
</el-button>
</div> -->
<div class="alarm-container-page">
<el-col :span="22">
<div class="alarm-item-title">{{ "OQA Defect Check" }}</div>
</el-col>
<!-- <el-row> -->
</div>
<div class="alarm-container-page">
<p class="title2">当前登陆工号:{{ userid }}</p>
</div>
<!-- <component :is="currentView" ref="child"></component> -->
<OQADefect ref="oqaDefectChild" @alarmTableUpdated="handleAlarmTableUpdate">
</OQADefect>
</div>
</template>
<script>
// import { createSocket } from "network/websocket/socket";
// import axios from "axios";
import { request } from "network/egg/restfulapi";
import { insertClickVolumeData } from "common/utils/clickvolume";
import OQADefect from "../YEAutoAlarm/SubPage/OQADefectAlarm";
export default {
name: "AutoAlarmPage",
components: {
OQADefect
},
data() {
return {
userid: this.$store.state.entrance.userInfo.userid,
currentView: "",
currentItem: "",
alarmCount: "",
formInline: {
datePicker: ""
},
// isActiveItemNameList: [], // 激活的项目列表
isAlarmNotified: false,
alarmRefreshInterval: null,
ruleConfig: {
alarmFrequency: ["30"],
alramFreByUser: [],
allowedViewers: ["1109531"],
alarmReceivers: []
},
availableUsers: [],
showConfig: true
};
},
watch: {},
computed: {},
created() {
// axios
// .get(`/AlarmRuleConfig/AlarmPageTree.json?time=${new Date().getTime()}`)
// .then(res => {
// const root = res.data.TreePage[0].children;
// });
},
mounted() {
this.loadUserAlarmFrequency();
this.startAlarmRefresh();
// 新增点击量及用户信息统计代码 begin
insertClickVolumeData(
this.$store.state.entrance.userInfo.userid,
this.$store.state.entrance.userInfo.name,
this.$store.state.entrance.userInfo.division,
this.$store.state.entrance.userInfo.department
);
// 新增点击量及用户信息统计代码 end
setTimeout(() => {
const childTableData = this.$refs.oqaDefectChild.alarmDataTable || [];
this.handleAlarmTableUpdate(childTableData);
}, 1000);
},
methods: {
loadUserAlarmFrequency() {
request({
method: "post",
url: `/api/YEAutoAlarm?type=getRuleConfig`,
data: this.$store.state.entrance.userInfo.userid
})
.then(res => {
console.log("loadUserAlarmFrequency", res.data);
if (res.data && res.data.FREQ) {
this.ruleConfig.alarmFrequency = res.data.FREQ;
} else if (res.data && !res.data.FREQ && res.data.FREQ_AUTO) {
this.ruleConfig.alarmFrequency = res.data.FREQ_AUTO;
}
})
.catch(err => {
console.error("Get Alarm Freq Fail:", err);
});
},
startAlarmRefresh() {
clearInterval(this.alarmRefreshInterval);
const refreshTime = this.ruleConfig.alarmFrequency * 60 * 1000;
console.log("refresh Time", refreshTime);
this.alarmRefreshInterval = setInterval(() => {
this.updateTotalAlarmData();
this.handleAlarmTableUpdate(this.alarmDataTable);
}, refreshTime);
},
updateAlarmData() {
// updateAlarmData(msg_) {
// const { alarmMsg } = msg_;
// this.Alarmfn(alarmMsg);
// if (msg_.length > 1) {
// msg_.forEach(x => {
// setTimeout(this.Alarmfn(x), 1000);
// });
// } else {
// this.Alarmfn(msg_);
// }
// this.$refs.child.updateAlarmTableData(msg_); // ref调用子组件方法
// this.$refs.oqaDefectChild.updateTotalAlarmData;
// this.alarmDataTable = tableData;
},
updateTotalAlarmData() {
request({
method: "post",
url: `/api/YEAutoAlarm?type=OQADefectCheckData`
})
.then(res => {
this.alarmDataTable = res.data;
this.$emit("alarmTableUpdated", this.alarmDataTable);
})
.catch(err => {
console.log(err);
});
},
// returnMainPage() {
// this.$router.push({ path: "/index/AutoAlarm/YEAutoAlarm" });
// },
handleAlarmTableUpdate(tableData) {
if (
// this.isActiveItemNameList.includes("OQA Defect Alarm") &&
tableData.length > 0 &&
!this.isAlarmNotified
) {
this.pushNotice("OQA Defect Alarm");
this.isAlarmNotified = true;
} else if (tableData.length === 0) {
this.isAlarmNotified = false;
}
},
pushNotice(title) {
if (window.Notification) {
const popNotice = () => {
if (!Notification.permission === "granted") return;
const option = {
dir: "ltr",
icon: require("@/assets/img/logo2.png"),
image: require("@/assets/img/waferBackground.png"),
body: `${title} 有报警,请查看!`,
tag: `${title}`,
renotify: true,
requireInteraction: true // 不自动关闭
};
const notification = new Notification("智能报警系统", option);
notification.onclick = function() {
window.open(`
http://10.66.54.131:8080/#/index/AutoAlarm/OQADefectAlarm`);
notification.close();
};
};
if (Notification.permission === "granted") {
popNotice();
} else {
Notification.requestPermission(function(permission) {
console.log(permission);
popNotice();
});
}
}
}
},
beforeDestory() {
clearInterval(this.alarmRefreshInterval);
}
};
</script>
<style scoped>
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.title2 {
position: absolute;
font-size: 20px;
margin-top: -20px;
margin-left: 40%;
color: black;
font-weight: 600;
}
.auto-alarm-page-main {
background: url("~assets/img/holdlotpagebg.png") no-repeat;
background-size: 100%;
}
.page-header {
display: flex;
font-size: 10px;
justify-content: space-between;
}
.return-main-page {
display: inline-block;
color: black;
border: none;
font-weight: bold;
font-size: 18px;
text-align: center;
padding-left: 10px;
padding-right: 10px;
padding-top: 4px;
padding-bottom: 4px;
text-decoration: none;
margin-left: 5px;
margin-top: 5px;
margin-bottom: 5px;
border-radius: 3px;
white-space: nowrap;
background: rgba(255, 255, 255, 0);
}
.alarm-container-page {
padding-top: 15px;
padding-bottom: 10px;
display: flex;
justify-content: space-around;
position: relative;
}
.alarm-item-title {
text-align: right;
line-height: 70px;
font-weight: bold;
font-size: 350%;
}
.alarm-item-count {
text-align: right;
line-height: 40px;
font-weight: bold;
font-size: 150%;
margin-bottom: 10px;
}
.picker {
height: 40px;
background-color: transparent;
border: 1px solid transparent;
}
.el-date-picker.has-sidebar.has-time {
background: #0a5857d6;
color: #fff;
border: 1px solid #22f4d6;
}
::v-deep .el-range-input {
background-color: transparent;
font-size: 70%;
font-weight: bold;
color: black;
}
</style>
<template>
<div class="auto-alarm-page-main1">
<div class="alarm-data alarm-data-text" style="margin: 20px;" v-if="false">
<div>报警信息为:{{ alarmDataText }}</div>
</div>
<el-tabs :value="activeName" @tab-click="changeTab" type="card">
<el-tab-pane label="报警详情" name="table">
<div>
<el-row :gutter="20">
<el-col :span="24">
<div class="content2">
<el-button
type="primary"
style="float: right;"
@click="engineerPostVisable()"
v-if="this.selectList.length >= 1"
>
处 置
</el-button>
</div>
</el-col>
</el-row>
</div>
<div class="alarm-data-table">
<yms-table-c2
:list="alarmDataTable"
:colProps="DTcolProps"
:isOperational="false"
:isMultiple="false"
:isExport="false"
:isFirst="false"
:isDeletable="false"
:isEditable="true"
:isDialog="true"
@selectChange="selectChange"
></yms-table-c2>
</div>
</el-tab-pane>
<el-tab-pane label="处置记录" name="historyTable">
<div class="alarm-data-table">
<el-form :inline="true" :model="formInline">
<el-form-item label="USERID:" style="margin-left: 20px;">
<el-select
v-model="formInline.filterUser"
clearable
style="width: 210px;"
placeholder="请选择"
>
<el-option
v-for="item in filterUserOpts"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="LOTID:" style="margin-left: 60px;">
<el-input
style="width: 210px;"
v-model="formInline.filterLot"
placeholder="请输入LOTID"
clearable
></el-input>
</el-form-item>
<el-form-item label="HANDLETYPE:" style="margin-left: 60px;">
<el-select
v-model="formInline.filterReason"
clearable
style="width: 210px;"
placeholder="请选择"
>
<el-option
v-for="item in filterReasonOpts"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="时间范围" style="margin-left: 230px;">
<el-date-picker
v-model="formInline.datePicker"
style="width: 370px;"
type="datetimerange"
range-separator="至"
start-placeholde="开始日期"
end-placeholde="结束日期"
align="right"
></el-date-picker>
<el-button
type="primary"
style="float: right;"
@click="getHistoryButton"
>
查 询
</el-button>
</el-form-item>
</el-form>
<yms-table-c2
:list="OperateDataTable"
:colProps="historycolProps"
:isOperational="false"
:isMultiple="false"
:isExport="false"
:isFirst="false"
:isDeletable="false"
:isEditable="false"
:isDialog="true"
></yms-table-c2>
</div>
</el-tab-pane>
<el-tab-pane label="规则配置" name="ruleTable" v-if="showRuleConfig">
<el-card class="rule-config-card">
<div slot="header" class="clearfix">
<span>报警规则配置</span>
<el-button
style="float:right;padding:3px 0"
type="text"
@click="saveRuleConfig"
>
保存配置
</el-button>
</div>
<el-divider content-position="left">报警频率</el-divider>
<el-select v-model="ruleConfig.alarmFrequency" placeholder="选择频率">
<el-option
v-for="item in frequencyOptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-divider content-position="left">访问权限</el-divider>
<el-input
v-model="newViewerUser"
placeholder="请输入工号"
style="width:200px;margin-right:10px;"
>
</el-input>
<el-button @click="addViewerUser">添加</el-button>
<ul style="margin-top:10px;">
<li v-for="(user, index) in ruleConfig.allowViewers" :key="index">
{{ user }}
</li>
</ul>
<el-table
:data="grantedId"
border
style="width:100%;margin-top:10px;"
>
<el-table-column prop="RULE_ID" label="ID"></el-table-column>
</el-table>
<el-divider content-position="left">报警接收权限</el-divider>
<el-input
v-model="newReceiverUser"
placeholder="请输入工号"
style="width:200px;margin-right:10px;"
>
</el-input>
<el-button @click="addReceiverUser">添加</el-button>
<ul style="margin-top:10px;">
<li v-for="(user, index) in ruleConfig.alarmReceivers" :key="index">
{{ user }}
</li>
</ul>
<el-table
:data="grantedId"
border
style="width:100%;margin-top:10px;"
>
<el-table-column prop="ALARM_ID" label="ID"></el-table-column>
</el-table>
</el-card>
</el-tab-pane>
</el-tabs>
<el-dialog :title="CommentTitle" :visible.sync="dialogFormVisible">
<el-form :model="form" ref="form" :rules="rules" label-width="160px">
<el-form-item label="处置类别" prop="isAlarm">
<el-input v-model="form.isAlarm" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="Comment" prop="isComment">
<el-input v-model="form.isComment" placeholder="请输入"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取 消</el-button>
<el-button type="primary" @click="engineerPost('form')">
提 交
</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { createSocket } from "network/websocket/socket";
import { Message } from "element-ui";
import { request } from "network/egg/restfulapi";
import YmsTableC2 from "components/common/YmsTable/YmsTableC2";
import { duplicate } from "common/utils/list";
import { insertClickVolumeData } from "common/utils/clickvolume";
const moment = require("moment");
const prop = [
{
label: "DEVICE",
value: "DEVICE",
type: "text",
sortable: true
},
{
label: "LOT_ID",
value: "LOT_ID",
type: "text",
sortable: true
},
{
label: "WAFER_ID",
value: "WAFER_ID",
type: "text",
sortable: true
},
{
label: "INSPECTION_TIME",
value: "INSPECTION_TIME",
type: "text",
sortable: true
},
{
label: "COUNT",
value: "COUNT",
type: "text",
sortable: true
}
];
const hisprop = [
{
label: "DEVICE",
value: "DEVICE",
type: "text",
// width: "120",
sortable: true
},
{
label: "LOT_ID",
value: "LOT_ID",
type: "text",
// width: "140",
sortable: true
},
{
label: "WAFER_ID",
value: "WAFER_ID",
type: "text",
sortable: true
},
{
label: "INSPECTION_TIME",
value: "INSPECTION_TIME",
type: "text",
// width: "180",
sortable: true
},
{
label: "COUNT",
value: "COUNT_DEFECTS",
type: "text",
// width: "120",
sortable: true
},
{
label: "HANDLETYPE",
value: "HANDLETYPE",
type: "text",
// width: "200",
sortable: true
},
{
label: "COMMENT",
value: "HANDLE_COMMENT",
type: "text",
// width: "200",
sortable: true
},
{
label: "USERID",
value: "USERID",
type: "text",
// width: "150",
sortable: true
},
{
label: "UPDATETIME",
value: "UPDATETIME",
type: "text",
// width: "200",
sortable: true
}
];
export default {
name: "OQADefectPage",
components: {
YmsTableC2
},
data() {
const now = moment().format("YYYY-MM-DD HH:mm:ss");
const twoDayAgo = moment()
.subtract(2, "day")
.format("YYYY-MM-DD HH:mm:ss");
// const checkComment = (rule, value, callback) => {
// if (this.reason === "Others" && !value) {
// return callback(new Error("comment不能为空"));
// }
// };
return {
userid: this.$store.state.entrance.userInfo.userid,
activeName: "table",
multipleSelection: {},
alarmDataText: null,
dialogFormVisible: false,
TrendChartDialogVisible: false,
alarmDataTable: [],
detailInfoData: [],
SubTableDialogVisible: false,
actionDataType: "",
DTcolProps: prop,
OperateDataTable: [],
historycolProps: hisprop,
CommentTitle: "",
LOTNAME: "",
currentPage: 1,
pageSizes: [5, 10, 20, 50, 100, 200],
pageSize: 10,
total: 0,
// dataTable: [],
subTableData: [],
alarmTrendInfoData: [],
alarmTrend: [],
recipe: "",
isNeed: false,
handleType: [],
form: {
isAlarm: "",
isComment: "",
startTime: ""
},
rules: {
isAlarm: [{ required: true, message: "请选择", trigger: "blur" }]
},
Reasonoptions: [],
Actionoptions: [],
selectList: [],
editprop: ["reason", "action", "comment"],
formInline: {
filterUser: "",
filterLot: "",
filterOperate: "",
filterReason: "",
filterAction: "",
datePicker: [twoDayAgo, now]
},
ruleConfig: {
alarmFrequency: [],
alramFreByUser: [],
allowedViewers: [],
alarmReceivers: []
},
grantedId: {
alarmFrequency: [],
alramFreByUser: [],
allowedViewers: [],
alarmReceivers: []
},
frequencyOptions: [
{ value: 10, label: "10min" },
{ value: 20, label: "20min" },
{ value: 30, label: "30min" },
{ value: 60, label: "60min" }
],
availableUsers: [],
showRuleConfig: true,
// filterActionOpts: [],
// filterReasonOpts: [],
beginTime: "",
endTime: "",
newReceiverUser: [],
newViewerUser: []
};
},
watch: {},
computed: {
/* eslint-disable */
filterUserOpts: {
get() {
const opts = duplicate(this.OperateDataTable, "USERID").map((item) => {
return {
label: item.USERID,
value: item.USERID,
}
})
return opts
},
set() {},
},
filterReasonOpts: {
get() {
const Aopts = duplicate(this.OperateDataTable, "HANDLETYPE").map(
(item) => {
return {
label: item.HANDLETYPE,
value: item.HANDLETYPE,
}
},
)
return Aopts
},
set() {},
},
/* eslint-disable */
currentUserId(){
return this.$store.state.entrance.userInfo.userid;
}
},
mounted() {
// this.loadUserAlarmFrequency();
this.updateTotalAlarmData();
this.getGrantedId();
this.beginTime = this.formInline.datePicker[0].toString();
this.endTime = this.formInline.datePicker[1].toString();
console.log("223", this.formInline.datePicker);
this.getHistory()
this.loadRuleconfig();
// 新增点击量及用户信息统计代码 begin
insertClickVolumeData(
this.$store.state.entrance.userInfo.userid,
this.$store.state.entrance.userInfo.name,
this.$store.state.entrance.userInfo.division,
this.$store.state.entrance.userInfo.department,
)
// 新增点击量及用户信息统计代码 end
},
updated() {},
methods: {
addViewerUser(){
if(this.newViewerUser.trim()){
this.ruleConfig.allowViews.push(this.newViewerUser.trim());
this.newViewerUser = "";
}
},
addReceiverUser(){
if(this.newReceiverUser.trim()){
this.ruleConfig.alarmReceivers.push(this.newReceiverUser.trim());
this.newReceiverUser = "";
}
},
loadRuleconfig(){
request({
method:"post",
url:`/api/YEAutoAlarm?type=getRuleConfig`,
data: this.$store.state.entrance.userInfo.userid
})
.then(res => {
console.log("loadRuleconfig", res.data);
if(res.data){
this.ruleConfig = res.data;
}
})
.catch(err =>{
console.error("加载配置失败:",err);
});
},
getGrantedId(){
request({
method:"post",
url:`/api/YEAutoAlarm?type=getGrantedID`
})
.then(res => {
console.log("getGrantedId", res.data);
this.grantedId = res.data;
this.showRuleConfig = this.grantedId.allowedViewers.includes(this.currentUserId);
})
.catch(err =>{
console.error("加载配置失败:",err);
});
},
saveRuleConfig(){
request({
method:"post",
url:`/api/YEAutoAlarm?type=saveRuleConfig`,
data:this.ruleConfig
})
.then(() => {
if (res.status === 200) {
Message.success("Success");
}
})
.catch(err => {
console.log("保存配置失败:", err);
Message.error("保存配置失败");
});
},
updateAlarmTableData(msg) {
const { OQADefect } = msg
if (OQADefect) {
if(this.ruleConfig.alarmReceivers.includes(this.currentUserId)){
this.alarmDataTable = duplicate(OQADefect, "PARAMS")
this.alarmDataTable.forEach(x => {
x.INSPECTION_TIME = this.rTime(x.INSPECTION_TIME);
});
this.$emit("alarmTableUpdated",this.alarmDataTable);
}
}
},
// 更新 查询的 报警数据
updateTotalAlarmData() {
request({
method: "post",
url: `/api/YEAutoAlarm?type=OQADefectCheckData`,
})
.then((res) => {
this.alarmDataTable = res.data;
this.$emit("alarmTableUpdated",this.alarmDataTable);
})
.catch((err) => {
console.log(err)
})
},
updateOperateDataTable() {
console.log("Oprate-Table-page")
this.getHistory()
},
// 查询 ReleaseLot 处置记录
getHistory() {
const data = {
beginTime: this.formInline.datePicker[0],
endTime: this.formInline.datePicker[1],
}
console.log("222", data)
request({
method: "post",
url: "/api/YEAutoAlarm?type=getOQADefectCheckRecord",
data,
})
.then((res) => {
if (res.status === 200) {
this.OperateDataTable = res.data
if (this.OperateDataTable.length > 0) {
this.OperateDataTable.forEach((x) => {
/* eslint-disable */
x.INSPECTION_TIME = this.rTime(x.INSPECTION_TIME)
x.LAST_UPDATE = this.rTime(x.LAST_UPDATE)
x.UPDATETIME = this.rTime(x.UPDATETIME)
/* eslint-enable */
});
}
console.log(
"Refres Ocap Record Data ->",
this.OperateDataTable.length
);
}
})
.catch(err => {
console.log(err);
});
},
getHistoryButton() {
const data = {
beginTime: this.formInline.datePicker[0],
endTime: this.formInline.datePicker[1]
};
console.log("222", data);
request({
method: "post",
url: "/api/YEAutoAlarm?type=getOQADefectCheckRecord",
data
})
.then(res => {
// console.log(res);
if (res.status === 200) {
this.OperateDataTable = res.data;
console.log("OperateDataTable", this.OperateDataTable);
let DataTableFilterLot = [];
if (
this.formInline.filterLot !== "" &&
this.OperateDataTable.length > 0
) {
console.log("hhh", this.formInline.filterLot);
DataTableFilterLot = this.OperateDataTable.filter(item => {
return item.LOT_ID === this.formInline.filterLot;
});
console.log("item", DataTableFilterLot);
} else {
DataTableFilterLot = this.OperateDataTable;
}
let DataTableFilterUser = [];
if (
this.formInline.filterUser !== "" &&
DataTableFilterLot.length > 0
) {
console.log("kkk", this.formInline.filterUser);
DataTableFilterUser = DataTableFilterLot.filter(item => {
return item.USERID === this.formInline.filterUser;
});
console.log("item2", DataTableFilterUser);
} else {
DataTableFilterUser = DataTableFilterLot;
}
console.log("this.OperateDataTable", DataTableFilterUser);
let DataTableFilterReason = [];
if (
this.formInline.filterReason !== "" &&
DataTableFilterUser.length > 0
) {
console.log("www", this.formInline.filterReason);
DataTableFilterReason = DataTableFilterUser.filter(item => {
return item.HANDLETYPE === this.formInline.filterReason;
});
console.log("item3", DataTableFilterUser);
} else {
DataTableFilterReason = DataTableFilterUser;
}
this.OperateDataTable = DataTableFilterReason;
if (
this.formInline.filterLot === "" &&
this.formInline.filterUser === "" &&
this.formInline.filterReason === ""
) {
this.OperateDataTable = res.data;
}
if (this.OperateDataTable.length > 0) {
this.OperateDataTable.forEach(x => {
/* eslint-disable */
x.INSPECTION_TIME = this.rTime(x.INSPECTION_TIME)
x.LAST_UPDATE = this.rTime(X.LAST_UPDATE)
x.UPDATETIME = this.rTime(x.UPDATETIME)
/* eslint-enable */
});
}
}
})
.catch(err => {
console.log(err);
});
},
changeTab() {},
currentChange(currentPage) {
// 获取u当前页数
this.currentPage = currentPage;
this.updateTotalAlarmData();
},
sizeChange(pageSize) {
this.multipleSelection = {};
// 更改条目数量
this.pageSize = pageSize;
this.currentPage = 1;
this.updateTotalAlarmData();
},
engineerPost(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
const rowData = this.selectList[0];
const submitData = {
rowData,
HANDLETYPE: this.form.isAlarm,
COMMENT: this.form.isComment,
USERID: this.userid
};
request({
method: "post",
url: "/api/YEAutoAlarm?type=OQADefectCheckHandle",
data: submitData
})
.then(res => {
// console.log(res);
if (res.status === 200) {
Message.success("提交成功");
this.updateTotalAlarmData(); // 处置后数据更新
this.updateOperateDataTable();
this.selectList = [];
}
})
.catch(err => {
console.log(err);
Message.error("发生未知错误,请稍后再试");
});
this.dialogFormVisible = false;
// alert("submit!");
} else {
console.log("error submit!!");
return false;
}
});
},
dateTimeToString(date) {
const y = date.getFullYear();
const M = date.getMonth() + 1;
const d = date.getDate();
const H = date.getHours();
const m = date.getMinutes();
const s = date.getSeconds();
const mm = M < 10 ? `0${M}` : M;
const dd = d < 10 ? `0${d}` : d;
const hh = H < 10 ? `0${H}` : H;
const mi = m < 10 ? `0${m}` : m;
const ss = s < 10 ? `0${s}` : s;
const str = `${y}-${mm}-${dd} ${hh}:${mi}:${ss}`;
return str;
},
// ISO格式time 转标准版
rTime(date) {
if (date) {
// "2022-09-11T16:27:40.000Z" -> "2022-09-12 00:27:40"
return this.dateTimeToString(new Date(Date.parse(date)));
}
return "";
},
numFliter(value) {
if (value !== undefined && value !== null) {
const Val = parseFloat(value).toFixed(1);
return Val;
}
},
selectChange(val) {
console.log(val);
this.selectList = val;
console.log("this.selectList", this.selectList);
this.handleType = this.ruleConfig.handleTypes.map(type => ({
label: type,
value: type
}));
},
engineerPostVisable() {
this.dialogFormVisible = true;
}
}
};
</script>
<style scoped>
.el-row {
margin-bottom: 20px;
}
.el-row:last-child {
margin-bottom: 0;
}
.el-table .warning-row {
background: rgb(201, 233, 192);
}
.el-table .success-row {
background: #f0f9eb;
}
.auto-alarm-page-main1 {
background: white;
}
.pagination {
display: flex;
flex-direction: row-reverse;
}
.alarm-data {
position: relative; /* 居中 */
display: flex;
justify-content: center;
align-items: center;
}
.alarm-data-table {
margin: 0px 5px;
overflow: auto;
}
#canvas-main {
width: 800px;
height: 400px;
font-size: 50px;
background: white;
}
.rule-config-card {
margin: 20px;
}
.el-divider {
margin: 25px 0;
}
</style>
if (type === "OQADefectCheckHandle") {
this.ctx.body = await ctx.service.yeAutoAlarm.OQADefectCheckHandledRecord();
}
if (type === "getOQADefectCheckRecord") {
this.ctx.body = await ctx.service.yeAutoAlarm.getOQADefectCheckRecord();
}
if (type === "getRuleConfig") {
this.ctx.body = await ctx.service.yeAutoAlarm.getOQADefectRule();
}
if (type === "saveRuleConfig") {
this.ctx.body = await ctx.service.yeAutoAlarm.saveOQADefectRule();
}
if (type === "getGrantedId") {
this.ctx.body = await ctx.service.yeAutoAlarm.getGrantedID();
}
public async getOQACheckData(){
//const data = this.ctx.request.body;
const sql =`select t2.lot_id,t2.inspection_time,t2.wafer_id,t2.device,t2.count
from(select coalesce(r.lotname,t1.lot_id) as lot_id,
t1.inspection_time,t2.recipe_id,t1.defects as count,t1.wafer_id,t1.device,t1.scan_area,
case when t1.defects/(t1.scan_area/POWER(10,14))>a.baseline then 1
else 0 end as alarm
from rpt.insp_wafer_summary t1
left join rpt.insp_recipe t2 on t1.recipe_key = t2.recipe_key
right join rpt.base_lot r on r.lotname = t1.lot_id and r.machinecapability = 'S-SFOSB-C'
left join espt_oqa_daily_alarms a on t2.recipe_id = a.newdevice1
where t1.inspection_time > (sysdate - 2)
) t2
where t2.alarm = 1
and t2.scan_area > 0
and t2.count is not null
and not exists (
select 1 from oqa_defect_check_handle oqa
where t2.lot_id = oqa.lot_id and t2.wafer_id = oqa.wafer_id and t2.device = oqa.device
)`;
return await this.ctx.service.oracleService.executeQuery("FA", sql);
}
public async OQADefectCheckHandledRecord() {
const data = this.ctx.request.body;
const { rowData, HANDLETYPE, COMMENT, USERID} = data;
console.log("OQA", data);
const {
DEVICE,
LOT_ID,
WAFER_ID,
INSPECTION_TIME,
COUNT
} = rowData
const insertRecordsql = `insert into oqa_defect_check_handle (
DEVICE,LOT_ID,WAFER_ID,INSPECTION_TIME,COUNT_DEFECTS,HANDLETYPE,HANDLE_COMMENT,USERID,UPDATETIME)
values ('${DEVICE || ''}','${LOT_ID || ''}','${WAFER_ID || ''}','${INSPECTION_TIME || ''}','${COUNT || ''}','${HANDLETYPE || ''}','${COMMENT || ''}','${USERID || ''}',sysdate)`
await this.ctx.service.oracleService.executeInsert(
"FA",
insertRecordsql
);
// }
// await this.getUpdateAlarm();
return { code: 0, message: "sucess" };
}
public async getOQADefectCheckRecord(){
const data = this.ctx.request.body;
const startTime = data.beginTime.replace(/-/g, '/');
const endTime = data.endTime.replace(/-/g, '/');
const sql =` select * from oqa_defect_check_handle
where updatetime > to_date('${startTime}','YYYY/MM/DD HH24:MI:SS')
and updatetime < to_date('${endTime}','YYYY/MM/DD HH24:MI:SS')`;
const record = await this.ctx.service.oracleService.executeQuery("FA", sql);
return record;
}
public async getOQADefectRule(){
const data = this.ctx.request.body;
const id = Object.keys(data)[0];
const sql =` select distinct * from oqa_defect_check_rule where rule_id = '${id}'`;
console.log("sql",sql);
const record = await this.ctx.service.oracleService.executeQuery("FA", sql);
console.log("getOQADefectRule", record);
return record;
}
public async getGrantedID(){
const sql =` select distinct * from oqa_defect_check_rule `;
const tmp = await this.ctx.service.oracleService.executeQuery("FA", sql);
console.log("tmptmptmp", tmp);
return tmp;
}
public async saveOQADefectRule(){
const data = this.ctx.request.body;
const { FREQ_AUTO, FREQ, RULE_ID, ALARM_ID} = data;
console.log("OQA", data);
const insertRecordsql = `insert into oqa_defect_check_rule (
DEVICE,LOT_ID,WAFER_ID,INSPECTION_TIME,COUNT_DEFECTS,HANDLETYPE,HANDLE_COMMENT,USERID,UPDATETIME)
values ('${FREQ_AUTO || ''}','${FREQ || ''}','${RULE_ID || ''}','${ALARM_ID || ''}')`
await this.ctx.service.oracleService.executeInsert(
"FA",
insertRecordsql
);
// }
// await this.getUpdateAlarm();
return { code: 0, message: "sucess" };
}
这是完整的代码,是否能定位原因
最新发布