Browse Source

Merge remote-tracking branch 'origin/master'

master
常熟吴彦祖 5 months ago
parent
commit
9ec94e275e
  1. 136
      src/views/modules/inspection/myInspectionList.vue

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

@ -55,6 +55,7 @@
<script>
import { getMyInspectionList, createIqc, startInspection } from '@/api/inspection/inspectionRequestHeader.js'
import { actionIQCInspection, qcIQCInspectionSearch } from '@/api/qc/qc.js'
export default {
@ -183,29 +184,130 @@ export default {
const inspectionNo = data.inspectionNo
this.$message.success('IQC检验单创建成功:' + inspectionNo)
// 第二步:调用 startInspection 接口,传入 requestNo 和 itemNo
const startInspectionData = {
requestNo: row.requestNo,
itemNo: row.itemNo
// 第二步:createIqc 成功后,立即查询检验单并执行开始检验逻辑
const searchParams = {
site: row.site,
userName: this.$store.state.user.name,
inspectionNo: inspectionNo,
inspectionTypeNo: '105',
states: ['未开始', '待检验'],
page: 1,
limit: 1
}
startInspection(startInspectionData).then(({ data }) => {
if (data.code === 0) {
this.$message.success('开始验货成功')
// 刷新列表
this.getList()
// 跳转到 IQCResultEntry 页面,并传入检验单号作为查询条件
this.$router.push({
name: 'qc-IQCResultEntry',
query: {
inspectionNo: inspectionNo
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.error((data && data.msg) || '开始验货失败')
this.$message.warning('未找到检验单信息,将直接执行开始验货')
// 如果查询不到检验单,直接执行原有的 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.error('开始验货失败:' + error.message)
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.error((data && data.msg) || '创建IQC检验单失败')

Loading…
Cancel
Save