Dockerfile 部署

This commit is contained in:
hjq
2026-06-22 14:34:23 +08:00
parent 2b461c2aea
commit e751d53362
4 changed files with 299 additions and 73 deletions

View File

@@ -375,15 +375,11 @@ def get_bom_reconciliation():
try:
start_date = request.args.get('start')
end_date = request.args.get('end')
match_type = request.args.get('match_type', 'official')
sys.path.insert(0, str(BROWSER_LOGIN_DIR))
from analysis_service import MaterialReconciliationService
service = MaterialReconciliationService()
data = service.step3_bom_reconciliation(start_date, end_date)
# 支持前端筛选
status_filter = request.args.get('status', '')
if status_filter:
data = [r for r in data if r['status'] == status_filter]
data = service.step3_bom_reconciliation(start_date, end_date, match_type)
return jsonify({"total": len(data), "rows": data})
except Exception as e:

View File

@@ -123,8 +123,7 @@
<el-button type="success" icon="el-icon-download" @click="exportReconData" size="small" style="margin-left: auto;">导出 Excel</el-button>
</div>
<el-table :data="pagedReconData" v-loading="loadingRecon" border style="width: 100%" stripe size="small" :header-cell-style="{background:'#f5f7fa',color:'#606266'}">
<el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
<el-table :data="pagedReconData" v-loading="loadingRecon" row-key="id" :tree-props="{children: 'children', hasChildren: 'hasChildren'}" border style="width: 100%" stripe size="small" :header-cell-style="{background:'#f5f7fa',color:'#606266'}">
<el-table-column prop="sfc" label="工单号 (SFC)" width="150" sortable></el-table-column>
<el-table-column prop="material_code" label="物料代码" width="120"></el-table-column>
<el-table-column prop="material_name" label="物料名称" min-width="180" show-overflow-tooltip></el-table-column>
@@ -132,17 +131,17 @@
<el-table-column label="发料对比" align="center">
<el-table-column prop="bom_qty" label="BOM 应发量" width="110" align="right">
<template slot-scope="scope">
<span v-text="Number(scope.row.bom_qty).toFixed(4)"></span>
<span v-if="scope.row.bom_qty !== ''" v-text="Number(scope.row.bom_qty).toFixed(4)"></span>
</template>
</el-table-column>
<el-table-column prop="actual_qty" label="实际发料量" width="110" align="right">
<template slot-scope="scope">
<span style="font-weight: bold;" v-text="Number(scope.row.actual_qty).toFixed(4)"></span>
<span v-if="scope.row.actual_qty !== ''" style="font-weight: bold;" v-text="Number(scope.row.actual_qty).toFixed(4)"></span>
</template>
</el-table-column>
<el-table-column prop="diff_qty" label="差异数量 (实-应)" width="130" align="right">
<template slot-scope="scope">
<span :style="{
<span v-if="scope.row.diff_qty !== ''" :style="{
color: scope.row.diff_qty > 0 ? '#F56C6C' : (scope.row.diff_qty < 0 ? '#E6A23C' : '#67C23A'),
fontWeight: 'bold'
}" v-text="(scope.row.diff_qty > 0 ? '+' : '') + Number(scope.row.diff_qty).toFixed(4)">
@@ -153,7 +152,7 @@
<el-table-column prop="status" label="状态" width="120" align="center" sortable>
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.status)" effect="dark" size="small" v-text="scope.row.status"></el-tag>
<el-tag v-if="scope.row.status && scope.row.status !== '-'" :type="getStatusType(scope.row.status)" effect="dark" size="small" v-text="scope.row.status"></el-tag>
</template>
</el-table-column>
</el-table>
@@ -181,7 +180,7 @@
el: '#app',
data() {
return {
activeTab: 'unmatched',
activeTab: 'official',
matching: false,
dateRange: { start: '-', end: '-' },
dateRangeSelect: [],
@@ -224,16 +223,34 @@
filteredReconData() {
let data = this.reconData;
if (this.reconStatusFilter) {
data = data.filter(item => item.status === this.reconStatusFilter);
}
if (this.reconSearch) {
const keyword = this.reconSearch.toLowerCase();
data = data.filter(item =>
(item.sfc && item.sfc.toLowerCase().includes(keyword)) ||
(item.material_name && item.material_name.toLowerCase().includes(keyword)) ||
(item.material_code && item.material_code.toLowerCase().includes(keyword))
);
if (this.reconSearch || this.reconStatusFilter) {
const keyword = this.reconSearch ? this.reconSearch.toLowerCase() : '';
const statusFilter = this.reconStatusFilter;
// 辅助函数:递归检查节点及其子节点是否匹配条件
const checkNode = (node) => {
let match = true;
if (keyword) {
match = match && (
(node.sfc && node.sfc.toLowerCase().includes(keyword)) ||
(node.material_code && node.material_code.toLowerCase().includes(keyword)) ||
(node.material_name && node.material_name.toLowerCase().includes(keyword))
);
}
if (statusFilter) {
match = match && (node.status === statusFilter);
}
if (match) return true;
// 如果当前节点不匹配,检查是否有子节点匹配
if (node.children && node.children.length > 0) {
return node.children.some(child => checkNode(child));
}
return false;
};
data = data.filter(row => checkNode(row));
}
return data;
},
@@ -382,22 +399,30 @@
});
},
exportReconData() {
// 简单的前端 CSV 导出
const headers = ['工单号(SFC)', '物料代码', '物料名称', 'BOM应发量', '实际发料量', '差异数量', '状态'];
// 简单的前端 CSV 导出(支持树形结构展开)
const headers = ['层级', '工单号(SFC)', '物料代码', '物料名称', 'BOM应发量', '实际发料量', '差异数量', '状态'];
let csvContent = "data:text/csv;charset=utf-8,\uFEFF" + headers.join(",") + "\n";
this.filteredReconData.forEach(row => {
const processRow = (node, level = 0) => {
const indent = " ".repeat(level);
const rowData = [
row.sfc,
row.material_code,
`"${row.material_name || ''}"`,
row.bom_qty,
row.actual_qty,
row.diff_qty,
row.status
level,
node.sfc || '',
node.material_code || '',
`"${indent}${node.material_name || ''}"`,
node.bom_qty !== '' ? node.bom_qty : '',
node.actual_qty !== '' ? node.actual_qty : '',
node.diff_qty !== '' ? node.diff_qty : '',
node.status || ''
];
csvContent += rowData.join(",") + "\n";
});
if (node.children && node.children.length > 0) {
node.children.forEach(child => processRow(child, level + 1));
}
};
this.filteredReconData.forEach(row => processRow(row, 0));
const encodedUri = encodeURI(csvContent);
const link = document.createElement("a");