供应商 进油

This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-18 18:18:15 +08:00
parent 0ff11ec140
commit b8398df156
34 changed files with 1521 additions and 397 deletions

View File

@ -27,8 +27,17 @@ export function updateGunApi(data) {
// 根据油号查询油罐
export function selectTankByNumberApi(data) {
return request({
url: 'business/petrolStationManagement/oilTank/selectList',
method: 'put',
data: data
url: 'business/petrolStationManagement/oilTank/selectList?numberId='+data,
method: 'get',
params: data
})
}
// 查询油罐列表
export function delGunApi(data) {
return request({
url: '/business/petrolStationManagement/oilGun/',
method: 'delete',
params: data
})
}

View File

@ -0,0 +1,22 @@
import request from "@/utils/request";
// 进货
// 查询油罐列表
export function getPurchaseApi(data) {
return request({
url: '/business/petrolStationManagement/oilGun/selectByNumberTGUn',
method: 'get',
params: data
})
}
// 订单
// 查询订单列表
export function getPurchaseOrderApi(data) {
return request({
url: '/business/petrolStationManagement/oilPurchaseOrder/getList',
method: 'get',
params: data
})
}

View File

@ -0,0 +1,26 @@
import request from "@/utils/request";
// 查询供应商列表
export function getSuppliersListApi(data) {
return request({
url: '/business/petrolStationManagement/oilSuppliers/queryByPage',
method: 'get',
params: data
})
}
// 新增有关信息
export function insertSuppliersApi(data) {
return request({
url: 'business/petrolStationManagement/oilSuppliers',
method: 'post',
data: data
})
}
// 修改有关信息
export function updateSuppliersApi(data) {
return request({
url: 'business/petrolStationManagement/oilSuppliers',
method: 'put',
data: data
})
}

View File

@ -82,7 +82,28 @@ export const constantRoutes = [
meta: { title: '个人中心', icon: 'user' }
}
]
}
},
{
path: '/oilPurchase',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'purchaseOrder',
component: () => import('@/views/oilConfig/oilPurchase/purchaseOrder'),
name: 'Profile',
meta: { title: '采购详情', icon: 'user' }
},
{
path: 'list',
component: () => import('@/views/oilConfig/oilPurchase/list'),
name: 'Profile',
meta: { title: '油站进油', icon: 'user' }
}
]
},
]
// 动态路由,基于用户权限动态去加载

View File

@ -6,41 +6,31 @@
</div>
<div class="conten-box" v-for="(item,index) in gunList" :key="index">
<!-- <div class="conten-top">-->
<!-- <div>{{item.oilType}} {{item.oilName}}</div>-->
<!-- <div>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- icon="el-icon-plus"-->
<!-- @click="gunAdd"-->
<!-- >新增油枪</el-button>-->
<!-- </div>-->
<!-- </div>-->
<div class="conten-top" style="display: flex; justify-content: space-between;">
<div>{{item.oilType}} {{item.oilName}}</div>
<div>
<el-button
type="primary"
icon="el-icon-plus"
@click="gunAdd()"
@click="gunAdd(item.numberId)"
>新增油枪</el-button>
</div>
</div>
<div class="conten-bottom">
<div class="cardbox" :class="{ 'act-cardbox': item.status == '正常' }" v-for="(item,index) in item.oilGunList" :key="index">
<div class="cardbox-top" :class="{ 'actcolor':item.status == '正常' }">
<div>92号油罐</div>
<div style="cursor: pointer" ><i class="el-icon-edit" @click="dialogVisible = true"></i> <i class="el-icon-delete"></i></div>
<div class="cardbox" :class="{ 'act-cardbox': item.status == '启用' }" v-for="(item,index) in item.oilGunList" :key="index">
<div class="cardbox-top" :class="{ 'actcolor':item.status == '启用' }">
<div>{{item.tankName}}</div>
<div style="cursor: pointer" ><i class="el-icon-edit" @click="gunEdit(item)"></i> <i class="el-icon-delete" @click="delGun(item.id)"></i></div>
</div>
<div class="cardbox-title">
<div>{{index+1 || '0'}}号枪</div>
<div>{{item.gunName}}</div>
</div>
<div class="cardbox-bottom" :class="{ 'actcolor':item.status == '正常' }">
<div>ID:778</div>
<div class="cardbox-bottom" :class="{ 'actcolor':item.status == '启用' }">
<div>ID:{{ item.id }}</div>
</div>
<div class="cardboxb" v-if="item.xb== 'you' ">
<div class="cardboxb" v-if="item.oilMachineGunNumber != null ">
<i class="el-icon-share"></i>
<div>01-3</div>
<div>{{item.oilMachineGunNumber}}</div>
</div>
</div>
</div>
@ -69,17 +59,22 @@
<el-input v-model="gunForm.oilMachineGunNumber"></el-input>
<div style="font-size: 12px;color: #999999">油机连接模式下 绑定油机系统中的枪号信息与当前枪号绑定</div>
</el-form-item>
<el-form-item label="所属油罐" prop="region">
<el-select v-model="gunForm.region" placeholder="请选择活动区域">
<el-option label="油罐一" value="shanghai"></el-option>
<el-option label="油罐二" value="beijing"></el-option>
<el-form-item label="所属油罐" prop="tankId">
<el-select v-model="gunForm.tankId" placeholder="请选择所属油罐">
<el-option
v-for="option in tankList"
:key="option.id"
:label="option.tankName"
:value="option.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="resource">
<el-radio-group v-model="gunForm.resource">
<el-form-item label="状态" prop="status">
<!-- <el-radio-group v-model="gunForm.status">-->
<el-radio-group v-model="statusOut">
<el-radio
v-for="dict in dict.type.zhzt"
:key="dict.value"
@ -89,16 +84,15 @@
</el-radio-group>
</el-form-item>
<el-form-item>
</el-form-item>
<!-- <el-form-item>-->
<!-- </el-form-item>-->
</el-form>
<!-- <el-button type="danger">删除</el-button>-->
<span slot="footer" class="dialog-footer">
<!--/* <el-button v-if="judgement" type="danger" @click="delGun()" style="float: left;">删除</el-button>*/-->
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</span>
@ -107,7 +101,8 @@
</template>
<script>
import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api/oilConfig/oilGuns";
import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi,delGunApi} from "@/api/oilConfig/oilGuns";
import {cleanTankApi} from "@/api/oilConfig/oilTank";
export default {
name: 'oilqiang',
@ -126,7 +121,8 @@ import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api
{type:1,xb:'you'},
{type:1,xb:'you'},
],
//
judgement:false,
tankList: [],
gunList: [],
gunForm: {
@ -143,6 +139,7 @@ import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api
oilMachineGunNumber: '',
select: ''
},
statusOut:'',
ruleForm: {
name: '',
region: '',
@ -155,28 +152,15 @@ import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api
desc: ''
},
rules: {
name: [
{ required: true, message: '请输入活动名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
gunName: [
{ required: true, message: '请输入油罐名称', trigger: 'blur' },
],
region: [
{ required: true, message: '请选择活动区域', trigger: 'change' }
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
date1: [
{ type: 'date', required: true, message: '请选择日期', trigger: 'change' }
tankId: [
{ required: true, message: '请选择所属油罐', trigger: 'change' }
],
date2: [
{ type: 'date', required: true, message: '请选择时间', trigger: 'change' }
],
type: [
{ type: 'array', required: true, message: '请至少选择一个活动性质', trigger: 'change' }
],
resource: [
{ required: true, message: '请选择活动资源', trigger: 'change' }
],
desc: [
{ required: true, message: '请填写活动形式', trigger: 'blur' }
]
}
}
},
@ -190,37 +174,89 @@ import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api
getList() {
getGunApi().then(response => {
this.gunList = response.data;
console.log("this.tankList",this.gunList)
})
},
//
gunAdd(){
gunAdd(numberId){
let this_ = this;
this_.dialogVisible = true;
this_.judgement = false;
this_.gunForm = {} //
this_.selectTankByNumberApi()
// this.gunForm.status = ''
this.statusOut = '启用',
this_.selectTankByNumber(numberId)
},
gunEdit() {
gunEdit(data) {
let this_ = this;
this_.dialogVisible = true;
this_.selectTankByNumberApi()
this_.judgement = true;
console.log("datadatadata",data)
this_.gunForm = data;
this_.statusOut = data.status;
this_.selectTankByNumber(data.numberId)
},
delGun(id) {
this.$confirm('此操作将删除油枪信息,请谨慎操作!是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let fil = {
id: id
}
delGunApi(fil).then(response => {
this.dialogVisible = false;
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
submitForm() {
this.gunForm.status = this.statusOut
this.$refs["gunForm"].validate((valid) => {
if (valid) {
// numberId
for (let tankListKey in this.tankList) {
if (parseInt(this.gunForm.tankId) === parseInt(this.tankList[tankListKey].id)) {
this.gunForm.numberId = parseInt(this.tankList[tankListKey].numberId);
}
}
if (!this.gunForm.id) {
insertGunApi(this.gunForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.getList();
console.log("response",response)
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.getList();
}else {
}
}).catch(reason => {
console.log("reason",reason)
this.dialogVisible = true;
});
} else {
updateGunApi(this.gunForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
if (response.code == 200) {
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.getList();
}
});
}
this.dialogVisible = false
} else {
console.log('error submit!!');
return false;
@ -232,15 +268,13 @@ import {getGunApi, insertGunApi, updateGunApi,selectTankByNumberApi} from "@/api
this_.gunForm.gunName = this_.gunForm.select
},
handleClose(){
this.dialogVisible = false;
},
//
selectTankByNumberApi(data) {
let fil = {
numberId : data
}
selectTankByNumberApi(fil).then(response => {
selectTankByNumber(data) {
let numberId = data
selectTankByNumberApi(numberId).then(response => {
this.tankList = response.data;
});
}

View File

@ -0,0 +1,94 @@
<template>
<div class="app-container">
<button @click="goToAbout">Go to About Page</button>
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="供应商名称" prop="supplierName">
<el-input
v-model="queryParams.supplierName"
placeholder="请输入供应商名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</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>
</div>
</template>
<script>
export default {
name: "list",
data() {
return {
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
supplierName: '',
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
// contactPerson: [
// { required: true, message: "", trigger: "blur" },
// ],
// contactPhone: [
// { required: true, message: "", trigger: "blur" },
// ],
// contactAddress: [
// { required: true, message: "", trigger: "blur" },
// ]
}
}
},
async created() {
},
methods: {
//
getList(){
},
goToAbout() {
this.$router.push('/oilPurchase/purchaseOrder');
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,203 @@
<template>
<div class="app-container">
<el-card >
<div slot="header" class="clearfix">
<i class="el-icon-back" @click="goToAbout">返回 | </i>
<span> 采购详情</span>
</div>
<div>
<div>
<div style="border: 2px solid #000;">
<div>
</div>
<div>
</div>
<div>
</div>
</div>
<div>
</div>
</div >
<div style="border: 2px solid #000;">
</div>
</div>
</el-card>
<el-card style="margin-top: 20px" >
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
@click="orderAdd"
>添加采购油品</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="orderList"
:default-sort="defaultSort">
<el-table-column label="油品名称" align="center" prop="numberName"/>
<el-table-column label="入库油罐" align="center" prop="tankName"/>
<el-table-column label="供应商" align="center" prop="supplierName" />
<el-table-column label="当前库存" align="center" prop="storedQuantity"/>
<!-- <el-table-column label="入库前库存" align="center" prop="preInboundInventory"/>-->
<el-table-column label="油品密度" align="center" prop="productDensity">
<template slot-scope="scope">
<el-input-number v-model="scope.row.productDensity" @change="change(scope.row)" controls-position="right" :min="1" :max="10" 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="1" :max="10" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column 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="1" :max="10" 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="1" :max="10" 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">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="orderDel(scope.row)"
>删除</el-button>
</template>
<!-- v-hasPermi="['']"-->
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import {getSuppliersListApi} from "@/api/oilConfig/oilSuppliers";
import {getPurchaseOrderApi} from "@/api/oilConfig/oilPurchase";
export default {
name: "purchaseOrder",
data() {
return {
orderList:[],
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
supplierName: '',
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
},
form: {
id: "", // ID
productDensity: "", //
purchaseWeight: "", //
purchasePrice: "", //
totalAmount: "", //
purchaseVolume: "", //
discountedPrice: "", //
oilType: "", //
oilName: "", //
supplierName: "", //
tankName: "", //
storedQuantity: "", //
},
}
},
async created() {
await this.getList();
},
methods: {
getList(){
this.loading = true;
getPurchaseOrderApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.orderList = response.data.records;
console.log("this.tankList",this.orderList)
this.total = response.data.total;
// response.data.records.forEach(item=>{
// this.categoryOptions.push(item.category)
})
this.loading = false;
},
//
orderAdd() {
},
orderDel() {
},
//
change(data) {
//
data.purchaseVolume = (data.purchaseWeight*(1000))/data.productDensity
//
data.totalAmount = data.purchasePrice * data.purchaseWeight
//
data.discountedPrice = data.purchaseVolume / data.totalAmount
},
goToAbout() {
// this.$router.push('/oilPurchase/list');
this.$router.push('/oilConfig/oilPurchase/list');
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,256 @@
<template>
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="供应商名称" prop="supplierName">
<el-input
v-model="queryParams.supplierName"
placeholder="请输入供应商名称"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系人" prop="contactPerson">
<el-input
v-model="queryParams.contactPerson"
placeholder="请输入联系人"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应商电话" prop="contactPhone">
<el-input
v-model.number="queryParams.contactPhone"
placeholder="请输入供应商电话"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</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">
<el-button
type="primary"
icon="el-icon-plus"
@click="suppliersAdd"
>新增供应商</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="suppliersList"
:default-sort="defaultSort">
<el-table-column label="id" align="center" prop="id"/>
<el-table-column label="供应商名称" align="center" prop="supplierName"/>
<el-table-column label="联系人" align="center" prop="contactPerson" />
<el-table-column label="联系方式" align="center" prop="contactPhone"/>
<el-table-column label="联系地址" align="center" prop="contactAddress"/>
<el-table-column label="备注信息" align="center" prop="remarks"/>
<el-table-column label="创建时间" align="center" prop="createTime"/>
<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="handleUpdate(scope.row)"
>修改</el-button>
</template>
<!-- v-hasPermi="['']"-->
</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-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="suppliersForm" :rules="rules" label-width="120px">
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="供应商" prop="supplierName">
<el-input v-model="suppliersForm.supplierName" placeholder="供应商名称" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="10">
<el-form-item label="联系人" prop="contactPerson">
<el-input v-model="suppliersForm.contactPerson" placeholder="联系人名称" maxlength="30"/>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="联系电话" prop="contactPhone">
<el-input v-model="suppliersForm.contactPhone" placeholder="联系电话" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="联系地址" prop="contactAddress">
<el-input v-model="suppliersForm.contactAddress" placeholder="联系地址" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="20">
<el-form-item label="备注信息" prop="remarks">
<el-input type="textarea" v-model="suppliersForm.remarks" placeholder="备注信息" maxlength="30"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {getSuppliersListApi, insertSuppliersApi, updateSuppliersApi} from "@/api/oilConfig/oilSuppliers";
export default {
data() {
return {
suppliersList:[],
suppliersForm:{
id: null,
supplierName: '',
contactPerson: '',
contactPhone: '',
contactAddress: '',
remarks: '',
createTime:''
},
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
supplierName: '',
contactPerson: '',
contactPhone: '',
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
// contactPerson: [
// { required: true, message: "", trigger: "blur" },
// ],
// contactPhone: [
// { required: true, message: "", trigger: "blur" },
// ],
// contactAddress: [
// { required: true, message: "", trigger: "blur" },
// ]
}
}
},
async created() {
await this.getList();
},
methods: {
getList() {
this.loading = true;
getSuppliersListApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.suppliersList = response.data.records;
console.log("this.tankList",this.suppliersList)
this.total = response.data.total;
// response.data.records.forEach(item=>{
// this.categoryOptions.push(item.category)
})
this.loading = false;
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (!this.suppliersForm.id) {
insertSuppliersApi(this.suppliersForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
} else {
updateSuppliersApi(this.suppliersForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
}
});
},
//
suppliersAdd() {
this.suppliersForm = {}
this.open = true
this.title = '新增供应商'
},
handleUpdate(data) {
this.suppliersForm = data
this.open = true
this.title = '新增供应商'
},
//
cancel() {
this.open = false;
this.reset();
},
//
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
},
}
</script>
<style>
</style>

View File

@ -59,16 +59,16 @@
size="mini"
type="text"
icon="el-icon-edit"
v-hasPermi="['staff:list']"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-copy-document"
v-hasPermi="['staff:list']"
@click="handleClean(scope.row)"
>初始化</el-button>
<!-- v-hasPermi="['']"-->
</template>
</el-table-column>
</el-table>

View File

@ -72,8 +72,12 @@ public class OilGunController extends BaseController {
* @return 新增结果
*/
@PostMapping
public ResponseObject add(OilGun oilGun) {
return getSuccessResult(this.oilGunService.insert(oilGun));
public ResponseObject add(@RequestBody OilGun oilGun) {
if (this.oilGunService.insert(oilGun)) {
return getSuccessResult(this.oilGunService.insert(oilGun));
}else {
return getSuccessResult(201,"存在重复的油枪名称,请修改",null);
}
}
/**
@ -83,8 +87,12 @@ public class OilGunController extends BaseController {
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(OilGun oilGun) {
return getSuccessResult(this.oilGunService.update(oilGun));
public ResponseObject edit(@RequestBody OilGun oilGun) {
if (this.oilGunService.update(oilGun)){
return getSuccessResult(this.oilGunService.update(oilGun));
}else {
return getSuccessResult(201,"存在重复的油枪名称,请修改",null);
}
}
/**

View File

@ -0,0 +1,100 @@
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.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.service.OilPurchaseOrderService;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* (OilPurchaseOrder)表控制层
*
* @author makejava
* @since 2023-10-18 15:32:18
*/
@RestController
@RequestMapping("business/petrolStationManagement/oilPurchaseOrder")
public class OilPurchaseOrderController extends BaseController {
/**
* 服务对象
*/
@Resource
private OilPurchaseOrderService oilPurchaseOrderService;
/**
* 分页查询
*
* @param oilPurchaseOrder 筛选条件
* @param pageNo 分页对象
* @return 查询结果
*/
@GetMapping("queryByPage")
public ResponseObject queryByPage(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize,
@Param("oilPurchase") OilPurchaseOrder oilPurchaseOrder) {
Page page =new Page(pageNo,pageSize);
IPage<OilPurchaseOrder> oilTanks = this.oilPurchaseOrderService.queryByPage(page, oilPurchaseOrder);
return getSuccessResult(oilTanks);
}
@GetMapping("getList")
public ResponseObject getList(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize,
@Param("oilPurchase") OilPurchaseOrder oilPurchaseOrder) {
Page page =new Page(pageNo,pageSize);
IPage<OilPurchaseOrderVO> oilTanks = this.oilPurchaseOrderService.getList(page, oilPurchaseOrder);
return getSuccessResult(oilTanks);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.oilPurchaseOrderService.queryById(id));
}
/**
* 新增数据
*
* @param oilPurchaseOrder 实体
* @return 新增结果
*/
@PostMapping
public ResponseObject add(OilPurchaseOrder oilPurchaseOrder) {
return getSuccessResult(this.oilPurchaseOrderService.insert(oilPurchaseOrder));
}
/**
* 编辑数据
*
* @param oilPurchaseOrder 实体
* @return 编辑结果
*/
@PutMapping
public ResponseObject edit(OilPurchaseOrder oilPurchaseOrder) {
return getSuccessResult(this.oilPurchaseOrderService.update(oilPurchaseOrder));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.oilPurchaseOrderService.deleteById(id));
}
}

View File

@ -19,7 +19,7 @@ import javax.annotation.Resource;
* @since 2023-10-17 16:42:28
*/
@RestController
@RequestMapping("oilSuppliers")
@RequestMapping("business/petrolStationManagement/oilSuppliers")
public class OilSuppliersController extends BaseController {
/**
* 服务对象
@ -50,8 +50,8 @@ public class OilSuppliersController extends BaseController {
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseEntity<OilSuppliers> queryById(@PathVariable("id") Integer id) {
return ResponseEntity.ok(this.oilSuppliersService.queryById(id));
public ResponseObject queryById(@PathVariable("id") Integer id) {
return getSuccessResult(this.oilSuppliersService.queryById(id));
}
/**
@ -61,8 +61,8 @@ public class OilSuppliersController extends BaseController {
* @return 新增结果
*/
@PostMapping
public ResponseEntity<OilSuppliers> add(OilSuppliers oilSuppliers) {
return ResponseEntity.ok(this.oilSuppliersService.insert(oilSuppliers));
public ResponseObject add(@RequestBody OilSuppliers oilSuppliers) {
return getSuccessResult(this.oilSuppliersService.insert(oilSuppliers));
}
/**
@ -72,8 +72,8 @@ public class OilSuppliersController extends BaseController {
* @return 编辑结果
*/
@PutMapping
public ResponseEntity<OilSuppliers> edit(OilSuppliers oilSuppliers) {
return ResponseEntity.ok(this.oilSuppliersService.update(oilSuppliers));
public ResponseObject edit(@RequestBody OilSuppliers oilSuppliers) {
return getSuccessResult(this.oilSuppliersService.update(oilSuppliers));
}
/**
@ -83,8 +83,8 @@ public class OilSuppliersController extends BaseController {
* @return 删除是否成功
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(Integer id) {
return ResponseEntity.ok(this.oilSuppliersService.deleteById(id));
public ResponseObject deleteById(Integer id) {
return getSuccessResult(this.oilSuppliersService.deleteById(id));
}
}

View File

@ -44,8 +44,8 @@ public class OilTankController extends BaseController {
}
@GetMapping("selectList")
public ResponseObject selectList(OilTank oilTank) {
return getSuccessResult(this.oilTankService.selectList(oilTank));
public ResponseObject selectList(Integer numberId) {
return getSuccessResult(this.oilTankService.selectList(numberId));
}

View File

@ -23,6 +23,10 @@ public class OilGun extends BaseEntity {
* 油枪名称
*/
private String gunName;
/**
* 油机枪号
*/
private String oilMachineGunNumber;
/**
* 所属油罐ID
*/
@ -40,6 +44,11 @@ public class OilGun extends BaseEntity {
*/
private Integer numberId;
/**
* 油罐名称
*/
private String tankName;
}

View File

@ -1,5 +1,8 @@
package com.fuint.business.petrolStationManagement.entity;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
@ -9,7 +12,8 @@ import java.io.Serializable;
* @author makejava
* @since 2023-10-17 16:09:46
*/
public class OilPurchase implements Serializable {
@Data
public class OilPurchase extends BaseEntity {
private static final long serialVersionUID = 205114404529546520L;
/**
* 进油ID
@ -63,159 +67,9 @@ public class OilPurchase implements Serializable {
* 店铺ID
*/
private Integer storeId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Integer createBy;
/**
* 更新人
*/
private Integer updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPurchaseNo() {
return purchaseNo;
}
public void setPurchaseNo(String purchaseNo) {
this.purchaseNo = purchaseNo;
}
public Date getPurchaseDate() {
return purchaseDate;
}
public void setPurchaseDate(Date purchaseDate) {
this.purchaseDate = purchaseDate;
}
public String getOilType() {
return oilType;
}
public void setOilType(String oilType) {
this.oilType = oilType;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Double getDensity() {
return density;
}
public void setDensity(Double density) {
this.density = density;
}
public Double getPurchaseQuantity() {
return purchaseQuantity;
}
public void setPurchaseQuantity(Double purchaseQuantity) {
this.purchaseQuantity = purchaseQuantity;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public String getCreator() {
return creator;
}
public void setCreator(String creator) {
this.creator = creator;
}
public String getReviewer() {
return reviewer;
}
public void setReviewer(String reviewer) {
this.reviewer = reviewer;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Integer getStoreId() {
return storeId;
}
public void setStoreId(Integer storeId) {
this.storeId = storeId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getCreateBy() {
return createBy;
}
public void setCreateBy(Integer createBy) {
this.createBy = createBy;
}
public Integer getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Integer updateBy) {
this.updateBy = updateBy;
}
}

View File

@ -0,0 +1,71 @@
package com.fuint.business.petrolStationManagement.entity;
import com.fuint.repository.model.base.BaseEntity;
import lombok.Data;
import java.io.Serializable;
/**
* (OilPurchaseOrder)实体类
*
* @author makejava
* @since 2023-10-18 15:32:18
*/
@Data
public class OilPurchaseOrder extends BaseEntity {
private static final long serialVersionUID = -84165036807190803L;
/**
* 进货单表id
*/
private Integer id;
/**
* 进油id
*/
private Integer purchaseId;
/**
* 油品id
*/
private Integer numberId;
/**
* 油罐id
*/
private Integer tankId;
/**
* 供应商id
*/
private Integer supplierId;
/**
* 油品密度
*/
private Double productDensity;
/**
* 采购吨数
*/
private Double purchaseWeight;
/**
* 采购单价
*/
private Double purchasePrice;
/**
* 金额
*/
private Double totalAmount;
/**
* 采购升数
*/
private Double purchaseVolume;
/**
* 入库前库存
*/
private Double preInboundInventory;
/**
* 折合单价
*/
private Double discountedPrice;
private Integer storeId;
}

View File

@ -1,5 +1,9 @@
package com.fuint.business.petrolStationManagement.entity;
import com.fuint.repository.model.base.BaseEntity;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
@ -9,7 +13,8 @@ import java.io.Serializable;
* @author makejava
* @since 2023-10-17 16:42:28
*/
public class OilSuppliers implements Serializable {
@Data
public class OilSuppliers extends BaseEntity {
private static final long serialVersionUID = 424975286266609004L;
/**
* 供应商ID
@ -36,102 +41,9 @@ public class OilSuppliers implements Serializable {
*/
private String remarks;
/**
* 创建时间
* 店铺id
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 创建人
*/
private Integer createBy;
/**
* 更新人
*/
private Integer updateBy;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getContactPerson() {
return contactPerson;
}
public void setContactPerson(String contactPerson) {
this.contactPerson = contactPerson;
}
public String getContactPhone() {
return contactPhone;
}
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
public String getContactAddress() {
return contactAddress;
}
public void setContactAddress(String contactAddress) {
this.contactAddress = contactAddress;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getCreateBy() {
return createBy;
}
public void setCreateBy(Integer createBy) {
this.createBy = createBy;
}
public Integer getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Integer updateBy) {
this.updateBy = updateBy;
}
private Integer storeId;
}

View File

@ -57,6 +57,8 @@ public interface OilGunMapper {
*/
int insert(OilGun oilGun);
List<OilGun> checkData(@Param("oilGun") OilGun oilGun);
/**
* 批量新增数据MyBatis原生foreach方法
*

View File

@ -48,7 +48,7 @@ public interface OilNumberMapper extends BaseMapper<OilNumber> {
*/
public int updateOilNumber(OilNumber oilNumber);
public List<OilNumber> getOilName(Integer storeId);
public List<OilNumber> getOilName(@Param("storeId") Integer storeId);
// 根据店铺和油号查询是否存在重复
public int selectOilNameByStore(OilNumber oilNumber);

View File

@ -0,0 +1,89 @@
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.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (OilPurchaseOrder)表数据库访问层
*
* @author makejava
* @since 2023-10-18 15:32:18
*/
public interface OilPurchaseOrderMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
OilPurchaseOrder queryById(Integer id);
/**
* 查询指定行数据
*
* @param oilPurchaseOrder 查询条件
* @param pageable 分页对象
* @return 对象列表
*/
IPage<OilPurchaseOrder> queryAllByLimit(@Param("page") Page page, OilPurchaseOrder oilPurchaseOrder);
IPage<OilPurchaseOrderVO> getList(@Param("page") Page page, @Param("oilPurchaseOrder") OilPurchaseOrder oilPurchaseOrder);
/**
* 统计总行数
*
* @param oilPurchaseOrder 查询条件
* @return 总行数
*/
long count(OilPurchaseOrder oilPurchaseOrder);
/**
* 新增数据
*
* @param oilPurchaseOrder 实例对象
* @return 影响行数
*/
int insert(OilPurchaseOrder oilPurchaseOrder);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<OilPurchaseOrder> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<OilPurchaseOrder> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<OilPurchaseOrder> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<OilPurchaseOrder> entities);
/**
* 修改数据
*
* @param oilPurchaseOrder 实例对象
* @return 影响行数
*/
int update(OilPurchaseOrder oilPurchaseOrder);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

@ -28,7 +28,7 @@ public interface OilSuppliersMapper {
* @param oilSuppliers 查询条件
* @return 对象列表
*/
IPage<OilSuppliers> queryAllByLimit(@Param("page") Page page, @Param("oilTank") OilSuppliers oilSuppliers);
IPage<OilSuppliers> queryAllByLimit(@Param("page") Page page, @Param("oilSuppliers") OilSuppliers oilSuppliers);
/**
* 统计总行数

View File

@ -33,7 +33,7 @@ public interface OilTankMapper {
*/
IPage<OilTank> queryAllByLimit(@Param("page")Page page,@Param("oilTank") OilTank oilTank);
List<OilTank> selectList(OilTank oilTank);
List<OilTank> selectList(@Param("oilTank") OilTank oilTank);
/**
* 统计总行数
*

View File

@ -13,6 +13,8 @@
<result property="createBy" column="create_by" jdbcType="INTEGER"/>
<result property="updateBy" column="update_by" jdbcType="INTEGER"/>
<result property="numberId" column="number_id" jdbcType="INTEGER"/>
<result property="tankName" column="tank_name" jdbcType="VARCHAR"/>
<result property="oilMachineGunNumber" column="oil_machine_gun_number" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
@ -95,35 +97,27 @@
</select>
<select id="getAllList" resultMap="OilGunMap">
select
id, gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by, number_id
from oil_gun
og.id, og.gun_name, og.tank_id, og.status, og.store_id, og.create_time, og.update_time, og.create_by, og.update_by, og.number_id, ot.tank_name,
og.oil_machine_gun_number
from oil_gun og left join oil_tank ot on og.tank_id = ot.id
<where>
<if test="oilGun.id != null">
and id = #{oilGun.id}
and og.id = #{oilGun.id}
</if>
<if test="oilGun.gunName != null and oilGun.gunName != ''">
and gun_name = #{oilGun.gunName}
and og.gun_name = #{oilGun.gunName}
</if>
<if test="oilGun.tankId != null">
and tank_id = #{oilGun.tankId}
and og.tank_id = #{oilGun.tankId}
</if>
<if test="oilGun.status != null and oilGun.status != ''">
and status = #{oilGun.status}
and og.status = #{oilGun.status}
</if>
<if test="oilGun.storeId != null">
and store_id = #{oilGun.storeId}
</if>
<if test="oilGun.createTime != null">
and create_time = #{oilGun.createTime}
</if>
<if test="oilGun.updateTime != null">
and update_time = #{oilGun.updateTime}
</if>
<if test="oilGun.createBy != null">
and create_by = #{oilGun.createBy}
and og.store_id = #{oilGun.storeId}
</if>
<if test="oilGun.updateBy != null">
and update_by = #{oilGun.updateBy}
and og.update_by = #{oilGun.updateBy}
</if>
</where>
</select>
@ -137,11 +131,19 @@
</if>
</where>
</select>
<select id="checkData" resultType="com.fuint.business.petrolStationManagement.entity.OilGun">
select id
from oil_gun
where
gun_name = #{oilGun.gunName}
and tank_id = #{oilGun.tankId}
and store_id = #{oilGun.storeId}
</select>
<!--新增所有列-->
<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)
values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
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}, #{updateTime}, #{createBy}, #{updateBy}, #{numberId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@ -197,6 +199,9 @@
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="numberId != null">
number_id = #{numberId},
</if>
</set>
where id = #{id}
</update>

View File

@ -0,0 +1,199 @@
<?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.OilPurchaseOrderMapper">
<resultMap type="com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder" id="OilPurchaseOrderMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="purchaseId" column="purchase_id" jdbcType="INTEGER"/>
<result property="numberId" column="number_id" jdbcType="INTEGER"/>
<result property="tankId" column="tank_id" jdbcType="INTEGER"/>
<result property="supplierId" column="supplier_id" jdbcType="INTEGER"/>
<result property="productDensity" column="product_density" jdbcType="NUMERIC"/>
<result property="purchaseWeight" column="purchase_weight" jdbcType="NUMERIC"/>
<result property="purchasePrice" column="purchase_price" jdbcType="NUMERIC"/>
<result property="totalAmount" column="total_amount" jdbcType="NUMERIC"/>
<result property="purchaseVolume" column="purchase_volume" jdbcType="NUMERIC"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="OilPurchaseOrderMap">
select
id, purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume
from oil_purchase_order
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="OilPurchaseOrderMap">
select
id, purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume
from oil_purchase_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="purchaseId != null">
and purchase_id = #{purchaseId}
</if>
<if test="numberId != null">
and number_id = #{numberId}
</if>
<if test="tankId != null">
and tank_id = #{tankId}
</if>
<if test="supplierId != null">
and supplier_id = #{supplierId}
</if>
<if test="productDensity != null">
and product_density = #{productDensity}
</if>
<if test="purchaseWeight != null">
and purchase_weight = #{purchaseWeight}
</if>
<if test="purchasePrice != null">
and purchase_price = #{purchasePrice}
</if>
<if test="totalAmount != null">
and total_amount = #{totalAmount}
</if>
<if test="purchaseVolume != null">
and purchase_volume = #{purchaseVolume}
</if>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from oil_purchase_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="purchaseId != null">
and purchase_id = #{purchaseId}
</if>
<if test="numberId != null">
and number_id = #{numberId}
</if>
<if test="tankId != null">
and tank_id = #{tankId}
</if>
<if test="supplierId != null">
and supplier_id = #{supplierId}
</if>
<if test="productDensity != null">
and product_density = #{productDensity}
</if>
<if test="purchaseWeight != null">
and purchase_weight = #{purchaseWeight}
</if>
<if test="purchasePrice != null">
and purchase_price = #{purchasePrice}
</if>
<if test="totalAmount != null">
and total_amount = #{totalAmount}
</if>
<if test="purchaseVolume != null">
and purchase_volume = #{purchaseVolume}
</if>
</where>
</select>
<select id="getList" resultType="com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO">
SELECT
opo.id id,
opo.product_density productDensity,
opo.purchase_weight purchaseWeight,
opo.purchase_price purchasePrice,
opo.total_amount totalAmount,
opo.purchase_volume purchaseVolume,
opo.discounted_price discountedPrice,
onn.oil_type oilType,
onn.oil_name oilName,
os.supplier_name supplierName,
ot.tank_name tankName,
ot.stored_quantity storedQuantity,
CONCAT(onn.oil_type,' ',onn.oil_name) numberName
FROM
oil_purchase_order opo
LEFT JOIN oil_purchase op ON opo.purchase_id = op.id
LEFT JOIN oil_number o ON o.number_id = opo.number_id
LEFT JOIN oil_name onn ON onn.id = o.oil_name
LEFT JOIN oil_tank ot ON ot.id = opo.tank_id
LEFT JOIN oil_suppliers os ON os.id = opo.supplier_id
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_purchase_order(purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume)
values (#{purchaseId}, #{numberId}, #{tankId}, #{supplierId}, #{productDensity}, #{purchaseWeight}, #{purchasePrice}, #{totalAmount}, #{purchaseVolume})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_purchase_order(purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.purchaseId}, #{entity.numberId}, #{entity.tankId}, #{entity.supplierId}, #{entity.productDensity}, #{entity.purchaseWeight}, #{entity.purchasePrice}, #{entity.totalAmount}, #{entity.purchaseVolume})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into oil_purchase_order(purchase_id, number_id, tank_id, supplier_id, product_density, purchase_weight, purchase_price, total_amount, purchase_volume)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.purchaseId}, #{entity.numberId}, #{entity.tankId}, #{entity.supplierId}, #{entity.productDensity}, #{entity.purchaseWeight}, #{entity.purchasePrice}, #{entity.totalAmount}, #{entity.purchaseVolume})
</foreach>
on duplicate key update
purchase_id = values(purchase_id),
number_id = values(number_id),
tank_id = values(tank_id),
supplier_id = values(supplier_id),
product_density = values(product_density),
purchase_weight = values(purchase_weight),
purchase_price = values(purchase_price),
total_amount = values(total_amount),
purchase_volume = values(purchase_volume)
</insert>
<!--通过主键修改数据-->
<update id="update">
update oil_purchase_order
<set>
<if test="purchaseId != null">
purchase_id = #{purchaseId},
</if>
<if test="numberId != null">
number_id = #{numberId},
</if>
<if test="tankId != null">
tank_id = #{tankId},
</if>
<if test="supplierId != null">
supplier_id = #{supplierId},
</if>
<if test="productDensity != null">
product_density = #{productDensity},
</if>
<if test="purchaseWeight != null">
purchase_weight = #{purchaseWeight},
</if>
<if test="purchasePrice != null">
purchase_price = #{purchasePrice},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount},
</if>
<if test="purchaseVolume != null">
purchase_volume = #{purchaseVolume},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from oil_purchase_order where id = #{id}
</delete>
</mapper>

View File

@ -13,6 +13,7 @@
<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="storeId" column="store_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
@ -29,35 +30,38 @@
id, supplier_name, contact_person, contact_phone, contact_address, remarks, create_time, update_time, create_by, update_by
from oil_suppliers
<where>
<if test="id != null">
and id = #{id}
<if test="oilSuppliers.id != null">
and id = #{oilSuppliers.id}
</if>
<if test="supplierName != null and supplierName != ''">
and supplier_name = #{supplierName}
<if test="oilSuppliers.supplierName != null and oilSuppliers.supplierName != ''">
and supplier_name LIKE CONCAT('%', #{oilSuppliers.supplierName}, '%')
</if>
<if test="contactPerson != null and contactPerson != ''">
and contact_person = #{contactPerson}
<if test="oilSuppliers.contactPerson != null and oilSuppliers.contactPerson != ''">
and contact_person LIKE CONCAT('%', #{oilSuppliers.contactPerson}, '%')
</if>
<if test="contactPhone != null and contactPhone != ''">
and contact_phone = #{contactPhone}
<if test="oilSuppliers.contactPhone != null and oilSuppliers.contactPhone != ''">
and contact_phone LIKE CONCAT('%', #{oilSuppliers.contactPhone}, '%')
</if>
<if test="contactAddress != null and contactAddress != ''">
<if test="oilSuppliers.contactAddress != null and oilSuppliers.contactAddress != ''">
and contact_address = #{contactAddress}
</if>
<if test="remarks != null and remarks != ''">
and remarks = #{remarks}
<if test="oilSuppliers.remarks != null and oilSuppliers.remarks != ''">
and remarks = #{oilSuppliers.remarks}
</if>
<if test="createTime != null">
and create_time = #{createTime}
<if test="oilSuppliers.createTime != null">
and create_time = #{oilSuppliers.createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
<if test="oilSuppliers.updateTime != null">
and update_time = #{oilSuppliers.updateTime}
</if>
<if test="createBy != null">
and create_by = #{createBy}
<if test="oilSuppliers.createBy != null">
and create_by = #{oilSuppliers.createBy}
</if>
<if test="updateBy != null">
and update_by = #{updateBy}
<if test="oilSuppliers.updateBy != null">
and update_by = #{oilSuppliers.updateBy}
</if>
<if test="oilSuppliers.storeId != null">
and store_id = #{oilSuppliers.storeId}
</if>
</where>
</select>
@ -102,8 +106,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_suppliers(supplier_name, contact_person, contact_phone, contact_address, remarks, create_time, update_time, create_by, update_by)
values (#{supplierName}, #{contactPerson}, #{contactPhone}, #{contactAddress}, #{remarks}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
insert into oil_suppliers(supplier_name, contact_person, contact_phone, contact_address, remarks, create_time, update_time, create_by, update_by,store_id)
values (#{supplierName}, #{contactPerson}, #{contactPhone}, #{contactAddress}, #{remarks}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy}, #{storeId})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
@ -163,6 +167,9 @@
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="storeId != null">
store_id = #{storeId},
</if>
</set>
where id = #{id}
</update>

View File

@ -92,7 +92,7 @@
</where>
</select>
<select id="selectList" resultType="com.fuint.business.petrolStationManagement.entity.OilTank">
<select id="selectList" resultMap="OilTankMap">
select
id, tank_name, oil_number, tank_volume, lower_warning, oil_density, stored_quantity, total_price, discounted_price, status, remarks, store_id, number_id, create_time, update_time, create_by, update_by, inventory_statistics, unit
from oil_tank

View File

@ -43,7 +43,7 @@ public interface OilGunService {
* @param oilGun 实例对象
* @return 实例对象
*/
OilGun insert(OilGun oilGun);
boolean insert(OilGun oilGun);
/**
* 修改数据
@ -51,7 +51,7 @@ public interface OilGunService {
* @param oilGun 实例对象
* @return 实例对象
*/
OilGun update(OilGun oilGun);
boolean update(OilGun oilGun);
/**
* 通过主键删除数据

View File

@ -0,0 +1,62 @@
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.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO;
import org.apache.ibatis.annotations.Param;
/**
* (OilPurchaseOrder)表服务接口
*
* @author makejava
* @since 2023-10-18 15:32:19
*/
public interface OilPurchaseOrderService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
OilPurchaseOrder queryById(Integer id);
/**
* 分页查询
*
* @param oilPurchaseOrder 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<OilPurchaseOrder> queryByPage(@Param("page") Page page, OilPurchaseOrder oilPurchaseOrder);
IPage<OilPurchaseOrderVO> getList(@Param("page") Page page, OilPurchaseOrder oilPurchaseOrder);
/**
* 新增数据
*
* @param oilPurchaseOrder 实例对象
* @return 实例对象
*/
OilPurchaseOrder insert(OilPurchaseOrder oilPurchaseOrder);
/**
* 修改数据
*
* @param oilPurchaseOrder 实例对象
* @return 实例对象
*/
OilPurchaseOrder update(OilPurchaseOrder oilPurchaseOrder);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -35,7 +35,7 @@ public interface OilTankService {
IPage<OilTank> queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank);
List<OilTank> selectList(OilTank oilTank);
List<OilTank> selectList(Integer numberId);
/**
* 新增数据

View File

@ -65,9 +65,11 @@ public class OilGunServiceImpl implements OilGunService {
List<OilGunVO> oilName = oilGunDao.getOilName(nowAccountInfo.getStoreId());
// 根据店铺id查询所有油枪
List<OilGun> allList = oilGunDao.getAllList(oilGun);
if (oilName.size() <= 0 || allList.size() <= 0){
return oilName;
}
for (OilGunVO oilNumber : oilName) {
List<OilGun> oilGunList = new ArrayList<>();
for (OilGun gun : allList) {
if (oilNumber.getNumberId().equals(gun.getNumberId())) {
oilGunList.add(gun);
@ -75,8 +77,6 @@ public class OilGunServiceImpl implements OilGunService {
}
oilNumber.setOilGunList(oilGunList);
}
return oilName;
}
@ -87,9 +87,21 @@ public class OilGunServiceImpl implements OilGunService {
* @return 实例对象
*/
@Override
public OilGun insert(OilGun oilGun) {
this.oilGunDao.insert(oilGun);
return oilGun;
public boolean insert(OilGun oilGun) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilGun.setStoreId(accountInfo.getStoreId());
boolean check = checkData(oilGun);
if (check) {
return false;
}
oilGun.setCreateBy(accountInfo.getId().toString());
return this.oilGunDao.insert(oilGun)>0;
}
// 判断是否有同一名称的数据
public boolean checkData(OilGun oilGun) {
List<OilGun> oilGunList = oilGunDao.checkData(oilGun);
return oilGunList.size() > 0;
}
/**
@ -99,9 +111,15 @@ public class OilGunServiceImpl implements OilGunService {
* @return 实例对象
*/
@Override
public OilGun update(OilGun oilGun) {
this.oilGunDao.update(oilGun);
return this.queryById(oilGun.getId());
public boolean update(OilGun oilGun) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilGun.setStoreId(accountInfo.getStoreId());
boolean check = checkData(oilGun);
if (check) {
return false;
}
oilGun.setUpdateBy(accountInfo.getId().toString());
return this.oilGunDao.update(oilGun)>0;
}
/**

View File

@ -0,0 +1,95 @@
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.OilPurchaseOrder;
import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper;
import com.fuint.business.petrolStationManagement.service.OilPurchaseOrderService;
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.stereotype.Service;
import javax.annotation.Resource;
/**
* (OilPurchaseOrder)表服务实现类
*
* @author makejava
* @since 2023-10-18 15:32:19
*/
@Service("oilPurchaseOrderService")
public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService {
@Resource
private OilPurchaseOrderMapper oilPurchaseOrderDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public OilPurchaseOrder queryById(Integer id) {
return this.oilPurchaseOrderDao.queryById(id);
}
/**
* 分页查询
*
* @param oilPurchaseOrder 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<OilPurchaseOrder> queryByPage(@Param("page") Page page, OilPurchaseOrder oilPurchaseOrder) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilPurchaseOrder.setStoreId(nowAccountInfo.getStoreId());
return oilPurchaseOrderDao.queryAllByLimit(page, oilPurchaseOrder);
}
@Override
public IPage<OilPurchaseOrderVO> getList(@Param("page") Page page, OilPurchaseOrder oilPurchaseOrder) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilPurchaseOrder.setStoreId(nowAccountInfo.getStoreId());
return oilPurchaseOrderDao.getList(page, oilPurchaseOrder);
}
/**
* 新增数据
*
* @param oilPurchaseOrder 实例对象
* @return 实例对象
*/
@Override
public OilPurchaseOrder insert(OilPurchaseOrder oilPurchaseOrder) {
this.oilPurchaseOrderDao.insert(oilPurchaseOrder);
return oilPurchaseOrder;
}
/**
* 修改数据
*
* @param oilPurchaseOrder 实例对象
* @return 实例对象
*/
@Override
public OilPurchaseOrder update(OilPurchaseOrder oilPurchaseOrder) {
this.oilPurchaseOrderDao.update(oilPurchaseOrder);
return this.queryById(oilPurchaseOrder.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.oilPurchaseOrderDao.deleteById(id) > 0;
}
}

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilSuppliers;
import com.fuint.business.petrolStationManagement.mapper.OilSuppliersMapper;
import com.fuint.business.petrolStationManagement.service.OilSuppliersService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
@ -41,6 +43,8 @@ public class OilSuppliersServiceImpl implements OilSuppliersService {
*/
@Override
public IPage<OilSuppliers> queryByPage(@Param("page") Page page, @Param("oilSuppliers") OilSuppliers oilSuppliers) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilSuppliers.setStoreId(nowAccountInfo.getStoreId());
return oilSuppliersDao.queryAllByLimit(page, oilSuppliers);
}
@ -52,6 +56,9 @@ public class OilSuppliersServiceImpl implements OilSuppliersService {
*/
@Override
public OilSuppliers insert(OilSuppliers oilSuppliers) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilSuppliers.setStoreId(nowAccountInfo.getStoreId());
oilSuppliers.setCreateBy(nowAccountInfo.getId().toString());
this.oilSuppliersDao.insert(oilSuppliers);
return oilSuppliers;
}
@ -64,6 +71,8 @@ public class OilSuppliersServiceImpl implements OilSuppliersService {
*/
@Override
public OilSuppliers update(OilSuppliers oilSuppliers) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilSuppliers.setUpdateBy(nowAccountInfo.getId().toString());
this.oilSuppliersDao.update(oilSuppliers);
return this.queryById(oilSuppliers.getId());
}

View File

@ -40,7 +40,6 @@ public class OilTankServiceImpl implements OilTankService {
* 分页查询
*
* @param oilTank 筛选条件
* @param pageRequest 分页对象
* @return 查询结果
*/
@Override
@ -51,8 +50,13 @@ public class OilTankServiceImpl implements OilTankService {
}
@Override
public List<OilTank> selectList(OilTank oilTank) {
return null;
public List<OilTank> selectList(Integer numberId) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
System.out.println("oilTank"+numberId);
OilTank oilTank = new OilTank();
oilTank.setStoreId(accountInfo.getStoreId());
oilTank.setNumberId(numberId);
return oilTankDao.selectList(oilTank);
}
/**

View File

@ -0,0 +1,15 @@
package com.fuint.business.petrolStationManagement.vo;
import com.fuint.business.petrolStationManagement.entity.OilPurchase;
import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder;
import lombok.Data;
@Data
public class OilPurchaseOrderVO extends OilPurchaseOrder {
private String oilType;
private String oilName;
private String tankName; // 油罐名称
private String supplierName; // 供应商名称
private String storedQuantity; // 库存数量
private String numberName; //
}