Commit 69fab2e1 by wancheng

生产日报页面展示,数据模拟

parent d66317d6
package com.baosight.hpjx.hp.bi.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.bi.domain.HPBI001;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wancheng
* @date 2024年02月01日 17:18
*/
public class ServiceHPBI001 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.MATERIAL.getCode(),
InventTypeEnum.CONSUMABLE.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
/* public EiInfo initLoad(EiInfo inInfo) {
return query(inInfo);
}*/
/**
* 查询操作
*
* @param inInfo
* @return
*/
@Override
public EiInfo query(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
Map params = new HashMap();
params.put("factory", inInfo.getCellStr(EiConstant.queryBlock, 0, "factory"));
params.put("date", inInfo.getCellStr(EiConstant.queryBlock, 0, "date"));
//汇总数据
outInfo = super.query(inInfo,"HPBI001.querySum",new HPBI001());
//每日数据
List mrsj= super.dao.query("HPBI001.queryDay", params);
outInfo.set("mrsj",mrsj);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return outInfo;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPBI001">
<select id="count" resultClass="int">
SELECT COUNT(*) FROM hpjx.t_hppz001 WHERE 1=1
<isNotEmpty prepend=" AND " property="factory">
FACTORY LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
DATE = #date#
</isNotEmpty>
</select>
<select id="querySum" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.bi.domain.HPBI001">
SELECT
INDNAME AS "indNmae",
DAYVALUE AS "dayValue",
MONVALUE AS "monValue",
YEARVALUE AS "yearValue",
JANVALUE AS "janValue",
FEBVALUE AS "febValue",
MARVLAUE AS "marValue",
APRVALUE AS "aprValue",
MAYVALUE AS "mayValue",
JUNVALUE AS "junValue",
JULVALUE AS "julValue",
AUGVALUE AS "augValue",
SEPVALUE AS "sepValue",
OCTVALUE AS "octValue",
NOVVALUE AS "novValue",
DECVALUE AS "decValue"
FROM (
SELECT '生产产量(吨)' AS INDNAME,121 AS DAYVALUE,
12 AS MONVALUE, 12 AS YEARVALUE,
12 AS JANVALUE, 12 AS FEBVALUE,
12 AS MARVLAUE, 12 AS APRVALUE,
12 AS MAYVALUE, 12 AS JUNVALUE,
12 AS JULVALUE, 12 AS AUGVALUE,
12 AS SEPVALUE, 12 AS OCTVALUE,
12 AS NOVVALUE, 12 AS DECVALUE,
'黄陂' AS FACTORY,
'' AS DATE
FROM DUAL
UNION ALL
SELECT '生产人数(人)' AS INDNAME,123 AS DAYVALUE,
13 AS MONVALUE, 13 AS YEARVALUE,
13 AS JANVALUE, 13 AS FEBVALUE,
13 AS MARVLAUE, 13 AS APRVALUE,
13 AS MAYVALUE, 13 AS JUNVALUE,
13 AS JULVALUE, 13 AS AUGVALUE,
13 AS SEPVALUE, 13 AS OCTVALUE,
13 AS NOVVALUE, 13 AS DECVALUE,
'黄陂' AS FACTORY,
'' AS DATE
FROM DUAL
UNION ALL
SELECT '人均产量(kg)' AS INDNAME,'' AS DAYVALUE,
14 AS MONVALUE, 14 AS YEARVALUE,
14 AS JANVALUE, 14 AS FEBVALUE,
14 AS MARVLAUE, 14 AS APRVALUE,
14 AS MAYVALUE, 14 AS JUNVALUE,
14 AS JULVALUE, 14 AS AUGVALUE,
14 AS SEPVALUE, 14 AS OCTVALUE,
14 AS NOVVALUE, 14 AS DECVALUE,
'黄陂' AS FACTORY,
'' AS DATE
FROM DUAL
) A
WHERE 1=1
<isNotEmpty prepend=" AND " property="factory">
FACTORY LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
DATE = #date#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
INDNAME desc
</isEmpty>
</dynamic>
</select>
<select id="queryDay" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT
SERIES,
VALUE
FROM (
SELECT '工厂' AS SERIES,'黄陂' AS VALUE,NULL AS FACTORY,NULL AS DATE, 1 AS SORT FROM DUAL
UNION ALL
SELECT '生产项目' AS SERIES,CONCAT('横沥10墩底模、沪宁合空心墩') AS VALUE,NULL AS FACTORY,NULL AS DATE, 2 AS SORT FROM DUAL
UNION ALL
SELECT '生产产量' AS SERIES,'组拼 :14.730吨 综合 :15.220吨 加焊 :15.710吨' AS VALUE,NULL AS FACTORY,NULL AS DATE, 3 AS SORT FROM DUAL
UNION ALL
SELECT '生产人数' AS SERIES,'26人' AS VALUE,NULL AS FACTORY,NULL AS DATE, 4 AS SORT FROM DUAL
UNION ALL
SELECT '人均日产' AS SERIES,'585kg' AS VALUE,NULL AS FACTORY,NULL AS DATE, 5 AS SORT FROM DUAL
) A
WHERE 1=1
<isNotEmpty prepend=" AND " property="factory">
FACTORY LIKE CONCAT('%',CONCAT( #factory#,'%'))
</isNotEmpty>
<isNotEmpty prepend=" AND " property="date">
DATE = #date#
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isEmpty property="orderBy">
SORT asc
</isEmpty>
</dynamic>
</select>
</sqlMap>
\ No newline at end of file
$(function () {
/* $("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
buildOption("scrb");
});*/
$("#QUERY").on("click", function (e) {
//resultGrid.dataSource.page(1);
var inInfo = new EiInfo();
EiCommunicator.send("HPBI001","query", inInfo, {
// 服务调用成功后的回调函数 onSuccess
onSuccess: function(response){
$('#mrsj').empty();
var mrsj = response.get('mrsj');
$.each(mrsj, function(index, item) {
str =
'<tr>' +
'<td width=\"30%\">' + item.SERIES + '</td>' +
'<td width=\"70%\">' + item.VALUE + '</td>' +
'</tr>';
$('#mrsj').append(str);
})
buildOption("scrb");
},
// 服务调用失败后的回调函数 onFail
onFail: function(errorMsg, status, e) {
; // 调用发生异常
console.log(errorMsg)
}
}, {async: true});
resultGrid.dataSource.page(1);
buildOption("scrb");
});
// 导出
$("#EXPORT").on("click", function () {
//$(".k-item k-menu-item k-first k-last").click();
//k-link k-menu-link
//$("a[tabindex='0']")[0].click();
$(".k-menu-link").click();
});
IPLATUI.EFGrid.result = {
pageable: {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',1)" >提交</a>';
}
// else if (auditStatus == 1) {
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
// 'onclick="check(' + item.id + ',0)" >撤回</a>';
// }
return template;
}
}
],
}
});
function check(id, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", auditStatus);
EiCommunicator.send('HPSC001', 'check', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
function buildOption(vid){
var myChart = echarts.init(document.getElementById(vid));
var colors = ['#5470C6', '#91CC75', '#EE6666'];
var option = {
title: {
text: '柱状图与折线图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend: {
orient: 'horizontal',
left: 'center',
top: 'bottom', // 放置在底部
data: ['生产产量(吨)', '生产人数(吨)', '人均产量(kg)']
},
xAxis: {
type: 'category',
//boundaryGap: false,
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: [
{
type: 'value',
//name: 'Y轴1',
// 配置项1...
},
{
type: 'value',
//name: 'Y轴2',
// 配置项2...
}
],
series: [
{
name: '生产产量(吨)',
type: 'bar',
color: '#4874CB',
yAxisIndex: 0,
barWidth: 15,
data: [120, 200, 150, 80, 70, 110, 130]
},
{
name: '生产人数(吨)',
type: 'bar',
color: '#EE822F',
yAxisIndex: 0,
barWidth: 15,
data: [130, 120, 200, 160, 80, 70, 140]
},
{
name: '人均产量(kg)',
type: 'line',
color:'#F2BA03',
yAxisIndex: 1, // 指定该系列在y轴上的位置,默认是0,可选为:0 | 1 | 2 | ... | n (正整数)
data: [130, 120, 200, 160, 80, 70, 140]
}
]
};
myChart.setOption(option, true);
}
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript" src="../HP/BI/js/echarts.js"></script>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="报表管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFSelect cname="工厂" defaultValue="0" ename="inqu_status-0-factory" colWidth="3">
<EF:EFOption label="黄陂" value="黄陂"/>
<EF:EFOption label="红安" value="红安"/>
</EF:EFSelect>
<EF:EFDatePicker ename="inqu_status-date" colWidth="3" cname="日期:"
format="yyyy-MM-dd"/>
</div>
<%-- <EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>--%>
</EF:EFRegion>
<EF:EFRegion id="result1" title="每日数据">
<div style="height:200px;width:50%">
<table id = 'mrsj' style="text-align: center;height:100%;width:100%;border: 0">
</table>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="汇总数据">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="indNmae" cname="指标名称" readonly="true"/>
<EF:EFColumn ename="dayValue" cname="日" readonly="true"/>
<EF:EFColumn ename="monValue" cname="月" readonly="true"/>
<EF:EFColumn ename="yearValue" cname="年" readonly="true"/>
<EF:EFColumn ename="janValue" cname="1月" readonly="true"/>
<EF:EFColumn ename="febValue" cname="2月" readonly="true"/>
<EF:EFColumn ename="marValue" cname="3月" readonly="true"/>
<EF:EFColumn ename="aprValue" cname="4月" readonly="true"/>
<EF:EFColumn ename="mayValue" cname="5月" readonly="true"/>
<EF:EFColumn ename="junValue" cname="6月" readonly="true"/>
<EF:EFColumn ename="julValue" cname="7月" readonly="true"/>
<EF:EFColumn ename="augValue" cname="8月" readonly="true"/>
<EF:EFColumn ename="sepValue" cname="9月" readonly="true"/>
<EF:EFColumn ename="octValue" cname="10月" readonly="true"/>
<EF:EFColumn ename="novValue" cname="11月" readonly="true"/>
<EF:EFColumn ename="decValue" cname="12月" readonly="true"/>
</EF:EFGrid>
<div class="row">
<div id="scrb" style="height:300px;width: 50%"></div>
</div>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/BI/HPBI001.js"></script>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
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