Browse Source

领料申请单

master
Yangzz 5 months ago
parent
commit
74a7858923
  1. 1
      src/api/orderIssure/soIssueNotify.js
  2. 212
      src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue

1
src/api/orderIssure/soIssueNotify.js

@ -17,6 +17,7 @@ export const deleteNotifySOS= data => createAPI(`/orderIssure/issureNotify/delet
export const deleteNotify= data => createAPI(`/orderIssure/issureNotify/deleteNotify`,'post',data) export const deleteNotify= data => createAPI(`/orderIssure/issureNotify/deleteNotify`,'post',data)
export const xiadaNotify= data => createAPI(`/orderIssure/issureNotify/xiadaNotify`,'post',data) export const xiadaNotify= data => createAPI(`/orderIssure/issureNotify/xiadaNotify`,'post',data)
export const editNotifyMaterial= data => createAPI(`/orderIssure/issureNotify/editNotifyMaterial`,'post',data)
export const searchNotifyHeader= data => createAPI(`/orderIssure/issureNotify/searchNotifyHeader`,'post',data) export const searchNotifyHeader= data => createAPI(`/orderIssure/issureNotify/searchNotifyHeader`,'post',data)

212
src/views/modules/orderIssure/soIssueNotify/searchIssureNotify.vue

@ -103,8 +103,10 @@
width="80" width="80"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<a type="text" size="small" v-if="scope.row.status==='已下达'" @click="closeNotifyModel(scope.row)">关闭</a>
<a type="text" size="small" v-if="scope.row.status==='已关闭'" @click="openNotify(scope.row)">开启</a>
<a type="text" size="small" v-if="scope.row.status==='草稿' || scope.row.status==='编辑中'" @click="xiadaNotifyModel(scope.row)">下达</a>
<a type="text" size="small" v-if="scope.row.status==='待出库'" @click="editNotifyMaterialFun(scope.row)">编辑</a>
<a type="text" size="small" v-if="scope.row.status!=='已完成'" @click="closeNotifyModel(scope.row)">关闭</a>
<!-- <a type="text" size="small" v-if="scope.row.status==='已关闭'" @click="openNotify(scope.row)">开启</a>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -122,7 +124,12 @@
<el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick"> <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
<el-tab-pane label="申请单明细" name="detail"> <el-tab-pane label="申请单明细" name="detail">
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -10px;"> <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -10px;">
<el-button @click="createOrderDetail()" type="primary" style="margin-left: 10px;margin-top: 0px">{{'新增'}}
<el-button
@click="createOrderDetail()"
type="primary"
style="margin-left: 10px;margin-top: 0px"
:disabled="(currentRow.status !== '草稿' && currentRow.status !== '编辑中')">
{{'新增'}}
</el-button> </el-button>
</el-form> </el-form>
<el-table <el-table
@ -137,7 +144,13 @@
width="80" width="80"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<a type="text" size="small" @click="deleteNotifySOSPlus(scope.row)">删除</a>
<a
type="text"
size="small"
@click="deleteNotifySOSPlus(scope.row)"
:class="{ 'disabled-link': currentRow.status !== '草稿' && currentRow.status !== '编辑中' }">
删除
</a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -167,26 +180,6 @@
:row-class-name="tableRowClassName" :row-class-name="tableRowClassName"
v-loading="dataListLoading" v-loading="dataListLoading"
style="width: 100%; "> style="width: 100%; ">
<!-- <el-table-column-->
<!-- header-align="center"-->
<!-- align="center"-->
<!-- width="80"-->
<!-- fixed="left"-->
<!-- label="操作">-->
<!-- <template slot-scope="scope">-->
<!-- <a type="text" size="small" @click="printLabel(scope.row)">打印标签</a>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column
header-align="center"
align="center"
width="80"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" v-if="currentRow.status==='已下达'" @click="deleteNotifyMaterial(scope.row)">删除</a>
</template>
</el-table-column>-->
<el-table-column <el-table-column
v-for="(item,index) in columnList3" :key="index" v-for="(item,index) in columnList3" :key="index"
:sortable="item.columnSortable" :sortable="item.columnSortable"
@ -839,12 +832,12 @@
class="text-right"></el-input> class="text-right"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item :label="'已申请领料总和'"> <el-form-item :label="'已申请领料总和'">
<el-input v-model="orderDetailData.alreadyApplyTotal" disabled style="text-align: right" <el-input v-model="orderDetailData.alreadyApplyTotal" disabled style="text-align: right"
class="text-right"></el-input> class="text-right"></el-input>
</el-form-item> </el-form-item>
</el-col>
</el-col>-->
<el-col :span="6"> <el-col :span="6">
<el-form-item :label="'此次领料数量'"> <el-form-item :label="'此次领料数量'">
<el-input-number v-model="orderDetailData.issureQty" style="line-height: 20px;padding: 0;width: 100%" <el-input-number v-model="orderDetailData.issureQty" style="line-height: 20px;padding: 0;width: 100%"
@ -854,7 +847,7 @@
<el-col :span="6"> <el-col :span="6">
<el-form-item :label="'要求发料时间'"> <el-form-item :label="'要求发料时间'">
<el-date-picker <el-date-picker
style="width: 165px"
style="width: 155px"
v-model="orderDetailData.needDate" v-model="orderDetailData.needDate"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@ -891,6 +884,8 @@
, createNotify , createNotify
, getSOScheduledRoutingListForIssureByPaging , getSOScheduledRoutingListForIssureByPaging
, getPartListByPaging , getPartListByPaging
, xiadaNotify
, editNotifyMaterial
} from "@/api/orderIssure/soIssueNotify.js" } from "@/api/orderIssure/soIssueNotify.js"
import { import {
searchShopOrderByPaging searchShopOrderByPaging
@ -2226,6 +2221,15 @@
], ],
} }
}, },
computed: {
//
isEditableStatusComputed() {
if (!this.currentRow || !this.currentRow.status) {
return false;
}
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中';
}
},
mounted () { mounted () {
this.$nextTick(() => { this.$nextTick(() => {
this.height = (window.innerHeight- 315) / 2 this.height = (window.innerHeight- 315) / 2
@ -2403,16 +2407,23 @@
searchTable(){ searchTable(){
this.searchData.limit = this.pageSize this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex this.searchData.page = this.pageIndex
searchNotifyHeader(this.searchData).then(({data}) => {
//
// Promise
return new Promise((resolve, reject) => {
searchNotifyHeader(this.searchData).then(({ data }) => {
if (data && data.code == 0) { if (data && data.code == 0) {
this.dataList = data.page.list
this.pageIndex = data.page.currPage
this.pageSize = data.page.pageSize
this.totalPage = data.page.totalCount
this.dataList = data.page.list;
this.pageIndex = data.page.currPage;
this.pageSize = data.page.pageSize;
this.totalPage = data.page.totalCount;
resolve(); // resolve
} else { } else {
this.dataList = []; this.dataList = [];
reject(new Error(data ? data.msg : '请求失败'));
} }
}).catch(err => {
this.dataList = [];
reject(err); //
});
}); });
}, },
closeNotifyModel(row){ closeNotifyModel(row){
@ -2452,7 +2463,6 @@
}) })
} }
}) })
}, },
openNotify(row){ openNotify(row){
this.$confirm('确认打开?', '提示', { this.$confirm('确认打开?', '提示', {
@ -2506,6 +2516,14 @@
}) })
}, },
deleteNotifySOSPlus(row){ deleteNotifySOSPlus(row){
//
if (!this.isEditableStatusComputed) {
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能删除明细。', '提示', {
confirmButtonText: '确定'
})
return false
}
this.$confirm('确认删除?', '提示', { this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -2599,6 +2617,14 @@
return false return false
} }
//
if (!this.isEditableStatusComputed) {
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增明细。', '提示', {
confirmButtonText: '确定'
})
return false
}
// //
this.orderDetailData = { this.orderDetailData = {
orderNo: '', orderNo: '',
@ -2634,7 +2660,7 @@
this.$message.error('请选择工序'); this.$message.error('请选择工序');
return false return false
} }
//BOM
/*//校验如果是BOM物料的话领料数量不能大于工单数
if (this.orderDetailData.issureQty > this.orderDetailData.qtyRequired){ if (this.orderDetailData.issureQty > this.orderDetailData.qtyRequired){
this.$message.error('领取数量不可大于工单/派工数量!'); this.$message.error('领取数量不可大于工单/派工数量!');
return false return false
@ -2644,7 +2670,7 @@
if ((this.orderDetailData.issureQty + this.orderDetailData.alreadyApplyTotal) > this.orderDetailData.qtyRequired){ if ((this.orderDetailData.issureQty + this.orderDetailData.alreadyApplyTotal) > this.orderDetailData.qtyRequired){
this.$message.error('申请总和不可超出工单/派工数量!'); this.$message.error('申请总和不可超出工单/派工数量!');
return false return false
}
}*/
} }
if (!this.orderDetailData.needDate) { if (!this.orderDetailData.needDate) {
@ -3150,8 +3176,111 @@
this.$message.success('选择物料成功,数据已填入表单'); this.$message.success('选择物料成功,数据已填入表单');
}, },
//
async xiadaNotifyModel(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
}
xiadaNotify(row).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 refreshAllSubTables() {
if(!this.currentRow || !this.currentRow.notifyNo) {
console.warn('当前行数据为空,无法刷新子表数据');
return;
}
try {
//
const [detailData, materialData] = await Promise.all([
searchNotifyOrderList(this.currentRow),
searchNotifyMaterialList(this.currentRow)
]);
//
if (detailData.data && detailData.data.code == 0) {
this.dataList2 = detailData.data.rows;
} else {
this.dataList2 = [];
}
//
if (materialData.data && materialData.data.code == 0) {
this.dataList3 = materialData.data.rows;
} else {
this.dataList3 = [];
}
} catch (error) {
console.error('刷新子表数据失败:', error);
this.$message.error('刷新子表数据失败,请稍后重试');
}
}, },
editNotifyMaterialFun(row){
//
this.currentRow = JSON.parse(JSON.stringify(row));
editNotifyMaterial(row).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: '确定'
})
}
})
},
//
isEditableStatus() {
if (!this.currentRow || !this.currentRow.status) {
return false;
}
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中';
},
},
} }
</script> </script>
@ -3190,4 +3319,15 @@
flex-shrink: 0; flex-shrink: 0;
min-width: 30px; min-width: 30px;
} }
.disabled-link {
cursor: not-allowed !important;
color: #C0C4CC !important;
pointer-events: none;
}
.disabled-text {
color: #C0C4CC !important;
cursor: not-allowed !important;
}
</style> </style>
Loading…
Cancel
Save