diff --git a/src/api/orderIssure/soIssueNotify.js b/src/api/orderIssure/soIssueNotify.js index 2c7daf6..6eeab13 100644 --- a/src/api/orderIssure/soIssueNotify.js +++ b/src/api/orderIssure/soIssueNotify.js @@ -55,4 +55,5 @@ export const updateNotifyDetail = data => createAPI(`/orderIssure/issureNotify/u export const saveSOIssueNotifyOrderMateria = data => createAPI(`/orderIssure/issureNotify/saveSOIssueNotifyOrderMateria`,'post',data) -export const getBomAlternativeParts = data => createAPI(`/orderIssure/issureNotify/getBomAlternativeParts`,'post',data) \ No newline at end of file +export const getBomAlternativeParts = data => createAPI(`/orderIssure/issureNotify/getBomAlternativeParts`,'post',data) +export const getWorkCenterList = data => createAPI(`/orderIssure/issureNotify/getWorkCenterList`,'post',data) diff --git a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue index 82ca429..c73d959 100644 --- a/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue +++ b/src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue @@ -11,6 +11,7 @@ + @@ -104,13 +105,16 @@ @@ -129,7 +133,7 @@ - {{'新增'}} + {{'新增'}} - - + - - - + + + + + + + + + + + - + + + - + 保存 关闭 @@ -1060,7 +1081,8 @@ , deleteNotify, updateNotifyDetail, saveSOIssueNotifyOrderMateria, - getBomAlternativeParts + getBomAlternativeParts, + getWorkCenterList } from "@/api/orderIssure/soIssueNotify.js" import { searchShopOrderByPaging @@ -1096,6 +1118,7 @@ dataList5: [], dataList6: [], userBuList:[], + workCenterList: [], createNotifyFlag: false, saveOrderDetailFlag: false, closeData:{ @@ -1148,6 +1171,7 @@ userDisplay: '', remark: '', planIssueDate: '', + workCenterNo: '' }, pageIndex: 1, pageSize: 100, @@ -2556,7 +2580,7 @@ if (!this.currentRow || !this.currentRow.status) { return false; } - return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中'; + return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中' || this.currentRow.status === '待确认'; } }, mounted () { @@ -2566,6 +2590,7 @@ }, created () { + this.getSiteAndBuByUserName() this.searchTable() }, @@ -2573,7 +2598,7 @@ // 批量编辑模态框 editBatchModel() { - if (this.currentRow.status !== '草稿' && this.currentRow.status !== '编辑中') { + if (this.currentRow.status !== '草稿' && this.currentRow.status !== '编辑中' && this.currentRow.status !== '待确认') { this.$message.warning('该类型单据不能编辑!') return } @@ -2927,7 +2952,7 @@ deleteNotifySOSPlus(row){ // 检查当前状态是否允许编辑 if (!this.isEditableStatusComputed) { - this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能删除明细。', '提示', { + this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能删除明细。', '提示', { confirmButtonText: '确定' }) return false @@ -2956,34 +2981,62 @@ }) }, - //申请单主表新增方法 //新增领料申请单模态框 createNotifyModal(){ - let inData={ - username:this.$store.state.user.name + this.notifyData = { + site: '', + bu: this.userBuList[0].buNo, + notifyNo: '', + notifyDate: '', + enteredDate: '', + userName: this.$store.state.user.name, + userDisplay: '', + remark: '', + planIssueDate: '', + workCenterNo: '' + } + this.createNotifyFlag = true + }, + + getSiteAndBuByUserName() { + let inData = { + username: this.$store.state.user.name } getSiteAndBuByUserName(inData).then(({data}) =>{ if (data && data.code === 0) { - this.userBuList=data.rows + this.userBuList = data.rows if (this.userBuList.length > 0) { - this.notifyData.bu = this.userBuList[0].buNo + this.getWorkCenterList() } } }) - this.createNotifyFlag=true }, + + // 查加工中心 + getWorkCenterList() { + let inData = { + site: this.userBuList[0].buNo.split('_')[0], + buNo: this.userBuList[0].buNo.split('_')[1] + } + getWorkCenterList(inData).then(({data}) =>{ + if (data && data.code === 0) { + this.workCenterList = data.rows + } + }) + }, + //保存领料申请单 - saveNotify(){ + saveNotify() { let buValue = this.notifyData.bu let site = buValue.split('_')[0] let bu = buValue.split('_')[1] - - let inData={ + let inData = { site: site, bu: bu, - userName:this.$store.state.user.name, - remark: this.notifyData.remark + userName: this.$store.state.user.name, + remark: this.notifyData.remark, + workCenterNo: this.notifyData.workCenterNo, } createNotify(inData).then(({data})=>{ if (data.code === 0) { @@ -2996,18 +3049,6 @@ this.createNotifyFlag = false // 刷新主表数据 this.searchTable() - // 清空表单数据 - this.notifyData = { - site: '', - bu: '', - notifyNo: '', - notifyDate: '', - enteredDate: '', - userName: this.$store.state.user.name, - userDisplay: '', - remark: '', - planIssueDate: '', - } }else { this.$alert(data.msg, '错误', { confirmButtonText: '确定' @@ -3028,7 +3069,7 @@ // 检查当前状态是否允许编辑 if (!this.isEditableStatusComputed) { - this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增明细。', '提示', { + this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能新增明细。', '提示', { confirmButtonText: '确定' }) return false @@ -3596,6 +3637,50 @@ this.$message.success('选择物料成功,数据已填入表单'); }, + //提交申请单方法 + async submitNotifyModel(row){ + // 设置当前行为要提交的行 + this.currentRow = JSON.parse(JSON.stringify(row)); + + // 先刷新子表数据,确保获取最新数据 + await this.refreshAllSubTables(); + + console.log('申请单明细数据:', this.dataList2); + console.log('材料明细数据:', this.dataList3); + + if(this.dataList2.length==0 || this.dataList3.length==0){ + this.$alert('没有明细记录无法提交!', '提示', { + confirmButtonText: '确定' + }) + return false + } + + // 调用更新状态接口,将状态改为"待确认" + let inData = { + site: row.site, + notifyNo: row.notifyNo, + status: '待确认', + } + updateNotifyStatus(inData).then(({data})=>{ + if (data.code === 0) { + //刷新主表数据 + this.searchTable().then(() => { // 等刷新完成 + const foundRow = this.dataList.find(item => item.notifyNo === row.notifyNo); + if (foundRow) { + this.currentRow = JSON.parse(JSON.stringify(foundRow)); + this.$nextTick(() => { + this.$refs.mainTable.setCurrentRow(foundRow); + }); + } + }); + this.$message.success('提交成功') + }else { + this.$alert(data.msg, '错误', { + confirmButtonText: '确定' + }) + } + }) + }, //下达申请单方法 async xiadaNotifyModel(row){ // 设置当前行为要下达的行 @@ -3698,7 +3783,7 @@ if (!this.currentRow || !this.currentRow.status) { return false; } - return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中'; + return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中' || this.currentRow.status === '待确认'; }, // 计算申请数量 @@ -3728,7 +3813,7 @@ } if (!this.isEditableStatus()) { - this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增材料。', '提示', { + this.$alert('当前状态不允许编辑!只有草稿、编辑中或待确认状态才能新增材料。', '提示', { confirmButtonText: '确定' }); return false;