| | |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.dto.AxisBean; |
| | | import com.zy.asrs.domain.dto.WorkChartAxis; |
| | | import com.zy.asrs.domain.vo.LocChartPie; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.common.service.CommonService; |
| | |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.protocol.CrnProtocol; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | return R.ok(pakinRep); |
| | | } |
| | | |
| | | @GetMapping("/line/charts") |
| | | public R locIoLineCharts(){ |
| | | Map<String,Object> map=new HashMap<String, Object>(); |
| | | List<AxisBean> list = new ArrayList<AxisBean>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxis(); |
| | | |
| | | if(listChart!=null) { |
| | | ArrayList<Integer> data1 = new ArrayList<Integer>(); |
| | | ArrayList<Integer> data2 = new ArrayList<Integer>(); |
| | | |
| | | SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.DATE, -12); |
| | | for(int i=0;i<12;i++) { |
| | | boolean flag = true; |
| | | calendar.add(Calendar.DATE, 1); |
| | | String str = sf.format(calendar.getTime()); |
| | | for(WorkChartAxis workChart : listChart) { |
| | | if(str.equals(workChart.getYmd())) { |
| | | data1.add(workChart.getInqty()); |
| | | data2.add(workChart.getOutqty()); |
| | | flag = false; |
| | | break; |
| | | } |
| | | } |
| | | if(flag) { |
| | | data1.add(0); |
| | | data2.add(0); |
| | | } |
| | | } |
| | | AxisBean inqty = new AxisBean(); |
| | | inqty.setName("入库数量"); |
| | | Integer[] array1 = new Integer[data1.size()]; |
| | | inqty.setData(data1.toArray(array1)); |
| | | list.add(inqty); |
| | | AxisBean outqty = new AxisBean(); |
| | | outqty.setName("出库数量"); |
| | | Integer[] array2 = new Integer[data2.size()]; |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | } |
| | | map.put("rows",list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 库位使用情况统计 |
| | | */ |
New file |
| | |
| | | package com.zy.asrs.domain.dto; |
| | | |
| | | /** |
| | | * 曲线图表json键 |
| | | * @author admin |
| | | * |
| | | */ |
| | | public class AxisBean { |
| | | private String name; |
| | | private Integer[] data; |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | public Integer[] getData() { |
| | | return data; |
| | | } |
| | | public void setData(Integer[] data) { |
| | | this.data = data; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.domain.dto; |
| | | |
| | | /** |
| | | * 入出库统计曲线图 |
| | | * @author admin |
| | | * @date 2018年12月12日 |
| | | */ |
| | | public class WorkChartAxis { |
| | | private String ymd; |
| | | private int inqty; |
| | | private int outqty; |
| | | |
| | | public String getYmd() { |
| | | return ymd; |
| | | } |
| | | public void setYmd(String ymd) { |
| | | this.ymd = ymd; |
| | | } |
| | | public int getInqty() { |
| | | return inqty; |
| | | } |
| | | public void setInqty(int inqty) { |
| | | this.inqty = inqty; |
| | | } |
| | | public int getOutqty() { |
| | | return outqty; |
| | | } |
| | | public void setOutqty(int outqty) { |
| | | this.outqty = outqty; |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.domain.dto.WorkChartAxis; |
| | | import com.zy.asrs.domain.vo.LocChartPie; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | "order by Min(wm.io_time) asc") |
| | | List<Map<String, Object>> queryPakOutRep(); |
| | | |
| | | //曲线图 |
| | | @Select("select ymd,SUM(sto_qty) inqty,SUM(ret_qty) outqty from asr_sta_inout_view " |
| | | + "where ymd>CONVERT(char(10), DATEADD(DAY,-12,GETDATE()), 120) group by ymd order by ymd") |
| | | public List<WorkChartAxis> getChartAxis(); |
| | | |
| | | @Select("select * from asr_loc_use_view") |
| | | LocChartPie getLocUseRate(); |
| | | |
| | |
| | | return unescape(r[2]); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | function getDateFormat(value){ |
| | | var date = new Date();// 获取当前时间 |
| | | date.setDate(date.getDate() + value);// 设置天数 -1 天 |
| | | return date.Format("MM-dd"); |
| | | } |
| | | /** |
| | | * 日期格式化 |
| | | */ |
| | | Date.prototype.Format = function (fmt) { |
| | | var o = { |
| | | "M+": this.getMonth() + 1, //月份 |
| | | "d+": this.getDate(), //日 |
| | | "h+": this.getHours(), //小时 |
| | | "m+": this.getMinutes(), //分 |
| | | "s+": this.getSeconds(), //秒 |
| | | "q+": Math.floor((this.getMonth() + 3) / 3), //季度 |
| | | "S": this.getMilliseconds() //毫秒 |
| | | }; |
| | | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); |
| | | for (var k in o) |
| | | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); |
| | | return fmt; |
| | | } |
| | |
| | | xAxis: { |
| | | type: 'category', |
| | | boundaryGap: false, |
| | | data: ['1', '2', '3', '4', '5', '6', '7'], |
| | | data: ['1', '2', '3', '4', '5', '6', '7'], |
| | | axisLabel: { |
| | | textStyle:{ |
| | | color:'#aaa', //坐标的字体颜色 |
| | |
| | | } |
| | | |
| | | }, |
| | | series: [{ |
| | | data: [820, 932, 901, 934, 1290, 1330, 1320], |
| | | type: 'line', |
| | | areaStyle: { |
| | | color: '#7494ae' // 折线区域颜色 |
| | | series: [ |
| | | { |
| | | data: [820, 932, 901, 934, 1290, 1330, 1320], |
| | | type: 'line', |
| | | // areaStyle: { |
| | | // color: '#7494ae' // 折线区域颜色 |
| | | // }, |
| | | itemStyle:{ |
| | | normal:{ |
| | | color:'#3590ac', //折点颜色 |
| | | lineStyle:{ |
| | | color:'#3590ac' //折线颜色 |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | itemStyle:{ |
| | | normal:{ |
| | | color:'#3590ac', //折点颜色 |
| | | lineStyle:{ |
| | | color:'#3590ac' //折线颜色 |
| | | { |
| | | data: [820, 932, 901, 934, 1290, 1330, 1320], |
| | | type: 'line', |
| | | // areaStyle: { |
| | | // color: '#d55b35' // 折线区域颜色 |
| | | // }, |
| | | itemStyle:{ |
| | | normal:{ |
| | | color:'#0cbad9', //折点颜色 |
| | | lineStyle:{ |
| | | color:'#07a093' //折线颜色 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }] |
| | | ] |
| | | }; |
| | | |
| | | // 访问量报表加载 |
| | | function initlinChart() { |
| | | var reportView = lineChartOption; |
| | | var xAxisDate = []; |
| | | var seriesDate=[]; |
| | | $.ajax({ |
| | | url: baseUrl+"/monitor/pakin/rep", |
| | | url: baseUrl+"/monitor/line/charts", |
| | | method: 'GET', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | var json = res.data; |
| | | for (var i = 0; i < json.length; i++) { |
| | | xAxisDate[i]=json[i].node; |
| | | seriesDate[i]=json[i].val; |
| | | } |
| | | reportView.xAxis.data=xAxisDate; |
| | | reportView.series[0].data=seriesDate; |
| | | var json = res.data.rows; |
| | | reportView.xAxis.data=[getDateFormat(-11), getDateFormat(-10), getDateFormat(-9), getDateFormat(-8), getDateFormat(-7), getDateFormat(-6), |
| | | getDateFormat(-5), getDateFormat(-4), getDateFormat(-3), getDateFormat(-2), getDateFormat(-1), getDateFormat(-0)]; |
| | | reportView.series[0].data=res.data.rows[0].data; |
| | | reportView.series[1].data=res.data.rows[1].data; |
| | | lineCharts.setOption(reportView) |
| | | } else if (res.code === 403){ |
| | | top.location.href = "/"; |
| | | } else { |
| | | layer.msg(res.msg); |
| | | console.log(res.msg); |
| | | } |
| | | } |
| | | }); |