|
@@ -77,6 +77,12 @@ public class MesProductController extends BaseController {
|
|
|
private MesShiftService mesShiftService;
|
|
private MesShiftService mesShiftService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private MesProcessAlarmService mesProcessAlarmService;
|
|
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", ""})
|
|
@RequestMapping(value = {"screen", ""})
|
|
|
public String screen(Model model) {
|
|
public String screen(Model model) {
|
|
|
- return "modules/mes/mesScreen2";
|
|
|
|
|
|
|
+ return "modules/mes/mesScreen4";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "alarmData")
|
|
@RequestMapping(value = "alarmData")
|
|
@@ -406,6 +412,145 @@ public class MesProductController extends BaseController {
|
|
|
return resp;
|
|
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")
|
|
@RequestMapping(value = "indexTj")
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
public CommonResp indexTj( HttpServletRequest req) {
|
|
public CommonResp indexTj( HttpServletRequest req) {
|