Browse Source

领料申请单

master
Yangzz 5 months ago
parent
commit
74a7858923
  1. 1
      src/api/orderIssure/soIssueNotify.js
  2. 266
      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 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)

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

@ -103,8 +103,10 @@
width="80"
label="操作">
<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>
</el-table-column>
</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-tab-pane label="申请单明细" name="detail">
<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-form>
<el-table
@ -137,7 +144,13 @@
width="80"
label="操作">
<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>
</el-table-column>
<el-table-column
@ -167,26 +180,6 @@
:row-class-name="tableRowClassName"
v-loading="dataListLoading"
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
v-for="(item,index) in columnList3" :key="index"
:sortable="item.columnSortable"
@ -839,12 +832,12 @@
class="text-right"></el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item :label="'已申请领料总和'">
<el-input v-model="orderDetailData.alreadyApplyTotal" disabled style="text-align: right"
class="text-right"></el-input>
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="6">
<el-form-item :label="'此次领料数量'">
<el-input-number v-model="orderDetailData.issureQty" style="line-height: 20px;padding: 0;width: 100%"
@ -854,7 +847,7 @@
<el-col :span="6">
<el-form-item :label="'要求发料时间'">
<el-date-picker
style="width: 165px"
style="width: 155px"
v-model="orderDetailData.needDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
@ -891,6 +884,8 @@
, createNotify
, getSOScheduledRoutingListForIssureByPaging
, getPartListByPaging
, xiadaNotify
, editNotifyMaterial
} from "@/api/orderIssure/soIssueNotify.js"
import {
searchShopOrderByPaging
@ -2226,6 +2221,15 @@
],
}
},
computed: {
//
isEditableStatusComputed() {
if (!this.currentRow || !this.currentRow.status) {
return false;
}
return this.currentRow.status === '草稿' || this.currentRow.status === '编辑中';
}
},
mounted () {
this.$nextTick(() => {
this.height = (window.innerHeight- 315) / 2
@ -2403,16 +2407,23 @@
searchTable(){
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
searchNotifyHeader(this.searchData).then(({data}) => {
//
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
} else {
// Promise
return new Promise((resolve, reject) => {
searchNotifyHeader(this.searchData).then(({ data }) => {
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;
resolve(); // resolve
} else {
this.dataList = [];
reject(new Error(data ? data.msg : '请求失败'));
}
}).catch(err => {
this.dataList = [];
}
reject(err); //
});
});
},
closeNotifyModel(row){
@ -2429,30 +2440,29 @@
return false;
}
let inData={
site:this.closeData.site,
notifyNo:this.closeData.notifyNo,
closeRemark:this.closeData.closeRemark,
username:this.$store.state.user.name,
status:'已关闭',
}
updateNotifyStatus(inData).then(({data}) => {
if (data && data.code === 0) {
this.closeModalFlag=false
this.searchTable()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
let inData={
site:this.closeData.site,
notifyNo:this.closeData.notifyNo,
closeRemark:this.closeData.closeRemark,
username:this.$store.state.user.name,
status:'已关闭',
}
updateNotifyStatus(inData).then(({data}) => {
if (data && data.code === 0) {
this.closeModalFlag=false
this.searchTable()
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {}
})
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
},
openNotify(row){
this.$confirm('确认打开?', '提示', {
@ -2506,6 +2516,14 @@
})
},
deleteNotifySOSPlus(row){
//
if (!this.isEditableStatusComputed) {
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能删除明细。', '提示', {
confirmButtonText: '确定'
})
return false
}
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
@ -2599,6 +2617,14 @@
return false
}
//
if (!this.isEditableStatusComputed) {
this.$alert('当前状态不允许编辑!只有草稿或编辑中状态才能新增明细。', '提示', {
confirmButtonText: '确定'
})
return false
}
//
this.orderDetailData = {
orderNo: '',
@ -2634,7 +2660,7 @@
this.$message.error('请选择工序');
return false
}
//BOM
/*//校验如果是BOM物料的话领料数量不能大于工单数
if (this.orderDetailData.issureQty > this.orderDetailData.qtyRequired){
this.$message.error('领取数量不可大于工单/派工数量!');
return false
@ -2644,7 +2670,7 @@
if ((this.orderDetailData.issureQty + this.orderDetailData.alreadyApplyTotal) > this.orderDetailData.qtyRequired){
this.$message.error('申请总和不可超出工单/派工数量!');
return false
}
}*/
}
if (!this.orderDetailData.needDate) {
@ -3150,8 +3176,111 @@
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>
@ -3190,4 +3319,15 @@
flex-shrink: 0;
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>
Loading…
Cancel
Save