feat(wms): 新增钢卷合同号自动填充功能

1. 在钢卷合并、分卷、打钢印、计划拆分、退火计划页面添加合同号自动拉取逻辑
2. 优化合同选择组件,补全不存在于列表的已选合同
3. 移除split.vue中冗余的注释代码
This commit is contained in:
2026-06-21 11:32:02 +08:00
parent b4fba79838
commit 274671f309
6 changed files with 88 additions and 15 deletions

View File

@@ -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);
}
}
},
// 将上一次选择的合同排到列表第一位

View File

@@ -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;

View File

@@ -363,6 +363,7 @@
<script>
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
import { listCoilContractRel } from '@/api/wms/coilContractRel';
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
import { listPendingAction, getPendingAction } from '@/api/wms/pendingAction';
import CoilSelector from '@/components/CoilSelector';
@@ -671,6 +672,14 @@ export default {
this.targetCoil.itemType = data.itemType;
this.targetCoil.itemId = data.itemId;
this.targetCoil.warehouseId = data.warehouseId;
// 获取源卷绑定的合同号作为目标卷默认值
listCoilContractRel({ coilId }).then(res => {
const rows = res.rows || []
if (rows.length > 0 && rows[0].contractId) {
this.$set(this.targetCoil, 'contractId', rows[0].contractId)
}
})
} catch (error) {
this.$message.error('加载钢卷信息失败');
console.error(error);

View File

@@ -378,6 +378,7 @@
<script>
import { getMaterialCoil, listMaterialCoil, createSpecialChild, completeSpecialSplit, updateMaterialCoilSimple, delMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil'
import { listCoilContractRel } from '@/api/wms/coilContractRel'
import { listCoilAbnormal } from '@/api/wms/coilAbnormal'
import { getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
@@ -735,6 +736,13 @@ export default {
if (this.isGrindAction && this.coilInfo.enterCoilNo) {
this.splitForm.chromePlateCoilNo = this.coilInfo.enterCoilNo.split(',')[0].trim()
}
// 获取原料卷绑定的合同号作为默认值
listCoilContractRel({ coilId: this.coilId }).then(res => {
const rows = res.rows || []
if (rows.length > 0 && rows[0].contractId) {
this.$set(this.splitForm, 'contractId', rows[0].contractId)
}
})
// 查询是否有缓存
try {
const res = await getCoilCacheByCoilId(this.coilId)

View File

@@ -366,9 +366,10 @@
<script>
import { getMaterialCoil, splitMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
import { listCoilContractRel } from '@/api/wms/coilContractRel';
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
import { listWarehouse } from '@/api/wms/warehouse';
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
import { getPendingAction } from '@/api/wms/pendingAction';
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
import ProductSelect from "@/components/KLPService/ProductSelect";
@@ -478,6 +479,7 @@ export default {
inheritButtonLoading: false,
parentCoils: [],
currentInheritSubCoilIndex: -1,
defaultContractId: '',
};
},
computed: {
@@ -502,8 +504,7 @@ export default {
// 先加载库区列表
await this.loadWarehouses();
// 不再一次性加载所有数据,改为实时搜索
// await this.loadAllItems();
// 加载母卷信息
// 从路由参数获取coilId、actionId和readonly
const coilId = this.$route.query.coilId;
@@ -643,6 +644,19 @@ export default {
// console.error('获取最早的热轧卷板材质失败', error);
}
// 获取母卷绑定的合同号作为子卷默认值
listCoilContractRel({ coilId }).then(res => {
const rows = res.rows || []
if (rows.length > 0 && rows[0].contractId) {
this.defaultContractId = rows[0].contractId
for (const item of this.splitList) {
if (!item.contractId) {
this.$set(item, 'contractId', this.defaultContractId)
}
}
}
})
}
} catch (error) {
this.$message.error('加载母卷信息失败');
@@ -683,6 +697,7 @@ export default {
trimmingRequirement: '',
temperGrade: '',
coatingType: '',
contractId: this.defaultContractId || '',
actualLength: undefined,
actualWidth: undefined,
productionStartTime: this.currentAction.createTime,

View File

@@ -389,9 +389,10 @@
<script>
import { getMaterialCoil, updateMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
import { listCoilContractRel } from '@/api/wms/coilContractRel';
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
import { matchBestSpecVersion } from '@/api/wms/processSpecVersion';
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
import { getPendingAction } from '@/api/wms/pendingAction';
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache';
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
@@ -754,24 +755,32 @@ export default {
...data,
};
// 获取源卷绑定的合同号作为默认值
listCoilContractRel({ coilId }).then(res => {
const rows = res.rows || []
if (rows.length > 0 && rows[0].contractId) {
this.$set(this.updateForm, 'contractId', rows[0].contractId)
}
})
const firstHeatMaterial = await getFirstHeatCoilMaterial(this.currentInfo.enterCoilNo);
console.log(firstHeatMaterial)
if (firstHeatMaterial.code === 200 && firstHeatMaterial.msg) {
this.$set(this.updateForm, 'packingStatus', firstHeatMaterial.msg)
}
// if (data.productionStartTime) {
// this.updateForm.productionStartTime = data.productionStartTime;
// }
// if (data.productionEndTime) {
// this.updateForm.productionEndTime = data.productionEndTime;
// }
// if (data.productionDuration) {
// this.updateForm.productionDuration = data.productionDuration;
// this.updateForm.formattedDuration = this.formatDuration(data.productionDuration);
// }
// 填充时间相关字段
if (data.productionStartTime) {
this.updateForm.productionStartTime = data.productionStartTime;
}
if (data.productionEndTime) {
this.updateForm.productionEndTime = data.productionEndTime;
}
if (data.productionDuration) {
this.updateForm.productionDuration = data.productionDuration;
this.updateForm.formattedDuration = this.formatDuration(data.productionDuration);
}
}
} catch (error) {
this.$message.error('加载钢卷信息失败');