修复酸轧实绩提交问题
This commit is contained in:
@@ -430,6 +430,12 @@ export default {
|
|||||||
async handleRowClick(row) {
|
async handleRowClick(row) {
|
||||||
// 快速点击防重:每次点击递增版本号,旧的 sync 任务检测到版本号变更后自动放弃
|
// 快速点击防重:每次点击递增版本号,旧的 sync 任务检测到版本号变更后自动放弃
|
||||||
const clickRev = ++this._clickRev
|
const clickRev = ++this._clickRev
|
||||||
|
|
||||||
|
// 记录点击前的钢卷号,用于判断是否同一行重复点击
|
||||||
|
const prevExcoilId = this.selectedRow
|
||||||
|
? (this.selectedRow.EXCOILID || this.selectedRow.excoilid || null)
|
||||||
|
: null
|
||||||
|
|
||||||
this.selectedRow = row
|
this.selectedRow = row
|
||||||
this.segData = null
|
this.segData = null
|
||||||
this.gaugeRows = null
|
this.gaugeRows = null
|
||||||
@@ -450,8 +456,12 @@ export default {
|
|||||||
// 如果期间又点击了其他行则放弃后续操作
|
// 如果期间又点击了其他行则放弃后续操作
|
||||||
if (this._clickRev !== clickRev) return
|
if (this._clickRev !== clickRev) return
|
||||||
|
|
||||||
// 后台静默同步到规程(不阻塞 UI)
|
// 同一钢卷重复点击:跳过规程同步,避免重复写入
|
||||||
this.autoSyncToActiveSpec(excoilId || encoilId, clickRev)
|
const isSameCoil = excoilId && excoilId === prevExcoilId
|
||||||
|
if (!isSameCoil) {
|
||||||
|
// 后台静默同步到规程(不阻塞 UI)
|
||||||
|
this.autoSyncToActiveSpec(excoilId || encoilId, clickRev)
|
||||||
|
}
|
||||||
|
|
||||||
await this.$nextTick()
|
await this.$nextTick()
|
||||||
// 加载完成后自动选中第一个趋势参数
|
// 加载完成后自动选中第一个趋势参数
|
||||||
@@ -879,22 +889,34 @@ export default {
|
|||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
if (guard()) return
|
if (guard()) return
|
||||||
|
|
||||||
// 确保 plan 点位存在
|
// 确保 plan 点位存在(幂等:插入失败时降级重查,应对并发竞态)
|
||||||
let planId
|
let planId
|
||||||
const ep = planMap[item.pointCode]
|
const ep = planMap[item.pointCode]
|
||||||
if (ep) {
|
if (ep) {
|
||||||
planId = ep.planId
|
planId = ep.planId
|
||||||
} else {
|
} else {
|
||||||
const r = await addProcessPlan({
|
try {
|
||||||
versionId,
|
const r = await addProcessPlan({
|
||||||
segmentType: 'PROCESS',
|
versionId,
|
||||||
segmentName: item.groupLabel,
|
segmentType: 'PROCESS',
|
||||||
pointName: item.pointName,
|
segmentName: item.groupLabel,
|
||||||
pointCode: item.pointCode,
|
pointName: item.pointName,
|
||||||
sortOrder: 0
|
pointCode: item.pointCode,
|
||||||
})
|
sortOrder: 0
|
||||||
if (guard()) return
|
})
|
||||||
planId = r.data
|
if (guard()) return
|
||||||
|
planId = r.data
|
||||||
|
// 写入本地 map,同一次 sync 内不再重复插入
|
||||||
|
planMap[item.pointCode] = { planId }
|
||||||
|
} catch (_dupErr) {
|
||||||
|
// 唯一键冲突:该点位已由并发请求写入,重新查询获取真实 planId
|
||||||
|
const refetch = await listProcessPlan({ versionId, pageNum: 1, pageSize: 500 })
|
||||||
|
if (guard()) return
|
||||||
|
const found = (refetch.rows || []).find(p => p.pointCode === item.pointCode)
|
||||||
|
if (!found) continue // 极端情况:查不到则跳过本条目
|
||||||
|
planId = found.planId
|
||||||
|
planMap[item.pointCode] = found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查已存储参数
|
// 查已存储参数
|
||||||
|
|||||||
Reference in New Issue
Block a user