From ce50baff7fc1d3b6b23794dd6b0d609f40b9aab1 Mon Sep 17 00:00:00 2001
From: zzyuan <781948537@qq.com>
Date: Mon, 11 Aug 2025 15:08:16 +0800
Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E5=90=88?=
=?UTF-8?q?=E5=B9=B6=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=EF=BC=8C=E5=85=A5?=
=?UTF-8?q?=E5=BA=93=E5=AF=BC=E5=85=A5=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../purchaseManage/productionPlan/index.vue | 20 +++-
.../purchaseInspection/edit.vue | 33 +++++--
.../purchaseManage/purchasePlan/index.vue | 93 ++++++++++++++++++-
.../stockManage/warehouseIn/edit.vue | 42 ++++++++-
4 files changed, 166 insertions(+), 22 deletions(-)
diff --git a/src/views/foodManage/purchaseManage/productionPlan/index.vue b/src/views/foodManage/purchaseManage/productionPlan/index.vue
index 7d90c954..a186cfdf 100644
--- a/src/views/foodManage/purchaseManage/productionPlan/index.vue
+++ b/src/views/foodManage/purchaseManage/productionPlan/index.vue
@@ -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;
diff --git a/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue b/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue
index 52db127b..4393d1cd 100644
--- a/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue
+++ b/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue
@@ -133,19 +133,19 @@
-->
-
+
{{ scope.row.deliveryNum }}
-
+
{{ scope.row.deliveryNum }}
-
+
{{ scope.row.remark }}
@@ -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 = [];
@@ -810,8 +812,15 @@ export default {
this.attachmentList.splice(sum, 1)
this.baseInfo.inspectAttachmentList.splice(sum, 1)
},
- patternValue(row){
- row.deliveryNum = row.deliveryNum.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1')
+ patternValue(row){
+ 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)
diff --git a/src/views/foodManage/purchaseManage/purchasePlan/index.vue b/src/views/foodManage/purchaseManage/purchasePlan/index.vue
index 7b69dd0e..04eaefe1 100644
--- a/src/views/foodManage/purchaseManage/purchasePlan/index.vue
+++ b/src/views/foodManage/purchaseManage/purchasePlan/index.vue
@@ -70,10 +70,20 @@
@click="handleAdd"
>新增
+
+ 合并生成采购订单
+
-
+
+
{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}
@@ -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) => {
@@ -408,8 +421,7 @@ export default {
this.getList();
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);
diff --git a/src/views/foodManage/stockManage/warehouseIn/edit.vue b/src/views/foodManage/stockManage/warehouseIn/edit.vue
index ce0fc247..770559cd 100644
--- a/src/views/foodManage/stockManage/warehouseIn/edit.vue
+++ b/src/views/foodManage/stockManage/warehouseIn/edit.vue
@@ -102,12 +102,23 @@
- (scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
+ {{ scope.row.unitPrice }}
+ (scope.row.unitPrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
-
+
- (scope.row.purNum=v.replace(/[^\d]/g,''))"/>
+ {{scope.row.orderNum}}
+
+
+
+
+ {{scope.row.intoNum}}
+
+
+
+
+
@@ -691,8 +702,13 @@ export default {
if(this.materialDetailsData.length>0){
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,"unitPrice",Number(item.singlePrice)/100)
+ 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