feat(报表): 优化各工序报表的损耗数据获取逻辑

将getLossList方法改为异步方式,同时获取酸轧/镀锌和分条工序的数据
合并两个工序的数据后再查询钢卷信息,提高数据完整性和准确性
添加updateBy参数区分不同工序的管理员
This commit is contained in:
砂糖
2026-03-02 10:50:47 +08:00
parent 2aeb19a685
commit 141d39263f
10 changed files with 389 additions and 287 deletions

View File

@@ -63,9 +63,10 @@
<el-descriptions-item label="异常率">{{ summary.abRate }}</el-descriptions-item>
</el-descriptions>
<!-- 异常统计 -->
<!-- 异常统计 -->
<el-descriptions title="异常统计" :column="4" border>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value }}</el-descriptions-item>
<el-descriptions-item v-for="item in abSummary" :key="item.label" :label="item.label">{{ item.value
}}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
@@ -268,7 +269,7 @@ export default {
summary() {
return calcSummary(this.list, this.lossList)
},
abSummary() {
abSummary() {
return calcAbSummary(this.list)
}
},
@@ -312,36 +313,46 @@ export default {
this.loading = false
})
},
getLossList() {
async getLossList() {
this.loading = true
listPendingAction({
const res1 = await listPendingAction({
actionType: 11, // 酸轧工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
}).then(res => {
const actions = res.rows
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
const res2 = await listPendingAction({
// actionStatus: 2,
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 200, // 分条工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
updateBy: 'suanzhakuguan',
})
const actions = res1.rows.concat(res2.rows)
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
},
// 导出

View File

@@ -334,36 +334,46 @@ export default {
this.loading = false
})
},
getLossList() {
async getLossList() {
this.loading = true
listPendingAction({
const res1 = await listPendingAction({
actionType: 11, // 酸轧工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
}).then(res => {
const actions = res.rows
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
const res2 = await listPendingAction({
// actionStatus: 2,
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 200, // 分条工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
updateBy: 'suanzhakuguan',
})
const actions = res1.rows.concat(res2.rows)
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
},
// 导出

View File

@@ -389,36 +389,46 @@ export default {
this.loading = false
})
},
getLossList() {
async getLossList() {
this.loading = true
listPendingAction({
const res1 = await listPendingAction({
actionType: 11, // 酸轧工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
}).then(res => {
const actions = res.rows
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.list = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
const res2 = await listPendingAction({
// actionStatus: 2,
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 200, // 分条工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
updateBy: 'suanzhakuguan',
})
const actions = res1.rows.concat(res2.rows)
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
},
// 导出

View File

@@ -318,36 +318,46 @@ export default {
this.loading = false
})
},
getLossList() {
async getLossList() {
this.loading = true
listPendingAction({
const res1 = await listPendingAction({
actionType: 11, // 酸轧工序
pageSize: 9999,
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
}).then(res => {
const actions = res.rows
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
const res2 = await listPendingAction({
// actionStatus: 2,
warehouseId: this.queryParams.planId,
// actionType: 401,
actionType: 200, // 分条工序
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
updateBy: 'suanzhakuguan',
})
const actions = res1.rows.concat(res2.rows)
const coilIds = actions.map(item => item.coilId).join(',')
console.log(coilIds)
if (!coilIds) {
this.$message({
message: '暂无数据',
type: 'warning',
})
this.lossList = []
this.loading = false
return
}
listCoilWithIds({
...this.queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
coilIds: coilIds,
}).then(res => {
this.lossList = res.rows
this.loading = false
})
},
// 导出