This commit is contained in:
cun-nan 2024-10-31 14:48:14 +08:00
parent 807e73cf02
commit 1b09dab46f
9 changed files with 343 additions and 295 deletions

View File

@ -1,161 +1,172 @@
<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 class="card-change-1-search">
<!-- <div slot="header" class="clearfix">-->
<!-- <i class="el-icon-back" @click="goToAbout">返回 | </i>-->
<!-- <span> 盘点详情</span>-->
<!-- </div>-->
<div class="" style="height: 110px; display: flex; justify-content: space-between;">
<div style="height: 100%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 70%; display: flex; justify-content: space-between;">
<div style="height: 100%; width: 70%; display: flex; justify-content: space-between;align-items: center">
<div class="box">
<span style="font-size: 26px;color: #0DC291;font-weight: bold" >{{inventoryForm.productQuantity}}</span>
<span style="font-size: 26px;color: #0DC291;font-weight: bold">{{ inventoryForm.productQuantity }}</span>
<span style="display: flex">
<div style="background-color: #0DC291;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
商品数量</span>
<div
style="background-color: #0DC291;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
商品种类</span>
</div>
<div class="box">
<span style="font-size: 26px;color: #00CAFF;font-weight: bold">{{inventoryForm.inventoryQuantity}}</span>
<span
style="font-size: 26px;color: #00CAFF;font-weight: bold">{{ inventoryForm.inventoryQuantity }}</span>
<span style="display: flex">
<div style="background-color: #00CAFF;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盘点数量</span>
<div
style="background-color: #00CAFF;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盘点正常商品量</span>
</div>
<div class="box">
<span style="font-size: 26px;color: #F44522;font-weight: bold" >{{inventoryForm.inventoryDiscrepancy}}</span>
<span
style="font-size: 26px;color: #F44522;font-weight: bold">{{ inventoryForm.inventoryDiscrepancy }}</span>
<span style="display: flex">
<div style="background-color: #F44522;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
库存差异</span>
<div
style="background-color: #F44522;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盘点货损数量</span>
</div>
<div class="box">
<span style="font-size: 26px;color: #FA6400;font-weight: bold">{{inventoryForm.profitLossAmount}}</span>
<span style="font-size: 26px;color: #FA6400;font-weight: bold">{{ inventoryForm.profitLossAmount }}</span>
<span style="display: flex">
<div style="background-color: #FA6400;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盈亏总额
<div
style="background-color: #FA6400;width: 10px;height: 10px;border-radius: 50%;margin-top: 6px;margin-right: 10px"></div>
盈亏金额
</span>
</div>
</div>
<div style="height: 100%; width: 40%; display: flex; flex-direction: column; justify-content: space-between;">
<el-form ref="" label-width="100px">
<el-form-item label="制单人" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.creataByName" disabled="true"
style="width: 220Px;margin-bottom: 1px;">
</el-input>
</el-form-item>
<el-form-item label="制单时间" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.orderDate" disabled="true"
style="width: 220Px">
</el-input>
</el-form-item>
<el-form-item label="盘点编号" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.orderNumber" disabled="true"
style="width: 220Px">
</el-input>
</el-form-item>
</div>
<div style="height: 100%; width: 40%; display: flex; flex-direction: column; justify-content: space-between;">
<el-form ref="" label-width="100px">
<el-form-item label="制单人" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.creataByName" disabled="true"
style="width: 220Px;margin-bottom: 1px;">
</el-input>
</el-form-item>
<el-form-item label="制单时间" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.orderDate" disabled="true"
style="width: 220Px">
</el-input>
</el-form-item>
<el-form-item label="盘点编号" style="margin-bottom: 1px">
<el-input size="mini" v-model="inventoryForm.orderNumber" disabled="true"
style="width: 220Px">
</el-input>
</el-form-item>
</el-form>
<!-- <table class="container1">-->
<!-- <tr>-->
<!-- <td>制单人</td>-->
<!-- <td style="width: 10px;"> </td>-->
<!-- <td style=""><span class="underlined-text" >{{inventoryForm.creataByName}}</span></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>制单时间</td>-->
<!-- <td> </td>-->
<!-- <td><span class="underlined-text">{{parseTime(inventoryForm.orderDate)}}</span></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>盘点编号</td>-->
<!-- <td> </td>-->
<!-- <td><span class="underlined-text">{{inventoryForm.orderNumber}}</span></td>-->
<!-- </tr>-->
<!-- </table>-->
</el-form>
<!-- <table class="container1">-->
<!-- <tr>-->
<!-- <td>制单人</td>-->
<!-- <td style="width: 10px;"> </td>-->
<!-- <td style=""><span class="underlined-text" >{{inventoryForm.creataByName}}</span></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>制单时间</td>-->
<!-- <td> </td>-->
<!-- <td><span class="underlined-text">{{parseTime(inventoryForm.orderDate)}}</span></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>盘点编号</td>-->
<!-- <td> </td>-->
<!-- <td><span class="underlined-text">{{inventoryForm.orderNumber}}</span></td>-->
<!-- </tr>-->
<!-- </table>-->
</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="storageFlag" @click="storage">退货处理库存</el-button>
<el-button type="warning" v-if="state !='await' || state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
<el-button type="warning" v-if="state !='await'" @click="exportExcel()">导出</el-button>
<el-button type="primary" @click="cancelPurchase" v-if="state=='qrts'">关闭</el-button>
<el-button @click="cancelPurchase" v-else>取消</el-button>
<el-button type="success" v-if="state=='await'" :disabled="saveFlag" @click="save()">保存</el-button>
<el-button type="primary" v-if="state=='await'" :disabled="auditFlag" @click="audit()">
保存并审核<!--生成差异单-->
</el-button>
<el-button type="danger" v-if="state=='ysh'" :disabled="voidFlag" @click="abolition()">作废</el-button>
<el-button type="success" v-if="state=='ysh'" @click="exportExcel()">导出</el-button>
<el-button type="primary" v-if="state=='ysh'" :disabled="storageFlag" @click="storage">退货处理库存
</el-button>
</div>
</div>
</el-card>
</div>
<el-card style="margin-top: 20px" >
<div class="card-change-1-1">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" style="text-align: right; float: right">
<el-button
v-if="!numberInput"
v-if="!numberInput"
type="primary"
icon="el-icon-plus"
@click="commodityAdd"
>添加盘点</el-button>
>添加盘点商品
</el-button>
</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 ref="tables" border
v-loading="loading"
:data="detailsList"
:default-sort="defaultSort">
<el-table-column label="序号" align="center" prop="commodityName"/>
<el-table-column label="序号" align="center" type="index"/>
<el-table-column label="商品名称" align="center" prop="commodityName"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="品类名称" align="center" prop="cvsGoodName"/>
<el-table-column label="条形码" align="center" prop="goodsNo"/>
<el-table-column label="进货量" align="center" prop="purchase">
<template slot-scope="scope">
{{scope.row.purchase?scope.row.purchase:'--'}}
{{ scope.row.purchase ? scope.row.purchase : '--' }}
</template>
</el-table-column>
<el-table-column label="商品规格" align="center" prop="goodsSpecs"/>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="销售量" align="center" prop="unit">
<el-table-column label="便利店销售" align="center" prop="goodsSales">
<template slot-scope="scope">
{{scope.row.goodsSales?scope.row.goodsSales:'0'}}
</template>
</el-table-column>
<el-table-column label="积分兑换" align="center" prop="inventorySales">
<template slot-scope="scope">
{{scope.row.inventorySales?scope.row.inventorySales:'0'}}
</template>
</el-table-column>
<el-table-column label="兑换卷兑换" align="center" prop="inventorySales">
<template slot-scope="scope">
{{scope.row.exchangeSales?scope.row.exchangeSales:'0'}}
</template>
</el-table-column>
<el-table-column label="便利店销售量" align="center" prop="goodsSales">
<template slot-scope="scope">
{{ scope.row.goodsSales ? scope.row.goodsSales : '0' }}
</template>
</el-table-column>
<el-table-column label="积分兑换量" align="center" prop="inventorySales">
<template slot-scope="scope">
{{ scope.row.inventorySales ? scope.row.inventorySales : '0' }}
</template>
</el-table-column>
<el-table-column label="兑换券兑换量" align="center" prop="inventorySales">
<template slot-scope="scope">
{{ scope.row.exchangeSales ? scope.row.exchangeSales : '0' }}
</template>
</el-table-column>
<el-table-column label="当前进价" align="center" prop="purchasePrice"/>
<el-table-column label="库存数量" align="center" prop="stock"/>
<el-table-column label="盘点数量" align="center" prop="unit">
<el-table-column label="正常商品" align="center" prop="purchasePrice">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.inventoryQuantity" @change="change(scope.row,2)" controls-position="right" :precision="0" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="货损数量" align="center" prop="damageQuantity">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.damageQuantity" @change="change(scope.row,2)" controls-position="right" :precision="0" :min="0" :max="100000000" :step="1" style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="总盘点数量" align="center" prop="inventoryQuantity">
<template slot-scope="scope">
{{ scope.row.inventoryQuantity + scope.row.damageQuantity}}
</template>
</el-table-column>
<el-table-column label="成本价" align="center" prop="purchasePrice"/>
<el-table-column label="当前库存" align="center" prop="stock"/>
<el-table-column label="盘点正常商品量" align="center" prop="purchasePrice">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.inventoryQuantity" @change="change(scope.row,2)"
controls-position="right" :precision="0" :min="0" :max="100000000" :step="1"
style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="盘点货损量" align="center" prop="damageQuantity">
<template slot-scope="scope">
<el-input-number :disabled="numberInput" v-model="scope.row.damageQuantity" @change="change(scope.row,2)"
controls-position="right" :precision="0" :min="0" :max="100000000" :step="1"
style="max-width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="总盘点量" align="center" prop="inventoryQuantity">
<template slot-scope="scope">
{{ scope.row.inventoryQuantity + scope.row.damageQuantity }}
</template>
</el-table-column>
<el-table-column label="库存差异" align="center" prop="inventoryDiscrepancy"/>
<el-table-column label="盈亏金额" align="center" prop="profitLossAmount"/>
@ -167,7 +178,8 @@
type="text"
icon="el-icon-edit"
@click="commodityDel(scope.row)"
>删除</el-button>
>删除
</el-button>
</template>
<!-- v-hasPermi="['']"-->
@ -181,45 +193,37 @@
<!-- :limit.sync="queryParams.pageSize"-->
<!-- @pagination="getList"-->
<!-- />-->
</el-card>
</div>
<el-dialog :title="title" :visible.sync="open" width="1000px" 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="6">
<el-form-item label="商品分类">
<el-select
v-model="commodityForm.cvsGoodId"
placeholder="全部"
clearable
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="供应商" prop="supplierId">
<el-select
v-model="commodityForm.supplierId"
placeholder="全部"
clearable
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="详细信息">
<el-input v-model="commodityForm.remark" placeholder="商品名称,拼音码,条形码等信息" ></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="inquire()">查询</el-button>
</el-col>
</el-row>
<el-form ref="tankForm" :model="commodityForm" label-width="20px" :inline="true">
<el-form-item label="">
<el-select
v-model="commodityForm.cvsGoodId"
placeholder="请选择品类名称"
clearable
>
<el-option v-for="item in cvsGoodList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="" prop="supplierId">
<el-select
v-model="commodityForm.supplierId"
placeholder="请选择供应商名称"
clearable
>
<el-option v-for="item in supplierList" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item label="">
<el-input v-model="commodityForm.remark" placeholder="请输入商品名称,拼音码,条形码等信息"></el-input>
</el-form-item>
<el-form-item style="float: right;margin-right: 0px">
<el-button type="primary" icon="el-icon-search" @click="inquire()">搜索</el-button>
</el-form-item>
</el-form>
</el-header>
<el-main>
@ -235,8 +239,8 @@
</el-table-column>
<el-table-column label="商品名称" align="center" prop="name"/>
<el-table-column label="商品编码" align="center" prop="goodsNo"/>
<el-table-column label="类名称" prop="cvsGoodId" align="center">
<!-- <el-table-column label="商品编码" align="center" prop="goodsNo"/>-->
<el-table-column label="类名称" prop="cvsGoodId" align="center">
<template slot-scope="scope">
<span>{{ getName(cvsGoodList, scope.row.cvsGoodId) }}</span>
</template>
@ -247,15 +251,20 @@
<span>{{ getName(supplierList, scope.row.supplierId) }}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="商品规格" align="center" prop="goodsSpecs">
<template slot-scope="scope">
<div>{{scope.row.goodsSpecs || '-'}}</div>
</template>
</el-table-column>
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="当前库存" align="center" prop="stock"/>
</el-table>
</el-main>
</el-container>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addCommodity"> </el-button>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="addCommodity"> </el-button>
</div>
</el-dialog>
@ -266,25 +275,24 @@
import {getAuditPremApi} from "@/api/oilConfig/staff";
import {BigNumber} from "bignumber.js";
import {listLJGoods} from "@/api/convenienceStore/ljgoods";
import {getName,parseTime} from "../../../utils/fuint";
import {selectParentById, selectTree} from "@/api/convenienceStore/goods";
import {parseTime} from "../../../utils/fuint";
import {selectTree} from "@/api/convenienceStore/goods";
import {listSupplier} from "@/api/convenienceStore/supplier";
import {
getInventoryDetailsPageApi,
auditInventoryApi,
batchProcessingApi,
delDetailsApi,
editInventoryApi,
addInventoryApi,
batchProcessingApi,
auditInventoryApi,
storageInventoryApi,
abolitionInventoryApi,
exportExcelApi, getSalesByMtInventoryApi
exportExcelApi,
getInventoryDetailsPageApi,
getSalesByMtInventoryApi,
storageInventoryApi
} from "@/api/convenienceStore/inventory";
export default {
name: "details",
props:[
props: [
'PinventoryId',
'PorderNumber',
'PorderDate',
@ -295,7 +303,7 @@ export default {
return {
detailsList: [],
commodityList: [],
commodityForm:{
commodityForm: {
cvsGoodId: "",
cvsGood: "",
supplierId: "",
@ -304,44 +312,43 @@ export default {
remark: "",
page: 1,
pageSize: 10,
isRecovery:0,
isRecovery: 0,
},
inventoryForm: {
inventoryId:this.$props.PinventoryId,
id:this.$props.PinventoryId,
inventoryId: this.$props.PinventoryId,
id: this.$props.PinventoryId,
orderNumber: this.$props.PorderNumber,
approvalStatus: this.$props.PapprovalStatus,
orderDate: this.$props.PorderDate,
creataByName: this.$props.PcreataByName,
roductQuantity:0, //
inventoryQuantity: 0 ,//
damageQuantity: 0 ,//
roductQuantity: 0, //
inventoryQuantity: 0,//
damageQuantity: 0,//
inventoryDiscrepancy: 0,//
profitLossAmount: 0//
},
inventoryId : this.$props.PinventoryId,
inventoryId: this.$props.PinventoryId,
//
cvsGoodList:[],
cvsGoodList: [],
//
supplierList:[],
supplierList: [],
state:this.$props.PapprovalStatus,
state: this.$props.PapprovalStatus,
saveFlag:false,
auditFlag:true,
voidFlag:true,
storageFlag:true,
multipleSelection:[], //
saveFlag: false,
auditFlag: true,
voidFlag: true,
storageFlag: true,
multipleSelection: [], //
//
title:'选择商品',
title: '添加盘点商品',
//
showSearch: true,
disableInput: false, //
@ -349,13 +356,13 @@ export default {
open: false,
//
total: 0,
numberInput: false,
//
queryParams: {
// supplierId: '',
inventoryId: this.$props.PinventoryId,
page:null,
pageSize:null
page: null,
pageSize: null
},
//
loading: false,
@ -364,7 +371,7 @@ export default {
//
rules: {
supplierName: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" },
{required: true, message: "供应商名称不能为空", trigger: "blur"},
],
},
}
@ -383,23 +390,23 @@ export default {
// this.inventoryForm.approvalStatus = this.$props.PapprovalStatus
this.state = this.$props.PapprovalStatus
if ( this.state == null) {
if (this.state == null) {
this.state = 'await'
}
if (this.state=='await') {
if (this.state == 'await') {
this.numberInput = false
}else {
} else {
this.numberInput = true
}
console.log("this.inventoryForm",this.inventoryForm)
console.log("this.inventoryForm", this.inventoryForm)
if (this.inventoryForm.orderNumber == null) {
this.refresh();
}
if (this.inventoryForm.orderDate == null) {
this.inventoryForm.orderDate =new Date()
this.inventoryForm.orderDate = new Date()
}
this.getDetailsList();
@ -407,10 +414,14 @@ export default {
this.JudgmentButton();
},
methods: {
//
cancelPurchase() {
this.$router.back()
},
parseTime,
getDetailsList() {
let this_ = this
getInventoryDetailsPageApi(this.queryParams).then(res=>{
getInventoryDetailsPageApi(this.queryParams).then(res => {
this_.detailsList = res.data.records;
this.total = res.data.total;
this.inventoryForm.productQuantity = res.data.total;
@ -419,7 +430,7 @@ export default {
},
getCommodityList() {
let this_ = this
listLJGoods(this_.commodityForm).then(res=>{
listLJGoods(this_.commodityForm).then(res => {
this_.commodityList = res.data.records;
this_.sumMethod(res.data.records);
// this.total = response.data.total;
@ -435,30 +446,27 @@ export default {
commodityDel(data) {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (data.id != null) {
delDetailsApi(data).then(res=>{
})
}
const index = this.detailsList.indexOf(data); //
if (index !== -1) {
this.detailsList.splice(index, 1); // 使splice
}
this.inventoryForm.productQuantity--;
this.sumMethod(this.detailsList);
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (data.id != null) {
delDetailsApi(data).then(res => {
})
}
const index = this.detailsList.indexOf(data); //
if (index !== -1) {
this.detailsList.splice(index, 1); // 使splice
}
this.inventoryForm.productQuantity--;
this.sumMethod(this.detailsList);
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
@ -468,7 +476,7 @@ export default {
},
//
change(data,flag) {
change(data, flag) {
let profitLossAmount = new BigNumber(data.profitLossAmount);
let inventoryDiscrepancy = new BigNumber(data.inventoryDiscrepancy);
let inventoryQuantity = new BigNumber(data.inventoryQuantity); //
@ -476,10 +484,10 @@ export default {
let purchasePrice = new BigNumber(data.purchasePrice);
let stock = new BigNumber(data.stock);
//
console.log("inventoryQuantity",inventoryQuantity)
console.log("damageQuantity",damageQuantity)
console.log("stock",stock)
let addStocke = inventoryQuantity.minus(damageQuantity) //
console.log("inventoryQuantity", inventoryQuantity)
console.log("damageQuantity", damageQuantity)
console.log("stock", stock)
let addStocke = inventoryQuantity.minus(damageQuantity) //
// let addStocke = inventoryQuantity.plus(damageQuantity)
inventoryDiscrepancy = addStocke.minus(stock) //
//
@ -490,8 +498,8 @@ export default {
//
//
let a = inventoryQuantity.minus(stock)
let b= a.minus(purchasePrice)
let a = inventoryQuantity.minus(stock)
let b = a.minus(purchasePrice)
//
data.inventoryDiscrepancy = a.toNumber();
data.profitLossAmount = b.toNumber();
@ -508,42 +516,42 @@ export default {
// this_.inventoryForm.productQuantity = 0
// }
this_.inventoryForm.productQuantity = data.length,
this_.inventoryForm.inventoryQuantity = new BigNumber(0),
this_.inventoryForm.damageQuantity = new BigNumber(0),
this_.inventoryForm.inventoryDiscrepancy = new BigNumber(0),
this_.inventoryForm.profitLossAmount = new BigNumber(0),
this_.inventoryForm.productQuantity = data.length,
this_.inventoryForm.inventoryQuantity = new BigNumber(0),
this_.inventoryForm.damageQuantity = new BigNumber(0),
this_.inventoryForm.inventoryDiscrepancy = new BigNumber(0),
this_.inventoryForm.profitLossAmount = new BigNumber(0),
data.forEach(da => {
if (da.inventoryQuantity != null) {
data.forEach(da => {
if (da.inventoryQuantity != null) {
this_.inventoryForm.inventoryQuantity= this_.inventoryForm.inventoryQuantity.plus(da.inventoryQuantity)
}
if (da.inventoryDiscrepancy != null) {
this_.inventoryForm.inventoryDiscrepancy = this_.inventoryForm.inventoryDiscrepancy.plus(da.inventoryDiscrepancy)
}
if (da.profitLossAmount != null) {
this_.inventoryForm.profitLossAmount = this_.inventoryForm.profitLossAmount.plus(da.profitLossAmount)
}
})
this_.inventoryForm.inventoryQuantity = this_.inventoryForm.inventoryQuantity.plus(da.inventoryQuantity)
}
if (da.inventoryDiscrepancy != null) {
this_.inventoryForm.inventoryDiscrepancy = this_.inventoryForm.inventoryDiscrepancy.plus(da.inventoryDiscrepancy)
}
if (da.profitLossAmount != null) {
this_.inventoryForm.profitLossAmount = this_.inventoryForm.profitLossAmount.plus(da.profitLossAmount)
}
})
},
async addCommodity () {
async addCommodity() {
let this_ = this
let sum = 0;
for (const mul of this.multipleSelection) {
let flag = true;
this_.detailsList.forEach(det=>{
this_.detailsList.forEach(det => {
if (mul.id == det.goodsId) {
flag = false
sum++
}
})
if(flag) {
if (flag) {
let getPurchaseByTankIdData
await getSalesByMtInventoryApi({goodsId:mul.id}).then(res=>{
await getSalesByMtInventoryApi({goodsId: mul.id}).then(res => {
getPurchaseByTankIdData = res.data
})
@ -552,25 +560,25 @@ export default {
goodsId: mul.id,
commodityName: mul.name,
cvsGoodId: mul.cvsGoodId,
unit:mul.unit,
stock:mul.stock,
unit: mul.unit,
stock: mul.stock,
purchasePrice: mul.buyingPrice,
goodsNo:mul.goodsNo,
inventoryQuantity:1,
damageQuantity:0,
profitLossAmount:0, //
inventoryDiscrepancy:0, //
purchase:getPurchaseByTankIdData.purchase,
goodsSales:getPurchaseByTankIdData.goodsSales,
inventorySales:getPurchaseByTankIdData.inventorySales,
exchangeSales:getPurchaseByTankIdData.exchangeSales,
goodsNo: mul.goodsNo,
inventoryQuantity: 1,
damageQuantity: 0,
profitLossAmount: 0, //
inventoryDiscrepancy: 0, //
purchase: getPurchaseByTankIdData.purchase,
goodsSales: getPurchaseByTankIdData.goodsSales,
inventorySales: getPurchaseByTankIdData.inventorySales,
exchangeSales: getPurchaseByTankIdData.exchangeSales,
}
this_.detailsList.push(now)
}
}
if(sum>0) {
this.$modal.msgError("同一货损单不能有两件相同的商品,您选择了"+sum+"件相同的商品,已为您剔除");
if (sum > 0) {
this.$modal.msgError("同一货损单不能有两件相同的商品,您选择了" + sum + "件相同的商品,已为您剔除");
}
this_.open = false
@ -586,7 +594,7 @@ export default {
page: 1,
pageSize: 1000,
total: 0,
isRecovery:0,
isRecovery: 0,
}
this.commodityList = []
@ -595,7 +603,7 @@ export default {
},
//
getQueryList(){
getQueryList() {
selectTree().then(response => {
this.cvsGoodList = response.data.records
});
@ -616,43 +624,42 @@ export default {
let min = 100; // 1000
let max = 999; // 9999
let randomFourDigitNumber = Math.floor(Math.random() * (max - min + 1)) + min;
this.inventoryForm.orderNumber = timestamp+randomFourDigitNumber.toString();
this.inventoryForm.orderNumber = timestamp + randomFourDigitNumber.toString();
},
//
async JudgmentButton(){
async JudgmentButton() {
let judgmentPermissions1 = await this.judgmentPermissions("盘点商品审核");
if (judgmentPermissions1 > 0){
this.auditFlag=false,
this.voidFlag=false
if (judgmentPermissions1 > 0) {
this.auditFlag = false,
this.voidFlag = false
}
let judgmentPermissions2 = await this.judgmentPermissions("盘点商品入库");
if (judgmentPermissions2 > 0){
if (judgmentPermissions2 > 0) {
this.storageFlag = false
}
let judgmentPermissions3 = await this.judgmentPermissions("盘点商品废止");
if (judgmentPermissions3 > 0){
this.voidFlag=false
}else {
this.voidFlag=true
if (judgmentPermissions3 > 0) {
this.voidFlag = false
} else {
this.voidFlag = true
}
},
//
async judgmentPermissions(data) {
let fil ={
auditPrem:data
let fil = {
auditPrem: data
}
return await getAuditPremApi(fil).then(res => {
return res.data
});
},
async save(flag){
async save(flag) {
let this_ = this
// 退
@ -666,18 +673,18 @@ export default {
// roductQuantity:0, //
// inventoryQuantity: 0 //
// },
if(this_.detailsList.length<=0) {
if (this_.detailsList.length <= 0) {
this.$modal.msgError("盘点单不能为空");
return -1;
}
await editInventoryApi(this.inventoryForm).then(res=>{
await editInventoryApi(this.inventoryForm).then(res => {
//
batchProcessingApi(this_.detailsList).then(res=>{
batchProcessingApi(this_.detailsList).then(res => {
this.$modal.msgSuccess("保存成功");
if (flag != -1) {
this.goToAbout();
}
}).catch(res=>{
}).catch(res => {
this.$modal.msgError("保存失败");
})
@ -685,20 +692,20 @@ export default {
},
//
async audit(){
async audit() {
//
let number = await this.save(-1);
if (number != -1) {
//
let fil ={
let fil = {
id: this.inventoryId
}
console.log(" id: this.inventoryId",fil)
console.log(" id: this.inventoryId", fil)
await auditInventoryApi(fil).then(res => {
if (res.data) {
this.state = 'ysh'
this.$modal.msgWarning("审核成功");
}else {
} else {
this.$modal.msgWarning("暂无审核权限");
}
this.goToAbout()
@ -716,7 +723,7 @@ export default {
type: 'warning'
}).then(() => {
//
let fil ={
let fil = {
id: this.inventoryId
}
storageInventoryApi(fil).then(res => {
@ -733,7 +740,7 @@ export default {
//
abolition(){
abolition() {
if (this.inventoryId < 0) {
this.$modal.msgWarning("数据未保存,不可废弃");
return;
@ -743,7 +750,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let fil ={
let fil = {
id: this.inventoryId
}
abolitioninventoryApi(fil).then(res => {
@ -765,16 +772,16 @@ export default {
async exportExcel() {
let fil ={
let fil = {
inventoryId: this.inventoryId
}
exportExcelApi(fil).then(res=>{
console.log("res",res)
exportExcelApi(fil).then(res => {
console.log("res", res)
// this.downloadFile(res);
const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const blob = new Blob([res], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
this.$download.saveAs(blob,this.inventoryForm.orderNumber+'.xlsx')
this.$download.saveAs(blob, this.inventoryForm.orderNumber + '.xlsx')
})
},
}
@ -782,19 +789,18 @@ export default {
</script>
<style scoped lang="scss">
.app-container{
.app-container {
width: 100%;
height: 100%;
background: #f6f8f9;
}
/* .underlined-text {
/* padding-bottom: 10px; /* 通过增加下边距来调整文本与下划线的间距 */
/* text-decoration: underline; 添加下划线 */
/* border-bottom: 1px solid; */
/* padding-bottom: 3px; */
/* text-decoration: underline; 添加下划线 */
/* border-bottom: 1px solid; */
/* padding-bottom: 3px; */
/* } */
@ -817,8 +823,9 @@ export default {
/* text-decoration: underline; */
/* vertical-align: middle; */
}
.box {
height: 100%;
height: 80%;
width: 212px;
margin-right: 10px;
background: #FFFFFF;

View File

@ -119,6 +119,7 @@
<el-table-column label="单位" align="center" prop="unit"/>
<el-table-column label="零售价" align="center" prop="retailPrice"/>
<el-table-column label="当前库存" align="center" prop="stock"/>
<el-table-column label="货损量" align="center" prop="cargoDamage"/>
<el-table-column label="当前成本价" align="center" prop="buyingPrice"/>
<el-table-column label="成本总金额" align="center" prop="costAmount"/>
<el-table-column label="状态" align="center" prop="status">

View File

@ -1,5 +1,6 @@
package com.fuint.business.convenienceSore.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
@ -20,7 +21,7 @@ import java.util.List;
* @author makejava
* @since 2023-10-28 14:45:43
*/
public interface MtInventoryDetailsMapper {
public interface MtInventoryDetailsMapper extends BaseMapper<MtInventoryDetails> {
/**
* 通过ID查询单条数据

View File

@ -132,11 +132,14 @@
mg.goods_no goodsNo,
mg.cvs_good_id cvsGoodId,
mg.unit unit,
mg.goods_specs goodsSpecs,
mg.supplier_id supplierId,
mg.id goodsId,
md.stock stock
md.stock stock,
cg.name cvsGoodName
from mt_inventory_details md
left join mt_goods mg ON md.goods_id = mg.id
LEFT JOIN cvs_goods cg on mg.cvs_good_id = cg.id
<where>
inventory_id = #{mtInventoryDetails.inventoryId}
<if test="mtInventoryDetails.id != null">

View File

@ -67,4 +67,11 @@ public interface MtInventoryDetailsService {
void export(HttpServletResponse response, MtInventoryDetails mtInventoryDetails);
/**
* 根据商品id和店铺id查询总货损量
* @param goodsId
* @param storeId
* @return
*/
Integer getDamageQuantity(Integer goodsId,Integer storeId);
}

View File

@ -2,6 +2,7 @@ package com.fuint.business.convenienceSore.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.entity.MtInventoryDetails;
@ -250,4 +251,19 @@ public class MtInventoryDetailsServiceImpl implements MtInventoryDetailsService
}
}
@Override
public Integer getDamageQuantity(Integer goodsId, Integer storeId) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("goods_id", goodsId);
queryWrapper.eq("store_id", storeId);
List<MtInventoryDetails> list = mtInventoryDetailsDao.selectList(queryWrapper);
Integer damageQuantity = 0;
for (MtInventoryDetails mtInventoryDetails : list) {
if (ObjectUtil.isNotEmpty(mtInventoryDetails.getDamageQuantity())){
damageQuantity += mtInventoryDetails.getDamageQuantity();
}
}
return damageQuantity;
}
}

View File

@ -11,6 +11,7 @@ import com.fuint.business.convenienceSore.entity.StockStatistic;
import com.fuint.business.convenienceSore.entity.StockTrack;
import com.fuint.business.convenienceSore.mapper.StockStatisticMapper;
import com.fuint.business.convenienceSore.service.LJGoodsService;
import com.fuint.business.convenienceSore.service.MtInventoryDetailsService;
import com.fuint.business.convenienceSore.service.StockStatisticService;
import com.fuint.business.convenienceSore.service.StockTrackService;
import com.fuint.business.convenienceSore.vo.StockStatisticVo;
@ -33,6 +34,9 @@ public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper,
@Autowired
@Lazy
private StockTrackService stockTrackService;
@Autowired
@Lazy
private MtInventoryDetailsService inventoryDetailsService;
/**
* 根据条件分页查询库存统计信息
@ -45,6 +49,9 @@ public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper,
Integer storeId = nowAccountInfo.getStoreId();
stockStatisticVo.setStoreId(storeId);
IPage<StockStatisticVo> stockStatisticVoIPage = baseMapper.selectStockList(page, stockStatisticVo);
for (StockStatisticVo record : stockStatisticVoIPage.getRecords()) {
record.setCargoDamage(inventoryDetailsService.getDamageQuantity(record.getGoodsId(),storeId));
}
return stockStatisticVoIPage;
}

View File

@ -7,11 +7,13 @@ import lombok.Data;
public class MtInventoryDetailsVO extends MtInventoryDetails {
private String commodityName; // 商品名称·
private String unit; // 商品名称·
private String goodsNo; // 商品名称·
private Integer supplierId; // 供应商
private Integer cvsGoodId; // 分类
private Integer stock; // 分类
private String goodsSpecs; // 商品规格·
private String unit; // 单位·
private String goodsNo; // 条形码·
private Integer supplierId; // 供应商id
private Integer cvsGoodId; // 分类id
private String cvsGoodName; // 分类名称
private Integer stock; // 库存
/**
* 业务单号
*/

View File

@ -2,6 +2,7 @@ package com.fuint.business.convenienceSore.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fuint.framework.entity.BaseEntity;
import lombok.Data;
@ -52,4 +53,7 @@ public class StockStatisticVo extends BaseEntity {
private String status;
// 操作人
private String realName;
// 货损量
@TableField(exist = false)
private Integer cargoDamage;
}