采购验收多次验收

This commit is contained in:
zzyuan 2025-08-06 13:35:29 +08:00
parent 0f1cb53c64
commit 9aca2751ed
3 changed files with 123 additions and 44 deletions

View File

@ -67,7 +67,7 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-dropdown trigger="click" @command="handleCommand">
<el-button type="primary">
<el-button type="primary" size="mini">
新增食堂生产计划<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
@ -76,18 +76,19 @@
<!-- <el-dropdown-item command="3">按预订单生成计划</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
<!-- <el-button
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增食堂生产计划</el-button> -->
size="mini" style="margin-left: 20px;"
@click="handleBatchPurchasePlan"
>合并生成采购计划</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="800">
<el-table v-loading="loading" :data="tableListData" height="800" :row-key="(row)=>{return row.planId}" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
@ -274,6 +275,7 @@ export default {
dialogTableList: [],
rowData:{},
material_conversion_rounding_method:null,//-
batchList:[],
};
},
created() {
@ -374,6 +376,43 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.$router.push({ path: "/foodManage/purchaseManage/productionPlanEdit",query: {productionPlanRowData:JSON.stringify(row)} });
},
//
handleSelectionChange(selection){
this.batchList = selection
},
/** 合并生成采购计划操作 */
handleBatchPurchasePlan(){
if(this.batchList&&this.batchList.length>0){
console.log(this.batchList)
const canteenIdIsSame = this.batchList.every(item => item.canteenId == this.batchList[0].canteenId);
const ifBreakDownIsSame = this.batchList.every(item => item.ifBreakDown == false);
if(canteenIdIsSame&&ifBreakDownIsSame){//
this.dialogTableList = [];
this.rowData = this.batchList[0]
let param = []
this.batchList.forEach(item=>{
param = param.concat(item.productionPlanGoodsSumVOList)
})
this.loading2=true;
dishesConvertApi(param).then(response => {
this.dialogTableList = response;
this.dialogTableList.forEach((item)=>{
this.$set(item,"rate",0)
this.$set(item,"purchaseNum",item.totalConvertWeight)
})
this.title = "生成采购计划"
this.open=true;
this.loading2 = false;
}).catch(() => {
this.loading2 = false;
});
}else{
this.$modal.msgError("只能选择相同食堂,审批同意且待分解的生产计划");
}
}else{
this.$modal.msgError("请先选择生产计划");
}
},
/** 生成采购计划操作 */
handlePurchasePlan(row) { //purchaseManage/purchasePlanEdit
@ -394,7 +433,7 @@ export default {
this.loading2 = false;
});
},
},
//
cancel() {
this.open = false;

View File

@ -119,24 +119,33 @@
<!-- <el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/> -->
</template>
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<el-table-column label="已验收数量" align="center" prop="totalQualifiedNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{scope.row.totalQualifiedNum}}</span>
</template>
</el-table-column>
<!-- <el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.orderNum*scope.row.unitPrice/100).toFixed(2) }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column label="送货数量" align="center" prop="deliveryNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.deliveryNum" placeholder="请输入" maxlength="10" clearable @change="patternValue(scope.row)"/>
<el-input v-model="scope.row.deliveryNum" placeholder="请输入" maxlength="10" v-if="scope.row.deliveryNum>0" clearable @change="patternValue(scope.row)"/>
<span v-else>{{ scope.row.deliveryNum }}</span>
</template>
</el-table-column>
<el-table-column label="合格数量" align="center" prop="qualifiedNum" :show-overflow-tooltip="true">
<el-table-column label="验收合格数量" align="center" prop="qualifiedNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.qualifiedNum" placeholder="请输入" maxlength="10" clearable @change="patternValue2(scope.row)"/>
<el-input v-model="scope.row.qualifiedNum" placeholder="请输入" maxlength="10" v-if="scope.row.deliveryNum>0" clearable @change="patternValue2(scope.row)"/>
<span v-else>{{ scope.row.deliveryNum }}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
<el-input v-model="scope.row.remark" placeholder="请输入" v-if="scope.row.deliveryNum>0" maxlength="20" clearable/>
<span v-else>{{ scope.row.remark }}</span>
</template>
</el-table-column>
</el-table>
@ -560,15 +569,17 @@ export default {
}
this.noMaterial = false;
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.deliveryNum==0 || item.qualifiedNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
param.deliveryTotalNum = param.deliveryTotalNum+Number(obj.deliveryNum)//
param.inspectQualifiedNum = param.inspectQualifiedNum+Number(obj.qualifiedNum)//
param.inspectGoodsDetails.push(obj)
}
this.materialList.forEach(item=>{
if(item.orderNum>item.totalQualifiedNum){
if(item.deliveryNum==0 || Number(item.qualifiedNum)==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
param.deliveryTotalNum = param.deliveryTotalNum+Number(obj.deliveryNum)//
param.inspectQualifiedNum = param.inspectQualifiedNum+Number(obj.qualifiedNum)//
param.inspectGoodsDetails.push(obj)
}
}
})
}
if(this.noMaterial){
@ -625,14 +636,16 @@ export default {
this.noMaterial = false;
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.deliveryNum==0 || item.qualifiedNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
param.deliveryTotalNum = param.deliveryTotalNum+Number(obj.deliveryNum)//
param.inspectQualifiedNum = param.inspectQualifiedNum+Number(obj.qualifiedNum)//
param.inspectGoodsDetails.push(obj)
}
if(item.orderNum>item.totalQualifiedNum){
if(item.deliveryNum==0 || item.qualifiedNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
param.deliveryTotalNum = param.deliveryTotalNum+Number(obj.deliveryNum)//
param.inspectQualifiedNum = param.inspectQualifiedNum+Number(obj.qualifiedNum)//
param.inspectGoodsDetails.push(obj)
}
}
})
}
if(this.noMaterial){
@ -700,6 +713,7 @@ export default {
"pageNum": this.queryParams2.pageNum,
"orderGoodsCode": this.queryParams2.orderGoodsCode,
"orderStatus":2,
"isInspect":2,
"areaId": this.baseInfo.areaId,
"warehouseId": this.baseInfo.deliveryWarehouseId,
"supplierId": this.baseInfo.deliverySupplierId,
@ -724,7 +738,26 @@ export default {
this.materialList.forEach(item=>{
this.$set(item,"unitPrice",Number(item.singlePrice))
this.$set(item,"orderNum",item.orderNum)
if(item.totalQualifiedNum&&item.totalQualifiedNum>0){
this.$set(item,"deliveryNum",item.orderNum-item.totalQualifiedNum)
}else{
this.$set(item,"deliveryNum",item.orderNum)
}
})
// this.materialList = [];
// this.materialDetailsData.forEach(item=>{
// if(item.totalQualifiedNum<item.orderNum){
// let obj = Object.assign({},item)
// this.$set(obj,"unitPrice",Number(obj.singlePrice))
// this.$set(obj,"orderNum",obj.orderNum)
// if(obj.totalQualifiedNum&&obj.totalQualifiedNum>0){
// this.$set(obj,"deliveryNum",obj.orderNum-obj.totalQualifiedNum)
// }else{
// this.$set(obj,"deliveryNum",obj.orderNum)
// }
// this.materialList.push(obj)
// }
// })
this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode;
this.$set(this.baseInfo,"remark","导入采购订单")
setTimeout(()=>{
@ -762,20 +795,27 @@ export default {
},
patternValue(row){
row.deliveryNum = row.deliveryNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
setTimeout(()=>{
if(Number(row.deliveryNum)>Number(row.orderNum)){
row.deliveryNum = row.orderNum
}
},500)
if(row.totalQualifiedNum&&row.totalQualifiedNum>0){
setTimeout(()=>{
if(Number(row.deliveryNum)>(Number(row.orderNum)-Number(row.totalQualifiedNum))){
row.deliveryNum = Number(row.orderNum)-Number(row.totalQualifiedNum)
}
},500)
}else{
setTimeout(()=>{
if(Number(row.deliveryNum)>Number(row.orderNum)){
row.deliveryNum = Number(row.orderNum)
}
},500)
}
},
patternValue2(row){
row.qualifiedNum = row.qualifiedNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
patternValue2(row){
row.qualifiedNum = row.qualifiedNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
setTimeout(()=>{
if(Number(row.qualifiedNum)>Number(row.deliveryNum)){
row.qualifiedNum = row.deliveryNum
row.qualifiedNum = Number(row.deliveryNum)
}
},500)
},500)
},
//
formatDate(date) {

View File

@ -63,15 +63,15 @@
<!-- <el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" width="120"/> -->
<el-table-column label="验货日期" align="center" prop="inspectDate" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="关联采购订单号" align="center" prop="relateOrderGoodsId" :show-overflow-tooltip="true" width="180"/>
<el-table-column label="验货人" align="center" prop="inspector" :show-overflow-tooltip="true"/>
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="送货单号" align="center" prop="relateDeliveryGoodsId" :show-overflow-tooltip="true"/> -->
<el-table-column label="送货供应商" align="center" prop="deliverySupplierName" :show-overflow-tooltip="true"/>
<el-table-column label="送货人" align="center" prop="deliveryMan" :show-overflow-tooltip="true"/>
<el-table-column label="送货人电话" align="center" prop="deliveryPhone" :show-overflow-tooltip="true"/>
<el-table-column label="送货仓库" align="center" prop="deliveryWarehouseId" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="送货仓库" align="center" prop="deliveryWarehouseId" :show-overflow-tooltip="true"/> -->
<el-table-column label="送货日期" align="center" prop="deliveryDate" :show-overflow-tooltip="true"/>
<el-table-column label="送货总数量" align="center" prop="deliveryTotalNum" :show-overflow-tooltip="true"/>
<el-table-column label="合格总数量" align="center" prop="inspectQualifiedNum" :show-overflow-tooltip="true"/>
<el-table-column label="验收总数量" align="center" prop="inspectQualifiedNum" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="提交状态" align="center" prop="status" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope">
<span v-if="scope.row.status==1">待提交</span>