feat(wms): 新增钢卷合同号自动填充功能
1. 在钢卷合并、分卷、打钢印、计划拆分、退火计划页面添加合同号自动拉取逻辑 2. 优化合同选择组件,补全不存在于列表的已选合同 3. 移除split.vue中冗余的注释代码
This commit is contained in:
@@ -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() {
|
mounted() {
|
||||||
if (this.mode == "today") {
|
if (this.mode == "today") {
|
||||||
this.loadFromLocalStorage();
|
this.loadFromLocalStorage();
|
||||||
@@ -211,6 +222,17 @@ export default {
|
|||||||
this.sortLastSelectedToFirst();
|
this.sortLastSelectedToFirst();
|
||||||
// 保存到localStorage
|
// 保存到localStorage
|
||||||
this.saveToLocalStorage();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 将上一次选择的合同排到列表第一位
|
// 将上一次选择的合同排到列表第一位
|
||||||
|
|||||||
@@ -238,6 +238,7 @@
|
|||||||
import { listAnnealPlan, updateAnnealPlanCoil, getAnnealPlan, addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan";
|
import { listAnnealPlan, updateAnnealPlanCoil, getAnnealPlan, addAnnealPlan, updateAnnealPlan, delAnnealPlan, changeAnnealPlanStatus, inFurnace, completeAnnealPlan, listAnnealPlanCoils, bindAnnealPlanCoils, unbindAnnealPlanCoil } from "@/api/wms/annealPlan";
|
||||||
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
|
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
|
||||||
import { listMaterialCoil } from "@/api/wms/coil";
|
import { listMaterialCoil } from "@/api/wms/coil";
|
||||||
|
import { listCoilContractRel } from '@/api/wms/coilContractRel';
|
||||||
import { listWarehouse } from '@/api/wms/warehouse'
|
import { listWarehouse } from '@/api/wms/warehouse'
|
||||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||||
import { addAnnealOperateEvent } from "@/api/wms/annealOperateEvent";
|
import { addAnnealOperateEvent } from "@/api/wms/annealOperateEvent";
|
||||||
@@ -398,6 +399,15 @@ export default {
|
|||||||
enterCoilNo: item.enterCoilNo,
|
enterCoilNo: item.enterCoilNo,
|
||||||
warehouseId: item.logicWarehouseId || null
|
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;
|
this.completeLoading = false;
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.completeLoading = false;
|
this.completeLoading = false;
|
||||||
|
|||||||
@@ -363,6 +363,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
|
import { getMaterialCoil, mergeMaterialCoil } from '@/api/wms/coil';
|
||||||
|
import { listCoilContractRel } from '@/api/wms/coilContractRel';
|
||||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||||
import { listPendingAction, getPendingAction } from '@/api/wms/pendingAction';
|
import { listPendingAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||||
import CoilSelector from '@/components/CoilSelector';
|
import CoilSelector from '@/components/CoilSelector';
|
||||||
@@ -671,6 +672,14 @@ export default {
|
|||||||
this.targetCoil.itemType = data.itemType;
|
this.targetCoil.itemType = data.itemType;
|
||||||
this.targetCoil.itemId = data.itemId;
|
this.targetCoil.itemId = data.itemId;
|
||||||
this.targetCoil.warehouseId = data.warehouseId;
|
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) {
|
} catch (error) {
|
||||||
this.$message.error('加载钢卷信息失败');
|
this.$message.error('加载钢卷信息失败');
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
@@ -378,6 +378,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, listMaterialCoil, createSpecialChild, completeSpecialSplit, updateMaterialCoilSimple, delMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil'
|
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 { listCoilAbnormal } from '@/api/wms/coilAbnormal'
|
||||||
import { getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
|
import { getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
|
||||||
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
|
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
|
||||||
@@ -735,6 +736,13 @@ export default {
|
|||||||
if (this.isGrindAction && this.coilInfo.enterCoilNo) {
|
if (this.isGrindAction && this.coilInfo.enterCoilNo) {
|
||||||
this.splitForm.chromePlateCoilNo = this.coilInfo.enterCoilNo.split(',')[0].trim()
|
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 {
|
try {
|
||||||
const res = await getCoilCacheByCoilId(this.coilId)
|
const res = await getCoilCacheByCoilId(this.coilId)
|
||||||
|
|||||||
@@ -366,9 +366,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, splitMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
import { getMaterialCoil, splitMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
||||||
|
import { listCoilContractRel } from '@/api/wms/coilContractRel';
|
||||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||||
import { listWarehouse } from '@/api/wms/warehouse';
|
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 ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||||
import ProductSelect from "@/components/KLPService/ProductSelect";
|
import ProductSelect from "@/components/KLPService/ProductSelect";
|
||||||
@@ -478,6 +479,7 @@ export default {
|
|||||||
inheritButtonLoading: false,
|
inheritButtonLoading: false,
|
||||||
parentCoils: [],
|
parentCoils: [],
|
||||||
currentInheritSubCoilIndex: -1,
|
currentInheritSubCoilIndex: -1,
|
||||||
|
defaultContractId: '',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -502,8 +504,7 @@ export default {
|
|||||||
// 先加载库区列表
|
// 先加载库区列表
|
||||||
await this.loadWarehouses();
|
await this.loadWarehouses();
|
||||||
|
|
||||||
// 不再一次性加载所有数据,改为实时搜索
|
// 加载母卷信息
|
||||||
// await this.loadAllItems();
|
|
||||||
|
|
||||||
// 从路由参数获取coilId、actionId和readonly
|
// 从路由参数获取coilId、actionId和readonly
|
||||||
const coilId = this.$route.query.coilId;
|
const coilId = this.$route.query.coilId;
|
||||||
@@ -643,6 +644,19 @@ export default {
|
|||||||
// console.error('获取最早的热轧卷板材质失败', error);
|
// 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) {
|
} catch (error) {
|
||||||
this.$message.error('加载母卷信息失败');
|
this.$message.error('加载母卷信息失败');
|
||||||
@@ -683,6 +697,7 @@ export default {
|
|||||||
trimmingRequirement: '',
|
trimmingRequirement: '',
|
||||||
temperGrade: '',
|
temperGrade: '',
|
||||||
coatingType: '',
|
coatingType: '',
|
||||||
|
contractId: this.defaultContractId || '',
|
||||||
actualLength: undefined,
|
actualLength: undefined,
|
||||||
actualWidth: undefined,
|
actualWidth: undefined,
|
||||||
productionStartTime: this.currentAction.createTime,
|
productionStartTime: this.currentAction.createTime,
|
||||||
|
|||||||
@@ -389,9 +389,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getMaterialCoil, updateMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
import { getMaterialCoil, updateMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
||||||
|
import { listCoilContractRel } from '@/api/wms/coilContractRel';
|
||||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||||
import { matchBestSpecVersion } from '@/api/wms/processSpecVersion';
|
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 { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache';
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
import RawMaterialSelect from "@/components/KLPService/RawMaterialSelect";
|
||||||
@@ -754,24 +755,32 @@ export default {
|
|||||||
...data,
|
...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);
|
const firstHeatMaterial = await getFirstHeatCoilMaterial(this.currentInfo.enterCoilNo);
|
||||||
|
|
||||||
console.log(firstHeatMaterial)
|
console.log(firstHeatMaterial)
|
||||||
if (firstHeatMaterial.code === 200 && firstHeatMaterial.msg) {
|
if (firstHeatMaterial.code === 200 && firstHeatMaterial.msg) {
|
||||||
this.$set(this.updateForm, 'packingStatus', 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) {
|
} catch (error) {
|
||||||
this.$message.error('加载钢卷信息失败');
|
this.$message.error('加载钢卷信息失败');
|
||||||
|
|||||||
Reference in New Issue
Block a user