Browse Source

多标签;标准工序;选择ProcessTimeMatrix

java8
han\hanst 5 months ago
parent
commit
5b094c4e87
  1. 14
      src/api/part/partProductGroupInformation.js
  2. 59
      src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue
  3. 409
      src/views/modules/part/quicklyCreateBom.vue
  4. 9
      src/views/modules/part/routing_create.vue
  5. 2
      src/views/modules/part/standardRoutingOperation.vue

14
src/api/part/partProductGroupInformation.js

@ -24,3 +24,17 @@ export const productGroupInformationEdit = data => createAPI(`/plm/partProductGr
* @returns {*}
*/
export const productGroupInformationDelete = data => createAPI(`/plm/partProductGroupInformation/productGroupInformationDelete`,'post',data)
/**
* 查询商品组的PTM条件
* @param data
* @returns {*}
*/
export const searchProductGroupPtmCondition = data => createAPI(`/plm/partProductGroupInformation/searchProductGroupPtmCondition`,'post',data)
/**
* 批量查询商品组下所有PTM条件及其参数一次查询
* @param data
* @returns {*}
*/
export const batchSearchProductGroupPtmConditionsWithItems = data => createAPI(`/plm/partProductGroupInformation/batchSearchProductGroupPtmConditionsWithItems`,'post',data)

59
src/views/modules/inquiry/inquiryTechnicalMaterialsNoBuilt.vue

@ -2773,7 +2773,64 @@ export default {
this.$router.push({ path: 'inquiry-inquiryDetail', query: { id : id} });
},
navigateToBomQuickCreation(data){
this.$router.push({ path: 'part-quicklyCreateBom',query:{ data: data} });
// 使testPartNoid
const uniqueName = `part-quicklyCreateBom-${data.testPartNo || data.id || Date.now()}`;
//
const route = {
path: uniqueName,
component: () => import('@/views/modules/part/quicklyCreateBom.vue'),
name: uniqueName,
meta: {
menuId: this.$router.resolve({ name: 'part-quicklyCreateBom' }).route.meta.menuId,
title: `BOM快速创建 - ${data.testPartNo || data.testPartDesc || ''}`,
isDynamic: true,
isTab: true,
iframeUrl: ''
}
};
//
const existingRoute = this.$router.options.routes.find(r => r.name === uniqueName);
if (!existingRoute) {
// main
this.$router.addRoutes([{
path: '/',
component: () => import('@/views/main.vue'),
name: 'main-dynamic-' + uniqueName,
children: [route]
}]);
}
//
const newTab = {
menuId: route.meta.menuId || uniqueName,
name: uniqueName,
title: route.meta.title,
type: 'module',
iframeUrl: '',
params: {},
query: { data: data }
};
//
const existingTab = this.$store.state.common.mainTabs.find(item => item.name === uniqueName);
if (!existingTab) {
//
this.$store.commit('common/updateMainTabs', [...this.$store.state.common.mainTabs, newTab]);
}
//
this.$store.commit('common/updateMainTabsActiveName', uniqueName);
this.$store.commit('common/updateMenuActiveName', newTab.menuId + '');
//
this.$router.push({
name: uniqueName,
query: { data: data }
}).catch(err => {
console.error('路由跳转失败:', err);
});
},
//
async getTableUserColumn(tableId, columnId) {

409
src/views/modules/part/quicklyCreateBom.vue

@ -502,6 +502,7 @@
<el-button type="primary" @click="addOrDelItem1">新增</el-button>
<el-button type="primary" :loading="loading" @click="clickSave1">{{ attributeFlag1?'编辑':'保存' }}</el-button>
<el-button type="primary" @click="chooseProcessTimeMatrix">选择ProcessTimeMatrix</el-button>
<el-button type="primary" @click="openPtmDialog">韩ProcessTimeMatrix</el-button>
</el-form>
<div class="rq " v-show="attributeFlag1">
<el-table
@ -1439,6 +1440,75 @@
</el-footer>
</el-dialog>
<!-- PTM参数选择对话框 -->
<el-dialog
title="选择ProcessTimeMatrix参数"
:close-on-click-modal="false"
v-drag
:visible.sync="ptmDialogVisible"
width="95%"
top="3vh">
<div class="rq">
<el-form :inline="true" label-position="top" style="margin-bottom: 10px">
<el-form-item label="Code筛选">
<el-input v-model="ptmSearchCode" placeholder="请输入条件描述" clearable style="width: 200px" @keyup.enter.native="filterPtmList"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="filterPtmList">筛选</el-button>
<el-button @click="resetPtmFilter">重置</el-button>
</el-form-item>
<el-form-item label=" " style="float: right">
<span style="color: #67C23A; font-size: 13px;">
💡 提示双击某一行直接添加该ProcessTimeMatrix的参数
</span>
</el-form-item>
</el-form>
<el-table
ref="ptmTable"
:data="filteredPtmDataList"
:height="520"
border
@row-dblclick="handlePtmRowDoubleClick"
highlight-current-row
:header-cell-style="{padding: '2px 2px', fontSize: '12px'}"
:cell-style="{padding: '2px 2px', fontSize: '11px', cursor: 'pointer'}"
style="width: 100%;">
<el-table-column
type="index"
label="序号"
width="60"
align="center"
fixed="left">
</el-table-column>
<el-table-column
prop="conditionDesc"
label="Code"
width="180"
header-align="center"
align="left"
fixed="left"
show-overflow-tooltip>
</el-table-column>
<el-table-column
v-for="(col, index) in ptmColumnList"
:key="index"
:prop="col.prop"
:label="col.label"
:min-width="col.width || 100"
header-align="center"
:align="col.align || 'center'"
show-overflow-tooltip>
<template slot-scope="scope">
<span>{{ scope.row[col.prop] || '-' }}</span>
</template>
</el-table-column>
</el-table>
</div>
<el-footer style="height:40px;margin-top: 20px;text-align:center">
<el-button type="primary" @click="ptmDialogVisible=false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 新增物料 -->
<part-create :init-data="searchData" ref="PartCreate" @update-part-item="getPartItem" @refreshPageTables="getBomInfo" @refreshPageTables2="getInfoByBomTemplate" v-drag></part-create>
@ -1467,6 +1537,7 @@ import RoutingCreate from "./routing_create.vue";
import PartCreate from "./part_create.vue";
import {updateInquiryDetailStatusAndPart} from "../../../api/inquiry/inquiryDetail";
import {EventBus} from "../../../main";
import {searchProductGroupPtmCondition, batchSearchProductGroupPtmConditionsWithItems} from "../../../api/part/partProductGroupInformation";
import {
addPartItem,
batchUpdateItem,
@ -3581,7 +3652,16 @@ export default {
copyPartModelFlag: false,
itemUpdateFlag: false,
processTimeMatrixFlag: false,
productGroupFlag: false
productGroupFlag: false,
ptmDialogVisible: false, // PTM
ptmDataList: [], // PTM53Code12
filteredPtmDataList: [], // PTM
ptmColumnList: [], // PTM12
ptmSearchCode: '', // PTM Code
ptmItemList: [], // PTMitem
selectedPtmItems: [], // PTM
copyPartModelFlag: false
}
},
created () {
@ -6006,7 +6086,332 @@ export default {
})
}
})
}
},
/**
* 打开PTM参数选择对话框
* 展示商品组1下所有ProcessTimeMatrix及其参数横向展示53 × 12
* 使用批量查询API只请求一次后台
*/
openPtmDialog() {
if (!this.attributeFlag1) {
this.$message.warning('请先保存当前编辑的内容!')
return
}
//
if (!this.partList1 || this.partList1.length === 0) {
this.$message.warning('请先选择物料!')
return
}
//
const firstPart = this.partList1[0]
if (!firstPart.productGroupId1) {
this.$message.warning('当前物料未设置商品组1,无法查询PTM参数!')
return
}
// PTM
const queryData = {
site: this.$store.state.user.site,
buNo: firstPart.buNo,
productGroupId: firstPart.productGroupId1
}
//
const loadingInstance = this.$loading({
lock: true,
text: '正在加载ProcessTimeMatrix数据...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
batchSearchProductGroupPtmConditionsWithItems(queryData).then(({data}) => {
loadingInstance.close()
if (data && data.code === 0) {
const ptmConditions = data.conditions || []
const allItems = data.items || []
if (ptmConditions.length === 0) {
this.$message.info('该商品组下未配置PTM参数')
return
}
if (allItems.length === 0) {
this.$message.info('该商品组的PTM配置中没有参数')
return
}
// itemsconditionId
this.processPtmData(ptmConditions, allItems)
} else {
this.$alert(data.msg || '查询PTM条件失败', '错误', {
confirmButtonText: '确定'
})
}
}).catch(error => {
loadingInstance.close()
this.$message.error('查询PTM条件异常')
console.error(error)
})
},
/**
* 处理PTM数据横向展示
* 将后端返回的数据处理成表格展示格式
* @param ptmConditions PTM条件列表
* @param allItems 所有参数列表
*/
processPtmData(ptmConditions, allItems) {
const flatDataList = []
const columnSet = new Set()
const columnMap = new Map()
// itemsconditionId
const itemsByCondition = {}
allItems.forEach(item => {
if (!itemsByCondition[item.conditionId]) {
itemsByCondition[item.conditionId] = []
}
itemsByCondition[item.conditionId].push(item)
//
if (!columnSet.has(item.itemNo)) {
columnSet.add(item.itemNo)
columnMap.set(item.itemNo, {
itemNo: item.itemNo,
itemDesc: item.itemDesc,
valueType: item.valueTypeDb,
valueChooseFlag: item.valueChooseFlag
})
}
})
//
ptmConditions.forEach(condition => {
const items = itemsByCondition[condition.conditionId] || []
if (items.length === 0) {
return
}
// conditionDesc
const rowData = {
conditionId: condition.conditionId,
conditionDesc: condition.conditionDesc,
seqNo: condition.seqNo,
site: condition.site,
buNo: condition.buNo,
productGroupId: condition.productGroupId,
items: items // items
}
//
items.forEach(item => {
const propName = `param_${item.itemNo}`
const displayValue = item.valueTypeDb === 'T' ? item.textValue : item.numValue
rowData[propName] = displayValue || '-'
})
flatDataList.push(rowData)
})
//
const columns = []
columnMap.forEach((colInfo, itemNo) => {
columns.push({
prop: `param_${itemNo}`,
label: colInfo.itemDesc || itemNo,
itemNo: itemNo,
valueType: colInfo.valueType,
width: 110,
align: colInfo.valueType === 'N' ? 'right' : 'left'
})
})
// itemNo
columns.sort((a, b) => a.itemNo.localeCompare(b.itemNo))
//
this.ptmDataList = flatDataList
this.filteredPtmDataList = flatDataList
this.ptmColumnList = columns
this.ptmSearchCode = ''
this.ptmDialogVisible = true
this.$message.success(`已加载 ${flatDataList.length} 个 ProcessTimeMatrix(共 ${columns.length} 个参数列)`)
},
/**
* 处理双击PTM行事件
* @param row 双击的行数据
*/
handlePtmRowDoubleClick(row) {
if (!row || !row.items || row.items.length === 0) {
this.$message.warning('该ProcessTimeMatrix没有参数!')
return
}
// loading
const loadingInstance = this.$loading({
lock: true,
text: '正在添加参数...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
//
this.addPtmItemsFromRow(row, loadingInstance)
},
/**
* 筛选PTM列表按Code条件描述
*/
filterPtmList() {
if (!this.ptmSearchCode || this.ptmSearchCode.trim() === '') {
this.filteredPtmDataList = this.ptmDataList
return
}
const searchText = this.ptmSearchCode.trim().toLowerCase()
this.filteredPtmDataList = this.ptmDataList.filter(row => {
return row.conditionDesc && row.conditionDesc.toLowerCase().includes(searchText)
})
if (this.filteredPtmDataList.length === 0) {
this.$message.info('没有找到匹配的ProcessTimeMatrix')
} else {
this.$message.success(`找到 ${this.filteredPtmDataList.length} 条匹配的ProcessTimeMatrix`)
}
},
/**
* 重置PTM筛选
*/
resetPtmFilter() {
this.ptmSearchCode = ''
this.filteredPtmDataList = this.ptmDataList
this.$message.info('已重置筛选条件')
},
/**
* 添加选中的PTM行的参数到物料属性列表
* @param row 双击的行数据
* @param loadingInstance loading实例
*/
addPtmItemsFromRow(row, loadingInstance) {
//
const allItems = []
if (row.items && row.items.length > 0) {
row.items.forEach(item => {
//
const itemData = {
itNo: item.itemNo, // itNo
valueTypeDb: item.valueTypeDb,
itemDesc: item.itemDesc
}
//
if (item.valueTypeDb === 'T') {
itemData.textValue = item.textValue || null
itemData.numValue = null
} else if (item.valueTypeDb === 'N') {
itemData.textValue = null
// numValue
itemData.numValue = item.numValue !== null && item.numValue !== undefined && item.numValue !== ''
? (typeof item.numValue === 'number' ? item.numValue : parseFloat(item.numValue))
: null
}
allItems.push(itemData)
})
}
if (allItems.length === 0) {
loadingInstance.close()
this.$message.warning('选中的ProcessTimeMatrix中没有参数!')
return
}
// 使addItem1
const partList = this.partList1.filter(item =>
item.partNo && item.partNo !== '' && item.buNo && item.buNo === this.searchData.buNo
)
if (partList.length === 0) {
loadingInstance.close()
this.$message.warning('没有符合条件的物料!')
return
}
const inDataList = []
for (let i = 0; i < partList.length; i++) {
if (!partList[i].codeNo || partList[i].codeNo === '') {
continue
}
inDataList.push({
site: partList[i].site,
buNo: partList[i].buNo,
partNo: partList[i].partNo,
codeNo: partList[i].codeNo,
codeDesc: partList[i].codeDesc,
recordType: 'IP',
itemList: allItems
})
}
if (inDataList.length === 0) {
loadingInstance.close()
this.$message.warning('请确保物料已配置属性模板(codeNo)!')
return
}
// addItem1
addPartsItem(inDataList).then(({data}) => {
if (data && data.code === 0) {
//
getItemLists(inDataList[0]).then(({data}) => {
this.itemList1 = data.row1
this.itemList2 = data.row2
loadingInstance.close()
//
this.getPartItem2()
this.$message.success(`成功添加 ${allItems.length} 个参数(ProcessTimeMatrix: ${row.conditionDesc}`)
//
this.ptmDialogVisible = false
//
this.ptmDataList = []
this.filteredPtmDataList = []
this.ptmColumnList = []
}).catch(error => {
loadingInstance.close()
this.getPartItem2()
this.$message.success(`成功添加 ${allItems.length} 个参数(ProcessTimeMatrix: ${row.conditionDesc}`)
this.ptmDialogVisible = false
this.ptmDataList = []
this.filteredPtmDataList = []
this.ptmColumnList = []
})
} else {
loadingInstance.close()
this.$alert(data.msg || '添加属性失败', '错误', {
confirmButtonText: '确定'
})
}
}).catch(error => {
loadingInstance.close()
this.$message.error('添加属性异常: ' + error.message)
console.error(error)
})
},
},
}

9
src/views/modules/part/routing_create.vue

@ -2181,6 +2181,12 @@ export default {
cancelButtonText: "取消",
type: "warning"
}).then(() => {
// operationNo standardOperationList
const selectedOperationNos = this.standardOperationSelections.map(item => item.operationNo)
const latestSelectedData = this.standardOperationList.filter(item =>
selectedOperationNos.includes(item.operationNo)
)
let tempData = {
site: this.detailData.site,
buNo: this.detailData.buNo,
@ -2188,10 +2194,11 @@ export default {
routingRevision: this.detailData.routingRevision,
routingType: this.detailData.routingType,
alternativeNo: this.detailData.alternativeNo,
informationList: this.standardOperationSelections
informationList: latestSelectedData // 使
}
saveStandardOperation(tempData).then(({data}) => {
if (data && data.code === 0) {
// ref_speedref_timeref_efficiency使
this.subDetailList = data.rows
this.standardOperationModal = false
this.$message({

2
src/views/modules/part/standardRoutingOperation.vue

@ -7,7 +7,7 @@
v-for = "i in userBuList"
:key = "i.buNo"
:label = "i.buDesc"
:value = "i.buNo">
:value = "i.buDesc">
</el-option>
</el-select>
</el-form-item>

Loading…
Cancel
Save