采购计划合并采购订单,入库导入采购订单
This commit is contained in:
parent
46df94cecd
commit
ce50baff7f
|
|
@ -381,14 +381,14 @@ export default {
|
|||
handleUpdate(row) {
|
||||
this.$router.push({ path: "/foodManage/purchaseManage/productionPlanEdit",query: {productionPlanRowData:JSON.stringify(row)} });
|
||||
},
|
||||
//批量弹窗勾选
|
||||
//批量弹窗勾选
|
||||
handleSelectionChange(selection){
|
||||
this.batchList = 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){//只能选择相同食堂,审批同意且待分解的生产计划
|
||||
|
|
@ -396,8 +396,20 @@ export default {
|
|||
this.rowData = this.batchList[0]
|
||||
let param = []
|
||||
this.batchList.forEach(item=>{
|
||||
param = param.concat(item.productionPlanGoodsSumVOList)
|
||||
console.log(item.productionPlanGoodsSumVOList)
|
||||
if(item.productionPlanGoodsSumVOList&&item.productionPlanGoodsSumVOList.length>0){
|
||||
item.productionPlanGoodsSumVOList.forEach(sub=>{
|
||||
let index = param.findIndex(v=>v.dishesId==sub.dishesId)
|
||||
if(index==-1){
|
||||
let obj = Object.assign({}, sub)
|
||||
param.push(obj)
|
||||
}else{
|
||||
param[index].dishesNum = Number(param[index].dishesNum)+Number(sub.dishesNum)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(param)
|
||||
this.loading2=true;
|
||||
dishesConvertApi(param).then(response => {
|
||||
this.dialogTableList = response;
|
||||
|
|
|
|||
|
|
@ -133,19 +133,19 @@
|
|||
</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" v-if="scope.row.deliveryNum>0" 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">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.qualifiedNum" placeholder="请输入" maxlength="10" v-if="scope.row.deliveryNum>0" 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 label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.remark" placeholder="请输入" v-if="scope.row.deliveryNum>0" 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>
|
||||
|
|
@ -578,7 +578,7 @@ export default {
|
|||
if(this.materialList.length>0){
|
||||
this.materialList.forEach(item=>{
|
||||
if(item.orderNum>item.totalQualifiedNum){
|
||||
if(item.deliveryNum==0 || Number(item.qualifiedNum)==0){
|
||||
if(Number(item.deliveryNum)==0 || Number(item.qualifiedNum)==0){
|
||||
this.noMaterial = true
|
||||
}else{
|
||||
let obj = Object.assign({}, item)
|
||||
|
|
@ -644,7 +644,7 @@ export default {
|
|||
if(this.materialList.length>0){
|
||||
this.materialList.forEach(item=>{
|
||||
if(item.orderNum>item.totalQualifiedNum){
|
||||
if(item.deliveryNum==0 || item.qualifiedNum==0){
|
||||
if(Number(item.deliveryNum)==0 || Number(item.qualifiedNum)==0){
|
||||
this.noMaterial = true
|
||||
}else{
|
||||
let obj = Object.assign({}, item)
|
||||
|
|
@ -750,9 +750,11 @@ export default {
|
|||
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)
|
||||
this.$set(item,"deliveryNum",Number(item.orderNum)-Number(item.totalQualifiedNum))
|
||||
this.$set(item,"qualifiedNum",Number(item.orderNum)-Number(item.totalQualifiedNum))
|
||||
}else{
|
||||
this.$set(item,"deliveryNum",item.orderNum)
|
||||
this.$set(item,"deliveryNum",Number(item.orderNum))
|
||||
this.$set(item,"qualifiedNum",Number(item.orderNum))
|
||||
}
|
||||
})
|
||||
// this.materialList = [];
|
||||
|
|
@ -811,7 +813,14 @@ export default {
|
|||
this.baseInfo.inspectAttachmentList.splice(sum, 1)
|
||||
},
|
||||
patternValue(row){
|
||||
row.deliveryNum = row.deliveryNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
console.log(row)
|
||||
if(!row.deliveryNum||row.deliveryNum==""){
|
||||
row.deliveryNum=0
|
||||
row.qualifiedNum=0
|
||||
}else{
|
||||
row.deliveryNum = row.deliveryNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
row.qualifiedNum = row.deliveryNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
}
|
||||
if(row.totalQualifiedNum&&row.totalQualifiedNum>0){
|
||||
setTimeout(()=>{
|
||||
if(Number(row.deliveryNum)>(Number(row.orderNum)-Number(row.totalQualifiedNum))){
|
||||
|
|
@ -827,7 +836,11 @@ export default {
|
|||
}
|
||||
},
|
||||
patternValue2(row){
|
||||
row.qualifiedNum = row.qualifiedNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
if(!row.qualifiedNum||row.qualifiedNum==""){
|
||||
row.qualifiedNum=0
|
||||
}else{
|
||||
row.qualifiedNum = row.qualifiedNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
}
|
||||
setTimeout(()=>{
|
||||
if(Number(row.qualifiedNum)>Number(row.deliveryNum)){
|
||||
row.qualifiedNum = Number(row.deliveryNum)
|
||||
|
|
|
|||
|
|
@ -70,10 +70,20 @@
|
|||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleBatchAdd"
|
||||
>合并生成采购订单</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>
|
||||
|
|
@ -238,6 +248,8 @@ export default {
|
|||
}
|
||||
}]
|
||||
},
|
||||
batchList:[],
|
||||
detailList:[],
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
|
|
@ -373,6 +385,7 @@ export default {
|
|||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
//生成采购订单
|
||||
handlePurchaseOrder(row){
|
||||
//获取计划详情
|
||||
getPurchasePlanInfoApi({planId:row.planId}).then((response) => {
|
||||
|
|
@ -409,7 +422,6 @@ export default {
|
|||
this.$router.push({ path: "/foodManage/purchaseManage/orderEdit",query: {purchaseOrderRowData:JSON.stringify(res.data)} });
|
||||
}).catch(() => {});
|
||||
});
|
||||
|
||||
},
|
||||
//生成询价单
|
||||
handlePurchaseInquiry(row){
|
||||
|
|
@ -447,6 +459,81 @@ export default {
|
|||
});
|
||||
|
||||
},
|
||||
//批量弹窗勾选
|
||||
handleSelectionChange(selection){
|
||||
this.batchList = [...selection];
|
||||
},
|
||||
handleBatchAdd(){
|
||||
if(this.batchList.length>0){
|
||||
const canteenIdIsSame = this.batchList.every(item => item.canteenId == this.batchList[0].canteenId);
|
||||
const stallIdIsSame = this.batchList.every(item => item.stallId == this.batchList[0].stallId);
|
||||
if(canteenIdIsSame&&stallIdIsSame){//只能选择相同食堂,档口
|
||||
this.detailList=[]
|
||||
this.getPurchasePlanList()
|
||||
this.$modal.confirm('是否确认生成采购订单?').then(()=> {
|
||||
return new Promise(resolve => {
|
||||
let param = {
|
||||
orderTitle:"采购计划生成采购订单",
|
||||
purchasePlanCode:null,
|
||||
requestArrivalTime:null,
|
||||
warehouseId:null,
|
||||
supplierId:null,
|
||||
areaId:this.batchList[0].areaId,
|
||||
canteenId:this.batchList[0].canteenId,
|
||||
stallId:this.batchList[0].stallId,
|
||||
orderAmount: 0,
|
||||
totalNum: 0,
|
||||
orderStatus: 1,
|
||||
orderGoodsDetailList: [],
|
||||
remark:"采购计划生成采购订单",
|
||||
}
|
||||
this.detailList.forEach(item=>{
|
||||
let obj = Object.assign({}, item)
|
||||
console.log(obj)
|
||||
obj.singlePrice = Number(item.unitPrice)
|
||||
obj.orderNum = Number(item.purchaseNum)
|
||||
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
|
||||
param.orderAmount = param.orderAmount+obj.totalPrice;
|
||||
param.totalNum = param.totalNum+Number(obj.orderNum)
|
||||
param.orderGoodsDetailList.push(obj)
|
||||
})
|
||||
console.log(param)
|
||||
resolve(addPurchaseOrderApi(param))
|
||||
})
|
||||
}).then((res) => {
|
||||
this.getList();
|
||||
this.$router.push({ path: "/foodManage/purchaseManage/orderEdit",query: {purchaseOrderRowData:JSON.stringify(res.data)} });
|
||||
}).catch(() => {});
|
||||
}else{
|
||||
this.$modal.msgError("只能选择相同食堂,档口的采购计划");
|
||||
}
|
||||
}else{
|
||||
this.$modal.msgError("请至少选择一个采购计划!");
|
||||
}
|
||||
},
|
||||
// 获取地址
|
||||
async getPurchasePlanList() {
|
||||
await this.batchList.forEach(item=>{
|
||||
getPurchasePlanInfoApi({planId:item.planId}).then((response) => {
|
||||
response.data.purchasePlanDetailList.forEach(sub=>{
|
||||
let index = this.detailList.findIndex(v=>v.materialId==sub.materialId)
|
||||
if(index==-1){
|
||||
let obj = Object.assign({}, sub)
|
||||
this.detailList.push(obj)
|
||||
}else{
|
||||
let index2 = this.detailList.findIndex(v=>v.unitPrice==sub.unitPrice)
|
||||
if(index2==-1){
|
||||
let obj = Object.assign({}, sub)
|
||||
this.detailList.push(obj)
|
||||
}else{
|
||||
this.detailList[index].purchaseNum = Number(this.detailList[index].purchaseNum)+Number(sub.purchaseNum)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
return this.detailList
|
||||
},
|
||||
defaultDateRange() {
|
||||
const end = new Date(new Date().toLocaleDateString());
|
||||
end.setTime(end.getTime() + 24 * 60 * 60 * 1000 -1);
|
||||
|
|
|
|||
|
|
@ -102,12 +102,23 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.unitPrice" placeholder="请输入" maxlength="8" clearable @input="(v)=>(scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
|
||||
<span v-if="baseInfo.relateOrderGoodsId">{{ scope.row.unitPrice }}</span>
|
||||
<el-input v-else v-model="scope.row.unitPrice" placeholder="请输入" maxlength="8" clearable @input="(v)=>(scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="入库数量" align="center" prop="purNum" :show-overflow-tooltip="true">
|
||||
<el-table-column label="订货数量" align="center" prop="orderNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model.number="scope.row.purNum" placeholder="请输入" maxlength="8" clearable @input="(v)=>(scope.row.purNum=v.replace(/[^\d]/g,''))"/>
|
||||
<span>{{scope.row.orderNum}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="已入库数量" align="center" prop="intoNum" :show-overflow-tooltip="true" v-if="baseInfo.relateOrderGoodsId">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.intoNum}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="待入库数量" align="center" prop="purNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.purNum" placeholder="请输入" maxlength="8" clearable @change="patternValue(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -692,7 +703,12 @@ export default {
|
|||
this.materialList = this.materialDetailsData;
|
||||
this.materialList.forEach(item=>{
|
||||
this.$set(item,"unitPrice",Number(item.singlePrice)/100)
|
||||
this.$set(item,"purNum",item.orderNum)
|
||||
this.$set(item,"supplierId",this.importRow.supplierId)
|
||||
if(item.intoNum&&item.intoNum>0){
|
||||
this.$set(item,"purNum",Number(item.totalQualifiedNum)-Number(item.intoNum))
|
||||
}else{
|
||||
this.$set(item,"purNum",Number(item.totalQualifiedNum))
|
||||
}
|
||||
})
|
||||
this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode;
|
||||
this.$set(this.baseInfo,"remark","导入采购订单")
|
||||
|
|
@ -705,6 +721,22 @@ export default {
|
|||
}).catch(() => {});
|
||||
});
|
||||
},
|
||||
patternValue(row){
|
||||
row.purNum = row.purNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
|
||||
if(row.intoNum&&row.intoNum>0){
|
||||
setTimeout(()=>{
|
||||
if(Number(row.purNum)>(Number(row.totalQualifiedNum)-Number(row.intoNum))){
|
||||
row.purNum = Number(row.totalQualifiedNum)-Number(row.intoNum)
|
||||
}
|
||||
},500)
|
||||
}else{
|
||||
setTimeout(()=>{
|
||||
if(Number(row.purNum)>Number(row.totalQualifiedNum)){
|
||||
row.purNum = Number(row.totalQualifiedNum)
|
||||
}
|
||||
},500)
|
||||
}
|
||||
},
|
||||
//日期
|
||||
formatDate(date) {
|
||||
// 格式化为 YYYY-MM-DD
|
||||
|
|
|
|||
Loading…
Reference in New Issue