diff --git a/src/api/part/bomManagement.js b/src/api/part/bomManagement.js index 614e9c1..882b094 100644 --- a/src/api/part/bomManagement.js +++ b/src/api/part/bomManagement.js @@ -56,6 +56,13 @@ export const queryBomComponent = data => createAPI(`/plm/bomManagement/queryBomC */ export const bomDetailSave = data => createAPI(`/plm/bomManagement/bomDetailSave`,'post',data) +/** + * bom明细编辑 + * @param data + * @returns {*} + */ +export const bomDetailUpdate = data => createAPI(`/plm/bomManagement/bomDetailUpdate`,'post',data) + /** * bom明细删除 * @param data diff --git a/src/api/part/routingManagement.js b/src/api/part/routingManagement.js index add3d68..28fefac 100644 --- a/src/api/part/routingManagement.js +++ b/src/api/part/routingManagement.js @@ -56,6 +56,13 @@ export const queryRoutingComponent = data => createAPI(`/plm/routingManagement/q */ export const routingDetailSave = data => createAPI(`/plm/routingManagement/routingDetailSave`,'post',data) +/** + * routing明细编辑 + * @param data + * @returns {*} + */ +export const routingDetailUpdate = data => createAPI(`/plm/routingManagement/routingDetailUpdate`,'post',data) + /** * routing明细删除 * @param data diff --git a/src/views/modules/part/bomManagement.vue b/src/views/modules/part/bomManagement.vue index 87e200a..8eda0b4 100644 --- a/src/views/modules/part/bomManagement.vue +++ b/src/views/modules/part/bomManagement.vue @@ -153,10 +153,11 @@ 新增 删除 + 编辑 - + - + + + + + + + + - + - + @@ -234,21 +242,30 @@ - + - + - + + + + + + + + + + - + - + @@ -411,6 +428,7 @@ import { saveBomHeader, // 新增bom主信息 queryBomDetail, // 查bom明细 bomDetailSave, // bom明细新增 + bomDetailUpdate, // bom明细编辑 bomDetailDelete, // bom明细删除 queryPartList, // 查询物料清单 queryBomComponent, // 查询bom子明细 @@ -505,6 +523,7 @@ export default { minLotQty: '', defaultFlag: '', detailNoteText: '', + status: '', createDate: '', createBy: '', updateDate: '', @@ -547,6 +566,7 @@ export default { partDesc: '', }, saveDetailData: { + flag: '', site: this.$store.state.user.site, partNo: '', engChgLevel: '', @@ -556,6 +576,7 @@ export default { minLotQty: '', defaultFlag: '', detailNoteText: '', + status: '', createDate: '', createBy: '', updateDate: '', @@ -1065,13 +1086,6 @@ export default { message: ' ', trigger: 'change' } - ], - alternativeNo: [ - { - required: true, - message: ' ', - trigger: 'change' - } ] }, detailRules: { @@ -1096,6 +1110,13 @@ export default { trigger: 'change' } ], + status: [ + { + required: true, + message: ' ', + trigger: 'change' + } + ] }, componentRules: { componentPart: [ @@ -1149,6 +1170,7 @@ export default { partModelFlag: false, componentPartModelFlag: false, saveDetailModalFlag :false, + saveDetailModalDisable: false, componentSaveModal: false, componentDisableFlag: false } @@ -1284,6 +1306,7 @@ export default { minLotQty: '', defaultFlag: '', detailNoteText: '', + status: 'Tentative', createDate: '', createBy: '', updateDate: '', @@ -1328,13 +1351,110 @@ export default { }) }, /** - * 新增子明细 + * 替代新增模态框 + */ + saveBomDetail () { + if (this.modalData.partNo === '' || this.modalData.partNo == null) { + this.$message.warning('请先选择Bom物料!') + return + } + if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) { + this.$message.warning('请先填写Bom版本号!') + return + } + if (this.modalData.bomType === '' || this.modalData.bomType == null) { + this.$message.warning('请先选择制造类型!') + return + } + this.saveDetailData = { + flag: '1', + site: this.$store.state.user.site, + partNo: this.modalData.partNo, + engChgLevel: this.modalData.engChgLevel, + bomType: this.modalData.bomType, + alternativeNo: '', + alternativeDescription: '', + minLotQty: 0, + defaultFlag: '', + detailNoteText: '', + status: 'Tentative', + createDate: '', + createBy: this.$store.state.user.name, + } + // 查询bom主信息 + queryBomHeader(this.modalData).then(({data}) => { + if (data && data.code === 0) { + if (data.rows.length > 0) { + this.saveDetailModalFlag = true + this.saveDetailModalDisable = false + } else { + this.$message.warning('请先保存BOM主记录!') + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + }, + /** + * 替代编辑模态框 + */ + updateBomDetail () { + if (this.modalData.partNo === '' || this.modalData.partNo == null) { + this.$message.warning('请先选择Bom物料!') + return + } + if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) { + this.$message.warning('请先填写Bom版本号!') + return + } + if (this.modalData.bomType === '' || this.modalData.bomType == null) { + this.$message.warning('请先选择制造类型!') + return + } + this.saveDetailData = { + flag: '2', + site: this.detailData.site, + partNo: this.detailData.partNo, + engChgLevel: this.detailData.engChgLevel, + bomType: this.detailData.bomType, + alternativeNo: this.detailData.alternativeNo, + alternativeDescription: this.detailData.alternativeDescription, + minLotQty: this.detailData.minLotQty, + defaultFlag: '', + detailNoteText: this.detailData.detailNoteText, + status: this.detailData.status, + updateBy: this.$store.state.user.name, + } + // 查询bom主信息 + queryBomHeader(this.modalData).then(({data}) => { + if (data && data.code === 0) { + if (data.rows.length > 0) { + this.saveDetailModalFlag = true + this.saveDetailModalDisable = true + } else { + this.$message.warning('请先保存BOM主记录!') + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + }, + /** + * 子明细新增模态框 */ saveComponentModal () { if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) { this.$message.warning('请先选择替代!') return } + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } this.componentData = { flag: '1', site: this.$store.state.user.site, @@ -1362,9 +1482,13 @@ export default { this.componentSaveModal = true }, /** - * 编辑模态框 + * 子明细编辑模态框 */ updateComponentModal (row) { + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } this.componentData = { flag: '2', site: row.site, @@ -1426,6 +1550,10 @@ export default { this.$message.warning('请选择替代!') return } + if (this.detailData.status === '' || this.detailData.status == null) { + this.$message.warning('请选择替代状态!') + return + } let tempData = { site: this.$store.state.user.site, partNo: this.modalData.partNo, @@ -1443,6 +1571,7 @@ export default { minLotQty: this.detailData.minLotQty, defaultFlag: this.detailData.defaultFlag, detailNoteText: this.detailData.detailNoteText, + status: this.detailData.status, createBy: this.$store.state.user.name, updateBy: this.$store.state.user.name, informationList: this.subDetailList @@ -1662,9 +1791,13 @@ export default { * 删除子物料 */ deleteComponentPart () { + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } if (this.checkedDetail.length === 0) { this.$message.warning('请选择要删除子物料!') - return + return; } else { this.$confirm("请是否确认删除该子明细记录?", "提示", { confirmButtonText: "确定", @@ -1865,50 +1998,6 @@ export default { this.saveHeaderLoading = false }) }, - /** - * 新增替代模态框 - */ - saveBomDetail () { - if (this.modalData.partNo === '' || this.modalData.partNo == null) { - this.$message.warning('请先选择Bom物料!') - return - } - if (this.modalData.engChgLevel === '' || this.modalData.engChgLevel == null) { - this.$message.warning('请先填写Bom版本号!') - return - } - if (this.modalData.bomType === '' || this.modalData.bomType == null) { - this.$message.warning('请先选择制造类型!') - return - } - this.saveDetailData = { - site: this.$store.state.user.site, - partNo: this.modalData.partNo, - engChgLevel: this.modalData.engChgLevel, - bomType: this.modalData.bomType, - alternativeNo: '', - alternativeDescription: '', - minLotQty: 0, - defaultFlag: '', - detailNoteText: '', - createDate: '', - createBy: this.$store.state.user.name, - } - // 查询bom主信息 - queryBomHeader(this.modalData).then(({data}) => { - if (data && data.code === 0) { - if (data.rows.length > 0) { - this.saveDetailModalFlag = true - } else { - this.$message.warning('请先保存BOM主记录!') - } - } else { - this.$alert(data.msg, '提示', { - confirmButtonText: '确定' - }) - } - }) - }, /** * 新增替代方法 */ @@ -1933,31 +2022,58 @@ export default { this.$message.warning('请填写替代名称!') return } + if (this.saveDetailData.status === '' || this.saveDetailData.status == null) { + this.$message.warning('请选择替代状态!') + return + } if (this.saveDetailData.minLotQty === '' || this.saveDetailData.minLotQty == null) { this.$message.warning('请填写最小订单数!') return } this.saveDetailLoading = true - bomDetailSave(this.saveDetailData).then(({data}) => { - if (data && data.code === 0) { - this.detailDataList = data.rows - this.detailData = this.saveDetailData - this.subDetailList = [] - this.saveDetailModalFlag = false - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => {} - }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - this.saveDetailLoading = false - }) + if (this.saveDetailData.flag === '1') { + bomDetailSave(this.saveDetailData).then(({data}) => { + if (data && data.code === 0) { + this.detailDataList = data.rows + this.detailData = this.saveDetailData + this.subDetailList = [] + this.saveDetailModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + this.saveDetailLoading = false + }) + } else { + bomDetailUpdate(this.saveDetailData).then(({data}) => { + if (data && data.code === 0) { + this.detailDataList = data.rows.detailDataList + this.detailData = data.rows.detailData + this.subDetailList = data.rows.subDetailList + this.saveDetailModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + this.saveDetailLoading = false + }) + } }, + /** * 删除替代 */ @@ -2112,7 +2228,6 @@ export default { height: 280px; padding: 0px; } - .numInput /deep/ .el-input__inner{ text-align: right; } diff --git a/src/views/modules/part/routingManagement.vue b/src/views/modules/part/routingManagement.vue index 0422817..ad13d03 100644 --- a/src/views/modules/part/routingManagement.vue +++ b/src/views/modules/part/routingManagement.vue @@ -141,10 +141,11 @@ 新增 删除 + 编辑 - + - + + + + + + + + - + @@ -221,12 +229,19 @@ - + + + + + + + + @@ -422,6 +437,7 @@ import { saveRoutingHeader, // 新增routing主信息 queryRoutingDetail, // 查routing明细 routingDetailSave, // routing明细新增 + routingDetailUpdate, // routing明细编辑 routingDetailDelete, // routing明细删除 queryPartList, // 查询物料清单 queryRoutingComponent, // 查询routing子明细 @@ -518,7 +534,8 @@ export default { forStdLotByDay: '', forLotByDay: '', minLotQty: '', - noteText: '', + detailNoteText: '', + status: '', createDate: '', createBy: '', updateDate: '', @@ -568,6 +585,7 @@ export default { operationName: '', }, saveDetailData: { + flag: '', site: this.$store.state.user.site, partNo: '', routingRevision: '', @@ -584,6 +602,7 @@ export default { forLotByDay: '', minLotQty: '', detailNoteText: '', + status: '', createDate: '', createBy: '', updateDate: '', @@ -1129,7 +1148,9 @@ export default { message: ' ', trigger: 'change' } - ], + ] + }, + detailRules: { alternativeNo: [ { required: true, @@ -1137,16 +1158,14 @@ export default { trigger: 'change' } ], - }, - detailRules: { - alternativeNo: [ + alternativeDescription: [ { required: true, message: ' ', trigger: 'change' } ], - alternativeDescription: [ + status: [ { required: true, message: ' ', @@ -1184,7 +1203,8 @@ export default { modalDisableFlag: false, partModelFlag: false, componentPartModelFlag: false, - saveDetailModalFlag :false, + saveDetailModalFlag: false, + saveDetailModalDisable: false, componentSaveModal: false, componentDisableFlag: false } @@ -1324,6 +1344,7 @@ export default { forLotByDay: '', minLotQty: '', detailNoteText: '', + status: 'Tentative', createBy: this.$store.state.user.name } this.subDetailList = [] @@ -1364,6 +1385,113 @@ export default { } }) }, + /** + * 新增替代模态框 + */ + saveRoutingDetail () { + if (this.modalData.partNo === '' || this.modalData.partNo == null) { + this.$message.warning('请先选择Routing物料!') + return + } + if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) { + this.$message.warning('请先填写Routing版本号!') + return + } + if (this.modalData.routingType === '' || this.modalData.routingType == null) { + this.$message.warning('请先选择工艺类型!') + return + } + this.saveDetailData = { + flag: '1', + site: this.$store.state.user.site, + partNo: this.modalData.partNo, + routingRevision: this.modalData.routingRevision, + routingType: this.modalData.routingType, + alternativeNo: '', + alternativeDescription: '', + routTemplateId: '', + planDate: '', + fixedLeadTimeDay: '', + fixedLeadTimeHour: '', + variableLeadTimeDay: '', + variableLeadTimeHour: '', + forStdLotByDay: '', + forLotByDay: '', + minLotQty: '', + detailNoteText: '', + status: 'Tentative', + createDate: '', + createBy: this.$store.state.user.name, + } + // 查询routing主信息 + queryRoutingHeader(this.modalData).then(({data}) => { + if (data && data.code === 0) { + if (data.rows.length > 0) { + this.saveDetailModalFlag = true + this.saveDetailModalDisable = false + } else { + this.$message.warning('请先保存Routing主记录!') + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + }, + /** + * 替代编辑模态框 + */ + updateRoutingDetail () { + if (this.modalData.partNo === '' || this.modalData.partNo == null) { + this.$message.warning('请先选择Routing物料!') + return + } + if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) { + this.$message.warning('请先填写Routing版本号!') + return + } + if (this.modalData.routingType === '' || this.modalData.routingType == null) { + this.$message.warning('请先选择工艺类型!') + return + } + this.saveDetailData = { + flag: '2', + site: this.detailData.site, + partNo: this.detailData.partNo, + routingRevision: this.detailData.routingRevision, + routingType: this.detailData.routingType, + alternativeNo: this.detailData.alternativeNo, + alternativeDescription: this.detailData.alternativeDescription, + routTemplateId: this.detailData.routTemplateId, + planDate: this.detailData.planDate, + fixedLeadTimeDay: this.detailData.fixedLeadTimeDay, + fixedLeadTimeHour: this.detailData.fixedLeadTimeHour, + variableLeadTimeDay: this.detailData.variableLeadTimeDay, + variableLeadTimeHour: this.detailData.variableLeadTimeHour, + forStdLotByDay: this.detailData.forStdLotByDay, + forLotByDay: this.detailData.forLotByDay, + minLotQty: this.detailData.minLotQty, + detailNoteText: this.detailData.detailNoteText, + status: this.detailData.status, + updateBy: this.$store.state.user.name, + } + // 查询routing主信息 + queryRoutingHeader(this.modalData).then(({data}) => { + if (data && data.code === 0) { + if (data.rows.length > 0) { + this.saveDetailModalFlag = true + this.saveDetailModalDisable = true + } else { + this.$message.warning('请先保存Routing主记录!') + } + } else { + this.$alert(data.msg, '提示', { + confirmButtonText: '确定' + }) + } + }) + }, /** * 新增子明细模态框 */ @@ -1372,6 +1500,10 @@ export default { this.$message.warning('请先选择替代!') return } + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } this.componentData = { flag: '1', site: this.$store.state.user.site, @@ -1409,6 +1541,10 @@ export default { * 编辑模态框 */ updateComponentModal (row) { + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } this.componentData = { flag: '2', site: row.site, @@ -1470,13 +1606,17 @@ export default { return } if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) { - this.$message.warning('请填写BOM版本号!') + this.$message.warning('请填写Routing版本号!') return } if (this.detailData.alternativeNo === '' || this.detailData.alternativeNo == null) { this.$message.warning('请选择替代!') return } + if (this.detailData.status === '' || this.detailData.status == null) { + this.$message.warning('请选择替代状态!') + return + } let tempData = { site: this.$store.state.user.site, partNo: this.modalData.partNo, @@ -1489,6 +1629,7 @@ export default { alternativeNo: this.detailData.alternativeNo, alternativeDescription: this.detailData.alternativeDescription, detailNoteText: this.detailData.detailNoteText, + status: this.detailData.status, createBy: this.$store.state.user.name, updateBy: this.$store.state.user.name, informationList: this.subDetailList @@ -1540,7 +1681,7 @@ export default { let tempArr = [] tempArr.push(this.modalData) if (this.modalData.flag === '1') { - this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', { + this.$confirm(`是否不保存且删除该条Routing记录?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -1577,7 +1718,7 @@ export default { let tempArr = [] tempArr.push(this.modalData) if (this.modalData.flag === '1') { - this.$confirm(`是否不保存且删除该条BOM记录?`, '提示', { + this.$confirm(`是否不保存且删除该条Routing记录?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' @@ -1706,6 +1847,10 @@ export default { * 删除子物料 */ deleteComponentPart () { + if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { + this.$message.warning('不可编辑的替代状态!') + return + } if (this.checkedDetail.length === 0) { this.$message.warning('请选择要删除子物料!') return @@ -1889,57 +2034,6 @@ export default { this.saveHeaderLoading = false }) }, - /** - * 新增替代模态框 - */ - saveRoutingDetail () { - if (this.modalData.partNo === '' || this.modalData.partNo == null) { - this.$message.warning('请先选择Routing物料!') - return - } - if (this.modalData.routingRevision === '' || this.modalData.routingRevision == null) { - this.$message.warning('请先填写Routing版本号!') - return - } - if (this.modalData.routingType === '' || this.modalData.routingType == null) { - this.$message.warning('请先选择工艺类型!') - return - } - this.saveDetailData = { - site: this.$store.state.user.site, - partNo: this.modalData.partNo, - routingRevision: this.modalData.routingRevision, - routingType: this.modalData.routingType, - alternativeNo: '', - alternativeDescription: '', - routTemplateId: '', - planDate: '', - fixedLeadTimeDay: '', - fixedLeadTimeHour: '', - variableLeadTimeDay: '', - variableLeadTimeHour: '', - forStdLotByDay: '', - forLotByDay: '', - minLotQty: '', - detailNoteText: '', - createDate: '', - createBy: this.$store.state.user.name, - } - // 查询routing主信息 - queryRoutingHeader(this.modalData).then(({data}) => { - if (data && data.code === 0) { - if (data.rows.length > 0) { - this.saveDetailModalFlag = true - } else { - this.$message.warning('请先保存Routing主记录!') - } - } else { - this.$alert(data.msg, '提示', { - confirmButtonText: '确定' - }) - } - }) - }, /** * 新增替代方法 */ @@ -1964,26 +2058,53 @@ export default { this.$message.warning('请填写替代名称!') return } + if (this.saveDetailData.status === '' || this.saveDetailData.status == null) { + this.$message.warning('请选择替代状态!') + return + } this.saveDetailLoading = true - routingDetailSave(this.saveDetailData).then(({data}) => { - if (data && data.code === 0) { - this.detailDataList = data.rows - this.detailData = this.saveDetailData - this.subDetailList = [] - this.saveDetailModalFlag = false - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => {} - }) - } else { - this.$alert(data.msg, '错误', { - confirmButtonText: '确定' - }) - } - this.saveDetailLoading = false - }) + if (this.saveDetailData.flag === '1') { + routingDetailSave(this.saveDetailData).then(({data}) => { + if (data && data.code === 0) { + this.detailDataList = data.rows + this.detailData = this.saveDetailData + this.subDetailList = [] + this.saveDetailModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + this.saveDetailLoading = false + }) + } else { + routingDetailUpdate(this.saveDetailData).then(({data}) => { + if (data && data.code === 0) { + this.detailDataList = data.rows.detailDataList + this.detailData = data.rows.detailData + this.subDetailList = data.rows.subDetailList + this.saveDetailModalFlag = false + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => {} + }) + } else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + this.saveDetailLoading = false + }) + } + }, /** * 删除替代