+
+
+
-
+
@@ -503,8 +508,9 @@ export default {
parsedCacheData: null,
itemSelectorQueryParams: {},
// 排产计划
- planDetailList: [],
- currentPlanSheet: null,
+ planSheetList: [],
+ planSheetDetailMap: {},
+ activePlanSheetId: null,
currentLineName: '',
};
},
@@ -512,6 +518,9 @@ export default {
l2HotCoilId() {
return (this.currentInfo && this.currentInfo.enterCoilNo) || ''
},
+ activePlanSheetDetails() {
+ return this.planSheetDetailMap[this.activePlanSheetId] || []
+ },
/** 是否双机架工序(actionType 504=正常 / 524=修复) */
isDrAction() {
return this.actionType === 504 || this.actionType === 524
@@ -702,7 +711,7 @@ export default {
}
},
- // 根据当前actionType加载对应产线的排产计划
+ // 根据当前actionType加载对应产线的最近3个排产计划
async loadPlanDetails() {
const lineName = actionTypeToLineName[this.actionType]
if (!lineName) return
@@ -711,24 +720,33 @@ export default {
const sheetRes = await listPlanSheet({
lineName,
pageNum: 1,
- pageSize: 1,
+ pageSize: 3,
})
- if (sheetRes.rows && sheetRes.rows.length > 0) {
- const planSheet = sheetRes.rows[0]
- this.currentPlanSheet = planSheet
- const detailRes = await listPlanDetail({
- planSheetId: planSheet.planSheetId,
- pageNum: 1,
- pageSize: 50,
- })
- if (detailRes.rows) {
- this.planDetailList = detailRes.rows
+ this.planSheetList = sheetRes.rows || []
+ this.planSheetDetailMap = {}
+ if (this.planSheetList.length > 0) {
+ this.activePlanSheetId = this.planSheetList[0].planSheetId
+ for (const sheet of this.planSheetList) {
+ this.fetchPlanSheetDetail(sheet.planSheetId)
}
}
} catch (error) {
console.error('加载排产计划失败', error)
}
},
+ async fetchPlanSheetDetail(planSheetId) {
+ try {
+ const detailRes = await listPlanDetail({
+ planSheetId,
+ pageNum: 1,
+ pageSize: 50,
+ })
+ if (detailRes.rows) {
+ const details = detailRes.rows.sort((a, b) => (parseInt(a.bizSeqNo) || 0) - (parseInt(b.bizSeqNo) || 0))
+ this.$set(this.planSheetDetailMap, planSheetId, details)
+ }
+ } catch (e) { console.error('查询排产单明细失败', e) }
+ },
// 复制当前信息到更新表单
copyFromCurrent() {