进油 盘点
This commit is contained in:
parent
3fd0db5a0d
commit
69feab70bc
@ -5,7 +5,16 @@ import request from "@/utils/request";
|
|||||||
// 查询油罐列表
|
// 查询油罐列表
|
||||||
export function getInventoryApi(data) {
|
export function getInventoryApi(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/business/petrolStationManagement/oilInventory/getList',
|
url: '/business/petrolStationManagement/oilInventory/getListPage',
|
||||||
|
method: 'get',
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据id查询信息
|
||||||
|
export function getInventoryByIdApi(data) {
|
||||||
|
return request({
|
||||||
|
url: '/business/petrolStationManagement/oilInventory/data',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: data
|
params: data
|
||||||
})
|
})
|
||||||
@ -83,3 +92,20 @@ export function selectList2Api(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除有关信息
|
||||||
|
export function delInventoryOrderApi(data) {
|
||||||
|
return request({
|
||||||
|
url: 'business/petrolStationManagement/oilInventoryOrder',
|
||||||
|
method: 'delete',
|
||||||
|
params: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量处理数据
|
||||||
|
export function disposeBatchApi(data) {
|
||||||
|
return request({
|
||||||
|
url: 'business/petrolStationManagement/oilInventoryOrder/disposeBatch',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -59,14 +59,14 @@
|
|||||||
|
|
||||||
<el-table ref="tables"
|
<el-table ref="tables"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
:data="purchaseList"
|
:data="inventoryList"
|
||||||
:default-sort="defaultSort">
|
:default-sort="defaultSort">
|
||||||
<el-table-column label="业务单号" align="center" prop="purchaseNo"/>
|
<el-table-column label="业务单号" align="center" prop="purchaseNo"/>
|
||||||
<el-table-column label="单据详情" align="center">
|
<el-table-column label="盘点详情" align="center">
|
||||||
<el-table-column label="供应商" align="center" prop="supplierss"/>
|
<el-table-column label="盘点油罐" align="center" prop="supplierss"/>
|
||||||
<el-table-column label="油品" align="center" prop="oils"/>
|
<el-table-column label="盘点升数" align="center" prop="oils"/>
|
||||||
<el-table-column label="入库油罐" align="center" prop="tanks"/>
|
<el-table-column label="库存差异升数" align="center" prop="tanks"/>
|
||||||
<el-table-column label="单据金额" align="center" prop="theDocumentAmount"/>
|
<el-table-column label="盈亏金额" align="center" prop="theDocumentAmount"/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status">
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@ -78,7 +78,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作人员" align="center">
|
<el-table-column label="操作人信息" align="center">
|
||||||
<el-table-column label="制单人" align="center" prop="creatorName"/>
|
<el-table-column label="制单人" align="center" prop="creatorName"/>
|
||||||
<el-table-column label="审核人" align="center" prop="reviewerName"/>
|
<el-table-column label="审核人" align="center" prop="reviewerName"/>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -122,6 +122,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getPurchaseApi, getPurchaseOrderApi} from "@/api/oilConfig/oilPurchase";
|
import {getPurchaseApi, getPurchaseOrderApi} from "@/api/oilConfig/oilPurchase";
|
||||||
import {getSuppliersListApi2} from "@/api/oilConfig/oilSuppliers";
|
import {getSuppliersListApi2} from "@/api/oilConfig/oilSuppliers";
|
||||||
|
import {getInventoryApi} from "@/api/oilConfig/oilInventory";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "list",
|
name: "list",
|
||||||
@ -129,6 +130,12 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
inventoryList: [],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
purchaseList: [],
|
purchaseList: [],
|
||||||
|
|
||||||
suppliersList: [],
|
suppliersList: [],
|
||||||
@ -166,19 +173,20 @@ export default {
|
|||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
await this.getList();
|
await this.getList();
|
||||||
this.selectSuppliers();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
getList(){
|
getList(){
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getPurchaseApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
getInventoryApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
this.purchaseList = response.data.records;
|
this.inventoryList = response.data.records;
|
||||||
console.log("this.tankList",this.purchaseList)
|
console.log("this.inventoryList",this.purchaseList)
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
})
|
})
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// 添加采购
|
// 添加采购
|
||||||
purchaseAdd() {
|
purchaseAdd() {
|
||||||
this.$router.push('/oilInventory/order');
|
this.$router.push('/oilInventory/order');
|
||||||
@ -195,12 +203,6 @@ export default {
|
|||||||
},
|
},
|
||||||
handleDel(data) {
|
handleDel(data) {
|
||||||
},
|
},
|
||||||
// 查询所有供应商
|
|
||||||
selectSuppliers() {
|
|
||||||
getSuppliersListApi2().then(response => {
|
|
||||||
this.suppliersList = response.data;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 搜索按钮操作
|
// 搜索按钮操作
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.page = 1;
|
this.queryParams.page = 1;
|
||||||
|
@ -15,24 +15,26 @@
|
|||||||
<span>油罐数量</span>
|
<span>油罐数量</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<span>{{countLiters}}</span>
|
<span>{{inventoryVolume}}</span>
|
||||||
<span>盘点升数</span>
|
<span>盘点升数</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<span>{{inventoryDiscrepancies}}</span>
|
<span>{{stockDifference}}</span>
|
||||||
<span>库存差异(L)</span>
|
<span>库存差异(L)</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<span>{{totalProfitAndLoss}}</span>
|
<span>{{profitLossAmount}}</span>
|
||||||
<span>盈亏总额(元)</span>
|
<span>盈亏总额(元)</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div style="height: 100%; width: 30%; display: flex; flex-direction: column; justify-content: space-between;">
|
<div style="height: 100%; width: 30%; display: flex; flex-direction: column; justify-content: space-between;">
|
||||||
<el-form ref="myForm" label-width="100px">
|
<el-form ref="myForm" label-width="100px">
|
||||||
<el-form-item label="进货单号">
|
<el-form-item label="进货单号">
|
||||||
<el-input v-model="purchaseForm.purchaseNo" @change="saveJudgment"
|
<el-input v-model="inventoryNo.inventoryNo" @change="saveJudgment"
|
||||||
style="width: 220Px">
|
style="width: 220Px">
|
||||||
<el-button slot="append" @click="refresh()" icon="el-icon-refresh"></el-button>
|
<el-button slot="append" @click="refresh()" icon="el-icon-refresh"></el-button>
|
||||||
</el-input>
|
</el-input>
|
||||||
@ -40,7 +42,7 @@
|
|||||||
<el-form-item label="进货时间" >
|
<el-form-item label="进货时间" >
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
style="width: 220Px"
|
style="width: 220Px"
|
||||||
v-model="purchaseForm.purchaseDate"
|
v-model="inventoryNo.inventoryDate"
|
||||||
@change="saveJudgment"
|
@change="saveJudgment"
|
||||||
type="date"
|
type="date"
|
||||||
placeholder="选择日期">
|
placeholder="选择日期">
|
||||||
@ -50,7 +52,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
|
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
|
||||||
<el-button type="primary" :disabled="saveFlag" @click="savePurchase()">保存</el-button>
|
<el-button type="primary" :disabled="saveFlag" @click="saveInventory()">保存</el-button>
|
||||||
<el-button type="success" :disabled="auditFlag" >保存并审核</el-button>
|
<el-button type="success" :disabled="auditFlag" >保存并审核</el-button>
|
||||||
<el-button type="warning" :disabled="voidFlag">作废</el-button>
|
<el-button type="warning" :disabled="voidFlag">作废</el-button>
|
||||||
</div>
|
</div>
|
||||||
@ -88,10 +90,10 @@
|
|||||||
<el-table-column label="当前库存升数(L)" align="center" prop="currentInventoryVolume"/>
|
<el-table-column label="当前库存升数(L)" align="center" prop="currentInventoryVolume"/>
|
||||||
<el-table-column label="盘点升数(L)" align="center" prop="inventoryVolume">
|
<el-table-column label="盘点升数(L)" align="center" prop="inventoryVolume">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input-number v-model="scope.row.productDensity" @change="change(scope.row)" controls-position="right" :min="0.000001" :max="1000" :step="1" style="max-width: 100%"></el-input-number>
|
<el-input-number v-model="scope.row.inventoryVolume" @change="change(scope.row)" controls-position="right" :min="0" :max="100000000" :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="stockDifferenceVolume"/>
|
<el-table-column label="库存差异升数(L)" align="center" prop="stockDifference"/>
|
||||||
<el-table-column label="盈亏金额(L)" align="center" prop="profitLossAmount"/>
|
<el-table-column label="盈亏金额(L)" align="center" prop="profitLossAmount"/>
|
||||||
<el-table-column v-if="true" label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column v-if="true" label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
@ -192,7 +194,7 @@ import {
|
|||||||
updateInventoryOrderApi,
|
updateInventoryOrderApi,
|
||||||
updateInventoryApi,
|
updateInventoryApi,
|
||||||
selectList2Api,
|
selectList2Api,
|
||||||
insertBatchInventoryOrderApi
|
insertBatchInventoryOrderApi, getInventoryByIdApi, disposeBatchApi, delInventoryOrderApi
|
||||||
} from "@/api/oilConfig/oilInventory";
|
} from "@/api/oilConfig/oilInventory";
|
||||||
import {getOilNameListApi} from "@/api/oilPrice";
|
import {getOilNameListApi} from "@/api/oilPrice";
|
||||||
import {selectTankByNumberApi} from "@/api/oilConfig/oilGuns";
|
import {selectTankByNumberApi} from "@/api/oilConfig/oilGuns";
|
||||||
@ -235,18 +237,24 @@ export default {
|
|||||||
totalAmountPurchased: 0, //采购总额
|
totalAmountPurchased: 0, //采购总额
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
numberOfTanks: 0, // 油罐数量
|
numberOfTanks: 0, // 油罐数量
|
||||||
countLiters: 0, // 盘点升数
|
inventoryVolume: 0, // 盘点升数
|
||||||
inventoryDiscrepancies: 0, // 库存差异
|
stockDifference: 0, // 库存差异
|
||||||
totalProfitAndLoss: 0, // 盈亏总额
|
profitLossAmount: 0,// 盈亏总额
|
||||||
|
|
||||||
|
|
||||||
tankList:[], //
|
tankList:[], //
|
||||||
tankForm: {
|
tankForm: {
|
||||||
numberId:'',
|
numberId:'',
|
||||||
tankName:''
|
tankName:''
|
||||||
},
|
},
|
||||||
|
|
||||||
|
inventoryId:'', // 盘点id
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
selectOilTypeByPrice: [], // 油品
|
selectOilTypeByPrice: [], // 油品
|
||||||
multipleSelection: [],
|
multipleSelection: [],
|
||||||
|
|
||||||
@ -287,9 +295,10 @@ export default {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
purchaseForm: {
|
|
||||||
purchaseNo: null,
|
inventoryNo: {
|
||||||
purchaseDate: null
|
inventoryNo: null,
|
||||||
|
inventoryDate: null
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
id: "", // ID(标识)
|
id: "", // ID(标识)
|
||||||
@ -310,7 +319,7 @@ export default {
|
|||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
// console.log("yourParamKey",this.$route.query.purchaseId)
|
// console.log("yourParamKey",this.$route.query.purchaseId)
|
||||||
// this.queryParams.purchaseId = this.$route.query.purchaseId;
|
|
||||||
// this.purchaseId = this.$route.query.purchaseId;
|
// this.purchaseId = this.$route.query.purchaseId;
|
||||||
// console.log("yourParamKey2",this.$route.query.purchaseId)
|
// console.log("yourParamKey2",this.$route.query.purchaseId)
|
||||||
//
|
//
|
||||||
@ -318,12 +327,17 @@ export default {
|
|||||||
// 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.purchaseForm.purchaseNo = this.$route.query.purchaseNo;
|
// this.inventoryNo.inventoryNo = this.$route.query.inventoryNo;
|
||||||
|
|
||||||
if (this.purchaseForm.purchaseNo == null) {
|
|
||||||
|
// this.queryParams.inventoryId = this.$route.query.inventoryId;
|
||||||
|
// this.inventoryId = this.$route.query.inventoryId;
|
||||||
|
|
||||||
|
|
||||||
|
if (this.inventoryNo.inventoryNo == null) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
console.log("yourParamKey3",this.$route.query.purchaseId)
|
console.log("yourParamKey3",this.$route.query.inventoryId)
|
||||||
|
|
||||||
await this.getList();
|
await this.getList();
|
||||||
|
|
||||||
@ -334,53 +348,125 @@ export default {
|
|||||||
getInventoryOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
getInventoryOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||||
this.orderList = response.data.records;
|
this.orderList = response.data.records;
|
||||||
this.total = response.data.total;
|
this.total = response.data.total;
|
||||||
|
this.numberOfTanks = response.data.total;
|
||||||
// 总数计算
|
// 总数计算
|
||||||
// this.sumMethod(response.data.records);
|
this.sumMethod(response.data.records);
|
||||||
|
|
||||||
})
|
})
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTankList() {
|
// 根据id获取盘点的详细信息
|
||||||
console.log("response");
|
getInventoryById() {
|
||||||
|
let this_ = this
|
||||||
|
let data = 0;
|
||||||
|
getInventoryByIdApi(data).then(response=>{
|
||||||
|
this_.inventoryVolume= response.data.inventoryVolume,
|
||||||
|
this_.stockDifference= response.data.stockDifference,
|
||||||
|
this_.profitLossAmount= response.data.profitLossAmount
|
||||||
|
}).catch()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 计算header数据
|
||||||
|
sumMethod(data) {
|
||||||
|
console.log("sumMethod",data)
|
||||||
|
let this_ = this
|
||||||
|
this_.inventoryVolume = new BigNumber(0),
|
||||||
|
this_.stockDifference = new BigNumber(0),
|
||||||
|
this_.profitLossAmount = new BigNumber(0),
|
||||||
|
data.forEach(da => {
|
||||||
|
if (da.inventoryVolume != null) {
|
||||||
|
this_.inventoryVolume= this_.inventoryVolume.plus(da.inventoryVolume)
|
||||||
|
}
|
||||||
|
if (da.stockDifference != null) {
|
||||||
|
this_.stockDifference= this_.stockDifference.plus(da.stockDifference)
|
||||||
|
}
|
||||||
|
if (da.profitLossAmount != null) {
|
||||||
|
this_.profitLossAmount= this_.profitLossAmount.plus(da.profitLossAmount)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 改变数字时
|
||||||
|
change(data) {
|
||||||
|
// 库存差异升数
|
||||||
|
data.stockDifference = data.inventoryVolume - data.currentInventoryVolume
|
||||||
|
// 盈亏金额
|
||||||
|
data.profitLossAmount = data.inventoryVolume * data.stockDifference
|
||||||
|
|
||||||
|
this.sumMethod(this.orderList)
|
||||||
|
// 进行保存
|
||||||
|
// this.orderForm = data
|
||||||
|
// this.edit()
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
// 查询油罐
|
||||||
|
inquireTank() {
|
||||||
|
this.getTankList()/**/
|
||||||
|
},
|
||||||
|
// 选择油品号之后
|
||||||
|
chooseOilNumber(data) {
|
||||||
|
this.getTankList()
|
||||||
|
// this.selectTankByNumber(this.orderForm.numberId);
|
||||||
|
},
|
||||||
|
getTankList() {
|
||||||
selectList2Api(this.tankForm).then(response => {
|
selectList2Api(this.tankForm).then(response => {
|
||||||
console.log("response",response);
|
console.log("response",response);
|
||||||
this.tankList = response.data
|
this.tankList = response.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 查询油罐
|
|
||||||
inquireTank() {
|
|
||||||
this.getTankList()/**/
|
|
||||||
},
|
|
||||||
// 添加采购油品
|
// 添加采购油品
|
||||||
orderAdd() {
|
orderAdd() {
|
||||||
// // 初始化
|
// 初始化
|
||||||
// this.orderForm = {}
|
|
||||||
this.open = true;
|
this.open = true;
|
||||||
// this.title = "新增采购油品"
|
this.title = "选择油罐"
|
||||||
this.getOilNameList()
|
this.getOilNameList()
|
||||||
// this.selectSuppliers()
|
// this.selectSuppliers()
|
||||||
},
|
},
|
||||||
// 添加油罐到订单列表
|
// 添加油罐到订单列表
|
||||||
addOrder () {
|
addOrder () {
|
||||||
|
let this_ = this
|
||||||
console.log("ccccccccccccccccc",this.multipleSelection)
|
// let oilInventoryOrder = []
|
||||||
let oilInventoryOrder = []
|
//
|
||||||
|
// this.multipleSelection.forEach(mul=>{
|
||||||
|
// let now = {
|
||||||
|
// tankId: mul.id,
|
||||||
|
// numberId: mul.numberId,
|
||||||
|
// currentAveragePrice: mul.discountedPrice,
|
||||||
|
// currentInventoryVolume: mul.storedQuantity
|
||||||
|
// }
|
||||||
|
// oilInventoryOrder.push(now)
|
||||||
|
// })
|
||||||
|
|
||||||
this.multipleSelection.forEach(mul=>{
|
this.multipleSelection.forEach(mul=>{
|
||||||
let now = {
|
let now = {
|
||||||
tankId: mul.id,
|
tankId: mul.id,
|
||||||
|
tankName: mul.tankName,
|
||||||
numberId: mul.numberId,
|
numberId: mul.numberId,
|
||||||
|
numberName: mul.oilNumber,
|
||||||
|
inventoryVolume:mul.storedQuantity,
|
||||||
currentAveragePrice: mul.discountedPrice,
|
currentAveragePrice: mul.discountedPrice,
|
||||||
currentInventoryVolume: mul.storedQuantity
|
currentInventoryVolume: mul.storedQuantity
|
||||||
}
|
}
|
||||||
oilInventoryOrder.push(now)
|
this_.orderList.push(now)
|
||||||
})
|
})
|
||||||
|
// this_.getList();
|
||||||
|
this_.open = false
|
||||||
|
this.numberOfTanks = this.numberOfTanks+1
|
||||||
|
|
||||||
insertBatchInventoryOrderApi(oilInventoryOrder).then(response => {
|
|
||||||
// console.log("response",response);
|
|
||||||
// this.tankList = response.data
|
// this_.orderList
|
||||||
})
|
|
||||||
|
// insertBatchInventoryOrderApi(oilInventoryOrder).then(response => {
|
||||||
|
// this_.$modal.msgSuccess("保存成功");
|
||||||
|
// this_.getList();
|
||||||
|
// this_.open = false
|
||||||
|
// }).catch(response=>{
|
||||||
|
//
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
// 表格选择器
|
// 表格选择器
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
@ -391,8 +477,16 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
orderDel() {
|
orderDel(data) {
|
||||||
|
if (data.id != null) {
|
||||||
|
delInventoryOrderApi(data).then(res=>{
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const index = this.orderList.indexOf(data); // 查找要删除的对象的索引
|
||||||
|
if (index !== -1) {
|
||||||
|
this.orderList.splice(index, 1); // 使用splice方法删除对象
|
||||||
|
}
|
||||||
|
this.numberOfTanks = this.numberOfTanks-1
|
||||||
},
|
},
|
||||||
// 提交
|
// 提交
|
||||||
submitForm: function() {
|
submitForm: function() {
|
||||||
@ -427,18 +521,7 @@ export default {
|
|||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
},
|
},
|
||||||
// 改变数字时
|
|
||||||
change(data) {
|
|
||||||
// // 密度计算
|
|
||||||
// data.purchaseVolume = ((data.purchaseWeight*(1000))/data.productDensity).toFixed(2);
|
|
||||||
// // 计算小计价格
|
|
||||||
// data.totalAmount = data.purchasePrice * data.purchaseWeight
|
|
||||||
// // 折合单价
|
|
||||||
// data.discountedPrice = (data.purchaseVolume / data.totalAmount).toFixed(2);
|
|
||||||
// // 进行保存
|
|
||||||
// this.orderForm = data
|
|
||||||
// this.edit()
|
|
||||||
},
|
|
||||||
edit() {
|
edit() {
|
||||||
// updatePurchaseOrderApi(this.orderForm).then(response => {
|
// updatePurchaseOrderApi(this.orderForm).then(response => {
|
||||||
// // this.$modal.msgSuccess("修改成功");
|
// // this.$modal.msgSuccess("修改成功");
|
||||||
@ -447,11 +530,7 @@ export default {
|
|||||||
// this.getList();
|
// this.getList();
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
// 选择油品号之后
|
|
||||||
chooseOilNumber(data) {
|
|
||||||
this.getTankList()
|
|
||||||
// this.selectTankByNumber(this.orderForm.numberId);
|
|
||||||
},
|
|
||||||
// 选择油罐添加密度
|
// 选择油罐添加密度
|
||||||
chooseTank(data){
|
chooseTank(data){
|
||||||
// // 根据id找密度
|
// // 根据id找密度
|
||||||
@ -490,62 +569,62 @@ export default {
|
|||||||
var max = 999; // 最大的四位数是 9999
|
var max = 999; // 最大的四位数是 9999
|
||||||
var randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
|
var randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
// this.purchaseOrderNumber = timestamp+randomFourDigitNumber.toString();
|
// this.purchaseOrderNumber = timestamp+randomFourDigitNumber.toString();
|
||||||
this.purchaseForm.purchaseNo = timestamp+randomFourDigitNumber.toString();
|
this.inventoryNo.inventoryNo = timestamp+randomFourDigitNumber.toString();
|
||||||
},
|
|
||||||
// 总数计算
|
|
||||||
sumMethod(data) {
|
|
||||||
this.purchasedTonnage= new BigNumber(0),
|
|
||||||
this.purchaseLiters= new BigNumber(0),
|
|
||||||
this.totalAmountPurchased= new BigNumber(0),
|
|
||||||
data.forEach(da => {
|
|
||||||
this.purchasedTonnage = this.purchasedTonnage.plus(da.purchaseWeight);
|
|
||||||
this.purchaseLiters = this.purchaseLiters.plus(da.purchaseVolume);
|
|
||||||
this.totalAmountPurchased = this.totalAmountPurchased.plus(da.totalAmount);
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 保存订单信息
|
// 保存订单信息
|
||||||
savePurchase(){
|
saveInventory(){
|
||||||
let from = {
|
let this_ = this
|
||||||
purchaseNo : this.purchaseForm.purchaseNo,
|
let inventoryForm = {
|
||||||
purchaseDate : this.purchaseForm.purchaseDate,
|
inventoryNumber : this_.inventoryNo.inventoryNo,
|
||||||
theDocumentAmount : this.totalAmountPurchased,
|
inventoryTime : this_.inventoryNo.inventoryDate,
|
||||||
|
inventoryVolume : this_.inventoryVolume,
|
||||||
|
stockDifference : this_.stockDifference,
|
||||||
|
profitLossAmount : this_.profitLossAmount
|
||||||
}
|
}
|
||||||
if (this.queryParams.purchaseId < 0) {
|
// 处理列表
|
||||||
insertPurchaseApi(from).then(response => {
|
let disList = {
|
||||||
console.log("response",response)
|
oilInventoryOrderList: this_.orderList,
|
||||||
this.$modal.msgSuccess("添加成功");
|
}
|
||||||
// 修改进货单的父id
|
// 判断是保存还是修改
|
||||||
let oilPurchase = {
|
if (this_.inventoryId != null) {
|
||||||
purchaseId:response.data.id,
|
// 修改
|
||||||
id:this.queryParams.purchaseId
|
inventoryForm.id = this_.inventoryId
|
||||||
}
|
updateInventoryApi(inventoryForm).then(response=>{
|
||||||
console.log("oilPurchase",oilPurchase)
|
// 处理列表
|
||||||
//todo 优化 将这些代码加到后台中完成并进行事务管理
|
disList.inventoryId= this_.inventoryId
|
||||||
editPurchuseApi(oilPurchase).then(response => {
|
disposeBatchApi(disList).then(response=> {
|
||||||
this.$router.push({ path: '/oilPurchase/purchaseOrder', query: { purchaseId: oilPurchase.purchaseId } });
|
// 保存成功
|
||||||
|
this.$modal.msgSuccess("保存成功");
|
||||||
|
|
||||||
})
|
})
|
||||||
// this.getList();
|
})
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
from.id = this.queryParams.purchaseId
|
// 新增
|
||||||
updatePurchaseApi(from).then(response => {
|
insertInventoryApi(inventoryForm).then(response=>{
|
||||||
this.$modal.msgSuccess("添加成功");
|
disList.inventoryId= response.data.id
|
||||||
|
disposeBatchApi(disList).then(response=> {
|
||||||
|
// 保存成功
|
||||||
|
this.$modal.msgSuccess("保存成功");
|
||||||
|
})
|
||||||
|
// 新增列表之后重新刷新
|
||||||
|
this.$router.push({ path: '/oilInventory/order', query: { inventoryId: response.data.id } });
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 判断是否可以保存
|
// 判断是否可以保存
|
||||||
saveJudgment(){
|
saveJudgment(){
|
||||||
if (this.purchaseForm.purchaseNo != null && this.purchaseForm.purchaseDate != null && this.orderList.length > 0) {
|
if (this.inventoryNo.inventoryNo != null && this.inventoryNo.inventoryDate != null && this.orderList.length > 0) {
|
||||||
this.saveFlag = false;
|
this.saveFlag = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 保存并审核
|
// 保存并审核
|
||||||
// savePurchase(){
|
// saveInventory(){
|
||||||
//
|
//
|
||||||
// },
|
// },
|
||||||
// // 作废
|
// // 作废
|
||||||
// savePurchase(){
|
// saveInventory(){
|
||||||
//
|
//
|
||||||
// },
|
// },
|
||||||
// 作废
|
// 作废
|
||||||
@ -567,6 +646,11 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
|
.app-container{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #f6f8f9;
|
||||||
|
}
|
||||||
.box {
|
.box {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package com.fuint.business.petrolStationManagement.controller;
|
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.fuint.business.petrolStationManagement.entity.OilInventory;
|
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
|
||||||
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
|
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -40,11 +39,21 @@ public class OilInventoryController extends BaseController {
|
|||||||
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
@Param("oilInventory") OilInventory oilInventory) {
|
@Param("oilInventory") OilInventory oilInventory) {
|
||||||
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
|
Page page =new Page(pageNo,pageSize);
|
||||||
IPage<OilInventory> oilInventoryIPage = this.oilInventoryService.queryByPage(page, oilInventory);
|
IPage<OilInventory> oilInventoryIPage = this.oilInventoryService.queryByPage(page, oilInventory);
|
||||||
return getSuccessResult(oilInventoryIPage);
|
return getSuccessResult(oilInventoryIPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("getListPage")
|
||||||
|
public ResponseObject getListPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
||||||
|
@Param("oilInventory") OilInventory oilInventory) {
|
||||||
|
Page page =new Page(pageNo,pageSize);
|
||||||
|
IPage<OilInventoryVO> oilInventoryIPage = this.oilInventoryService.getListPage(page, oilInventory);
|
||||||
|
return getSuccessResult(oilInventoryIPage);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
|
@ -7,6 +7,7 @@ import com.fuint.business.petrolStationManagement.service.OilInventoryOrderServi
|
|||||||
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
||||||
import com.fuint.framework.web.BaseController;
|
import com.fuint.framework.web.BaseController;
|
||||||
import com.fuint.framework.web.ResponseObject;
|
import com.fuint.framework.web.ResponseObject;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -46,7 +47,7 @@ public class OilInventoryOrderController extends BaseController {
|
|||||||
|
|
||||||
@GetMapping("getListPage")
|
@GetMapping("getListPage")
|
||||||
public ResponseObject getListPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
public ResponseObject getListPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
|
||||||
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
|
@RequestParam(value = "pageSize",defaultValue = "100000") Integer pageSize,
|
||||||
@Param("oilInventory") OilInventoryOrder oilInventory) {
|
@Param("oilInventory") OilInventoryOrder oilInventory) {
|
||||||
Page page =new Page(pageNo,pageSize);
|
Page page =new Page(pageNo,pageSize);
|
||||||
IPage<OilInventoryOrderVO> oilInventoryIPage = this.oilInventoryOrderService.getListPage(page, oilInventory);
|
IPage<OilInventoryOrderVO> oilInventoryIPage = this.oilInventoryOrderService.getListPage(page, oilInventory);
|
||||||
@ -77,6 +78,16 @@ public class OilInventoryOrderController extends BaseController {
|
|||||||
return getSuccessResult(this.oilInventoryOrderService.insert(oilInventoryOrder));
|
return getSuccessResult(this.oilInventoryOrderService.insert(oilInventoryOrder));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量处理数据
|
||||||
|
* @param oilInventoryOrderList
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("disposeBatch")
|
||||||
|
public ResponseObject disposeBatch(@RequestBody @Param("oilInventoryOrderList") List<OilInventoryOrder> oilInventoryOrderList,@Param("inventoryId") Integer inventoryId) {
|
||||||
|
return getSuccessResult(this.oilInventoryOrderService.disposeBatch(oilInventoryOrderList,inventoryId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增数据
|
* 批量新增数据
|
||||||
* @param oilInventoryOrder
|
* @param oilInventoryOrder
|
||||||
|
@ -42,11 +42,11 @@ public class OilInventory extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 盘点人
|
* 盘点人
|
||||||
*/
|
*/
|
||||||
private String inventoryPerson;
|
private String creator;
|
||||||
/**
|
/**
|
||||||
* 审核人
|
* 审核人
|
||||||
*/
|
*/
|
||||||
private String auditPerson;
|
private String reviewer;
|
||||||
/**
|
/**
|
||||||
* 制单时间
|
* 制单时间
|
||||||
*/
|
*/
|
||||||
|
@ -44,9 +44,9 @@ public class OilInventoryOrder extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Double inventoryVolume;
|
private Double inventoryVolume;
|
||||||
/**
|
/**
|
||||||
* 库存差异升数(L)
|
* 库存差异升数
|
||||||
*/
|
*/
|
||||||
private Double stockDifferenceVolume;
|
private Double stockDifference;
|
||||||
/**
|
/**
|
||||||
* 盈亏金额
|
* 盈亏金额
|
||||||
*/
|
*/
|
||||||
@ -56,5 +56,10 @@ public class OilInventoryOrder extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer storeId;
|
private Integer storeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 制单时间
|
||||||
|
*/
|
||||||
|
private Data inventoryTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ 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.entity.OilInventory;
|
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -33,6 +34,8 @@ public interface OilInventoryMapper {
|
|||||||
*/
|
*/
|
||||||
IPage<OilInventory> queryAllByLimit(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
|
IPage<OilInventory> queryAllByLimit(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
|
||||||
|
|
||||||
|
IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总行数
|
* 统计总行数
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,9 @@ package com.fuint.business.petrolStationManagement.mapper;
|
|||||||
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.entity.OilInventoryOrder;
|
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
|
||||||
|
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||||
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,6 +38,8 @@ public interface OilInventoryOrderMapper {
|
|||||||
|
|
||||||
IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder);
|
IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder);
|
||||||
|
|
||||||
|
List<OilInventoryOrderVO> getAllList(OilInventoryOrder oilInventoryOrder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计总行数
|
* 统计总行数
|
||||||
*
|
*
|
||||||
|
@ -4,6 +4,7 @@ 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.entity.OilPurchaseOrder;
|
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||||
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
|
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -92,5 +93,11 @@ public interface OilPurchaseOrderMapper {
|
|||||||
*/
|
*/
|
||||||
int deleteById(Integer id);
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据油罐查找对应的所有的订单(已完成)
|
||||||
|
*/
|
||||||
|
List<OilPurchaseOrder> getlistByTankId(Integer tankId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
|
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
|
||||||
<result property="stockDifference" column="stock_difference" jdbcType="NUMERIC"/>
|
<result property="stockDifference" column="stock_difference" jdbcType="NUMERIC"/>
|
||||||
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
|
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
|
||||||
<result property="inventoryPerson" column="inventory_person" jdbcType="VARCHAR"/>
|
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||||
<result property="auditPerson" column="audit_person" jdbcType="VARCHAR"/>
|
<result property="reviewer" column="reviewer" jdbcType="VARCHAR"/>
|
||||||
<result property="orderTime" column="order_time" jdbcType="TIMESTAMP"/>
|
<result property="orderTime" column="order_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="status" column="status" jdbcType="INTEGER"/>
|
<result property="status" column="status" jdbcType="INTEGER"/>
|
||||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<!--查询单个-->
|
<!--查询单个-->
|
||||||
<select id="queryById" resultMap="OilInventoryMap">
|
<select id="queryById" resultMap="OilInventoryMap">
|
||||||
select
|
select
|
||||||
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by
|
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by
|
||||||
from oil_inventory
|
from oil_inventory
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
<!--查询指定行数据-->
|
<!--查询指定行数据-->
|
||||||
<select id="queryAllByLimit" resultMap="OilInventoryMap">
|
<select id="queryAllByLimit" resultMap="OilInventoryMap">
|
||||||
select
|
select
|
||||||
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by
|
id, inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by
|
||||||
from oil_inventory
|
from oil_inventory
|
||||||
<where>
|
<where>
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
@ -52,11 +52,11 @@
|
|||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
and profit_loss_amount = #{profitLossAmount}
|
and profit_loss_amount = #{profitLossAmount}
|
||||||
</if>
|
</if>
|
||||||
<if test="inventoryPerson != null and inventoryPerson != ''">
|
<if test="creator != null and creator != ''">
|
||||||
and inventory_person = #{inventoryPerson}
|
and creator = #{creator}
|
||||||
</if>
|
</if>
|
||||||
<if test="auditPerson != null and auditPerson != ''">
|
<if test="reviewer != null and reviewer != ''">
|
||||||
and audit_person = #{auditPerson}
|
and reviewer = #{reviewer}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderTime != null">
|
<if test="orderTime != null">
|
||||||
and order_time = #{orderTime}
|
and order_time = #{orderTime}
|
||||||
@ -105,11 +105,11 @@
|
|||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
and profit_loss_amount = #{profitLossAmount}
|
and profit_loss_amount = #{profitLossAmount}
|
||||||
</if>
|
</if>
|
||||||
<if test="inventoryPerson != null and inventoryPerson != ''">
|
<if test="creator != null and creator != ''">
|
||||||
and inventory_person = #{inventoryPerson}
|
and creator = #{creator}
|
||||||
</if>
|
</if>
|
||||||
<if test="auditPerson != null and auditPerson != ''">
|
<if test="reviewer != null and reviewer != ''">
|
||||||
and audit_person = #{auditPerson}
|
and reviewer = #{reviewer}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderTime != null">
|
<if test="orderTime != null">
|
||||||
and order_time = #{orderTime}
|
and order_time = #{orderTime}
|
||||||
@ -134,26 +134,49 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getListPage" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryVO">
|
||||||
|
SELECT
|
||||||
|
op.id id,
|
||||||
|
op.STATUS STATUS,
|
||||||
|
op.inventory_number inventoryNumber,
|
||||||
|
op.inventory_time inventoryTime,
|
||||||
|
op.inventory_volume inventoryVolume,
|
||||||
|
op.stock_difference stockDifference,
|
||||||
|
op.profit_loss_amount profitLossAmount,
|
||||||
|
op.reviewer reviewer,
|
||||||
|
op.creator creator,
|
||||||
|
ms1.real_name creatorName,
|
||||||
|
ms2.real_name reviewerName
|
||||||
|
FROM
|
||||||
|
oil_inventory op
|
||||||
|
LEFT JOIN oil_inventory_order opo ON op.id = opo.inventory_id
|
||||||
|
LEFT JOIN oil_tank ot ON ot.id = opo.tank_id
|
||||||
|
LEFT JOIN mt_staff ms1 ON op.creator = ms1.id
|
||||||
|
LEFT JOIN mt_staff ms2 ON op.reviewer = ms2.id
|
||||||
|
GROUP BY
|
||||||
|
op.id
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--新增所有列-->
|
<!--新增所有列-->
|
||||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
||||||
values (#{inventoryNumber}, #{inventoryTime}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{inventoryPerson}, #{auditPerson}, #{orderTime}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
values (#{inventoryNumber}, #{inventoryTime}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{creator}, #{reviewer}, #{orderTime}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.inventoryPerson}, #{entity.auditPerson}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.creator}, #{entity.reviewer}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, inventory_person, audit_person, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory(inventory_number, inventory_time, inventory_volume, stock_difference, profit_loss_amount, creator, reviewer, order_time, status, store_id, create_time, update_time, create_by, update_by)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.inventoryPerson}, #{entity.auditPerson}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
(#{entity.inventoryNumber}, #{entity.inventoryTime}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.creator}, #{entity.reviewer}, #{entity.orderTime}, #{entity.status}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
inventory_number = values(inventory_number),
|
inventory_number = values(inventory_number),
|
||||||
@ -161,8 +184,8 @@
|
|||||||
inventory_volume = values(inventory_volume),
|
inventory_volume = values(inventory_volume),
|
||||||
stock_difference = values(stock_difference),
|
stock_difference = values(stock_difference),
|
||||||
profit_loss_amount = values(profit_loss_amount),
|
profit_loss_amount = values(profit_loss_amount),
|
||||||
inventory_person = values(inventory_person),
|
creator = values(creator),
|
||||||
audit_person = values(audit_person),
|
reviewer = values(reviewer),
|
||||||
order_time = values(order_time),
|
order_time = values(order_time),
|
||||||
status = values(status),
|
status = values(status),
|
||||||
store_id = values(store_id),
|
store_id = values(store_id),
|
||||||
@ -191,11 +214,11 @@
|
|||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
profit_loss_amount = #{profitLossAmount},
|
profit_loss_amount = #{profitLossAmount},
|
||||||
</if>
|
</if>
|
||||||
<if test="inventoryPerson != null and inventoryPerson != ''">
|
<if test="creator != null and creator != ''">
|
||||||
inventory_person = #{inventoryPerson},
|
creator = #{creator},
|
||||||
</if>
|
</if>
|
||||||
<if test="auditPerson != null and auditPerson != ''">
|
<if test="reviewer != null and reviewer != ''">
|
||||||
audit_person = #{auditPerson},
|
reviewer = #{reviewer},
|
||||||
</if>
|
</if>
|
||||||
<if test="orderTime != null">
|
<if test="orderTime != null">
|
||||||
order_time = #{orderTime},
|
order_time = #{orderTime},
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<result property="currentAveragePrice" column="current_average_price" jdbcType="NUMERIC"/>
|
<result property="currentAveragePrice" column="current_average_price" jdbcType="NUMERIC"/>
|
||||||
<result property="currentInventoryVolume" column="current_inventory_volume" jdbcType="NUMERIC"/>
|
<result property="currentInventoryVolume" column="current_inventory_volume" jdbcType="NUMERIC"/>
|
||||||
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
|
<result property="inventoryVolume" column="inventory_volume" jdbcType="NUMERIC"/>
|
||||||
<result property="stockDifferenceVolume" column="stock_difference_volume" jdbcType="NUMERIC"/>
|
<result property="stockDifference" column="stock_difference" jdbcType="NUMERIC"/>
|
||||||
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
|
<result property="profitLossAmount" column="profit_loss_amount" jdbcType="NUMERIC"/>
|
||||||
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
<!--查询单个-->
|
<!--查询单个-->
|
||||||
<select id="queryById" resultMap="OilInventoryOrderMap">
|
<select id="queryById" resultMap="OilInventoryOrderMap">
|
||||||
select
|
select
|
||||||
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
|
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
|
||||||
from oil_inventory_order
|
from oil_inventory_order
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
@ -30,7 +30,7 @@
|
|||||||
<!--查询指定行数据-->
|
<!--查询指定行数据-->
|
||||||
<select id="queryAllByLimit" resultMap="OilInventoryOrderMap">
|
<select id="queryAllByLimit" resultMap="OilInventoryOrderMap">
|
||||||
select
|
select
|
||||||
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
|
id, inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by
|
||||||
from oil_inventory_order
|
from oil_inventory_order
|
||||||
<where>
|
<where>
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
@ -54,8 +54,8 @@
|
|||||||
<if test="inventoryVolume != null">
|
<if test="inventoryVolume != null">
|
||||||
and inventory_volume = #{inventoryVolume}
|
and inventory_volume = #{inventoryVolume}
|
||||||
</if>
|
</if>
|
||||||
<if test="stockDifferenceVolume != null">
|
<if test="stockDifference != null">
|
||||||
and stock_difference_volume = #{stockDifferenceVolume}
|
and stock_difference = #{stockDifference}
|
||||||
</if>
|
</if>
|
||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
and profit_loss_amount = #{profitLossAmount}
|
and profit_loss_amount = #{profitLossAmount}
|
||||||
@ -104,8 +104,8 @@
|
|||||||
<if test="inventoryVolume != null">
|
<if test="inventoryVolume != null">
|
||||||
and inventory_volume = #{inventoryVolume}
|
and inventory_volume = #{inventoryVolume}
|
||||||
</if>
|
</if>
|
||||||
<if test="stockDifferenceVolume != null">
|
<if test="stockDifference != null">
|
||||||
and stock_difference_volume = #{stockDifferenceVolume}
|
and stock_difference = #{stockDifference}
|
||||||
</if>
|
</if>
|
||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
and profit_loss_amount = #{profitLossAmount}
|
and profit_loss_amount = #{profitLossAmount}
|
||||||
@ -129,12 +129,14 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getListPage" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
|
<select id="getListPage" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
oi.id id,
|
||||||
ot.tank_name tankName,
|
ot.tank_name tankName,
|
||||||
|
ot.id tankId,
|
||||||
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
|
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
|
||||||
current_average_price currentAveragePrice,
|
current_average_price currentAveragePrice,
|
||||||
ot.stored_quantity currentInventoryVolume,
|
ot.stored_quantity currentInventoryVolume,
|
||||||
oi.inventory_volume inventoryVolume,
|
oi.inventory_volume inventoryVolume,
|
||||||
oi.stock_difference_volume stockDifferenceVolume,
|
oi.stock_difference stockDifference,
|
||||||
oi.profit_loss_amount profitLossAmount
|
oi.profit_loss_amount profitLossAmount
|
||||||
FROM
|
FROM
|
||||||
oil_inventory_order oi
|
oil_inventory_order oi
|
||||||
@ -143,25 +145,38 @@
|
|||||||
LEFT JOIN oil_name onn ON n.oil_name = onn.id
|
LEFT JOIN oil_name onn ON n.oil_name = onn.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getAllList" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
|
||||||
|
SELECT
|
||||||
|
opo.id id,
|
||||||
|
opo.inventory_id inventoryId,
|
||||||
|
ot.tank_name tankName
|
||||||
|
FROM
|
||||||
|
oil_inventory_order opo
|
||||||
|
LEFT JOIN oil_inventory op ON opo.inventory_id = op.id
|
||||||
|
LEFT JOIN oil_tank ot ON ot.id = opo.tank_id
|
||||||
|
where opo.store_id = #{storeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<!--新增所有列-->
|
<!--新增所有列-->
|
||||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
||||||
values (#{inventoryId}, #{numberId}, #{tankId}, #{currentAveragePrice}, #{currentInventoryVolume}, #{inventoryVolume}, #{stockDifferenceVolume}, #{profitLossAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
values (#{inventoryId}, #{numberId}, #{tankId}, #{currentAveragePrice}, #{currentInventoryVolume}, #{inventoryVolume}, #{stockDifference}, #{profitLossAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifferenceVolume}, #{entity.profitLossAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
|
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.storeId}, NOW(), NOW(), #{entity.createBy}, #{entity.updateBy})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||||
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference_volume, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifferenceVolume}, #{entity.profitLossAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
(#{entity.inventoryId}, #{entity.numberId}, #{entity.tankId}, #{entity.currentAveragePrice}, #{entity.currentInventoryVolume}, #{entity.inventoryVolume}, #{entity.stockDifference}, #{entity.profitLossAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
inventory_id = values(inventory_id),
|
inventory_id = values(inventory_id),
|
||||||
@ -170,7 +185,7 @@
|
|||||||
current_average_price = values(current_average_price),
|
current_average_price = values(current_average_price),
|
||||||
current_inventory_volume = values(current_inventory_volume),
|
current_inventory_volume = values(current_inventory_volume),
|
||||||
inventory_volume = values(inventory_volume),
|
inventory_volume = values(inventory_volume),
|
||||||
stock_difference_volume = values(stock_difference_volume),
|
stock_difference = values(stock_difference),
|
||||||
profit_loss_amount = values(profit_loss_amount),
|
profit_loss_amount = values(profit_loss_amount),
|
||||||
store_id = values(store_id),
|
store_id = values(store_id),
|
||||||
create_time = values(create_time),
|
create_time = values(create_time),
|
||||||
@ -201,8 +216,8 @@
|
|||||||
<if test="inventoryVolume != null">
|
<if test="inventoryVolume != null">
|
||||||
inventory_volume = #{inventoryVolume},
|
inventory_volume = #{inventoryVolume},
|
||||||
</if>
|
</if>
|
||||||
<if test="stockDifferenceVolume != null">
|
<if test="stockDifference != null">
|
||||||
stock_difference_volume = #{stockDifferenceVolume},
|
stock_difference = #{stockDifference},
|
||||||
</if>
|
</if>
|
||||||
<if test="profitLossAmount != null">
|
<if test="profitLossAmount != null">
|
||||||
profit_loss_amount = #{profitLossAmount},
|
profit_loss_amount = #{profitLossAmount},
|
||||||
|
@ -235,5 +235,18 @@
|
|||||||
delete from oil_purchase_order where id = #{id}
|
delete from oil_purchase_order where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getlistByTankId"
|
||||||
|
resultType="com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder">
|
||||||
|
SELECT
|
||||||
|
po.total_amount totalAmount,
|
||||||
|
po.purchase_volume purchaseVolume
|
||||||
|
FROM
|
||||||
|
oil_purchase_order po
|
||||||
|
LEFT JOIN oil_purchase p ON po.purchase_id = p.id
|
||||||
|
WHERE
|
||||||
|
p.STATUS = 'qrts'
|
||||||
|
AND po.tank_id = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
@ -51,13 +51,20 @@ public interface OilInventoryOrderService {
|
|||||||
*/
|
*/
|
||||||
int insertBatch(List<OilInventoryOrder> oilInventoryOrder);
|
int insertBatch(List<OilInventoryOrder> oilInventoryOrder);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量处理数据
|
||||||
|
* @param oilInventoryOrder
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int disposeBatch(List<OilInventoryOrder> oilInventoryOrder, Integer inventoryId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改数据
|
/**
|
||||||
*
|
* 修改数据
|
||||||
* @param oilInventoryOrder 实例对象
|
*
|
||||||
* @return 实例对象
|
* @param oilInventoryOrder 实例对象
|
||||||
*/
|
* @return 实例对象
|
||||||
|
*/
|
||||||
OilInventoryOrder update(OilInventoryOrder oilInventoryOrder);
|
OilInventoryOrder update(OilInventoryOrder oilInventoryOrder);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package com.fuint.business.petrolStationManagement.service;
|
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.fuint.business.petrolStationManagement.entity.OilInventory;
|
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (OilInventory)表服务接口
|
* (OilInventory)表服务接口
|
||||||
@ -30,7 +30,9 @@ public interface OilInventoryService {
|
|||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
IPage<OilInventory> queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("oilInventory") OilInventory oilInventory);
|
IPage<OilInventory> queryByPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
|
||||||
|
|
||||||
|
IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
|
@ -3,13 +3,17 @@ package com.fuint.business.petrolStationManagement.service.impl;
|
|||||||
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.entity.OilInventoryOrder;
|
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
|
||||||
|
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||||
import com.fuint.business.petrolStationManagement.mapper.OilInventoryOrderMapper;
|
import com.fuint.business.petrolStationManagement.mapper.OilInventoryOrderMapper;
|
||||||
|
import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper;
|
||||||
import com.fuint.business.petrolStationManagement.service.OilInventoryOrderService;
|
import com.fuint.business.petrolStationManagement.service.OilInventoryOrderService;
|
||||||
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,7 +26,8 @@ import java.util.List;
|
|||||||
public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
|
public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
|
||||||
@Resource
|
@Resource
|
||||||
private OilInventoryOrderMapper oilInventoryOrderDao;
|
private OilInventoryOrderMapper oilInventoryOrderDao;
|
||||||
|
@Resource
|
||||||
|
private OilPurchaseOrderMapper oilPurchaseOrderMapper;
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
@ -48,7 +53,19 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder) {
|
public IPage<OilInventoryOrderVO> getListPage(@Param("page") Page page, @Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder) {
|
||||||
return oilInventoryOrderDao.getListPage(page, oilInventoryOrder);
|
OilInventoryOrderMapper oilInventoryOrderDao = this.oilInventoryOrderDao;
|
||||||
|
|
||||||
|
IPage<OilInventoryOrderVO> listPage = oilInventoryOrderDao.getListPage(page, oilInventoryOrder);
|
||||||
|
// 获取所有油罐的当前均进价
|
||||||
|
for (OilInventoryOrderVO record : listPage.getRecords()) {
|
||||||
|
try {
|
||||||
|
Double aDouble = calculateTheAveragePrice(record.getTankId());
|
||||||
|
record.setCurrentAveragePrice(aDouble);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return listPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,6 +80,31 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
|
|||||||
return oilInventoryOrder;
|
return oilInventoryOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 计算当前均进价
|
||||||
|
public Double calculateTheAveragePrice(Integer tankId) {
|
||||||
|
BigDecimal bigSunPrice = new BigDecimal(0);
|
||||||
|
BigDecimal bigSumL = new BigDecimal(0);
|
||||||
|
|
||||||
|
// 根据油罐id查询到所有的订单
|
||||||
|
List<OilPurchaseOrder> oilPurchaseOrders = oilPurchaseOrderMapper.getlistByTankId(tankId);
|
||||||
|
// 计算每个订单的平均进价并进行相加
|
||||||
|
for (OilPurchaseOrder oilPurchaseOrder : oilPurchaseOrders) {
|
||||||
|
bigSunPrice.add( new BigDecimal(oilPurchaseOrder.getTotalAmount()));
|
||||||
|
bigSumL.add( new BigDecimal(oilPurchaseOrder.getPurchaseVolume()));
|
||||||
|
}
|
||||||
|
// 用总的钱数/总的量
|
||||||
|
BigDecimal result = new BigDecimal(0);
|
||||||
|
try{
|
||||||
|
result = bigSunPrice.divide(bigSumL, 2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
}catch (Exception e) {
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
|
return Double.parseDouble(result.toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增
|
* 批量新增
|
||||||
* @param oilInventoryOrder
|
* @param oilInventoryOrder
|
||||||
@ -74,6 +116,19 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int disposeBatch(List<OilInventoryOrder> oilInventoryOrder, Integer inventoryId) {
|
||||||
|
// List<OilInventoryOrder> insInventory = new ArrayList<>();
|
||||||
|
// List<OilInventoryOrder> updateInventory = new ArrayList<>();
|
||||||
|
if (oilInventoryOrder.size()>0) {
|
||||||
|
oilInventoryOrder.stream().forEach(o -> o.setInventoryId(inventoryId));
|
||||||
|
oilInventoryOrderDao.insertOrUpdateBatch(oilInventoryOrder);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据
|
* 修改数据
|
||||||
*
|
*
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
package com.fuint.business.petrolStationManagement.service.impl;
|
package com.fuint.business.petrolStationManagement.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
import com.fuint.business.petrolStationManagement.entity.OilInventory;
|
||||||
import com.fuint.business.petrolStationManagement.entity.OilTank;
|
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
|
||||||
|
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
|
||||||
import com.fuint.business.petrolStationManagement.mapper.OilInventoryMapper;
|
import com.fuint.business.petrolStationManagement.mapper.OilInventoryMapper;
|
||||||
|
import com.fuint.business.petrolStationManagement.mapper.OilInventoryOrderMapper;
|
||||||
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
|
import com.fuint.business.petrolStationManagement.service.OilInventoryService;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilInventoryVO;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
|
||||||
|
import com.fuint.business.petrolStationManagement.vo.OilPurchaseVO;
|
||||||
|
import com.fuint.common.dto.AccountInfo;
|
||||||
|
import com.fuint.common.util.StringUtils;
|
||||||
|
import com.fuint.common.util.TokenUtil;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.PageImpl;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (OilInventory)表服务实现类
|
* (OilInventory)表服务实现类
|
||||||
@ -24,6 +32,9 @@ public class OilInventoryServiceImpl implements OilInventoryService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OilInventoryMapper oilInventoryDao;
|
private OilInventoryMapper oilInventoryDao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OilInventoryOrderMapper oilInventoryOrderMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询单条数据
|
* 通过ID查询单条数据
|
||||||
*
|
*
|
||||||
@ -43,10 +54,46 @@ public class OilInventoryServiceImpl implements OilInventoryService {
|
|||||||
* @return 查询结果
|
* @return 查询结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<OilInventory> queryByPage(@Param("page") com.baomidou.mybatisplus.extension.plugins.pagination.Page page, @Param("oilInventory") OilInventory oilInventory) {
|
public IPage<OilInventory> queryByPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory) {
|
||||||
return oilInventoryDao.queryAllByLimit(page, oilInventory);
|
return oilInventoryDao.queryAllByLimit(page, oilInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<OilInventoryVO> getListPage(@Param("page") Page page, @Param("oilInventory") OilInventory oilInventory) {
|
||||||
|
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||||
|
oilInventory.setStoreId(nowAccountInfo.getStoreId());
|
||||||
|
|
||||||
|
IPage<OilInventoryVO> listPage = oilInventoryDao.getListPage(page, oilInventory);
|
||||||
|
|
||||||
|
// 查出所有的油罐
|
||||||
|
OilInventoryOrder oilInventoryOrder = new OilInventoryOrder();
|
||||||
|
oilInventoryOrder.setStoreId(nowAccountInfo.getStoreId());
|
||||||
|
List<OilInventoryOrderVO> allList = oilInventoryOrderMapper.getAllList(oilInventoryOrder);
|
||||||
|
|
||||||
|
// 组合数据
|
||||||
|
for (OilInventoryVO record : listPage.getRecords()) {
|
||||||
|
for (OilInventoryOrderVO oilInventoryOrderVO : allList) {
|
||||||
|
if (record.getId().equals(oilInventoryOrderVO.getInventoryId())) {
|
||||||
|
record.setTanks(appendString(record.getTanks(),oilInventoryOrderVO.getTankName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return listPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String appendString(String res,String com){
|
||||||
|
if (StringUtils.isEmpty(res)) {
|
||||||
|
return com;
|
||||||
|
}else {
|
||||||
|
if (res.contains(com)) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
stringBuilder.append(res).append("/").append(com);
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
*
|
*
|
||||||
|
@ -6,5 +6,6 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class OilInventoryOrderVO extends OilInventoryOrder {
|
public class OilInventoryOrderVO extends OilInventoryOrder {
|
||||||
private String tankName;
|
private String tankName;
|
||||||
|
private Integer tankId;
|
||||||
private String numberName;
|
private String numberName;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.fuint.business.petrolStationManagement.vo;
|
||||||
|
|
||||||
|
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OilInventoryVO extends OilInventoryOrder {
|
||||||
|
private String tankName;
|
||||||
|
private Integer tankId;
|
||||||
|
private String numberName;
|
||||||
|
private String tanks;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user