Browse Source

feat(inspection): 优化IQC检验流程增加状态检查和异常处理

- 引入qc模块的actionIQCInspection和qcIQCInspectionSearch接口
- 在创建检验单后增加检验单状态查询逻辑
- 添加开始检验状态更新功能,确保检验单状态正确流转
- 增强错误处理机制,当状态更新失败时仍能继续执行后续流程
- 实现双重保障机制,查询失败时直接执行原有验货流程
- 优化用户体验,添加更详细的进度提示和警告信息
master
qiankanghui 1 week ago
parent
commit
dbafce561c
  1. 110
      src/views/modules/inspection/myInspectionList.vue

110
src/views/modules/inspection/myInspectionList.vue

@ -55,6 +55,7 @@
<script> <script>
import { getMyInspectionList, createIqc, startInspection } from '@/api/inspection/inspectionRequestHeader.js' import { getMyInspectionList, createIqc, startInspection } from '@/api/inspection/inspectionRequestHeader.js'
import { actionIQCInspection, qcIQCInspectionSearch } from '@/api/qc/qc.js'
export default { export default {
@ -183,7 +184,86 @@ export default {
const inspectionNo = data.inspectionNo const inspectionNo = data.inspectionNo
this.$message.success('IQC检验单创建成功:' + inspectionNo) this.$message.success('IQC检验单创建成功:' + inspectionNo)
// startInspection requestNo itemNo
// createIqc
const searchParams = {
site: row.site,
userName: this.$store.state.user.name,
inspectionNo: inspectionNo,
inspectionTypeNo: '105',
states: ['未开始', '待检验'],
page: 1,
limit: 1
}
qcIQCInspectionSearch(searchParams).then(({ data }) => {
if (data.code === 0 && data.page.list && data.page.list.length > 0) {
const iqcRecord = data.page.list[0]
// ""
const actionIQCData = {
site: iqcRecord.site,
buNo: iqcRecord.buNo,
inspectionNo: inspectionNo,
actionBy: this.$store.state.user.name,
state: '待检验',
equipmentList: []
}
actionIQCInspection(actionIQCData).then(({ data }) => {
if (data.code === 0) {
this.$message.success('开始检验成功')
} else {
this.$message.warning((data && data.msg) || '开始检验失败,但不影响后续操作')
}
// startInspection
const startInspectionData = {
requestNo: row.requestNo,
itemNo: row.itemNo
}
startInspection(startInspectionData).then(({ data }) => {
if (data.code === 0) {
this.$message.success('开始验货成功')
this.getList()
this.$router.push({
name: 'qc-IQCResultEntry',
query: {
inspectionNo: inspectionNo
}
})
} else {
this.$message.error((data && data.msg) || '开始验货失败')
}
}).catch((error) => {
this.$message.error('开始验货失败:' + error.message)
})
}).catch((error) => {
this.$message.warning('开始检验异常:' + error.message + ',继续执行后续操作')
// 使 startInspection
const startInspectionData = {
requestNo: row.requestNo,
itemNo: row.itemNo
}
startInspection(startInspectionData).then(({ data }) => {
if (data.code === 0) {
this.$message.success('开始验货成功')
this.getList()
this.$router.push({
name: 'qc-IQCResultEntry',
query: {
inspectionNo: inspectionNo
}
})
} else {
this.$message.error((data && data.msg) || '开始验货失败')
}
}).catch((error) => {
this.$message.error('开始验货失败:' + error.message)
})
})
} else {
this.$message.warning('未找到检验单信息,将直接执行开始验货')
// startInspection
const startInspectionData = { const startInspectionData = {
requestNo: row.requestNo, requestNo: row.requestNo,
itemNo: row.itemNo itemNo: row.itemNo
@ -191,10 +271,7 @@ export default {
startInspection(startInspectionData).then(({ data }) => { startInspection(startInspectionData).then(({ data }) => {
if (data.code === 0) { if (data.code === 0) {
this.$message.success('开始验货成功') this.$message.success('开始验货成功')
//
this.getList() this.getList()
// IQCResultEntry
this.$router.push({ this.$router.push({
name: 'qc-IQCResultEntry', name: 'qc-IQCResultEntry',
query: { query: {
@ -207,6 +284,31 @@ export default {
}).catch((error) => { }).catch((error) => {
this.$message.error('开始验货失败:' + error.message) this.$message.error('开始验货失败:' + error.message)
}) })
}
}).catch((error) => {
this.$message.warning('查询检验单失败:' + error.message + ',将直接执行开始验货')
// startInspection
const startInspectionData = {
requestNo: row.requestNo,
itemNo: row.itemNo
}
startInspection(startInspectionData).then(({ data }) => {
if (data.code === 0) {
this.$message.success('开始验货成功')
this.getList()
this.$router.push({
name: 'qc-IQCResultEntry',
query: {
inspectionNo: inspectionNo
}
})
} else {
this.$message.error((data && data.msg) || '开始验货失败')
}
}).catch((error) => {
this.$message.error('开始验货失败:' + error.message)
})
})
} else { } else {
this.$message.error((data && data.msg) || '创建IQC检验单失败') this.$message.error((data && data.msg) || '创建IQC检验单失败')
} }

Loading…
Cancel
Save