diff --git a/src/api/part/routingManagement.js b/src/api/part/routingManagement.js index 5b40355..5784446 100644 --- a/src/api/part/routingManagement.js +++ b/src/api/part/routingManagement.js @@ -160,3 +160,10 @@ export const getStandardOperations = data => createAPI(`/part/routingManagement/ * @returns {*} */ export const saveStandardOperation = data => createAPI(`/part/routingManagement/saveStandardOperation`,'post',data) + +/** + * 计算工时 + * @param data + * @returns {*} + */ +export const calculationTime = data => createAPI(`/part/routingManagement/calculationTime`,'post',data) diff --git a/src/views/modules/part/routingManagement.vue b/src/views/modules/part/routingManagement.vue index 3613883..2bcdab0 100644 --- a/src/views/modules/part/routingManagement.vue +++ b/src/views/modules/part/routingManagement.vue @@ -685,6 +685,7 @@ + 计算工时 保存 关闭 @@ -720,6 +721,7 @@ import { queryMaxOperationNo, // 查询最大工序号 getStandardOperations, // 根据物料的商品组1查维护的标准工序 saveStandardOperation, // 新增工序 + calculationTime, // 计算工时 } from '@/api/part/routingManagement.js' import {verifyData} from '@/api/part/partInformation.js' import {getSiteAndBuByUserName, getSiteAndBuByUserName2} from "@/api/qc/qc.js" @@ -2491,10 +2493,6 @@ export default { this.$message.warning('请先选择替代!') return } - // if (this.detailData.status != null && this.detailData.status !== '' && this.detailData.status !== 'Tentative') { - // this.$message.warning('不可编辑的替代状态!') - // return - // } this.standardOperationSelections = [] getStandardOperations(this.modalData).then(({data}) => { if (data && data.code === 0) { @@ -2508,6 +2506,42 @@ export default { }) }, + // 计算工时 + calculationTime () { + if (this.standardOperationSelections.length === 0) { + this.$message.warning('请选择要计算的工序!') + return + } + this.standardOperationList.forEach(item1 => { + const matchInList2 = this.standardOperationSelections.find(item2 => item1.operationNo === item2.operationNo) + if (matchInList2) { + item1.flag = 'Y' + } else { + item1.flag = '' + } + }) + let tempData = { + site: this.modalData.site, + buNo: this.modalData.buNo, + partNo: this.modalData.partNo, + operationList: this.standardOperationList + } + calculationTime(tempData).then(({data}) => { + if (data && data.code === 0) { + this.standardOperationList = data.rows + this.standardOperationList.forEach(item => { + if (item.flag === 'Y') { + this.$nextTick(() => this.$refs.standardOperationTable.toggleRowSelection(item,true)) + } + }) + } else { + this.$alert('工时相关属性未维护属性值', '提示', { + confirmButtonText: '确定' + }) + } + }) + }, + // 更新 Routing 的工序 saveStandardOperation () { if (this.standardOperationSelections.length === 0) {