Report. 修改
dep_wangsr
Limy 4 years ago
parent 25aa7deaaa
commit bdc793aa9d

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.nanjing;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.nanjing.domain.Demo;
import com.ruoyi.nanjing.domain.ReportData; import com.ruoyi.nanjing.domain.ReportData;
import com.ruoyi.nanjing.domain.TBdProductinfo; import com.ruoyi.nanjing.domain.TBdProductinfo;
import com.ruoyi.nanjing.service.ITBdProducttypeService; import com.ruoyi.nanjing.service.ITBdProducttypeService;
@ -43,31 +44,57 @@ public class ReportDataController extends BaseController {
List<ReportData> reportDataList = producttypeService.selectReport(map); List<ReportData> reportDataList = producttypeService.selectReport(map);
List<String> paraName = new ArrayList<>(); List<String> paraName = new ArrayList<>();
List<String> barcodelist = new ArrayList<>(); List<String> barcodes = new ArrayList<>();
List<String> stations = new ArrayList<>();
//取出参数名 //取出参数名
reportDataList.forEach(x->barcodelist.add(x.getBarcode())); reportDataList.forEach(x->barcodes.add(x.getBarcode()));
reportDataList.forEach(x->paraName.add(x.getParameaning())); reportDataList.forEach(x->paraName.add(x.getParameaning()));
reportDataList.forEach(x->stations.add(x.getStationName()));
//去重 //去重
List<String> barcodeList = barcodelist.stream().distinct().collect(Collectors.toList()); //条码List
List<String> barcodeList = barcodes.stream().distinct().collect(Collectors.toList());
//参数List
List<String> paraNameList = paraName.stream().distinct().collect(Collectors.toList()); List<String> paraNameList = paraName.stream().distinct().collect(Collectors.toList());
//工位名集合
List<String> stationList = stations.stream().distinct().collect(Collectors.toList());
//定义结果集合 //定义结果集合
List<Map<String,Object>> list = new ArrayList<>(); List<Map<String,Object>> list = new ArrayList<>();
//定义结果集map //定义结果集map
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
for(String item:barcodeList){ for(String item:barcodeList){
map1.put("barcode",item); map1.put("barcode",item);
for (String station:stationList) {
for(String param:paraNameList){ for(String param:paraNameList){
for (ReportData rpd:reportDataList) { for (ReportData rpd:reportDataList) {
if (rpd.getBarcode().equals(item)&&rpd.getParameaning().equals(param)){ // if (rpd.getBarcode().equals(item)&&rpd.getStationName().equals(station)){
// map1.put(station,rpd.getStationName());
// }
if (rpd.getBarcode().equals(item)&&rpd.getStationName().equals(station)&&rpd.getParameaning().equals(param)){
if(rpd.getValue()==null){ if(rpd.getValue()==null){
rpd.setValue("-"); rpd.setValue("-");
} }
map1.put(station,param);
map1.put(param,rpd.getValue()); map1.put(param,rpd.getValue());
// map1.put(param+"value",rpd.getValue());
break; break;
} }
} }
} }
}
// for (String param:paraNameList) {
// for (ReportData rpd:reportDataList) {
// if (rpd.getBarcode().equals(item)&&rpd.getParameaning().equals(param)){
// if(rpd.getValue()==null){
// rpd.setValue("-");
// }
// map1.put(param,rpd.getValue());
//// map1.put(param+"value",rpd.getValue());
// break;
// }
// }
// }
//排序的作用 //排序的作用
TreeMap<String,Object> treeMap = new TreeMap<>(map1); TreeMap<String,Object> treeMap = new TreeMap<>(map1);
list.add(treeMap); list.add(treeMap);

@ -51,14 +51,14 @@
processData: false, processData: false,
contentType: false, contentType: false,
success: function (json) { success: function (json) {
// var coulmnsData = []; var coulmnsData = [];
var columnsArray = []; var columnsArray = [];
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 1}); columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 2});
// var columns = []; var columns = [];
if(json.length>0){ if(json.length>0){
// console.log(Object.keys(json[0]).length); // console.log(Object.keys(json[0]).length);
for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称 for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
var property = (Object.keys(json[0]))[i];//id username var property = (Object.keys(json[0]))[i];
if(property!='barcode'){ if(property!='barcode'){
columnsArray.push({ columnsArray.push({
"title": property, "title": property,
@ -66,13 +66,16 @@
switchable: true, switchable: true,
align:"center", align:"center",
} }
columns.push({
"title": property,
"field": property,
})
); );
} }
} }
} }
// coulmnsData.push(columnsArray); coulmnsData.push(columnsArray);
// coulmnsData.push(columns); coulmnsData.push(columns);
// console.log(columnsArray); // console.log(columnsArray);
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({ $('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
id: "bootstrap-table", id: "bootstrap-table",

@ -13,6 +13,15 @@ public class ReportData extends BaseEntity {
private long id; private long id;
private Date beginTime; private Date beginTime;
private Date endTime; private Date endTime;
private String stationName;
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getBarcode() { public String getBarcode() {
return barcode; return barcode;

@ -57,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="barcode" column="Barcode"/> <result property="barcode" column="Barcode"/>
<result property="parameaning" column="parameaning"/> <result property="parameaning" column="parameaning"/>
<result property="value" column="value"/> <result property="value" column="value"/>
<result property="beginTime" column="begintime"/>
<result property="stationName" column="stationname"/>
</resultMap> </resultMap>
<sql id="selectTBdProducttypeVo"> <sql id="selectTBdProducttypeVo">
select ID, ProductTypeID, ProductTypeName from T_BD_ProductType select ID, ProductTypeID, ProductTypeName from T_BD_ProductType
@ -151,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectReport" parameterType="map" statementType="CALLABLE" resultMap="repo"> <select id="selectReport" parameterType="map" statementType="CALLABLE" resultMap="repo">
{ {
call begin_date4 call begin_date5
( (
#{begin,mode=IN,jdbcType=DATE}, #{begin,mode=IN,jdbcType=DATE},
#{end,mode=IN,jdbcType=DATE}, #{end,mode=IN,jdbcType=DATE},

Loading…
Cancel
Save