feat(wms): 新增分条报表配置及功能优化

- 添加分条报表相关配置及视图组件
- 优化标签打印尺寸及布局
- 增加实测厚度字段及相关展示逻辑
- 重构报表数据获取逻辑,统一处理异常情况
- 完善分条操作表单,增加异常信息管理
This commit is contained in:
砂糖
2026-03-26 15:13:08 +08:00
parent 281f86ca8c
commit a389a98664
22 changed files with 349 additions and 163 deletions

View File

@@ -103,3 +103,14 @@ export const zincConfig = {
{ value: '2019583137616310273', label: '退货库' },
],
}
export const splitConfig = {
actionTypes: [506],
warehouseOptions: [
{ value: '1988150210872930306', label: '酸连轧分条成品' },
{ value: '1988150800092950529', label: '退火分条成品' },
{ value: '1988150380649967617', label: '镀锌分条成品' },
{ value: '1988151027466170370', label: '拉矫分条成品' },
]
}

View File

@@ -2,6 +2,7 @@ import { listCoilWithIds } from "@/api/wms/coil";
import {
listPendingAction,
} from '@/api/wms/pendingAction';
import { Message } from 'element-ui'
export async function fetchOutputList(queryParams) {
const resList = await Promise.all([
@@ -39,9 +40,9 @@ export async function fetchOutputList(queryParams) {
export async function fetchLossList(actionTypes, queryParams) {
const resultList = await Promise.all(actionTypes.map(actionType => {
return listPendingAction({
...queryParams,
actionStatus: 2,
actionType,
createBy: queryParams.createBy,
startTime: queryParams.byCreateTimeStart,
endTime: queryParams.byCreateTimeEnd,
pageSize: 99999,
@@ -52,16 +53,17 @@ export async function fetchLossList(actionTypes, queryParams) {
const actionIds = actions.map(item => item.actionId).join(',')
console.log(actionIds)
if (!actionIds) {
this.$message({
Message({
message: '暂无数据',
type: 'warning',
})
throw new Error('暂无数据')
return []
}
const res = await listCoilWithIds({
...queryParams,
byCreateTimeStart: undefined,
byCreateTimeEnd: undefined,
createBy: undefined,
actionIds: actionIds,
pageSize: 99999,
pageNum: 1,

View File

@@ -0,0 +1,25 @@
<template>
<ComprehensiveTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import ComprehensiveTemplate from '@/views/wms/report/template/comprehensive.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'ComprehensiveReport',
components: {
ComprehensiveTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,26 @@
<template>
<DayTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import DayTemplate from '@/views/wms/report/template/day.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'LossReport',
components: {
DayTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<LossTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
></LossTemplate>
</template>
<script>
import LossTemplate from '@/views/wms/report/template/loss.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'LossReport',
components: {
LossTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,25 @@
<template>
<MonthTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import MonthTemplate from '@/views/wms/report/template/month.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'MonthReport',
components: {
MonthTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,23 @@
<template>
<OutTemplate
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import OutTemplate from "@/views/wms/report/template/out.vue";
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'ZhaTemplate',
components: {
OutTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,25 @@
<template>
<TeamTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import TeamTemplate from '@/views/wms/report/template/team.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'TeamReport',
components: {
TeamTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -0,0 +1,25 @@
<template>
<YearTemplate
:actionTypes="actionTypes"
:actionQueryParams="actionQueryParams"
:baseQueryParams="baseQueryParams"
:warehouseOptions="warehouseOptions"
/>
</template>
<script>
import YearTemplate from '@/views/wms/report/template/year.vue'
import { splitConfig } from '@/views/wms/report/js/config.js'
export default {
name: 'YearReport',
components: {
YearTemplate,
},
data() {
return {
...splitConfig,
}
}
}
</script>

View File

@@ -130,6 +130,7 @@ import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
import { calcSummary, calcAbSummary, calcMSummary } from "@/views/wms/report/js/calc";
import ColumnsSetting from "@/views/wms/report/components/setting/columns.vue";
import CoilTable from "@/views/wms/report/components/coilTable/index.vue";
import { fetchLossList, fetchOutputList } from "@/views/wms/report/js/fetch";
export default {
name: 'DayTemplate',
@@ -255,86 +256,20 @@ export default {
},
// 统一查询入口(兼容回车和按钮点击)
handleQuery() {
this.getList()
// this.getLossList()
},
// 核心查询逻辑
getList() {
this.loading = true
Promise.all([
listCoilWithIds({
selectType: 'raw_material',
itemType: 'raw_material',
warehouseIds: this.warehouseIds.join(','),
fetchLossList(this.actionTypes, {
...this.queryParams,
...this.actionQueryParams
}),
fetchOutputList({
...this.queryParams,
...this.baseQueryParams,
}),
listCoilWithIds({
selectType: 'product',
itemType: 'product',
warehouseIds: this.warehouseIds.join(','),
...this.queryParams,
...this.baseQueryParams,
}),
]).then((resList) => {
console.log(resList)
const list = resList.flatMap(res => res.rows)
// 按照createTime 降序排序
this.list = list.sort(
(a, b) => new Date(b.createTime) - new Date(a.createTime)
).map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
this.getLossList()
})
},
async getLossList() {
this.loading = true
const resultList = await Promise.all(this.actionTypes.map(actionType => {
return listPendingAction({
actionStatus: 2,
warehouseId: this.queryParams.planId,
actionType,
pageSize: 9999,
pageNum: 1,
startTime: this.queryParams.byCreateTimeStart,
endTime: this.queryParams.byCreateTimeEnd,
...this.actionQueryParams,
})
}))
const actions = resultList.flatMap(item => item.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.map(item => {
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
const [thickness, width] = item.specification.split('*')
return {
...item,
computedThickness: parseFloat(thickness),
computedWidth: parseFloat(width),
}
})
]).then(([lossList, outputList]) => {
this.lossList = lossList
this.list = outputList
this.loading = false
})
},
@@ -359,8 +294,7 @@ export default {
},
},
mounted() {
this.getList()
// this.getLossList()
this.handleQuery()
this.loadColumns()
}
}