|
|
|
@ -178,6 +178,58 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div v-show="!historyChartLoading && hasHistoryData" ref="inventoryChartRef" class="chart" style="height: 450px;"></div>
|
|
|
|
<div v-show="!historyChartLoading && hasHistoryData" ref="inventoryChartRef" class="chart" style="height: 450px;"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 转移概率表格 -->
|
|
|
|
|
|
|
|
<div v-if="currentDialogTransitionData && currentDialogTransitionData.current_specification_transitions" class="transition-probability-section" style="margin-top: 20px;">
|
|
|
|
|
|
|
|
<div class="section-header">
|
|
|
|
|
|
|
|
<h4>转移概率分析 - {{ currentWmsModel }} - {{ currentWmsSpecification }}</h4>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="transition-info" style="margin-bottom: 15px; padding: 10px; background-color: #f5f7fa; border-radius: 4px; font-size: 14px;">
|
|
|
|
|
|
|
|
<div v-if="currentDialogTransitionData.input_parameters">
|
|
|
|
|
|
|
|
<strong>输入参数:</strong>
|
|
|
|
|
|
|
|
设备: {{ currentDialogTransitionData.input_parameters.equipment_code }} |
|
|
|
|
|
|
|
|
轴数: {{ currentDialogTransitionData.input_parameters.axle_number }} |
|
|
|
|
|
|
|
|
当前规格: {{ currentDialogTransitionData.input_parameters.specification }}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="currentDialogTransitionData.prediction" style="margin-top: 5px;">
|
|
|
|
|
|
|
|
<strong>预测:</strong>
|
|
|
|
|
|
|
|
最可能转移至: {{ currentDialogTransitionData.prediction.most_likely_next_spec }}
|
|
|
|
|
|
|
|
({{ (currentDialogTransitionData.prediction.probability * 100).toFixed(1) }}%)
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table
|
|
|
|
|
|
|
|
:data="getTransitionProbabilityTableData()"
|
|
|
|
|
|
|
|
style="width: 100%; margin-top: 10px;"
|
|
|
|
|
|
|
|
border
|
|
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<el-table-column prop="targetSpec" label="目标规格" width="100" />
|
|
|
|
|
|
|
|
<el-table-column prop="probability" label="转移概率" width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<span>{{ (scope.row.probability * 100).toFixed(1) }}%</span>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column prop="count" label="历史次数" width="100" />
|
|
|
|
|
|
|
|
<el-table-column prop="percentage" label="占比">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<div style="display: flex; align-items: center;">
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
|
|
width: (scope.row.probability * 100).toFixed(1) + '%',
|
|
|
|
|
|
|
|
height: '20px',
|
|
|
|
|
|
|
|
backgroundColor: getProbabilityColor(scope.row.probability, '#409EFF'),
|
|
|
|
|
|
|
|
marginRight: '8px',
|
|
|
|
|
|
|
|
borderRadius: '2px'
|
|
|
|
|
|
|
|
}"
|
|
|
|
|
|
|
|
></div>
|
|
|
|
|
|
|
|
<span>{{ (scope.row.probability * 100).toFixed(1) }}%</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</el-dialog>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -265,10 +317,28 @@ const handleFilterChange = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 方法:获取转移概率表格数据
|
|
|
|
|
|
|
|
const getTransitionProbabilityTableData = () => {
|
|
|
|
|
|
|
|
if (!currentDialogTransitionData.value || !currentDialogTransitionData.value.current_specification_transitions) {
|
|
|
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const transitions = currentDialogTransitionData.value.current_specification_transitions;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Object.entries(transitions).map(([targetSpec, data]) => ({
|
|
|
|
|
|
|
|
targetSpec,
|
|
|
|
|
|
|
|
probability: data.probability,
|
|
|
|
|
|
|
|
count: data.count
|
|
|
|
|
|
|
|
})).sort((a, b) => b.probability - a.probability); // 按概率降序排列
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// WMS对话框相关状态
|
|
|
|
// WMS对话框相关状态
|
|
|
|
const wmsDialogVisible = ref(false)
|
|
|
|
const wmsDialogVisible = ref(false)
|
|
|
|
const currentWmsModel = ref('')
|
|
|
|
const currentWmsModel = ref('')
|
|
|
|
const currentWmsSpecification = ref('')
|
|
|
|
const currentWmsSpecification = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 当前对话框的转移概率数据
|
|
|
|
|
|
|
|
const currentDialogTransitionData = ref(null)
|
|
|
|
const wmsTableRef = ref(null)
|
|
|
|
const wmsTableRef = ref(null)
|
|
|
|
|
|
|
|
|
|
|
|
// 图表相关状态
|
|
|
|
// 图表相关状态
|
|
|
|
@ -1097,8 +1167,8 @@ const handleCellClick = async (row, column, cell, event) => {
|
|
|
|
}, DBL_CLICK_DELAY);
|
|
|
|
}, DBL_CLICK_DELAY);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 方法:处理单元格双击事件 - 显示WMS详情
|
|
|
|
// 方法:处理单元格双击事件 - 显示WMS详情和转移概率
|
|
|
|
const handleCellDblClick = (row, column, cell, event) => {
|
|
|
|
const handleCellDblClick = async (row, column, cell, event) => {
|
|
|
|
// 清除单击事件的延时器,防止双击时触发单击逻辑
|
|
|
|
// 清除单击事件的延时器,防止双击时触发单击逻辑
|
|
|
|
if (clickTimeoutId) {
|
|
|
|
if (clickTimeoutId) {
|
|
|
|
clearTimeout(clickTimeoutId);
|
|
|
|
clearTimeout(clickTimeoutId);
|
|
|
|
@ -1151,6 +1221,56 @@ const handleCellDblClick = (row, column, cell, event) => {
|
|
|
|
|
|
|
|
|
|
|
|
// 获取库存历史数据
|
|
|
|
// 获取库存历史数据
|
|
|
|
fetchInventoryHistoryData(model, row.specification, wire_disc);
|
|
|
|
fetchInventoryHistoryData(model, row.specification, wire_disc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取转移概率数据(用于表格显示)
|
|
|
|
|
|
|
|
const keyWithSpec = `${columnKey}::${row.specification}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取对应的机台信息和轴数
|
|
|
|
|
|
|
|
let equipmentCode = 'QB002'; // 默认值
|
|
|
|
|
|
|
|
let axleNumber = '左边'; // 默认值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uidProductionStatusMap.value.has(keyWithSpec)) {
|
|
|
|
|
|
|
|
const status = uidProductionStatusMap.value.get(keyWithSpec);
|
|
|
|
|
|
|
|
equipmentCode = status.equipment_code || 'QB002';
|
|
|
|
|
|
|
|
axleNumber = status.axle_number || '左边';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('双击事件获取转移概率参数:', {
|
|
|
|
|
|
|
|
equipmentCode,
|
|
|
|
|
|
|
|
axleNumber,
|
|
|
|
|
|
|
|
model,
|
|
|
|
|
|
|
|
specification: row.specification,
|
|
|
|
|
|
|
|
wireDisc: formatWireDisc(wire_disc || '')
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否已经获取过该单元格的转移概率数据
|
|
|
|
|
|
|
|
if (transitionProbabilitiesMap.value.has(keyWithSpec)) {
|
|
|
|
|
|
|
|
console.log('双击事件:该单元格的转移概率数据已存在');
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取转移概率数据
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
const transitionData = await fetchTransitionProbabilities(
|
|
|
|
|
|
|
|
equipmentCode,
|
|
|
|
|
|
|
|
axleNumber,
|
|
|
|
|
|
|
|
model,
|
|
|
|
|
|
|
|
row.specification,
|
|
|
|
|
|
|
|
formatWireDisc(wire_disc || '')
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (transitionData && transitionData.current_specification_transitions) {
|
|
|
|
|
|
|
|
// 存储转移概率数据
|
|
|
|
|
|
|
|
const transitionsKey = `${columnKey}::${row.specification}`;
|
|
|
|
|
|
|
|
transitionProbabilitiesMap.value.set(transitionsKey, transitionData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置当前对话框的转移概率数据
|
|
|
|
|
|
|
|
currentDialogTransitionData.value = transitionData;
|
|
|
|
|
|
|
|
console.log('双击事件:转移概率数据已存储到对话框表格:', transitionData);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
|
|
console.error('双击事件:获取转移概率数据失败:', error);
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 获取销量数据
|
|
|
|
// 获取销量数据
|
|
|
|
@ -1706,6 +1826,9 @@ const handleDialogClose = () => {
|
|
|
|
historyData.value = [];
|
|
|
|
historyData.value = [];
|
|
|
|
hasHistoryData.value = false;
|
|
|
|
hasHistoryData.value = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 清空当前对话框的转移概率数据
|
|
|
|
|
|
|
|
currentDialogTransitionData.value = null;
|
|
|
|
|
|
|
|
|
|
|
|
// 移除窗口大小变化监听器
|
|
|
|
// 移除窗口大小变化监听器
|
|
|
|
window.removeEventListener('resize', resizeInventoryChart);
|
|
|
|
window.removeEventListener('resize', resizeInventoryChart);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|