Commit 5e6e7019 authored by yff's avatar yff

Merge branch 'master' of gitlab.gavelinfo.com:gavelinfo/kwell-mes

parents 9acf4fc4 781cdc12
...@@ -2,13 +2,11 @@ package com.gavel.kwell.controller; ...@@ -2,13 +2,11 @@ package com.gavel.kwell.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.controller.BaseController; import com.gavel.common.base.controller.BaseController;
import com.gavel.common.utils.ThreadContext;
import com.gavel.kwell.service.KmesBoardService; import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.vo.GpfkHgVO; import com.gavel.kwell.vo.GpfkHgVO;
import com.gavel.kwell.vo.PcslVO; import com.gavel.kwell.vo.PcslVO;
import com.gavel.kwell.vo.SdclVO; import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO; import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -16,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -16,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.util.List; import java.util.List;
@Controller @Controller
...@@ -127,25 +127,24 @@ public class KmesBoardController extends BaseController { ...@@ -127,25 +127,24 @@ public class KmesBoardController extends BaseController {
/** /**
* 视频路径api * pdf路径api
*/ */
@RequestMapping(value ="getPdf", method = RequestMethod.POST) @RequestMapping(value ="getPdf")
@ResponseBody public void getPdf(HttpServletResponse response) {
public Object getPdf(@RequestBody JSONObject param) { FileInputStream fileInputStream = kmesBoardService.getPdf();
returnData().add("pdf", kmesBoardService.getPdf()); kmesBoardService.doAttachmentPreview(response, fileInputStream);
return ThreadContext.getReturnData();
} }
/** /**
* 视频路径api * 视频路径api
*/ */
@RequestMapping(value ="getVideo", method = RequestMethod.POST) @RequestMapping(value ="getVideo")
@ResponseBody public void getVideo(HttpServletResponse response) {
public Object getVideo(@RequestBody JSONObject param) { FileInputStream fileInputStream = kmesBoardService.getVideo();
returnData().add("video", kmesBoardService.getVideo()); kmesBoardService.doAttachmentPreview(response, fileInputStream);
return ThreadContext.getReturnData();
} }
} }
...@@ -7,6 +7,8 @@ import com.gavel.kwell.vo.SdclVO; ...@@ -7,6 +7,8 @@ import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO; import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx; import com.gavel.wo.persistent.Pcjhmx;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.util.List; import java.util.List;
...@@ -26,7 +28,11 @@ public interface KmesBoardService extends BaseEditService { ...@@ -26,7 +28,11 @@ public interface KmesBoardService extends BaseEditService {
public List<GpfkHgVO> queryGpfkHgl(); public List<GpfkHgVO> queryGpfkHgl();
public String getPdf(); public FileInputStream getPdf();
public String getVideo(); public FileInputStream getVideo();
public FileInputStream downloadFile(String path);
public void doAttachmentPreview(HttpServletResponse response, FileInputStream fileInputStream);
} }
...@@ -4,6 +4,7 @@ import com.gavel.common.base.service.impl.BaseEditServiceImpl; ...@@ -4,6 +4,7 @@ import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.business.service.CommonService; import com.gavel.common.business.service.CommonService;
import com.gavel.common.utils.DateUtils; import com.gavel.common.utils.DateUtils;
import com.gavel.common.utils.NumberUtils; import com.gavel.common.utils.NumberUtils;
import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.GpfkcxDao; import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.dao.KmesBoardDao; import com.gavel.kwell.dao.KmesBoardDao;
import com.gavel.kwell.persistent.Gpfk; import com.gavel.kwell.persistent.Gpfk;
...@@ -15,10 +16,14 @@ import com.gavel.kwell.vo.PcslVO; ...@@ -15,10 +16,14 @@ import com.gavel.kwell.vo.PcslVO;
import com.gavel.kwell.vo.SdclVO; import com.gavel.kwell.vo.SdclVO;
import com.gavel.kwell.vo.UWoVO; import com.gavel.kwell.vo.UWoVO;
import com.gavel.wo.persistent.Pcjhmx; import com.gavel.wo.persistent.Pcjhmx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -29,6 +34,9 @@ import java.util.List; ...@@ -29,6 +34,9 @@ import java.util.List;
@Transactional @Transactional
public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoardService { public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoardService {
private Logger logger = LoggerFactory.getLogger(KmesBoardServiceImpl.class);
@Autowired @Autowired
private KmesBoardDao kmesBoardDao; private KmesBoardDao kmesBoardDao;
...@@ -135,12 +143,64 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa ...@@ -135,12 +143,64 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
} }
@Override @Override
public String getPdf() { public FileInputStream getPdf() {
return commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_PDF.getId()); String path = commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_PDF.getId());
if(StringUtils.isEmpty(path)) {
logger.error("文件路径参数为空,请检查!");
return null;
}
return downloadFile(path);
}
@Override
public FileInputStream getVideo() {
String path = commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_VIDEO.getId());
if(StringUtils.isEmpty(path)) {
logger.error("文件路径参数为空,请检查!");
return null;
}
return downloadFile(path);
}
@Override
public void doAttachmentPreview(HttpServletResponse response, FileInputStream fileInputStream) {
try {
BufferedInputStream bis = new BufferedInputStream(fileInputStream);
try {
BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
try {
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} finally {
bos.close();
}
} finally {
bis.close();
}
} catch (Exception var23) {
this.logger.error("", var23);
}
} }
@Override @Override
public String getVideo() { public FileInputStream downloadFile(String path) {
return commonService.getStringOptionValue(KwellParamEnum.DASHBORAD_VIDEO.getId()); File dataFile = new File(path);
if (dataFile.exists()) {
//获取输入流
FileInputStream inStream = null;
try {
inStream = new FileInputStream(dataFile);
} catch (FileNotFoundException e) {
logger.error(e.getMessage());
}
return inStream;
}
return null;
} }
} }
package com.gavel.kwell.service.impl; package com.gavel.kwell.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.gavel.common.base.entity.BaseEntity; import com.gavel.common.base.entity.BaseEntity;
import com.gavel.common.base.service.impl.BaseEditServiceImpl; import com.gavel.common.base.service.impl.BaseEditServiceImpl;
import com.gavel.common.utils.NumberUtils;
import com.gavel.common.utils.RedisConnection; import com.gavel.common.utils.RedisConnection;
import com.gavel.common.utils.StringUtils; import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.UpointDao; import com.gavel.kwell.dao.UpointDao;
...@@ -18,9 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,9 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
@Service("upointService") @Service("upointService")
...@@ -75,7 +76,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ ...@@ -75,7 +76,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
@Override @Override
public List<DataPointItem> queryringpoint() { public List<DataPointItem> queryringpoint() {
/* try { try {
List<Upoint> ponitList = upointDao.queryList(PointTypeEnum.RIGN.getId()); List<Upoint> ponitList = upointDao.queryList(PointTypeEnum.RIGN.getId());
if(ponitList==null || ponitList.size()==0){ if(ponitList==null || ponitList.size()==0){
logger.error("点位信息未配置,请检查!"); logger.error("点位信息未配置,请检查!");
...@@ -118,9 +119,9 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ ...@@ -118,9 +119,9 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
} catch (Exception e) { } catch (Exception e) {
logger.error("数据点采集出错!", e); logger.error("数据点采集出错!", e);
} }
return Collections.EMPTY_LIST;*/ return Collections.EMPTY_LIST;
List<DataPointItem> dataPointItems = new ArrayList<DataPointItem>(); /* List<DataPointItem> dataPointItems = new ArrayList<DataPointItem>();
dataPointItems.add(new DataPointItem("R1",new Date().getTime(),1,"R1",0)); dataPointItems.add(new DataPointItem("R1",new Date().getTime(),1,"R1",0));
dataPointItems.add(new DataPointItem("R2",new Date().getTime(),1,"R2",0)); dataPointItems.add(new DataPointItem("R2",new Date().getTime(),1,"R2",0));
dataPointItems.add(new DataPointItem("R3",new Date().getTime(),1,"R3",0)); dataPointItems.add(new DataPointItem("R3",new Date().getTime(),1,"R3",0));
...@@ -129,7 +130,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ ...@@ -129,7 +130,7 @@ public class UpointServiceImpl extends BaseEditServiceImpl implements UpointServ
dataPointItems.add(new DataPointItem("R6",new Date().getTime(),1,"R6",1)); dataPointItems.add(new DataPointItem("R6",new Date().getTime(),1,"R6",1));
dataPointItems.add(new DataPointItem("R7",new Date().getTime(),1,"R7",-1)); dataPointItems.add(new DataPointItem("R7",new Date().getTime(),1,"R7",-1));
dataPointItems.add(new DataPointItem("R8",new Date().getTime(),1,"R8",-1)); dataPointItems.add(new DataPointItem("R8",new Date().getTime(),1,"R8",-1));
return dataPointItems; return dataPointItems;*/
} }
} }
...@@ -40,8 +40,10 @@ ul,ol{ ...@@ -40,8 +40,10 @@ ul,ol{
.allnav{ .allnav{
height: 100%; height: 100%;
} }
#chartJdshCirle{
height: 1.6rem!important;
width: 1.6rem!important;
}
/*第三栏头部*/ /*第三栏头部*/
.rightTop{ .rightTop{
width: 100%; width: 100%;
......
...@@ -141,23 +141,30 @@ ...@@ -141,23 +141,30 @@
}); });
} }
/* 静电手环 */ /* 静电手环 */
function apiqueryringpoint(){ function apiqueryringpoint(chartJdshCirle){
let $point=$(".allnav-right ul li").children() let $point=$(".allnav-right ul li").children()
let $point1=$(".allnav-right ul li>div").children() let $point1=$(".allnav-right ul li>div").children()
console.log($point) let shdata={}
shdata.g=0
shdata.r=0
shdata.s=0
HTTP.post("/mes/kmes/point/queryringpoint", {}, function(result) { HTTP.post("/mes/kmes/point/queryringpoint", {}, function(result) {
if (result['success']) { if (result['success']) {
let data=result.data.records let data=result.data.records
data.forEach(function(e,index){ data.forEach(function(e,index){
if(e.value==0){ if(e.value==0){
shdata.g++
$($point[index]).css("background-color","greenyellow"); $($point[index]).css("background-color","greenyellow");
}else if(e.value==1){ }else if(e.value==1){
$($point[index]).css("background-color","red"); $($point[index]).css("background-color","red");
shdata.r++
}else{ }else{
$($point[index]).css("background-color","skyblue"); $($point[index]).css("background-color","skyblue");
shdata.s++
} }
$($point1[index]).html(e.itemId) $($point1[index]).html(e.itemId)
}) })
setchartJdshCirle(chartJdshCirle,shdata)
} else { } else {
console.log("请求失败") console.log("请求失败")
} }
...@@ -219,23 +226,9 @@ ...@@ -219,23 +226,9 @@
} }
/* pdf */ /* pdf */
function getPdf(time){ function getPdf(time){
HTTP.post("getPdf", {}, function(result) { pdfshow("getPdf","gylct",time||20000)
if (result['success']) {
let data=result.data.pdf
pdfshow(data,"gylct",time||20000)
} else {
console.log("请求失败")
}
});
} }
/* video */ /* video */
function getVideo(){ function getVideo(){
HTTP.post("getVideo", {}, function(result) { $("video").attr('src','getVideo')
if (result['success']) {
let data=result.data.video
$("video").attr('src',data)
} else {
console.log("请求失败")
}
});
} }
\ No newline at end of file
...@@ -2206,7 +2206,51 @@ function setDailyDataEchart(chart,apidata) { ...@@ -2206,7 +2206,51 @@ function setDailyDataEchart(chart,apidata) {
chart.setOption(ops,true); chart.setOption(ops,true);
} }
/* 手环展示 */
function setchartJdshCirle(chartJdshCirle,apidata){
var option = {
color:['greenyellow','red','skyblue'],
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '40',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: apidata.g||0},
{ value: apidata.r||0},
{ value: apidata.s||0},
]
}
]
};
chartJdshCirle.setOption(option);
}
/*合格率*/ /*合格率*/
function setHglEchart(chart,apidata) { function setHglEchart(chart,apidata) {
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<div class="bottom-b"> <div class="bottom-b">
<div id="chartJdsh" class="allnav"> <div id="chartJdsh" class="allnav">
<div class="allnav-left"> <div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div> <div class="circle " id="chartJdshCirle" ></div>
<ul class="allnav-circle"> <ul class="allnav-circle">
<li> <li>
<span class="circle circle-small circle-normal"></span> <span class="circle circle-small circle-normal"></span>
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
var chartHgl=echarts.init(document.getElementById("chartHgl")); var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh")); var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh")); var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle"); var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/ setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/ setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
// setHglEchart(chartHgl);/*合格率*/ // setHglEchart(chartHgl);/*合格率*/
...@@ -330,6 +330,7 @@ ...@@ -330,6 +330,7 @@
speed: 60, //数值越大,速度越慢 speed: 60, //数值越大,速度越慢
rowHeight: 46 //li的高度 rowHeight: 46 //li的高度
}); });
/* 调用 */ /* 调用 */
function getAlldata(){ function getAlldata(){
apisetTimeProductionEchart(myChartSdcl) apisetTimeProductionEchart(myChartSdcl)
...@@ -338,7 +339,7 @@ ...@@ -338,7 +339,7 @@
apisetPieDailyCharty(chartYjh) apisetPieDailyCharty(chartYjh)
apisetHglEchart(chartHgl) apisetHglEchart(chartHgl)
apiqueryWo() apiqueryWo()
apiqueryringpoint() apiqueryringpoint(chartJdshCirle)
} }
getAlldata() getAlldata()
getVideo() getVideo()
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
<div class="bottom-b"> <div class="bottom-b">
<div id="chartJdsh" class="allnav"> <div id="chartJdsh" class="allnav">
<div class="allnav-left"> <div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div> <div class="circle" id="chartJdshCirle" ></div>
<ul class="allnav-circle"> <ul class="allnav-circle">
<li> <li>
<span class="circle circle-small circle-normal"></span> <span class="circle circle-small circle-normal"></span>
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
<span>关闭</span> <span>关闭</span>
</li> </li>
<li> <li>
<span class="circle circle-small circle-offine"></span> <span class="circle circle-small circle-info"></span>
<span>离线</span> <span>警告</span>
</li> </li>
</ul> </ul>
</div> </div>
...@@ -347,7 +347,7 @@ ...@@ -347,7 +347,7 @@
var chartHgl=echarts.init(document.getElementById("chartHgl")); var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh")); var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh")); var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle"); var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/ setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/ setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
setHglEchart(chartHgl);/*合格率*/ setHglEchart(chartHgl);/*合格率*/
...@@ -368,7 +368,7 @@ ...@@ -368,7 +368,7 @@
apisetPieDailyCharty(chartYjh) apisetPieDailyCharty(chartYjh)
apisetHglEchart(chartHgl) apisetHglEchart(chartHgl)
apiqueryWo() apiqueryWo()
apiqueryringpoint() apiqueryringpoint(chartJdshCirle)
apiqueryWorkingWO() apiqueryWorkingWO()
} }
apiqueryWorkingWO() apiqueryWorkingWO()
......
...@@ -256,7 +256,6 @@ ...@@ -256,7 +256,6 @@
var chartHgl=echarts.init(document.getElementById("chartHgl")); var chartHgl=echarts.init(document.getElementById("chartHgl"));
var chartRjh=echarts.init(document.getElementById("chartRjh")); var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh")); var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartJdshCirle=$("#chartJdshCirle");
setTimeProductionEchart(myChartSdcl); /*时段产量*/ setTimeProductionEchart(myChartSdcl); /*时段产量*/
setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/ setDailyDataEchart(chartRpcdcsj); /*日排产达成数据*/
setHglEchart(chartHgl);/*合格率*/ setHglEchart(chartHgl);/*合格率*/
......
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
<div class="bottom-b"> <div class="bottom-b">
<div id="chartJdsh" class="allnav"> <div id="chartJdsh" class="allnav">
<div class="allnav-left"> <div class="allnav-left">
<div class="circle circle-normal" id="chartJdshCirle" ></div> <div class="circle" id="chartJdshCirle" ></div>
<ul class="allnav-circle"> <ul class="allnav-circle">
<li> <li>
<span class="circle circle-small circle-normal"></span> <span class="circle circle-small circle-normal"></span>
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
var chartRjh=echarts.init(document.getElementById("chartRjh")); var chartRjh=echarts.init(document.getElementById("chartRjh"));
var chartYjh=echarts.init(document.getElementById("chartYjh")); var chartYjh=echarts.init(document.getElementById("chartYjh"));
var chartHgl=echarts.init(document.getElementById("chartRpcHgl")); var chartHgl=echarts.init(document.getElementById("chartRpcHgl"));
var chartJdshCirle=$("#chartJdshCirle"); var chartJdshCirle=echarts.init(document.getElementById("chartJdshCirle"));
setTimeProductionEchart(myChartSdcl); /*时段产量*/ setTimeProductionEchart(myChartSdcl); /*时段产量*/
setRpcHglEchart(chartHgl);/*日排产&合格率*/ setRpcHglEchart(chartHgl);/*日排产&合格率*/
setPieDailyChart(chartRjh,80);/*日计划*/ setPieDailyChart(chartRjh,80);/*日计划*/
...@@ -312,7 +312,7 @@ ...@@ -312,7 +312,7 @@
apisetPieDailyCharty(chartYjh) apisetPieDailyCharty(chartYjh)
apisetRpcHglEchart(chartHgl) apisetRpcHglEchart(chartHgl)
apiqueryWo() apiqueryWo()
apiqueryringpoint() apiqueryringpoint(chartJdshCirle)
} }
getAlldata() getAlldata()
getVideo() getVideo()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment