会员等级和进油修改
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) {
|
export function updatePurchaseApi(data) {
|
||||||
return request({
|
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) {
|
export function auditApi(data) {
|
||||||
|
@ -433,7 +433,7 @@
|
|||||||
<div style="display: flex">
|
<div style="display: flex">
|
||||||
<div style="width: 7%;line-height: 40px">油品类型</div>
|
<div style="width: 7%;line-height: 40px">油品类型</div>
|
||||||
<el-radio-group v-model="tabOilType" style="margin-bottom: 30px;">
|
<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>
|
</el-radio-group>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -1010,8 +1010,13 @@ export default {
|
|||||||
await getCardValueListApi(quy).then(res=>{
|
await getCardValueListApi(quy).then(res=>{
|
||||||
this.cardValueList = res.data.records;
|
this.cardValueList = res.data.records;
|
||||||
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
|
this.cardValueList.sort((a, b) => a.rechargeBalance - b.rechargeBalance);
|
||||||
|
|
||||||
})
|
})
|
||||||
if (this.cardValueList.length > 0) {
|
if (this.cardValueList.length > 0) {
|
||||||
|
// 过滤
|
||||||
|
this.cardValueList = this.cardValueList.filter(item => {
|
||||||
|
return item.membershipLevel.includes(this.grade.name);
|
||||||
|
});
|
||||||
this.rechargeCard(0);
|
this.rechargeCard(0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1098,12 +1103,14 @@ export default {
|
|||||||
if (this.oilTypeList.length > 0) {
|
if (this.oilTypeList.length > 0) {
|
||||||
// 默认选中第一个
|
// 默认选中第一个
|
||||||
this.tabOilType = this.oilTypeList[0].oilType
|
this.tabOilType = this.oilTypeList[0].oilType
|
||||||
this.selectOilType(this.oilTypeList[0].oilType);
|
this.selectOilType(this.oilTypeList[0].status,this.oilTypeList[0].oilType);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 根据油品过滤查询存油卡
|
// 根据油品过滤查询存油卡
|
||||||
tabOilTypeClick(data){
|
tabOilTypeClick(data){
|
||||||
|
console.log("aaaaaaaaaaaaaa",this.grade.name)
|
||||||
|
|
||||||
this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => {
|
this.cardFuelDieselList = this.sourceCardFuelDieselList.filter(item => {
|
||||||
return item.oilType === data;
|
return item.oilType === data;
|
||||||
});
|
});
|
||||||
@ -1111,9 +1118,9 @@ export default {
|
|||||||
this.recharge(0)
|
this.recharge(0)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
selectOilType(oilType) {
|
selectOilType(status,oilType) {
|
||||||
this.tabOilType = oilType;
|
this.tabOilType = oilType;
|
||||||
this.tabOilTypeClick(oilType);
|
this.tabOilTypeClick(status);
|
||||||
},
|
},
|
||||||
// 查询员工
|
// 查询员工
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="dispose(scope.row)"
|
@click="dispose(scope.row)"
|
||||||
>{{ scope.row.status == 'ysh'?'查看单据':'处理单据' }}
|
>{{ scope.row.status == 'qrts'?'查看单据':'处理单据' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- <el-button-->
|
<!-- <el-button-->
|
||||||
<!-- size="mini"-->
|
<!-- size="mini"-->
|
||||||
|
@ -437,10 +437,8 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isDuplicate) {
|
if (isDuplicate) {
|
||||||
console.log("isDuplicate222")
|
|
||||||
|
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '有重复油罐油罐,请重新选择',
|
message: '有重复油罐,请重新选择',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
this.multipleSelection = []
|
this.multipleSelection = []
|
||||||
@ -517,12 +515,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
edit() {
|
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
|
let this_ = this
|
||||||
if (this_.inventoryNo.inventoryNo == null){
|
if (this_.inventoryNo.inventoryNo == null){
|
||||||
this.$modal.msgSuccess("请先填写盘点号");
|
this.$modal.msgSuccess("请先填写盘点号");
|
||||||
@ -596,7 +588,7 @@ export default {
|
|||||||
if (this_.inventoryId != null) {
|
if (this_.inventoryId != null) {
|
||||||
// 修改
|
// 修改
|
||||||
inventoryForm.id = this_.inventoryId
|
inventoryForm.id = this_.inventoryId
|
||||||
updateInventoryApi(inventoryForm).then(response=>{
|
await updateInventoryApi(inventoryForm).then(response=>{
|
||||||
// 处理列表
|
// 处理列表
|
||||||
// disList.inventoryId= this_.inventoryId
|
// disList.inventoryId= this_.inventoryId
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="dispose(scope.row)"
|
@click="dispose(scope.row)"
|
||||||
>处理单据</el-button>
|
>{{ scope.row.status == 'qrts'?'查看单据':'处理单据' }}</el-button>
|
||||||
<!-- <el-button-->
|
<!-- <el-button-->
|
||||||
<!-- size="mini"-->
|
<!-- size="mini"-->
|
||||||
<!-- type="text"-->
|
<!-- type="text"-->
|
||||||
|
@ -92,12 +92,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="小计金额(元)" align="center" prop="totalAmount">
|
<el-table-column label="小计金额(元)" align="center" prop="totalAmount">
|
||||||
<template slot-scope="scope">
|
<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>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="采购升数(L)" align="center" prop="purchaseVolume"/>
|
<el-table-column label="采购升数(L)" align="center" prop="purchaseVolume"/>
|
||||||
<el-table-column label="折和单价(元/升)" align="center" prop="discountedPrice"/>
|
<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">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -203,17 +204,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { getSuppliersListApi2 } from "@/api/oilConfig/oilSuppliers";
|
||||||
getSuppliersListApi,
|
|
||||||
getSuppliersListApi2,
|
|
||||||
insertSuppliersApi,
|
|
||||||
updateSuppliersApi
|
|
||||||
} from "@/api/oilConfig/oilSuppliers";
|
|
||||||
import {
|
import {
|
||||||
editPurchuseApi,
|
editPurchuseApi,
|
||||||
getPurchaseOrderApi,
|
getPurchaseOrderApi,unifiedProcessingApi,
|
||||||
insertPurchaseApi,
|
insertPurchaseApi,
|
||||||
insertPurchaseOrderApi,
|
insertPurchaseOrderApi,
|
||||||
|
disposeBatchApi,
|
||||||
updatePurchaseOrderApi,
|
updatePurchaseOrderApi,
|
||||||
updatePurchaseApi, auditApi, abolitionApi, storageApi, delPurchaseOrderApi
|
updatePurchaseApi, auditApi, abolitionApi, storageApi, delPurchaseOrderApi
|
||||||
} from "@/api/oilConfig/oilPurchase";
|
} from "@/api/oilConfig/oilPurchase";
|
||||||
@ -232,17 +229,13 @@ export default {
|
|||||||
purchaseId: null,
|
purchaseId: null,
|
||||||
numberId: null,
|
numberId: null,
|
||||||
tankId: null,
|
tankId: null,
|
||||||
|
tankName: null,
|
||||||
supplierId: null,
|
supplierId: null,
|
||||||
productDensity: null,
|
productDensity: null,
|
||||||
purchaseWeight: null,
|
purchaseWeight: null,
|
||||||
purchasePrice: null,
|
purchasePrice: null,
|
||||||
totalAmount: null,
|
totalAmount: null,
|
||||||
purchaseVolume: null,
|
purchaseVolume: null,
|
||||||
storeId: null,
|
|
||||||
createTime: null,
|
|
||||||
updateTime: null,
|
|
||||||
createBy: null,
|
|
||||||
updateBy: null,
|
|
||||||
preInboundInventory: null,
|
preInboundInventory: null,
|
||||||
discountedPrice: null
|
discountedPrice: null
|
||||||
},
|
},
|
||||||
@ -337,17 +330,14 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (this.$route.query.purchaseId != null) {
|
if (this.$route.query.purchaseId != null) {
|
||||||
this.queryParams.purchaseId = this.$route.query.purchaseId;
|
this.queryParams.purchaseId = this.$route.query.purchaseId;
|
||||||
this.purchaseId = this.$route.query.purchaseId;
|
this.purchaseId = this.$route.query.purchaseId;
|
||||||
}else if (this.$route.query.purchaseId == null && this.purchaseId>0) {
|
}else if (this.$route.query.purchaseId == null && this.purchaseId>0) {
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
this.queryParams.purchaseId = -parseInt(new Date().getTime())% 100000000;
|
// this.queryParams.purchaseId = -parseInt(new Date().getTime())% 100000000;
|
||||||
this.purchaseId = -parseInt(new Date().getTime()) % 100000000;
|
// this.purchaseId = -parseInt(new Date().getTime()) % 100000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = this.$route.query.state;
|
this.state = this.$route.query.state;
|
||||||
@ -408,37 +398,95 @@ export default {
|
|||||||
this.selectSuppliers()
|
this.selectSuppliers()
|
||||||
},
|
},
|
||||||
orderDel(data) {
|
orderDel(data) {
|
||||||
delPurchaseOrderApi(data).then(response => {
|
if (data.id != null) {
|
||||||
this.$modal.msgSuccess("删除成功");
|
delPurchaseOrderApi(data).then(res=>{
|
||||||
this.getList()
|
})
|
||||||
})
|
}
|
||||||
|
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() {
|
submitForm: function() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (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
|
// 复制id
|
||||||
this.orderForm.purchaseId = this.purchaseId
|
this.orderForm.purchaseId = this.purchaseId
|
||||||
if (!this.orderForm.id) {
|
|
||||||
insertPurchaseOrderApi(this.orderForm).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
let numberName = this.numberList.find(item => item.numberId === this.orderForm.numberId);
|
||||||
this.open = false;
|
let tankName = this.tankList.find(item => item.id === this.orderForm.tankId);
|
||||||
// this.saveJudgment()
|
let supplierName = this.suppliersList.find(item => item.id === this.orderForm.supplierId);
|
||||||
this.getList();
|
console.log("numberName",numberName)
|
||||||
});
|
// 去重
|
||||||
} else {
|
let isDuplicate = false
|
||||||
updatePurchaseOrderApi(this.orderForm).then(response => {
|
if (this.orderList.length > 0) {
|
||||||
this.$modal.msgSuccess("修改成功");
|
isDuplicate = this.orderList.some(order => order.numberId === this.orderForm.numberId);
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
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) {
|
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.orderForm = data
|
||||||
this.edit()
|
// this.edit()
|
||||||
},
|
},
|
||||||
edit() {
|
edit() {
|
||||||
updatePurchaseOrderApi(this.orderForm).then(response => {
|
updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||||
@ -530,46 +584,101 @@ export default {
|
|||||||
this.$modal.msgWarning("请先选择进货时间");
|
this.$modal.msgWarning("请先选择进货时间");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (this.orderList.length <= 0) {
|
||||||
|
this.$modal.msgWarning("请选择至少一个油品");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
let from = {
|
let from = {
|
||||||
|
id:this.purchaseId,
|
||||||
purchaseNo : this.purchaseForm.purchaseNo,
|
purchaseNo : this.purchaseForm.purchaseNo,
|
||||||
purchaseDate : this.purchaseForm.purchaseDate,
|
purchaseDate : this.purchaseForm.purchaseDate,
|
||||||
theDocumentAmount : this.totalAmountPurchased,
|
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 优化 将这些代码加到后台中完成并进行事务管理
|
|
||||||
|
|
||||||
editPurchuseApi(oilPurchase).then(response2 => {
|
await unifiedProcessingApi({oilPurchase:from,oilPurchaseOrders:this.orderList}).then(res=>{
|
||||||
if (flag != -1) {
|
if (res.code === 200) {
|
||||||
// this.$router.push({ path: '/oilPurchase/purchaseOrder', query: {
|
this.purchaseId = res.data.id
|
||||||
// purchaseId: oilPurchase.purchaseId,
|
|
||||||
// purchaseNo: response.data.purchaseNo,
|
|
||||||
// state: response.data.status
|
|
||||||
// }});
|
|
||||||
this.$router.push('/oilConfig/oilPurchase/list');
|
|
||||||
|
|
||||||
}
|
this.$router.push({ path: '/oilConfig/oilPurchase/list'});
|
||||||
})
|
}else {
|
||||||
this.getList();
|
return -1;
|
||||||
});
|
}
|
||||||
} else {
|
}).catch({
|
||||||
from.id = this.queryParams.purchaseId
|
})
|
||||||
updatePurchaseApi(from).then(response => {
|
|
||||||
this.$modal.msgSuccess("添加成功");
|
// 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.$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(){
|
saveJudgment(){
|
||||||
@ -582,12 +691,15 @@ export default {
|
|||||||
let judgmentPermissions1 = await this.judgmentPermissions("进油审核");
|
let judgmentPermissions1 = await this.judgmentPermissions("进油审核");
|
||||||
if (judgmentPermissions1 > 0){
|
if (judgmentPermissions1 > 0){
|
||||||
this.auditFlag=false
|
this.auditFlag=false
|
||||||
|
}else {
|
||||||
|
this.auditFlag=true
|
||||||
}
|
}
|
||||||
let judgmentPermissions2 = await this.judgmentPermissions("进油入库");
|
let judgmentPermissions2 = await this.judgmentPermissions("进油入库");
|
||||||
if (judgmentPermissions2 > 0){
|
if (judgmentPermissions2 > 0){
|
||||||
this.storageFlag = false
|
this.storageFlag = false
|
||||||
|
}else {
|
||||||
|
this.storageFlag=true
|
||||||
}
|
}
|
||||||
|
|
||||||
let judgmentPermissions3 = await this.judgmentPermissions("进油废止");
|
let judgmentPermissions3 = await this.judgmentPermissions("进油废止");
|
||||||
if (judgmentPermissions3 > 0){
|
if (judgmentPermissions3 > 0){
|
||||||
this.voidFlag=false
|
this.voidFlag=false
|
||||||
@ -709,9 +821,6 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 页面跳转
|
// 页面跳转
|
||||||
goToAbout() {
|
goToAbout() {
|
||||||
this.$router.push('/oilConfig/oilPurchase/list');
|
this.$router.push('/oilConfig/oilPurchase/list');
|
||||||
|
@ -153,12 +153,7 @@ public class CardFuelDieselController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/countOilType")
|
@GetMapping("/countOilType")
|
||||||
public ResponseObject countOilType() {
|
public ResponseObject countOilType() {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
return getSuccessResult(cardFuelDieselService.countOilType());
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@ package com.fuint.business.marketingActivity.cardFule.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 柴油屯油卡(CardFuelDiesel)表数据库访问层
|
* 柴油屯油卡(CardFuelDiesel)表数据库访问层
|
||||||
*
|
*
|
||||||
@ -11,5 +13,6 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
|||||||
*/
|
*/
|
||||||
public interface CardFuelDieselMapper extends BaseMapper<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.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 柴油屯油卡(CardFuelDiesel)表服务接口
|
* 柴油屯油卡(CardFuelDiesel)表服务接口
|
||||||
*
|
*
|
||||||
@ -11,5 +13,7 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
|||||||
*/
|
*/
|
||||||
public interface CardFuelDieselService extends IService<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.mapper.CardFuelDieselMapper;
|
||||||
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
|
||||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
|
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 org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 柴油屯油卡(CardFuelDiesel)表服务实现类
|
* 柴油屯油卡(CardFuelDiesel)表服务实现类
|
||||||
*
|
*
|
||||||
@ -15,5 +20,13 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service("cardFuelDieselService")
|
@Service("cardFuelDieselService")
|
||||||
public class CardFuelDieselServiceImpl extends ServiceImpl<CardFuelDieselMapper, CardFuelDiesel> implements 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.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.dto.OilPurchaseDTO;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||||
@ -105,6 +106,11 @@ public class OilPurchaseController extends BaseController {
|
|||||||
return getSuccessResult(this.oilPurchaseService.insert(oilPurchase));
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("disposeBatch")
|
@PostMapping("disposeBatch")
|
||||||
@ -127,11 +127,21 @@ public class OilPurchaseOrderController extends BaseController {
|
|||||||
return getSuccessResult(this.oilPurchaseOrderService.audit(id));
|
return getSuccessResult(this.oilPurchaseOrderService.audit(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进油废除
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("abolition")
|
@GetMapping("abolition")
|
||||||
public ResponseObject abolition(Integer id) {
|
public ResponseObject abolition(Integer id) {
|
||||||
return getSuccessResult(this.oilPurchaseOrderService.abolition(id));
|
return getSuccessResult(this.oilPurchaseOrderService.abolition(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进油入库
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("storage")
|
@GetMapping("storage")
|
||||||
public ResponseObject storage(Integer id) {
|
public ResponseObject storage(Integer id) {
|
||||||
return getSuccessResult(this.oilPurchaseOrderService.storage(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.total_amount totalAmount,
|
||||||
opo.purchase_volume purchaseVolume,
|
opo.purchase_volume purchaseVolume,
|
||||||
opo.discounted_price discountedPrice,
|
opo.discounted_price discountedPrice,
|
||||||
|
opo.pre_inbound_inventory preInboundInventory,
|
||||||
onn.oil_type oilType,
|
onn.oil_type oilType,
|
||||||
onn.oil_name oilName,
|
onn.oil_name oilName,
|
||||||
os.supplier_name supplierName,
|
os.supplier_name supplierName,
|
||||||
@ -163,10 +164,10 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
<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
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<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>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -228,37 +229,36 @@
|
|||||||
|
|
||||||
<update id="updateBatch">
|
<update id="updateBatch">
|
||||||
<foreach collection="list" item="user" separator=";">
|
<foreach collection="list" item="user" separator=";">
|
||||||
|
|
||||||
update oil_purchase_order
|
update oil_purchase_order
|
||||||
<set>
|
<set>
|
||||||
<if test="${user.purchaseId != null}">
|
<if test="user.purchaseId != null">
|
||||||
purchase_id = #{user.purchaseId},
|
purchase_id = #{user.purchaseId},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.numberId != null}">
|
<if test="user.numberId != null">
|
||||||
number_id = #{user.numberId},
|
number_id = #{user.numberId},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.tankId != null}">
|
<if test="user.tankId != null">
|
||||||
tank_id = #{user.tankId},
|
tank_id = #{user.tankId},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.supplierId != null}">
|
<if test="user.supplierId != null">
|
||||||
supplier_id = #{user.supplierId},
|
supplier_id = #{user.supplierId},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.productDensity != null}">
|
<if test="user.productDensity != null">
|
||||||
product_density = #{user.productDensity},
|
product_density = #{user.productDensity},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.purchaseWeight != null}">
|
<if test="user.purchaseWeight != null">
|
||||||
purchase_weight = #{user.purchaseWeight},
|
purchase_weight = #{user.purchaseWeight},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.purchasePrice != null}">
|
<if test="user.purchasePrice != null">
|
||||||
purchase_price = #{user.purchasePrice},
|
purchase_price = #{user.purchasePrice},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.totalAmount != null}">
|
<if test="user.totalAmount != null">
|
||||||
total_amount = #{user.totalAmount},
|
total_amount = #{user.totalAmount},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.purchaseVolume != null}">
|
<if test="user.purchaseVolume != null">
|
||||||
purchase_volume = #{user.purchaseVolume},
|
purchase_volume = #{user.purchaseVolume},
|
||||||
</if>
|
</if>
|
||||||
<if test="${user.discountedPrice != null}">
|
<if test="user.discountedPrice != null">
|
||||||
discounted_price = #{user.discountedPrice},
|
discounted_price = #{user.discountedPrice},
|
||||||
</if>
|
</if>
|
||||||
update_time = NOW()
|
update_time = NOW()
|
||||||
|
@ -50,7 +50,7 @@ public interface OilPurchaseOrderService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量处理数据
|
* 批量处理数据
|
||||||
* @param oilInventoryOrder
|
* @param oilPurchaseOrders
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int disposeBatch(List<OilPurchaseOrder> oilPurchaseOrders);
|
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.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.dto.OilPurchaseDTO;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||||
@ -46,6 +47,8 @@ public interface OilPurchaseService {
|
|||||||
*/
|
*/
|
||||||
OilPurchase insert(OilPurchase oilPurchase);
|
OilPurchase insert(OilPurchase oilPurchase);
|
||||||
|
|
||||||
|
OilPurchase unifiedProcessing(OilPurchase4OrdDTO oilPurchase);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单审核
|
* 订单审核
|
||||||
* @param oilPurchase
|
* @param oilPurchase
|
||||||
|
@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -123,7 +125,7 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
|||||||
oilPurchaseOrderDao.insertBatch(insPurchase);
|
oilPurchaseOrderDao.insertBatch(insPurchase);
|
||||||
}
|
}
|
||||||
if (updatePurchase.size()>0) {
|
if (updatePurchase.size()>0) {
|
||||||
int i = oilPurchaseOrderDao.updateBatch(updatePurchase);
|
oilPurchaseOrderDao.updateBatch(updatePurchase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -198,8 +200,6 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean storage(Integer id) {
|
public boolean storage(Integer id) {
|
||||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
|
||||||
|
|
||||||
String oilIntake = "进油入库";
|
String oilIntake = "进油入库";
|
||||||
int audit = iljStaffService.auditPrem(oilIntake);
|
int audit = iljStaffService.auditPrem(oilIntake);
|
||||||
if (audit>0) {
|
if (audit>0) {
|
||||||
@ -212,7 +212,14 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
|||||||
oilTank.setId(oilPurchaseOrderVO.getTankId());
|
oilTank.setId(oilPurchaseOrderVO.getTankId());
|
||||||
oilTank.setStoredQuantity(oilPurchaseOrderVO.getPurchaseVolume());
|
oilTank.setStoredQuantity(oilPurchaseOrderVO.getPurchaseVolume());
|
||||||
oilTank.setTotalPrice(oilPurchaseOrderVO.getTotalAmount());
|
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);
|
oilTankMapper.accumulate(oilTank);
|
||||||
// 插入到库存跟踪
|
// 插入到库存跟踪
|
||||||
OilTracking oilTracking = new OilTracking();
|
OilTracking oilTracking = new OilTracking();
|
||||||
@ -224,8 +231,6 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
|
|||||||
oilTracking.setOrderNumber(oilPurchaseOrderVO.getPurchaseNo());
|
oilTracking.setOrderNumber(oilPurchaseOrderVO.getPurchaseNo());
|
||||||
oilTrackingMapper.insert(oilTracking);
|
oilTrackingMapper.insert(oilTracking);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2.将数据填充到油罐里面
|
|
||||||
String status = "qrts";
|
String status = "qrts";
|
||||||
|
|
||||||
boolean edit = edit(id);
|
boolean edit = edit(id);
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.fuint.business.petrolStationManagement.service.impl;
|
package com.fuint.business.petrolStationManagement.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.dto.OilPurchaseDTO;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
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.stereotype.Service;
|
||||||
import org.springframework.data.domain.PageImpl;
|
import org.springframework.data.domain.PageImpl;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -38,6 +42,10 @@ public class OilPurchaseServiceImpl implements OilPurchaseService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OilPurchaseOrderMapper oilPurchaseOrderMapper;
|
private OilPurchaseOrderMapper oilPurchaseOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OilPurchaseOrderMapper oilPurchaseOrderDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
@ -117,20 +125,62 @@ public class OilPurchaseServiceImpl implements OilPurchaseService {
|
|||||||
oilPurchase.setCreator(nowAccountInfo.getStaffId().toString());
|
oilPurchase.setCreator(nowAccountInfo.getStaffId().toString());
|
||||||
|
|
||||||
oilPurchase.setStatus("await");
|
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);
|
this.oilPurchaseDao.insert(oilPurchase);
|
||||||
return 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
|
* @param oilPurchase
|
||||||
|
Loading…
Reference in New Issue
Block a user