opt: 加急工单
This commit is contained in:
547
lms/nladmin-system/doc/套轴点位日志记录实时看板v3.html
Normal file
547
lms/nladmin-system/doc/套轴点位日志记录实时看板v3.html
Normal file
@@ -0,0 +1,547 @@
|
||||
<!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: #8B0000 !important; /* 红色背景 */
|
||||
color: #ffffff;
|
||||
}
|
||||
.timeout-row-warning td {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.timeout-row-error {
|
||||
background: #FFC107 !important; /* 黄色背景 */
|
||||
color: #000000;
|
||||
}
|
||||
.timeout-row-error td {
|
||||
color: #000000 !important;
|
||||
}
|
||||
|
||||
/* 添加颜色图例样式 */
|
||||
.color-legend {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-bottom: 15px;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.color-box {
|
||||
display: inline-block;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-right: 8px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.red-box {
|
||||
background-color: #8B0000;
|
||||
}
|
||||
|
||||
.yellow-box {
|
||||
background-color: #FFC107;
|
||||
}
|
||||
|
||||
</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>
|
||||
<!-- 添加颜色图例 -->
|
||||
<div class="color-legend">
|
||||
<span class="legend-item"><span class="color-box red-box"></span>呼叫超过2小时</span>
|
||||
<span class="legend-item"><span class="color-box yellow-box"></span>存在异常</span>
|
||||
</div>
|
||||
<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>
|
||||
// API URL 配置
|
||||
const BASE_URL = 'http://localhost:9999';
|
||||
const API_CONFIG = {
|
||||
logApiUrl: `${BASE_URL}/api/wms/apply/v2/tzInfo`,
|
||||
tableApiUrl: `${BASE_URL}/api/pda/slitter/showManualView`,
|
||||
recoverApiUrl: `${BASE_URL}/api/wms/apply/recover`,
|
||||
tipApiUrl: `${BASE_URL}/api/wms/apply/v2/tzTaskINfo`
|
||||
};
|
||||
|
||||
const refreshInterval = 5000; // 刷新间隔统一为5秒
|
||||
const devices = ['B_CBJ01', 'B_CBJ02'];
|
||||
|
||||
async function fetchLogData(deviceCode) {
|
||||
try {
|
||||
const response = await fetch(API_CONFIG.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);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增表格数据相关逻辑
|
||||
async function fetchTableData() {
|
||||
try {
|
||||
const response = await fetch(API_CONFIG.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(API_CONFIG.recoverApiUrl, {
|
||||
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并显示在标题后
|
||||
async function fetchAndDisplayTip(deviceCode) {
|
||||
try {
|
||||
const response = await fetch(API_CONFIG.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>
|
||||
@@ -10,14 +10,16 @@
|
||||
up_or_down,
|
||||
qzz_size,
|
||||
qzz_generation,
|
||||
start_time
|
||||
start_time,
|
||||
manufacture_sort
|
||||
FROM (SELECT p.resource_name,
|
||||
p.parent_container_name,
|
||||
p.split_group,
|
||||
p.up_or_down,
|
||||
p.qzz_size,
|
||||
p.qzz_generation,
|
||||
MIN(p.start_time) AS start_time
|
||||
MIN(p.start_time) AS start_time,
|
||||
MAX(p.manufacture_sort) AS manufacture_sort
|
||||
FROM `pdm_bi_slittingproductionplan` p
|
||||
WHERE p.`status` = '01'
|
||||
AND p.is_child_tz_ok = '0'
|
||||
@@ -25,9 +27,11 @@
|
||||
AND p.is_delete = '0'
|
||||
AND IFNULL(p.up_or_down, '') <![CDATA[ <> ]]> ''
|
||||
AND IFNULL(p.left_or_right, '') <![CDATA[ <> ]]> ''
|
||||
AND DATE (p.start_time) >= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
|
||||
AND IFNULL(p.parent_container_name, '') <![CDATA[ <> ]]> ''
|
||||
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
||||
AND DATE (p.start_time)
|
||||
>= DATE_SUB(CURDATE(), INTERVAL #{day} DAY)
|
||||
AND IFNULL(p.parent_container_name
|
||||
, '') <![CDATA[ <> ]]> ''
|
||||
AND '1' = ( SELECT c.is_used FROM st_ivt_cutpointivt c WHERE c.ext_code = p.resource_name )
|
||||
GROUP BY
|
||||
p.resource_name,
|
||||
p.parent_container_name,
|
||||
@@ -42,7 +46,8 @@
|
||||
p.up_or_down,
|
||||
p.qzz_size,
|
||||
p.qzz_generation,
|
||||
MIN(p.start_time) AS start_time
|
||||
MIN(p.start_time) AS start_time,
|
||||
MAX(p.manufacture_sort) AS manufacture_sort
|
||||
FROM `pdm_bi_slittingproductionplan` p
|
||||
WHERE p.`status` = '01'
|
||||
AND p.is_child_tz_ok = '0'
|
||||
@@ -64,7 +69,7 @@
|
||||
p.qzz_generation
|
||||
) AS combined_data
|
||||
ORDER BY
|
||||
start_time,split_group
|
||||
manufacture_sort DESC, start_time, split_group
|
||||
</select>
|
||||
<select id="getAllHalfPlan" resultType="org.nl.b_lms.sch.tasks.slitter.mapper.dto.SlitterPlanDistinctDto">
|
||||
WITH RankedData AS (
|
||||
|
||||
@@ -322,6 +322,12 @@ public interface SlitterService {
|
||||
*/
|
||||
JSONObject urgentPlan(JSONObject param);
|
||||
|
||||
/**
|
||||
* 批量加急
|
||||
* @param whereJson
|
||||
*/
|
||||
JSONObject urgentBatchPlan(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 子卷下料2
|
||||
* @param param
|
||||
|
||||
@@ -2422,12 +2422,12 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
PdmBiSlittingproductionplan plan = slittingproductionplanService.getById(workorder_id);
|
||||
log.info("当前加急送轴的计划为:{}", plan);
|
||||
if (!"01".equals(plan.getStatus())) {
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
|
||||
res.put("message", "加急失败,当前计划正在套轴!");
|
||||
return res;
|
||||
}
|
||||
if (!"P1".equals(plan.getManufacture_sort())) {
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
|
||||
res.put("message", "加急失败,当前计划已加急过一次!");
|
||||
return res;
|
||||
}
|
||||
@@ -2443,12 +2443,38 @@ public class SlitterServiceImpl implements SlitterService {
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("message", "加急成功!");
|
||||
} else {
|
||||
res.put("status", HttpStatus.HTTP_OK);
|
||||
res.put("status", HttpStatus.HTTP_BAD_REQUEST);
|
||||
res.put("message", "加急失败,请刷新再试!");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject urgentBatchPlan(JSONObject whereJson) {
|
||||
JSONArray data = whereJson.getJSONArray("data");
|
||||
int success = 0;
|
||||
int fail = 0;
|
||||
JSONArray failInfo = new JSONArray();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject json = data.getJSONObject(i);
|
||||
JSONObject urgentPlan = urgentPlan(json);
|
||||
if (HttpStatus.HTTP_BAD_REQUEST == urgentPlan.getInteger("status")) {
|
||||
fail++;
|
||||
JSONObject p = new JSONObject();
|
||||
p.put(json.getString("container_name"), urgentPlan.getString("message"));
|
||||
failInfo.add(p);
|
||||
} else {
|
||||
success++;
|
||||
}
|
||||
}
|
||||
JSONObject res = new JSONObject();
|
||||
res.put("success", success);
|
||||
res.put("fail", fail);
|
||||
res.put("total", data.size());
|
||||
res.put("failInfo", failInfo);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject downRolls2(JSONObject param) {
|
||||
log.info("下卷2的输入参数为:{}", param);
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.b_lms.pdm.bi.slittingproductionplan.service.IPdmBiSlittingproductionplanService;
|
||||
import org.nl.b_lms.sch.tasks.slitter.service.SlitterService;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.wms.pdm.service.SlittingproductionplanService;
|
||||
import org.nl.wms.pdm.service.dto.SlittingproductionplanDto;
|
||||
@@ -30,6 +31,7 @@ public class SlittingproductionplanController {
|
||||
private final SlittingproductionplanService slittingproductionplanService;
|
||||
|
||||
private final IPdmBiSlittingproductionplanService biSlittingproductionplanService;
|
||||
private final SlitterService slitterService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询分切计划")
|
||||
@@ -111,4 +113,9 @@ public class SlittingproductionplanController {
|
||||
biSlittingproductionplanService.setDirection(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("加急")
|
||||
@PostMapping("/urgentPlan")
|
||||
public ResponseEntity<Object> urgentPlan(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(slitterService.urgentBatchPlan(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,6 +321,18 @@
|
||||
>
|
||||
设置右卷
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
v-permission="['urgent']"
|
||||
class="filter-item"
|
||||
type="danger"
|
||||
icon="el-icon-warning-outline"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length < 1"
|
||||
@click="urgentPlan"
|
||||
>
|
||||
加急
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="1200px">
|
||||
@@ -488,7 +500,7 @@
|
||||
<el-table-column v-if="false" prop="workorder_id" label="分切计划标识" />
|
||||
<el-table-column prop="status" label="状态" :formatter="formatStatusName" />
|
||||
<el-table-column prop="order_type" label="订单类型" :formatter="formatTypeName" />
|
||||
<el-table-column prop="mfg_order_name" label="订单号" min-width="200" >
|
||||
<el-table-column prop="mfg_order_name" label="订单号" min-width="200">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="primary" @click="toView2(scope.$index, scope.row)">{{ scope.row.mfg_order_name }}</el-link>
|
||||
</template>
|
||||
@@ -724,6 +736,68 @@ export default {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
})
|
||||
},
|
||||
urgentPlan() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = {
|
||||
'data': _selectData
|
||||
}
|
||||
crudSlittingproductionplan.urgentPlan(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
if (res.failInfo.length == 0) {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
} else {
|
||||
this.$notify({
|
||||
title: '操作结果',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: this.buildNotificationContent(res),
|
||||
duration: 0,
|
||||
offset: 50,
|
||||
customClass: 'custom-notify'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
buildNotificationContent(data) {
|
||||
console.log('通知数据:', data)
|
||||
|
||||
// 第一行:统计信息
|
||||
const stats = `<div>总数:${data.total},成功:${data.success},失败:${data.fail}</div>`
|
||||
|
||||
// 第二行:失败信息表格
|
||||
let tableHtml = ''
|
||||
|
||||
if (data.failInfo && Object.keys(data.failInfo).length > 0) {
|
||||
// 创建表头
|
||||
const headers = `<tr style="background-color: #f5f5f5;">
|
||||
<th style="padding: 5px; text-align: left;">卷号</th>
|
||||
<th style="padding: 5px; text-align: left;">信息</th>
|
||||
</tr>`
|
||||
|
||||
// 创建表格行
|
||||
const rows = Object.values(data.failInfo).flatMap(errorObj => {
|
||||
return Object.entries(errorObj).map(([volumeNo, errorMsg]) => {
|
||||
return `<tr>
|
||||
<td style="padding: 5px; border: 1px solid #ddd;">${volumeNo}</td>
|
||||
<td style="padding: 5px; border: 1px solid #ddd;">${errorMsg}</td>
|
||||
</tr>`
|
||||
})
|
||||
}).join('')
|
||||
|
||||
tableHtml = `
|
||||
<div style="margin-top: 10px;">
|
||||
<div>失败信息:</div>
|
||||
<table border="1" style="border-collapse: collapse; width: 100%; margin-top: 5px;">
|
||||
${headers}
|
||||
${rows}
|
||||
</table>
|
||||
</div>
|
||||
`
|
||||
} else {
|
||||
tableHtml = '<div style="margin-top: 10px;">无失败信息</div>'
|
||||
}
|
||||
|
||||
return `${stats}${tableHtml}`
|
||||
},
|
||||
inFinish() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = {
|
||||
@@ -810,5 +884,4 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@@ -71,6 +71,14 @@ export function setDirection(data) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function urgentPlan(data) {
|
||||
return request({
|
||||
url: 'api/slittingproductionplan/urgentPlan',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
export function updates(data) {
|
||||
return request({
|
||||
url: 'api/slittingproductionplan',
|
||||
@@ -79,4 +87,4 @@ export function updates(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, upMaterFinish, caseFinish, sendFinish, inFinish, compelFinish, setDirection, updates }
|
||||
export default { add, edit, del, upMaterFinish, caseFinish, sendFinish, inFinish, compelFinish, setDirection, updates, urgentPlan }
|
||||
|
||||
Reference in New Issue
Block a user