no message
parent
ad92e11877
commit
60a45927d7
|
|
@ -12119,7 +12119,7 @@
|
||||||
},
|
},
|
||||||
"node_modules/xlsx": {
|
"node_modules/xlsx": {
|
||||||
"version": "0.18.5",
|
"version": "0.18.5",
|
||||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
||||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adler-32": "~1.3.0",
|
"adler-32": "~1.3.0",
|
||||||
|
|
@ -21202,7 +21202,7 @@
|
||||||
},
|
},
|
||||||
"xlsx": {
|
"xlsx": {
|
||||||
"version": "0.18.5",
|
"version": "0.18.5",
|
||||||
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
|
"resolved": "https://registry.npmmirror.com/xlsx/-/xlsx-0.18.5.tgz",
|
||||||
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"adler-32": "~1.3.0",
|
"adler-32": "~1.3.0",
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,22 @@
|
||||||
|
|
||||||
<div class="div2" style="padding-bottom: 10px">
|
<div class="div2" style="padding-bottom: 10px">
|
||||||
<el-form ref="form" :model="param" label-width="80px">
|
<el-form ref="form" :model="param" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="4">
|
||||||
|
<el-form-item label="日期:">
|
||||||
|
<el-date-picker style="width: 300px"
|
||||||
|
v-model="param.日期"
|
||||||
|
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="find">查找</el-button>
|
||||||
<el-button type="success" @click="down">导出</el-button>
|
<el-button type="success" @click="down">导出</el-button>
|
||||||
<el-button type="success" @click="rest">重置</el-button>
|
<el-button type="success" @click="rest">重置</el-button>
|
||||||
|
|
@ -57,9 +73,39 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
import XLSX from "xlsx";
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
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: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
|
@ -78,7 +124,7 @@ export default {
|
||||||
label: '作业类型'
|
label: '作业类型'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: '有效时间',
|
prop: '有效时效',
|
||||||
minWidth: '150px',
|
minWidth: '150px',
|
||||||
label: '有效时间'
|
label: '有效时间'
|
||||||
},
|
},
|
||||||
|
|
@ -100,9 +146,10 @@ export default {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
total: 3,
|
total: 3,
|
||||||
param: {
|
param: {
|
||||||
|
日期:[]
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
checked: false,
|
checked: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -127,7 +174,7 @@ export default {
|
||||||
cellStyle({ row, column }) {
|
cellStyle({ row, column }) {
|
||||||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||||||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||||||
return { 'text-align': 'left' }
|
return { 'text-align': 'center' }
|
||||||
} else {
|
} else {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
@ -156,7 +203,7 @@ export default {
|
||||||
},
|
},
|
||||||
queryUser() {
|
queryUser() {
|
||||||
//列表数据加载
|
//列表数据加载
|
||||||
this.$axios.post(this.$httpUrl + '/JianHuoXiaoLv/queryList', {
|
this.$axios.post(this.$httpUrl + '/GGZXiaoLv/queryList', {
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
pageNum: this.pageNum,
|
pageNum: this.pageNum,
|
||||||
param: this.param,
|
param: this.param,
|
||||||
|
|
@ -180,36 +227,36 @@ export default {
|
||||||
this.queryUser();
|
this.queryUser();
|
||||||
},
|
},
|
||||||
down(){
|
down(){
|
||||||
this.downExcel();
|
this.exportToExcel();
|
||||||
},
|
},
|
||||||
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')
|
|
||||||
});
|
|
||||||
//列表数据加载
|
|
||||||
|
|
||||||
},
|
// 表格数据写入excel,并导出为Excel文件
|
||||||
downloadFile(obj, name, suffix) {
|
exportToExcel(){
|
||||||
//解析流文件,进行下载保存
|
/*const worksheet = XLSX.utils.json_to_sheet(this.tableData);
|
||||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
const workbook = XLSX.utils.book_new();
|
||||||
const link = document.createElement('a')
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
link.style.display = 'none'
|
XLSX.writeFile(workbook, 'table_data.xlsx');*/
|
||||||
link.href = url
|
const XLSX = require('xlsx')
|
||||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
console.log('XLSX',XLSX,FileSaver)
|
||||||
link.setAttribute('download', fileName)
|
// 使用 this.$nextTick 是在dom元素都渲染完成之后再执行
|
||||||
document.body.appendChild(link)
|
this.$nextTick(function () {
|
||||||
link.click()
|
// 设置导出的内容是否只做解析,不进行格式转换 false:要解析, true:不解析
|
||||||
document.body.removeChild(link)
|
const xlsxParam = { raw: true }
|
||||||
|
const wb = XLSX.utils.table_to_book(document.querySelector('#educe-table'), xlsxParam)
|
||||||
|
// 导出excel文件名
|
||||||
|
let fileName = '工作效率分析_' + new Date().getTime() + '.xlsx'
|
||||||
|
|
||||||
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
||||||
|
try {
|
||||||
|
// 下载保存文件
|
||||||
|
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), fileName)
|
||||||
|
} catch (e) {
|
||||||
|
if (typeof console !== 'undefined') {
|
||||||
|
console.log(e, wbout)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wbout
|
||||||
|
})
|
||||||
},
|
},
|
||||||
parseTime(time, cFormat) {
|
parseTime(time, cFormat) {
|
||||||
//获取当前时间
|
//获取当前时间
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-button type="success" @click="find">查找</el-button>
|
<el-button type="success" @click="find">查找</el-button>
|
||||||
<el-button type="success" @click="down">导出</el-button>
|
<el-button type="success" @click="exportToExcel">导出</el-button>
|
||||||
<el-button type="success" @click="rest">重置</el-button>
|
<el-button type="success" @click="rest">重置</el-button>
|
||||||
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
<el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
@ -65,6 +65,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// import * as XLSX from 'xlsx';
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
import XLSX from 'xlsx'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -192,37 +195,33 @@ export default {
|
||||||
this.pageNum=1;
|
this.pageNum=1;
|
||||||
this.queryUser();
|
this.queryUser();
|
||||||
},
|
},
|
||||||
down(){
|
// 表格数据写入excel,并导出为Excel文件
|
||||||
this.downExcel();
|
exportToExcel(){
|
||||||
},
|
/*const worksheet = XLSX.utils.json_to_sheet(this.tableData);
|
||||||
downExcel() {
|
const workbook = XLSX.utils.book_new();
|
||||||
//显示加载图
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
this.tableloding=true;
|
XLSX.writeFile(workbook, 'table_data.xlsx');*/
|
||||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
const XLSX = require('xlsx')
|
||||||
//参数和搜索参数一样
|
console.log('XLSX',XLSX,FileSaver)
|
||||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
// 使用 this.$nextTick 是在dom元素都渲染完成之后再执行
|
||||||
pageSize: this.pageSize,
|
this.$nextTick(function () {
|
||||||
pageNum: this.pageNum,
|
// 设置导出的内容是否只做解析,不进行格式转换 false:要解析, true:不解析
|
||||||
param: this.param,
|
const xlsxParam = { raw: true }
|
||||||
},{responseType:'blob'}).then(res => {
|
const wb = XLSX.utils.table_to_book(document.querySelector('#educe-table'), xlsxParam)
|
||||||
this.tableloding=false;
|
// 导出excel文件名
|
||||||
//重命名文件
|
let fileName = '拣货表单_' + new Date().getTime() + '.xlsx'
|
||||||
this.downloadFile(res.data,'拣货表单'+ '数据', 'xlsx')
|
|
||||||
});
|
|
||||||
//列表数据加载
|
|
||||||
|
|
||||||
},
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
||||||
downloadFile(obj, name, suffix) {
|
try {
|
||||||
//解析流文件,进行下载保存
|
// 下载保存文件
|
||||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), fileName)
|
||||||
const link = document.createElement('a')
|
} catch (e) {
|
||||||
link.style.display = 'none'
|
if (typeof console !== 'undefined') {
|
||||||
link.href = url
|
console.log(e, wbout)
|
||||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
}
|
||||||
link.setAttribute('download', fileName)
|
}
|
||||||
document.body.appendChild(link)
|
return wbout
|
||||||
link.click()
|
})
|
||||||
document.body.removeChild(link)
|
|
||||||
},
|
},
|
||||||
KuS(){
|
KuS(){
|
||||||
//库区下拉列表数据加载
|
//库区下拉列表数据加载
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
import XLSX from 'xlsx'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -243,7 +246,7 @@ export default {
|
||||||
任务号:'',
|
任务号:'',
|
||||||
子任务号:'',
|
子任务号:'',
|
||||||
库区:'',
|
库区:'',
|
||||||
创建日期:''
|
创建日期:[]
|
||||||
},
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
checked: false,
|
checked: false,
|
||||||
|
|
@ -326,36 +329,35 @@ export default {
|
||||||
this.queryUser();
|
this.queryUser();
|
||||||
},
|
},
|
||||||
down(){
|
down(){
|
||||||
this.downExcel();
|
this.exportToExcel();
|
||||||
},
|
},
|
||||||
downExcel() {
|
// 表格数据写入excel,并导出为Excel文件
|
||||||
//显示加载图
|
exportToExcel(){
|
||||||
this.tableloding=true;
|
/*const worksheet = XLSX.utils.json_to_sheet(this.tableData);
|
||||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
const workbook = XLSX.utils.book_new();
|
||||||
//参数和搜索参数一样
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
XLSX.writeFile(workbook, 'table_data.xlsx');*/
|
||||||
pageSize: this.pageSize,
|
const XLSX = require('xlsx')
|
||||||
pageNum: this.pageNum,
|
console.log('XLSX',XLSX,FileSaver)
|
||||||
param: this.param,
|
// 使用 this.$nextTick 是在dom元素都渲染完成之后再执行
|
||||||
},{responseType:'blob'}).then(res => {
|
this.$nextTick(function () {
|
||||||
this.tableloding=false;
|
// 设置导出的内容是否只做解析,不进行格式转换 false:要解析, true:不解析
|
||||||
//重命名文件
|
const xlsxParam = { raw: true }
|
||||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
const wb = XLSX.utils.table_to_book(document.querySelector('#educe-table'), xlsxParam)
|
||||||
});
|
// 导出excel文件名
|
||||||
//列表数据加载
|
let fileName = '拣货效率统计_' + new Date().getTime() + '.xlsx'
|
||||||
|
|
||||||
},
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
||||||
downloadFile(obj, name, suffix) {
|
try {
|
||||||
//解析流文件,进行下载保存
|
// 下载保存文件
|
||||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), fileName)
|
||||||
const link = document.createElement('a')
|
} catch (e) {
|
||||||
link.style.display = 'none'
|
if (typeof console !== 'undefined') {
|
||||||
link.href = url
|
console.log(e, wbout)
|
||||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
}
|
||||||
link.setAttribute('download', fileName)
|
}
|
||||||
document.body.appendChild(link)
|
return wbout
|
||||||
link.click()
|
})
|
||||||
document.body.removeChild(link)
|
|
||||||
},
|
},
|
||||||
KuS(){
|
KuS(){
|
||||||
//库区下拉列表数据加载
|
//库区下拉列表数据加载
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import FileSaver from 'file-saver'
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
import XLSX from 'xlsx'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -252,36 +255,35 @@ export default {
|
||||||
this.queryUser();
|
this.queryUser();
|
||||||
},
|
},
|
||||||
down(){
|
down(){
|
||||||
this.downExcel();
|
this.exportToExcel();
|
||||||
},
|
},
|
||||||
downExcel() {
|
// 表格数据写入excel,并导出为Excel文件
|
||||||
//显示加载图
|
exportToExcel(){
|
||||||
this.tableloding=true;
|
/*const worksheet = XLSX.utils.json_to_sheet(this.tableData);
|
||||||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
const workbook = XLSX.utils.book_new();
|
||||||
//参数和搜索参数一样
|
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
|
||||||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
XLSX.writeFile(workbook, 'table_data.xlsx');*/
|
||||||
pageSize: this.pageSize,
|
const XLSX = require('xlsx')
|
||||||
pageNum: this.pageNum,
|
console.log('XLSX',XLSX,FileSaver)
|
||||||
param: this.param,
|
// 使用 this.$nextTick 是在dom元素都渲染完成之后再执行
|
||||||
},{responseType:'blob'}).then(res => {
|
this.$nextTick(function () {
|
||||||
this.tableloding=false;
|
// 设置导出的内容是否只做解析,不进行格式转换 false:要解析, true:不解析
|
||||||
//重命名文件
|
const xlsxParam = { raw: true }
|
||||||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
const wb = XLSX.utils.table_to_book(document.querySelector('#educe-table'), xlsxParam)
|
||||||
});
|
// 导出excel文件名
|
||||||
//列表数据加载
|
let fileName = '人效管理' + new Date().getTime() + '.xlsx'
|
||||||
|
|
||||||
},
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' })
|
||||||
downloadFile(obj, name, suffix) {
|
try {
|
||||||
//解析流文件,进行下载保存
|
// 下载保存文件
|
||||||
const url = window.URL.createObjectURL(new Blob([obj]))
|
FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), fileName)
|
||||||
const link = document.createElement('a')
|
} catch (e) {
|
||||||
link.style.display = 'none'
|
if (typeof console !== 'undefined') {
|
||||||
link.href = url
|
console.log(e, wbout)
|
||||||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
}
|
||||||
link.setAttribute('download', fileName)
|
}
|
||||||
document.body.appendChild(link)
|
return wbout
|
||||||
link.click()
|
})
|
||||||
document.body.removeChild(link)
|
|
||||||
},
|
},
|
||||||
parseTime(time, cFormat) {
|
parseTime(time, cFormat) {
|
||||||
//获取当前时间
|
//获取当前时间
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.yc.wms.controller;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.sun.istack.NotNull;
|
||||||
import com.yc.wms.bean.Xuliehao;
|
import com.yc.wms.bean.Xuliehao;
|
||||||
import com.yc.wms.service.Xuliehaoqingdan;
|
import com.yc.wms.service.Xuliehaoqingdan;
|
||||||
import com.yc.wms.until.QueryPageUtil;
|
import com.yc.wms.until.QueryPageUtil;
|
||||||
|
|
@ -17,10 +18,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -39,11 +39,27 @@ public class GGZXiaoLvController {
|
||||||
query.setPageSize((int)jsonObject.get("pageSize"));
|
query.setPageSize((int)jsonObject.get("pageSize"));
|
||||||
query.setPageNum((int)jsonObject.get("pageNum"));
|
query.setPageNum((int)jsonObject.get("pageNum"));
|
||||||
JSONObject param= (JSONObject)jsonObject.get("param");
|
JSONObject param= (JSONObject)jsonObject.get("param");
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String startDate="2024-05-01";
|
||||||
|
String endDate=sdf.format(new Date());
|
||||||
|
if (param.getStr("日期")!=null&¶m.getJSONArray("日期").size()>0){
|
||||||
|
startDate=sdf.format(param.getJSONArray("日期").getDate(0));
|
||||||
|
endDate=sdf.format(param.getJSONArray("日期").getDate(1));
|
||||||
|
}
|
||||||
/* 基础sql数据查询*/
|
/* 基础sql数据查询*/
|
||||||
String sql=" select agv.id,agv.robotJobId,agv.targetArea,agv.status,agv.createTime, "
|
String sql=" select Row_number() OVER(order by v.库区,v.工作站 asc) as id,v.库区, "
|
||||||
+" agv.arrivalTime,agv.agvCode,agv.type,agv.classification,agv.founderName, "
|
+" v.工作站,sum(v.有效时效) '有效时效', v.业务类型 ,sum(v.有效时效)/540 '有效时间占比' from ( "
|
||||||
+" agv.jobPriorityType "
|
+" select (case when left(agv.targetArea,1)='1' then '货架到人' when left(agv.targetArea,1)='2' then '料箱到人' end) as '库区', "
|
||||||
+" from agvtask agv ";
|
+" (agv.id) ID,(agv.robotJobId) as '任务号',left(agv.targetArea,3) as '工作站',(agv.status) as '状态', "
|
||||||
|
+" (CONVERT(VARCHAR,agv.createTime , 23)) as '创建时间', "
|
||||||
|
+" (agv.arrivalTime),(agv.agvCode) as '车子',(agv.type) as '类型',(agv.classification) as '业务类型', "
|
||||||
|
+" (agv.founderName) as '创建人', "
|
||||||
|
+" (agv.jobPriorityType) as '加急', (agv.leaveTime) as '到站时间',(agv.returnTime) as '返库时间', "
|
||||||
|
+" DATEDIFF(second,(agv.leaveTime), (agv.returnTime) )/60 as '有效时效' "
|
||||||
|
+" from agvtask agv "
|
||||||
|
+" where CONVERT(VARCHAR,agv.createTime , 23)>='"+startDate+"' "
|
||||||
|
+" and CONVERT(VARCHAR,agv.createTime , 23)<='"+endDate+"' ) v "
|
||||||
|
+" GROUP BY v.库区,v.工作站 ,v.业务类型 ";
|
||||||
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
String sqlCount = "select count(t.id) as nums from (" + sql+") t";
|
||||||
/* 总条数*/
|
/* 总条数*/
|
||||||
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
List<Integer> counts = entityManager.createNativeQuery(sqlCount).getResultList();
|
||||||
|
|
@ -60,13 +76,73 @@ public class GGZXiaoLvController {
|
||||||
+" OFFSET "+ (pageNum-1) * pageSize +" ROWS "
|
+" OFFSET "+ (pageNum-1) * pageSize +" ROWS "
|
||||||
+" FETCH NEXT "+pageSize+" ROWS ONLY; ";
|
+" FETCH NEXT "+pageSize+" ROWS ONLY; ";
|
||||||
|
|
||||||
|
/* 返回数据*/
|
||||||
|
List<GGZXl> returnList=new ArrayList<>();
|
||||||
/* 查询所有数据*/
|
/* 查询所有数据*/
|
||||||
List<GGZXl> jhXlList = entityManager.createNativeQuery(sqlFy, GGZXl.class).getResultList();
|
List<GGZXl> ggzXlList = entityManager.createNativeQuery(sqlFy, GGZXl.class).getResultList();
|
||||||
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), jhXlList);
|
/* 按SAP类型分组*/
|
||||||
|
Map<String, List<GGZXl>> groupedMap = ggzXlList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ggzXl -> Objects.toString(ggzXl.get库区(), "unknown")));
|
||||||
|
/*排序获取建*/
|
||||||
|
List<String> sapKeys = panxu(groupedMap);
|
||||||
|
for (int i = 0; i < sapKeys.size(); i++) {
|
||||||
|
List<GGZXl> ggzXls=groupedMap.get(sapKeys.get(i));
|
||||||
|
GGZXl gz=ggzXls.get(0);
|
||||||
|
int l=1;//合并列
|
||||||
|
|
||||||
|
for (GGZXl ggzXl:ggzXls){
|
||||||
|
l=l+1;
|
||||||
|
}
|
||||||
|
Map<String,int[]> map=new HashMap<>();
|
||||||
|
map.put("库区", new int[]{l, 1});
|
||||||
|
gz.setMergeData(map);
|
||||||
|
returnList.addAll(ggzXls);
|
||||||
|
|
||||||
|
GGZXl xhz=new GGZXl();
|
||||||
|
xhz.set工作站("汇总");
|
||||||
|
returnList.add(xhz);
|
||||||
|
}
|
||||||
|
GGZXl dhz=new GGZXl();
|
||||||
|
dhz.set库区("汇总");
|
||||||
|
dhz.setMergeData(new HashMap() {{
|
||||||
|
put("库区", new int[]{1, 2});
|
||||||
|
}});
|
||||||
|
returnList.add(dhz);
|
||||||
|
Result result=Result.result(200,"操作成功",Long.parseLong(counts.get(0).toString()), returnList);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public List<String> panxu( Map<String, List<GGZXl>> 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<GGZXl> jhBdList=sapJhBdMap.get(areaNames.get(i));
|
||||||
|
GGZXl 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;
|
||||||
|
}
|
||||||
@PostMapping(value = "/download")
|
@PostMapping(value = "/download")
|
||||||
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
public void exportCompany(HttpServletResponse response, @RequestBody String json) throws Exception {
|
||||||
|
|
||||||
|
|
@ -92,25 +168,23 @@ class GGZXl implements Serializable {
|
||||||
/* 库区名称*/
|
/* 库区名称*/
|
||||||
private String 库区="";
|
private String 库区="";
|
||||||
private String 工作站="";
|
private String 工作站="";
|
||||||
private String 出库="";
|
@NotNull
|
||||||
private String 入库="";
|
@Transient
|
||||||
private String 盘点="";
|
private Integer 出库=0;
|
||||||
|
@NotNull
|
||||||
|
@Transient
|
||||||
|
private Integer 入库=0;
|
||||||
|
@NotNull
|
||||||
|
@Transient
|
||||||
|
private Integer 盘点=0;
|
||||||
|
@NotNull
|
||||||
|
@Transient
|
||||||
private Integer 整理=0;
|
private Integer 整理=0;
|
||||||
private Date 有效时间;
|
|
||||||
private Date 有效时间占比;
|
private Integer 有效时效;
|
||||||
|
private Integer 有效时间占比;
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String,int[]> mergeData=new HashMap() {{
|
private Map<String,int[]> mergeData=new HashMap() {{
|
||||||
put("库区", new int[]{1, 1});
|
put("库区", new int[]{0, 0});
|
||||||
}};;
|
}};
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public class JianHuoXiaoLvController {
|
||||||
if (param.getJSONArray("库区")!=null&¶m.getJSONArray("库区").size()>0){
|
if (param.getJSONArray("库区")!=null&¶m.getJSONArray("库区").size()>0){
|
||||||
querySql=querySql+" and 库区 in ("+ StringUtils.strInSql(JSONUtil.toList(param.getJSONArray("库区"), String.class))+")";
|
querySql=querySql+" and 库区 in ("+ StringUtils.strInSql(JSONUtil.toList(param.getJSONArray("库区"), String.class))+")";
|
||||||
}
|
}
|
||||||
if (param.getStr("创建日期")!=null&¶m.getStr("创建日期").length()>0){
|
if (param.getStr("创建日期")!=null&¶m.getJSONArray("创建日期").size()>0){
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
querySql=querySql+" and 创建时间 >= '"+sdf.format(param.getJSONArray("创建日期").getDate(0))+"'";
|
querySql=querySql+" and 创建时间 >= '"+sdf.format(param.getJSONArray("创建日期").getDate(0))+"'";
|
||||||
querySql=querySql+" and 创建时间 <= '"+sdf.format(param.getJSONArray("创建日期").getDate(1))+"'";
|
querySql=querySql+" and 创建时间 <= '"+sdf.format(param.getJSONArray("创建日期").getDate(1))+"'";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue