feat(wms): 新增钢卷报表功能并添加导出接口

- 新增三个报表页面:发货报表、收货报表和ZHA报表
- 添加钢卷数据导出API接口
- 在钢卷拆分页面添加备注字段
- 清理base.vue中的多余空行
This commit is contained in:
砂糖
2026-01-09 19:06:21 +08:00
parent 8f89ff3b10
commit 90c81fbee0
6 changed files with 397 additions and 2 deletions

View File

@@ -163,4 +163,15 @@ export function listCoilOperation({coilIds, planId}) {
pageSize: 1000
}
})
}
// 钢卷导出
export function exportCoilData(coilIds) {
return request({
url: '/wms/materialCoil/export',
method: 'post',
data: {
coilIds
}
})
}

View File

@@ -278,8 +278,6 @@ import MutiSelect from "@/components/MutiSelect";
import html2canvas from 'html2canvas';
import { PDFDocument } from 'pdf-lib';
export default {
name: "MaterialCoil",
components: {

View File

@@ -199,6 +199,9 @@
<ActualWarehouseSelect v-model="item.actualWarehouseId" placeholder="请选择真实库区" block
:disabled="readonly" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="item.remark" placeholder="请输入备注" :disabled="readonly"/>
</el-form-item>
</el-form>
</div>
</div>

View File

@@ -0,0 +1,113 @@
<template>
<div class="app-container" v-loading="loading">
<el-row>
<!-- 筛选区 -->
开始时间<el-date-picker v-model="queryParams.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间"></el-date-picker>
结束时间<el-date-picker v-model="queryParams.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间"></el-date-picker>
<el-button type="primary" style="margin-left: 10px;" @click="getList">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button>
</el-row>
<el-descriptions title="统计信息" :column="3" border>
<el-descriptions-item label="总钢卷数量">{{ summary.totalCount }}</el-descriptions-item>
<el-descriptions-item label="总重">{{ summary.totalWeight }}t</el-descriptions-item>
<el-descriptions-item label="均重">{{ summary.avgWeight }}t</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<el-table :data="list" border height="calc(100vh - 320px)">
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
<el-table-column label="产品类型" align="center" width="250">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
</template>
</el-table-column>
<el-table-column label="长度 (米)" align="center" prop="length" />
<el-table-column label="发货时间" align="center" prop="exportTime" />
<el-table-column label="更新人" align="center" prop="updateByName" />
</el-table>
</div>
</template>
<script>
import { listMaterialCoil } from "@/api/wms/coil";
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
export default {
components: {
ProductInfo,
RawMaterialInfo,
CoilNo,
},
data() {
// 获取昨天0点到今天0点的时间范围
const now = new Date()
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000)
const startTime = yesterday.toISOString().slice(0, 10) + ' 00:00:00'
const endTime = now.toISOString().slice(0, 10) + ' 00:00:00'
return {
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
status: 1,
startTime: startTime,
endTime: endTime,
},
loading: false,
}
},
computed: {
summary() {
// 总钢卷数量、总重、均重
const totalCount = this.list.length
const totalWeight = this.list.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
const avgWeight = totalCount > 0 ? (totalWeight / totalCount).toFixed(2) : 0
return {
totalCount,
totalWeight,
avgWeight,
}
}
},
methods: {
getList() {
this.loading = true
listMaterialCoil({
...this.queryParams
}).then(res => {
this.list = res.rows
this.loading = false
})
},
// 导出
exportData() {
this.download('wms/materialCoil/export', {
coilIds: this.list.map(item => item.coilId).join(',')
}, `materialCoil_${new Date().getTime()}.xlsx`)
},
},
mounted() {
this.getList()
}
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,135 @@
<template>
<div class="app-container" v-loading="loading">
<el-row>
<!-- 筛选区 -->
开始时间<el-date-picker v-model="queryParams.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间"></el-date-picker>
结束时间<el-date-picker v-model="queryParams.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间"></el-date-picker>
<el-button type="primary" style="margin-left: 10px;" @click="getList">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button>
</el-row>
<el-descriptions title="统计信息" :column="3" border>
<el-descriptions-item label="总钢卷数量">{{ summary.totalCount }}</el-descriptions-item>
<el-descriptions-item label="总重">{{ summary.totalWeight.toFixed(2) }}t</el-descriptions-item>
<el-descriptions-item label="均重">{{ summary.avgWeight }}t</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<el-table :data="list" border height="calc(100vh - 320px)">
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
<el-table-column label="产品类型" align="center" width="250">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
</template>
</el-table-column>
<el-table-column label="长度 (米)" align="center" prop="length" />
<el-table-column label="更新人" align="center" prop="updateByName" />
</el-table>
</div>
</template>
<script>
import { listMaterialCoil } from "@/api/wms/coil";
import {
listPendingAction,
} from '@/api/wms/pendingAction';
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
export default {
components: {
ProductInfo,
RawMaterialInfo,
CoilNo,
},
data() {
// 获取昨天0点到今天0点的时间范围
const now = new Date()
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000)
const startTime = yesterday.toISOString().slice(0, 10) + ' 00:00:00'
const endTime = yesterday.toISOString().slice(0, 10) + ' 23:59:59'
return {
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
status: 1,
startTime: startTime,
endTime: endTime,
},
loading: false,
}
},
computed: {
summary() {
// 总钢卷数量、总重、均重
const totalCount = this.list.length
const totalWeight = this.list.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
const avgWeight = totalCount > 0 ? (totalWeight / totalCount).toFixed(2) : 0
return {
totalCount,
totalWeight,
avgWeight,
}
}
},
methods: {
getList() {
this.loading = true
listPendingAction({
// actionStatus: 2,
actionType: 401,
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.startTime,
endTime: this.queryParams.endTime,
}).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.loading = false
return
}
listMaterialCoil({
coilIds: coilIds,
}).then(res => {
this.list = res.rows
this.loading = false
})
})
},
// 导出
exportData() {
this.download('wms/materialCoil/export', {
coilIds: this.list.map(item => item.coilId).join(',')
}, `materialCoil_${new Date().getTime()}.xlsx`)
},
},
mounted() {
this.getList()
}
}
</script>
<style scoped></style>

View File

@@ -0,0 +1,135 @@
<template>
<div class="app-container" v-loading="loading">
<el-row>
<!-- 筛选区 -->
开始时间<el-date-picker v-model="queryParams.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择开始时间"></el-date-picker>
结束时间<el-date-picker v-model="queryParams.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择结束时间"></el-date-picker>
<el-button type="primary" style="margin-left: 10px;" @click="getList">查询</el-button>
<el-button type="primary" @click="exportData">导出</el-button>
</el-row>
<el-descriptions title="统计信息" :column="3" border>
<el-descriptions-item label="总钢卷数量">{{ summary.totalCount }}</el-descriptions-item>
<el-descriptions-item label="总重">{{ summary.totalWeight.toFixed(2) }}t</el-descriptions-item>
<el-descriptions-item label="均重">{{ summary.avgWeight }}t</el-descriptions-item>
</el-descriptions>
<el-descriptions title="明细信息" :column="3" border>
</el-descriptions>
<el-table :data="list" border height="calc(100vh - 320px)">
<el-table-column label="入场钢卷号" align="center" prop="enterCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.enterCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="当前钢卷号" align="center" prop="currentCoilNo">
<template slot-scope="scope">
<coil-no :coil-no="scope.row.currentCoilNo"></coil-no>
</template>
</el-table-column>
<el-table-column label="逻辑库位" align="center" prop="warehouseName" />
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" />
<el-table-column label="产品类型" align="center" width="250">
<template slot-scope="scope">
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row.product" />
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row.rawMaterial" />
</template>
</el-table-column>
<el-table-column label="长度 (米)" align="center" prop="length" />
<el-table-column label="更新人" align="center" prop="updateByName" />
</el-table>
</div>
</template>
<script>
import { listMaterialCoil } from "@/api/wms/coil";
import {
listPendingAction,
} from '@/api/wms/pendingAction';
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
import CoilNo from "@/components/KLPService/Renderer/CoilNo.vue";
export default {
components: {
ProductInfo,
RawMaterialInfo,
CoilNo,
},
data() {
// 获取昨天0点到今天0点的时间范围
const now = new Date()
const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000)
const startTime = yesterday.toISOString().slice(0, 10) + ' 00:00:00'
const endTime = yesterday.toISOString().slice(0, 10) + ' 23:59:59'
return {
list: [],
queryParams: {
pageNum: 1,
pageSize: 9999,
status: 1,
startTime: startTime,
endTime: endTime,
},
loading: false,
}
},
computed: {
summary() {
// 总钢卷数量、总重、均重
const totalCount = this.list.length
const totalWeight = this.list.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
const avgWeight = totalCount > 0 ? (totalWeight / totalCount).toFixed(2) : 0
return {
totalCount,
totalWeight,
avgWeight,
}
}
},
methods: {
getList() {
this.loading = true
listPendingAction({
// actionStatus: 2,
actionType: 11,
pageSize: 999,
pageNum: 1,
startTime: this.queryParams.startTime,
endTime: this.queryParams.endTime,
}).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.loading = false
return
}
listMaterialCoil({
coilIds: coilIds,
}).then(res => {
this.list = res.rows
this.loading = false
})
})
},
// 导出
exportData() {
this.download('wms/materialCoil/export', {
coilIds: this.list.map(item => item.coilId).join(',')
}, `materialCoil_${new Date().getTime()}.xlsx`)
},
},
mounted() {
this.getList()
}
}
</script>
<style scoped></style>