Browse Source

feat(srmPart): 添加供应商价格表查看功能

- 在产品信息列表操作列增加价格表链接按钮
- 新增供应商可供物料价格表弹窗组件,展示阶梯价格信息
- 实现按默认供应商和物料编码查询当前生效阶梯价功能
- 添加价格表弹窗状态管理和数据加载逻辑
- 新增共用阶梯价加载方法供其他模块调用

fix(iqc): 优化检验结果录入界面交互控制

- 使用统一的 itemTableDisabled 计算属性控制表格只读状态
- 当已提交或状态为待审核时禁用实测值和检验结论修改
- 移除过时的不合格项目强制选择验证逻辑
- 调整需求:检验结论为不合格时不再必须有不合格项目

feat(partInfo): 优化SKU与基准料号一致性校验流程

- 完善SKU管理冲突处理机制,支持统一修改基准料号下所有SKU
- 基准料号已对应其他SKU时提供统一修改选项而非直接拦截
- 返回Promise<boolean>类型的校验结果用于流程控制
- 优化指定SKU功能的冲突提示和处理逻辑
master
qiankanghui 1 month ago
parent
commit
cb2fcb297e
  1. 2
      src/views/modules/order/poOrder.vue
  2. 27
      src/views/modules/qc/IQCResultEntry.vue
  3. 167
      src/views/modules/srmPart/partInfoList.vue

2
src/views/modules/order/poOrder.vue

@ -1725,7 +1725,7 @@ export default {
fixed: '',
columnWidth: 90,
showOverflowTooltip: true,
editAble: true,
editAble: false,
editType: 'text',
selectOptionsKey: '',
selectOptions: null

27
src/views/modules/qc/IQCResultEntry.vue

@ -375,8 +375,8 @@
min-width="60"
label="实测值">
<template slot-scope="scope">
<el-input :ref="`textValue${scope.$index}`" v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numberValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" type="number" @change="updateItemResult(scope.row)" style="height: 10px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-else v-model="scope.row.textValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" style="height: 10px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numberValue" :disabled="itemTableDisabled" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" type="number" @change="updateItemResult(scope.row)" style="height: 10px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-else v-model="scope.row.textValue" :disabled="itemTableDisabled" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" style="height: 10px; width: 98%"></el-input>
</template>
</el-table-column>
<el-table-column
@ -386,7 +386,7 @@
min-width="90"
label="项目检验结论">
<template slot-scope="scope">
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.itemResult" disabled style="height: 10px;padding: 0px" >
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="itemTableDisabled" v-model="scope.row.itemResult" disabled style="height: 10px;padding: 0px" >
<el-option label="合格" value="Y" style="color: green"></el-option>
<el-option label="不合格" value="N" style="color: red"></el-option>
</el-select>
@ -425,7 +425,7 @@
min-width="80"
label="不合格数量">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.unqualifiedQuantity" disabled style="height: 10px; width: 98%"></el-input-number>
<el-input-number :controls="false" :step="0" v-if="itemTableDisabled" v-model="scope.row.unqualifiedQuantity" disabled style="height: 10px; width: 98%"></el-input-number>
<el-input-number :controls="false" :step="0" v-else :ref="`unqualifiedQuantity${scope.$index}`" v-model="scope.row.unqualifiedQuantity" @keyup.enter.native="focusNextInput(scope.$index, 'unqualifiedQuantity')" style="height: 10px; width: 98%"></el-input-number>
</template>
</el-table-column>
@ -834,6 +834,10 @@
}
return this.tableData.slice(start,end)
},
// 检验项目表格只读标记:已提交或状态为待审核时,实测值/项目检验结论/不合格数量均不允许修改 - rqrq
itemTableDisabled () {
return this.detailData.submitFlag === 'Y' || this.detailData.state === '待审核'
}
},
watch: {
'$route.query.inspectionNo': {
@ -2793,13 +2797,14 @@
this.$message.warning('请选择处置措施!')
return
}
if (this.detailList.length > 0 && this.detailData.inspectionResult === '不合格') {
const flag = this.detailList.some(item => item.itemResult === 'N')
if (!flag) {
this.$message.warning('请选择不合格项目!')
return
}
}
// 需求调整:不再限制“检验结论为不合格时必须有不合格项目”,检验项目全合格也允许按不合格提交 - rqrq
// if (this.detailList.length > 0 && this.detailData.inspectionResult === '不合格') {
// const flag = this.detailList.some(item => item.itemResult === 'N')
// if (!flag) {
// this.$message.warning('请选择不合格项目!')
// return
// }
// }
if (this.detailData.inspectionResult !== '不合格') {
this.detailData.disposalMeasures = ''
this.detailData.disposalRemark = ''

167
src/views/modules/srmPart/partInfoList.vue

@ -93,12 +93,13 @@
fixed="right"
header-align="center"
align="center"
width="200"
width="260"
label="操作">
<template slot-scope="scope">
<!-- <el-link style="cursor: pointer" v-if="scope.row.flowStatus === 'COMPLETED' || scope.row.flowStatus === 'TERMINATED'" @click="handleRestart(scope.row)">重新审批 |</el-link>
<el-link style="cursor: pointer" v-if="scope.row.flowStatus === 'RUNNING'" @click="openApproveDialog(scope.row)">审批 |</el-link> -->
<!-- <el-link style="cursor: pointer" v-if="scope.row.partStage === 'Created'" @click="startFormalApprove(scope.row)">转正 |</el-link>-->
<el-link style="cursor: pointer" @click="openCurrentRowPriceDialog(scope.row)">价格表 |</el-link>
<el-link style="cursor: pointer" @click="openChangeDefaultSupplier(scope.row)">变更默认供应商 |</el-link>
<el-link style="cursor: pointer" @click="editPart(scope.row)">编辑 |</el-link>
<el-link style="cursor: pointer" @click="deletePart(scope.row)">删除</el-link>
@ -137,6 +138,46 @@
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<PartAdvancedCopyDialog ref="advancedCopyDialog" @copied="getMainData" />
<!--
供应商可供物料价格表弹窗(沿用 poOrder.vue 查看价格表实现) - rqrq
用途:按默认供应商 + 物料编码查询当前生效阶梯价并展示
关联状态:
priceDialogVisible / priceDialogRows / priceDialogLoading
priceDialogPartNo / priceDialogSupplierNo
-->
<el-dialog
title="供应商可供物料价格表"
v-drag
:visible.sync="priceDialogVisible"
width="680px"
top="8vh"
append-to-body
:close-on-click-modal="false"
@closed="resetSupplierPartPriceDialog">
<div style="margin-bottom: 10px; color: #606266;">
<span>供应商:{{ priceDialogSupplierNo }}</span>
<span style="margin-left: 16px;">物料编码:{{ priceDialogPartNo }}</span>
</div>
<el-table
:data="priceDialogRows"
:height="360"
border
stripe
v-loading="priceDialogLoading"
empty-text="该供应商物料未维护价格表">
<el-table-column prop="qtyStart" label="数量起" min-width="100" header-align="center" align="center" />
<el-table-column label="数量止" min-width="100" header-align="center" align="center">
<template slot-scope="scope">{{ scope.row.qtyEnd === null || scope.row.qtyEnd === undefined || scope.row.qtyEnd === '' ? '∞' : scope.row.qtyEnd }}</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" min-width="100" header-align="center" align="center" />
<el-table-column prop="priceDate" label="价格日期" min-width="120" header-align="center" align="center" />
<el-table-column prop="remark" label="备注" min-width="160" header-align="center" align="left" show-overflow-tooltip />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="priceDialogVisible = false">关闭</el-button>
</div>
</el-dialog>
<!-- 产品编辑对话框 -->
<!-- 默认弹窗可拖动,特殊需求除外 - rqrq -->
<el-dialog :title="isAdd ? '新增产品' : '编辑产品'" :visible.sync="partDialogVisible" width="720px" top="3vh" :close-on-click-modal="false" class="part-dialog" v-drag>
@ -423,6 +464,7 @@ import {
checkSkuBasePartNo
} from '@/api/part/partInfo.js'
import { checkSupplierPartByItemSku, addSupplierPartMoq } from '@/api/supplier/supplierPartMoqPrice'
import { listPoCurrentTierPrice } from '@/api/order/poOrder'
import { startNewProductAudit } from '@/api/supplier/supplierPartNewProductAudit'
import excel from '@/utils/excel-util.js'
import Chooselist from '@/views/modules/common/Chooselist_eam'
@ -920,6 +962,12 @@ export default {
// }
],
exportName: '产品信息' + this.dayjs().format('YYYYMMDDHHmmss'),
// 供应商可供物料价格表弹窗状态 - rqrq
priceDialogVisible: false,
priceDialogLoading: false,
priceDialogRows: [],
priceDialogPartNo: '',
priceDialogSupplierNo: '',
// 产品对话框相关
partDialogVisible: false,
isAdd: true,
@ -1294,7 +1342,8 @@ export default {
}).then(({ data }) => {
this.specifySkuSaving = false
if (data && data.code === 0) {
this.$message.success(`指定成功,共更新 ${data.updatedCount || 0} 条物料`)
const updatedCount = data.updatedCount || 0
this.$message.success(updatedCount > 0 ? `指定成功,共更新 ${updatedCount} 条物料` : '该基准料号下物料SKU已是最新,已同步SKU对照表')
this.specifySkuDialogVisible = false
this.getMainData()
} else {
@ -1305,6 +1354,58 @@ export default {
this.$message.error('指定SKU失败: ' + error.message)
})
},
// 查看当前物料价格表:按默认供应商 + 物料编码查当前生效阶梯价(同 poOrder.vue) - rqrq
openCurrentRowPriceDialog (row) {
if (!row || !row.partNo) {
this.$message.warning('请先选择一行数据')
return
}
const site = String(row.site || this.$store.state.user.site || '').trim()
const supplierCode = String(row.defaultSupplierNo || row.supplierNo || '').trim()
const partNo = String(row.partNo || '').trim()
if (!site || !supplierCode || !partNo) {
this.$message.warning('当前行缺少供应商或物料编码,无法查询价格')
return
}
this.loadSupplierPartPriceDialog({ site, supplierCode, partNo })
},
// 共用的阶梯价加载:拉取当前生效阶梯价并渲染到价格弹窗
loadSupplierPartPriceDialog ({ site, supplierCode, partNo }) {
this.priceDialogPartNo = partNo
this.priceDialogSupplierNo = supplierCode
this.priceDialogRows = []
this.priceDialogVisible = true
this.priceDialogLoading = true
listPoCurrentTierPrice({
site,
supplierCode,
partNo
}).then(({ data }) => {
if (data && data.code === 0) {
this.priceDialogRows = (data.rows || []).map(item => ({
qtyStart: (item.qtyStart === null || item.qtyStart === undefined) ? '' : item.qtyStart,
qtyEnd: (item.qtyEnd === null || item.qtyEnd === undefined) ? '' : item.qtyEnd,
unitPrice: (item.unitPrice === null || item.unitPrice === undefined) ? '' : item.unitPrice,
priceDate: item.priceDate || '',
remark: item.remark || ''
}))
return
}
this.priceDialogRows = []
this.$message.error((data && data.msg) || '获取供应商价格表失败')
}).catch(() => {
this.priceDialogRows = []
this.$message.error('获取供应商价格表失败')
}).finally(() => {
this.priceDialogLoading = false
})
},
resetSupplierPartPriceDialog () {
this.priceDialogLoading = false
this.priceDialogRows = []
this.priceDialogPartNo = ''
this.priceDialogSupplierNo = ''
},
openChangeDefaultSupplier (row) {
if (!row || !row.partNo) {
this.$message.warning('请先选择物料')
@ -1816,7 +1917,8 @@ export default {
* 新增时校验 SKU 与基准料号互为一一对应(仅新增弹窗、两者均有值时触发):
* part_sku 无该 SKU → 放行,保存物料时自动新建;
* SKU 存在但基准料号为空 → 后端自动回填本次基准料号后放行;
* SKU 已对应其他基准料号,或基准料号已对应其他 SKU → 拦截并提示去 SKU 管理页人工维护。
* SKU 已对应其他基准料号 → 仍然拦截,提示去 SKU 管理页人工维护;
* 基准料号已对应其他 SKU → 询问是否统一修改该基准料号下的产品SKU(同“指定SKU”功能)。
*/
ensureSkuBasePartNoConsistent () {
const basePartNo = (this.currentpart.basePartNo || '').trim().toUpperCase()
@ -1829,8 +1931,9 @@ export default {
},
/**
* 调用 part_sku 一致性校验接口:无记录放行、空基准料号后端自动回填、冲突提示拦截。
* 新增弹窗与“指定SKU”弹窗共用;skipNavigation=true 时冲突仅提示不跳转,留在当前弹窗。
* 调用 part_sku 一致性校验接口:无记录放行、空基准料号后端自动回填、冲突按场景处理。
* 新增弹窗与“指定SKU”弹窗共用;skipNavigation=true 时冲突不跳转,留在当前弹窗。
* 统一返回 Promise<boolean>:true 可继续保存/指定,false 中止。
*/
doSkuBasePartNoCheck (site, sku, basePartNo, skipNavigation) {
return checkSkuBasePartNo({
@ -1840,8 +1943,8 @@ export default {
}).then(({ data }) => {
if (data && data.code === 0) {
if (data.conflict) {
this.promptSkuBasePartNoConflict(data, sku, skipNavigation)
return false
// 冲突可能转为“统一修改该基准料号下的SKU”,按其结果决定是否继续
return this.promptSkuBasePartNoConflict(data, sku, skipNavigation, basePartNo)
}
return true
}
@ -1854,17 +1957,33 @@ export default {
})
},
// 冲突提示:新增场景选“是”关闭新增弹窗并跳转 SKU 管理页自动查询该 SKU;指定SKU场景仅提示不跳转,留在弹窗不执行指定
promptSkuBasePartNoConflict (data, sku, skipNavigation) {
let msg
// 冲突处理:基准料号已对应其他SKU时走“统一修改该基准料号下的SKU”;SKU 已被其他基准料号占用时仍人工维护拦截
promptSkuBasePartNoConflict (data, sku, skipNavigation, basePartNo) {
// 基准料号已对应其他SKU:本次目标就是把它们统一成新SKU,不存在占用风险,直接按统一修改处理
if (data.conflictType === 'BASE_PART_NO') {
msg = `基准料号 ${(this.currentpart.basePartNo || this.specifySkuForm.basePartNo || '').toUpperCase()} 已在 SKU 管理中对应 SKU ${data.conflictSku},与本次的 SKU ${sku} 不一致。`
} else {
msg = `SKU ${sku} 已在 SKU 管理中维护基准料号 ${data.dbBasePartNo},与本次的基准料号不一致。`
// “指定SKU”弹窗已二次确认过,直接放行到统一修改;新增弹窗需先询问用户
if (skipNavigation) {
return Promise.resolve(true)
}
return this.$confirm(
`当前基准料号的SKU为:${data.conflictSku},是否统一修改该基准料号下的产品SKU:${sku}?`,
'SKU与基准料号不一致',
{
confirmButtonText: '是',
cancelButtonText: '否',
type: 'warning'
}
).then(() => {
return this.unifySkuByBasePartNo(sku, basePartNo)
}).catch(() => {
this.$message.info('已取消统一修改,本次新增未保存,请调整SKU后再保存。')
return false
})
}
const msg = `SKU ${sku} 已在 SKU 管理中维护基准料号 ${data.dbBasePartNo},与本次的基准料号不一致。`
if (skipNavigation) {
this.$message.error(`${msg}请先到 SKU 管理页手动维护后再指定。`)
return
return Promise.resolve(false)
}
this.$confirm(
`${msg}是否前往 SKU 管理页手动维护?前往后将不再保存本次新增。`,
@ -1880,6 +1999,26 @@ export default {
}
this.$router.push({ name: 'srmBaseInformation-srmPartSku', query: { sku } })
}).catch(() => {})
return Promise.resolve(false)
},
// 按基准料号统一修改SKU(后端同步维护 part_sku:新增新SKU并清除原SKU的基准料号),成功返回 true 继续保存
unifySkuByBasePartNo (sku, basePartNo) {
return updateSkuByBasePartNo({
site: this.$store.state.user.site,
basePartNo,
sku
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success(`已统一修改该基准料号下的SKU为 ${sku}`)
return true
}
this.$message.error((data && data.msg) || '统一修改SKU失败')
return false
}).catch(() => {
this.$message.error('统一修改SKU失败,请稍后重试')
return false
})
},
// 原有价格表校验:供应商编码、Item、SKU 三者都有值时校验价格表是否已存在该组合

Loading…
Cancel
Save