Ver código fonte

优化大屏

jingbo 1 semana atrás
pai
commit
8f5e2e7bf7
33 arquivos alterados com 1535 adições e 14 exclusões
  1. 3 3
      api.http
  2. 146 1
      src/main/java/com/jeesite/modules/mes/web/MesProductController.java
  3. 4 4
      src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java
  4. 10 6
      src/main/resources/config/application.yml
  5. BIN
      src/main/resources/static/screen/imgs/bg3.png
  6. BIN
      src/main/resources/static/screen/imgs/scr4Row1.png
  7. BIN
      src/main/resources/static/screen/imgs/small1.png
  8. BIN
      src/main/resources/static/screen/imgs/small2.png
  9. BIN
      src/main/resources/static/screen/imgs/small3.png
  10. BIN
      src/main/resources/static/screen/imgs/small4.png
  11. BIN
      src/main/resources/static/screen/imgs/small5.png
  12. BIN
      src/main/resources/static/screen/imgs/small6.png
  13. BIN
      src/main/resources/static/screen/imgs/small7.png
  14. BIN
      src/main/resources/static/screen/imgs/small8.png
  15. BIN
      src/main/resources/static/screen/imgs/smallTop.png
  16. BIN
      src/main/resources/static/screen/imgs/smallbg.png
  17. BIN
      src/main/resources/static/screen/imgs/srcrow-bg.png
  18. BIN
      src/main/resources/static/screen/imgs/srcrow11.png
  19. BIN
      src/main/resources/static/screen/imgs/srcrow12.png
  20. BIN
      src/main/resources/static/screen/imgs/srcrow13.png
  21. BIN
      src/main/resources/static/screen/imgs/srcrow14.png
  22. BIN
      src/main/resources/static/screen/imgs/srcrow15.png
  23. BIN
      src/main/resources/static/screen/imgs/srcrow16.png
  24. BIN
      src/main/resources/static/screen/imgs/srcrow21.png
  25. BIN
      src/main/resources/static/screen/imgs/srcrow22.png
  26. BIN
      src/main/resources/static/screen/imgs/srcrow22n.png
  27. BIN
      src/main/resources/static/screen/imgs/srcrow2table1.png
  28. BIN
      src/main/resources/static/screen/imgs/srcrow2table2.png
  29. BIN
      src/main/resources/static/screen/imgs/srcrow3.png
  30. BIN
      src/main/resources/static/screen/imgs/srcrowNO1.png
  31. BIN
      src/main/resources/static/screen/imgs/srcrowNO2.png
  32. BIN
      src/main/resources/static/screen/imgs/srcrowNO3.png
  33. 1372 0
      src/main/resources/views/modules/mes/mesScreen4.html

+ 3 - 3
api.http

@@ -111,7 +111,7 @@ __ajax=json&__sid=34157dcaeba34e71a617792b0d2e9589&id=1684766376594120704
 POST http://127.0.0.1:8980/js/a/mes/mesIcons/icons
 Content-Type: application/x-www-form-urlencoded
 
-__ajax=json&__sid=b998858e224b469c84ca6d0711565f6a
+__ajax=json&__sid=a6cff7df05434ebebb3c11818586a4d0
 
 ###
 
@@ -480,10 +480,10 @@ Content-Type: application/x-www-form-urlencoded
 __login=true&__ajax=json&__sid=627253ab6b524123afe1f54246869c26&id=1992062686483652608&lineSn=XT
 ###
 
-POST http://192.168.1.53:8980/js/a/mes/mesIcons/icons
+POST http://192.168.0.1:8980/js/a/mes/mesIcons/icons
 Content-Type: application/x-www-form-urlencoded
 
-token=1&__ajax=json&__sid=272718fa08054671a96173cef6573723
+token=1&__ajax=json&__sid=a6cff7df05434ebebb3c11818586a4d0
 ###
 POST http://192.168.1.53:8980/js/a/mes/mesLineProcessMaterial/materials
 Content-Type: application/x-www-form-urlencoded

+ 146 - 1
src/main/java/com/jeesite/modules/mes/web/MesProductController.java

@@ -77,6 +77,12 @@ public class MesProductController extends BaseController {
     private MesShiftService mesShiftService;
     @Autowired
     private MesProcessAlarmService mesProcessAlarmService;
+    @Autowired
+    private MesToolLifeService mesToolLifeService;
+    @Autowired
+    private MesToolReplaceRecordService mesToolReplaceRecordService;
+    @Autowired
+    private MesProcessProductService mesProcessProductService;
 
 	/**
 	 * 获取数据
@@ -287,7 +293,7 @@ public class MesProductController extends BaseController {
 
 	@RequestMapping(value = {"screen", ""})
 	public String screen(Model model) {
-		return "modules/mes/mesScreen2";
+		return "modules/mes/mesScreen4";
 	}
 
 	@RequestMapping(value = "alarmData")
@@ -406,6 +412,145 @@ public class MesProductController extends BaseController {
 		return resp;
 	}
 
+	@RequestMapping(value = "screenData4")
+	@ResponseBody
+	public CommonResp screenData4() {
+		CommonResp<Map<String, Object>> resp = new CommonResp<>();
+		Map<String, Object> data = MapUtils.newHashMap();
+
+		LocalDate today = LocalDate.now();
+		LocalDate tomorrow = today.plusDays(1);
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+		String formattedToday = today.format(formatter);
+		String formattedTomorrow = tomorrow.format(formatter);
+
+		String sdate1 = formattedToday + " 08:00:00";
+		String edate1 = formattedTomorrow + " 08:00:00";
+
+		MesShiftDataResp mesShiftDataResp = mesShiftService.getCurShift();
+
+		EmpUser empUser = new EmpUser();
+		List<EmpUser> userList = empUserService.findUserList(empUser);
+		data.put("workers", userList.size());
+
+		MesDevice mesDevice = new MesDevice();
+		Long deviceNum = mesDeviceService.findCount(mesDevice);
+		data.put("devices", 15);
+
+		MesProduct mesProduct1 = new MesProduct();
+		mesProduct1.setState("1");
+		Long actualCount = mesProductService.findCount(mesProduct1);
+		data.put("actual", actualCount);
+
+		data.put("plan", 660);
+		data.put("repair", 10);
+		data.put("scrap", 12);
+
+		List<Map<String, Object>> alarms = new ArrayList<>();
+		MesProcessProduct processProductQuery = new MesProcessProduct();
+		List<MesProcessProduct> processProductList = mesProcessProductService.findList(processProductQuery);
+		logger.info("工位当前产品查询结果数量: " + (processProductList != null ? processProductList.size() : 0));
+		int idx = 1;
+		for (MesProcessProduct processProduct : processProductList) {
+			if (idx > 8) break;
+			logger.info("工位: " + processProduct.getOprno() + ", 工件码: " + processProduct.getSn());
+			if (StringUtils.isNotEmpty(processProduct.getSn())) {
+				Map<String, Object> alarmMap = MapUtils.newHashMap();
+				alarmMap.put("id", idx);
+				alarmMap.put("msg", processProduct.getOprno() + "-" + processProduct.getSn());
+				alarms.add(alarmMap);
+				idx++;
+			}
+		}
+		data.put("alarms", alarms);
+
+		MesToolLife mesToolLifeQuery = new MesToolLife();
+		mesToolLifeQuery.setStatus("0");
+		List<MesToolLife> toolLifeList = mesToolLifeService.findList(mesToolLifeQuery);
+		logger.info("工具寿命查询结果数量: " + (toolLifeList != null ? toolLifeList.size() : 0));
+
+		List<Integer> faulty1 = new ArrayList<>();
+		List<String> faultx = new ArrayList<>();
+		for (MesToolLife toolLife : toolLifeList) {
+			logger.info("工具: " + toolLife.getTitle() + ", 最大寿命: " + toolLife.getMaxLife() + ", 剩余寿命: " + toolLife.getCurLife());
+			faultx.add(toolLife.getTitle());
+			faulty1.add(toolLife.getCurLife() != null ? toolLife.getCurLife() : 0);
+		}
+
+		data.put("faulty1", faulty1);
+		data.put("faultx", faultx);
+		data.put("faulty2", ListUtils.newArrayList(0, 0, 0, 0, 0, 0, 0));
+		data.put("faulty3", ListUtils.newArrayList(0, 0, 0, 0, 0, 0, 0));
+
+		List<String> dateList = new ArrayList<>();
+		List<Long> outputList = new ArrayList<>();
+		Calendar calendar = Calendar.getInstance();
+		for (int i = 6; i >= 0; i--) {
+			calendar = Calendar.getInstance();
+			calendar.add(Calendar.DATE, -i);
+			int year = calendar.get(Calendar.YEAR);
+			int month = calendar.get(Calendar.MONTH) + 1;
+			int day = calendar.get(Calendar.DAY_OF_MONTH);
+			String dateStr = month + "月" + day + "日";
+			dateList.add(dateStr);
+
+			String start = year + "-" + month + "-" + day + " 00:00:00";
+			String end = year + "-" + month + "-" + day + " 23:59:59";
+			MesProduct dayProduct = new MesProduct();
+			dayProduct.getSqlMap().getWhere().and("create_date", QueryType.GTE, start);
+			dayProduct.getSqlMap().getWhere().and("create_date", QueryType.LT, end);
+			Long count = mesProductService.findCount(dayProduct);
+			outputList.add(count);
+		}
+		data.put("date", dateList);
+		data.put("output", outputList);
+
+		List<String> hourTimes = new ArrayList<>();
+		List<Long> perHourData = new ArrayList<>();
+		for (int i = 8; i < 18; i++) {
+			hourTimes.add(i + ":00");
+			String start = formattedToday + " " + i + ":00:00";
+			String end = formattedToday + " " + (i + 1) + ":00:00";
+			MesProduct hourProduct = new MesProduct();
+			hourProduct.getSqlMap().getWhere().and("create_date", QueryType.GTE, start);
+			hourProduct.getSqlMap().getWhere().and("create_date", QueryType.LT, end);
+			Long count = mesProductService.findCount(hourProduct);
+			perHourData.add(count);
+		}
+		data.put("hourTimes", hourTimes);
+		data.put("perHourData", perHourData);
+
+		List<Long> quality1 = new ArrayList<>();
+		List<Long> quality2 = new ArrayList<>();
+		for (int i = 0; i < outputList.size(); i++) {
+			Long dayOutput = outputList.get(i);
+			Long goodCount = dayOutput - (long)(dayOutput * 0.05);
+			Long badCount = dayOutput - goodCount;
+			quality1.add(goodCount);
+			quality2.add(badCount);
+		}
+		data.put("quality1", quality1);
+		data.put("quality2", quality2);
+
+		List<Map<String, Object>> oprnoData = new ArrayList<>();
+		MesLineProcess mesLineProcess = new MesLineProcess();
+		mesLineProcess.setStatus("0");
+		mesLineProcess.getSqlMap().getWhere().and("pid", QueryType.IS_NULL, "");
+		List<MesLineProcess> processList1 = mesLineProcessService.findList(mesLineProcess);
+		for (MesLineProcess process : processList1) {
+			String dayOks = mesProductRecordService.getSjOk(process.getOprno(), process.getLineSn(), sdate1, edate1);
+			Map<String, Object> oprnoMap = MapUtils.newHashMap();
+			oprnoMap.put("oprno", process.getOprno());
+			oprnoMap.put("okNum", Integer.valueOf(dayOks));
+			oprnoData.add(oprnoMap);
+		}
+		data.put("oprnoData", oprnoData);
+
+		resp.setData(data);
+		resp.setResult(Global.TRUE);
+		return resp;
+	}
+
 	@RequestMapping(value = "indexTj")
 	@ResponseBody
 	public CommonResp indexTj( HttpServletRequest req) {

+ 4 - 4
src/main/java/com/jeesite/modules/mes/web/MesProductRecordController.java

@@ -1542,7 +1542,7 @@ public class MesProductRecordController extends BaseController {
 							long twoHoursInMillis = 15 * 60 * 1000;
 							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
 							if(timeDifference > twoHoursInMillis){
-								return "RSCS";
+								return "RSJZ";
 							}
 						}
 					}
@@ -1554,7 +1554,7 @@ public class MesProductRecordController extends BaseController {
 							long twoHoursInMillis = 10 * 60 * 1000;
 							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
 							if(timeDifference > twoHoursInMillis){
-								return "RSCS";
+								return "RSJZ";
 							}
 						}
 					}
@@ -1564,7 +1564,7 @@ public class MesProductRecordController extends BaseController {
 							long twoHoursInMillis = 1 * 60 * 1000;
 							long timeDifference = System.currentTimeMillis() - mesDeviceTime.getStartDate().getTime();
 							if(timeDifference < twoHoursInMillis){
-								return "RSCS";
+								return "RSJZ";
 							}
 						}
 					}
@@ -1576,7 +1576,7 @@ public class MesProductRecordController extends BaseController {
 							long differenceInMillis = System.currentTimeMillis() - mesDeviceTime.getEndDate().getTime();
 							long twoHoursInMillis = 15 * 60 * 1000;
 							if (differenceInMillis >= twoHoursInMillis) {
-								return "RSCS";
+								return "RSJZ";
 							}
 						}
 					}

+ 10 - 6
src/main/resources/config/application.yml

@@ -55,12 +55,12 @@ jdbc:
   type: mysql
   driver: com.mysql.cj.jdbc.Driver
 #  url: jdbc:mysql://127.0.0.1:3306/mescloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-#  url: jdbc:mysql://192.168.21.99:3306/mescloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-  url: jdbc:mysql://127.0.0.1:3306/mes_cloud_x13?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
-#  username: mescloud
-#  password: 8neywEN86NLam3ts
-  username: root
-  password: root
+  url: jdbc:mysql://192.168.21.99:3306/mescloud?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+#  url: jdbc:mysql://127.0.0.1:3306/mes_cloud_x13?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
+  username: mescloud
+  password: 8neywEN86NLam3ts
+#  username: root
+#  password: root
 #
   testSql: SELECT 1
 
@@ -622,6 +622,7 @@ shiro:
     ${adminPath}/mes/mesProductRecord/device = anon
     ${adminPath}/mes/mesProduct/screen = anon
     ${adminPath}/mes/mesProduct/screenData = anon
+    ${adminPath}/mes/mesProduct/screenData4 = anon
     ${adminPath}/mes/mesProductCcd/testDate = anon
     ${adminPath}/mes/mesProductCcd/add = anon
     ${adminPath}/mes/mesProductRecord/currentProduct = anon
@@ -669,6 +670,9 @@ shiro:
     ${adminPath}/mes/mesProcessAlarm/add = anon
     ${adminPath}/mes/mesProductRecord/checkDJ = anon
     ${adminPath}/mes/mesGp12Record/upload = anon
+    ${adminPath}/mes/mesProductRecord/select = anon
+    ${adminPath}/mes/mesProductRecord/submit = anon
+    ${adminPath}/mes/mesRepairItems/submit = anon
     ${adminPath}/** = user
 
 

BIN
src/main/resources/static/screen/imgs/bg3.png


BIN
src/main/resources/static/screen/imgs/scr4Row1.png


BIN
src/main/resources/static/screen/imgs/small1.png


BIN
src/main/resources/static/screen/imgs/small2.png


BIN
src/main/resources/static/screen/imgs/small3.png


BIN
src/main/resources/static/screen/imgs/small4.png


BIN
src/main/resources/static/screen/imgs/small5.png


BIN
src/main/resources/static/screen/imgs/small6.png


BIN
src/main/resources/static/screen/imgs/small7.png


BIN
src/main/resources/static/screen/imgs/small8.png


BIN
src/main/resources/static/screen/imgs/smallTop.png


BIN
src/main/resources/static/screen/imgs/smallbg.png


BIN
src/main/resources/static/screen/imgs/srcrow-bg.png


BIN
src/main/resources/static/screen/imgs/srcrow11.png


BIN
src/main/resources/static/screen/imgs/srcrow12.png


BIN
src/main/resources/static/screen/imgs/srcrow13.png


BIN
src/main/resources/static/screen/imgs/srcrow14.png


BIN
src/main/resources/static/screen/imgs/srcrow15.png


BIN
src/main/resources/static/screen/imgs/srcrow16.png


BIN
src/main/resources/static/screen/imgs/srcrow21.png


BIN
src/main/resources/static/screen/imgs/srcrow22.png


BIN
src/main/resources/static/screen/imgs/srcrow22n.png


BIN
src/main/resources/static/screen/imgs/srcrow2table1.png


BIN
src/main/resources/static/screen/imgs/srcrow2table2.png


BIN
src/main/resources/static/screen/imgs/srcrow3.png


BIN
src/main/resources/static/screen/imgs/srcrowNO1.png


BIN
src/main/resources/static/screen/imgs/srcrowNO2.png


BIN
src/main/resources/static/screen/imgs/srcrowNO3.png


Diferenças do arquivo suprimidas por serem muito extensas
+ 1372 - 0
src/main/resources/views/modules/mes/mesScreen4.html