油站结尾 - 进货开头

This commit is contained in:
DESKTOP-369JRHT\12997 2023-10-26 13:52:13 +08:00
parent 90b60aaadc
commit 2eae3a90aa
32 changed files with 2140 additions and 73 deletions

View File

@ -0,0 +1,25 @@
import request from '@/utils/request'
/**
* 订单
*/
export function getPurchasePageApi(query) {
return request({
url: '/business/convenience/supplier/list',
method: 'get',
params: query
})
}
/**
* 订单详情
*/
// 新增供应商
export function addSupplier(data) {
return request({
url: '/business/convenience/supplier',
method: 'post',
data: data
})
}

View File

@ -35,4 +35,14 @@ export function cleanTankApi(data) {
})
}
// 初始化信息
export function exportExcelTankApi(data) {
return request({
url: 'business/petrolStationManagement/oilTank/exportExcel',
method: 'post',
responseType:'blob',
data: data
})
}

View File

@ -116,12 +116,21 @@ export const constantRoutes = [
name: 'Profile',
meta: { title: '盘点详情', icon: 'user' }
},
// {
// path: 'list',
// component: () => import('@/views/oilConfig/oilInventory/list'),
// name: 'Profile',
// meta: { title: '油站进油', icon: 'user' }
// }
]
},
{
path: '/purchase',
component: Layout,
hidden: true,
redirect: 'noredirect',
children: [
{
path: 'details',
component: () => import('@/views/convenienceStore/purchase/details'),
name: 'Profile',
meta: { title: '盘点详情', icon: 'user' }
},
]
},
]

View File

@ -0,0 +1,374 @@
<template>
<div class="app-container">
<el-card >
<div slot="header" class="clearfix">
<i class="el-icon-back" @click="goToAbout">返回 | </i>
<!-- <el-link icon="el-icon-edit" :underline="false" @click="goToAbout">编辑</el-link>-->
<span> 盘点详情</span>
</div>
<div style="height: 90px; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 50%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 70%; display: flex; justify-content: space-between;">
<div class="box">
<span>{{purchaseForm.totalAmount}}</span>
<span>总金额</span>
</div>
<div class="box">
<span>{{purchaseForm.productQuantity}}</span>
<span>商品数量</span>
</div>
<div class="box">
<span>{{purchaseForm.quantityPurchased}}</span>
<span>进货数量</span>
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; flex-direction: column; justify-content: space-between;">
<el-form ref="myForm" label-width="100px">
<el-form-item label="盘点单号">
<el-input v-model="purchaseForm.orderNumber"
style="width: 220Px">
<el-button slot="append" @click="refresh()" icon="el-icon-refresh"></el-button>
</el-input>
</el-form-item>
<el-form-item label="盘点时间" >
<el-date-picker
style="width: 220Px"
v-model="purchaseForm.orderDate"
type="date"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form>
</div>
</div>
<div style="height: 100%; width: 30%; display: flex; align-items: center; justify-content: flex-end;">
<el-button type="primary" v-if="state=='await'" :disabled="saveFlag" @click="save()">保存</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 =='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
</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="commodityAdd"
>添加进货</el-button>
</el-col>
<el-col :span="1.5">
<el-alert
title="为了保证盘点我准确性,请在非收银期间段内进行盘点、否则会导致盘点信息异常"
:closable="false"
type="error">
</el-alert>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="detailsList"
:default-sort="defaultSort">
<el-table-column label="油罐名称" align="center" prop="tankName"/>
<el-table-column label="油品名称" align="center" prop="numberName"/>
<el-table-column label="当前均进价" align="center" prop="currentAveragePrice" />
<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 :disabled="false" 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="盈亏金额" 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"
type="text"
icon="el-icon-edit"
@click="commodityDel(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="800px" append-to-body :close-on-click-modal="false">-->
<!-- <el-container>-->
<!-- <el-header style="">-->
<!-- <el-form ref="tankForm" :model="commodityForm" label-width="80px">-->
<!-- <el-row :gutter="24">-->
<!-- <el-col :span="10">-->
<!-- <el-form-item label="选择油号">-->
<!-- <el-select v-model="commodityForm.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-col>-->
<!-- <el-col :span="10">-->
<!-- <el-form-item label="油罐名称">-->
<!-- <el-input v-model="tankForm.tankName"></el-input>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="4">-->
<!-- <el-button type="primary" @click="inquireTank()">查询</el-button>-->
<!-- </el-col>-->
<!-- </el-row>-->
<!-- </el-form>-->
<!-- </el-header>-->
<!-- <el-main>-->
<!-- <el-table ref="tables"-->
<!-- v-loading="loading"-->
<!-- :data="tankList"-->
<!-- @selection-change="handleSelectionChange"-->
<!-- border-->
<!-- :default-sort="defaultSort">-->
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55">-->
<!-- </el-table-column>-->
<!-- <el-table-column label="油罐名称" align="center" prop="tankName"/>-->
<!-- <el-table-column label="油品" align="center" prop="oilNumber"/>-->
<!-- <el-table-column label="当前均价(元/升)" align="center" prop="discountedPrice" />-->
<!-- <el-table-column label="当前库存(L)" align="center" prop="storedQuantity"/>-->
<!-- </el-table>-->
<!-- </el-main>-->
<!-- </el-container>-->
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="addOrder"> </el-button>-->
<!-- <el-button @click="cancel"> </el-button>-->
<!-- </div>-->
<!-- </el-dialog>-->
</div>
</template>
<script>
import {getAuditPremApi} from "@/api/oilConfig/staff";
import {abolitionInventoryApi, auditInventoryApi, storageInventoryApi} from "@/api/oilConfig/oilInventory";
export default {
name: "details",
data() {
return {
detailsList: [],
commodityForm:{
},
purchaseForm: {
orderNumber: "",
approvalStatus: "",
orderDate: "",
totalAmount: 0, //
productQuantity: 0, //
quantityPurchased: 0 //
} ,
state:'',
saveFlag:false,
auditFlag:false,
voidFlag:false,
storageFlag:true,
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
//
queryParams: {
supplierId: '',
inventoryId: null,
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
],
},
}
},
async created() {
},
methods: {
//
goToAbout() {
this.$router.push('/convenienceStore/purchase/details');
},
commodityAdd() {
},
commodityDel() {
},
//
refresh() {
let timestamp = new Date().getTime();
let min = 100; // 1000
let max = 999; // 9999
let randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.inventoryNo.inventoryNo = timestamp+randomFourDigitNumber.toString();
},
//
async JudgmentButton(){
let judgmentPermissions1 = await this.judgmentPermissions("盘点审核");
if (judgmentPermissions1 > 0){
this.auditFlag=false,
this.voidFlag=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
}
},
//
async judgmentPermissions(data) {
let fil ={
auditPrem:data
}
return await getAuditPremApi(fil).then(res => {
return res.data
});
},
//
save(){
//
let number = this.saveInventory();
if (number != -1) {
//
let fil ={
id: this.inventoryId
}
console.log(" id: this.purchaseId",fil)
auditInventoryApi(fil).then(res => {
this.state = 'ysh'
this.$modal.msgWarning("审核成功");
this.goToAbout()
})
}
},
//
audit() {
let this_ = this;
if (this_.inventoryNo.inventoryNo == null) {
this.$modal.msgWarning("请先选择进货单号");
return;
}else if (this_.inventoryNo.inventoryDate==null) {
this.$modal.msgWarning("请先选择进货时间");
return;
}
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.inventoryId < 0) {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
}
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>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
</style>

View File

@ -0,0 +1,175 @@
<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="tankName">
<el-input v-model="queryParams.inventoryNumber" placeholder="请输入业务单号名称" />
</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
v-for="dict in dict.type.oilPurchasedStatus"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="日期选择" prop="status">-->
<!-- <el-date-picker-->
<!-- v-model="dateRange"-->
<!-- type="datetimerange"-->
<!-- range-separator="至"-->
<!-- start-placeholder="开始日期"-->
<!-- end-placeholder="结束日期">-->
<!-- </el-date-picker>-->
<!-- </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="detailsAdd"
>添加盘点</el-button>
</el-col>
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
</el-row>
<el-table ref="tables"
v-loading="loading"
:data="inventoryList"
:default-sort="defaultSort">
<el-table-column label="业务单号" align="center" prop="inventoryNumber"/>
<el-table-column label="盘点详情" align="center">
<el-table-column label="盘点油罐" align="center" prop="tanks"/>
<el-table-column label="盘点升数" align="center" prop="inventoryVolume"/>
<el-table-column label="库存差异升数" align="center" prop="stockDifference"/>
<el-table-column label="盈亏金额" align="center" prop="profitLossAmount"/>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<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>
</div>
</template>
</el-table-column>
<el-table-column label="操作人信息" align="center">
<el-table-column label="制单人" align="center" prop="creatorName"/>
<el-table-column label="审核人" align="center" prop="reviewerName"/>
</el-table-column>
<el-table-column label="制单日期" align="center" prop="orderTime" width="200">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.orderTime) }}</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="dispose(scope.row)"
>处理单据</el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-copy-document"-->
<!-- @click="handleDel(scope.row.id)"-->
<!-- >删除</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>
</div>
</template>
<script>
import {getInventoryApi} from "@/api/oilConfig/oilInventory";
export default {
name: "index",
dicts: ['oilPurchasedStatus'],
data() {
return {
purchaseList:[],
//
title:'',
//
showSearch: true,
disableInput: false, //
//
open: false,
//
total: 0,
dateRange: '',
//
queryParams: {
inventoryNumber:'',
status: '',
page:null,
pageSize:null
},
//
loading: false,
//
defaultSort: {prop: 'createTime', order: 'descending'},
}
},
async created() {
// await this.getList();
},
methods: {
//
getList(){
this.loading = true;
getInventoryApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.inventoryList = response.data.records;
this.total = response.data.total;
})
this.loading = false;
},
detailsAdd() {
this.$router.push('/purchase/details');
}
}
}
</script>
<style scoped>
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
</style>

View File

@ -40,7 +40,8 @@
title="编辑油枪"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose">
:before-close="handleClose"
:close-on-click-modal="false">
<el-form :model="gunForm" :rules="rules" ref="gunForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="油枪名称" prop="gunName">
@ -69,33 +70,23 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<!-- <el-radio-group v-model="gunForm.status">-->
<el-radio-group v-model="statusOut">
<el-radio-group v-model="gunForm.status">
<el-radio
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
@change="handleIsopenSelect"
/>
</el-radio-group>
</el-form-item>
<!-- <el-form-item>-->
<!-- </el-form-item>-->
</el-form>
<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="submitForm()"> </el-button>
</span>
</el-dialog>
</div>
</template>
@ -155,9 +146,9 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
gunName: [
{ required: true, message: '请输入油罐名称', trigger: 'blur' },
],
status: [
{ required: true, message: '请选择状态', trigger: 'change' }
],
// status: [
// { required: true, message: '', trigger: 'change' }
// ],
tankId: [
{ required: true, message: '请选择所属油罐', trigger: 'change' }
],
@ -170,7 +161,9 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
await this_.getList()
},
methods:{
handleIsopenSelect() {
this.$forceUpdate()
},
getList() {
getGunApi().then(response => {
this.gunList = response.data;
@ -182,9 +175,7 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
this_.dialogVisible = true;
this_.judgement = false;
this_.gunForm = {} //
// this.gunForm.status = ''
this.statusOut = '启用',
this_.gunForm.status = '启用'
this_.selectTankByNumber(numberId)
},
gunEdit(data) {
@ -221,7 +212,6 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
});
},
submitForm() {
this.gunForm.status = this.statusOut
this.$refs["gunForm"].validate((valid) => {
if (valid) {
// numberId
@ -241,9 +231,6 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
}
}).catch(reason => {
console.log("reason",reason)
// this.dialogVisible = true;
});
} else {
updateGunApi(this.gunForm).then(response => {
@ -257,13 +244,10 @@ import {cleanTankApi} from "@/api/oilConfig/oilTank";
this.dialogVisible = false
} else {
console.log('error submit!!');
return false;
}
this.getList();
});
this.getList();
},
chooseName() {
var this_ = this

View File

@ -120,7 +120,7 @@
</el-card>
<!-- 添加采购油品-->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
<el-container>
<el-header style="">
<el-form ref="tankForm" :model="tankForm" label-width="80px">

View File

@ -120,7 +120,7 @@
</el-card>
<!-- 添加采购油品-->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="orderForm" :rules="rules" label-width="120px">
<el-row :gutter="24">
<el-col :span="22">

View File

@ -50,7 +50,7 @@
<el-col :span="1.5">
<h3>油罐列表</h3>
</el-col>
<!-- <el-button @click="exportExcelTank()">导出</el-button>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">123123123</right-toolbar>-->
</el-row>
@ -69,7 +69,7 @@
<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>
<el-tag v-if ="scope.row.inventoryStatistics == ''" type="danger" size="medium"></el-tag>
</div>
</template>
</el-table-column>
@ -159,16 +159,14 @@
:limit.sync="queryParams2.pageSize"
@pagination="getTrackingList"
/>
</el-card>
</div>
</el-drawer>
</div>
</template>
<script>
import {getTankApi} from "@/api/oilConfig/oilTank";
import {exportExcelTankApi, getTankApi} from "@/api/oilConfig/oilTank";
import {getTrackingApi} from "@/api/oilConfig/oilStatistics";
import {getOilNameListApi} from "@/api/oilPrice";
@ -220,6 +218,22 @@ export default {
this_.getOilNameList()
},
methods: {
exportExcelTank() {
console.log("resbgdfgddffffffffffffffffffffffffffffffffffffffffffffffff")
exportExcelTankApi().then(res=>{
console.log("res",res)
const blob = new Blob([res], {
type: 'application/vnd.ms-excel'
});
let link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.setAttribute('download', '存油统计.xlsx');
link.click();
link = null;
})
},
getList() {
getTankApi(this.queryParams).then(res=>{
this.statisticsList = res.data.records

View File

@ -85,7 +85,7 @@
</el-card>
<!-- 新增/修改-->
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="suppliersForm" :rules="rules" label-width="120px">
<el-row :gutter="24">
<el-col :span="20">

View File

@ -83,7 +83,7 @@
</el-card>
<!-- 新增/修改-->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="tankForm" :rules="rules" label-width="120px">
<el-row :gutter="24">
<el-col :span="16">
@ -107,21 +107,21 @@
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="油罐体积" prop="tankVolume">
<el-input v-model.number="tankForm.tankVolume" placeholder="请输入油罐体积" maxlength="30">
<el-input v-model="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.number="tankForm.lowerWarning" placeholder="小于预警值将进行提示" maxlength="30">
<el-input v-model="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="oilDensity">
<el-input v-model.number="tankForm.oilDensity" placeholder="请输入油品密度" maxlength="30">
<el-input v-model="tankForm.oilDensity" placeholder="请输入油品密度" maxlength="30">
<template slot="append">g/ml</template>
</el-input>
</el-form-item>
@ -130,21 +130,21 @@
<el-row :gutter="24">
<el-col :span="8">
<el-form-item label="存油数量" prop="storedQuantity">
<el-input v-model.number="tankForm.storedQuantity" placeholder="请输入存油数量" maxlength="30" @input="changePrice() " :disabled="disableInput">
<el-input v-model="tankForm.storedQuantity" placeholder="请输入存油数量" maxlength="30" @input="changePrice() " :disabled="disableInput">
<template slot="append">{{tankForm.unit}}</template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="存油总价" prop="totalPrice" >
<el-input v-model.number="tankForm.totalPrice" placeholder="请输入存油总价" maxlength="30" @input="changePrice()" :disabled="disableInput">
<el-input v-model="tankForm.totalPrice" placeholder="请输入存油总价" maxlength="30" @input="changePrice()" :disabled="disableInput">
<template slot="append"></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="折合单价" prop="discountedPrice">
<el-input v-model.number="tankForm.discountedPrice" placeholder="请输入折合单价" maxlength="30" :disabled="disableInput">
<el-input v-model="tankForm.discountedPrice" placeholder="请输入折合单价" maxlength="30" :disabled="disableInput">
<template slot="append"></template>
</el-input>
</el-form-item>
@ -159,6 +159,7 @@
:key="dict.value"
:label="dict.label"
:value="dict.value"
@change="handleIsopenSelect"
/>
</el-radio-group>
</el-form-item>
@ -171,6 +172,7 @@
:key="dict.value"
:label="dict.label"
:value="dict.value"
@change="handleIsopenSelect"
/>
</el-radio-group>
</el-form-item>
@ -197,7 +199,7 @@
</template>
<script>
import {cleanTankApi, getTankApi, insertTankApi, updateTankApi} from "@/api/oilConfig/oilTank";
import {cleanTankApi, exportExcelTankApi, getTankApi, insertTankApi, updateTankApi} from "@/api/oilConfig/oilTank";
import {getName,parseTime} from "../../../utils/fuint";
import {addStaff, updateStaff} from "@/api/staff/staff";
import {getOilNameListApi} from "@/api/oilPrice";
@ -221,7 +223,6 @@ export default {
};
return {
// form :{},
//
title:'',
tankList: [], //
@ -293,10 +294,10 @@ export default {
{ required: true, validator:valiNumberPass, trigger: "blur" }
],
status: [
{ required: true, message: "请选择", trigger: "blur" }
{ required: true, message: "请选择对应状态", trigger: "blur" }
],
inventoryStatistics: [
{ required: true, message: "请选择", trigger: "blur" }
{ required: true, message: "请选择对应状态", trigger: "blur" }
]
}
}
@ -306,19 +307,19 @@ export default {
await this_.getList()
},
methods: {
handleIsopenSelect() {
this.$forceUpdate()
},
getList() {
this.loading = true;
getTankApi(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tankList = response.data.records;
console.log("this.tankList",this.tankList)
this.total = response.data.total;
// response.data.records.forEach(item=>{
// this.categoryOptions.push(item.category)
})
this.loading = false;
})
this.loading = false;
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {
@ -326,8 +327,6 @@ export default {
if (valid) {
if (!this.tankForm.id) {
console.log("this.tankFormthis.tankForm33333",this.tankForm)
insertTankApi(this.tankForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
@ -346,7 +345,6 @@ export default {
//
handleUpdate(data) {
console.log("datadata",data)
this.disableInput = true
let this_ = this
this_.tankForm = data
@ -395,7 +393,7 @@ export default {
//
let this_ = this
this_.tankForm = {}
this_.tankForm.status= 'qy',
this_.tankForm.status= '启用',
this_.tankForm.inventoryStatistics= '启用',
this_.disableInput = false
@ -417,11 +415,7 @@ export default {
changePrice() {
var this_=this
console.log("nonono",this_.tankForm)
if (this_.tankForm.totalPrice != null && this_.tankForm.storedQuantity != null) {
console.log("进入")
// this_.tankForm.discountedPrice =
var totalPrice = BigNumber(this_.tankForm.totalPrice);
var storedQuantity = BigNumber(this_.tankForm.storedQuantity);
this_.tankForm.discountedPrice = totalPrice.dividedBy(storedQuantity).toNumber();

View File

@ -0,0 +1,91 @@
package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtPurchase;
import com.fuint.business.convenienceSore.service.MtPurchaseService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 商品进货表(MtPurchase)表控制层
*
* @author makejava
* @since 2023-10-26 11:49:45
*/
@RestController
@RequestMapping("/business/convenience/mtPurchase")
public class MtPurchaseController extends BaseController {
/**
* 服务对象
*/
@Resource
private MtPurchaseService mtPurchaseService;
/**
* 分页查询
*
* @param mtPurchase 筛选条件
* @return 查询结果
*/
@GetMapping("/queryByPage")
public ResponseObject queryByPage(MtPurchase mtPurchase,
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
IPage<MtPurchase> list = mtPurchaseService.queryByPage(page,mtPurchase);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseEntity<MtPurchase> queryById(@PathVariable("id") Integer id) {
return ResponseEntity.ok(this.mtPurchaseService.queryById(id));
}
/**
* 新增数据
*
* @param mtPurchase 实体
* @return 新增结果
*/
@PostMapping
public ResponseEntity<MtPurchase> add(MtPurchase mtPurchase) {
return ResponseEntity.ok(this.mtPurchaseService.insert(mtPurchase));
}
/**
* 编辑数据
*
* @param mtPurchase 实体
* @return 编辑结果
*/
@PutMapping
public ResponseEntity<MtPurchase> edit(MtPurchase mtPurchase) {
return ResponseEntity.ok(this.mtPurchaseService.update(mtPurchase));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(Integer id) {
return ResponseEntity.ok(this.mtPurchaseService.deleteById(id));
}
}

View File

@ -0,0 +1,88 @@
package com.fuint.business.convenienceSore.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.service.MtPurchaseDetailsService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 进货详情表(MtPurchaseDetails)表控制层
*
* @author makejava
* @since 2023-10-26 11:50:36
*/
@RestController
@RequestMapping("/business/convenience/mtPurchaseDetails")
public class MtPurchaseDetailsController extends BaseController {
/**
* 服务对象
*/
@Resource
private MtPurchaseDetailsService mtPurchaseDetailsService;
/**
* 分页查询
*
* @param mtPurchaseDetails 筛选条件
* @return 查询结果
*/
@GetMapping("/queryByPage")
public ResponseObject queryByPage(MtPurchaseDetails mtPurchaseDetails,
@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
com.baomidou.mybatisplus.extension.plugins.pagination.Page page =new com.baomidou.mybatisplus.extension.plugins.pagination.Page(pageNo,pageSize);
IPage<MtPurchaseDetails> list = mtPurchaseDetailsService.queryByPage(page,mtPurchaseDetails);
return getSuccessResult(list);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseEntity<MtPurchaseDetails> queryById(@PathVariable("id") Integer id) {
return ResponseEntity.ok(this.mtPurchaseDetailsService.queryById(id));
}
/**
* 新增数据
*
* @param mtPurchaseDetails 实体
* @return 新增结果
*/
@PostMapping
public ResponseEntity<MtPurchaseDetails> add(MtPurchaseDetails mtPurchaseDetails) {
return ResponseEntity.ok(this.mtPurchaseDetailsService.insert(mtPurchaseDetails));
}
/**
* 编辑数据
*
* @param mtPurchaseDetails 实体
* @return 编辑结果
*/
@PutMapping
public ResponseEntity<MtPurchaseDetails> edit(MtPurchaseDetails mtPurchaseDetails) {
return ResponseEntity.ok(this.mtPurchaseDetailsService.update(mtPurchaseDetails));
}
/**
* 删除数据
*
* @param id 主键
* @return 删除是否成功
*/
@DeleteMapping
public ResponseEntity<Boolean> deleteById(Integer id) {
return ResponseEntity.ok(this.mtPurchaseDetailsService.deleteById(id));
}
}

View File

@ -0,0 +1,173 @@
package com.fuint.business.convenienceSore.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 商品进货表(MtPurchase)实体类
*
* @author makejava
* @since 2023-10-26 11:49:52
*/
public class MtPurchase implements Serializable {
private static final long serialVersionUID = -59077196480001564L;
/**
* 进货id主键
*/
private Integer id;
/**
* 业务单号
*/
private String orderNumber;
/**
* 审核状态
*/
private String approvalStatus;
/**
* 制单日期
*/
private Date orderDate;
/**
* 审核人
*/
private String approver;
/**
* 总金额
*/
private Double totalAmount;
/**
* 进货单价
*/
private Double unitPrice;
/**
* 进货数量
*/
private Integer quantityPurchased;
/**
* 店铺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 getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public String getApprovalStatus() {
return approvalStatus;
}
public void setApprovalStatus(String approvalStatus) {
this.approvalStatus = approvalStatus;
}
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
public String getApprover() {
return approver;
}
public void setApprover(String approver) {
this.approver = approver;
}
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public Integer getQuantityPurchased() {
return quantityPurchased;
}
public void setQuantityPurchased(Integer quantityPurchased) {
this.quantityPurchased = quantityPurchased;
}
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,149 @@
package com.fuint.business.convenienceSore.entity;
import java.util.Date;
import java.io.Serializable;
/**
* 进货详情表(MtPurchaseDetails)实体类
*
* @author makejava
* @since 2023-10-26 11:50:36
*/
public class MtPurchaseDetails implements Serializable {
private static final long serialVersionUID = -65129453439834782L;
/**
* 进货详情id主键
*/
private Integer id;
/**
* 关联商品id
*/
private Integer productId;
/**
* 关联订单id
*/
private Integer purchaseId;
/**
* 进货数量
*/
private Integer quantityPurchased;
/**
* 进货单价
*/
private Double unitPrice;
/**
* 小计金额
*/
private Double subtotalAmount;
/**
* 店铺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 Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getPurchaseId() {
return purchaseId;
}
public void setPurchaseId(Integer purchaseId) {
this.purchaseId = purchaseId;
}
public Integer getQuantityPurchased() {
return quantityPurchased;
}
public void setQuantityPurchased(Integer quantityPurchased) {
this.quantityPurchased = quantityPurchased;
}
public Double getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Double unitPrice) {
this.unitPrice = unitPrice;
}
public Double getSubtotalAmount() {
return subtotalAmount;
}
public void setSubtotalAmount(Double subtotalAmount) {
this.subtotalAmount = subtotalAmount;
}
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,86 @@
package com.fuint.business.convenienceSore.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtPurchase;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* 进货详情表(MtPurchaseDetails)表数据库访问层
*
* @author makejava
* @since 2023-10-26 11:50:36
*/
public interface MtPurchaseDetailsMapper {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtPurchaseDetails queryById(Integer id);
/**
* 查询指定行数据
*
* @param mtPurchaseDetails 查询条件
* @param page 分页对象
* @return 对象列表
*/
IPage<MtPurchaseDetails> queryAllByLimit(Page page, @Param("mtPurchaseDetails") MtPurchaseDetails mtPurchaseDetails);
/**
* 统计总行数
*
* @param mtPurchaseDetails 查询条件
* @return 总行数
*/
long count(MtPurchaseDetails mtPurchaseDetails);
/**
* 新增数据
*
* @param mtPurchaseDetails 实例对象
* @return 影响行数
*/
int insert(MtPurchaseDetails mtPurchaseDetails);
/**
* 批量新增数据MyBatis原生foreach方法
*
* @param entities List<MtPurchaseDetails> 实例对象列表
* @return 影响行数
*/
int insertBatch(@Param("entities") List<MtPurchaseDetails> entities);
/**
* 批量新增或按主键更新数据MyBatis原生foreach方法
*
* @param entities List<MtPurchaseDetails> 实例对象列表
* @return 影响行数
* @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常请自行校验入参
*/
int insertOrUpdateBatch(@Param("entities") List<MtPurchaseDetails> entities);
/**
* 修改数据
*
* @param mtPurchaseDetails 实例对象
* @return 影响行数
*/
int update(MtPurchaseDetails mtPurchaseDetails);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}

View File

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

View File

@ -0,0 +1,187 @@
<?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.convenienceSore.mapper.MtPurchaseDetailsMapper">
<resultMap type="com.fuint.business.convenienceSore.entity.MtPurchaseDetails" id="MtPurchaseDetailsMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="productId" column="product_id" jdbcType="INTEGER"/>
<result property="purchaseId" column="purchase_id" jdbcType="INTEGER"/>
<result property="quantityPurchased" column="quantity_purchased" jdbcType="INTEGER"/>
<result property="unitPrice" column="unit_price" jdbcType="NUMERIC"/>
<result property="subtotalAmount" column="subtotal_amount" jdbcType="NUMERIC"/>
<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"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="MtPurchaseDetailsMap">
select
id, product_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by
from mt_purchase_details
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtPurchaseDetailsMap">
select
id, product_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by
from mt_purchase_details
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="productId != null">
and product_id = #{productId}
</if>
<if test="purchaseId != null">
and purchase_id = #{purchaseId}
</if>
<if test="quantityPurchased != null">
and quantity_purchased = #{quantityPurchased}
</if>
<if test="unitPrice != null">
and unit_price = #{unitPrice}
</if>
<if test="subtotalAmount != null">
and subtotal_amount = #{subtotalAmount}
</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>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from mt_purchase_details
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="productId != null">
and product_id = #{productId}
</if>
<if test="purchaseId != null">
and purchase_id = #{purchaseId}
</if>
<if test="quantityPurchased != null">
and quantity_purchased = #{quantityPurchased}
</if>
<if test="unitPrice != null">
and unit_price = #{unitPrice}
</if>
<if test="subtotalAmount != null">
and subtotal_amount = #{subtotalAmount}
</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>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase_details(product_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
values (#{productId}, #{purchaseId}, #{quantityPurchased}, #{unitPrice}, #{subtotalAmount}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase_details(product_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.productId}, #{entity.purchaseId}, #{entity.quantityPurchased}, #{entity.unitPrice}, #{entity.subtotalAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase_details(product_id, purchase_id, quantity_purchased, unit_price, subtotal_amount, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.productId}, #{entity.purchaseId}, #{entity.quantityPurchased}, #{entity.unitPrice}, #{entity.subtotalAmount}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
product_id = values(product_id),
purchase_id = values(purchase_id),
quantity_purchased = values(quantity_purchased),
unit_price = values(unit_price),
subtotal_amount = values(subtotal_amount),
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)
</insert>
<!--通过主键修改数据-->
<update id="update">
update mt_purchase_details
<set>
<if test="productId != null">
product_id = #{productId},
</if>
<if test="purchaseId != null">
purchase_id = #{purchaseId},
</if>
<if test="quantityPurchased != null">
quantity_purchased = #{quantityPurchased},
</if>
<if test="unitPrice != null">
unit_price = #{unitPrice},
</if>
<if test="subtotalAmount != null">
subtotal_amount = #{subtotalAmount},
</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>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from mt_purchase_details where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,209 @@
<?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.convenienceSore.mapper.MtPurchaseMapper">
<resultMap type="com.fuint.business.convenienceSore.entity.MtPurchase" id="MtPurchaseMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="orderNumber" column="order_number" jdbcType="VARCHAR"/>
<result property="approvalStatus" column="approval_status" jdbcType="VARCHAR"/>
<result property="orderDate" column="order_date" jdbcType="TIMESTAMP"/>
<result property="approver" column="approver" jdbcType="VARCHAR"/>
<result property="totalAmount" column="total_amount" jdbcType="NUMERIC"/>
<result property="unitPrice" column="unit_price" jdbcType="NUMERIC"/>
<result property="quantityPurchased" column="quantity_purchased" 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"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="MtPurchaseMap">
select
id, order_number, approval_status, order_date, approver, total_amount, unit_price, quantity_purchased, store_id, create_time, update_time, create_by, update_by
from mt_purchase
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="MtPurchaseMap">
select
id, order_number, approval_status, order_date, approver, total_amount, unit_price, quantity_purchased, store_id, create_time, update_time, create_by, update_by
from mt_purchase
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
</if>
<if test="approvalStatus != null and approvalStatus != ''">
and approval_status = #{approvalStatus}
</if>
<if test="orderDate != null">
and order_date = #{orderDate}
</if>
<if test="approver != null and approver != ''">
and approver = #{approver}
</if>
<if test="totalAmount != null">
and total_amount = #{totalAmount}
</if>
<if test="unitPrice != null">
and unit_price = #{unitPrice}
</if>
<if test="quantityPurchased != null">
and quantity_purchased = #{quantityPurchased}
</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>
</where>
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from mt_purchase
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="orderNumber != null and orderNumber != ''">
and order_number = #{orderNumber}
</if>
<if test="approvalStatus != null and approvalStatus != ''">
and approval_status = #{approvalStatus}
</if>
<if test="orderDate != null">
and order_date = #{orderDate}
</if>
<if test="approver != null and approver != ''">
and approver = #{approver}
</if>
<if test="totalAmount != null">
and total_amount = #{totalAmount}
</if>
<if test="unitPrice != null">
and unit_price = #{unitPrice}
</if>
<if test="quantityPurchased != null">
and quantity_purchased = #{quantityPurchased}
</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>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase(order_number, approval_status, order_date, approver, total_amount, unit_price, quantity_purchased, store_id, create_time, update_time, create_by, update_by)
values (#{orderNumber}, #{approvalStatus}, #{orderDate}, #{approver}, #{totalAmount}, #{unitPrice}, #{quantityPurchased}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase(order_number, approval_status, order_date, approver, total_amount, unit_price, quantity_purchased, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orderNumber}, #{entity.approvalStatus}, #{entity.orderDate}, #{entity.approver}, #{entity.totalAmount}, #{entity.unitPrice}, #{entity.quantityPurchased}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into mt_purchase(order_number, approval_status, order_date, approver, total_amount, unit_price, quantity_purchased, store_id, create_time, update_time, create_by, update_by)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orderNumber}, #{entity.approvalStatus}, #{entity.orderDate}, #{entity.approver}, #{entity.totalAmount}, #{entity.unitPrice}, #{entity.quantityPurchased}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy})
</foreach>
on duplicate key update
order_number = values(order_number),
approval_status = values(approval_status),
order_date = values(order_date),
approver = values(approver),
total_amount = values(total_amount),
unit_price = values(unit_price),
quantity_purchased = values(quantity_purchased),
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)
</insert>
<!--通过主键修改数据-->
<update id="update">
update mt_purchase
<set>
<if test="orderNumber != null and orderNumber != ''">
order_number = #{orderNumber},
</if>
<if test="approvalStatus != null and approvalStatus != ''">
approval_status = #{approvalStatus},
</if>
<if test="orderDate != null">
order_date = #{orderDate},
</if>
<if test="approver != null and approver != ''">
approver = #{approver},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount},
</if>
<if test="unitPrice != null">
unit_price = #{unitPrice},
</if>
<if test="quantityPurchased != null">
quantity_purchased = #{quantityPurchased},
</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>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from mt_purchase where id = #{id}
</delete>
</mapper>

View File

@ -0,0 +1,57 @@
package com.fuint.business.convenienceSore.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
/**
* 进货详情表(MtPurchaseDetails)表服务接口
*
* @author makejava
* @since 2023-10-26 11:50:36
*/
public interface MtPurchaseDetailsService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtPurchaseDetails queryById(Integer id);
/**
* 分页查询
*
* @param mtPurchaseDetails 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<MtPurchaseDetails> queryByPage(Page page, MtPurchaseDetails mtPurchaseDetails);
/**
* 新增数据
*
* @param mtPurchaseDetails 实例对象
* @return 实例对象
*/
MtPurchaseDetails insert(MtPurchaseDetails mtPurchaseDetails);
/**
* 修改数据
*
* @param mtPurchaseDetails 实例对象
* @return 实例对象
*/
MtPurchaseDetails update(MtPurchaseDetails mtPurchaseDetails);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -0,0 +1,56 @@
package com.fuint.business.convenienceSore.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtPurchase;
/**
* 商品进货表(MtPurchase)表服务接口
*
* @author makejava
* @since 2023-10-26 11:49:52
*/
public interface MtPurchaseService {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
MtPurchase queryById(Integer id);
/**
* 分页查询
*
* @param mtPurchase 筛选条件
* @param page 分页对象
* @return 查询结果
*/
IPage<MtPurchase> queryByPage(Page page, MtPurchase mtPurchase);
/**
* 新增数据
*
* @param mtPurchase 实例对象
* @return 实例对象
*/
MtPurchase insert(MtPurchase mtPurchase);
/**
* 修改数据
*
* @param mtPurchase 实例对象
* @return 实例对象
*/
MtPurchase update(MtPurchase mtPurchase);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
boolean deleteById(Integer id);
}

View File

@ -0,0 +1,86 @@
package com.fuint.business.convenienceSore.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtPurchaseDetails;
import com.fuint.business.convenienceSore.mapper.MtPurchaseDetailsMapper;
import com.fuint.business.convenienceSore.service.MtPurchaseDetailsService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 进货详情表(MtPurchaseDetails)表服务实现类
*
* @author makejava
* @since 2023-10-26 11:50:36
*/
@Service("mtPurchaseDetailsService")
public class MtPurchaseDetailsServiceImpl implements MtPurchaseDetailsService {
@Resource
private MtPurchaseDetailsMapper mtPurchaseDetailsDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public MtPurchaseDetails queryById(Integer id) {
return this.mtPurchaseDetailsDao.queryById(id);
}
/**
* 分页查询
*
* @param mtPurchaseDetails 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<MtPurchaseDetails> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtPurchaseDetails mtPurchaseDetails) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtPurchaseDetails.setStoreId(storeId);
IPage<MtPurchaseDetails> mtPurchaseIPage = mtPurchaseDetailsDao.queryAllByLimit(page, mtPurchaseDetails);
return mtPurchaseIPage;
}
/**
* 新增数据
*
* @param mtPurchaseDetails 实例对象
* @return 实例对象
*/
@Override
public MtPurchaseDetails insert(MtPurchaseDetails mtPurchaseDetails) {
this.mtPurchaseDetailsDao.insert(mtPurchaseDetails);
return mtPurchaseDetails;
}
/**
* 修改数据
*
* @param mtPurchaseDetails 实例对象
* @return 实例对象
*/
@Override
public MtPurchaseDetails update(MtPurchaseDetails mtPurchaseDetails) {
this.mtPurchaseDetailsDao.update(mtPurchaseDetails);
return this.queryById(mtPurchaseDetails.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.mtPurchaseDetailsDao.deleteById(id) > 0;
}
}

View File

@ -0,0 +1,86 @@
package com.fuint.business.convenienceSore.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.business.convenienceSore.entity.MtPurchase;
import com.fuint.business.convenienceSore.mapper.MtPurchaseMapper;
import com.fuint.business.convenienceSore.service.MtPurchaseService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 商品进货表(MtPurchase)表服务实现类
*
* @author makejava
* @since 2023-10-26 11:49:52
*/
@Service("mtPurchaseService")
public class MtPurchaseServiceImpl implements MtPurchaseService {
@Resource
private MtPurchaseMapper mtPurchaseDao;
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
@Override
public MtPurchase queryById(Integer id) {
return this.mtPurchaseDao.queryById(id);
}
/**
* 分页查询
*
* @param mtPurchase 筛选条件
* @param page 分页对象
* @return 查询结果
*/
@Override
public IPage<MtPurchase> queryByPage(com.baomidou.mybatisplus.extension.plugins.pagination.Page page, MtPurchase mtPurchase) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
mtPurchase.setStoreId(storeId);
IPage<MtPurchase> mtPurchaseIPage = mtPurchaseDao.queryAllByLimit(page, mtPurchase);
return mtPurchaseIPage;
}
/**
* 新增数据
*
* @param mtPurchase 实例对象
* @return 实例对象
*/
@Override
public MtPurchase insert(MtPurchase mtPurchase) {
this.mtPurchaseDao.insert(mtPurchase);
return mtPurchase;
}
/**
* 修改数据
*
* @param mtPurchase 实例对象
* @return 实例对象
*/
@Override
public MtPurchase update(MtPurchase mtPurchase) {
this.mtPurchaseDao.update(mtPurchase);
return this.queryById(mtPurchase.getId());
}
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
@Override
public boolean deleteById(Integer id) {
return this.mtPurchaseDao.deleteById(id) > 0;
}
}

View File

@ -74,7 +74,7 @@ public class OilGunController extends BaseController {
@PostMapping
public ResponseObject add(@RequestBody OilGun oilGun) {
if (this.oilGunService.insert(oilGun)) {
return getSuccessResult(this.oilGunService.insert(oilGun));
return getSuccessResult(true);
}else {
return getSuccessResult(201,"存在重复的油枪名称,请修改",null);
}

View File

@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* (OilTank)表控制层
@ -49,6 +50,15 @@ public class OilTankController extends BaseController {
}
@PostMapping("exportExcel")
public void exportExcel(HttpServletResponse response) {
this.oilTankService.export(response);
}
/**
* 根据油罐名称和名字查找
* @param

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.petrolStationManagement.entity.OilPresetPrices;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.vo.OilTankExcel;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@ -33,6 +34,14 @@ public interface OilTankMapper {
*/
IPage<OilTank> queryAllByLimit(@Param("page")Page page,@Param("oilTank") OilTank oilTank);
List<OilTankExcel> queryAllByLimit2(@Param("oilTank") OilTank oilTank);
List<OilTank> selectList(@Param("oilTank") OilTank oilTank);

View File

@ -135,12 +135,13 @@
CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName,
current_average_price currentAveragePrice,
ot.stored_quantity currentInventoryVolume,
ot.inventory_time inventoryTime,
op.inventory_time inventoryTime,
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

View File

@ -90,6 +90,7 @@
and update_by = #{oilTank.updateBy}
</if>
</where>
ORDER BY update_time DESC
</select>
<select id="selectList" resultMap="OilTankMap">
@ -215,6 +216,76 @@
</where>
</select>
<select id="queryAllByLimit2" resultType="com.fuint.business.petrolStationManagement.vo.OilTankExcel">
select
id, tank_name tankName,
oil_number oilNumber,
tank_volume tankVolume,
lower_warning lowerWarning,
oil_density oilDensity,
stored_quantity storedQuantity,
total_price totalPrice,
discounted_price discountedPrice,
status status,
remarks, store_id, number_id, create_time, update_time updateTime, create_by, update_by, inventory_statistics, unit
from oil_tank
<where>
<if test="oilTank.id != null">
and id = #{oilTank.id}
</if>
<if test="oilTank.tankName != null and oilTank.tankName != ''">
and tank_name LIKE CONCAT('%', #{oilTank.tankName}, '%')
</if>
<if test="oilTank.oilNumber != null and oilTank.oilNumber != ''">
and oil_number = #{oilTank.oilNumber}
</if>
<if test="oilTank.tankVolume != null">
and tank_volume = #{oilTank.tankVolume}
</if>
<if test="oilTank.lowerWarning != null">
and lower_warning = #{oilTank.lowerWarning}
</if>
<if test="oilTank.oilDensity != null">
and oil_density = #{oilTank.oilDensity}
</if>
<if test="oilTank.storedQuantity != null">
and stored_quantity = #{oilTank.storedQuantity}
</if>
<if test="oilTank.totalPrice != null">
and total_price = #{oilTank.otalPrice}
</if>
<if test="oilTank.discountedPrice != null">
and discounted_price = #{oilTank.discountedPrice}
</if>
<if test="oilTank.status != null and oilTank.status != ''">
and status = #{oilTank.status}
</if>
<if test="oilTank.remarks != null and oilTank.remarks != ''">
and remarks = #{oilTank.remarks}
</if>
<if test="oilTank.storeId != null">
and store_id = #{oilTank.storeId}
</if>
<if test="oilTank.numberId != null">
and number_id = #{oilTank.numberId}
</if>
<if test="oilTank.createTime != null">
and create_time = #{oilTank.createTime}
</if>
<if test="oilTank.updateTime != null">
and update_time = #{oilTank.updateTime}
</if>
<if test="oilTank.createBy != null">
and create_by = #{oilTank.createBy}
</if>
<if test="oilTank.updateBy != null">
and update_by = #{oilTank.updateBy}
</if>
</where>
ORDER BY update_time DESC
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into oil_tank(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)

View File

@ -58,6 +58,7 @@
and tank_id = #{oilTracking.tankId}
</if>
</where>
ORDER BY create_time DESC
</select>
<!-- <if test="oilTracking.quantityChange != null">-->
<!-- and quantity_change = #{oilTracking.quantityChange}-->

View File

@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -29,7 +30,7 @@ public interface OilTankService {
* 分页查询
*
* @param oilTank 筛选条件
* @param 分页对象
* @param page
* @return 查询结果
*/
IPage<OilTank> queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank);
@ -37,9 +38,12 @@ public interface OilTankService {
List<OilTank> selectList(Integer numberId);
/**
* 根据油罐名称和名字查找
* @param numberId
* @param oilTank
* @return
*/
List<OilTank> selectList2(OilTank oilTank);
@ -72,4 +76,6 @@ public interface OilTankService {
boolean cleanData(Integer id);
public void export(HttpServletResponse response);
}

View File

@ -90,14 +90,14 @@ public class OilGunServiceImpl implements OilGunService {
public boolean insert(OilGun oilGun) {
AccountInfo accountInfo = TokenUtil.getNowAccountInfo();
oilGun.setStoreId(accountInfo.getStoreId());
oilGun.setCreateBy(accountInfo.getStaffId().toString());
boolean check = checkData(oilGun);
if (check) {
return false;
}
oilGun.setCreateBy(accountInfo.getId().toString());
System.out.println("oilGun"+oilGun.getOilMachineGunNumber());
return this.oilGunDao.insert(oilGun)>0;
return oilGunDao.insert(oilGun)>0;
}
// 判断是否有同一名称的数据

View File

@ -1,9 +1,11 @@
package com.fuint.business.petrolStationManagement.service.impl;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.petrolStationManagement.entity.OilTank;
import com.fuint.business.petrolStationManagement.mapper.OilTankMapper;
import com.fuint.business.petrolStationManagement.service.OilTankService;
import com.fuint.business.petrolStationManagement.vo.OilTankExcel;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.ibatis.annotations.Param;
@ -12,6 +14,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
@ -112,4 +115,32 @@ public class OilTankServiceImpl implements OilTankService {
public boolean cleanData(Integer id) {
return this.oilTankDao.cleanData(id) > 0;
}
public void export(HttpServletResponse response) {
OilTank oilTank = new OilTank();
// 需要导出的数据
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilTank.setStoreId(nowAccountInfo.getStoreId());
List<OilTankExcel> oilTankExcels = oilTankDao.queryAllByLimit2(oilTank);
// 设置文件名字
String fileName = "存油统计"+System.currentTimeMillis() + ".xlsx";
try{
// 设置响应头信息
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "filename=" + fileName + ".xlsx");
// 写入文件数据
EasyExcel.write(response.getOutputStream(), OilTankExcel.class).sheet("download").doWrite(oilTankExcels);
}catch(Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}