|
|
|
@ -59,163 +59,9 @@ public class ReportDataController extends BaseController {
|
|
|
|
|
map.put("begin", begin);
|
|
|
|
|
map.put("end", end);
|
|
|
|
|
map.put("barcode", barcode);
|
|
|
|
|
// List<Map<String,Object>> mapList=producttypeService.selectReport(map);
|
|
|
|
|
List<Map<String,Object>> reportDataList = producttypeService.selectReport(map);
|
|
|
|
|
|
|
|
|
|
// List<DemoData> list = new ArrayList<>();
|
|
|
|
|
// for (ReportData data : reportDataList) {
|
|
|
|
|
// DemoData demoData = new DemoData(data.getBarcode());
|
|
|
|
|
// String datetime= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(data.getBeginTime());
|
|
|
|
|
// demoData.setDate(datetime);
|
|
|
|
|
// Map<String, String> v_map = new HashMap<>();
|
|
|
|
|
// v_map.put(data.getParameaning(), data.getValue());//最后一层添加值
|
|
|
|
|
// if (list.contains(demoData)) {
|
|
|
|
|
// //包含的情况,继续判断Map的key是否存在
|
|
|
|
|
// //真实值
|
|
|
|
|
// DemoData demoData_r = list.get(list.indexOf(demoData));
|
|
|
|
|
// //huoqu
|
|
|
|
|
// Map<String, List<Map<String, String>>> map1 = demoData_r.getMap();
|
|
|
|
|
// if (map1 == null) map1 = new HashMap<>();
|
|
|
|
|
// //包不包含都要添加,主要是看v的创建方式
|
|
|
|
|
//
|
|
|
|
|
// List<Map<String, String>> strings;
|
|
|
|
|
// if (map1.containsKey(data.getStationName())) {
|
|
|
|
|
// //包含压装工位的情况,就用v的集合添加
|
|
|
|
|
// strings = map1.get(data.getStationName());
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// strings = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// strings.add(v_map);
|
|
|
|
|
// map1.put(data.getStationName(), strings);
|
|
|
|
|
//
|
|
|
|
|
// } else {
|
|
|
|
|
// Map<String, List<Map<String,String>>> map1 = new HashMap<>();
|
|
|
|
|
// List<Map<String,String>> list1 = new ArrayList<>();
|
|
|
|
|
// list1.add(v_map);
|
|
|
|
|
// map1.put(data.getStationName(), list1);
|
|
|
|
|
// demoData.setMap(map1);
|
|
|
|
|
// list.add(demoData);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// JSONObject jsonObject=new JSONObject();
|
|
|
|
|
// System.out.println(jsonObject.toJSONString(list));
|
|
|
|
|
// List<String> paraName = new ArrayList<>();
|
|
|
|
|
// List<String> barcodes = new ArrayList<>();
|
|
|
|
|
// List<String> stations = new ArrayList<>();
|
|
|
|
|
// //取出参数名
|
|
|
|
|
// for (int i = 0; i < mapList.size(); i++) {
|
|
|
|
|
// barcodes.add((String) mapList.get(i).get("Barcode"));
|
|
|
|
|
//// mapList.forEach(x->barcodes.add());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for (int i = 0; i < mapList.size(); i++) {
|
|
|
|
|
// paraName.add((String) mapList.get(i).get("parameaning"));
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for (int i = 0; i < mapList.size(); i++) {
|
|
|
|
|
// stations.add((String) mapList.get(i).get("stationname"));
|
|
|
|
|
// }
|
|
|
|
|
//// reportDataList.forEach(x->paraName.add(x.getParameaning()));
|
|
|
|
|
//// reportDataList.forEach(x->stations.add(x.getStationName()));
|
|
|
|
|
// //去重
|
|
|
|
|
// //条码List
|
|
|
|
|
// List<String> barcodeList = barcodes.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
// //参数List
|
|
|
|
|
// 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<>();
|
|
|
|
|
//// //定义结果集map
|
|
|
|
|
// Map<String,Object> map1 = new HashMap<>();
|
|
|
|
|
// System.out.println(barcodeList);
|
|
|
|
|
// int number=0;
|
|
|
|
|
//
|
|
|
|
|
// for (String item:barcodeList) {
|
|
|
|
|
// for (String station : stationList) {
|
|
|
|
|
// for (String param : paraNameList) {
|
|
|
|
|
// for (Map map2:mapList){
|
|
|
|
|
// System.out.println(map2.get("Barcode"));
|
|
|
|
|
//// if (map2.get("Barcode").equals(item) && map2.get("stationname").equals(station)&& map2.get("parameaning").equals(param)){
|
|
|
|
|
//// String paramName = map2.get("stationname") + "-" + map2.get("parameaning");
|
|
|
|
|
//// map1.put(paramName, map2.get("value"));
|
|
|
|
|
//// break;
|
|
|
|
|
//// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// for(String item:barcodeList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// number = number + 1;
|
|
|
|
|
// map1.put("产品条码", item);
|
|
|
|
|
// map1.put("序号", number);
|
|
|
|
|
// for (String station : stationList) {
|
|
|
|
|
// for (String param : paraNameList) {
|
|
|
|
|
// for (Map map2 : mapList) {
|
|
|
|
|
// map1.put("时间", map2.get("begintime"));
|
|
|
|
|
// map1.put("状态", map2.get("stationname"));
|
|
|
|
|
// if (map2.get("Barcode").equals(item) && map2.get("stationname").equals(station) && map2.get("parameaning").equals(param)) {
|
|
|
|
|
// if (map2.get("value") == null) {
|
|
|
|
|
// map2.put("value", "-");
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// String paramName = map2.get("stationname") + "-" + map2.get("parameaning");
|
|
|
|
|
// map1.put(paramName, map2.get("value"));
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// int number=0;
|
|
|
|
|
// for(String item:barcodeList){
|
|
|
|
|
// number=number+1;
|
|
|
|
|
// map1.put("产品条码",item);
|
|
|
|
|
// map1.put("序号",number);
|
|
|
|
|
// for (String station:stationList) {
|
|
|
|
|
// for(String param:paraNameList){
|
|
|
|
|
// for (ReportData rpd:reportDataList) {
|
|
|
|
|
// map1.put("时间",rpd.getBeginTime());
|
|
|
|
|
// map1.put("状态",rpd.getState());
|
|
|
|
|
// if (rpd.getBarcode().equals(item)&&rpd.getStationName().equals(station)&&rpd.getParameaning().equals(param)){
|
|
|
|
|
// if(rpd.getValue()==null){
|
|
|
|
|
// rpd.setValue("-");
|
|
|
|
|
// }
|
|
|
|
|
// String paramName = rpd.getStationName()+"-"+rpd.getParameaning();
|
|
|
|
|
//// map1.put(station,param);
|
|
|
|
|
// map1.put(paramName,rpd.getValue());
|
|
|
|
|
// 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);
|
|
|
|
|
// list.add(treeMap);
|
|
|
|
|
// }
|
|
|
|
|
// String info = JSONArray.toJSONString(list);
|
|
|
|
|
//// System.out.println(info);
|
|
|
|
|
// System.out.println("条码信息查询Json格式:"+info);
|
|
|
|
|
return getDataTable(reportDataList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|