This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-25 18:19:09 +08:00
parent b0b04f4349
commit fe075eeb54
34 changed files with 1248 additions and 154 deletions

View File

@ -41,6 +41,14 @@ export function getPurchaseOrderApi(data) {
params: data
})
}
// 删除有关信息
export function delPurchaseOrderApi(data) {
return request({
url: '/business/petrolStationManagement/oilPurchaseOrder',
method: 'delete',
params: data
})
}
// 新增有关信息
export function insertPurchaseOrderApi(data) {

View File

@ -0,0 +1,10 @@
import request from "@/utils/request";
// 查询列表
export function getTrackingApi(data) {
return request({
url: '/business/petrolStationManagement/oilTracking/queryByPage',
method: 'get',
params: data
})
}

View File

@ -3,7 +3,7 @@
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="业务单号" prop="tankName">
<el-input v-model="queryParams.tankName" placeholder="请输入业务单号名称" />
<el-input v-model="queryParams.inventoryNumber" placeholder="请输入业务单号名称" />
</el-form-item>
@ -41,7 +41,7 @@
type="primary"
icon="el-icon-plus"
@click="purchaseAdd"
>添加采购</el-button>
>添加盘点</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
@ -138,8 +138,7 @@ export default {
dateRange: '',
//
queryParams: {
supplierId: '',
tankName: '',
inventoryNumber:'',
status: '',
page:null,
pageSize:null

View File

@ -55,7 +55,7 @@
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="saveInventory()">保存</el-button>
<el-button type="success" v-if="state=='await'" :disabled="auditFlag" @click="audit">保存并审核</el-button>
<el-button type="success" v-if="state=='ysh'" :disabled="auditFlag" @click="storage">盘点并处理库存</el-button>
<el-button type="warning" v-if="state!='yzf' || state!='qrts'":disabled="voidFlag" @click="abolition()">作废</el-button>
<el-button type="warning" v-if="state =='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
</div>
</div>
@ -91,12 +91,12 @@
<el-table-column label="当前库存升数(L)" align="center" prop="currentInventoryVolume"/>
<el-table-column label="盘点升数(L)" align="center" prop="inventoryVolume">
<template slot-scope="scope">
<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>
<el-input-number :disabled="numberInput" 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>
</el-table-column>
<el-table-column label="库存差异升数(L)" align="center" prop="stockDifference"/>
<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 label="盈亏金额" align="center" prop="profitLossAmount"/>
<el-table-column v-if="state =='await' || state=='ysh'"label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@ -236,6 +236,7 @@ export default {
incomingTime: '', //
state: 'await',
numberInput: false,
numberOfTanks: 0, //
@ -320,8 +321,14 @@ export default {
if ( this.state == null) {
this.state = 'await'
}
if (this.state=='await') {
this.numberInput = false
}else {
this.numberInput = true
}
this.inventoryNo.inventoryNo = this.$route.query.inventoryNo;
this.inventoryNo.inventoryDate = this.$route.query.inventoryDate;
// this.inventoryNo.inventoryDate = this.$route.query.inventoryDate;
this.queryParams.inventoryId = this.$route.query.inventoryId;
this.inventoryId = this.$route.query.inventoryId;
@ -623,8 +630,9 @@ export default {
disposeBatchApi(oilInventoryOrderList).then(response=> {
//
this.$modal.msgSuccess("保存成功");
this.getList()
// this.getList()
this.$router.push({ path: '/oilConfig/oilInventory/list', query: {
} });
})
})
} else {
@ -636,7 +644,7 @@ export default {
this_.inventoryId = response.data.id
this_.state = response.data.status
this_.inventoryNo.inventoryNo = response.data.inventoryNumber,
this_.inventoryNo.inventoryDate = response.data.inventoryTime,
// this_.inventoryNo.inventoryDate = response.data.inventoryTime,
this_.orderList.forEach(ord=>{
let now = {
@ -659,20 +667,26 @@ export default {
this.getList()
this.$router.push({ path: '/oilConfig/oilInventory/list', query: {
} });
})
//
this.$router.push({ path: '/oilInventory/order', query: {
inventoryId: this_.inventoryId,
inventoryNo: this_.inventoryNo.inventoryNo,
inventoryDate: this_.inventoryNo.inventoryDate,
state: this_.status
} });
})
// this.$router.push({ path: '/oilInventory/order', query: {
// inventoryId: this_.inventoryId,
// inventoryNo: this_.inventoryNo.inventoryNo,
// inventoryDate: this_.inventoryNo.inventoryDate,
// state: this_.status
// } });
// })
})
}
},
//
saveJudgment(){
@ -702,6 +716,14 @@ export default {
if (judgmentPermissions2 > 0){
this.storageFlag = false
}
let judgmentPermissions3 = await this.judgmentPermissions("盘点废止");
if (judgmentPermissions3 > 0){
this.voidFlag=false
}else {
this.voidFlag=true
}
},
//
@ -728,9 +750,9 @@ export default {
auditInventoryApi(fil).then(res => {
this.state = 'ysh'
this.$modal.msgWarning("审核成功");
this.goToAbout()
})
}
},
//
@ -743,34 +765,56 @@ export default {
this.$modal.msgWarning("请先选择进货时间");
return;
}
//
let fil ={
id: this.purchaseId
}
storageInventoryApi(fil).then(res => {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
})
this.$confirm('确认后盘点中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照盘点数量入库吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
let fil ={
id: this.inventoryId
}
storageInventoryApi(fil).then(res => {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
//
abolition(){
if (this.purchaseId < 0) {
if (this.inventoryId < 0) {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
}
//
let fil ={
id: this.purchaseId
}
abolitionInventoryApi(fil).then(res => {
this.state = 'yzf'
this.$modal.msgWarning("审核成功");
this.$confirm('确定要废弃盘点好的数据吗', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let fil ={
id: this.inventoryId
}
abolitionInventoryApi(fil).then(res => {
if (res.data) {
this.state = 'yzf'
this.$modal.msgWarning("作废成功");
this.goToAbout()
} else {
this.$modal.msgWarning("暂无作废权限");
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
},
}
}
</script>

View File

@ -118,7 +118,7 @@
</el-card>
<el-dialog title="添加" :visible.sync="dialogFormVisible" >
<el-dialog title="添加" :visible.sync="dialogFormVisible" :close-on-click-modal="false">
<el-form ref="oilNumberF" :model="oilNumber" :rules="rules">
<el-form-item label="油品类型" prop="oilType">
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick(oilNumber)">
@ -165,14 +165,14 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品单价" prop="oilPrice">
<el-input v-model.number="oilNumber.oilPrice" style="width: 217px">
<el-input v-model="oilNumber.oilPrice" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="国标价格" prop="gbPrice">
<el-input v-model.number="oilNumber.gbPrice" style="width: 217px">
<el-input v-model="oilNumber.gbPrice" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -208,7 +208,7 @@
</div>
</el-dialog>
<el-dialog title="修改" :visible.sync="dialogFormNumberEdit">
<el-dialog title="修改" :visible.sync="dialogFormNumberEdit" :close-on-click-modal="false">
<el-form ref="form" :model="oilNumber" :rules="rules">
<el-form-item label="油品类型" prop="oilType">
<el-radio-group v-model="oilNumber.oilType" @change="oilTypeClick(oilNumber.oilType)">
@ -254,14 +254,14 @@
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="油品单价" prop="oilPrice">
<el-input v-model.number="oilNumber.oilPrice" style="width: 217px">
<el-input v-model="oilNumber.oilPrice" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="国标价格" prop="gbPrice">
<el-input v-model.number="oilNumber.gbPrice" style="width: 217px">
<el-input v-model="oilNumber.gbPrice" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -300,7 +300,7 @@
</div>
</el-dialog>
<el-dialog title="添加预设" :visible.sync="dialogFormPricesAdd" width="450px">
<el-dialog title="添加预设" :visible.sync="dialogFormPricesAdd" width="450px" :close-on-click-modal="false">
<el-form ref="priForm" :model="oilPresetPrices" label-width="100px" :rules="oilPresetPricesRules">
<el-form-item label="预设油号" prop="numberId">
<el-select v-model="oilPresetPrices.numberId" placeholder="请选择油号" @change="oilTypeClickByPrice()">
@ -318,7 +318,7 @@
</el-input>
</el-form-item>
<el-form-item label="预设油站价" prop="presetOilPrices">
<el-input v-model.number="oilPresetPrices.presetOilPrices" style="width: 217px">
<el-input v-model="oilPresetPrices.presetOilPrices" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -328,7 +328,7 @@
</el-input>
</el-form-item>
<el-form-item label="预设国标价" prop="presetGbPrice">
<el-input v-model.number="oilPresetPrices.presetGbPrice" style="width: 217px">
<el-input v-model="oilPresetPrices.presetGbPrice" style="width: 217px">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -372,18 +372,32 @@ import {
dicts: ['jobState','oil_type','zhzt'],
data() {
var valiNumberPass = (rule, value, callback) => {//
let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
if (value === '') {
callback(new Error('请输入内容'));
} else if (!reg.test(value)) {
callback(new Error('请输入数字'));
} else {
callback();
}
};
return {
oilPresetPricesRules: {
numberId:[
{ required: true, message: '请选择油品类型', trigger: 'change' }
],
presetOilPrices: [
{required: true, message: '请输入', trigger: 'blur'},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
// {required: true, message: '', trigger: 'blur'},
// { type: 'number', message: ''}
],
presetGbPrice: [
{required: true, message: '请输入', trigger: 'blur'},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
effectiveTime:[
{ required: true, message: '请选择日期', trigger: 'change' }
@ -400,12 +414,11 @@ import {
{ required: true, message: '请选择', trigger: 'change' }
],
oilPrice: [
{required: true, message: '请输入', trigger: 'blur'},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
gbPrice: [
{required: true, message: '请输入', trigger: 'blur'},
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
receivingUnits: [
{ required: true, message: '请选择', trigger: 'change' }
@ -493,6 +506,9 @@ import {
mounted() {
},
methods:{
getStatusText(data) {
if (data == 1) {
return "停止"
@ -691,7 +707,6 @@ import {
*/
//
getOilPresetListin() {
var this_=this
getOilPresetList().then( response => {
this.oilPresetPricesList = response.data.records
@ -726,7 +741,6 @@ import {
insertOilPresePrices(){
// console.log(typeof oilPresetPrices.presetOilPrices);
console.log("typeof oilPresetPrices.presetOilPrices",this.oilPresetPrices);
this.$refs["priForm"].validate(valid => {
if (valid) {
this.dialogFormPricesAdd = false
@ -734,6 +748,7 @@ import {
var list = response.data
this.getOilNameList();
this.getAllOilList();
this.getOilPresetListin();
});
}
});

View File

@ -74,7 +74,7 @@
<el-tag v-if ="scope.row.status == 'await'" size="medium">待审核</el-tag>
<el-tag v-if ="scope.row.status == 'qrts'" type="success" size="medium">已审核入库</el-tag>
<el-tag v-if ="scope.row.status == 'yzf'" type="danger" size="medium">已作废</el-tag>
<el-tag v-if ="scope.row.status == 'ysh'" type="danger" size="medium">已审核</el-tag>
<el-tag v-if ="scope.row.status == 'ysh'" type="success" size="medium">已审核</el-tag>
</div>
</template>
</el-table-column>
@ -192,7 +192,7 @@ export default {
query: {
purchaseId: data.id,
purchaseNo: data.purchaseNo,
// purchaseDate: data.purchaseDate,
purchaseDate: data.purchaseDate,
state: data.status
}
});

View File

@ -46,7 +46,7 @@
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="savePurchase()">保存</el-button>
<el-button type="success" v-if="state=='await'" :disabled="auditFlag" @click="audit">保存并审核</el-button>
<el-button type="success" v-if="state=='ysh'" :disabled="storageFlag" @click="storage">收货并入库</el-button>
<el-button type="warning" v-if="state=='qrts'" :disabled="voidFlag" @click="abolition()">作废</el-button>
<el-button type="warning" v-if="state =='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
<!-- state=='yzf'-->
</div>
</div>
@ -76,27 +76,27 @@
<!-- <el-table-column label="入库前库存" align="center" prop="preInboundInventory"/>-->
<el-table-column label="油品密度(g/ml)" align="center" prop="productDensity">
<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 :disabled="numberInput" 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>
</template>
</el-table-column>
<el-table-column label="采购吨数(t)" align="center" prop="purchaseWeight">
<template slot-scope="scope">
<el-input-number v-model="scope.row.purchaseWeight" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
<el-input-number :disabled="numberInput" v-model="scope.row.purchaseWeight" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="采购单价(元/吨)" align="center" prop="purchasePrice">
<el-table-column :disabled="numberInput" label="采购单价(元/吨)" align="center" prop="purchasePrice">
<template slot-scope="scope">
<el-input-number v-model="scope.row.purchasePrice" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
<el-input-number :disabled="numberInput" v-model="scope.row.purchasePrice" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="小计金额(元)" align="center" prop="totalAmount">
<template slot-scope="scope">
<el-input-number v-model="scope.row.totalAmount" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
<el-input-number :disabled="numberInput" v-model="scope.row.totalAmount" @change="change(scope.row)" controls-position="right" :min="0.000001" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="采购升数L" align="center" prop="purchaseVolume"/>
<el-table-column label="折和单价(元/升)" align="center" prop="discountedPrice"/>
<el-table-column v-if="true" label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column v-if="state =='await' || state=='ysh'" label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
@ -214,7 +214,7 @@ import {
insertPurchaseApi,
insertPurchaseOrderApi,
updatePurchaseOrderApi,
updatePurchaseApi, auditApi, abolitionApi, storageApi
updatePurchaseApi, auditApi, abolitionApi, storageApi, delPurchaseOrderApi
} from "@/api/oilConfig/oilPurchase";
import {getOilNameListApi} from "@/api/oilPrice";
import {selectTankByNumberApi} from "@/api/oilConfig/oilGuns";
@ -246,7 +246,7 @@ export default {
discountedPrice: null
},
purchaseId: null,
numberInput: false,
purchaseOrderNumber: null, //
incomingTime: '', //
@ -260,7 +260,7 @@ export default {
saveFlag:false,
auditFlag:true,
voidFlag:true,
voidFlag:false,
storageFlag:true,
state:'',
@ -342,6 +342,7 @@ export default {
if (this.$route.query.purchaseId != null) {
this.queryParams.purchaseId = this.$route.query.purchaseId;
this.purchaseId = this.$route.query.purchaseId;
// this.purchaseForm.purchaseDate = this.$route.query.purchaseDate;
}else if (this.$route.query.purchaseId == null && this.purchaseId>0) {
}else {
@ -355,6 +356,11 @@ export default {
this.state = 'await'
}
if (this.state=='await') {
this.numberInput = false
}else {
this.numberInput = true
}
this.purchaseForm.purchaseNo = this.$route.query.purchaseNo;
if (this.purchaseForm.purchaseNo == null) {
@ -386,8 +392,11 @@ export default {
this.getOilNameList()
this.selectSuppliers()
},
orderDel() {
orderDel(data) {
delPurchaseOrderApi(data).then(response => {
this.$modal.msgSuccess("删除成功");
this.getList()
})
},
//
submitForm: function() {
@ -553,13 +562,19 @@ export default {
async JudgmentButton(){
let judgmentPermissions1 = await this.judgmentPermissions("进油审核");
if (judgmentPermissions1 > 0){
this.auditFlag=false,
this.voidFlag=false
this.auditFlag=false
}
let judgmentPermissions2 = await this.judgmentPermissions("进油入库");
if (judgmentPermissions2 > 0){
this.storageFlag = false
}
let judgmentPermissions3 = await this.judgmentPermissions("进油废止");
if (judgmentPermissions3 > 0){
this.voidFlag=false
}else {
this.voidFlag=true
}
},
//
@ -583,9 +598,16 @@ export default {
}
console.log(" id: this.purchaseId",fil)
auditApi(fil).then(res => {
this.state = 'ysh'
if (res.data) {
this.state = 'ysh'
this.numberInput= true
this.$modal.msgWarning("审核成功");
this.$router.push('/oilConfig/oilPurchase/list');
}else {
this.$modal.msgWarning("暂无审核权限");
}
this.$modal.msgWarning("审核成功");
})
}
@ -599,14 +621,37 @@ export default {
this.$modal.msgWarning("请先选择进货时间");
return;
}
//
let fil ={
id: this.purchaseId
}
storageApi(fil).then(res => {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
})
this.$confirm('确认后单据中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照采购单据收货并入库吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
let fil ={
id: this.purchaseId
}
storageApi(fil).then(res => {
if (res.data) {
this.state = 'qrts'
this.$modal.msgWarning("入库成功");
this.numberInput= true
this.$router.push('/oilConfig/oilPurchase/list');
} else {
this.$modal.msgWarning("暂无入库权限");
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
//
@ -615,14 +660,34 @@ export default {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
}
//
let fil ={
id: this.purchaseId
}
abolitionApi(fil).then(res => {
this.state = 'yzf'
this.$modal.msgWarning("审核成功");
this.$confirm('确认废弃订单吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
//
let fil ={
id: this.purchaseId
}
abolitionApi(fil).then(res => {
if (res.data) {
this.state = 'yzf'
this.$modal.msgWarning("审核废弃");
this.numberInput= true
this.$router.push('/oilConfig/oilPurchase/list');
}else {
this.$modal.msgWarning("暂无废弃权限");
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
})
},

View File

@ -0,0 +1,307 @@
<template>
<div class="app-container">
<!-- 搜索框-->
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
<el-form-item label="油品" prop="oilNumber">
<el-select v-model="queryParams.numberId" placeholder="请选择油品" style="width:100%" @change="chooseOilNumber()">
<el-option
v-for="option in selectOilTypeByPrice"
:key="option.numberId"
:label="option.oilType +' '+option.oilName"
:value="option.numberId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="油罐名称" prop="tankName">
<el-input
v-model="queryParams.tankName"
placeholder="请输入姓名"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" v-model="queryParams.status" prop="status">
<el-select v-model="queryParams.status" placeholder="" style="width:100%">
<el-option label="全部" value=""></el-option>
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.label"
:label="dict.label"
:value="dict.label"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<!-- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>-->
</el-form-item>
</el-form>
</el-card>
<!-- 列表-->
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<h3>油罐列表</h3>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">123123123</right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="statisticsList"
:default-sort="defaultSort">
<el-table-column label="油罐名称" align="center" prop="tankName"/>
<el-table-column label="油品名称" align="center" prop="oilNumber" />
<el-table-column label="油罐容量" align="center" prop="tankVolume" />
<el-table-column label="油品密度(g/ml)" align="center" prop="oilDensity" />
<el-table-column label="当前剩余升数" align="center" prop="storedQuantity" />
<el-table-column label="当前成本价" align="center" prop="discountedPrice" />
<el-table-column label="成本金额" align="center" prop="totalPrice" />
<el-table-column label="状态" align="center" prop="inventoryStatistics">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag v-if ="scope.row.inventoryStatistics == '启用'" size="success">启用</el-tag>
<el-tag v-if ="scope.row.inventoryStatistics == '禁止'" type="danger" size="medium">禁止</el-tag>
</div>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="trace(scope.row)"
>库存跟踪</el-button>
<!-- v-hasPermi="['']"-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<el-drawer
title="库存跟踪"
:visible.sync="drawer"
direction="rtl"
size="50%"
:before-close="handleClose">
<div style="display: grid; place-items: center;">
<el-card class="box-card" style="background-color: #f5f5f5">
<div slot="header" class="clearfix">
<div style="position: relative;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);">
<h2>{{statisticsForm.tankName}}</h2>
</div>
</div>
<br>
<div style="display: flex; justify-content: space-between;">
<span>油品名称</span>
<span>{{ statisticsForm.oilNumber }}</span>
</div>
</div>
<div >
<div style="margin-top:-5px;display: flex; justify-content: space-between;">
<h3>库存数量</h3>
<h3>{{statisticsForm.storedQuantity}}{{statisticsForm.unit}}</h3>
</div>
<div style="display: flex; justify-content: space-between;">
<span>更新时间</span>
<span>{{ statisticsForm.updateTime }}</span>
</div>
</div>
</el-card>
<el-card class="box-card" style="margin-top: 15px">
<el-table ref="tables"
v-loading="loading"
:data="trackList"
:default-sort="defaultSort">
<el-table-column
lable="#"
type="index"
>
</el-table-column>
<el-table-column label="库存更新时间" align="center" prop="updateTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="单据" align="center" prop="document" />
<el-table-column label="单号" align="center" prop="orderNumber" />
<el-table-column label="变动数量" align="center" prop="quantityChange" />
</el-table>
<pagination
v-show="total2>0"
:total="total2"
:page.sync="queryParams2.page"
:limit.sync="queryParams2.pageSize"
@pagination="getTrackingList"
/>
</el-card>
</div>
</el-drawer>
</div>
</template>
<script>
import {getTankApi} from "@/api/oilConfig/oilTank";
import {getTrackingApi} from "@/api/oilConfig/oilStatistics";
import {getOilNameListApi} from "@/api/oilPrice";
export default {
name: "oilStatistics",
dicts: ['zhzt'],
data() {
return {
statisticsList: [],
trackList: [],
selectOilTypeByPrice: [],
//
total: 0,
total2: 0,
statisticsForm: {
tankName:'',
oilNumber:'',
storedQuantity:'',
updateTime:'',
unit:''
},
//
queryParams: {
numberId:'',
status:'',
tankName: '',
page:null,
pageSize:null
},
queryParams2: {
page:null,
pageSize:null
},
drawer: false,
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
}
},
async created() {
let this_ = this
await this_.getList()
this_.getOilNameList()
},
methods: {
getList() {
getTankApi(this.queryParams).then(res=>{
this.statisticsList = res.data.records
this.total = res.data.total;
})
},
getTrackingList(data) {
this.queryParams2.tankId = data.id,
getTrackingApi(this.queryParams2).then(res=>{
this.trackList = res.data.records
this.total2 = res.data.total;
})
},
//
trace(data) {
let this_ = this
this_.statisticsForm = {},
this_.statisticsForm.tankName = data.tankName,
this_.statisticsForm.oilNumber = data.oilNumber,
this_.statisticsForm.storedQuantity = data.storedQuantity,
this_.statisticsForm.updateTime = data.updateTime,
this_.statisticsForm.unit = data.unit,
this.trackList = []
this_.getTrackingList(data)
this.drawer=true
},
handleClose(done) {
done();
// this.$confirm('')
// .then(_ => {
// done();
// })
// .catch(_ => {});
},
//
getOilNameList() {
var this_=this
getOilNameListApi().then( response => {
var list = response.data
this_.selectOilTypeByPrice = list
});
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100vh;
background: #f6f8f9;
}
.text {
font-size: 14px;
}
.item {
margin-bottom: 18px;
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card {
width: 90%;
}
</style>

View File

@ -6,7 +6,7 @@
<el-form-item label="油罐名称" prop="tankName">
<el-input
v-model="queryParams.tankName"
placeholder="请输入姓名"
placeholder="请输入油罐名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
@ -107,21 +107,21 @@
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="油罐体积" prop="tankVolume">
<el-input v-model="tankForm.tankVolume" placeholder="请输入油罐体积" maxlength="30">
<el-input v-model.number="tankForm.tankVolume" placeholder="请输入油罐体积" maxlength="30">
<template slot="append">{{tankForm.unit}}</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="下限预警" prop="lowerWarning">
<el-input v-model="tankForm.lowerWarning" placeholder="小于预警值将进行提示" maxlength="30">
<el-input v-model.number="tankForm.lowerWarning" placeholder="小于预警值将进行提示" maxlength="30">
<template slot="append">{{tankForm.unit}}</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="油品密度" prop="password">
<el-input v-model="tankForm.oilDensity" placeholder="请输入油品密度" maxlength="30">
<el-form-item label="油品密度" prop="oilDensity">
<el-input v-model.number="tankForm.oilDensity" placeholder="请输入油品密度" maxlength="30">
<template slot="append">g/ml</template>
</el-input>
</el-form-item>
@ -209,6 +209,17 @@ export default {
dicts: ['zhzt'],
data() {
var valiNumberPass = (rule, value, callback) => {//
let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g;
if (value === '') {
callback(new Error('请输入内容'));
} else if (!reg.test(value)) {
callback(new Error('请输入数字'));
} else {
callback();
}
};
return {
// form :{},
//
@ -224,8 +235,6 @@ export default {
storedQuantity: null,
totalPrice: null,
discountedPrice: null,
// status: '',
// inventoryStatistics: '',
status: '',
inventoryStatistics: '',
remarks: '',
@ -266,34 +275,22 @@ export default {
{ required: true, message: '请选择油品类型', trigger: 'change' }
],
tankVolume: [
{ required: true, message: "油罐体积不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
lowerWarning: [
{ required: true, message: "下线预警不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
oilDensity: [
{ required: true, message: "油品密度不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
storedQuantity: [
{ required: true, message: "存油数量不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
totalPrice: [
{ required: true, message: "存油总价不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
discountedPrice: [
{ required: true, message: "折合单价不能为空", trigger: "blur" },
{ type: 'number', message: '价格必须为数字值'}
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
status: [
{ required: true, message: "请选择", trigger: "blur" }
@ -398,8 +395,8 @@ export default {
//
let this_ = this
this_.tankForm = {}
this.tankForm.status= "启用",
this.tankForm.inventoryStatistics= "启用",
this_.tankForm.status= 'qy',
this_.tankForm.inventoryStatistics= '启用',
this_.disableInput = false
this_.open = true;
@ -411,10 +408,9 @@ export default {
let this_ = this;
this_.selectOilTypeByPrice.forEach(oilType=>{
if (oilType.numberId == this_.tankForm.numberId) {
this.tankForm.oilDensity = oilType.oilDensity
this.tankForm.oilNumber = oilType.oilType +" "+oilType.oilName
console.log("oilTypeoilType",oilType)
this.tankForm.unit = oilType.unit
this_.tankForm.oilDensity = oilType.oilDensity
this_.tankForm.oilNumber = oilType.oilType +" "+oilType.oilName
this_.tankForm.unit = oilType.unit
}
})
},

View File

@ -101,19 +101,7 @@ public class OilPurchaseController extends BaseController {
*/
@PostMapping
public ResponseObject add(@RequestBody OilPurchase oilPurchase) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilPurchase.setCreateBy(nowAccountInfo.getStaffId().toString());
oilPurchase.setCreator(nowAccountInfo.getStaffId().toString());
oilPurchase.setStatus("await");
// 获取当前时间
// Date currentDate = new Date();
oilPurchase.setCreatedAt(new Date());
// // 创建一个SimpleDateFormat对象指定想要的日期时间格式
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// // 使用SimpleDateFormat格式化日期时间
// String formattedDate = dateFormat.format(currentDate);
return getSuccessResult(this.oilPurchaseService.insert(oilPurchase));
}

View File

@ -36,7 +36,7 @@ public class OilTankController extends BaseController {
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("oilTank") OilTank oilTank) {
Page page =new Page(pageNo,pageSize);
IPage<OilTank> oilTanks = this.oilTankService.queryByPage(page, oilTank);

View File

@ -0,0 +1,94 @@
package com.fuint.business.petrolStationManagement.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* (OilTracking)表控制层
*
* @author makejava
* @since 2023-10-25 11:55:13
*/
@RestController
@RequestMapping("business/petrolStationManagement/oilTracking")
public class OilTrackingController extends BaseController {
/**
* 服务对象
*/
@Resource
private OilTrackingService oilTrackingService;
/**
* 分页查询
*
* @param oilTracking 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("oilTracking") OilTracking oilTracking) {
Page page =new Page(pageNo,pageSize);
IPage<OilTracking> oilTrackingIPage = this.oilTrackingService.queryByPage(page, oilTracking);
return getSuccessResult(oilTrackingIPage);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.oilTrackingService.queryById(id));
}
/**
* 新增数据
*
* @param oilTracking 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(@RequestBody OilTracking oilTracking) {
return getSuccessResult(this.oilTrackingService.insert(oilTracking));
}
/**
* 编辑数据
*
* @param oilTracking 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(@RequestBody OilTracking oilTracking) {
return getSuccessResult(this.oilTrackingService.update(oilTracking));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.oilTrackingService.deleteById(id));
}
}

View File

@ -59,7 +59,7 @@ public class OilPurchase extends BaseEntity {
/**
* 制单时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createdAt;
/**
* 状态

View File

@ -0,0 +1,46 @@
package com.fuint.business.petrolStationManagement.entity;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
/**
* (OilTracking)实体类
*
* @author makejava
* @since 2023-10-25 11:55:13
*/
@Data
public class OilTracking extends BaseEntity {
private static final long serialVersionUID = 370742420512851869L;
/**
* 库存跟踪id
*/
private Integer id;
/**
* 单据
*/
private String document;
/**
* 单号
*/
private String orderNumber;
/**
* 变动数量
*/
private double quantityChange;
/**
* 店铺ID
*/
private Integer storeId;
/**
* 关联油罐id
*/
private Integer tankId;
}

View File

@ -40,6 +40,9 @@ public interface OilInventoryOrderMapper {
List<OilInventoryOrderVO> getAllList(OilInventoryOrder oilInventoryOrder);
List<OilInventoryOrderVO> getAllList2(@Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder);
/**
* 统计总行数
*

View File

@ -0,0 +1,85 @@
package com.fuint.business.petrolStationManagement.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (OilTracking)表数据库访问层
*
* @author makejava
* @since 2023-10-25 11:55:13
*/
public interface OilTrackingMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
OilTracking queryById(Integer id);
/**
* 查询指定行数据
*
* @param oilTracking 查询条件
* @param page
* 分页对象
* @return 对象列表
*/
IPage<OilTracking> queryAllByLimit(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking);
/**
* 统计总行数
*
* @param oilTracking 查询条件
* @return 总行数
*/
long count(OilTracking oilTracking);
/**
* 新增数据
*
* @param oilTracking 实例对象
* @return 影响行数
*/
int insert(OilTracking oilTracking);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<OilTracking> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<OilTracking> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<OilTracking> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<OilTracking> entities);
/**
* 修改数据
*
* @param oilTracking 实例对象
* @return 影响行数
*/
int update(OilTracking oilTracking);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -142,8 +142,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by, number_id)
values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}, #{numberId})
insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by, number_id, oil_machine_gun_number)
values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}, #{numberId}, #{oilMachineGunNumber})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@ -202,6 +202,9 @@
<if test="numberId != null">
number_id = #{numberId},
</if>
<if test="oilMachineGunNumber != null">
oil_machine_gun_number = #{oilMachineGunNumber},
</if>
</set>
where id = #{id}
</update>

View File

@ -154,6 +154,15 @@
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
<where>
<if test="oilInventory.status != null and oilInventory.status != ''">
and op.status = #{oilInventory.status}
</if>
<if test="oilInventory.inventoryNumber != null and oilInventory.inventoryNumber != ''">
and op.inventory_number LIKE CONCAT('%', #{oilInventory.inventoryNumber}, '%')
</if>
</where>
GROUP BY
op.id
</select>

View File

@ -135,6 +135,7 @@
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
current_average_price currentAveragePrice,
ot.stored_quantity currentInventoryVolume,
ot.inventory_time inventoryTime,
oi.inventory_volume inventoryVolume,
oi.stock_difference stockDifference,
oi.profit_loss_amount profitLossAmount
@ -161,6 +162,29 @@
where opo.store_id = #{storeId}
</select>
<select id="getAllList2" resultType="com.fuint.business.petrolStationManagement.vo.OilInventoryOrderVO">
SELECT
oi.id id,
ot.tank_name tankName,
ot.id tankId,
op.inventory_number inventoryNumber,
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
current_average_price currentAveragePrice,
ot.stored_quantity currentInventoryVolume,
oi.inventory_volume inventoryVolume,
oi.stock_difference stockDifference,
oi.profit_loss_amount profitLossAmount
FROM
oil_inventory_order oi
LEFT JOIN oil_inventory op ON oi.inventory_id = op.id
LEFT JOIN oil_tank ot ON ot.id = oi.tank_id
LEFT JOIN oil_number n ON oi.number_id = n.number_id
LEFT JOIN oil_name onn ON n.oil_name = onn.id
where
oi.inventory_id = #{oilInventoryOrder.inventoryId}
</select>
<!--新增所有列-->
<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, profit_loss_amount, store_id, create_time, update_time, create_by, update_by)

View File

@ -161,6 +161,7 @@
op.reviewer reviewer,
op.created_at createdAt,
op.the_document_amount theDocumentAmount,
op.purchase_date purchaseDate,
ms1.real_name creatorName,
ms2.real_name reviewerName
from
@ -190,7 +191,7 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_purchase(purchase_no, purchase_date, oil_type, supplier, density, purchase_quantity, unit_price, creator, reviewer, created_at, status, store_id, create_time, update_time, create_by, update_by,the_document_amount)
values (#{purchaseNo}, #{purchaseDate}, #{oilType}, #{supplier}, #{density}, #{purchaseQuantity}, #{unitPrice}, #{creator}, #{reviewer}, #{createdAt}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy},#{theDocumentAmount})
values (#{purchaseNo}, #{purchaseDate}, #{oilType}, #{supplier}, #{density}, #{purchaseQuantity}, #{unitPrice}, #{creator}, #{reviewer}, #{createTime}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{theDocumentAmount})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">

View File

@ -135,6 +135,7 @@
opo.purchase_volume purchaseVolume,
opo.discounted_price discountedPrice,
opo.tank_id tankId ,
op.purchase_no purchaseNo ,
onn.oil_type oilType,
onn.oil_name oilName,
os.supplier_name supplierName,

View File

@ -325,6 +325,7 @@
update oil_tank set
stored_quantity = stored_quantity + #{storedQuantity} ,
total_price = total_price + #{totalPrice},
update_time = NOW(),
discounted_price = #{discountedPrice}
where id = #{id}
</update>
@ -333,6 +334,7 @@
update oil_tank set
stored_quantity = #{storedQuantity} ,
total_price = #{totalPrice},
update_time = NOW(),
discounted_price = #{discountedPrice}
where id = #{id}
</update>

View File

@ -0,0 +1,176 @@
<?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.petrolStationManagement.mapper.OilTrackingMapper">
<resultMap type="com.fuint.business.petrolStationManagement.entity.OilTracking" id="OilTrackingMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="document" column="document" jdbcType="VARCHAR"/>
<result property="orderNumber" column="order_number" jdbcType="VARCHAR"/>
<result property="quantityChange" column="quantity_change" jdbcType="INTEGER"/>
<result property="storeId" column="store_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
<result property="tankId" column="tank_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="OilTrackingMap">
select
id, document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id
from oil_tracking
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="OilTrackingMap">
select
id, document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id
from oil_tracking
<where>
<if test="oilTracking.id != null">
and id = #{oilTracking.id}
</if>
<if test="oilTracking.document != null and oilTracking.document != ''">
and document = #{oilTracking.document}
</if>
<if test="oilTracking.orderNumber != null and oilTracking.orderNumber != ''">
and order_number = #{oilTracking.orderNumber}
</if>
<if test="oilTracking.storeId != null">
and store_id = #{oilTracking.storeId}
</if>
<if test="oilTracking.createTime != null">
and create_time = #{oilTracking.createTime}
</if>
<if test="oilTracking.updateTime != null">
and update_time = #{oilTracking.updateTime}
</if>
<if test="oilTracking.createBy != null">
and create_by = #{oilTracking.createBy}
</if>
<if test="oilTracking.updateBy != null">
and update_by = #{oilTracking.updateBy}
</if>
<if test="oilTracking.tankId != null">
and tank_id = #{oilTracking.tankId}
</if>
</where>
</select>
<!-- <if test="oilTracking.quantityChange != null">-->
<!-- and quantity_change = #{oilTracking.quantityChange}-->
<!-- </if>-->
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from oil_tracking
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="document != null and document != ''">
and document = #{document}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
</if>
<if test="quantityChange != null">
and quantity_change = #{quantityChange}
</if>
<if test="storeId != null">
and store_id = #{storeId}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createBy != null">
and create_by = #{createBy}
</if>
<if test="updateBy != null">
and update_by = #{updateBy}
</if>
<if test="tankId != null">
and tank_id = #{tankId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id)
values (#{document}, #{orderNumber}, #{quantityChange}, #{storeId}, #{createTime},NOW(), #{createBy}, #{updateBy}, #{tankId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.document}, #{entity.orderNumber}, #{entity.quantityChange}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.tankId})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.document}, #{entity.orderNumber}, #{entity.quantityChange}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.tankId})
</foreach>
on duplicate key update
document = values(document),
order_number = values(order_number),
quantity_change = values(quantity_change),
store_id = values(store_id),
create_time = values(create_time),
update_time = values(update_time),
create_by = values(create_by),
update_by = values(update_by),
tank_id = values(tank_id)
</insert>
<!--通过主键修改数据-->
<update id="update">
update oil_tracking
<set>
<if test="document != null and document != ''">
document = #{document},
</if>
<if test="orderNumber != null and orderNumber != ''">
order_number = #{orderNumber},
</if>
<if test="quantityChange != null">
quantity_change = #{quantityChange},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="createBy != null">
create_by = #{createBy},
</if>
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="tankId != null">
tank_id = #{tankId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from oil_tracking where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,58 @@
package com.fuint.business.petrolStationManagement.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import org.apache.ibatis.annotations.Param;
/**
* (OilTracking)表服务接口
*
* @author makejava
* @since 2023-10-25 11:55:13
*/
public interface OilTrackingService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
OilTracking queryById(Integer id);
/**
* 分页查询
*
* @param oilTracking 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
IPage<OilTracking> queryByPage(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking);
/**
* 新增数据
*
* @param oilTracking 实例对象
* @return 实例对象
*/
OilTracking insert(OilTracking oilTracking);
/**
* 修改数据
*
* @param oilTracking 实例对象
* @return 实例对象
*/
OilTracking update(OilTracking oilTracking);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -95,13 +95,15 @@ public class OilGunServiceImpl implements OilGunService {
return false;
}
oilGun.setCreateBy(accountInfo.getId().toString());
System.out.println("oilGun"+oilGun.getOilMachineGunNumber());
return this.oilGunDao.insert(oilGun)>0;
}
// 判断是否有同一名称的数据
public boolean checkData(OilGun oilGun) {
List<OilGun> oilGunList = oilGunDao.checkData(oilGun);
return oilGunList.size() > 0;
return oilGunList.size() > 1;
}
/**

View File

@ -11,7 +11,9 @@ import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -36,6 +38,13 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
@Resource
private ILJStaffService iljStaffService;
@Resource
OilTankMapper oilTankMapper;
@Resource
OilTrackingMapper oilTrackingMapper;
/**
* 通过ID查询单条数据
*
@ -212,18 +221,18 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
return false;
}
@Resource
OilTankMapper oilTankMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean storage(Integer id) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String oilIntake = "盘点入库";
int audit = iljStaffService.auditPrem(oilIntake);
if (audit>0) {
// 1.查询所有的数据
OilInventoryOrder oilInventoryOrder = new OilInventoryOrder();
oilInventoryOrder.setInventoryId(id);
List<OilInventoryOrderVO> allList = oilInventoryOrderDao.getAllList(oilInventoryOrder);
List<OilInventoryOrderVO> allList = oilInventoryOrderDao.getAllList2(oilInventoryOrder);
for (OilInventoryOrderVO oilInventoryOrderVO : allList) {
OilTank oilTank = new OilTank();
oilTank.setId(oilInventoryOrderVO.getTankId());
@ -235,6 +244,17 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
oilTank.setTotalPrice(bigDecimal.doubleValue());
oilTank.setDiscountedPrice(oilInventoryOrderVO.getCurrentAveragePrice());
oilTankMapper.accumulate2(oilTank);
// 插入到库存跟踪
OilTracking oilTracking = new OilTracking();
oilTracking.setStoreId(nowAccountInfo.getStoreId());
oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString());
oilTracking.setDocument(oilIntake);
oilTracking.setQuantityChange(oilInventoryOrderVO.getInventoryVolume());
oilTracking.setTankId(oilInventoryOrderVO.getTankId());
oilTracking.setOrderNumber(oilInventoryOrderVO.getInventoryNumber());
oilTrackingMapper.insert(oilTracking);
}
// 2.将数据填充到油罐里面
@ -249,7 +269,7 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService {
}
// 修改审核人
private boolean edit(Integer id){
public boolean edit(Integer id){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
OilInventory oilPurchase = new OilInventory();

View File

@ -49,7 +49,7 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
oilNumber.setCreateBy(nowAccountInfo.getStaffId().toString());
// 根据id查询这个店铺是否加过该型号的油
int i = baseMapper.selectOilNameByStore(oilNumber);
if ( i> 0) {
if ( i> 1) {
return 0;
}
return baseMapper.insertOilNumber(oilNumber);
@ -61,7 +61,7 @@ public class OilNumberServiceImpl extends ServiceImpl<OilNumberMapper, OilNumber
oilNumber.setUpdateBy(nowAccountInfo.getStaffId().toString());
int i = baseMapper.selectOilNameByStore(oilNumber);
if ( i> 0) {
if ( i> 1) {
return -1;
}

View File

@ -7,9 +7,11 @@ import com.fuint.business.member.service.impl.LJStaffServiceImpl;
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import com.fuint.business.petrolStationManagement.mapper.OilPurchaseMapper;
import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper;
import com.fuint.business.petrolStationManagement.mapper.OilTankMapper;
import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper;
import com.fuint.business.petrolStationManagement.service.OilPurchaseOrderService;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import com.fuint.business.petrolStationManagement.vo.OilTankVO;
@ -18,6 +20,7 @@ import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@ -31,6 +34,7 @@ import java.util.List;
*/
@Service("oilPurchaseOrderService")
public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
@Resource
private OilPurchaseOrderMapper oilPurchaseOrderDao;
@ -40,6 +44,13 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
@Resource
private ILJStaffService iljStaffService;
@Resource
OilTankMapper oilTankMapper;
@Resource
OilTrackingMapper oilTrackingMapper;
/**
* 通过ID查询单条数据
*
@ -159,11 +170,13 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
return false;
}
@Resource
OilTankMapper oilTankMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public boolean storage(Integer id) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String oilIntake = "进油入库";
int audit = iljStaffService.auditPrem(oilIntake);
if (audit>0) {
@ -178,6 +191,15 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
oilTank.setTotalPrice(oilPurchaseOrderVO.getTotalAmount());
oilTank.setDiscountedPrice(oilPurchaseOrderVO.getPurchasePrice());
oilTankMapper.accumulate(oilTank);
// 插入到库存跟踪
OilTracking oilTracking = new OilTracking();
oilTracking.setStoreId(nowAccountInfo.getStoreId());
oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString());
oilTracking.setDocument(oilIntake);
oilTracking.setQuantityChange(oilPurchaseOrderVO.getPurchaseVolume());
oilTracking.setTankId(oilPurchaseOrderVO.getTankId());
oilTracking.setOrderNumber(oilPurchaseOrderVO.getPurchaseNo());
oilTrackingMapper.insert(oilTracking);
}
// 2.将数据填充到油罐里面
@ -192,7 +214,7 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
}
// 修改审核人
private boolean edit(Integer id){
public boolean edit(Integer id){
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
OilPurchase oilPurchase = new OilPurchase();

View File

@ -111,6 +111,20 @@ public class OilPurchaseServiceImpl implements OilPurchaseService {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilPurchase.setStoreId(nowAccountInfo.getStoreId());
oilPurchase.setCreateBy(nowAccountInfo.getStaffId().toString());
oilPurchase.setCreator(nowAccountInfo.getStaffId().toString());
oilPurchase.setStatus("await");
// 获取当前时间
// Date currentDate = new Date();
// oilPurchase.setCreatedAt(new Date());
// // 创建一个SimpleDateFormat对象指定想要的日期时间格式
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// // 使用SimpleDateFormat格式化日期时间
// String formattedDate = dateFormat.format(currentDate);
this.oilPurchaseDao.insert(oilPurchase);
return oilPurchase;
}

View File

@ -44,8 +44,8 @@ public class OilTankServiceImpl implements OilTankService {
*/
@Override
public IPage<OilTank> queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank) {
// long total = this.oilTankDao.count(oilTank);
// return new PageImpl<>(this.oilTankDao.queryAllByLimit(oilTank, pageRequest), pageRequest, total);
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilTank.setStoreId(accountInfo.getStoreId());
return oilTankDao.queryAllByLimit(page, oilTank);
}

View File

@ -0,0 +1,88 @@
package com.fuint.business.petrolStationManagement.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.entity.OilTracking;
import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper;
import com.fuint.business.petrolStationManagement.service.OilTrackingService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
/**
* (OilTracking)表服务实现类
*
* @author makejava
* @since 2023-10-25 11:55:13
*/
@Service("oilTrackingService")
public class OilTrackingServiceImpl implements OilTrackingService {
@Resource
private OilTrackingMapper oilTrackingDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public OilTracking queryById(Integer id) {
return this.oilTrackingDao.queryById(id);
}
/**
* 分页查询
*
* @param oilTracking 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<OilTracking> queryByPage(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilTracking.setStoreId(accountInfo.getStoreId());
return oilTrackingDao.queryAllByLimit(page, oilTracking);
}
/**
* 新增数据
*
* @param oilTracking 实例对象
* @return 实例对象
*/
@Override
public OilTracking insert(OilTracking oilTracking) {
this.oilTrackingDao.insert(oilTracking);
return oilTracking;
}
/**
* 修改数据
*
* @param oilTracking 实例对象
* @return 实例对象
*/
@Override
public OilTracking update(OilTracking oilTracking) {
this.oilTrackingDao.update(oilTracking);
return this.queryById(oilTracking.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.oilTrackingDao.deleteById(id) > 0;
}
}

View File

@ -3,9 +3,19 @@ package com.fuint.business.petrolStationManagement.vo;
import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder;
import lombok.Data;
import java.util.Date;
@Data
public class OilInventoryOrderVO extends OilInventoryOrder {
private String tankName;
private Integer tankId;
private String numberName;
/**
* 盘点单号
*/
private String inventoryNumber;
/**
* 盘点时间
*/
private Date inventoryTime;
}

View File

@ -12,4 +12,8 @@ public class OilPurchaseOrderVO extends OilPurchaseOrder {
private String supplierName; // 供应商名称
private String storedQuantity; // 库存数量
private String numberName; //
/**
* 进货单号
*/
private String purchaseNo;
}

View File

@ -28,14 +28,14 @@ public class BaseEntity implements Serializable
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateTime;
/** 备注 */