会员等级和进油修改
This commit is contained in:
parent
64ee2829d3
commit
b2574cc2cb
@ -20,6 +20,15 @@ export function insertPurchaseApi(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 处理全部
|
||||
export function unifiedProcessingApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilPurchase/unifiedProcessing',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改有关信息
|
||||
export function updatePurchaseApi(data) {
|
||||
return request({
|
||||
@ -75,6 +84,15 @@ export function editPurchuseApi(data) {
|
||||
})
|
||||
}
|
||||
|
||||
// 批量处理数据
|
||||
export function disposeBatchApi(data) {
|
||||
return request({
|
||||
url: 'business/petrolStationManagement/oilPurchaseOrder/disposeBatch',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 审核
|
||||
export function auditApi(data) {
|
||||
|
@ -433,7 +433,7 @@
|
||||
<div style="display: flex">
|
||||
<div style="width: 7%;line-height: 40px">油品类型</div>
|
||||
<el-radio-group v-model="tabOilType" style="margin-bottom: 30px;">
|
||||
<el-radio-button v-for="item,index in oilTypeList" :label="item.oilType" @click.native="tabOilTypeClick(item.oilType)">{{ item.type }}{{item.oilType}}</el-radio-button>
|
||||
<el-radio-button v-for="item,index in oilTypeList" :label="item.oilType" @click.native="tabOilTypeClick(item.status)">{{ item.type }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</el-col>
|
||||
@ -1010,8 +1010,13 @@ export default {
|
||||
await getCardValueListApi(quy).then(res=>{
|
||||
this.cardValueList = res.data.records;
|
||||
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
|
||||
|
||||
})
|
||||
if (this.cardValueList.length > 0) {
|
||||
// 过滤
|
||||
this.cardValueList = this.cardValueList.filter(item => {
|
||||
return item.membershipLevel.includes(this.grade.name);
|
||||
});
|
||||
this.rechargeCard(0);
|
||||
}
|
||||
},
|
||||
@ -1098,12 +1103,14 @@ export default {
|
||||
if (this.oilTypeList.length > 0) {
|
||||
// 默认选中第一个
|
||||
this.tabOilType = this.oilTypeList[0].oilType
|
||||
this.selectOilType(this.oilTypeList[0].oilType);
|
||||
this.selectOilType(this.oilTypeList[0].status,this.oilTypeList[0].oilType);
|
||||
}
|
||||
})
|
||||
},
|
||||
// 根据油品过滤查询存油卡
|
||||
tabOilTypeClick(data){
|
||||
console.log("aaaaaaaaaaaaaa",this.grade.name)
|
||||
|
||||
this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => {
|
||||
return item.oilType === data;
|
||||
});
|
||||
@ -1111,9 +1118,9 @@ export default {
|
||||
this.recharge(0)
|
||||
}
|
||||
},
|
||||
selectOilType(oilType) {
|
||||
selectOilType(status,oilType) {
|
||||
this.tabOilType = oilType;
|
||||
this.tabOilTypeClick(oilType);
|
||||
this.tabOilTypeClick(status);
|
||||
},
|
||||
// 查询员工
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="dispose(scope.row)"
|
||||
>{{ scope.row.status == 'ysh'?'查看单据':'处理单据' }}
|
||||
>{{ scope.row.status == 'qrts'?'查看单据':'处理单据' }}
|
||||
</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
|
@ -437,10 +437,8 @@ export default {
|
||||
}
|
||||
|
||||
if (isDuplicate) {
|
||||
console.log("isDuplicate222")
|
||||
|
||||
this.$message({
|
||||
message: '有重复油罐油罐,请重新选择',
|
||||
message: '有重复油罐,请重新选择',
|
||||
type: 'warning'
|
||||
});
|
||||
this.multipleSelection = []
|
||||
@ -517,12 +515,6 @@ export default {
|
||||
},
|
||||
|
||||
edit() {
|
||||
// updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||
// // this.$modal.msgSuccess("修改成功");
|
||||
// // this.open = false;
|
||||
// this.orderForm = {}
|
||||
// this.getList();
|
||||
// });
|
||||
},
|
||||
|
||||
// 选择油罐添加密度
|
||||
@ -567,7 +559,7 @@ export default {
|
||||
},
|
||||
|
||||
// 保存订单信息
|
||||
saveInventory(){
|
||||
async saveInventory(){
|
||||
let this_ = this
|
||||
if (this_.inventoryNo.inventoryNo == null){
|
||||
this.$modal.msgSuccess("请先填写盘点号");
|
||||
@ -596,7 +588,7 @@ export default {
|
||||
if (this_.inventoryId != null) {
|
||||
// 修改
|
||||
inventoryForm.id = this_.inventoryId
|
||||
updateInventoryApi(inventoryForm).then(response=>{
|
||||
await updateInventoryApi(inventoryForm).then(response=>{
|
||||
// 处理列表
|
||||
// disList.inventoryId= this_.inventoryId
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="dispose(scope.row)"
|
||||
>处理单据</el-button>
|
||||
>{{ scope.row.status == 'qrts'?'查看单据':'处理单据' }}</el-button>
|
||||
<!-- <el-button-->
|
||||
<!-- size="mini"-->
|
||||
<!-- type="text"-->
|
||||
|
@ -92,12 +92,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="小计金额(元)" align="center" prop="totalAmount">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number :disabled="numberInput" v-model="scope.row.totalAmount" @change="change(scope.row)" controls-position="right" :min="0" :step="1" style="max-width: 100%"></el-input-number>
|
||||
{{ scope.row.totalAmount }}
|
||||
<!-- <el-input-number :disabled="numberInput" v-model="scope.row.totalAmount" @change="change(scope.row)" controls-position="right" :min="0" :max="10000000" :step="1" style="max-width: 100%"></el-input-number> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="采购升数(L)" align="center" prop="purchaseVolume"/>
|
||||
<el-table-column label="折和单价(元/升)" align="center" prop="discountedPrice"/>
|
||||
<el-table-column v-if="state =='await' || state=='ysh'" label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column v-if="state =='await'" label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@ -203,17 +204,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getSuppliersListApi,
|
||||
getSuppliersListApi2,
|
||||
insertSuppliersApi,
|
||||
updateSuppliersApi
|
||||
} from "@/api/oilConfig/oilSuppliers";
|
||||
import { getSuppliersListApi2 } from "@/api/oilConfig/oilSuppliers";
|
||||
import {
|
||||
editPurchuseApi,
|
||||
getPurchaseOrderApi,
|
||||
getPurchaseOrderApi,unifiedProcessingApi,
|
||||
insertPurchaseApi,
|
||||
insertPurchaseOrderApi,
|
||||
disposeBatchApi,
|
||||
updatePurchaseOrderApi,
|
||||
updatePurchaseApi, auditApi, abolitionApi, storageApi, delPurchaseOrderApi
|
||||
} from "@/api/oilConfig/oilPurchase";
|
||||
@ -232,17 +229,13 @@ export default {
|
||||
purchaseId: null,
|
||||
numberId: null,
|
||||
tankId: null,
|
||||
tankName: null,
|
||||
supplierId: null,
|
||||
productDensity: null,
|
||||
purchaseWeight: null,
|
||||
purchasePrice: null,
|
||||
totalAmount: null,
|
||||
purchaseVolume: null,
|
||||
storeId: null,
|
||||
createTime: null,
|
||||
updateTime: null,
|
||||
createBy: null,
|
||||
updateBy: null,
|
||||
preInboundInventory: null,
|
||||
discountedPrice: null
|
||||
},
|
||||
@ -337,17 +330,14 @@ export default {
|
||||
},
|
||||
|
||||
async created() {
|
||||
|
||||
|
||||
|
||||
if (this.$route.query.purchaseId != null) {
|
||||
this.queryParams.purchaseId = this.$route.query.purchaseId;
|
||||
this.purchaseId = this.$route.query.purchaseId;
|
||||
}else if (this.$route.query.purchaseId == null && this.purchaseId>0) {
|
||||
|
||||
}else {
|
||||
this.queryParams.purchaseId = -parseInt(new Date().getTime())% 100000000;
|
||||
this.purchaseId = -parseInt(new Date().getTime()) % 100000000;
|
||||
// this.queryParams.purchaseId = -parseInt(new Date().getTime())% 100000000;
|
||||
// this.purchaseId = -parseInt(new Date().getTime()) % 100000000;
|
||||
}
|
||||
|
||||
this.state = this.$route.query.state;
|
||||
@ -408,37 +398,95 @@ export default {
|
||||
this.selectSuppliers()
|
||||
},
|
||||
orderDel(data) {
|
||||
delPurchaseOrderApi(data).then(response => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList()
|
||||
})
|
||||
if (data.id != null) {
|
||||
delPurchaseOrderApi(data).then(res=>{
|
||||
})
|
||||
}
|
||||
const index = this.orderList.indexOf(data); // 查找要删除的对象的索引
|
||||
if (index !== -1) {
|
||||
this.orderList.splice(index, 1); // 使用splice方法删除对象
|
||||
}
|
||||
// this.numberOfTanks = this.numberOfTanks-1
|
||||
// delPurchaseOrderApi(data).then(response => {
|
||||
// this.$modal.msgSuccess("删除成功");
|
||||
// this.getList()
|
||||
// })
|
||||
},
|
||||
// 提交
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
// 密度计算
|
||||
this.orderForm.purchaseVolume = ((this.orderForm.purchaseWeight*(1000))/this.orderForm.productDensity).toFixed(2);
|
||||
this.orderForm.purchaseVolume = new BigNumber(this.orderForm.purchaseWeight).times(1000).dividedBy(this.orderForm.productDensity).toFixed(2);
|
||||
// 计算小计价格
|
||||
this.orderForm.totalAmount = this.orderForm.purchasePrice * this.orderForm.purchaseWeight
|
||||
this.orderForm.totalAmount = new BigNumber(this.orderForm.purchasePrice).times(this.orderForm.purchaseWeight);
|
||||
// 折合单价
|
||||
this.orderForm.discountedPrice = (this.orderForm.purchaseVolume / this.orderForm.totalAmount).toFixed(2);
|
||||
this.orderForm.discountedPrice = new BigNumber(this.orderForm.totalAmount).dividedBy(this.orderForm.purchaseVolume).toFixed(2);
|
||||
|
||||
// 复制id
|
||||
this.orderForm.purchaseId = this.purchaseId
|
||||
if (!this.orderForm.id) {
|
||||
insertPurchaseOrderApi(this.orderForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
// this.saveJudgment()
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
|
||||
|
||||
let numberName = this.numberList.find(item => item.numberId === this.orderForm.numberId);
|
||||
let tankName = this.tankList.find(item => item.id === this.orderForm.tankId);
|
||||
let supplierName = this.suppliersList.find(item => item.id === this.orderForm.supplierId);
|
||||
console.log("numberName",numberName)
|
||||
// 去重
|
||||
let isDuplicate = false
|
||||
if (this.orderList.length > 0) {
|
||||
isDuplicate = this.orderList.some(order => order.numberId === this.orderForm.numberId);
|
||||
}
|
||||
if (isDuplicate) {
|
||||
this.$message({
|
||||
message: '有重复油号,请重新选择',
|
||||
type: 'warning'
|
||||
});
|
||||
this.orderForm = {}
|
||||
return;
|
||||
}
|
||||
let addFrom = {
|
||||
"discountedPrice": this.orderForm.discountedPrice,
|
||||
// "id": 47,
|
||||
"numberId": this.orderForm.numberId,
|
||||
"numberName": numberName.oilType +' '+numberName.oilName,
|
||||
"oilName": numberName.oilName,
|
||||
"oilType": numberName.oilType,
|
||||
// "preInboundInventory": null,
|
||||
"productDensity": this.orderForm.productDensity,
|
||||
// "purchaseId": this.purchaseId,
|
||||
"purchasePrice": this.orderForm.purchasePrice,
|
||||
"purchaseVolume": this.orderForm.purchaseVolume,
|
||||
"purchaseWeight": this.orderForm.purchaseWeight,
|
||||
// "preInboundInventory": tankName.storedQuantity,
|
||||
"storedQuantity": tankName.storedQuantity,
|
||||
"supplierId": this.orderForm.supplierId,
|
||||
"supplierName": supplierName.supplierName,
|
||||
"tankId": this.orderForm.tankId,
|
||||
"tankName": tankName.tankName,
|
||||
"totalAmount": this.orderForm.totalAmount,
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.orderList.push(addFrom)
|
||||
this.open = false;
|
||||
this.sumMethod(this.orderList)
|
||||
console.log(" this.orderForm", this.orderForm)
|
||||
|
||||
// if (!this.orderForm.id) {
|
||||
// insertPurchaseOrderApi(this.orderForm).then(response => {
|
||||
// this.$modal.msgSuccess("新增成功");
|
||||
// this.open = false;
|
||||
// // this.saveJudgment()
|
||||
// this.getList();
|
||||
// });
|
||||
// } else {
|
||||
// updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||
// this.$modal.msgSuccess("修改成功");
|
||||
// this.open = false;
|
||||
// this.getList();
|
||||
// });
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -448,15 +496,21 @@ export default {
|
||||
},
|
||||
// 改变数字时
|
||||
change(data) {
|
||||
console.log()
|
||||
// 密度计算
|
||||
data.purchaseVolume = ((data.purchaseWeight*(1000))/data.productDensity).toFixed(2);
|
||||
data.purchaseVolume = new BigNumber(data.purchaseWeight).times(1000).dividedBy(data.productDensity).toFixed(2);
|
||||
// 计算小计价格
|
||||
data.totalAmount = data.purchasePrice * data.purchaseWeight
|
||||
data.totalAmount = new BigNumber(data.purchasePrice).times(data.purchaseWeight);
|
||||
// 折合单价
|
||||
data.discountedPrice = (data.purchaseVolume / data.totalAmount).toFixed(2);
|
||||
if (data.purchasePrice == 0 || data.purchaseWeight == 0) {
|
||||
data.discountedPrice = 0
|
||||
} else {
|
||||
data.discountedPrice = new BigNumber(data.totalAmount).dividedBy(data.purchaseVolume).toFixed(2);
|
||||
}
|
||||
this.sumMethod(this.orderList)
|
||||
// 进行保存
|
||||
this.orderForm = data
|
||||
this.edit()
|
||||
// this.orderForm = data
|
||||
// this.edit()
|
||||
},
|
||||
edit() {
|
||||
updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||
@ -530,46 +584,101 @@ export default {
|
||||
this.$modal.msgWarning("请先选择进货时间");
|
||||
return -1;
|
||||
}
|
||||
if (this.orderList.length <= 0) {
|
||||
this.$modal.msgWarning("请选择至少一个油品");
|
||||
return -1;
|
||||
}
|
||||
|
||||
let from = {
|
||||
id:this.purchaseId,
|
||||
purchaseNo : this.purchaseForm.purchaseNo,
|
||||
purchaseDate : this.purchaseForm.purchaseDate,
|
||||
theDocumentAmount : this.totalAmountPurchased,
|
||||
}
|
||||
if (this.queryParams.purchaseId < 0) {
|
||||
insertPurchaseApi(from).then(response => {
|
||||
console.log("response",response)
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
// 修改进货单的父id
|
||||
let oilPurchase = {
|
||||
purchaseId:response.data.id,
|
||||
id:this.queryParams.purchaseId
|
||||
}
|
||||
this.queryParams.purchaseId = response.data.id,
|
||||
this.purchaseId = response.data.id,
|
||||
this.purchaseNo = response.data.purchaseNo,
|
||||
this.state = response.data.status
|
||||
//todo 优化 将这些代码加到后台中完成并进行事务管理
|
||||
|
||||
await unifiedProcessingApi({oilPurchase:from,oilPurchaseOrders:this.orderList}).then(res=>{
|
||||
if (res.code === 200) {
|
||||
this.purchaseId = res.data.id
|
||||
|
||||
this.$router.push({ path: '/oilConfig/oilPurchase/list'});
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
}).catch({
|
||||
})
|
||||
|
||||
editPurchuseApi(oilPurchase).then(response2 => {
|
||||
if (flag != -1) {
|
||||
// this.$router.push({ path: '/oilPurchase/purchaseOrder', query: {
|
||||
// purchaseId: oilPurchase.purchaseId,
|
||||
// purchaseNo: response.data.purchaseNo,
|
||||
// state: response.data.status
|
||||
// }});
|
||||
this.$router.push('/oilConfig/oilPurchase/list');
|
||||
// if(this.purchaseId != null) {
|
||||
// // 修改
|
||||
// from.id = this.purchaseId
|
||||
// updatePurchaseApi(from).then(res => {
|
||||
// // this.purchaseId = res.data.id
|
||||
// this.orderList.forEach(ord=>{
|
||||
// ord.purchaseId = res.data.id
|
||||
// })
|
||||
// // if (flag != -1) {
|
||||
// // // 处理列表
|
||||
|
||||
}
|
||||
})
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
from.id = this.queryParams.purchaseId
|
||||
updatePurchaseApi(from).then(response => {
|
||||
this.$modal.msgSuccess("添加成功");
|
||||
})
|
||||
}
|
||||
// // this.$router.push('/oilConfig/oilPurchase/list');
|
||||
// // }
|
||||
// disposeBatchApi(this.orderList).then(response=> {
|
||||
// // 保存成功
|
||||
// this.$modal.msgSuccess("保存成功");
|
||||
// // this.getList()
|
||||
// this.$router.push({ path: '/oilConfig/oilPurchase/list', query: {
|
||||
// } });
|
||||
// })
|
||||
// })
|
||||
// }else{
|
||||
// insertPurchaseApi(from).then(res => {
|
||||
// this.orderList.forEach(ord=>{
|
||||
// ord.purchaseId = res.data.id
|
||||
// })
|
||||
// disposeBatchApi(this.orderList).then(response=> {
|
||||
// // 保存成功
|
||||
// this.$modal.msgSuccess("保存成功");
|
||||
// // this.getList()
|
||||
// this.$router.push({ path: '/oilConfig/oilPurchase/list', query: {
|
||||
// } });
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
// 判断是新增还是修改
|
||||
// if (this.queryParams.purchaseId < 0) {
|
||||
// insertPurchaseApi(from).then(response => {
|
||||
// console.log("response",response)
|
||||
// this.$modal.msgSuccess("添加成功");
|
||||
// // 修改进货单的父id
|
||||
// let oilPurchase = {
|
||||
// purchaseId:response.data.id,
|
||||
// id:this.queryParams.purchaseId
|
||||
// }
|
||||
// this.queryParams.purchaseId = response.data.id,
|
||||
// this.purchaseId = response.data.id,
|
||||
// this.purchaseNo = response.data.purchaseNo,
|
||||
// this.state = response.data.status
|
||||
// //todo 优化 将这些代码加到后台中完成并进行事务管理
|
||||
|
||||
// editPurchuseApi(oilPurchase).then(response2 => {
|
||||
// if (flag != -1) {
|
||||
// // this.$router.push({ path: '/oilPurchase/purchaseOrder', query: {
|
||||
// // purchaseId: oilPurchase.purchaseId,
|
||||
// // purchaseNo: response.data.purchaseNo,
|
||||
// // state: response.data.status
|
||||
// // }});
|
||||
// this.$router.push('/oilConfig/oilPurchase/list');
|
||||
|
||||
// }
|
||||
// })
|
||||
// this.getList();
|
||||
// });
|
||||
// } else {
|
||||
// from.id = this.queryParams.purchaseId
|
||||
// updatePurchaseApi(from).then(response => {
|
||||
// this.$modal.msgSuccess("添加成功");
|
||||
// })
|
||||
// }
|
||||
},
|
||||
// 判断是否可以保存
|
||||
saveJudgment(){
|
||||
@ -582,12 +691,15 @@ export default {
|
||||
let judgmentPermissions1 = await this.judgmentPermissions("进油审核");
|
||||
if (judgmentPermissions1 > 0){
|
||||
this.auditFlag=false
|
||||
}else {
|
||||
this.auditFlag=true
|
||||
}
|
||||
let judgmentPermissions2 = await this.judgmentPermissions("进油入库");
|
||||
if (judgmentPermissions2 > 0){
|
||||
this.storageFlag = false
|
||||
}else {
|
||||
this.storageFlag=true
|
||||
}
|
||||
|
||||
let judgmentPermissions3 = await this.judgmentPermissions("进油废止");
|
||||
if (judgmentPermissions3 > 0){
|
||||
this.voidFlag=false
|
||||
@ -709,9 +821,6 @@ export default {
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
// 页面跳转
|
||||
goToAbout() {
|
||||
this.$router.push('/oilConfig/oilPurchase/list');
|
||||
|
@ -153,12 +153,7 @@ public class CardFuelDieselController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/countOilType")
|
||||
public ResponseObject countOilType() {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
QueryWrapper<CardFuelDiesel> wrapper = Wrappers.query();
|
||||
wrapper.eq("store_id", nowAccountInfo.getStoreId());
|
||||
// wrapper.select("type", "oil_type", "COUNT(*) as count");
|
||||
wrapper.groupBy("type", "oil_type");
|
||||
return getSuccessResult(cardFuelDieselService.list(wrapper));
|
||||
return getSuccessResult(cardFuelDieselService.countOilType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.cardFule.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 柴油屯油卡(CardFuelDiesel)表数据库访问层
|
||||
*
|
||||
@ -11,5 +13,6 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
*/
|
||||
public interface CardFuelDieselMapper extends BaseMapper<CardFuelDiesel> {
|
||||
|
||||
List<CardFuelDiesel> countOilType(Integer storeId);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper">
|
||||
|
||||
|
||||
<select id="countOilType" resultType="com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel">
|
||||
select cf.oil_type oilType,
|
||||
concat(oo.oil_type,' ',oo.oil_name) type,
|
||||
oo.oil_name status
|
||||
from card_fuel_diesel cf
|
||||
left join oil_name oo ON oo.id = cf.oil_type
|
||||
where cf.store_id = #{storeId}
|
||||
group by cf.oil_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.cardFule.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 柴油屯油卡(CardFuelDiesel)表服务接口
|
||||
*
|
||||
@ -11,5 +13,7 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
*/
|
||||
public interface CardFuelDieselService extends IService<CardFuelDiesel> {
|
||||
|
||||
List<CardFuelDiesel> countOilType();
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardFule.mapper.CardFuelDieselMapper;
|
||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 柴油屯油卡(CardFuelDiesel)表服务实现类
|
||||
*
|
||||
@ -15,5 +20,13 @@ import org.springframework.stereotype.Service;
|
||||
@Service("cardFuelDieselService")
|
||||
public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper, CardFuelDiesel> implements CardFuelDieselService {
|
||||
|
||||
@Resource
|
||||
CardFuelDieselMapper cardFuelDieselMapper;
|
||||
|
||||
@Override
|
||||
public List<CardFuelDiesel> countOilType() {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
return cardFuelDieselMapper.countOilType(nowAccountInfo.getStoreId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchase4OrdDTO;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchaseDTO;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||
@ -105,6 +106,11 @@ public class OilPurchaseController extends BaseController {
|
||||
return getSuccessResult(this.oilPurchaseService.insert(oilPurchase));
|
||||
}
|
||||
|
||||
@PostMapping("unifiedProcessing")
|
||||
public ResponseObject unifiedProcessing(@RequestBody OilPurchase4OrdDTO oilPurchase) {
|
||||
return getSuccessResult(this.oilPurchaseService.unifiedProcessing(oilPurchase));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ public class OilPurchaseOrderController extends BaseController {
|
||||
|
||||
/**
|
||||
* 批量处理数据
|
||||
* @param oilInventoryOrderList ,@Param("inventoryId") Integer inventoryId
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("disposeBatch")
|
||||
@ -127,11 +127,21 @@ public class OilPurchaseOrderController extends BaseController {
|
||||
return getSuccessResult(this.oilPurchaseOrderService.audit(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 进油废除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("abolition")
|
||||
public ResponseObject abolition(Integer id) {
|
||||
return getSuccessResult(this.oilPurchaseOrderService.abolition(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 进油入库
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("storage")
|
||||
public ResponseObject storage(Integer id) {
|
||||
return getSuccessResult(this.oilPurchaseOrderService.storage(id));
|
||||
|
@ -0,0 +1,13 @@
|
||||
package com.fuint.business.petrolStationManagement.dto;
|
||||
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OilPurchase4OrdDTO {
|
||||
private OilPurchase oilPurchase;
|
||||
private List<OilPurchaseOrder> oilPurchaseOrders;
|
||||
}
|
@ -108,6 +108,7 @@
|
||||
opo.total_amount totalAmount,
|
||||
opo.purchase_volume purchaseVolume,
|
||||
opo.discounted_price discountedPrice,
|
||||
opo.pre_inbound_inventory preInboundInventory,
|
||||
onn.oil_type oilType,
|
||||
onn.oil_name oilName,
|
||||
os.supplier_name supplierName,
|
||||
@ -163,10 +164,10 @@
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into oil_purchase_order(purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume)
|
||||
insert into oil_purchase_order(purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume,discounted_price)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.purchaseId}, #{entity.numberId}, #{entity.tankId}, #{entity.supplierId}, #{entity.productDensity}, #{entity.purchaseWeight}, #{entity.purchasePrice}, #{entity.totalAmount}, #{entity.purchaseVolume})
|
||||
(#{entity.purchaseId}, #{entity.numberId}, #{entity.tankId}, #{entity.supplierId}, #{entity.productDensity}, #{entity.purchaseWeight}, #{entity.purchasePrice}, #{entity.totalAmount}, #{entity.purchaseVolume}, #{entity.discountedPrice})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@ -228,37 +229,36 @@
|
||||
|
||||
<update id="updateBatch">
|
||||
<foreach collection="list" item="user" separator=";">
|
||||
|
||||
update oil_purchase_order
|
||||
<set>
|
||||
<if test="${user.purchaseId != null}">
|
||||
<if test="user.purchaseId != null">
|
||||
purchase_id = #{user.purchaseId},
|
||||
</if>
|
||||
<if test="${user.numberId != null}">
|
||||
<if test="user.numberId != null">
|
||||
number_id = #{user.numberId},
|
||||
</if>
|
||||
<if test="${user.tankId != null}">
|
||||
<if test="user.tankId != null">
|
||||
tank_id = #{user.tankId},
|
||||
</if>
|
||||
<if test="${user.supplierId != null}">
|
||||
<if test="user.supplierId != null">
|
||||
supplier_id = #{user.supplierId},
|
||||
</if>
|
||||
<if test="${user.productDensity != null}">
|
||||
<if test="user.productDensity != null">
|
||||
product_density = #{user.productDensity},
|
||||
</if>
|
||||
<if test="${user.purchaseWeight != null}">
|
||||
<if test="user.purchaseWeight != null">
|
||||
purchase_weight = #{user.purchaseWeight},
|
||||
</if>
|
||||
<if test="${user.purchasePrice != null}">
|
||||
<if test="user.purchasePrice != null">
|
||||
purchase_price = #{user.purchasePrice},
|
||||
</if>
|
||||
<if test="${user.totalAmount != null}">
|
||||
<if test="user.totalAmount != null">
|
||||
total_amount = #{user.totalAmount},
|
||||
</if>
|
||||
<if test="${user.purchaseVolume != null}">
|
||||
<if test="user.purchaseVolume != null">
|
||||
purchase_volume = #{user.purchaseVolume},
|
||||
</if>
|
||||
<if test="${user.discountedPrice != null}">
|
||||
<if test="user.discountedPrice != null">
|
||||
discounted_price = #{user.discountedPrice},
|
||||
</if>
|
||||
update_time = NOW()
|
||||
|
@ -50,7 +50,7 @@ public interface OilPurchaseOrderService {
|
||||
|
||||
/**
|
||||
* 批量处理数据
|
||||
* @param oilInventoryOrder
|
||||
* @param oilPurchaseOrders
|
||||
* @return
|
||||
*/
|
||||
int disposeBatch(List<OilPurchaseOrder> oilPurchaseOrders);
|
||||
|
@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchase4OrdDTO;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchaseDTO;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||
@ -46,6 +47,8 @@ public interface OilPurchaseService {
|
||||
*/
|
||||
OilPurchase insert(OilPurchase oilPurchase);
|
||||
|
||||
OilPurchase unifiedProcessing(OilPurchase4OrdDTO oilPurchase);
|
||||
|
||||
/**
|
||||
* 订单审核
|
||||
* @param oilPurchase
|
||||
|
@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -123,7 +125,7 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
oilPurchaseOrderDao.insertBatch(insPurchase);
|
||||
}
|
||||
if (updatePurchase.size()>0) {
|
||||
int i = oilPurchaseOrderDao.updateBatch(updatePurchase);
|
||||
oilPurchaseOrderDao.updateBatch(updatePurchase);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -198,8 +200,6 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean storage(Integer id) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
|
||||
|
||||
String oilIntake = "进油入库";
|
||||
int audit = iljStaffService.auditPrem(oilIntake);
|
||||
if (audit>0) {
|
||||
@ -212,7 +212,14 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
oilTank.setId(oilPurchaseOrderVO.getTankId());
|
||||
oilTank.setStoredQuantity(oilPurchaseOrderVO.getPurchaseVolume());
|
||||
oilTank.setTotalPrice(oilPurchaseOrderVO.getTotalAmount());
|
||||
oilTank.setDiscountedPrice(oilPurchaseOrderVO.getPurchasePrice());
|
||||
// oilTank.setDiscountedPrice(oilPurchaseOrderVO.getDiscountedPrice());
|
||||
|
||||
// 单价计算
|
||||
OilTank oilTankSum = oilTankMapper.queryById(oilPurchaseOrderVO.getTankId());
|
||||
BigDecimal totalSum= new BigDecimal(oilPurchaseOrderVO.getTotalAmount()).add(new BigDecimal(oilTankSum.getTotalPrice()));
|
||||
BigDecimal volSum= new BigDecimal(oilPurchaseOrderVO.getPurchaseVolume()).add(new BigDecimal(oilTankSum.getStoredQuantity()));
|
||||
BigDecimal disPrice = totalSum.divide(volSum, 2, RoundingMode.HALF_UP);
|
||||
oilTank.setDiscountedPrice(disPrice.doubleValue());
|
||||
oilTankMapper.accumulate(oilTank);
|
||||
// 插入到库存跟踪
|
||||
OilTracking oilTracking = new OilTracking();
|
||||
@ -224,8 +231,6 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
||||
oilTracking.setOrderNumber(oilPurchaseOrderVO.getPurchaseNo());
|
||||
oilTrackingMapper.insert(oilTracking);
|
||||
}
|
||||
|
||||
// 2.将数据填充到油罐里面
|
||||
String status = "qrts";
|
||||
|
||||
boolean edit = edit(id);
|
||||
|
@ -1,7 +1,9 @@
|
||||
package com.fuint.business.petrolStationManagement.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchase4OrdDTO;
|
||||
import com.fuint.business.petrolStationManagement.dto.OilPurchaseDTO;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||
@ -18,8 +20,10 @@ import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -38,6 +42,10 @@ public class OilPurchaseServiceImpl implements OilPurchaseService {
|
||||
@Resource
|
||||
private OilPurchaseOrderMapper oilPurchaseOrderMapper;
|
||||
|
||||
@Resource
|
||||
private OilPurchaseOrderMapper oilPurchaseOrderDao;
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
@ -117,20 +125,62 @@ public class OilPurchaseServiceImpl implements OilPurchaseService {
|
||||
oilPurchase.setCreator(nowAccountInfo.getStaffId().toString());
|
||||
|
||||
oilPurchase.setStatus("await");
|
||||
// 获取当前时间
|
||||
// Date currentDate = new Date();
|
||||
// oilPurchase.setCreatedAt(new Date());
|
||||
// // 创建一个SimpleDateFormat对象,指定想要的日期时间格式
|
||||
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//
|
||||
// // 使用SimpleDateFormat格式化日期时间
|
||||
// String formattedDate = dateFormat.format(currentDate);
|
||||
|
||||
|
||||
this.oilPurchaseDao.insert(oilPurchase);
|
||||
return oilPurchase;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public OilPurchase unifiedProcessing(OilPurchase4OrdDTO oilPurchase) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
OilPurchase oilPurchase1 = oilPurchase.getOilPurchase();
|
||||
|
||||
if (!ObjectUtil.isEmpty(oilPurchase1.getId())) {
|
||||
// 修改
|
||||
oilPurchase1.setUpdateBy(nowAccountInfo.getStaffId().toString());
|
||||
this.oilPurchaseDao.update(oilPurchase1);
|
||||
}else {
|
||||
oilPurchase1.setStoreId(nowAccountInfo.getStoreId());
|
||||
oilPurchase1.setCreateBy(nowAccountInfo.getStaffId().toString());
|
||||
oilPurchase1.setCreator(nowAccountInfo.getStaffId().toString());
|
||||
oilPurchase1.setStatus("await");
|
||||
this.oilPurchaseDao.insert(oilPurchase1);
|
||||
}
|
||||
|
||||
|
||||
List<OilPurchaseOrder> oilPurchaseOrders = oilPurchase.getOilPurchaseOrders();
|
||||
if (!ObjectUtil.isEmpty(oilPurchase1.getId())) {
|
||||
if (!ObjectUtil.isEmpty(oilPurchaseOrders)) {
|
||||
for (OilPurchaseOrder oilPurchaseOrder : oilPurchaseOrders) {
|
||||
oilPurchaseOrder.setPurchaseId(oilPurchase1.getId());
|
||||
}
|
||||
List<OilPurchaseOrder> insPurchase = new ArrayList<>();
|
||||
List<OilPurchaseOrder> updatePurchase = new ArrayList<>();
|
||||
if (oilPurchaseOrders.size()>0) {
|
||||
for (OilPurchaseOrder oilPurchaseOrder : oilPurchaseOrders) {
|
||||
if (oilPurchaseOrder.getId() != null) {
|
||||
updatePurchase.add(oilPurchaseOrder);
|
||||
}else {
|
||||
oilPurchaseOrder.setStoreId(nowAccountInfo.getStoreId());
|
||||
oilPurchaseOrder.setUpdateBy(nowAccountInfo.getStaffId().toString());
|
||||
insPurchase.add(oilPurchaseOrder);
|
||||
}
|
||||
}
|
||||
if (insPurchase.size()>0) {
|
||||
oilPurchaseOrderDao.insertBatch(insPurchase);
|
||||
}
|
||||
if (updatePurchase.size()>0) {
|
||||
oilPurchaseOrderDao.updateBatch(updatePurchase);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return oilPurchase1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订单审核
|
||||
* @param oilPurchase
|
||||
|
Loading…
Reference in New Issue
Block a user