Browse Source

库存流水帐明细模仿报表暂存

faster_develop
安虹睿 2 years ago
parent
commit
05f94692a6
  1. 9
      fe/PC/src/api/wms-api.js
  2. 524
      fe/PC/src/views/activeReportManage/reportForm/InventoryBookDetail_innerPage.vue

9
fe/PC/src/api/wms-api.js

@ -585,11 +585,12 @@ export function getListPageSafety(data, url) {
} }
// 库存流水帐明细 报表页面 // 库存流水帐明细 报表页面
export function getInventoryTransactionSerials(data) { export function getInventoryTransactionSerials(data,params) {
return request({ return request({
url: 'http://dev.ccwin-in.com:60099/api/wms/inventory/inventory-transaction/item-serial-list', url: baseURL + 'wms/inventory/inventory-transaction/item-serial-list',
method: 'get', method: 'post',
params: data data:data,
params:params
}) })
} }

524
fe/PC/src/views/activeReportManage/reportForm/InventoryBookDetail_innerPage.vue

@ -2,9 +2,6 @@
<div class="InventoryBookDetail_innerPage" v-loading="loading"> <div class="InventoryBookDetail_innerPage" v-loading="loading">
<!-- 搜索 --> <!-- 搜索 -->
<el-form :inline="true" :model="searchForm" size="small" class="searchHeader"> <el-form :inline="true" :model="searchForm" size="small" class="searchHeader">
<el-form-item label="库位">
<el-input v-model="searchForm.locationCode" placeholder="请输入库位"></el-input>
</el-form-item>
<el-form-item label="零件"> <el-form-item label="零件">
<el-input v-model="searchForm.itemCode" placeholder="请输入零件"></el-input> <el-input v-model="searchForm.itemCode" placeholder="请输入零件"></el-input>
</el-form-item> </el-form-item>
@ -32,84 +29,49 @@
<div class="tableContent" v-if="tableData"> <div class="tableContent" v-if="tableData">
<ul class="tableHeader"> <ul class="tableHeader">
<li>{{tableHeader.companyName}}</li> <li>{{tableHeader.companyName}}</li>
<li class="tableName">库存流水帐料品</li> <li><span class="tableName">库存流水帐 (料品)</span></li>
<li> <li class="timeLi">
<div>交易年月: {{ getYearMonth(searchForm.beginDate) }} - {{ getYearMonth(searchForm.endDate) }}</div> <div class="item">交易年月: {{ getYearMonth(searchForm.beginDate) }} - {{ getYearMonth(searchForm.endDate) }}</div>
<div>制表日期{{ getNow() }}</div> <div class="item">制表日期{{ getNow() }}</div>
</li> </li>
</ul> </ul>
<!-- :span-method="verticalMergeCell" -->
<el-table <el-table
:data="tableData" :data="tableData"
height="calc(100% - 200px)" class="tableEl"
style="width: 90%;margin: 0 auto;" height="calc(100vh - 180px)"
:span-method="verticalMergeCell"
:row-class-name="tableRowClass"
> >
<!-- <el-table-column type="index" label="序号"></el-table-column> -->
<el-table-column <el-table-column
v-for="(item,key) in tableTh" v-for="(item,key) in tableTh"
:prop="item.prop" :prop="item.prop"
:label="item.label" :label="item.label"
width="180" :align="item.prop.toLowerCase().indexOf('qty') >= 0 ? 'right' : 'left'"
:width="item.width"
> >
<template slot-scope="scopeA"> <template slot-scope="scope">
<!-- <div> <div v-if="!scope.row.total">
<span v-if="item.prop == 'itemCode'">{{ scopeA.row[item.prop] }}</span> <div v-if="item.prop == 'itemCode'">
<div v-else> {{ scope.row.level1[item.prop] }}
<div v-for="level2 in scopeA.row.reportErpLocationSerialDtos"> <br/>
<div v-if="item.prop == 'erpLocatioCode'">{{ level2[item.prop] }}</div> <div>配置码{{ scope.row.level1.configuration }}</div>
<div v-else>
<div v-for="level3 in level2.reportLocationSerialDtos">{{ level3[item.prop] }}</div>
</div>
</div>
</div> </div>
<div v-else-if="item.prop == 'erpLocatioCode'">{{ scope.row.level2[item.prop] }}</div>
<div v-else> <div v-else>
<div v-for="level2 in scopeA.row.reportErpLocationSerialDtos"> <div v-if="scope.row.level4">
<div v-for="level3 in level2.reportLocationSerialDtos">{{ level3[item.prop] }}</div> <div v-if="item.prop == 'sumInQty'">{{ scope.row.level4.inQty }}</div>
<div v-else-if="item.prop == 'sumOutQty'">{{ scope.row.level4.outQty }}</div>
<div v-else-if="item.prop == 'createDateTime'">{{ scope.row.level4.createDateTime.slice(0,scope.row.level4.createDateTime.indexOf('T')) }}</div>
<div v-else-if="item.prop == 'locationCode'">{{ scope.row.level4.locatioCode }}</div>
<div v-else>{{ scope.row.level4[item.prop] }}</div>
</div> </div>
<div v-else>{{ scope.row.level3[item.prop] }}</div>
</div> </div>
</div> --> </div>
<div> <div v-else>
<span v-if="item.prop == 'itemCode'">{{ scopeA.row[item.prop] }}</span> <span v-if="totalProps[0] == item.prop">储位小计</span>
<div v-if="item.prop == 'erpLocatioCode'"> <span v-if="totalProps.indexOf(item.prop) >= 0">{{scope.row.total[item.prop]}}</span>
<el-table
:show-header="false"
:data="scopeA.row.reportErpLocationSerialDtos"
>
<el-table-column
prop="erpLocatioCode"
>
<!-- <template slot-scope="scopeB">
<div v-if="item.prop == 'erpLocatioCode'">{{ scopeB.reportLocationSerialDtos.erpLocatioCode }}</div>
</template> -->
</el-table-column>
</el-table>
</div>
<div v-else>
<el-table
:show-header="false"
:data="scopeA.row.reportErpLocationSerialDtos"
>
<el-table-column
prop="erpLocatioCode"
>
<template slot-scope="scopeB">
<el-table
:show-header="false"
:data="scopeB.row.reportLocationSerialDtos"
>
<el-table-column
:prop="item.prop"
>
</el-table-column>
</el-table>
</template>
</el-table-column>
</el-table>
</div>
<!-- <div v-else>
<div v-for="level2 in scope.row.reportErpLocationSerialDtos">
<div v-for="level3 in level2.reportLocationSerialDtos">{{ level3[item.prop] }}</div>
</div>
</div> -->
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
@ -119,187 +81,46 @@
</template> </template>
<script> <script>
import { getInventoryTransactionSerials } from '@/api/wms-api' import { getInventoryTransactionSerials } from '@/api/wms-api'
import { formatTimeStampToNorm } from '@/utils/formatTime'
export default { export default {
name:"InventoryBookDetail_innerPage", name:"InventoryBookDetail_innerPage",
data(){ data(){
return{ return{
loading:false, loading:false,
tableData:[ tableData:null,
{
"itemCode": "VW316C1A028A",
"itemName": "P000000000000053",
"itemDesc1": "后轮眉2内板注塑件右",
"itemDesc2": null,
"configuration": "",
"reportErpLocationSerialDtos": [
{
"erpLocatioCode": "TV",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportLocationSerialDtos": [
{
"locationCode": "TV",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
},
]
},
{
"erpLocatioCode": "TVB",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportLocationSerialDtos": [
{
"locationCode": "TVB",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
},
{
"locationCode": "TVB_A",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
},
{
"locationCode": "TVB_B",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
}
]
},
]
},{
"itemCode": "222222222222222222",
"itemName": "P000000000000053",
"itemDesc1": "后轮眉2内板注塑件右",
"itemDesc2": null,
"configuration": "",
"reportErpLocationSerialDtos": [
{
"erpLocatioCode": "222-TV",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportLocationSerialDtos": [
{
"locationCode": "TV",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
},
{
"locationCode": "TV_A",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
}
]
},
{
"erpLocatioCode": "2222-TVB",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportLocationSerialDtos": [
{
"locationCode": "TVB",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
},
{
"locationCode": "TVB_A",
"firstQty": 0,
"sumInQty": 0,
"sumOutQty": 0,
"nowQty": 0,
"lastQty": 0,
"reportTransactionSerialDtos": []
}
]
},
]
}
],
searchForm:{ searchForm:{
locationCode:'', itemCode:'VW316C1A028A,VW316C1A131AG',
itemCode:'VW316C1A028A',
beginDate: '2023-07-01', beginDate: '2023-07-01',
endDate: '2023-08-01', endDate: '2023-08-01',
}, },
tableHeader:{ tableHeader:{
companyName:localStorage.getItem('companyName') companyName:localStorage.getItem('companyName')
}, },
tableTh1:[
{label:'1-itemCode',prop:'itemCode'},
{label:'1-itemDesc1',prop:'itemDesc1'},
{label:'1-itemDesc2',prop:'itemDesc2'},
{label:'1-itemName',prop:'itemName'},
],
tableTh2:[
{label:'2-erpLocatioCode',prop:'erpLocatioCode'},
{label:'2-firstQty',prop:'firstQty'},
{label:'2-lastQty',prop:'lastQty'},
{label:'2-nowQty',prop:'nowQty'},
{label:'2-sumInQty',prop:'sumInQty'},
{label:'2-sumOutQty',prop:'sumOutQty'},
],
tableTh3:[
{label:'3-firstQty',prop:'firstQty'},
{label:'3-lastQty',prop:'lastQty'},
{label:'3-locationCode',prop:'locationCode'},
{label:'3-nowQty',prop:'nowQty'},
{label:'3-sumInQty',prop:'sumInQty'},
{label:'3-sumOutQty',prop:'sumOutQty'},
],
tableTh:[ tableTh:[
{label:'产品代码',prop:'itemCode'}, {label:'物料代码',prop:'itemCode',width:180},
{label:'储位',prop:'erpLocatioCode'}, {label:'ERP储位',prop:'erpLocatioCode'},
{label:'库位代码',prop:'locationCode',width:180},
// {label:'inQty',prop:'inQty'},
// {label:'outQty',prop:'outQty'},
{label:'number',prop:'number'},
{label:'createDateTime',prop:'createDateTime'},
{label:'docNumber',prop:'docNumber'},
{label:'enumTransType',prop:'enumTransType'},
{label:'enumTransSubType',prop:'enumTransSubType'},
{label:'interFaceName',prop:'interFaceName'},
{label:'firstQty',prop:'firstQty'}, {label:'firstQty',prop:'firstQty'},
{label:'lastQty',prop:'lastQty'}, {label:'lastQty',prop:'lastQty'},
{label:'locationCode',prop:'locationCode'},
{label:'nowQty',prop:'nowQty'}, {label:'nowQty',prop:'nowQty'},
{label:'sumInQty',prop:'sumInQty'}, {label:'sumInQty/inQty',prop:'sumInQty'},
{label:'sumOutQty',prop:'sumOutQty'}, {label:'sumOutQty/outQty',prop:'sumOutQty'},
] ],
totalProps:['firstQty','lastQty','nowQty','sumInQty','sumOutQty'],
indexArray_item: [], //itemCode
indexArray_erp: [], //erpLocatioCode
indexArray_erp2: [], //locationCode
} }
}, },
mounted () { mounted () {},
},
methods:{ methods:{
// //
searchHandle(){ searchHandle(){
@ -307,41 +128,162 @@ export default {
}, },
// //
getYearMonth(date){ getYearMonth(date){
return date.replaceAll('-',"")
}, },
// //
getNow(){ getNow(){
return formatTimeStampToNorm(new Date(),'date')
},
initTableData(res){
let _list = []
res.forEach(item1 => {
item1.reportErpLocationSerialDtos.forEach(item2 => {
item2.reportLocationSerialDtos.forEach((item3,index3)=>{
//
if(item3.reportTransactionSerialDtos && item3.reportTransactionSerialDtos.length > 0){
item3.reportTransactionSerialDtos.forEach((item4,index4)=>{
let _item = {
level1:item1,
level2:item2,
level3:item3,
level4:item4,
}
_list.push(_item)
if(index4 == item3.reportTransactionSerialDtos.length - 1){
_list.push({
level1:item1,
level2:item2,
level3:item3,
level4:item4,
total:item3
})
}
})
}else{
let _item = {
level1:item1,
level2:item2,
level3:item3,
}
_list.push(_item)
if(index3 == item2.reportLocationSerialDtos.length - 1){
_list.push({
level1:item1,
level2:item2,
level3:item3,
total:item2
})
}
}
})
})
});
return _list
}, },
// //
getTableData(){ getTableData(){
this.loading = true this.loading = true
getInventoryTransactionSerials({ getInventoryTransactionSerials(
itemCodes:this.searchForm.itemCode, this.searchForm.itemCode.split(','),{
startDateTime:this.searchForm.beginDate, startDateTime:this.searchForm.beginDate,
endDateTime:this.searchForm.endDate, endDateTime:this.searchForm.endDate,
}).then(res => { }).then(res => {
console.log(res) this.tableData = this.initTableData(res)
this.tableData = res this.getIndexArr()
this.loading = false this.loading = false
}).catch(err => { }).catch(err => {
this.loading = false this.loading = false
}) })
}, },
tableRowClass(data){
if(data.row.total){
return "totalRow"
}
},
getIndexArr(){
// itemCode
let count_item = 0
for (let rowIndex = 0; rowIndex < this.tableData.length; ) {
this.indexArray_item.push(rowIndex)
count_item = this.getRows(rowIndex, this.tableData[rowIndex].level1.itemCode,'itemCode','level1')
rowIndex += count_item
}
// erpLocatioCode
let count_erp = 0
for (let rowIndex = 0; rowIndex < this.tableData.length; ) {
this.indexArray_erp.push(rowIndex)
count_erp = this.getRows(rowIndex, this.tableData[rowIndex].level2.erpLocatioCode,'erpLocatioCode','level2')
rowIndex += count_erp
}
// locationCode
let count_erp2 = 0
for (let rowIndex = 0; rowIndex < this.tableData.length; ) {
this.indexArray_erp2.push(rowIndex)
count_erp2 = this.getRows(rowIndex, this.tableData[rowIndex].level3.locationCode,'locationCode','level3')
rowIndex += count_erp2
}
},
getRows(rowIndex, name,prop,level) {
let count = 0
for (let i = rowIndex; i < this.tableData.length; i++) {
if (this.tableData[i][level][prop] == name) {
count++
} else {
break
}
}
return count
},
// //
verticalMergeCell({ row, column, rowIndex, columnIndex }) { verticalMergeCell({ row, column, rowIndex, columnIndex }) {
console.log(121,row, column, rowIndex, columnIndex) // itemCode
if (columnIndex === 0) { if (columnIndex == 0) {
if (rowIndex % 2 === 0) { let rowCount = 0
if (this.indexArray_item.includes(rowIndex)) {
rowCount = this.getRows(rowIndex, row.level1.itemCode, 'itemCode','level1')
return { return {
rowspan: 2, rowspan: rowCount,
colspan: 1 colspan: 1
}; }
} else { } else {
return { return {
rowspan: 0, rowspan: 0,
colspan: 0 colspan: 0
}; }
}
}
// erpLocatioCode
if (columnIndex == 1) {
let rowCount = 0
if (this.indexArray_erp.includes(rowIndex)) {
rowCount = this.getRows(rowIndex, this.tableData[rowIndex].level2.erpLocatioCode,'erpLocatioCode','level2')
return {
rowspan: rowCount,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 0
}
}
}
// locationCode
if (columnIndex == 2) {
let rowCount = 0
if (this.indexArray_erp2.includes(rowIndex)) {
rowCount = this.getRows(rowIndex, this.tableData[rowIndex].level3.locationCode,'locationCode','level3')
return {
rowspan: rowCount,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 0
}
} }
} }
} }
@ -350,36 +292,98 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.InventoryBookDetail_innerPage{ .InventoryBookDetail_innerPage{
background: #e6e6e6; background: #fff;
height: 100%; height: 100%;
.searchHeader{ .searchHeader{
background: #f1f1f1; background: #f1f1f1;
padding: 20px 30px 0; padding: 20px 30px 0;
border-bottom: 1px solid #dbdbdb; border-bottom: 1px solid #dbdbdb;
}
.el-form-item{ .el-form-item{
margin-right: 25px !important; margin-right: 25px !important;
} }
.el-button{ .el-button{
background: #205f78 !important; background: #205f78 !important;
border-color: #ddd; border-color: #ddd;
border-radius: 2px; border-radius: 2px;
} }
.el-form-item__label{
font-weight: normal;
}
.el-input__inner{
border-radius: 0px !important;
background: #ddd !important;
}
.el-form-item__label{ .el-input__inner:focus,
font-weight: normal; .el-input__inner:hover{
border-color: #ddd;
}
} }
.el-input__inner{ .tableHeader{
border-radius: 0px !important; list-style: none;
background: #ddd !important; text-align: center;
height: 80px;
overflow: hidden;
margin: 10px 0;
.tableName{
letter-spacing: 10px;
border-bottom: #333 solid 1px;
padding: 0 15px;
font-size: 18px;
}
.timeLi{
display: flex;
justify-content: center;
.item{
margin: 0 10px;
}
}
} }
.el-input__inner:focus, .tableEl{
.el-input__inner:hover{ width: 100%;
border-color: #ddd; margin: 0px auto;
// background: transparent !important;
.el-table__cell{
vertical-align: initial !important;
padding: 5px 0 !important;
background: transparent !important;
}
tr{
background: transparent !important;
border: none !important;
}
th.el-table__cell{
padding: 0 !important;
color: #000 !important;
border: none !important;
border-bottom: #333 solid 1px !important;
.cell{
vertical-align: bottom !important;
}
}
td{
border: none !important;
color: #000 !important;
}
.totalRow{
td{
border-top: #333 solid 1px !important;
}
}
} }
} }

Loading…
Cancel
Save