opt: 套轴优先托盘有管芯、套轴看板优化、看板可直接恢复套轴计划、套轴计划过滤天数
This commit is contained in:
@@ -141,6 +141,13 @@
|
|||||||
.timeout-row-warning td {
|
.timeout-row-warning td {
|
||||||
color: #f8d7da !important;
|
color: #f8d7da !important;
|
||||||
}
|
}
|
||||||
|
.timeout-row-error {
|
||||||
|
background: #1dec12 !important;
|
||||||
|
color: #f8d7da;
|
||||||
|
}
|
||||||
|
.timeout-row-error td {
|
||||||
|
color: #0b0505 !important;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
@@ -346,6 +353,15 @@
|
|||||||
if (item.is_paper_ok === '2') {
|
if (item.is_paper_ok === '2') {
|
||||||
tzText = '已套轴';
|
tzText = '已套轴';
|
||||||
}
|
}
|
||||||
|
if (item.is_paper_ok === '3') {
|
||||||
|
tzText = '正在套轴';
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '4') {
|
||||||
|
tzText = '已下发套轴';
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '99') {
|
||||||
|
tzText = '套轴异常';
|
||||||
|
}
|
||||||
row.insertCell().textContent = tzText || 'N/A';
|
row.insertCell().textContent = tzText || 'N/A';
|
||||||
// 检查start_time是否超过2小时,并设置行样式
|
// 检查start_time是否超过2小时,并设置行样式
|
||||||
if (item.start_time) {
|
if (item.start_time) {
|
||||||
@@ -355,6 +371,9 @@
|
|||||||
row.classList.add('timeout-row-warning'); // 应用于整行
|
row.classList.add('timeout-row-warning'); // 应用于整行
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (item.is_paper_ok === '99') {
|
||||||
|
row.classList.add('timeout-row-error');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const row = tableBody.insertRow();
|
const row = tableBody.insertRow();
|
||||||
|
|||||||
507
lms/nladmin-system/doc/套轴点位日志记录实时看板v2.html
Normal file
507
lms/nladmin-system/doc/套轴点位日志记录实时看板v2.html
Normal file
@@ -0,0 +1,507 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>套轴点位日志记录实时看板</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #183a5c 0%, #274b7a 100%); /* 深科技蓝渐变背景 */
|
||||||
|
color: #cfd8e3; /* 浅灰蓝文本 */
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #ffffff; /* 亮蓝标题40a9ff */
|
||||||
|
text-align: center;
|
||||||
|
font-size: 2.5em;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
text-shadow: 0 2px 12px #274b7a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 1800px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-card {
|
||||||
|
background: #223a5c; /* 中深蓝卡片背景 */
|
||||||
|
border: 1px solid #40a9ff; /* 亮蓝边框 */
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
width: 45%;
|
||||||
|
min-height: 300px;
|
||||||
|
height: 350px; /* 新增:固定高度 */
|
||||||
|
box-shadow: 0 2px 16px rgba(64,169,255,0.12);
|
||||||
|
transition: transform 0.3s, box-shadow 0.3s;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-entries {
|
||||||
|
flex: 1;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 250px;
|
||||||
|
/* 美化滚动条 */
|
||||||
|
scrollbar-width: thin;
|
||||||
|
scrollbar-color: #40a9ff #223a5c;
|
||||||
|
}
|
||||||
|
.log-entries::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
.log-entries::-webkit-scrollbar-thumb {
|
||||||
|
background: linear-gradient(135deg, #40a9ff 0%, #274b7a 100%);
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
.log-entries::-webkit-scrollbar-track {
|
||||||
|
background: #223a5c;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
/* .device-card:hover {
|
||||||
|
transform: translateY(-5px) scale(1.02);
|
||||||
|
box-shadow: 0 0 30px #40a9ff;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.device-card h2 {
|
||||||
|
color: #ffffff;
|
||||||
|
border-bottom: 1px solid #274b7a;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
margin-top: 0;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-entry {
|
||||||
|
background: #274b7a;
|
||||||
|
color: #cfd8e3;
|
||||||
|
padding: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
border-left: 3px solid #40a9ff;
|
||||||
|
font-size: 0.95em;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container {
|
||||||
|
width: 95%;
|
||||||
|
max-width: 1800px;
|
||||||
|
background: #223a5c;
|
||||||
|
border: 1px solid #40a9ff;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 0 20px 20px 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
box-shadow: 0 2px 16px rgba(64,169,255,0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container h2 {
|
||||||
|
color: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 1.8em;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
color: #cfd8e3;
|
||||||
|
background: #274b7a;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #3b6ea5;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 0.95em;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background: linear-gradient(90deg, #274b7a 0%, #3b6ea5 100%);
|
||||||
|
color: #40a9ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:nth-child(odd) {
|
||||||
|
background: #223a5c;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:hover {
|
||||||
|
background: #3b6ea5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeout-row-warning {
|
||||||
|
background: #5c1a1a !important;
|
||||||
|
color: #f8d7da;
|
||||||
|
}
|
||||||
|
.timeout-row-warning td {
|
||||||
|
color: #f8d7da !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeout-row-error {
|
||||||
|
background: #1dec12 !important;
|
||||||
|
color: #f8d7da;
|
||||||
|
}
|
||||||
|
.timeout-row-error td {
|
||||||
|
color: #0b0505 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>套轴点位日志记录实时看板</h1>
|
||||||
|
<div class="dashboard-container">
|
||||||
|
<div class="device-card" id="device-B_CBJ01">
|
||||||
|
<h2>B_CBJ01<span id="tip-B_CBJ01" style="font-size:0.7em;color:#ffec3d;margin-left:12px;"></span></h2>
|
||||||
|
<!-- 添加tip2显示区域 -->
|
||||||
|
<div id="tip2-B_CBJ01" style="color:#ffec3d;font-size:0.9em;margin-bottom:10px;background:rgba(64,169,255,0.1);padding:5px;border-radius:4px;"></div>
|
||||||
|
<div class="log-entries">
|
||||||
|
<!-- 日志条目将在这里动态添加 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-card" id="device-B_CBJ02">
|
||||||
|
<h2>B_CBJ02<span id="tip-B_CBJ02" style="font-size:0.7em;color:#ffec3d;margin-left:12px;"></span></h2>
|
||||||
|
<!-- 添加tip2显示区域 -->
|
||||||
|
<div id="tip2-B_CBJ02" style="color:#ffec3d;font-size:0.9em;margin-bottom:10px;background:rgba(64,169,255,0.1);padding:5px;border-radius:4px;"></div>
|
||||||
|
<div class="log-entries">
|
||||||
|
<!-- 日志条目将在这里动态添加 -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 新增的表格容器 -->
|
||||||
|
<div class="table-container">
|
||||||
|
<h2>套轴监控系统实时数据</h2>
|
||||||
|
<table id="slitter-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>设备</th>
|
||||||
|
<th>子卷号</th>
|
||||||
|
<th>轴位置</th>
|
||||||
|
<th>气胀轴尺寸</th>
|
||||||
|
<th>气胀轴代数</th>
|
||||||
|
<th>气胀轴状态</th>
|
||||||
|
<th>呼叫时间</th>
|
||||||
|
<th>管芯规格</th>
|
||||||
|
<th>套轴标记</th>
|
||||||
|
<th>一键恢复</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="slitter-table-body">
|
||||||
|
<!-- 表格数据将在这里动态添加 -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const logApiUrl = 'http://10.1.3.91:8013/api/wms/apply/v2/tzInfo';
|
||||||
|
const devices = ['B_CBJ01', 'B_CBJ02'];
|
||||||
|
const refreshInterval = 5000; // 刷新间隔统一为5秒
|
||||||
|
|
||||||
|
async function fetchLogData(deviceCode) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(logApiUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ device_code: deviceCode }),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
console.error(`HTTP error response for ${deviceCode} (log):`, errorText);
|
||||||
|
throw new Error(`HTTP error! status: ${response.status} for ${deviceCode} (log). Response: ${errorText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseText = await response.text();
|
||||||
|
if (!responseText) {
|
||||||
|
console.warn(`Empty response received for ${deviceCode} (log)`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(responseText);
|
||||||
|
return data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Error parsing JSON for ${deviceCode} (log):`, e);
|
||||||
|
console.error(`Raw response text for ${deviceCode} (log):`, responseText);
|
||||||
|
throw new Error(`Failed to parse JSON response for ${deviceCode} (log). Raw text: ${responseText.substring(0, 100)}...`);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error fetching log data for ${deviceCode}:`, error);
|
||||||
|
return [`获取 ${deviceCode} 日志数据失败: ${error.message}`];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayLogData(deviceCode, data) {
|
||||||
|
const deviceElement = document.getElementById(`device-${deviceCode}`);
|
||||||
|
if (!deviceElement) {
|
||||||
|
console.error(`Element with ID 'device-${deviceCode}' not found.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const logEntriesContainer = deviceElement.querySelector('.log-entries');
|
||||||
|
logEntriesContainer.innerHTML = '';
|
||||||
|
|
||||||
|
if (Array.isArray(data) && data.length > 0) {
|
||||||
|
data.forEach(entry => {
|
||||||
|
const logEntryDiv = document.createElement('div');
|
||||||
|
logEntryDiv.classList.add('log-entry');
|
||||||
|
logEntryDiv.textContent = entry;
|
||||||
|
logEntriesContainer.appendChild(logEntryDiv);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const noDataEntry = document.createElement('div');
|
||||||
|
noDataEntry.classList.add('log-entry');
|
||||||
|
noDataEntry.textContent = '暂无日志信息。';
|
||||||
|
logEntriesContainer.appendChild(noDataEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateLogDashboard() {
|
||||||
|
for (const device of devices) {
|
||||||
|
const data = await fetchLogData(device);
|
||||||
|
displayLogData(device, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增表格数据相关逻辑
|
||||||
|
const tableApiUrl = 'http://127.0.0.1:9999/api/pda/slitter/showManualView';
|
||||||
|
|
||||||
|
async function fetchTableData() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(tableApiUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
project: "套轴监控系统",
|
||||||
|
timestamp: Date.now() // 使用当前时间戳
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorText = await response.text();
|
||||||
|
console.error('HTTP error response for table data:', errorText);
|
||||||
|
throw new Error(`HTTP error! status: ${response.status} for table data. Response: ${errorText}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const responseText = await response.text();
|
||||||
|
if (!responseText) {
|
||||||
|
console.warn('Empty response received for table data');
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const data = JSON.parse(responseText);
|
||||||
|
return data;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error parsing JSON for table data:', e);
|
||||||
|
console.error('Raw response text for table data:', responseText);
|
||||||
|
throw new Error(`Failed to parse JSON response for table data. Raw text: ${responseText.substring(0, 100)}...`);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching table data:', error);
|
||||||
|
// 可以选择在表格中显示错误信息
|
||||||
|
const tableBody = document.getElementById('slitter-table-body');
|
||||||
|
if (tableBody) {
|
||||||
|
tableBody.innerHTML = `<tr><td colspan="7">获取表格数据失败: ${error.message}</td></tr>`;
|
||||||
|
}
|
||||||
|
return []; // 返回空数组以避免后续处理错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displayTableData(data) {
|
||||||
|
const tableBody = document.getElementById('slitter-table-body');
|
||||||
|
if (!tableBody) {
|
||||||
|
console.error("Element with ID 'slitter-table-body' not found.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tableBody.innerHTML = ''; // 清空旧数据
|
||||||
|
|
||||||
|
if (Array.isArray(data) && data.length > 0) {
|
||||||
|
data.forEach(item => {
|
||||||
|
const row = tableBody.insertRow();
|
||||||
|
row.insertCell().textContent = item.resource_name || 'N/A';
|
||||||
|
row.insertCell().textContent = item.container_name || 'N/A';
|
||||||
|
row.insertCell().textContent = item.up_or_down === '1' ? '上' : (item.up_or_down === '2' ? '下' : item.up_or_down || 'N/A');
|
||||||
|
row.insertCell().textContent = item.qzz_size || 'N/A';
|
||||||
|
row.insertCell().textContent = item.qzz_generation || 'N/A';
|
||||||
|
|
||||||
|
let statusText = '已完成';
|
||||||
|
if (item.status === '01') {
|
||||||
|
statusText = '准备套轴';
|
||||||
|
} else if (item.status === '02') {
|
||||||
|
statusText = '正在配送';
|
||||||
|
} else if (item.status === '03') {
|
||||||
|
statusText = '配送完成';
|
||||||
|
} else if (item.status) {
|
||||||
|
statusText = '已完成';
|
||||||
|
}
|
||||||
|
row.insertCell().textContent = statusText;
|
||||||
|
|
||||||
|
const startTimeCell = row.insertCell();
|
||||||
|
startTimeCell.textContent = item.start_time || 'N/A';
|
||||||
|
|
||||||
|
row.insertCell().textContent = item.tube || 'N/A';
|
||||||
|
|
||||||
|
let tzText = '未套轴';
|
||||||
|
if (item.is_paper_ok === '2') {
|
||||||
|
tzText = '已套轴';
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '3') {
|
||||||
|
tzText = '正在套轴';
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '4') {
|
||||||
|
tzText = '已下发套轴';
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '99') {
|
||||||
|
tzText = '套轴异常';
|
||||||
|
}
|
||||||
|
row.insertCell().textContent = tzText || 'N/A';
|
||||||
|
|
||||||
|
// 添加恢复按钮
|
||||||
|
const recoverCell = row.insertCell();
|
||||||
|
const recoverBtn = document.createElement('button');
|
||||||
|
recoverBtn.className = 'recover-btn';
|
||||||
|
recoverBtn.textContent = '恢复';
|
||||||
|
recoverBtn.disabled = item.is_paper_ok !== '99';
|
||||||
|
recoverBtn.onclick = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch('http://10.1.3.91:8013/api/wms/apply/recover', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
container_name: item.container_name
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
const alertDiv = document.createElement('div');
|
||||||
|
alertDiv.style.position = 'fixed';
|
||||||
|
alertDiv.style.top = '50%';
|
||||||
|
alertDiv.style.left = '50%';
|
||||||
|
alertDiv.style.transform = 'translate(-50%, -50%)';
|
||||||
|
alertDiv.style.padding = '20px 40px';
|
||||||
|
alertDiv.style.background = 'linear-gradient(135deg, #40a9ff 0%, #096dd9 100%)';
|
||||||
|
alertDiv.style.color = 'white';
|
||||||
|
alertDiv.style.borderRadius = '8px';
|
||||||
|
alertDiv.style.boxShadow = '0 4px 16px rgba(0,0,0,0.3)';
|
||||||
|
alertDiv.style.zIndex = '1000';
|
||||||
|
alertDiv.textContent = '恢复成功';
|
||||||
|
document.body.appendChild(alertDiv);
|
||||||
|
setTimeout(() => alertDiv.remove(), 2000);
|
||||||
|
// 刷新数据
|
||||||
|
updateTableDashboard();
|
||||||
|
} else {
|
||||||
|
throw new Error('恢复失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error:', error);
|
||||||
|
alert('恢复失败:' + error.message);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
recoverCell.appendChild(recoverBtn);
|
||||||
|
|
||||||
|
// 检查start_time是否超过2小时,并设置行样式
|
||||||
|
if (item.start_time) {
|
||||||
|
const startTime = new Date(item.start_time.replace(/-/g, '/'));
|
||||||
|
const twoHoursAgo = new Date(Date.now() - 2 * 60 * 60 * 1000);
|
||||||
|
if (startTime < twoHoursAgo) {
|
||||||
|
row.classList.add('timeout-row-warning'); // 应用于整行
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (item.is_paper_ok === '99') {
|
||||||
|
row.classList.add('timeout-row-error'); // 应用于整行
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const row = tableBody.insertRow();
|
||||||
|
const cell = row.insertCell();
|
||||||
|
cell.colSpan = 7;
|
||||||
|
cell.textContent = '暂无数据。';
|
||||||
|
cell.style.textAlign = 'center';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function updateTableDashboard() {
|
||||||
|
const data = await fetchTableData();
|
||||||
|
displayTableData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增:获取tip并显示在标题后
|
||||||
|
const tipApiUrl = 'http://10.1.3.91:8013/api/wms/apply/v2/tzTaskINfo';
|
||||||
|
async function fetchAndDisplayTip(deviceCode) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(tipApiUrl, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ device_code: deviceCode })
|
||||||
|
});
|
||||||
|
let tip = '';
|
||||||
|
let tip2 = '';
|
||||||
|
if (response.ok) {
|
||||||
|
const data = await response.json();
|
||||||
|
tip = data.tip || '';
|
||||||
|
tip2 = data.tip2 || '';
|
||||||
|
|
||||||
|
// 显示tip2在对应设备标题下方
|
||||||
|
document.getElementById('tip2-' + deviceCode).textContent = tip2;
|
||||||
|
}
|
||||||
|
document.getElementById('tip-' + deviceCode).textContent = tip;
|
||||||
|
} catch (e) {
|
||||||
|
document.getElementById('tip-' + deviceCode).textContent = '';
|
||||||
|
document.getElementById('tip2-' + deviceCode).textContent = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function updateAllTips() {
|
||||||
|
devices.forEach(device => fetchAndDisplayTip(device));
|
||||||
|
}
|
||||||
|
// 初始加载tip
|
||||||
|
updateAllTips();
|
||||||
|
// 定时刷新tip
|
||||||
|
setInterval(updateAllTips, refreshInterval);
|
||||||
|
|
||||||
|
// 初始加载数据
|
||||||
|
updateLogDashboard();
|
||||||
|
updateTableDashboard();
|
||||||
|
|
||||||
|
// 定时刷新数据
|
||||||
|
setInterval(updateLogDashboard, refreshInterval);
|
||||||
|
setInterval(updateTableDashboard, refreshInterval); // 表格也使用相同的刷新间隔
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<style>
|
||||||
|
.recover-btn {
|
||||||
|
background: linear-gradient(135deg, #40a9ff 0%, #096dd9 100%);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 0.9em;
|
||||||
|
transition: all 0.3s;
|
||||||
|
box-shadow: 0 2px 8px rgba(64,169,255,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.recover-btn:hover {
|
||||||
|
background: linear-gradient(135deg, #69c0ff 0%, #40a9ff 100%);
|
||||||
|
box-shadow: 0 4px 12px rgba(64,169,255,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.recover-btn:disabled {
|
||||||
|
background: #274b7a;
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -164,6 +164,7 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
.anyMatch(prefix -> p.getResource_name().startsWith(prefix)) &&
|
.anyMatch(prefix -> p.getResource_name().startsWith(prefix)) &&
|
||||||
checkComputationPoint(p, empty) && checkHasTask(p))
|
checkComputationPoint(p, empty) && checkHasTask(p))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
log.info("SQL查询后过滤区域、是否有套过轴的数据:{}", plans);
|
||||||
if (plans.size() == 0) {
|
if (plans.size() == 0) {
|
||||||
stepErrorInfo.add("找不到需要套轴的信息,只做拔轴。");
|
stepErrorInfo.add("找不到需要套轴的信息,只做拔轴。");
|
||||||
// 如果不需要套轴,就只做拔轴
|
// 如果不需要套轴,就只做拔轴
|
||||||
@@ -173,7 +174,7 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
// 过滤相比当前时间大于1小时
|
// 过滤相比当前时间大于1小时
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
LocalDateTime cutoffTime = LocalDateTime.now().minusHours(1);
|
LocalDateTime cutoffTime = LocalDateTime.now().minusHours(1);
|
||||||
List<SlitterPlanDistinctDto> filteredList = planAll.stream()
|
List<SlitterPlanDistinctDto> filteredList = plans.stream()
|
||||||
.filter(p -> {
|
.filter(p -> {
|
||||||
try {
|
try {
|
||||||
LocalDateTime startTime = LocalDateTime.parse(p.getStart_time(), formatter);
|
LocalDateTime startTime = LocalDateTime.parse(p.getStart_time(), formatter);
|
||||||
@@ -183,7 +184,6 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<PdmBiSlittingproductionplan> filterCheckPlans = null;
|
|
||||||
if (filteredList.size() > 0) {
|
if (filteredList.size() > 0) {
|
||||||
log.info("过滤时间之后的数据:{}", filteredList);
|
log.info("过滤时间之后的数据:{}", filteredList);
|
||||||
// 获取当前三个位置的所有管芯信息
|
// 获取当前三个位置的所有管芯信息
|
||||||
@@ -193,18 +193,13 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
.map(MdPbPapervehicle::getMaterial_code)
|
.map(MdPbPapervehicle::getMaterial_code)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
// 获取所有dto中的分切计划信息
|
if (tubeCodes.size() > 0) {
|
||||||
List<String> parents = filteredList.stream()
|
// 获取所有dto中的分切计划信息
|
||||||
.map(SlitterPlanDistinctDto::getParent_container_name)
|
List<SlitterPlanDistinctDto> filteredListT = getSlitterPlanByTubesDtos(filteredList, papers, tubeCodes);
|
||||||
.distinct()
|
if (CollectionUtil.isNotEmpty(filteredListT)) {
|
||||||
.collect(Collectors.toList());
|
plans = filteredListT;
|
||||||
List<PdmBiSlittingproductionplan> checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
}
|
||||||
.in(PdmBiSlittingproductionplan::getParent_container_name, parents)
|
}
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
|
||||||
filterCheckPlans = checkPlans.stream()
|
|
||||||
.filter(p -> tubeCodes.contains("1".equals(p.getPaper_tube_or_FRP()) ? p.getPaper_tube_material() : p.getFRP_material()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("获取过滤后的分切计划数据:{}", JSON.toJSONString(plans));
|
log.info("获取过滤后的分切计划数据:{}", JSON.toJSONString(plans));
|
||||||
@@ -291,10 +286,6 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||||
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||||
}
|
}
|
||||||
// 如果过滤出来的需要套轴的信息,则直接获取
|
|
||||||
if (CollectionUtil.isNotEmpty(filterCheckPlans)) {
|
|
||||||
needPlans = filterCheckPlans;
|
|
||||||
}
|
|
||||||
log.info("通过dto获取的分切计划:{}", needPlans);
|
log.info("通过dto获取的分切计划:{}", needPlans);
|
||||||
// 获取其中一条
|
// 获取其中一条
|
||||||
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
|
PdmBiSlittingproductionplan needPlan = needPlans.get(0);
|
||||||
@@ -417,6 +408,42 @@ public class AutoCallAirShaftTask extends Prun {
|
|||||||
stepStr += ",97";
|
stepStr += ",97";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SlitterPlanDistinctDto> getSlitterPlanByTubesDtos(List<SlitterPlanDistinctDto> filteredList
|
||||||
|
, List<MdPbPapervehicle> papers
|
||||||
|
, List<String> tubeCodes) {
|
||||||
|
List<SlitterPlanDistinctDto> filteredListT;
|
||||||
|
filteredListT = filteredList.stream().filter(dto -> {
|
||||||
|
List<PdmBiSlittingproductionplan> checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.eq(PdmBiSlittingproductionplan::getResource_name, dto.getResource_name())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getParent_container_name, dto.getParent_container_name())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getUp_or_down, dto.getUp_or_down())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getSplit_group, dto.getSplit_group())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||||
|
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||||
|
if (checkPlans.size() == 0) {
|
||||||
|
// 可能是改切,所以换成restruct_container_name来使用
|
||||||
|
checkPlans = slittingproductionplanService.list(new LambdaQueryWrapper<PdmBiSlittingproductionplan>()
|
||||||
|
.eq(PdmBiSlittingproductionplan::getResource_name, dto.getResource_name())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getRestruct_container_name, dto.getParent_container_name())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getUp_or_down, dto.getUp_or_down())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getSplit_group, dto.getSplit_group())
|
||||||
|
.eq(PdmBiSlittingproductionplan::getIs_delete, SlitterConstant.SLITTER_NO)
|
||||||
|
.eq(PdmBiSlittingproductionplan::getIs_paper_ok, SlitterConstant.SLITTER_YES));
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isEmpty(checkPlans)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
List<String> needTubes = checkPlans.stream().map(p -> {
|
||||||
|
if ("1".equals(p.getPaper_tube_or_FRP())) {
|
||||||
|
return p.getPaper_tube_material();
|
||||||
|
}
|
||||||
|
return p.getFRP_material();
|
||||||
|
}).distinct().collect(Collectors.toList());
|
||||||
|
return SlitterTaskUtil.containsAllTubes(tubeCodes, needTubes, papers);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return filteredListT;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是不是有空位置
|
* 判断是不是有空位置
|
||||||
* @param planD
|
* @param planD
|
||||||
|
|||||||
@@ -52,4 +52,11 @@ public class SlitterController {
|
|||||||
public ResponseEntity<Object> tzTaskINfo(@RequestBody JSONObject entity){
|
public ResponseEntity<Object> tzTaskINfo(@RequestBody JSONObject entity){
|
||||||
return new ResponseEntity<>(slitterService.tzTaskINfo(entity), HttpStatus.OK);
|
return new ResponseEntity<>(slitterService.tzTaskINfo(entity), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/recover")
|
||||||
|
@Log("恢复计划")
|
||||||
|
@SaIgnore
|
||||||
|
public ResponseEntity<Object> recover(@RequestBody JSONObject entity){
|
||||||
|
slitterService.recover(entity);
|
||||||
|
return new ResponseEntity<>( HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,8 @@
|
|||||||
p.is_paper_ok,
|
p.is_paper_ok,
|
||||||
MIN(p.start_time) AS start_time,
|
MIN(p.start_time) AS start_time,
|
||||||
IF(p.paper_tube_or_FRP = '1', p.paper_tube_description, p.FRP_description) AS tube,
|
IF(p.paper_tube_or_FRP = '1', p.paper_tube_description, p.FRP_description) AS tube,
|
||||||
MIN(p.`status`) AS `status`
|
MIN(p.`status`) AS `status`,
|
||||||
|
MAX(p.qzzno) AS qzzno
|
||||||
FROM `pdm_bi_slittingproductionplan` p
|
FROM `pdm_bi_slittingproductionplan` p
|
||||||
WHERE p.`status` <![CDATA[ < ]]> '09'
|
WHERE p.`status` <![CDATA[ < ]]> '09'
|
||||||
AND p.is_delete = '0'
|
AND p.is_delete = '0'
|
||||||
|
|||||||
@@ -46,4 +46,5 @@ public class CallPlanViewVO implements Serializable {
|
|||||||
private String qzz_generation;
|
private String qzz_generation;
|
||||||
private String start_time;
|
private String start_time;
|
||||||
private String is_paper_ok;
|
private String is_paper_ok;
|
||||||
|
private String qzzno;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
import org.nl.b_lms.bst.ivt.cutpointivt.service.dao.BstIvtCutpointivt;
|
||||||
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
import org.nl.b_lms.sch.tasks.slitter.mapper.dto.CallPlanViewVO;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -371,4 +372,6 @@ public interface SlitterService {
|
|||||||
JSONObject cutCacheInventory(JSONObject param);
|
JSONObject cutCacheInventory(JSONObject param);
|
||||||
|
|
||||||
JSONObject tzTaskINfo(JSONObject entity);
|
JSONObject tzTaskINfo(JSONObject entity);
|
||||||
|
|
||||||
|
void recover(JSONObject param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import org.nl.common.utils.SecurityUtils;
|
|||||||
import org.nl.common.utils.TaskUtils;
|
import org.nl.common.utils.TaskUtils;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.RedisUtils;
|
import org.nl.modules.common.utils.RedisUtils;
|
||||||
import org.nl.modules.wql.WQL;
|
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.system.service.notice.ISysNoticeService;
|
import org.nl.system.service.notice.ISysNoticeService;
|
||||||
import org.nl.system.service.param.ISysParamService;
|
import org.nl.system.service.param.ISysParamService;
|
||||||
@@ -2323,11 +2322,38 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CallPlanViewVO> showManualView(JSONObject param) {
|
public List<CallPlanViewVO> showManualView(JSONObject param) {
|
||||||
|
// 获取穿拔轴点位数据
|
||||||
|
List<BstIvtShafttubeivt> shaftPoints = shafttubeivtService.getAllByPointType("2", true);
|
||||||
Param useXn = paramService.findByCode(USE_XN);
|
Param useXn = paramService.findByCode(USE_XN);
|
||||||
|
List<CallPlanViewVO> callPlanViewVOS;
|
||||||
if (ObjectUtil.isNotEmpty(useXn) && "1".equals(useXn.getValue())) {
|
if (ObjectUtil.isNotEmpty(useXn) && "1".equals(useXn.getValue())) {
|
||||||
return slitterMapper.showManualView();
|
callPlanViewVOS = slitterMapper.showManualView();
|
||||||
|
} else {
|
||||||
|
callPlanViewVOS = slitterMapper.showManualViewNoXn();
|
||||||
}
|
}
|
||||||
return slitterMapper.showManualViewNoXn();
|
for (CallPlanViewVO callPlanViewVO : callPlanViewVOS) {
|
||||||
|
if ("2".equals(callPlanViewVO.getIs_paper_ok())) {
|
||||||
|
// 已下发
|
||||||
|
callPlanViewVO.setIs_paper_ok("4");
|
||||||
|
for (BstIvtShafttubeivt shaftPoint : shaftPoints) {
|
||||||
|
if (shaftPoint.getContainer_name1().equals(callPlanViewVO.getContainer_name())
|
||||||
|
|| shaftPoint.getContainer_name2().equals(callPlanViewVO.getContainer_name())) {
|
||||||
|
// 正在套轴
|
||||||
|
callPlanViewVO.setIs_paper_ok("3");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!"3".equals(callPlanViewVO.getIs_paper_ok()) && ObjectUtil.isNotEmpty(callPlanViewVO.getQzzno())) {
|
||||||
|
// 已套轴
|
||||||
|
callPlanViewVO.setIs_paper_ok("2");
|
||||||
|
}
|
||||||
|
if (!"3".equals(callPlanViewVO.getIs_paper_ok())
|
||||||
|
&& ObjectUtil.isEmpty(callPlanViewVO.getQzzno())) {
|
||||||
|
callPlanViewVO.setIs_paper_ok("99");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return callPlanViewVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -2818,6 +2844,23 @@ public class SlitterServiceImpl implements SlitterService {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void recover(JSONObject param) {
|
||||||
|
// container_name
|
||||||
|
String containerName = param.getString("container_name");
|
||||||
|
List<BstIvtShafttubeivt> shaftPoints = shafttubeivtService.getAllByPointType("2", true);
|
||||||
|
for (BstIvtShafttubeivt shaftPoint : shaftPoints) {
|
||||||
|
if (shaftPoint.getContainer_name1().equals(containerName)
|
||||||
|
|| shaftPoint.getContainer_name2().equals(containerName)) {
|
||||||
|
throw new BadRequestException("请使用手持并且与电气初始化");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<PdmBiSlittingproductionplan> lam = new LambdaUpdateWrapper<>();
|
||||||
|
lam.set(PdmBiSlittingproductionplan::getIs_paper_ok, "1")
|
||||||
|
.eq(PdmBiSlittingproductionplan::getContainer_name, containerName);
|
||||||
|
slittingproductionplanService.update(lam);
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getRedisListValue(String key) {
|
public List<String> getRedisListValue(String key) {
|
||||||
List<String> stepTipLogs = (List<String>) redisUtils.get(key);
|
List<String> stepTipLogs = (List<String>) redisUtils.get(key);
|
||||||
if (CollectionUtil.isEmpty(stepTipLogs)) {
|
if (CollectionUtil.isEmpty(stepTipLogs)) {
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -529,4 +526,32 @@ public class SlitterTaskUtil {
|
|||||||
}
|
}
|
||||||
log.info("分切下卷计划位置校验通过!");
|
log.info("分切下卷计划位置校验通过!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断管芯行家对接位是否有所需的管芯、并且数量是符合的。
|
||||||
|
* @param tubeCodes
|
||||||
|
* @param needTubes
|
||||||
|
* @param papers
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean containsAllTubes(List<String> tubeCodes, List<String> needTubes, List<MdPbPapervehicle> papers) {
|
||||||
|
Set<String> tubeSet = new HashSet<>(tubeCodes);
|
||||||
|
for (String tube : needTubes) {
|
||||||
|
if (!tubeSet.contains(tube)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int num = 0;
|
||||||
|
for (String needTube : needTubes) {
|
||||||
|
for (MdPbPapervehicle paper : papers) {
|
||||||
|
if (needTube.equals(paper.getMaterial_code())) {
|
||||||
|
num += paper.getQty().intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (num == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user