|
@@ -4,11 +4,7 @@ import com.iamberry.rst.core.order.Order;
|
|
|
import com.iamberry.rst.core.order.RentType;
|
|
|
import com.iamberry.rst.core.page.PageRequest;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
-import com.iamberry.rst.core.pts.PtsEmployee;
|
|
|
-import com.iamberry.rst.core.pts.ProduceProcess;
|
|
|
-import com.iamberry.rst.core.pts.PtsMachine;
|
|
|
-import com.iamberry.rst.core.pts.PtsMachineLogs;
|
|
|
-import com.iamberry.rst.core.pts.PtsMachineStatistics;
|
|
|
+import com.iamberry.rst.core.pts.*;
|
|
|
import com.iamberry.rst.faces.pts.*;
|
|
|
import com.iamberry.wechat.tools.ResponseJson;
|
|
|
import net.sf.json.JSONObject;
|
|
@@ -40,38 +36,40 @@ public class AdminMachineController {
|
|
|
|
|
|
@Autowired
|
|
|
private ProduceService produceService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询机器列表
|
|
|
- * @author LJK
|
|
|
- * @date 2017年8月31日16:08:15
|
|
|
+ *
|
|
|
* @param pageSize
|
|
|
* @param pageNO
|
|
|
* @return
|
|
|
+ * @author LJK
|
|
|
+ * @date 2017年8月31日16:08:15
|
|
|
*/
|
|
|
@RequiresPermissions("machine:select_all:machine")
|
|
|
@RequestMapping("/_machine_list")
|
|
|
public ModelAndView listOrder(
|
|
|
- @RequestParam(value= "pageSize",defaultValue= "10" ,required=false) Integer pageSize,
|
|
|
- @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
|
|
|
+ @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
|
|
|
@RequestParam(value = "pageTotal", required = false) Integer pageTotal,
|
|
|
- PtsMachine ptsMachine){
|
|
|
+ PtsMachine ptsMachine) {
|
|
|
ModelAndView mv = new ModelAndView("pts/machine/machine_list");
|
|
|
StringBuilder sb = new StringBuilder("/admin/machine/_machine_list?pageSize=" + pageSize);
|
|
|
|
|
|
if (StringUtils.isNotEmpty(ptsMachine.getMachineBarcode())) {
|
|
|
sb.append("&machineBarcode=");
|
|
|
sb.append(ptsMachine.getMachineBarcode());
|
|
|
- mv.addObject("machineBarcode",ptsMachine.getMachineBarcode());
|
|
|
+ mv.addObject("machineBarcode", ptsMachine.getMachineBarcode());
|
|
|
}
|
|
|
if (ptsMachine.getMachineIsPrint() != null && ptsMachine.getMachineIsPrint() != -1) {
|
|
|
- sb.append("&machineIsPrint=" );
|
|
|
+ sb.append("&machineIsPrint=");
|
|
|
sb.append(ptsMachine.getMachineIsPrint());
|
|
|
- mv.addObject("machineIsPrint",ptsMachine.getMachineIsPrint());
|
|
|
+ mv.addObject("machineIsPrint", ptsMachine.getMachineIsPrint());
|
|
|
}
|
|
|
if (ptsMachine.getMachineProcessState() != null && ptsMachine.getMachineProcessState() != -1) {
|
|
|
- sb.append("&machineProcessState=" );
|
|
|
+ sb.append("&machineProcessState=");
|
|
|
sb.append(ptsMachine.getMachineProcessState());
|
|
|
- mv.addObject("machineProcessState",ptsMachine.getMachineProcessState());
|
|
|
+ mv.addObject("machineProcessState", ptsMachine.getMachineProcessState());
|
|
|
}
|
|
|
|
|
|
PageRequest<PtsMachine> pageRequest = new PageRequest<PtsMachine>(ptsMachine, pageNO, pageSize, pageTotal == null);
|
|
@@ -86,7 +84,7 @@ public class AdminMachineController {
|
|
|
}
|
|
|
//查询最新一条机器id
|
|
|
Integer machineId = machineService.maxMachineId();
|
|
|
- mv.addObject("machineId",machineId);
|
|
|
+ mv.addObject("machineId", machineId);
|
|
|
sb.append("&pageTotal=").append(total).append("&pageNO=");
|
|
|
mv.addObject("page", pagedResult);
|
|
|
mv.addObject("url", sb.toString());
|
|
@@ -95,31 +93,33 @@ public class AdminMachineController {
|
|
|
|
|
|
/**
|
|
|
* 查询最新机器信息
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:latest_all:machine")
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/_LatestMachine_list")
|
|
|
- public List<PtsMachine> listLatestMachine(HttpServletRequest request){
|
|
|
+ public List<PtsMachine> listLatestMachine(HttpServletRequest request) {
|
|
|
String machineId = request.getParameter("machineId");
|
|
|
- if(machineId == null){
|
|
|
+ if (machineId == null) {
|
|
|
return null;
|
|
|
}
|
|
|
- return machineService.listLatestMachine(Integer.valueOf(machineId));
|
|
|
+ return machineService.listLatestMachine(Integer.valueOf(machineId));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改机器打印状态为已打印
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:update_print:machine")
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/_update_print")
|
|
|
- public Integer updateMachinPrintState(HttpServletRequest request){
|
|
|
+ public Integer updateMachinPrintState(HttpServletRequest request) {
|
|
|
String machineBarcode = request.getParameter("machineBarcode");
|
|
|
- if(machineBarcode == null){
|
|
|
+ if (machineBarcode == null) {
|
|
|
return null;
|
|
|
}
|
|
|
PtsMachine ptsMachine = new PtsMachine();
|
|
@@ -130,32 +130,33 @@ public class AdminMachineController {
|
|
|
|
|
|
/**
|
|
|
* 查询机器打印列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
* @author LJK
|
|
|
* @date 2017年8月31日16:08:15
|
|
|
- * @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:select_all:machine")
|
|
|
@RequestMapping("/_machine_print_list")
|
|
|
- public ModelAndView listPrintMachine(HttpServletRequest request,PtsMachine ptsMachine,
|
|
|
- @RequestParam(value= "pageSize",defaultValue= "10" ,required=false) Integer pageSize,
|
|
|
- @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
|
|
|
- @RequestParam(value = "totalNum", defaultValue = "0",required=false) Integer totalNum){
|
|
|
+ public ModelAndView listPrintMachine(HttpServletRequest request, PtsMachine ptsMachine,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10", required = false) Integer pageSize,
|
|
|
+ @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
|
|
|
+ @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
|
|
|
ModelAndView mv = new ModelAndView("pts/machine/machine_print_List");
|
|
|
- mv.addObject("machineIsPrint",ptsMachine.getMachineIsPrint() == null?"1":ptsMachine.getMachineIsPrint());
|
|
|
+ mv.addObject("machineIsPrint", ptsMachine.getMachineIsPrint() == null ? "1" : ptsMachine.getMachineIsPrint());
|
|
|
|
|
|
StringBuilder sb = new StringBuilder("/admin/machine/_machine_print_list?pageSize=" + pageSize);
|
|
|
|
|
|
- if(ptsMachine == null || ptsMachine.getMachineIsPrint() == null || ptsMachine.getMachineIsPrint() == 1){ //未打印
|
|
|
+ if (ptsMachine == null || ptsMachine.getMachineIsPrint() == null || ptsMachine.getMachineIsPrint() == 1) { //未打印
|
|
|
List<PtsMachine> machineList = machineService.listPrintOrder(ptsMachine);
|
|
|
- mv.addObject("machineList",machineList);
|
|
|
- }else{ //已打印
|
|
|
+ mv.addObject("machineList", machineList);
|
|
|
+ } else { //已打印
|
|
|
PagedResult<PtsMachine> pagedResult = machineService.getPrintOrderList(pageNO, pageSize, ptsMachine, totalNum == 0);
|
|
|
- if(totalNum != 0) {
|
|
|
+ if (totalNum != 0) {
|
|
|
pagedResult.setTotal(totalNum);
|
|
|
- pagedResult.setPages((int) Math.ceil((double)totalNum/pageSize));
|
|
|
+ pagedResult.setPages((int) Math.ceil((double) totalNum / pageSize));
|
|
|
}
|
|
|
sb.append("&machineIsPrint=");
|
|
|
- if(ptsMachine.getMachineIsPrint() != null && ptsMachine.getMachineIsPrint() == 2){
|
|
|
+ if (ptsMachine.getMachineIsPrint() != null && ptsMachine.getMachineIsPrint() == 2) {
|
|
|
sb.append(ptsMachine.getMachineIsPrint());
|
|
|
}
|
|
|
sb.append("&totalNum=");
|
|
@@ -166,33 +167,48 @@ public class AdminMachineController {
|
|
|
}
|
|
|
//查询最新一条机器id
|
|
|
Integer machineId = machineService.maxMachineId();
|
|
|
- mv.addObject("machineId",machineId);
|
|
|
+ mv.addObject("machineId", machineId);
|
|
|
return mv;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 查询机器关联的产品信息
|
|
|
+ *
|
|
|
+ * @param machineId
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequiresPermissions("machine:select_all:machine")
|
|
|
+ @RequestMapping("/_getProduce_print")
|
|
|
+ public Produce setProduceList(Integer machineId) {
|
|
|
+ Produce produce = machineService.getProduceByMachineId(machineId);
|
|
|
+ return produce;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 打印列表查询所有机器
|
|
|
+ *
|
|
|
+ * @return
|
|
|
* @author LJK
|
|
|
* @date 2017年8月31日16:08:15
|
|
|
- * @return
|
|
|
*/
|
|
|
@ResponseBody
|
|
|
@RequiresPermissions("machine:select_all:machine")
|
|
|
@RequestMapping("/machine_print_list")
|
|
|
- public List<PtsMachine> selectPrintMachine(PtsMachine ptsMachine){
|
|
|
+ public List<PtsMachine> selectPrintMachine(PtsMachine ptsMachine) {
|
|
|
return machineService.listPrintOrder(ptsMachine);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 查询机器生成流程
|
|
|
+ *
|
|
|
+ * @return
|
|
|
* @author LJK
|
|
|
* @date 2017年8月31日16:08:15
|
|
|
- * @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:logs_all:machine")
|
|
|
@RequestMapping("/_machine_logs_list")
|
|
|
- public ModelAndView listLogsMachine(Integer machineId){
|
|
|
- if(machineId == null || machineId < 0){
|
|
|
+ public ModelAndView listLogsMachine(Integer machineId) {
|
|
|
+ if (machineId == null || machineId < 0) {
|
|
|
return null;
|
|
|
}
|
|
|
PtsMachine ptsMachine = machineService.getMachine(machineId);
|
|
@@ -205,37 +221,40 @@ public class AdminMachineController {
|
|
|
|
|
|
/**
|
|
|
* 批量修改机器打印状态为已打印
|
|
|
+ *
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:update_print:machine")
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/_batchUpdate_print")
|
|
|
- public Integer batchUpdateMachineIsPring(HttpServletRequest request){
|
|
|
+ public Integer batchUpdateMachineIsPring(HttpServletRequest request) {
|
|
|
/*String[] listId = request.getParameterValues("machineBarcodes");*/
|
|
|
String listId = request.getParameter("machineBarcodes");
|
|
|
- if(listId == null){
|
|
|
+ if (listId == null) {
|
|
|
return 0;
|
|
|
}
|
|
|
String s = new String(listId);
|
|
|
String[] a = s.split(",");
|
|
|
return machineService.batchUpdateMachineIsPring(a);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询机器打印列表
|
|
|
+ *
|
|
|
+ * @return
|
|
|
* @author LJK
|
|
|
* @date 2017年8月31日16:08:15
|
|
|
- * @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:abnormality:statistics")
|
|
|
@RequestMapping("/_produced_abnormality_statistics")
|
|
|
- public ModelAndView producedAbnormalityStatistics(HttpServletRequest request,PtsMachine ptsMachine){
|
|
|
+ public ModelAndView producedAbnormalityStatistics(HttpServletRequest request, PtsMachine ptsMachine) {
|
|
|
ModelAndView mv = new ModelAndView("pts/machine/producedAbnormalityStatistics");
|
|
|
String machineType = request.getParameter("machineType");//1.净水机 2.冲奶机
|
|
|
- if(machineType == null || machineType.equals("")){
|
|
|
+ if (machineType == null || machineType.equals("")) {
|
|
|
machineType = "1";
|
|
|
}
|
|
|
- mv.addObject("machineType",machineType);
|
|
|
+ mv.addObject("machineType", machineType);
|
|
|
PtsMachineStatistics ptsMachineStatistics = new PtsMachineStatistics();
|
|
|
Calendar date = Calendar.getInstance();
|
|
|
String year = String.valueOf(date.get(Calendar.YEAR));//年
|
|
@@ -243,28 +262,28 @@ public class AdminMachineController {
|
|
|
ptsMachineStatistics.setMachineType(Integer.valueOf(machineType));
|
|
|
//查询1-12月每月生产机器数
|
|
|
List<PtsMachineStatistics> ptsMachineStatisticsList = machineService.monthStatistics(ptsMachineStatistics);
|
|
|
- if(ptsMachineStatisticsList.size() > 0){
|
|
|
+ if (ptsMachineStatisticsList.size() > 0) {
|
|
|
StringBuffer yearBf = new StringBuffer();
|
|
|
- for(int i=0;i< ptsMachineStatisticsList.size();i++){
|
|
|
- yearBf.append(ptsMachineStatisticsList.get(i).getNum().toString()+",");
|
|
|
+ for (int i = 0; i < ptsMachineStatisticsList.size(); i++) {
|
|
|
+ yearBf.append(ptsMachineStatisticsList.get(i).getNum().toString() + ",");
|
|
|
}
|
|
|
String yearString = yearBf.toString();
|
|
|
- mv.addObject("years", "["+yearString.substring(0,yearString.length()-1)+"]");
|
|
|
+ mv.addObject("years", "[" + yearString.substring(0, yearString.length() - 1) + "]");
|
|
|
}
|
|
|
|
|
|
//查询最近七天生产机器
|
|
|
List<PtsMachineStatistics> dayList = machineService.dayStatistics(ptsMachineStatistics);
|
|
|
- if(dayList.size() > 0){
|
|
|
+ if (dayList.size() > 0) {
|
|
|
StringBuffer dayBf = new StringBuffer();
|
|
|
StringBuffer dateBf = new StringBuffer();
|
|
|
- for(int i=0;i< dayList.size();i++){
|
|
|
- dayBf.append(dayList.get(i).getNum().toString()+",");
|
|
|
- dateBf.append(dayList.get(i).getDate()+",");
|
|
|
+ for (int i = 0; i < dayList.size(); i++) {
|
|
|
+ dayBf.append(dayList.get(i).getNum().toString() + ",");
|
|
|
+ dateBf.append(dayList.get(i).getDate() + ",");
|
|
|
}
|
|
|
String dayString = dayBf.toString();
|
|
|
String monthDayString = dateBf.toString();
|
|
|
- mv.addObject("days", "["+dayString.substring(0,dayString.length()-1)+"]");
|
|
|
- mv.addObject("monthDay", "["+monthDayString.substring(0,monthDayString.length()-1)+"]");
|
|
|
+ mv.addObject("days", "[" + dayString.substring(0, dayString.length() - 1) + "]");
|
|
|
+ mv.addObject("monthDay", "[" + monthDayString.substring(0, monthDayString.length() - 1) + "]");
|
|
|
}
|
|
|
|
|
|
/*机器总数及流程异常数*/
|
|
@@ -274,33 +293,33 @@ public class AdminMachineController {
|
|
|
/*机器异常总数*/
|
|
|
mv.addObject("machineAbnormality", numbers.getMachineAbnormality());
|
|
|
/*流程异常百分比*/
|
|
|
- double percentage = (numbers.getMachineAbnormality() == null? 0.0 : (double)numbers.getMachineAbnormality()) / (numbers.getMachineCount() == null? 0.0:(double)numbers.getMachineCount()) * 100;
|
|
|
- NumberFormat nf=new DecimalFormat( "0.0 ");
|
|
|
+ double percentage = (numbers.getMachineAbnormality() == null ? 0.0 : (double) numbers.getMachineAbnormality()) / (numbers.getMachineCount() == null ? 0.0 : (double) numbers.getMachineCount()) * 100;
|
|
|
+ NumberFormat nf = new DecimalFormat("0.0 ");
|
|
|
percentage = Double.parseDouble(nf.format(percentage));
|
|
|
mv.addObject("abnormalityPercentage", percentage);
|
|
|
/*正常百分比*/
|
|
|
double normalPercentage = Double.parseDouble(nf.format(100.0 - percentage));
|
|
|
- mv.addObject("normalPercentage",normalPercentage);
|
|
|
+ mv.addObject("normalPercentage", normalPercentage);
|
|
|
/*根据机器类型查询机器所有工序*/
|
|
|
ProduceProcess produceProcess = new ProduceProcess();
|
|
|
- produceProcess.setProduceId(machineType.equals("1")? 1:2);
|
|
|
+ produceProcess.setProduceId(machineType.equals("1") ? 1 : 2);
|
|
|
List<ProduceProcess> processList = produceService.listProduceProcess(produceProcess);
|
|
|
- mv.addObject("processList",processList);
|
|
|
+ mv.addObject("processList", processList);
|
|
|
//查询第一条的工序值 默认选择第一条工序
|
|
|
List<PtsMachineStatistics> nodeCountList = machineService.nodeNormalByPrduceId(processList.get(0).getProcessId());
|
|
|
- if(nodeCountList.size() > 0){
|
|
|
+ if (nodeCountList.size() > 0) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
StringBuffer nodeBf = new StringBuffer();
|
|
|
StringBuffer desBf = new StringBuffer();
|
|
|
- for(int i=0;i< nodeCountList.size();i++){
|
|
|
- nodeBf.append(nodeCountList.get(i).getNum().toString()+",");
|
|
|
- desBf.append("\""+nodeCountList.get(i).getNodeDes()+"\"" + ",");
|
|
|
+ for (int i = 0; i < nodeCountList.size(); i++) {
|
|
|
+ nodeBf.append(nodeCountList.get(i).getNum().toString() + ",");
|
|
|
+ desBf.append("\"" + nodeCountList.get(i).getNodeDes() + "\"" + ",");
|
|
|
|
|
|
}
|
|
|
String nodeString = nodeBf.toString();
|
|
|
String desString = desBf.toString();
|
|
|
- mv.addObject("nodeString", "["+nodeString.substring(0,nodeString.length()-1)+"]");
|
|
|
- mv.addObject("desString", "["+desString.substring(0,desString.length()-1)+"]");
|
|
|
+ mv.addObject("nodeString", "[" + nodeString.substring(0, nodeString.length() - 1) + "]");
|
|
|
+ mv.addObject("desString", "[" + desString.substring(0, desString.length() - 1) + "]");
|
|
|
}
|
|
|
|
|
|
return mv;
|
|
@@ -308,33 +327,34 @@ public class AdminMachineController {
|
|
|
|
|
|
/**
|
|
|
* 根据工序id统计选项数量
|
|
|
+ *
|
|
|
+ * @return
|
|
|
* @author LJK
|
|
|
* @date 2017年8月31日16:08:15
|
|
|
- * @return
|
|
|
*/
|
|
|
@RequiresPermissions("machine:abnormality:statistics")
|
|
|
@ResponseBody
|
|
|
@RequestMapping("/_node_normal")
|
|
|
- public ModelMap nodeNormal(HttpServletRequest request){
|
|
|
+ public ModelMap nodeNormal(HttpServletRequest request) {
|
|
|
String processId = request.getParameter("processId");//工序id
|
|
|
ModelMap mm = new ModelMap();
|
|
|
- if(processId == null || processId.equals("")){
|
|
|
- mm.put("returnCode",500);
|
|
|
+ if (processId == null || processId.equals("")) {
|
|
|
+ mm.put("returnCode", 500);
|
|
|
return mm;
|
|
|
}
|
|
|
List<PtsMachineStatistics> nodeCountList = machineService.nodeNormalByPrduceId(Integer.valueOf(processId));
|
|
|
- if(nodeCountList.size() > 0){
|
|
|
+ if (nodeCountList.size() > 0) {
|
|
|
StringBuffer nodeBf = new StringBuffer();
|
|
|
StringBuffer desBf = new StringBuffer();
|
|
|
- for(int i=0;i< nodeCountList.size();i++){
|
|
|
- nodeBf.append(nodeCountList.get(i).getNum().toString()+",");
|
|
|
- desBf.append("\""+nodeCountList.get(i).getNodeDes()+"\"" + ",");
|
|
|
+ for (int i = 0; i < nodeCountList.size(); i++) {
|
|
|
+ nodeBf.append(nodeCountList.get(i).getNum().toString() + ",");
|
|
|
+ desBf.append("\"" + nodeCountList.get(i).getNodeDes() + "\"" + ",");
|
|
|
}
|
|
|
String nodeString = nodeBf.toString();
|
|
|
String desString = desBf.toString();
|
|
|
- mm.put("returnCode",200);
|
|
|
- mm.put("nodeString","["+nodeString.substring(0,nodeString.length()-1)+"]");
|
|
|
- mm.put("desString","["+desString.substring(0,desString.length()-1)+"]");
|
|
|
+ mm.put("returnCode", 200);
|
|
|
+ mm.put("nodeString", "[" + nodeString.substring(0, nodeString.length() - 1) + "]");
|
|
|
+ mm.put("desString", "[" + desString.substring(0, desString.length() - 1) + "]");
|
|
|
}
|
|
|
return mm;
|
|
|
}
|