多查询
parent
08f00ad7f8
commit
0991e6d200
File diff suppressed because it is too large
Load Diff
|
|
@ -15,6 +15,7 @@
|
|||
"file-saver": "^2.0.5",
|
||||
"less-loader": "^12.2.0",
|
||||
"vue": "^2.7.14",
|
||||
"vue-good-table": "^2.21.11",
|
||||
"vue-router": "^3.0.2",
|
||||
"vuex": "^3.1.0",
|
||||
"xlsx": "^0.18.5"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,272 @@
|
|||
|
||||
<template>
|
||||
<div class="div1">
|
||||
|
||||
<div class="div2" style="padding-bottom: 10px">
|
||||
<el-form ref="form" :model="param" label-width="80px">
|
||||
<el-button type="success" @click="find">查找</el-button>
|
||||
<el-button type="success" @click="down">导出</el-button>
|
||||
<el-button type="success" @click="rest">重置</el-button>
|
||||
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="this.tableloding"
|
||||
:height="MaxHeight"
|
||||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||||
:span-method="objectSpanMethod"
|
||||
:data="tableData"
|
||||
id="educe-table"
|
||||
ref="tableData"
|
||||
style="width: 100%;">
|
||||
<el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" :min-width="item.minWidth">
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="出库"
|
||||
label="出库"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="入库"
|
||||
label="入库"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="盘点"
|
||||
label="盘点"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="整理"
|
||||
label="整理"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="pageNum"
|
||||
:page-sizes="[ 50, 100, 200,500]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 表头配置
|
||||
columns: [
|
||||
{
|
||||
prop: '库区',
|
||||
minWidth: '150px',
|
||||
label: '库区'
|
||||
},
|
||||
{
|
||||
prop: '工作站',
|
||||
minWidth: '150px',
|
||||
label: '工作站'
|
||||
},
|
||||
{
|
||||
prop: '作业类型',
|
||||
minWidth: '150px',
|
||||
label: '作业类型'
|
||||
},
|
||||
{
|
||||
prop: '有效时间',
|
||||
minWidth: '150px',
|
||||
label: '有效时间'
|
||||
},
|
||||
{
|
||||
prop: '有效时间占比',
|
||||
minWidth: '150px',
|
||||
label: '有效时间占比'
|
||||
}
|
||||
],
|
||||
/*columns:[
|
||||
prop: 'a1',
|
||||
],*/
|
||||
tableloding: false,
|
||||
isShow:false,//是否展示全部搜索条件
|
||||
tableData: [],
|
||||
pageSize: 50
|
||||
,spanArr: [], //每行合并数
|
||||
pos: 0, //角标索引
|
||||
pageNum: 1,
|
||||
total: 3,
|
||||
param: {
|
||||
},
|
||||
loading: false,
|
||||
checked: false,
|
||||
}
|
||||
},
|
||||
|
||||
computed:{
|
||||
MaxHeight(){
|
||||
return window.innerHeight - 240 +"px";
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.queryUser();
|
||||
},
|
||||
updated() {
|
||||
// 每次更新会重新对 Table 进行重新布局
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.mutipleTable !== undefined) {
|
||||
this.$refs.mutipleTable.doLayout()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 合并单元格样式,主要是针对要合并列的第一个单元格(有其他需要的可自行更改)
|
||||
cellStyle({ row, column }) {
|
||||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||||
return { 'text-align': 'left' }
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
|
||||
},
|
||||
objectSpanMethod({ row, column }) {
|
||||
// 直接返回后端给的对应字段的单元格数据
|
||||
return row['mergeData'][column.property]
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`);
|
||||
this.pageNum = 1;
|
||||
this.pageSize = val;
|
||||
this.queryUser();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pageNum = val;
|
||||
this.queryUser();
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/JianHuoXiaoLv/queryList', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
},err=>{
|
||||
this.tableloding=false;
|
||||
})
|
||||
|
||||
},
|
||||
find(){
|
||||
this.queryUser();
|
||||
},
|
||||
down(){
|
||||
this.downExcel();
|
||||
},
|
||||
downExcel() {
|
||||
//显示加载图
|
||||
this.tableloding=true;
|
||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
||||
//参数和搜索参数一样
|
||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
},{responseType:'blob'}).then(res => {
|
||||
this.tableloding=false;
|
||||
//重命名文件
|
||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
||||
});
|
||||
//列表数据加载
|
||||
|
||||
},
|
||||
downloadFile(obj, name, suffix) {
|
||||
//解析流文件,进行下载保存
|
||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
},
|
||||
parseTime(time, cFormat) {
|
||||
//获取当前时间
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||||
return ''
|
||||
} else if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
},
|
||||
Allquesr(){
|
||||
//查询按钮
|
||||
if(this.checked){
|
||||
this.isShow=true;
|
||||
}else {
|
||||
this.isShow=false;
|
||||
}
|
||||
},
|
||||
rest() {
|
||||
//条件查询重置
|
||||
this.checked=false;
|
||||
this.isShow=false;
|
||||
this.param={};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,246 @@
|
|||
|
||||
<template>
|
||||
<div class="div1">
|
||||
|
||||
<div class="div2" style="padding-bottom: 10px">
|
||||
<el-form ref="form" :model="param" label-width="80px">
|
||||
<el-button type="success" @click="find">查找</el-button>
|
||||
<el-button type="success" @click="down">导出</el-button>
|
||||
<el-button type="success" @click="rest">重置</el-button>
|
||||
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="this.tableloding"
|
||||
:height="MaxHeight"
|
||||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||||
:span-method="objectSpanMethod"
|
||||
:data="tableData"
|
||||
id="educe-table"
|
||||
ref="tableData"
|
||||
style="width: 100%;">
|
||||
<el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" :min-width="item.minWidth" />
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="pageNum"
|
||||
:page-sizes="[ 50, 100, 200,500]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 表头配置
|
||||
columns: [
|
||||
{
|
||||
prop: 'sapName',
|
||||
minWidth: '150px',
|
||||
label: 'SAP类型'
|
||||
},
|
||||
{
|
||||
prop: 'areaName',
|
||||
minWidth: '150px',
|
||||
label: '库区'
|
||||
},
|
||||
{
|
||||
prop: 'formattedDate',
|
||||
minWidth: '150px',
|
||||
label: 'FormattedDate'
|
||||
},
|
||||
{
|
||||
prop: 'taskCount',
|
||||
minWidth: '150px',
|
||||
label: '数量'
|
||||
}
|
||||
],
|
||||
/*columns:[
|
||||
prop: 'a1',
|
||||
],*/
|
||||
tableloding: false,
|
||||
isShow:false,//是否展示全部搜索条件
|
||||
tableData: [],
|
||||
pageSize: 50
|
||||
,spanArr: [], //每行合并数
|
||||
pos: 0, //角标索引
|
||||
pageNum: 1,
|
||||
total: 3,
|
||||
param: {
|
||||
},
|
||||
loading: false,
|
||||
checked: false,
|
||||
}
|
||||
},
|
||||
|
||||
computed:{
|
||||
MaxHeight(){
|
||||
return window.innerHeight - 240 +"px";
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.queryUser();
|
||||
},
|
||||
updated() {
|
||||
// 每次更新会重新对 Table 进行重新布局
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.mutipleTable !== undefined) {
|
||||
this.$refs.mutipleTable.doLayout()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 合并单元格样式,主要是针对要合并列的第一个单元格(有其他需要的可自行更改)
|
||||
cellStyle({ row, column }) {
|
||||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||||
return { 'text-align': 'left' }
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
|
||||
},
|
||||
objectSpanMethod({ row, column }) {
|
||||
// 直接返回后端给的对应字段的单元格数据
|
||||
return row['mergeData'][column.property]
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`);
|
||||
this.pageNum = 1;
|
||||
this.pageSize = val;
|
||||
this.queryUser();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pageNum = val;
|
||||
this.queryUser();
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/JianHuoBiaoDan/queryList', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
},err=>{
|
||||
this.tableloding=false;
|
||||
})
|
||||
|
||||
},
|
||||
find(){
|
||||
this.queryUser();
|
||||
},
|
||||
down(){
|
||||
this.downExcel();
|
||||
},
|
||||
downExcel() {
|
||||
//显示加载图
|
||||
this.tableloding=true;
|
||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
||||
//参数和搜索参数一样
|
||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
},{responseType:'blob'}).then(res => {
|
||||
this.tableloding=false;
|
||||
//重命名文件
|
||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
||||
});
|
||||
//列表数据加载
|
||||
|
||||
},
|
||||
downloadFile(obj, name, suffix) {
|
||||
//解析流文件,进行下载保存
|
||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
},
|
||||
parseTime(time, cFormat) {
|
||||
//获取当前时间
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||||
return ''
|
||||
} else if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
},
|
||||
Allquesr(){
|
||||
//查询按钮
|
||||
if(this.checked){
|
||||
this.isShow=true;
|
||||
}else {
|
||||
this.isShow=false;
|
||||
}
|
||||
},
|
||||
rest() {
|
||||
//条件查询重置
|
||||
this.checked=false;
|
||||
this.isShow=false;
|
||||
this.param={};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -0,0 +1,332 @@
|
|||
|
||||
<template>
|
||||
<div class="div1">
|
||||
|
||||
<div class="div2" style="padding-bottom: 10px">
|
||||
<el-form ref="form" :model="param" label-width="80px">
|
||||
|
||||
<el-button type="success" @click="find">查找</el-button>
|
||||
<el-button type="success" @click="down">导出</el-button>
|
||||
<el-button type="success" @click="rest">重置</el-button>
|
||||
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="this.tableloding"
|
||||
:height="MaxHeight"
|
||||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||||
:span-method="objectSpanMethod"
|
||||
:data="tableData"
|
||||
id="educe-table"
|
||||
ref="tableData"
|
||||
style="width: 100%;">
|
||||
<el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" :min-width="item.minWidth" />
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="pageNum"
|
||||
:page-sizes="[ 50, 100, 200,500]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 表头配置
|
||||
columns: [
|
||||
{
|
||||
prop: '单据类型',
|
||||
minWidth: '150px',
|
||||
label: '单据类型'
|
||||
},
|
||||
{
|
||||
prop: '出库类型',
|
||||
minWidth: '150px',
|
||||
label: '出库类型'
|
||||
},
|
||||
{
|
||||
prop: '任务号',
|
||||
minWidth: '150px',
|
||||
label: '任务号'
|
||||
},
|
||||
{
|
||||
prop: '子任务号',
|
||||
minWidth: '150px',
|
||||
label: '子任务号'
|
||||
},
|
||||
{
|
||||
prop: '库区',
|
||||
minWidth: '150px',
|
||||
label: '库区'
|
||||
},
|
||||
{
|
||||
prop: '拣货行',
|
||||
minWidth: '150px',
|
||||
label: '拣货行'
|
||||
},
|
||||
{
|
||||
prop: '创建时间',
|
||||
minWidth: '150px',
|
||||
label: '创建时间'
|
||||
},
|
||||
{
|
||||
prop: '生成合单任务时间',
|
||||
minWidth: '150px',
|
||||
label: '生成合单任务时间'
|
||||
},
|
||||
{
|
||||
prop: '下发时间',
|
||||
minWidth: '150px',
|
||||
label: '下发时间'
|
||||
},
|
||||
{
|
||||
prop: '全部拣货完成时间',
|
||||
minWidth: '150px',
|
||||
label: '全部拣货完成时间'
|
||||
},
|
||||
{
|
||||
prop: '清点时间',
|
||||
minWidth: '150px',
|
||||
label: '清点时间'
|
||||
},
|
||||
{
|
||||
prop: '合单时间',
|
||||
minWidth: '150px',
|
||||
label: '合单时间'
|
||||
},
|
||||
{
|
||||
prop: '交单时间',
|
||||
minWidth: '150px',
|
||||
label: '交单时间'
|
||||
},
|
||||
{
|
||||
prop: '创建-下发时间',
|
||||
minWidth: '150px',
|
||||
label: '创建-下发时间'
|
||||
},
|
||||
{
|
||||
prop: '下发-拣货时间',
|
||||
minWidth: '150px',
|
||||
label: '下发-拣货时间'
|
||||
},
|
||||
{
|
||||
prop: '拣货-合单时间',
|
||||
minWidth: '150px',
|
||||
label: '拣货-合单时间'
|
||||
},
|
||||
{
|
||||
prop: '拣货-合单时间',
|
||||
minWidth: '150px',
|
||||
label: '拣货-合单时间'
|
||||
},
|
||||
{
|
||||
prop: '合单-交单时间',
|
||||
minWidth: '150px',
|
||||
label: '合单-交单时间'
|
||||
},
|
||||
{
|
||||
prop: '拣货-清点时间',
|
||||
minWidth: '150px',
|
||||
label: '拣货-清点时间'
|
||||
},
|
||||
{
|
||||
prop: '清点-合单时间',
|
||||
minWidth: '150px',
|
||||
label: '清点-合单时间'
|
||||
},
|
||||
{
|
||||
prop: '拣货-交单时间',
|
||||
minWidth: '150px',
|
||||
label: '拣货-交单时间'
|
||||
}
|
||||
],
|
||||
/*columns:[
|
||||
prop: 'a1',
|
||||
],*/
|
||||
tableloding: false,
|
||||
isShow:false,//是否展示全部搜索条件
|
||||
tableData: [],
|
||||
pageSize: 50
|
||||
,spanArr: [], //每行合并数
|
||||
pos: 0, //角标索引
|
||||
pageNum: 1,
|
||||
total: 3,
|
||||
param: {
|
||||
},
|
||||
loading: false,
|
||||
checked: false,
|
||||
}
|
||||
},
|
||||
|
||||
computed:{
|
||||
MaxHeight(){
|
||||
return window.innerHeight - 240 +"px";
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.queryUser();
|
||||
},
|
||||
updated() {
|
||||
// 每次更新会重新对 Table 进行重新布局
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.mutipleTable !== undefined) {
|
||||
this.$refs.mutipleTable.doLayout()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 合并单元格样式,主要是针对要合并列的第一个单元格(有其他需要的可自行更改)
|
||||
cellStyle({ row, column }) {
|
||||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||||
return { 'text-align': 'left' }
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
|
||||
},
|
||||
objectSpanMethod({ row, column }) {
|
||||
// 直接返回后端给的对应字段的单元格数据
|
||||
return row['mergeData'][column.property]
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`);
|
||||
this.pageNum = 1;
|
||||
this.pageSize = val;
|
||||
this.queryUser();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pageNum = val;
|
||||
this.queryUser();
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/JianHuoXiaoLv/queryList', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
},err=>{
|
||||
this.tableloding=false;
|
||||
})
|
||||
|
||||
},
|
||||
find(){
|
||||
this.queryUser();
|
||||
},
|
||||
down(){
|
||||
this.downExcel();
|
||||
},
|
||||
downExcel() {
|
||||
//显示加载图
|
||||
this.tableloding=true;
|
||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
||||
//参数和搜索参数一样
|
||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
},{responseType:'blob'}).then(res => {
|
||||
this.tableloding=false;
|
||||
//重命名文件
|
||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
||||
});
|
||||
//列表数据加载
|
||||
|
||||
},
|
||||
downloadFile(obj, name, suffix) {
|
||||
//解析流文件,进行下载保存
|
||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
},
|
||||
parseTime(time, cFormat) {
|
||||
//获取当前时间
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||||
return ''
|
||||
} else if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
},
|
||||
Allquesr(){
|
||||
//查询按钮
|
||||
if(this.checked){
|
||||
this.isShow=true;
|
||||
}else {
|
||||
this.isShow=false;
|
||||
}
|
||||
},
|
||||
rest() {
|
||||
//条件查询重置
|
||||
this.checked=false;
|
||||
this.isShow=false;
|
||||
this.param={};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -455,23 +455,6 @@ export default {
|
|||
this.tableloding=false;
|
||||
})
|
||||
},
|
||||
LogS(){
|
||||
//日志类型下拉列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/Kucunrizhi/log', {
|
||||
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.Log = res.data;
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
},err=>{
|
||||
this.tableloding=false;
|
||||
})
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/Kucunrizhi/queryRi', {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,335 @@
|
|||
|
||||
<template>
|
||||
<div class="div1">
|
||||
|
||||
<div class="div2" style="padding-bottom: 10px">
|
||||
<el-form ref="form" :model="param" label-width="80px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="下发日期:">
|
||||
<el-date-picker style="width: 325px"
|
||||
v-model="param.issued_Date"
|
||||
type="daterange"
|
||||
align="right"
|
||||
unlink-panels
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:picker-options="pickerOptions">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button type="success" @click="find">查找</el-button>
|
||||
<el-button type="success" @click="down">导出</el-button>
|
||||
<el-button type="success" @click="rest">重置</el-button>
|
||||
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
v-loading="this.tableloding"
|
||||
:height="MaxHeight"
|
||||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||||
:span-method="objectSpanMethod"
|
||||
:data="tableData"
|
||||
id="educe-table"
|
||||
ref="tableData"
|
||||
style="width: 100%;">
|
||||
<el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" :min-width="item.minWidth">
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="出库"
|
||||
label="出库"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="入库"
|
||||
label="入库"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="盘点"
|
||||
label="盘点"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="item.label==='作业类型'"
|
||||
prop="整理"
|
||||
label="整理"
|
||||
width="120">
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
:current-page="pageNum"
|
||||
:page-sizes="[ 50, 100, 200,500]"
|
||||
:page-size="pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
pickerOptions: {
|
||||
shortcuts: [{
|
||||
text: '最近一周',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近一个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近三个月',
|
||||
onClick(picker) {
|
||||
const end = new Date();
|
||||
const start = new Date();
|
||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
},
|
||||
// 表头配置
|
||||
columns: [
|
||||
{
|
||||
prop: '操作人',
|
||||
minWidth: '150px',
|
||||
label: '操作人'
|
||||
},
|
||||
{
|
||||
prop: '整理',
|
||||
minWidth: '150px',
|
||||
label: '整理(行)'
|
||||
},
|
||||
{
|
||||
prop: '拣货',
|
||||
minWidth: '150px',
|
||||
label: '拣货(行)'
|
||||
},
|
||||
{
|
||||
prop: '清点',
|
||||
minWidth: '150px',
|
||||
label: '清点(行)'
|
||||
},
|
||||
{
|
||||
prop: '合单',
|
||||
minWidth: '150px',
|
||||
label: '合单(按容器)'
|
||||
},
|
||||
{
|
||||
prop: '交单',
|
||||
minWidth: '150px',
|
||||
label: '交单(按容器)'
|
||||
},
|
||||
{
|
||||
prop: '盘点',
|
||||
minWidth: '150px',
|
||||
label: '盘点'
|
||||
},
|
||||
{
|
||||
prop: '入库',
|
||||
minWidth: '150px',
|
||||
label: '入库'
|
||||
},
|
||||
{
|
||||
prop: '移库',
|
||||
minWidth: '150px',
|
||||
label: '移库'
|
||||
}
|
||||
|
||||
],
|
||||
tableloding: false,
|
||||
isShow:false,//是否展示全部搜索条件
|
||||
tableData: [],
|
||||
pageSize: 50
|
||||
,spanArr: [], //每行合并数
|
||||
pos: 0, //角标索引
|
||||
pageNum: 1,
|
||||
total: 3,
|
||||
//查询条件
|
||||
param: {
|
||||
issued_Date: []
|
||||
},
|
||||
loading: false,
|
||||
checked: false,
|
||||
}
|
||||
},
|
||||
|
||||
computed:{
|
||||
MaxHeight(){
|
||||
return window.innerHeight - 240 +"px";
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.queryUser();
|
||||
},
|
||||
updated() {
|
||||
// 每次更新会重新对 Table 进行重新布局
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.mutipleTable !== undefined) {
|
||||
this.$refs.mutipleTable.doLayout()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 合并单元格样式,主要是针对要合并列的第一个单元格(有其他需要的可自行更改)
|
||||
cellStyle({ row, column }) {
|
||||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||||
return { 'text-align': 'left' }
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
|
||||
},
|
||||
objectSpanMethod({ row, column }) {
|
||||
// 直接返回后端给的对应字段的单元格数据
|
||||
return row['mergeData'][column.property]
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleDelete(index, row) {
|
||||
console.log(index, row);
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
console.log(`每页 ${val} 条`);
|
||||
this.pageNum = 1;
|
||||
this.pageSize = val;
|
||||
this.queryUser();
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
console.log(`当前页: ${val}`);
|
||||
this.pageNum = val;
|
||||
this.queryUser();
|
||||
},
|
||||
queryUser() {
|
||||
//列表数据加载
|
||||
this.$axios.post(this.$httpUrl + '/RenXiao/queryList', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
}).then(res => res.data)
|
||||
.then(res => {
|
||||
if (res.code == 200) {
|
||||
this.tableData = res.data
|
||||
this.total = res.total
|
||||
} else {
|
||||
this.$message.error('获取数据失败');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
},err=>{
|
||||
this.tableloding=false;
|
||||
})
|
||||
|
||||
},
|
||||
find(){
|
||||
this.queryUser();
|
||||
},
|
||||
down(){
|
||||
this.downExcel();
|
||||
},
|
||||
downExcel() {
|
||||
//显示加载图
|
||||
this.tableloding=true;
|
||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
||||
//参数和搜索参数一样
|
||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
||||
pageSize: this.pageSize,
|
||||
pageNum: this.pageNum,
|
||||
param: this.param,
|
||||
},{responseType:'blob'}).then(res => {
|
||||
this.tableloding=false;
|
||||
//重命名文件
|
||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
||||
});
|
||||
//列表数据加载
|
||||
|
||||
},
|
||||
downloadFile(obj, name, suffix) {
|
||||
//解析流文件,进行下载保存
|
||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
||||
link.setAttribute('download', fileName)
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link)
|
||||
},
|
||||
parseTime(time, cFormat) {
|
||||
//获取当前时间
|
||||
if (arguments.length === 0) {
|
||||
return null
|
||||
}
|
||||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||||
return ''
|
||||
} else if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
},
|
||||
Allquesr(){
|
||||
//查询按钮
|
||||
if(this.checked){
|
||||
this.isShow=true;
|
||||
}else {
|
||||
this.isShow=false;
|
||||
}
|
||||
},
|
||||
rest() {
|
||||
//条件查询重置
|
||||
this.checked=false;
|
||||
this.isShow=false;
|
||||
this.param={};
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -88,6 +88,46 @@ const routes=[
|
|||
},
|
||||
component: () => import('@/components/duochaxun/Xuliehao.vue')
|
||||
},
|
||||
{
|
||||
path:'/JianHuoBiaoDan',
|
||||
name:'JianHuoBiaoDan',
|
||||
meta:{
|
||||
title:'拣货表单'
|
||||
},
|
||||
component: () => import('@/components/duochaxun/JianHuoBiaoDan.vue')
|
||||
},
|
||||
{
|
||||
path:'/JianHuoXiaoLv',
|
||||
name:'JianHuoXiaoLv',
|
||||
meta:{
|
||||
title:'拣货任务效率统计'
|
||||
},
|
||||
component: () => import('@/components/duochaxun/JianHuoXiaoLv.vue')
|
||||
},
|
||||
{
|
||||
path:'/GZZXiaoLv',
|
||||
name:'GZZXiaoLv',
|
||||
meta:{
|
||||
title:'工作站效率'
|
||||
},
|
||||
component: () => import('@/components/duochaxun/GZZXiaoLv.vue')
|
||||
},
|
||||
{
|
||||
path:'/RenXiao',
|
||||
name:'RenXiao',
|
||||
meta:{
|
||||
title:'人效管理'
|
||||
},
|
||||
component: () => import('@/components/duochaxun/RenXiao.vue')
|
||||
},
|
||||
{
|
||||
path:'/Xuliehao',
|
||||
name:'Xuliehao',
|
||||
meta:{
|
||||
title:'序列号库存清点'
|
||||
},
|
||||
component: () => import('@/components/duochaxun/Xuliehao.vue')
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package com.yc.wms.bean;
|
||||
|
||||
public class QueryColumn {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yc.wms.bean.Xuliehao;
|
||||
import com.yc.wms.service.Xuliehaoqingdan;
|
||||
import com.yc.wms.until.QueryPageUtil;
|
||||
import com.yc.wms.until.Result;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/GGZXiaoLv")
|
||||
public class GGZXiaoLvController {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
@Autowired
|
||||
private Xuliehaoqingdan xuliehaoqingdan;
|
||||
|
||||
@PostMapping("/queryList")
|
||||
public Result queryList(@RequestBody String json) {
|
||||
/* 返回data设置*/
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
/* 基础sql数据查询*/
|
||||
String sql=" select agv.id,agv.robotJobId,agv.targetArea,agv.status,agv.createTime, "
|
||||
+" agv.arrivalTime,agv.agvCode,agv.type,agv.classification,agv.founderName, "
|
||||
+" agv.jobPriorityType "
|
||||
+" from agvtask agv ";
|
||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||
/* 总条数*/
|
||||
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
||||
/* 当前页数据*/
|
||||
int pageNum = query.getPageNum();//当前页
|
||||
int pageSize = query.getPageSize();//条数
|
||||
String querySql="";//查询条件
|
||||
|
||||
String sqlFy = "select * from( "
|
||||
+ sql
|
||||
+ ") t where 1=1 "
|
||||
+ querySql
|
||||
+" ORDER BY id "
|
||||
+" OFFSET "+ (pageNum-1) * pageSize +" ROWS "
|
||||
+" FETCH NEXT "+pageSize+" ROWS ONLY; ";
|
||||
|
||||
/* 查询所有数据*/
|
||||
List<GGZXl> jhXlList = entityManager.createNativeQuery(sqlFy, GGZXl.class).getResultList();
|
||||
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), jhXlList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/download")
|
||||
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
||||
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
|
||||
Xuliehao j = JSONUtil.toBean(param.toString(), Xuliehao.class);
|
||||
|
||||
|
||||
xuliehaoqingdan.download( (List<Map<String,Object>>)xuliehaoqingdan.QueryJson(query,j).getData(), response);
|
||||
}
|
||||
}
|
||||
@Data
|
||||
@Entity
|
||||
class GGZXl implements Serializable {
|
||||
/* 序号*/
|
||||
@Id
|
||||
private Long id;
|
||||
/* 库区名称*/
|
||||
private String 库区="";
|
||||
private String 工作站="";
|
||||
private String 出库="";
|
||||
private String 入库="";
|
||||
private String 盘点="";
|
||||
private Integer 整理=0;
|
||||
private Date 有效时间;
|
||||
private Date 有效时间占比;
|
||||
@Transient
|
||||
private Map<String,int[]> mergeData=new HashMap() {{
|
||||
put("库区", new int[]{1, 1});
|
||||
}};;
|
||||
|
||||
public void setMergeData(int[] sap,int[] area){
|
||||
int[] mn={1,1};
|
||||
Map<String,int[]> map=new HashMap<>();
|
||||
|
||||
map.put("sapName", sap);
|
||||
map.put("areaName", area);
|
||||
map.put("taskCount", mn);
|
||||
map.put("formattedDate", mn);
|
||||
this.mergeData = map;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yc.wms.bean.Xuliehao;
|
||||
import com.yc.wms.service.Xuliehaoqingdan;
|
||||
import com.yc.wms.until.QueryPageUtil;
|
||||
import com.yc.wms.until.Result;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/JianHuoBiaoDan")
|
||||
public class JianHuoBiaoDanController {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
@Autowired
|
||||
private Xuliehaoqingdan xuliehaoqingdan;
|
||||
|
||||
@PostMapping("/queryList")
|
||||
public Result queryList(@RequestBody String json) {
|
||||
/* 返回data设置*/
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
/* 基础sql数据查询*/
|
||||
String sql=" select Row_number() OVER(order by pt.sourceType,z.NAME,CONVERT(VARCHAR, t.OPERATE_TIME, 23)) as id, z.NAME as 'area_name',count(t.id) as 'task_count',max(bt.NAME) as 'bt_name',pt.sourceType as 'sap_name', "
|
||||
+" CONVERT(VARCHAR, t.OPERATE_TIME, 23) AS formatted_date "
|
||||
+" from task t "
|
||||
+" left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID "
|
||||
+" left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID "
|
||||
+" left join BILL_TYPE bt on bt.id=pt.BILL_TYPE_ID "
|
||||
+" left join LOCATION loc on loc.id=t.SRC_LOC_ID "
|
||||
+" left join [ZONE] z on z.id=loc.ZONE_ID "
|
||||
+" where t.PLAN_QUANTITY>0 "
|
||||
+" group by pt.sourceType,z.NAME,CONVERT(VARCHAR, t.OPERATE_TIME, 23) ";
|
||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||
/* 总条数*/
|
||||
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
||||
/* 当前页数据*/
|
||||
int pageNum = query.getPageNum();//当前页
|
||||
int pageSize = query.getPageSize();//条数
|
||||
String sqlFy = "select t.* from(" + sql+") t";
|
||||
sqlFy+= " WHERE id BETWEEN " + (pageNum-1) * pageSize + " AND " + (pageNum) * pageSize;
|
||||
List<SapDo> sapDos=new ArrayList<>();
|
||||
/* 查询所有数据*/
|
||||
List<JhBd> jhBdList = entityManager.createNativeQuery(sqlFy,JhBd.class).getResultList();
|
||||
if (jhBdList.size()>0){
|
||||
/*table 合并列行*/
|
||||
int m=0;//列
|
||||
int n=0;//行
|
||||
/* 按SAP类型分组*/
|
||||
Map<String, List<JhBd>> groupedMap = jhBdList.stream()
|
||||
.collect(Collectors.groupingBy(jhBd -> Objects.toString(jhBd.getSapName(), "unknown")));
|
||||
/*遍历所有SAP类型*/
|
||||
List<String> sapKeys = panxu(groupedMap);
|
||||
for (int i = 0; i < sapKeys.size(); i++) {
|
||||
String sapName=sapKeys.get(i);
|
||||
List<JhBd> sapJhBdList=groupedMap.get(sapName);
|
||||
/*合并第一列*/
|
||||
int[] sapMn={sapJhBdList.size(),1};
|
||||
/* 按库区分组*/
|
||||
Map<String, List<JhBd>> sapJhBdMap = sapJhBdList.stream()
|
||||
.collect(Collectors.groupingBy(jhBd -> Objects.toString(jhBd.getAreaName(), "unknown")));
|
||||
/*遍历所有库区*/
|
||||
List<AreaDo> areaDos=new ArrayList<>();// 返回AreaDos
|
||||
List<String> areaNames = panxu(sapJhBdMap);//按表的id进行排序
|
||||
for (int j = 0; j < areaNames.size(); j++) {
|
||||
String areaName=areaNames.get(j);
|
||||
List<JhBd> areaJhBdList=sapJhBdMap.get(areaName);
|
||||
/*合并第二列*/
|
||||
int[] areaMn={areaJhBdList.size(),1};
|
||||
/*按时间FormattedDate进行分组*/
|
||||
Map<String, List<JhBd>> dateJhBdMap = areaJhBdList.stream()
|
||||
.collect(Collectors.groupingBy(jhBd -> Objects.toString(jhBd.getFormattedDate(), "unknown")));
|
||||
/*遍历所有FormattedDate*/
|
||||
List<FormattedDo> formattedDos=new ArrayList<>();// 返回FormattedDos
|
||||
List<String> formattedDates=panxu(dateJhBdMap);
|
||||
for (int k = 0; k < formattedDates.size(); k++) {
|
||||
String formatted=formattedDates.get(k);
|
||||
List<JhBd> jhBds =dateJhBdMap.get(formatted);
|
||||
JhBd jhBd = jhBdList.stream()
|
||||
.filter(person -> person.getId() == jhBds.get(0).getId())
|
||||
.findFirst().get();
|
||||
jhBd.setMergeData(sapMn, areaMn);
|
||||
/* 合并后重置*/
|
||||
sapMn=new int[2];
|
||||
areaMn=new int[2];
|
||||
|
||||
FormattedDo formattedDo=new FormattedDo(formatted, jhBds);
|
||||
formattedDos.add(formattedDo);
|
||||
}
|
||||
/*写入库区*/
|
||||
AreaDo areaDo=new AreaDo();
|
||||
areaDo.setAreaName(areaName);
|
||||
areaDo.setFormatted(formattedDos);
|
||||
areaDos.add(areaDo);
|
||||
}
|
||||
SapDo sapDo=new SapDo(sapName,areaDos);
|
||||
sapDos.add(sapDo);
|
||||
}
|
||||
System.out.println("返回数据:"+sapDos);
|
||||
}else {
|
||||
System.out.println("为查询到值");
|
||||
}
|
||||
|
||||
// long total=counts.get(0);
|
||||
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), jhBdList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public List<String> panxu( Map<String, List<JhBd>> sapJhBdMap){
|
||||
List<String> areaNames = new ArrayList<>(sapJhBdMap.keySet());
|
||||
JSONObject jsonObject=new JSONObject();//排序建关联
|
||||
int[] arr=new int[areaNames.size()];
|
||||
for (int i = 0; i < areaNames.size(); i++) {
|
||||
/* 获取类id*/
|
||||
List<JhBd> jhBdList=sapJhBdMap.get(areaNames.get(i));
|
||||
JhBd jhBd=jhBdList.get(0);
|
||||
/* 添加id映射*/
|
||||
jsonObject.accumulate(jhBd.getId()+"",areaNames.get(i));
|
||||
/* 添加id排序*/
|
||||
arr[i]=Integer.valueOf(jhBd.getId()+"");
|
||||
}
|
||||
int n=arr.length;
|
||||
for (int i = 0; i < n - 1; i++) {
|
||||
for (int j = 0; j < n - i - 1; j++) {
|
||||
if (arr[j] > arr[j + 1]) {
|
||||
// 交换 arr[j] 和 arr[j + 1]
|
||||
int temp = arr[j];
|
||||
arr[j] = arr[j + 1];
|
||||
arr[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
List<String> keyList=new ArrayList<>();
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
String keyName = jsonObject.get(arr[i]+"")+"";
|
||||
keyList.add(keyName);
|
||||
}
|
||||
return keyList;
|
||||
}
|
||||
|
||||
public Result QueryJson(QueryPageUtil query) {
|
||||
|
||||
|
||||
int pageNum = query.getPageNum();//当前页
|
||||
int pageSize = query.getPageSize();//条数
|
||||
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
String sql=" select Row_number() OVER(order by pt.sourceType,z.NAME,CONVERT(VARCHAR, t.OPERATE_TIME, 23)) as id, z.NAME as 'areaName',count(t.id) as 'taskCount',max(bt.NAME) as 'btName',pt.sourceType as 'ptName', "
|
||||
+" CONVERT(VARCHAR, t.OPERATE_TIME, 23) AS FormattedDate "
|
||||
+" from task t "
|
||||
+" left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID "
|
||||
+" left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID "
|
||||
+" left join BILL_TYPE bt on bt.id=pt.BILL_TYPE_ID "
|
||||
+" left join LOCATION loc on loc.id=t.SRC_LOC_ID "
|
||||
+" left join [ZONE] z on z.id=loc.ZONE_ID "
|
||||
+" where t.PLAN_QUANTITY>0 "
|
||||
+" group by pt.sourceType,z.NAME,CONVERT(VARCHAR, t.OPERATE_TIME, 23) ";
|
||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||
String sqlFy = "select t.* from(" + sql+") t";
|
||||
|
||||
sqlFy+= " WHERE id BETWEEN " + (pageNum-1) * pageSize + " AND " + (pageNum) * pageSize;
|
||||
|
||||
//查询总条数量
|
||||
/*Map<String,Object> listCount = jdbcTemplate.queryForMap(sqlCount, new HashMap<>());
|
||||
//查询单页数据
|
||||
List<Map<String,Object>> maps = jdbcTemplate.queryForList(sqlFy, new HashMap<>());*/
|
||||
|
||||
// Result result=Result.result(200,"操作成功",Long.parseLong(listCount.get("nums").toString()), maps);
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@PostMapping(value = "/download")
|
||||
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
||||
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
|
||||
Xuliehao j = JSONUtil.toBean(param.toString(), Xuliehao.class);
|
||||
|
||||
|
||||
xuliehaoqingdan.download( (List<Map<String,Object>>)xuliehaoqingdan.QueryJson(query,j).getData(), response);
|
||||
}
|
||||
}
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
class SapDo {
|
||||
/*SAP类型名称*/
|
||||
String sapMame;
|
||||
/*包含库区*/
|
||||
List<AreaDo> areaList;
|
||||
}
|
||||
@Data
|
||||
class AreaDo {
|
||||
/*库区名称*/
|
||||
String areaName;
|
||||
/*时间集合*/
|
||||
List<FormattedDo> formatted;
|
||||
}
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
class FormattedDo {
|
||||
/*时间*/
|
||||
String formattedDate;
|
||||
/*数量*/
|
||||
List<JhBd> jhBd;
|
||||
}
|
||||
|
||||
/* 拣货表单-sql查询数据*/
|
||||
@Data
|
||||
@Entity
|
||||
class JhBd implements Serializable {
|
||||
/* 序号*/
|
||||
@Id
|
||||
private Long id;
|
||||
/* 库区名称*/
|
||||
private String areaName="";
|
||||
/* 任务数量*/
|
||||
private int taskCount;
|
||||
/* sap类型*/
|
||||
private String sapName="";
|
||||
/* 其他出库*/
|
||||
private String btName="";
|
||||
private String formattedDate="";
|
||||
@Transient
|
||||
private Map<String,int[]> mergeData;
|
||||
|
||||
public void setMergeData(int[] sap,int[] area){
|
||||
int[] mn={1,1};
|
||||
Map<String,int[]> map=new HashMap<>();
|
||||
|
||||
map.put("sapName", sap);
|
||||
map.put("areaName", area);
|
||||
map.put("taskCount", mn);
|
||||
map.put("formattedDate", mn);
|
||||
this.mergeData = map;
|
||||
}
|
||||
public JhBd(){
|
||||
int[] mn={1,1};
|
||||
int[] mnc={0,0};/*默认不显示*/
|
||||
Map<String,int[]> map=new HashMap<>();
|
||||
map.put("sapName", mnc);
|
||||
map.put("areaName", mnc);
|
||||
map.put("taskCount", mn);
|
||||
map.put("formattedDate", mn);
|
||||
this.mergeData = map;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yc.wms.bean.Xuliehao;
|
||||
import com.yc.wms.service.Xuliehaoqingdan;
|
||||
import com.yc.wms.until.QueryPageUtil;
|
||||
import com.yc.wms.until.Result;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/JianHuoXiaoLv")
|
||||
public class JianHuoXiaoLvController {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
@Autowired
|
||||
private Xuliehaoqingdan xuliehaoqingdan;
|
||||
|
||||
@PostMapping("/queryList")
|
||||
public Result queryList(@RequestBody String json) {
|
||||
/* 返回data设置*/
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
/* 基础sql数据查询*/
|
||||
String sql=" select t.id,bt.NAME as '单据类型',pt.sourceType as '出库类型',pt.id as '任务号',t.BILLCODE as '子任务号', "
|
||||
+" z.NAME as '库区',ptd.LINE_NUMBER as '拣货行' ,pt.UPDATE_TIME as '创建时间',t.dateBill3 as '生成合单任务时间', "
|
||||
+" t.dateBill1 as '下发时间',t.OPERATE_TIME as '拣货时间',t.ARRIVAL_TIME as '清点时间',t.operator_Date as '合单时间', "
|
||||
+" t.dateline as '交单时间', "
|
||||
+" DATEDIFF(second, pt.UPDATE_TIME,t.dateBill1 )/60 as '创建-下发时间', "
|
||||
+" DATEDIFF(second, t.dateBill1,t.OPERATE_TIME )/60 as '下发-拣货时间', "
|
||||
+" DATEDIFF(second, t.OPERATE_TIME,t.operator_Date )/60 as '拣货-合单时间', "
|
||||
+" DATEDIFF(second, t.operator_Date,t.dateline )/60 as '合单-交单时间', "
|
||||
+" DATEDIFF(second, t.OPERATE_TIME,t.ARRIVAL_TIME )/60 as '拣货-清点时间', "
|
||||
+" DATEDIFF(second, t.ARRIVAL_TIME,t.operator_Date )/60 as '清点-合单时间', "
|
||||
+" DATEDIFF(second, t.OPERATE_TIME,t.dateline )/60 as '拣货-交单时间' "
|
||||
+" from task t "
|
||||
+" left join PICK_TICKET_DETAIL ptd on ptd.id=t.PICK_TICKET_DETAIL_ID "
|
||||
+" left join PICK_TICKET pt on pt.id=ptd.PICK_TICKET_ID "
|
||||
+" left join BILL_TYPE bt on bt.id=pt.BILL_TYPE_ID "
|
||||
+" left join LOCATION loc on loc.id=t.SRC_LOC_ID "
|
||||
+" left join [ZONE] z on z.id=loc.ZONE_ID "
|
||||
+" where t.PLAN_QUANTITY>0 ";
|
||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||
/* 总条数*/
|
||||
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
||||
/* 当前页数据*/
|
||||
int pageNum = query.getPageNum();//当前页
|
||||
int pageSize = query.getPageSize();//条数
|
||||
String querySql="";//查询条件
|
||||
|
||||
String sqlFy = "select * from( "
|
||||
+ sql
|
||||
+ ") t where 1=1 "
|
||||
+ querySql
|
||||
+" ORDER BY id "
|
||||
+" OFFSET "+ (pageNum-1) * pageSize +" ROWS "
|
||||
+" FETCH NEXT "+pageSize+" ROWS ONLY; ";
|
||||
|
||||
/* 查询所有数据*/
|
||||
List<JhXl> jhXlList = entityManager.createNativeQuery(sqlFy, JhXl.class).getResultList();
|
||||
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), jhXlList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/download")
|
||||
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
||||
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
|
||||
Xuliehao j = JSONUtil.toBean(param.toString(), Xuliehao.class);
|
||||
|
||||
|
||||
xuliehaoqingdan.download( (List<Map<String,Object>>)xuliehaoqingdan.QueryJson(query,j).getData(), response);
|
||||
}
|
||||
}
|
||||
@Data
|
||||
@Entity
|
||||
class JhXl implements Serializable {
|
||||
/* 序号*/
|
||||
@Id
|
||||
private Long id;
|
||||
/* 库区名称*/
|
||||
private String 单据类型="";
|
||||
private String 出库类型="";
|
||||
private String 任务号="";
|
||||
private String 子任务号="";
|
||||
private String 库区="";
|
||||
private Integer 拣货行=0;
|
||||
private Date 创建时间;
|
||||
private Date 生成合单任务时间;
|
||||
private Date 下发时间;
|
||||
private Date 拣货时间;
|
||||
private Date 清点时间;
|
||||
private Date 合单时间;
|
||||
private Date 交单时间;
|
||||
@Transient
|
||||
private Map<String,int[]> mergeData=new HashMap() {{
|
||||
put("单据类型", new int[]{1, 1});
|
||||
}};;
|
||||
|
||||
public void setMergeData(int[] sap,int[] area){
|
||||
int[] mn={1,1};
|
||||
Map<String,int[]> map=new HashMap<>();
|
||||
|
||||
map.put("sapName", sap);
|
||||
map.put("areaName", area);
|
||||
map.put("taskCount", mn);
|
||||
map.put("formattedDate", mn);
|
||||
this.mergeData = map;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
package com.yc.wms.controller;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.yc.wms.bean.Xuliehao;
|
||||
import com.yc.wms.service.Xuliehaoqingdan;
|
||||
import com.yc.wms.until.QueryPageUtil;
|
||||
import com.yc.wms.until.Result;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/RenXiao")
|
||||
public class RenXiaoController {
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
@Autowired
|
||||
private Xuliehaoqingdan xuliehaoqingdan;
|
||||
|
||||
@PostMapping("/queryList")
|
||||
public Result queryList(@RequestBody String json) {
|
||||
/* 返回data设置*/
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
JSONArray jsonArray=param.getJSONArray("issued_Date");
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String startDate="";
|
||||
String endDate="";
|
||||
if (jsonArray.size()>0){
|
||||
Date date1=jsonArray.getDate(0);
|
||||
startDate=sdf.format(date1);
|
||||
Date date2=jsonArray.getDate(1);
|
||||
endDate=sdf.format(date2);
|
||||
}else {
|
||||
startDate="2024-05-01";
|
||||
Date date = new Date();
|
||||
endDate=sdf.format(date);
|
||||
}
|
||||
/* 基础sql数据查询*/
|
||||
String sql=" select Row_number() OVER(order by v.操作人 asc) as id,v.操作人,sum(v.整理 ) '整理',sum(v.拣货 ) as '拣货',sum(v.清点 ) as '清点',sum(v.合单 ) as '合单', "
|
||||
+" sum(v.交单 ) as '交单',sum(v.盘点) as '盘点',sum(v.入库) as '入库',sum(v.移库) as '移库' from ( "
|
||||
+" select r.operator as '操作人',count(r.id) as '整理',0 as '拣货',0 as '清点',0 as '合单', "
|
||||
+" 0 as '交单',0 as '盘点',0 as '入库',0 as '移库' "
|
||||
+" from RECEIVED_RECORD r "
|
||||
+" where CONVERT(VARCHAR, r.RECEIVE_DATE, 23)>='"+startDate+"' and CONVERT(VARCHAR, r.RECEIVE_DATE, 23)<='"+endDate+"' "
|
||||
+" group by r.operator "
|
||||
+" union ALL "
|
||||
+" select w.NAME,0,count(t.id) as '拣货',0,0,0,0,0,0 from task t "
|
||||
+" LEFT JOIN WORKER w ON t.WORKER4_ID=w.id "
|
||||
+" where CONVERT(VARCHAR,t.OPERATE_TIME, 23)>='"+startDate+"' and CONVERT(VARCHAR,t.OPERATE_TIME, 23)<='"+endDate+"' "
|
||||
+" group by w.NAME "
|
||||
+" "
|
||||
+" union ALL "
|
||||
+" select w.NAME,0,0,count(t.id) as '清点',0,0,0,0,0 from task t "
|
||||
+" LEFT JOIN WORKER w ON t.WORKER2_ID=w.id "
|
||||
+" where CONVERT(VARCHAR,t.ARRIVAL_TIME, 23)>='"+startDate+"' and CONVERT(VARCHAR,t.ARRIVAL_TIME, 23)<='"+endDate+"'"
|
||||
+" group by w.NAME "
|
||||
+" "
|
||||
+" union ALL "
|
||||
+" select t.strBill5,0,0,0,count(DISTINCT(s.LP)) as '合单' ,0,0,0,0 from task t "
|
||||
+" left join stock s on s.id=t.DST_LP "
|
||||
+" where CONVERT(VARCHAR,t.operator_Date, 23)>='"+startDate+"' and CONVERT(VARCHAR,t.operator_Date, 23)<='"+endDate+"'"
|
||||
+" group by t.strBill5 "
|
||||
+" union ALL "
|
||||
+" select t.operator,0,0,0,0,count(DISTINCT(s.LP)) as '交单' ,0,0,0 "
|
||||
+" from task t "
|
||||
+" left join stock s on s.id=t.DST_LP "
|
||||
+" where CONVERT(VARCHAR,t.dateline, 23)>='"+startDate+"' and CONVERT(VARCHAR,t.dateline, 23)<='"+endDate+"'"
|
||||
+" group by t.operator "
|
||||
+" union ALL "
|
||||
+" select w.NAME,0,0,0,0,0,count(rd.id) as '盘点' ,0,0 from COUNT_RECORD rd "
|
||||
+" left join WORKER w on w.id=rd.WORKER_ID "
|
||||
+" where CONVERT(VARCHAR,rd.END_DATE, 23)>='"+startDate+"' and CONVERT(VARCHAR,rd.END_DATE, 23)>='"+endDate+"'"
|
||||
+" and rd.WORKER_ID is not null "
|
||||
+" group by w.NAME "
|
||||
+" "
|
||||
+" union ALL "
|
||||
+" select t.operator,0,0,0,0,0,0,count(t.id) as '入库',0 from INVENTORY_LOG t where t.LOG_TYPE='RECEIVING' "
|
||||
+" and CONVERT(VARCHAR,t.occur_Time, 23)>='"+startDate+"' "
|
||||
+" and CONVERT(VARCHAR,t.occur_Time, 23)<='"+endDate+"' "
|
||||
+" group by t.operator "
|
||||
+" union ALL "
|
||||
+" select t.operator,0,0,0,0,0,0,0,count(t.id) as '移库' from INVENTORY_LOG t where t.LOG_TYPE='MOVE' "
|
||||
+" and CONVERT(VARCHAR,t.occur_Time, 23)>='"+startDate+"' "
|
||||
+" and CONVERT(VARCHAR,t.occur_Time, 23)<='"+endDate+"' "
|
||||
+" group by t.operator ) v "
|
||||
+" group by v.操作人 ";
|
||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||
/* 总条数*/
|
||||
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
||||
/* 当前页数据*/
|
||||
int pageNum = query.getPageNum();//当前页
|
||||
int pageSize = query.getPageSize();//条数
|
||||
String querySql="";//查询条件
|
||||
|
||||
String sqlFy = "select * from( "
|
||||
+ sql
|
||||
+ ") t where 1=1 "
|
||||
+ querySql
|
||||
+" ORDER BY id "
|
||||
+" OFFSET "+ (pageNum-1) * pageSize +" ROWS "
|
||||
+" FETCH NEXT "+pageSize+" ROWS ONLY; ";
|
||||
|
||||
/* 查询所有数据*/
|
||||
List<RenXiao> jhXlList = entityManager.createNativeQuery(sqlFy, RenXiao.class).getResultList();
|
||||
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), jhXlList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/download")
|
||||
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
||||
|
||||
QueryPageUtil query =new QueryPageUtil();
|
||||
JSONObject jsonObject= JSONUtil.parseObj(json);
|
||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||
|
||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||
|
||||
Xuliehao j = JSONUtil.toBean(param.toString(), Xuliehao.class);
|
||||
|
||||
|
||||
xuliehaoqingdan.download( (List<Map<String,Object>>)xuliehaoqingdan.QueryJson(query,j).getData(), response);
|
||||
}
|
||||
}
|
||||
@Data
|
||||
@Entity
|
||||
class RenXiao implements Serializable {
|
||||
/* 序号*/
|
||||
@Id
|
||||
private Long id;
|
||||
/* 库区名称*/
|
||||
@Transient
|
||||
private String 组别="";
|
||||
@Transient
|
||||
private String 账号="";
|
||||
private String 操作人="";
|
||||
private Integer 整理=0;
|
||||
private Integer 拣货=0;
|
||||
private Integer 清点=0;
|
||||
private Integer 合单=0;
|
||||
private Integer 交单=0;
|
||||
private Integer 盘点=0;
|
||||
private Integer 入库=0;
|
||||
private Integer 移库=0;
|
||||
@Transient
|
||||
private Map<String,int[]> mergeData=new HashMap() {{
|
||||
put("库区", new int[]{1, 1});
|
||||
}};;
|
||||
|
||||
public void setMergeData(int[] sap,int[] area){
|
||||
int[] mn={1,1};
|
||||
Map<String,int[]> map=new HashMap<>();
|
||||
|
||||
map.put("sapName", sap);
|
||||
map.put("areaName", area);
|
||||
map.put("taskCount", mn);
|
||||
map.put("formattedDate", mn);
|
||||
this.mergeData = map;
|
||||
}
|
||||
}
|
||||
|
|
@ -32,23 +32,9 @@ public class UserController {
|
|||
*/
|
||||
@PostMapping ("/login")
|
||||
public Result login(@RequestBody String user) {
|
||||
// Result result = null;
|
||||
// List<User> list= userService.lambdaQuery()
|
||||
// .eq(User::getUserNo,user.getUserNo())
|
||||
// .eq(User::getPassWord,user.getPassWord()).list();
|
||||
// if(list.size()>0){
|
||||
// List menulist=menuService.lambdaQuery().like(Menu::getMenuRight,list.get(0).getRoleId().toString()).list();
|
||||
// HashMap map =new HashMap();
|
||||
// map.put("user",list.get(0));
|
||||
// map.put("menu",menulist);
|
||||
// result=Result.success(map);
|
||||
// }else{
|
||||
// result=Result.fail("账号或密码输入有误!");
|
||||
// }
|
||||
// return result;
|
||||
JSONArray array=new JSONArray();
|
||||
JSONObject data=new JSONObject();
|
||||
int menuCount=8;
|
||||
int menuCount=12;
|
||||
for (int i=1;i<=menuCount;i++){
|
||||
JSONObject menu=new JSONObject();
|
||||
menu.put("id",i);
|
||||
|
|
@ -85,6 +71,22 @@ public class UserController {
|
|||
menu.put("menuName", "序列号库存清点");
|
||||
menu.put("menuComponent","/Xuliehao");
|
||||
menu.put("menuClick","Xuliehao");
|
||||
}else if(i==9) {
|
||||
menu.put("menuName", "拣货表单");
|
||||
menu.put("menuComponent","/JianHuoBiaoDan");
|
||||
menu.put("menuClick","JianHuoBiaoDan");
|
||||
}else if(i==10) {
|
||||
menu.put("menuName", "拣货任务效率统计");
|
||||
menu.put("menuComponent","/JianHuoXiaoLv");
|
||||
menu.put("menuClick","JianHuoXiaoLv");
|
||||
}else if(i==11) {
|
||||
menu.put("menuName", "工作站效率分析");
|
||||
menu.put("menuComponent","/GZZXiaoLv");
|
||||
menu.put("menuClick","GZZXiaoLv");
|
||||
}else if(i==12) {
|
||||
menu.put("menuName", "人效管理");
|
||||
menu.put("menuComponent","/RenXiao");
|
||||
menu.put("menuClick","RenXiao");
|
||||
}
|
||||
menu.put("menuLevel",i);
|
||||
menu.put("menuParentCode",i);
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ server:
|
|||
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:sqlserver://47.100.54.81:1433;DatabaseName=zwwms
|
||||
url: jdbc:sqlserver://47.103.100.52:1433;DatabaseName=zwtest
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
username: super
|
||||
password: 1K4QfD%ESd1fe@VJ
|
||||
username: WMSDB
|
||||
password: WmsYc@5688
|
||||
|
||||
hikari:
|
||||
connection-timeout: 60000
|
||||
|
|
|
|||
Loading…
Reference in New Issue