diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java index 696b5f4a..f6f74b30 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java @@ -18,7 +18,10 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; @Controller @RequestMapping("/nanjing/selectStationPara") @@ -29,7 +32,6 @@ public class StationParaInfoController extends BaseController { @Autowired private ITBdSubstationService substationService; - @RequiresPermissions("nanjing:StationPara:view") @GetMapping() public String ProRpList(ModelMap map) { @@ -54,14 +56,7 @@ public class StationParaInfoController extends BaseController { map.put("Barcode", ""); map.put("SemiBarcode", semiBarcode); map.put("StateID", ""); - List> list=tracestateService.selectStationPara(map); -// List> list = tracestateService.selectStationPara(map); -// Map newMAP=new HashMap(); -// for(Map map1 : list){ -// if (map1.containsKey("产品码")){ -// newMAP.put("产品码",map1.get("产品码")); -// } -// } + List> list = tracestateService.selectStationPara(map); for (int i = 0; i < list.size(); i++) { if (list.get(i).containsKey("产品码")) { continue; @@ -72,27 +67,6 @@ public class StationParaInfoController extends BaseController { return getDataTable(list); } -// public static void main(String[] args) { -// List> maps=new ArrayList<>(); -// Map map=new HashMap(); -// map.put("测试","1552"); -// map.put("测试2","58146"); -// map.put("产品码","58533"); -// maps.add(map); -// Map newMAP=new HashMap(); -// List> newListMap=new ArrayList<>(); -// for (Map map1 : maps){ -// if (map1.containsKey("产品码")){ -// newMAP.put("产品码",map1.get("产品码")); -// }else { -// newMAP.put(); -// } -// newListMap.add(newMAP); -// } -// System.out.println(maps); -// } - - // @RequiresPermissions("nanjing:StationPara:export") // @Log(title = "产品码查询", businessType = BusinessType.EXPORT) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java index 0b7470ab..3c9213d8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProductinfoController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.nanjing; +import java.util.ArrayList; import java.util.List; import com.ruoyi.common.core.text.Convert; @@ -78,9 +79,20 @@ public class TBdProductinfoController extends BaseController public String add(ModelMap map) { List list = tBdProductinfoService.selectTBdProductinfo(); - int max = Convert.toInt(list.get(0).getProductID()); - list.get(0).setProductID(max+1L); - map.addAttribute("pt",list); + int max; + if(list.size()==0){ + max=0; + List list1 = new ArrayList<>(); + TBdProductinfo tBdProductinfo = new TBdProductinfo(); + tBdProductinfo.setProductID(max+1L); + list1.add(tBdProductinfo); + map.addAttribute("pt",list1); + } + else{ + max = Convert.toInt(list.get(0).getProductID()); + list.get(0).setProductID(max+1L); + map.addAttribute("pt",list); + } return prefix + "/add"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java index abd3a622..8cabeb40 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdProducttypeController.java @@ -1,8 +1,10 @@ package com.ruoyi.web.controller.nanjing; +import java.util.ArrayList; import java.util.List; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.nanjing.domain.TBdProductinfo; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -77,10 +79,20 @@ public class TBdProducttypeController extends BaseController public String add(ModelMap map) { List list = tBdProducttypeService.selectTBdProducttype(); - int max = Convert.toInt(list.get(0).getProductTypeID()); - String oper = max + 1+""; - list.get(0).setProductTypeID(oper); - map.addAttribute("pt",list); + int max ; + if(list.size()==0){ + max = 0; + List list1 = new ArrayList<>(); + TBdProducttype tBdProducttype = new TBdProducttype(); + tBdProducttype.setProductTypeID(max+1L+""); + map.addAttribute("pt",list1); + }else{ + max = Convert.toInt(list.get(0).getProductTypeID()); + String oper = max + 1+""; + list.get(0).setProductTypeID(oper); + map.addAttribute("pt",list); + } + return prefix + "/add"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java index 871bfc7b..f2a230de 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/TBdSubstationController.java @@ -1,9 +1,6 @@ package com.ruoyi.web.controller.nanjing; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.text.Convert; @@ -108,17 +105,36 @@ public class TBdSubstationController extends BaseController { //工位序号+ List list = tBdSubstationService.selectStationcode(); - int max = Convert.toInt(list.get(0).getStationID()); - list.get(0).setStationID(max+1L); + int max; + if(list.size()==0){ + max = 0; + List lists = new ArrayList<>(); + TBdSubstation tBdSubstation = new TBdSubstation(); + tBdSubstation.setStationID(max+1L); + lists.add(tBdSubstation); + map.addAttribute("si",lists); + }else{ + max = Convert.toInt(list.get(0).getStationID()); + list.get(0).setStationID(max+1L); + map.addAttribute("si",list); + } //排序id+ List list1 = tBdSubstationService.selectOrderid(); - int max1 = Convert.toInt(list.get(0).getOrderID()); - list.get(0).setOrderID(max1+1L); - + int max1; + if(list1.size()==0){ + max1 = 0; + List list2 = new ArrayList<>(); + TBdSubstation tBdSubstation = new TBdSubstation(); + tBdSubstation.setOrderID(max1+1L); + list2.add(tBdSubstation); + map.addAttribute("oi",list2); + }else{ + max1 = Convert.toInt(list.get(0).getOrderID()); + list1.get(0).setOrderID(max1+1L); + map.addAttribute("oi",list1); + } List linetypes = linetypeService.selectTBdLinetypeList(new TBdLinetype()); List stationtypes = stationtypeService.selectTBdStationtypeList(new TBdStationtype()); - map.addAttribute("si",list); - map.addAttribute("oi",list); map.addAttribute("linename",linetypes); map.addAttribute("stationtype",stationtypes); return prefix + "/add"; diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html b/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html index 5b1165fb..cdb228be 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html @@ -66,15 +66,24 @@ success: function (json) { console.log(json); var columnsArray1 = []; - for (var i = 0; i < (Object.keys(json.rows[0])).length; i++) {//Object.keys(obj) 获取key名称 - var property = (Object.keys(json.rows[0]))[i]; - columnsArray1.push({ - "title": property, - "field": property, - switchable: true - }); + // + columnsArray1.push({field : "序号",title : "序号",colspan: 1,rowspan: 1}); + columnsArray1.push({field : "产品码",title : "产品码",colspan: 1,rowspan: 1}); + columnsArray1.push({field : "状态",title : "状态",colspan: 1,rowspan: 1}); + columnsArray1.push({field : "记录时间",title : "记录时间",colspan: 1,rowspan: 1}); + columnsArray1.push({field : "工位名称",title : "工位名称",colspan: 1,rowspan: 1}); + if(json.total>0) { + for (var i = 0; i < (Object.keys(json.rows[0])).length; i++) {//Object.keys(obj) 获取key名称 + var property = (Object.keys(json.rows[0]))[i]; + if(property!='产品码'&&property!='记录时间'&&property!='序号'&&property!='状态'&&property!='工位名称') { + columnsArray1.push({ + "title": property, + "field": property, + switchable: true + }); + } + } } - // console.log(json); // var arrlength=[]; // json.rows.forEach(function (value) { @@ -137,7 +146,7 @@ toolbar: "#toolbar", singleSelect: false, clickToSelect: true, - sortName: "记录时间", + sortName: "序号", sortOrder: "desc", pageSize: 50, pageNumber: 1,