diff --git a/klp-ui/src/components/KLPService/ContractSelect/index.vue b/klp-ui/src/components/KLPService/ContractSelect/index.vue index e6d366ef..a2afcc17 100644 --- a/klp-ui/src/components/KLPService/ContractSelect/index.vue +++ b/klp-ui/src/components/KLPService/ContractSelect/index.vue @@ -157,6 +157,17 @@ export default { } } }, + watch: { + value(val) { + if (val && !this.contractList.some(item => String(item.orderId) === String(val))) { + getOrder(val).then(res => { + if (res.data) { + this.contractList.unshift(res.data) + } + }).catch(() => {}) + } + } + }, mounted() { if (this.mode == "today") { this.loadFromLocalStorage(); @@ -211,6 +222,17 @@ export default { this.sortLastSelectedToFirst(); // 保存到localStorage this.saveToLocalStorage(); + // 确保已选中的合同在列表中 + if (this.value && !this.contractList.some(item => String(item.orderId) === String(this.value))) { + try { + const contract = await getOrder(this.value); + if (contract.data) { + this.contractList.unshift(contract.data); + } + } catch (e) { + console.error('Failed to fetch selected contract:', e); + } + } }, // 将上一次选择的合同排到列表第一位 diff --git a/klp-ui/src/views/wms/anneal/plan/ctrl.vue b/klp-ui/src/views/wms/anneal/plan/ctrl.vue index 6221f352..f6c37c36 100644 --- a/klp-ui/src/views/wms/anneal/plan/ctrl.vue +++ b/klp-ui/src/views/wms/anneal/plan/ctrl.vue @@ -238,6 +238,7 @@ import { listAnnealPlan, updateAnnealPlanCoil, getAnnealPlan, addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan"; import { listAnnealFurnace } from "@/api/wms/annealFurnace"; import { listMaterialCoil } from "@/api/wms/coil"; +import { listCoilContractRel } from '@/api/wms/coilContractRel'; import { listWarehouse } from '@/api/wms/warehouse' import WarehouseSelect from "@/components/KLPService/WarehouseSelect"; import { addAnnealOperateEvent } from "@/api/wms/annealOperateEvent"; @@ -398,6 +399,15 @@ export default { enterCoilNo: item.enterCoilNo, warehouseId: item.logicWarehouseId || null })); + // 查询每个钢卷绑定的合同号作为默认值 + for (const coil of this.completeCoils) { + listCoilContractRel({ coilId: coil.coilId }).then(res => { + const rows = res.rows || [] + if (rows.length > 0 && rows[0].contractId) { + this.$set(coil, 'contractId', rows[0].contractId) + } + }) + } this.completeLoading = false; }).catch(() => { this.completeLoading = false; diff --git a/klp-ui/src/views/wms/coil/merge.vue b/klp-ui/src/views/wms/coil/merge.vue index 5dde05a8..5f0b8524 100644 --- a/klp-ui/src/views/wms/coil/merge.vue +++ b/klp-ui/src/views/wms/coil/merge.vue @@ -363,6 +363,7 @@