diff --git a/klp-ui/src/views/wms/post/aps/compare.vue b/klp-ui/src/views/wms/post/aps/compare.vue index dca25f3c5..2aad31614 100644 --- a/klp-ui/src/views/wms/post/aps/compare.vue +++ b/klp-ui/src/views/wms/post/aps/compare.vue @@ -18,6 +18,17 @@ + +
+ + {{ p.name }} + +
+ @@ -28,17 +39,6 @@ 共 {{ scheduleList.length }} 条 - -
- {{ at || '(空)' }} - 全部 -
-
+
import { listScheduleItem } from '@/api/aps/schedule' import { listMaterialCoil } from '@/api/aps/materialCoil' +import { listLightPendingAction } from '@/api/wms/pendingAction' +import { PROCESSES } from '@/utils/meta' export default { name: 'ApsCompare', @@ -121,10 +123,12 @@ export default { // 左侧排产明细 schLoading: false, scheduleList: [], - actionTypes: [], - selectedActionType: '', coilStatusMap: { 0: '在库', 1: '在途', 2: '已出库' }, + // 工序筛选(顶部 radio tab) + processOptions: PROCESSES, + selectedProcessActionType: null, + // 右侧钢卷 coilLoading: false, coilList: [], @@ -134,11 +138,15 @@ export default { }, computed: { filteredScheduleList() { - if (!this.selectedActionType) return this.scheduleList - return this.scheduleList.filter(item => (item.actionType || '') === this.selectedActionType) + if (!this.selectedProcessActionType) return this.scheduleList + return this.scheduleList.filter(item => String(item.actionType) === String(this.selectedProcessActionType)) } }, created() { + // 默认选中第一个工序 + if (this.processOptions.length > 0) { + this.selectedProcessActionType = this.processOptions[0].actionType + } this.handleQuery() }, methods: { @@ -156,44 +164,55 @@ export default { queryScheduleItems() { this.schLoading = true this.scheduleList = [] - this.actionTypes = [] - this.selectedActionType = '' listScheduleItem({ prodDate: this.queryDate, pageNum: 1, pageSize: 9999 }).then(res => { this.scheduleList = (res.rows || []).sort((a, b) => (a.scheduleNo || '').localeCompare(b.scheduleNo || '')) - // 提取所有不同的 actionType - const types = new Set() - this.scheduleList.forEach(item => { - if (item.actionType) types.add(item.actionType) - }) - this.actionTypes = [...types].sort() this.updateSummary() }).catch(() => { this.scheduleList = [] - this.actionTypes = [] }).finally(() => { this.schLoading = false }) }, - filterByActionType(type) { - this.selectedActionType = type - }, - - // ====== 右侧:钢卷 ====== + // ====== 右侧:钢卷(先查 pendingAction 获取 coilIds,再查实际钢卷) ====== queryCoils() { + if (!this.selectedProcessActionType) { + this.coilList = [] + this.coilTotal = 0 + this.coilTotalWeight = 0 + return + } this.coilLoading = true this.coilList = [] - listMaterialCoil({ - pageNum: 1, - pageSize: 9999 - // 可根据需要加上日期和 dataType 过滤 + const startTime = `${this.queryDate} 00:00:00` + const endTime = `${this.queryDate} 23:59:59` + + listLightPendingAction({ + actionType: this.selectedProcessActionType, + startTime, + endTime }).then(res => { - this.coilList = res.rows || [] - this.coilTotal = res.total || this.coilList.length - this.coilTotalWeight = this.coilList.reduce((sum, c) => sum + (parseFloat(c.netWeight) || 0) / 1000, 0).toFixed(3) - this.updateSummary() + const rows = res.rows || (Array.isArray(res) ? res : []) + const coilIds = rows.map(r => r.processedCoilId).filter(Boolean) + if (coilIds.length === 0) { + this.coilList = [] + this.coilTotal = 0 + this.coilTotalWeight = 0 + this.updateSummary() + return + } + return listMaterialCoil({ + coilIds: coilIds.join(','), + pageNum: 1, + pageSize: 1000 + }).then(coilRes => { + this.coilList = coilRes.rows || [] + this.coilTotal = coilRes.total || this.coilList.length + this.coilTotalWeight = this.coilList.reduce((sum, c) => sum + (parseFloat(c.netWeight) || 0) / 1000, 0).toFixed(3) + this.updateSummary() + }) }).catch(() => { this.coilList = [] this.coilTotal = 0 @@ -203,6 +222,10 @@ export default { }) }, + onProcessChange() { + this.queryCoils() + }, + updateSummary() { this.summaryText = `排产 ${this.scheduleList.length} 条 | 钢卷 ${this.coilTotal} 条 ${this.coilTotalWeight} 吨` } @@ -251,6 +274,21 @@ export default { border: 1px solid $aps-border; } +.process-tab-bar { + flex-shrink: 0; + padding: 6px 0; + ::v-deep .el-radio-button__inner { + padding: 6px 14px; + font-size: 12px; + } + ::v-deep .el-radio-button:first-child .el-radio-button__inner { + border-radius: $aps-radius 0 0 $aps-radius; + } + ::v-deep .el-radio-button:last-child .el-radio-button__inner { + border-radius: 0 $aps-radius $aps-radius 0; + } +} + .aps-compare-card { height: 100%; display: flex; @@ -259,15 +297,6 @@ export default { overflow: hidden; } -.action-filter-bar { - padding: 8px 12px; - border-bottom: 1px solid $aps-border; - display: flex; - flex-wrap: wrap; - gap: 6px; - flex-shrink: 0; -} - .aps-btn-red { @include aps-btn-red; } diff --git a/klp-ui/src/views/wms/post/aps/schedule.vue b/klp-ui/src/views/wms/post/aps/schedule.vue index 6ff6398ec..50afa27bc 100644 --- a/klp-ui/src/views/wms/post/aps/schedule.vue +++ b/klp-ui/src/views/wms/post/aps/schedule.vue @@ -23,14 +23,14 @@
-
+
待审核产需单明细 共 {{ pendingScheduleList.length }} 个产需单
-
+
@@ -162,7 +162,7 @@
-
+
已排产明细
@@ -191,7 +191,7 @@
-
+
- + + +