Merge remote-tracking branch 'origin/0.8.X' into 0.8.X
This commit is contained in:
@@ -473,3 +473,13 @@ export function excludeLock(coilId) {
|
||||
timeout: 600000,
|
||||
})
|
||||
}
|
||||
|
||||
// 轻量钢卷列表
|
||||
export function listLightCoil(data) {
|
||||
return request({
|
||||
url: '/wms/materialCoil/listForReport',
|
||||
method: 'get',
|
||||
timeout: 600000,
|
||||
params: data
|
||||
})
|
||||
}
|
||||
@@ -167,3 +167,15 @@ export function restorePendingAction(actionId) {
|
||||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 轻量待操作列表
|
||||
*/
|
||||
export function listLightPendingAction(query) {
|
||||
return request({
|
||||
url: '/wms/coilPendingAction/actionCoilIdList',
|
||||
method: 'get',
|
||||
params: query,
|
||||
timeout: 600000
|
||||
})
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</div>
|
||||
|
||||
<div class="selected-table-wrapper">
|
||||
<el-table :data="selectedCoils" :height="orderBy ? '100%' : '200px'">
|
||||
<el-table :data="selectedCoils" :height="orderBy ? 'calc(100% - 30px)' : '200px'">
|
||||
<el-table-column v-for="column in renderColumns" :label="column.label" :align="column.align"
|
||||
:prop="column.prop" :width="column.width" :show-overflow-tooltip="column.showOverflowTooltip" />
|
||||
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<div class="acid-container">
|
||||
<div class="acid-sidebar">
|
||||
<el-menu
|
||||
:default-active="activeMenu"
|
||||
class="sidebar-menu"
|
||||
@select="handleMenuSelect"
|
||||
>
|
||||
<el-menu :default-active="activeMenu" class="sidebar-menu" @select="handleMenuSelect">
|
||||
<el-menu-item index="inventory">
|
||||
<i class="el-icon-box"></i>
|
||||
<span slot="title">库存</span>
|
||||
@@ -34,6 +30,10 @@
|
||||
<i class="el-icon-date"></i>
|
||||
<span slot="title">计划</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="tracking">
|
||||
<i class="el-icon-location-outline"></i>
|
||||
<span slot="title">跟踪</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="actualPerformance">
|
||||
<i class="el-icon-data-analysis"></i>
|
||||
<span slot="title">实绩</span>
|
||||
@@ -54,10 +54,6 @@
|
||||
<i class="el-icon-alarm-clock"></i>
|
||||
<span slot="title">app</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="tracking">
|
||||
<i class="el-icon-location-outline"></i>
|
||||
<span slot="title">跟踪</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
<div style="flex: 1; overflow: hidden;">
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<div class="coil-table">
|
||||
<div class="table-controls">
|
||||
<div class="filter-section">
|
||||
<!-- <div class="filter-section">
|
||||
<el-input v-model="filterKeyword" placeholder="输入关键词筛选" clearable @input="handleFilterChange"
|
||||
style="width: 200px; margin-right: 10px" />
|
||||
<el-select v-model="filterColumn" placeholder="选择筛选字段" @change="handleFilterChange"
|
||||
style="width: 200px; margin-right: 10px" multiple collapse-tags>
|
||||
<el-option v-for="column in columns" :key="column.prop" :label="column.title" :value="column.prop" />
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="sort-section">
|
||||
</div> -->
|
||||
<!-- <div class="sort-section">
|
||||
<el-select v-model="sortField" placeholder="选择排序字段" @change="handleSortChange"
|
||||
style="width: 150px; margin-right: 10px">
|
||||
<el-option v-for="column in columns" :key="column.prop" :label="column.title" :value="column.prop" />
|
||||
@@ -18,10 +18,10 @@
|
||||
<el-option label="升序" value="asc" />
|
||||
<el-option label="降序" value="desc" />
|
||||
</el-select>
|
||||
</div>
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :total="total" :page-size.sync="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div> -->
|
||||
<el-pagination layout="total, sizes, prev, pager, next, jumper" :total="paginationTotal" :page-size="effectivePageSize"
|
||||
:current-page="pageNum" :page-sizes="[10, 20, 50, 100, 200, 500, 1000]" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
|
||||
<slot name="settings"></slot>
|
||||
</div>
|
||||
@@ -107,13 +107,23 @@ export default {
|
||||
// 自定义高亮样式
|
||||
style: {}
|
||||
})
|
||||
},
|
||||
// 服务端分页总数(>0 时开启服务端分页模式)
|
||||
total: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
// 服务端分页每页条数
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
dicts: ['coil_quality_status', 'coil_abnormal_code', 'coil_abnormal_degree'],
|
||||
data() {
|
||||
return {
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
innerPageSize: 1000,
|
||||
// 排序相关
|
||||
sortField: '',
|
||||
sortDirection: 'asc',
|
||||
@@ -133,8 +143,17 @@ export default {
|
||||
this.filterColumn = this.columns.map(column => column.prop)
|
||||
},
|
||||
computed: {
|
||||
// 处理排序和筛选后的数据
|
||||
isServerPagination() {
|
||||
return this.total > 0
|
||||
},
|
||||
effectivePageSize() {
|
||||
return this.pageSize > 0 ? this.pageSize : this.innerPageSize
|
||||
},
|
||||
// 处理排序和筛选后的数据(服务端分页模式下跳过筛选排序)
|
||||
processedData() {
|
||||
if (this.isServerPagination) {
|
||||
return this.data
|
||||
}
|
||||
let result = [...this.data]
|
||||
|
||||
// 筛选逻辑
|
||||
@@ -183,32 +202,48 @@ export default {
|
||||
|
||||
return result
|
||||
},
|
||||
// 内部实现前端分页逻辑
|
||||
// 内部实现前端分页逻辑(服务端分页模式下直接返回数据)
|
||||
tableData() {
|
||||
return this.processedData.slice((this.pageNum - 1) * this.pageSize, this.pageNum * this.pageSize)
|
||||
if (this.isServerPagination) {
|
||||
return this.data
|
||||
}
|
||||
return this.processedData.slice((this.pageNum - 1) * this.effectivePageSize, this.pageNum * this.effectivePageSize)
|
||||
},
|
||||
// 计算总页数
|
||||
totalPage() {
|
||||
return Math.ceil(this.processedData.length / this.pageSize)
|
||||
const total = this.isServerPagination ? this.total : this.processedData.length
|
||||
return Math.ceil(total / this.effectivePageSize)
|
||||
},
|
||||
// 计算总条数
|
||||
total() {
|
||||
pageTotal() {
|
||||
return this.processedData.length
|
||||
},
|
||||
// 分页总条数(服务端优先)
|
||||
paginationTotal() {
|
||||
return this.isServerPagination ? this.total : this.pageTotal
|
||||
},
|
||||
// 是否展示分页组件
|
||||
showPagination() {
|
||||
if (this.isServerPagination) return true
|
||||
return this.totalPage > 1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 分页大小改变时触发
|
||||
handleSizeChange(val) {
|
||||
this.pageSize = val
|
||||
if (this.isServerPagination) {
|
||||
this.$emit('size-change', val)
|
||||
} else {
|
||||
this.innerPageSize = val
|
||||
}
|
||||
this.pageNum = 1
|
||||
},
|
||||
// 分页当前页改变时触发
|
||||
handleCurrentChange(val) {
|
||||
this.pageNum = val
|
||||
if (this.isServerPagination) {
|
||||
this.$emit('current-change', val)
|
||||
}
|
||||
},
|
||||
// 生产耗时,单位分钟,渲染为xx天xx小时xx分钟
|
||||
formatProductionDuration(duration) {
|
||||
|
||||
@@ -55,7 +55,8 @@
|
||||
|
||||
<el-descriptions title="明细信息" :column="3" border>
|
||||
</el-descriptions>
|
||||
<coil-table :columns="deliveryColumns" :data="list"></coil-table>
|
||||
<coil-table :columns="deliveryColumns" :data="list" :total="total" :page-size="pageSize"
|
||||
@current-change="handlePageChange" @size-change="handleSizeChange"></coil-table>
|
||||
|
||||
<el-dialog title="列设置" :visible.sync="settingVisible" width="50%">
|
||||
<el-radio-group v-model="activeColumnConfig">
|
||||
@@ -67,7 +68,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCoilWithIds, listWithBindInfoCoil } from "@/api/wms/coil";
|
||||
import { listWithBindInfoCoil, listLightCoil } 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";
|
||||
@@ -118,11 +119,10 @@ export default {
|
||||
activeColumnConfig: 'coil-report-delivery',
|
||||
settingVisible: false,
|
||||
list: [],
|
||||
lightList: [],
|
||||
defaultStartTime: startTime,
|
||||
defaultEndTime: endTime,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 99999,
|
||||
status: 1,
|
||||
dataType: 1,
|
||||
selectType: 'product',
|
||||
@@ -133,8 +133,10 @@ export default {
|
||||
itemSpecification: '',
|
||||
itemMaterial: '',
|
||||
itemManufacturer: '',
|
||||
includeBindInfo: true,
|
||||
},
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
total: 0,
|
||||
loading: false,
|
||||
|
||||
deliveryColumns: [],
|
||||
@@ -142,9 +144,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
summary() {
|
||||
// 总钢卷数量、总重、均重
|
||||
const totalCount = this.list.length
|
||||
const totalWeight = this.list.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
|
||||
// 总钢卷数量、总重、均重(基于轻量全量列表)
|
||||
const totalCount = this.lightList.length
|
||||
const totalWeight = this.lightList.reduce((acc, cur) => acc + parseFloat(cur.netWeight), 0)
|
||||
const avgWeight = totalCount > 0 ? (totalWeight / totalCount).toFixed(2) : 0
|
||||
return {
|
||||
totalCount,
|
||||
@@ -153,7 +155,7 @@ export default {
|
||||
}
|
||||
},
|
||||
coilIds() {
|
||||
return this.list.map(item => item.coilId).join(',')
|
||||
return this.lightList.map(item => item.coilId).join(',')
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -167,11 +169,20 @@ export default {
|
||||
},
|
||||
getList() {
|
||||
this.loading = true
|
||||
listWithBindInfoCoil({
|
||||
this.pageNum = 1
|
||||
Promise.all([
|
||||
this.fetchLightList(),
|
||||
this.fetchDetailList()
|
||||
]).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 轻量全量接口,用于统计计算
|
||||
fetchLightList() {
|
||||
return listLightCoil({
|
||||
...this.queryParams
|
||||
}).then(res => {
|
||||
this.list = res.rows.map(item => {
|
||||
// 计算宽度和厚度,将规格按照*分割,*前的是厚度,*后的是宽度
|
||||
this.lightList = (res || []).map(item => {
|
||||
const [thickness, width] = item.specification?.split('*') || []
|
||||
return {
|
||||
...item,
|
||||
@@ -179,6 +190,41 @@ export default {
|
||||
computedWidth: parseFloat(width),
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 分页明细接口,用于表格展示
|
||||
fetchDetailList() {
|
||||
return listWithBindInfoCoil({
|
||||
...this.queryParams,
|
||||
includeBindInfo: true,
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize,
|
||||
}).then(res => {
|
||||
this.total = res.total || 0
|
||||
this.list = (res.rows || []).map(item => {
|
||||
const [thickness, width] = item.specification?.split('*') || []
|
||||
return {
|
||||
...item,
|
||||
computedThickness: parseFloat(thickness),
|
||||
computedWidth: parseFloat(width),
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
// 切换页码
|
||||
handlePageChange(pageNum) {
|
||||
this.pageNum = pageNum
|
||||
this.loading = true
|
||||
this.fetchDetailList().finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 切换每页条数
|
||||
handleSizeChange(pageSize) {
|
||||
this.pageSize = pageSize
|
||||
this.pageNum = 1
|
||||
this.loading = true
|
||||
this.fetchDetailList().finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
@@ -40,15 +40,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -448,7 +448,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
this.lossList = lossList
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -341,7 +341,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
this.lossList = lossList
|
||||
|
||||
@@ -42,15 +42,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -452,7 +452,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
// 将mergeCoils中存在的卷剔除
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -414,7 +414,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
this.lossList = lossList
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="endTime">
|
||||
<el-form-item label="逻辑库位" prop="endTime">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="endTime">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -208,7 +208,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}).then((resList) => {
|
||||
this.list = resList
|
||||
this.loading = false
|
||||
|
||||
@@ -24,15 +24,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位">
|
||||
<el-form-item label="逻辑库位">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -326,7 +326,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
this.lossList = lossList
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
<el-input style="width: 200px;" v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-form-item label="逻辑库位" prop="warehouseIds">
|
||||
<el-select v-model="warehouseIds" collapse-tags multiple placeholder="请选择逻辑库位" style="width: 200px;">
|
||||
<el-option v-for="item in warehouseOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="逻辑库位" prop="warehouseId">
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="逻辑库位" prop="warehouseId">
|
||||
<warehouse-select v-model="queryParams.warehouseId" placeholder="请选择仓库/库区/库位"
|
||||
style="width: 100%; display: inline-block; width: 200px;" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="产品名称" prop="itemName">
|
||||
<el-input style="width: 200px;" v-model="queryParams.itemName" placeholder="请输入产品名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
@@ -312,7 +312,7 @@ export default {
|
||||
fetchOutputList({
|
||||
...this.queryParams,
|
||||
...this.baseQueryParams,
|
||||
// warehouseIds: this.warehouseIds.join(','),
|
||||
warehouseIds: this.warehouseIds.join(','),
|
||||
}),
|
||||
]).then(([lossList, outputList]) => {
|
||||
this.lossList = lossList
|
||||
|
||||
@@ -65,8 +65,8 @@ public class WmsMaterialCoilController extends BaseController {
|
||||
* 查询钢卷物料表列表(报表专用,轻量级,仅返回coilId、netWeight、warehouseId、qualityStatus、team)
|
||||
* 使用与list相同的查询条件,但只返回少量字段以提升传输性能
|
||||
*/
|
||||
@GetMapping("/listForReport")
|
||||
public List<WmsMaterialCoilReportVo> listForReport(WmsMaterialCoilBo bo) {
|
||||
@PostMapping("/listForReport")
|
||||
public List<WmsMaterialCoilReportVo> listForReport(@RequestBody WmsMaterialCoilBo bo) {
|
||||
return iWmsMaterialCoilService.queryReportList(bo);
|
||||
}
|
||||
|
||||
@@ -224,15 +224,6 @@ public class WmsMaterialCoilController extends BaseController {
|
||||
return iWmsMaterialCoilService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 报表汇总(待操作筛选 + 钢卷筛选)
|
||||
* 仅返回统计结果,不返回钢卷明细
|
||||
*/
|
||||
@PostMapping("/reportSummary")
|
||||
public R<WmsMaterialCoilReportSummaryVo> reportSummary(@RequestBody WmsMaterialCoilReportSummaryBo bo) {
|
||||
return R.ok(iWmsMaterialCoilService.reportSummary(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 钢卷发货,将钢卷状态更新为已发货,且更新发货时间
|
||||
*
|
||||
|
||||
@@ -269,11 +269,6 @@ public interface IWmsMaterialCoilService {
|
||||
|
||||
List<WmsMaterialCoilAllExportVo> queryExportListAll(WmsMaterialCoilBo bo);
|
||||
|
||||
/**
|
||||
* 报表汇总(待操作条件 + 钢卷条件)
|
||||
*/
|
||||
WmsMaterialCoilReportSummaryVo reportSummary(WmsMaterialCoilReportSummaryBo bo);
|
||||
|
||||
/**
|
||||
* 查询itemId和itemType不匹配的钢卷
|
||||
* 检查所有钢卷的itemId是否存在于对应的表中(根据itemType)
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.klp.domain.bo.WmsCoilPendingActionBo;
|
||||
import com.klp.mapper.*;
|
||||
import com.klp.service.*;
|
||||
import com.klp.system.service.ISysUserService;
|
||||
import com.klp.utils.CoilBusinessRuleUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -1410,6 +1411,9 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
validateActualWarehouseForAssign(bo.getActualWarehouseId(), ignoreOccupiedId);
|
||||
}
|
||||
|
||||
// 处理特殊业务逻辑:根据条件自动调整逻辑库区等字段
|
||||
CoilBusinessRuleUtils.handleSpecialBusinessLogic(oldCoil, bo);
|
||||
|
||||
// 1. 历史钢卷(dataType=0)禁止修改实际库区(actualWarehouseId非空且不等于-1)
|
||||
if (0 == oldCoil.getDataType()) { // 原钢卷是历史钢卷
|
||||
// 场景1:传入了新的实际库区ID,且不是置空(-1),禁止操作
|
||||
@@ -5195,232 +5199,6 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WmsMaterialCoilReportSummaryVo reportSummary(WmsMaterialCoilReportSummaryBo req) {
|
||||
WmsMaterialCoilBo coilFilter = req != null && req.getMaterialCoilFilter() != null
|
||||
? req.getMaterialCoilFilter() : new WmsMaterialCoilBo();
|
||||
WmsCoilPendingActionBo pendingFilter = req == null ? null : req.getPendingActionFilter();
|
||||
|
||||
if (hasAnyPendingFilter(pendingFilter)) {
|
||||
List<Long> pendingCoilIds = queryCoilIdsByPendingFilter(pendingFilter);
|
||||
if (CollectionUtils.isEmpty(pendingCoilIds)) {
|
||||
return buildEmptySummary();
|
||||
}
|
||||
coilFilter.setCoilIds(mergeCoilIds(coilFilter.getCoilIds(), pendingCoilIds));
|
||||
}
|
||||
|
||||
List<WmsMaterialCoilVo> list = queryList(coilFilter);
|
||||
return buildSummaryFromList(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean hasAnyPendingFilter(WmsCoilPendingActionBo bo) {
|
||||
if (bo == null) {
|
||||
return false;
|
||||
}
|
||||
return bo.getCoilId() != null
|
||||
|| StringUtils.isNotBlank(bo.getCurrentCoilNo())
|
||||
|| bo.getActionType() != null
|
||||
|| CollectionUtils.isNotEmpty(bo.getActionTypes())
|
||||
|| bo.getActionStatus() != null
|
||||
|| bo.getWarehouseId() != null
|
||||
|| bo.getPriority() != null
|
||||
|| StringUtils.isNotBlank(bo.getSourceType())
|
||||
|| bo.getStartTime() != null
|
||||
|| bo.getEndTime() != null
|
||||
|| StringUtils.isNotBlank(bo.getCreateBy())
|
||||
|| StringUtils.isNotBlank(bo.getUpdateBy())
|
||||
|| StringUtils.isNotBlank(bo.getProcessedCoilIds())
|
||||
|| bo.getIncludeDeleted() != null;
|
||||
}
|
||||
|
||||
private List<Long> queryCoilIdsByPendingFilter(WmsCoilPendingActionBo bo) {
|
||||
LambdaQueryWrapper<WmsCoilPendingAction> qw = Wrappers.lambdaQuery();
|
||||
qw.select(WmsCoilPendingAction::getCoilId);
|
||||
qw.eq(bo.getCoilId() != null, WmsCoilPendingAction::getCoilId, bo.getCoilId());
|
||||
qw.like(StringUtils.isNotBlank(bo.getCurrentCoilNo()), WmsCoilPendingAction::getCurrentCoilNo, bo.getCurrentCoilNo());
|
||||
if (CollectionUtils.isNotEmpty(bo.getActionTypes())) {
|
||||
qw.in(WmsCoilPendingAction::getActionType, bo.getActionTypes());
|
||||
} else {
|
||||
qw.eq(bo.getActionType() != null, WmsCoilPendingAction::getActionType, bo.getActionType());
|
||||
}
|
||||
if (bo.getActionStatus() != null) {
|
||||
if (bo.getActionStatus() == -1) {
|
||||
qw.ne(WmsCoilPendingAction::getActionStatus, 2);
|
||||
} else {
|
||||
qw.eq(WmsCoilPendingAction::getActionStatus, bo.getActionStatus());
|
||||
}
|
||||
}
|
||||
qw.eq(bo.getWarehouseId() != null, WmsCoilPendingAction::getWarehouseId, bo.getWarehouseId());
|
||||
qw.eq(bo.getPriority() != null, WmsCoilPendingAction::getPriority, bo.getPriority());
|
||||
qw.like(StringUtils.isNotBlank(bo.getSourceType()), WmsCoilPendingAction::getSourceType, bo.getSourceType());
|
||||
qw.ge(bo.getStartTime() != null, WmsCoilPendingAction::getCompleteTime, bo.getStartTime());
|
||||
qw.le(bo.getEndTime() != null, WmsCoilPendingAction::getCompleteTime, bo.getEndTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getCreateBy()), WmsCoilPendingAction::getCreateBy, bo.getCreateBy());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getUpdateBy()), WmsCoilPendingAction::getUpdateBy, bo.getUpdateBy());
|
||||
qw.like(StringUtils.isNotBlank(bo.getProcessedCoilIds()), WmsCoilPendingAction::getProcessedCoilIds, bo.getProcessedCoilIds());
|
||||
|
||||
if (bo.getIncludeDeleted() != null) {
|
||||
if (bo.getIncludeDeleted() == 2) {
|
||||
qw.eq(WmsCoilPendingAction::getDelFlag, 2);
|
||||
} else if (bo.getIncludeDeleted() == 0) {
|
||||
qw.eq(WmsCoilPendingAction::getDelFlag, 0);
|
||||
}
|
||||
} else {
|
||||
qw.eq(WmsCoilPendingAction::getDelFlag, 0);
|
||||
}
|
||||
|
||||
List<WmsCoilPendingAction> actions = coilPendingActionMapper.selectList(qw);
|
||||
if (CollectionUtils.isEmpty(actions)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return actions.stream()
|
||||
.map(WmsCoilPendingAction::getCoilId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String mergeCoilIds(String coilIdsCsv, List<Long> pendingCoilIds) {
|
||||
Set<Long> pendingSet = new LinkedHashSet<>(pendingCoilIds);
|
||||
if (StringUtils.isBlank(coilIdsCsv)) {
|
||||
return pendingSet.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
List<Long> existing = parseCsvLongs(coilIdsCsv);
|
||||
if (CollectionUtils.isEmpty(existing)) {
|
||||
return pendingSet.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
Set<Long> existingSet = new LinkedHashSet<>(existing);
|
||||
existingSet.retainAll(pendingSet);
|
||||
if (existingSet.isEmpty()) {
|
||||
return "-1";
|
||||
}
|
||||
return existingSet.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
private WmsMaterialCoilReportSummaryVo buildEmptySummary() {
|
||||
WmsMaterialCoilReportSummaryVo vo = new WmsMaterialCoilReportSummaryVo();
|
||||
vo.setTotalCount(0);
|
||||
vo.setTotalWeight("0.00");
|
||||
vo.setAvgWeight("0");
|
||||
vo.setAbnormalSummary(buildAbnormalSummary(Collections.emptyList()));
|
||||
vo.setTeamSummary(Collections.emptyMap());
|
||||
return vo;
|
||||
}
|
||||
|
||||
private WmsMaterialCoilReportSummaryVo buildSummaryFromList(List<WmsMaterialCoilVo> list) {
|
||||
List<WmsMaterialCoilVo> safeList = list == null ? Collections.emptyList() : list;
|
||||
int totalCount = safeList.size();
|
||||
BigDecimal totalWeight = safeList.stream()
|
||||
.map(WmsMaterialCoilVo::getNetWeight)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
String avgWeight = totalCount > 0
|
||||
? totalWeight.divide(BigDecimal.valueOf(totalCount), 2, java.math.RoundingMode.HALF_UP).toPlainString()
|
||||
: "0";
|
||||
|
||||
WmsMaterialCoilReportSummaryVo vo = new WmsMaterialCoilReportSummaryVo();
|
||||
vo.setTotalCount(totalCount);
|
||||
vo.setTotalWeight(totalWeight.setScale(2, java.math.RoundingMode.HALF_UP).toPlainString());
|
||||
vo.setAvgWeight(avgWeight);
|
||||
vo.setAbnormalSummary(buildAbnormalSummary(safeList));
|
||||
vo.setTeamSummary(buildTeamSummary(safeList));
|
||||
return vo;
|
||||
}
|
||||
|
||||
private List<Map<String, String>> buildAbnormalSummary(List<WmsMaterialCoilVo> list) {
|
||||
int totalCount = list.size();
|
||||
int jishuCount = 0;
|
||||
int miniCount = 0;
|
||||
int rubbishCount = 0;
|
||||
int returnCount = 0;
|
||||
|
||||
BigDecimal jishuWeight = BigDecimal.ZERO;
|
||||
BigDecimal miniWeight = BigDecimal.ZERO;
|
||||
BigDecimal rubbishWeight = BigDecimal.ZERO;
|
||||
BigDecimal returnWeight = BigDecimal.ZERO;
|
||||
|
||||
for (WmsMaterialCoilVo coil : list) {
|
||||
String warehouseId = coil.getWarehouseId() == null ? null : String.valueOf(coil.getWarehouseId());
|
||||
String qualityStatus = coil.getQualityStatus();
|
||||
BigDecimal netWeight = coil.getNetWeight() == null ? BigDecimal.ZERO : coil.getNetWeight();
|
||||
|
||||
if ("2019583656787259393".equals(warehouseId) || "O".equals(qualityStatus)) {
|
||||
jishuCount++;
|
||||
jishuWeight = jishuWeight.add(netWeight);
|
||||
} else if ("2019583325311414274".equals(warehouseId)) {
|
||||
miniCount++;
|
||||
miniWeight = miniWeight.add(netWeight);
|
||||
} else if ("2019583429955104769".equals(warehouseId)
|
||||
|| "D-".equals(qualityStatus)
|
||||
|| "D".equals(qualityStatus)
|
||||
|| "D+".equals(qualityStatus)
|
||||
|| "C-".equals(qualityStatus)
|
||||
|| "C".equals(qualityStatus)
|
||||
|| "C+".equals(qualityStatus)) {
|
||||
rubbishCount++;
|
||||
rubbishWeight = rubbishWeight.add(netWeight);
|
||||
} else if ("2019583137616310273".equals(warehouseId)) {
|
||||
returnCount++;
|
||||
returnWeight = returnWeight.add(netWeight);
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, String>> result = new ArrayList<>();
|
||||
result.add(buildLabelValue("技术部钢卷数", String.valueOf(jishuCount)));
|
||||
result.add(buildLabelValue("小钢卷库钢卷数", String.valueOf(miniCount)));
|
||||
result.add(buildLabelValue("废品库钢卷数", String.valueOf(rubbishCount)));
|
||||
result.add(buildLabelValue("退货库钢卷数", String.valueOf(returnCount)));
|
||||
result.add(buildLabelValue("技术部钢卷重量", jishuWeight.setScale(2, java.math.RoundingMode.HALF_UP).toPlainString()));
|
||||
result.add(buildLabelValue("小钢卷库钢卷重量", miniWeight.setScale(2, java.math.RoundingMode.HALF_UP).toPlainString()));
|
||||
result.add(buildLabelValue("废品库钢卷重量", rubbishWeight.setScale(2, java.math.RoundingMode.HALF_UP).toPlainString()));
|
||||
result.add(buildLabelValue("退货库钢卷重量", returnWeight.setScale(2, java.math.RoundingMode.HALF_UP).toPlainString()));
|
||||
result.add(buildLabelValue("技术部占比", percent(jishuCount, totalCount)));
|
||||
result.add(buildLabelValue("小钢卷库占比", percent(miniCount, totalCount)));
|
||||
result.add(buildLabelValue("废品库占比", percent(rubbishCount, totalCount)));
|
||||
result.add(buildLabelValue("退货库占比", percent(returnCount, totalCount)));
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, WmsMaterialCoilReportSummaryVo.TeamSummaryItem> buildTeamSummary(List<WmsMaterialCoilVo> list) {
|
||||
Map<String, WmsMaterialCoilReportSummaryVo.TeamSummaryItem> teamSummary = new LinkedHashMap<>();
|
||||
for (WmsMaterialCoilVo coil : list) {
|
||||
String team = StringUtils.isNotBlank(coil.getTeam()) ? coil.getTeam() : "未分配";
|
||||
WmsMaterialCoilReportSummaryVo.TeamSummaryItem item = teamSummary.computeIfAbsent(team, k -> {
|
||||
WmsMaterialCoilReportSummaryVo.TeamSummaryItem summaryItem = new WmsMaterialCoilReportSummaryVo.TeamSummaryItem();
|
||||
summaryItem.setCount(0);
|
||||
summaryItem.setWeight("0.00");
|
||||
return summaryItem;
|
||||
});
|
||||
int nextCount = item.getCount() == null ? 1 : item.getCount() + 1;
|
||||
BigDecimal currWeight = StringUtils.isBlank(item.getWeight()) ? BigDecimal.ZERO : new BigDecimal(item.getWeight());
|
||||
BigDecimal netWeight = coil.getNetWeight() == null ? BigDecimal.ZERO : coil.getNetWeight();
|
||||
item.setCount(nextCount);
|
||||
item.setWeight(currWeight.add(netWeight).setScale(2, java.math.RoundingMode.HALF_UP).toPlainString());
|
||||
}
|
||||
return teamSummary;
|
||||
}
|
||||
|
||||
private Map<String, String> buildLabelValue(String label, String value) {
|
||||
Map<String, String> map = new LinkedHashMap<>(2);
|
||||
map.put("label", label);
|
||||
map.put("value", value);
|
||||
return map;
|
||||
}
|
||||
|
||||
private String percent(int part, int total) {
|
||||
if (total <= 0) {
|
||||
return "0.00%";
|
||||
}
|
||||
return BigDecimal.valueOf(part)
|
||||
.multiply(BigDecimal.valueOf(100))
|
||||
.divide(BigDecimal.valueOf(total), 2, java.math.RoundingMode.HALF_UP)
|
||||
.toPlainString() + "%";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询itemId和itemType不匹配的钢卷
|
||||
* 检查所有钢卷的itemId是否存在于对应的表中(根据itemType)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.klp.utils;
|
||||
|
||||
import com.klp.domain.WmsMaterialCoil;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 钢卷业务规则工具类
|
||||
* 用于处理钢卷相关的特殊业务规则和逻辑
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-05-19
|
||||
*/
|
||||
public class CoilBusinessRuleUtils {
|
||||
|
||||
/**
|
||||
* 处理特殊业务逻辑:根据条件自动调整字段值
|
||||
* 此方法集中管理各种特殊业务规则,方便后续扩展和维护
|
||||
*
|
||||
* @param oldCoil 原钢卷信息
|
||||
* @param bo 前端传入的更新数据
|
||||
*/
|
||||
public static void handleSpecialBusinessLogic(WmsMaterialCoil oldCoil, WmsMaterialCoilBo bo) {
|
||||
if (oldCoil == null || bo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 规则1:当前端传的逻辑库区是2056545127927787522并且修改了实际库区(老的和前端传的不一样)
|
||||
// 则自动将逻辑库区改为1988150323162836993
|
||||
Long targetLogicWarehouseId = 2056545127927787522L;
|
||||
Long newLogicWarehouseId = 1988150323162836993L;
|
||||
if (oldCoil.getWarehouseId() != null && oldCoil.getWarehouseId().equals(targetLogicWarehouseId)
|
||||
&& bo.getActualWarehouseId() != null
|
||||
&& !Objects.equals(bo.getActualWarehouseId(), oldCoil.getActualWarehouseId())) {
|
||||
// 设置新的逻辑库区ID
|
||||
bo.setWarehouseId(newLogicWarehouseId);
|
||||
}
|
||||
|
||||
// TODO: 后续可以在这里添加更多的特殊业务规则
|
||||
// 例如:
|
||||
// 规则2:xxx条件下自动调整yyy字段
|
||||
// 规则3:xxx条件下触发zzz操作
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user