+
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 @@
-
+
-
+
@@ -162,7 +162,7 @@
-
+
-
+
-
+
+
+ {{ getActionTypeName(scope.row.actionType) }}
+
+
{{ statusMap[scope.row.scheduleStatus] || '未知' }}
@@ -303,17 +307,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -512,7 +527,11 @@
-
+
+
+
+
+
@@ -635,6 +654,7 @@ import {
receiveScheduleItem,
mergeScheduleItem
} from '@/api/aps/schedule'
+import { PROCESSES } from '@/utils/meta'
export default {
name: 'ApsSchedule',
@@ -654,6 +674,7 @@ export default {
pendingScheduleList: [],
summaryText: '',
statusMap: { 1: '待审核', 2: '已接收', 3: '已驳回' },
+ processOptions: PROCESSES,
// 已排产
scheduledItemList: [],
@@ -870,6 +891,14 @@ export default {
handleEditScheduled(row) {
this.editForm = { ...this.getEmptyEditForm(), ...row }
+ // 确保 actionType 为数字类型以匹配下拉选项
+ if (this.editForm.actionType != null && typeof this.editForm.actionType !== 'number') {
+ this.editForm.actionType = Number(this.editForm.actionType)
+ }
+ // 确保 scheduleStatus 为数字类型以匹配下拉选项
+ if (this.editForm.scheduleStatus != null && typeof this.editForm.scheduleStatus !== 'number') {
+ this.editForm.scheduleStatus = Number(this.editForm.scheduleStatus)
+ }
this.editDialogTitle = '编辑排产明细'
this.editDialogVisible = true
this.$nextTick(() => {
@@ -948,7 +977,7 @@ export default {
this.mergeForm = {
itemCount: this.mergeSourceRows.length,
scheduleNo: row.scheduleNo || '',
- actionType: row.actionType || '',
+ actionType: row.actionType != null ? Number(row.actionType) : '',
customerName: row.customerName || '',
spec: row.spec || '',
material: row.material || '',
@@ -1004,6 +1033,11 @@ export default {
return total.toFixed(3)
},
+ getActionTypeName(actionType) {
+ const p = this.processOptions.find(item => String(item.actionType) === String(actionType))
+ return p ? p.name : (actionType || '')
+ },
+
handleDetailClick(sch, detail) {
// 点击明细行查看来源订单
if (!sch || !sch.orderList || sch.orderList.length === 0) {