From e2446637d73364635f5b1ab5a7da9dfdb45f990b Mon Sep 17 00:00:00 2001 From: gongbaoxiong <751575283@qq.com> Date: Wed, 18 Sep 2024 09:22:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=80=BB=E8=A7=88?= =?UTF-8?q?=EF=BC=8C=E6=B6=82=E6=9D=BF=EF=BC=8C=E5=9B=BA=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E6=9A=82=E5=AD=98=E9=A1=B5=E9=9D=A2=E6=B2=A1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=9B=20add:=E5=A2=9E=E5=8A=A0=E6=90=AC?= =?UTF-8?q?=E8=BF=90=E7=AE=A1=E7=90=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cockpit/controller/CockpitController.java | 8 +- .../wms/cockpit/service/dao/zcq/TaskInfo.java | 2 + .../service/impl/CockpitServiceImpl.java | 379 ++++++++++-------- .../cockpit/service/mapper/CockpitMapper.java | 26 +- .../cockpit/service/mapper/CockpitMapper.xml | 64 ++- 5 files changed, 307 insertions(+), 172 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/controller/CockpitController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/controller/CockpitController.java index b10bc5c..07045f3 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/controller/CockpitController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/controller/CockpitController.java @@ -38,8 +38,8 @@ public class CockpitController { } @PostMapping("/allDeviceStatus") - @Log("设备ui") - @ApiOperation("设备ui") + @Log("秒刷接口") + @ApiOperation("秒刷接口") public ResponseEntity allDeviceStatus() { return new ResponseEntity<>(cockpitService.allDeviceStatus(), HttpStatus.OK); } @@ -55,8 +55,8 @@ public class CockpitController { @PostMapping("/acceptDeviceFaultInfo") - @Log("接收acs推送的设备故障信息") - @ApiOperation("接收acs推送的设备故障信息") + @Log("查询当天的设备故障信息") + @ApiOperation("查询当天的设备故障信息") public ResponseEntity acceptDeviceFaultInfo() { return new ResponseEntity<>(cockpitService.acceptDeviceFaultInfo(),HttpStatus.OK); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/zcq/TaskInfo.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/zcq/TaskInfo.java index 13d1603..eab67a5 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/zcq/TaskInfo.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/dao/zcq/TaskInfo.java @@ -16,6 +16,8 @@ public class TaskInfo extends ErrorData { private String point_code1; private String point_code2; private String material_name; + private String material_spec; + private String qty; private String vehicle_type; private String vehicle_code; private String task_type; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java index 45fd605..2603fdb 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java @@ -24,7 +24,6 @@ import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; import org.nl.wms.sch.point.service.ISchBasePointService; import org.nl.wms.sch.point.service.dao.SchBasePoint; import org.nl.wms.sch.task.service.ISchBaseTaskService; -import org.nl.wms.sch.task.service.dao.SchBaseTask; import org.nl.wms.sch.task_manage.enums.RegionCodeConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -89,22 +88,22 @@ public class CockpitServiceImpl implements CockpitService { JSONObject getHomeInfo = new JSONObject(); //生产任务目标达成 JSONObject target_achievement = cockpitMapper.getProductTarget(); - - - //固化汇总 - CompletableFuture> task2 = CompletableFuture.supplyAsync(() -> { - List dayDataList = new ArrayList<>(); - try { - dayDataList = cockpitMapper.getGhCuringSummary(); - } catch (Exception e) { - DayData dayData = new DayData(); - dayData.setError_info(e.toString()); - dayDataList.add(dayData); - } - return dayDataList; - }, pool); - - + List> productionSummaryList = new ArrayList<>(); + for (String itemName : Arrays.asList("1", "2", "3")) { + Map item = new HashMap<>(); + item.put("item_name", itemName); + item.put("item_qty", "0"); + productionSummaryList.add(item); + } + JSONObject production_summary = cockpitMapper.getProductionsummary(); + if (ObjectUtil.isNotEmpty(production_summary)) { + productionSummaryList.forEach(item -> { + String key = item.get("item_name").toString().toLowerCase(); + if (ObjectUtil.isNotEmpty(production_summary.get(key))) { + item.put("item_qty", production_summary.get(key).toString()); + } + }); + } //暂存库库存结构 JSONObject zc_storage_info = new JSONObject(); List> material_info = cockpitMapper.getZcMaterialmsg(); @@ -116,36 +115,20 @@ public class CockpitServiceImpl implements CockpitService { List> today_work = cockpitMapper.getTdWorkmsg(); if (ObjectUtil.isEmpty(today_work)) { Map item1 = new HashMap<>(); - item1.put("workorder_code", "240712001"); - item1.put("material_name", "13.2正"); + item1.put("workorder_code", "240918001"); + item1.put("material_name", "TS_12Z中负"); item1.put("plan_qty", "100"); item1.put("real_qty", "0"); item1.put("point_name", "普涂线01"); item1.put("workorder_status", "生产中"); today_work.add(item1); } - - // todo 7天生产统计 - List> tb_real_qty = cockpitMapper.getTxQty("7"); + List> tb_real_qty = cockpitMapper.getTxQty("7", "TBX"); List> gh_real_qty = cockpitMapper.getGhsQty("7"); - if (ObjectUtil.isEmpty(tb_real_qty)) { - for (int i = 0; i < 7; i++) { - Map item = new HashMap<>(); - item.put("region_name", "TBX"); - item.put("total_qty", "0"); - item.put("date", today.minusDays(i).format(formatter)); - tb_real_qty.add(item); - } - } - if (ObjectUtil.isEmpty(gh_real_qty)) { - for (int i = 0; i < 7; i++) { - Map item = new HashMap<>(); - item.put("region_name", "GHS"); - item.put("total_qty", "0"); - item.put("date", today.minusDays(i).format(formatter)); - gh_real_qty.add(item); - } - } + List> tb_real_qty_default = new ArrayList<>(); + List> gh_real_qty_default = new ArrayList<>(); + getWeekWorkStatistics(tb_real_qty, tb_real_qty_default, "TBX", 7); + getWeekWorkStatistics(gh_real_qty, gh_real_qty_default, "GHS", 7); //设备运行状态 JSONObject device_status = new JSONObject(); //状态信息 @@ -156,24 +139,66 @@ public class CockpitServiceImpl implements CockpitService { device_status.put("storage_info", storage_info); //实时故障告警 List> fault_alarm = cockpitMapper.faultAlarm(); - faultAlarmDefault(fault_alarm, "GHS02"); + faultAlarmDefault(fault_alarm, "TS_GHS02"); //近30日故障统计 JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); - monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); + monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_GHS02"); //设备报警前十 List> gh_statistics = cockpitMapper.ghStatistics(); getHomeInfo.put("target_achievement", target_achievement); getHomeInfo.put("zc_storage_info", zc_storage_info); getHomeInfo.put("today_work", today_work); - getHomeInfo.put("tbx_produce", tb_real_qty); - getHomeInfo.put("ghs_produce", gh_real_qty); + getHomeInfo.put("tbx_produce", tb_real_qty_default); + getHomeInfo.put("ghs_produce", gh_real_qty_default); getHomeInfo.put("device_status", device_status); getHomeInfo.put("fault_alarm", fault_alarm); getHomeInfo.put("monthly_fault_statistics", monthly_fault_statistics); getHomeInfo.put("gh_statistics", gh_statistics); + getHomeInfo.put("production_summary", productionSummaryList); return getHomeInfo; } + private void getWeekWorkStatistics(List> gh_real_qty, List> tb_real_qty_default, String region_name, Integer days) { + for (int i = 0; i < days; i++) { + Map item = new HashMap<>(); + item.put("region_name", region_name); + item.put("total_qty", "0"); + item.put("date", today.minusDays(i).format(formatter)); + tb_real_qty_default.add(item); + } + Map ghRealQtyMap = gh_real_qty.stream() + .collect(Collectors.toMap( + item -> (String) item.get("date"), + item -> (BigDecimal) item.get("total_qty") + )); + tb_real_qty_default.forEach(tbItem -> { + String date = (String) tbItem.get("date"); + if (ghRealQtyMap.containsKey(date)) { + tbItem.put("total_qty", ghRealQtyMap.get(date)); + } + }); + } + + private void getMonthlyWorkStatistics(List> gh_real_qty, List> tb_real_qty_default, String region_name) { + for (int i = 0; i < 7; i++) { + Map item = new HashMap<>(); + item.put("region_name", region_name); + item.put("total_qty", "0"); + item.put("date", today.minusDays(i).format(formatter)); + tb_real_qty_default.add(item); + } + Map ghRealQtyMap = gh_real_qty.stream() + .collect(Collectors.toMap( + item -> (String) item.get("date"), + item -> (BigDecimal) item.get("total_qty") + )); + tb_real_qty_default.forEach(tbItem -> { + String date = (String) tbItem.get("date"); + if (ghRealQtyMap.containsKey(date)) { + tbItem.put("total_qty", ghRealQtyMap.get(date)); + } + }); + } /** @@ -188,71 +213,83 @@ public class CockpitServiceImpl implements CockpitService { JSONObject target_achievement = new JSONObject(); JSONObject lt_production = cockpitMapper.ltProduction(); JSONObject pt_production = cockpitMapper.ptProduction(); - if (ObjectUtil.isEmpty(lt_production)) { - lt_production = new JSONObject(); - lt_production.put("plan_production", "0"); - lt_production.put("actual_production", "0"); - lt_production.put("percentage", "0"); - } - if (ObjectUtil.isEmpty(pt_production)) { - pt_production = new JSONObject(); - pt_production.put("plan_production", "0"); - pt_production.put("actual_production", "0"); - pt_production.put("percentage", "0"); - } - target_achievement.put("lt_production", lt_production); - target_achievement.put("pt_production", pt_production); + target_achievement.put("lt_production", getTargetProduction(lt_production)); + target_achievement.put("pt_production", getTargetProduction(pt_production)); //今日涂板任务 JSONArray today_work = cockpitMapper.todayTbTask(); if (ObjectUtil.isEmpty(today_work)) { JSONObject item1 = new JSONObject(); - item1.put("workorder_code", "240712002"); + item1.put("workorder_code", "test_240712002"); item1.put("material_name", "13.2正"); item1.put("plan_qty", "100"); item1.put("real_qty", "0"); item1.put("point_name", "连涂线01"); - item1.put("workorder_status", "生产中"); + item1.put("workorder_status", "就绪"); today_work.add(item1); } //实时故障告警 - List> fault_alarm = cockpitMapper.FaultTime("TBX"); - faultAlarmDefault(fault_alarm, "LTX02"); + List> fault_alarm = cockpitMapper.FaultTime("TBX"); + faultAlarmDefault(fault_alarm, "TS_LTX02"); //近30日故障统计 JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("TBX"); - monthlyFaultStatisticsDefault(monthly_fault_statistics, "LTX02"); - - //todo 近30日生产 - // JSONArray monthly_produce_statistics = cockpitMapper.FaultTotal("TBX"); - List> monthly_produce_statistics = new ArrayList<>(); - if (ObjectUtil.isEmpty(monthly_produce_statistics)) { - for (int i = 0; i < 30; i++) { - Map item1 = new HashMap<>(); - item1.put("region_name", "LT"); - item1.put("total_qty", "0"); - item1.put("date", today.minusDays(i).format(formatter)); - Map item2 = new HashMap<>(); - item2.put("region_name", "PT"); - item2.put("total_qty", "0"); - item2.put("date", today.minusDays(i).format(formatter)); - Map item3 = new HashMap<>(); - item3.put("region_name", "total"); - item3.put("total_qty", "0"); - item3.put("date", today.minusDays(i).format(formatter)); - monthly_produce_statistics.add(item1); - monthly_produce_statistics.add(item2); - monthly_produce_statistics.add(item3); - } + monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_LTX02"); + List> monthly_produce_statistics = cockpitMapper.getTbxMonthlyStatistics(); + List> tbxMonthlyStatistics = new ArrayList<>(); + for (int i = 0; i < 30; i++) { + Map item1 = new HashMap<>(); + item1.put("region_name", "LT"); + item1.put("total_qty", "0"); + item1.put("date", today.minusDays(i).format(formatter)); + Map item2 = new HashMap<>(); + item2.put("region_name", "PT"); + item2.put("total_qty", "0"); + item2.put("date", today.minusDays(i).format(formatter)); + Map item3 = new HashMap<>(); + item3.put("region_name", "total"); + item3.put("total_qty", "0"); + item3.put("date", today.minusDays(i).format(formatter)); + tbxMonthlyStatistics.add(item1); + tbxMonthlyStatistics.add(item2); + tbxMonthlyStatistics.add(item3); + } + monthly_produce_statistics.forEach(item -> { + String key = item.get("region_name").toString().toUpperCase(); + tbxMonthlyStatistics.forEach(r -> { + if (r.get("region_name").equals(key) && item.get("date").equals(r.get("date"))) { + r.put("total_qty", item.get("total_qty").toString()); + } + }); + }); + for (int i = 0; i < tbxMonthlyStatistics.size(); i += 3) { + Map item1 = tbxMonthlyStatistics.get(i); + Map item2 = tbxMonthlyStatistics.get(i + 1); + Map item3 = tbxMonthlyStatistics.get(i + 2); + BigDecimal totalQty1 = new BigDecimal(item1.get("total_qty").toString()); + BigDecimal totalQty2 = new BigDecimal(item2.get("total_qty").toString()); + BigDecimal totalQtySum = totalQty1.add(totalQty2); + item3.put("total_qty", totalQtySum.toString()); } getTbxInfo.put("target_achievement", target_achievement); getTbxInfo.put("today_work", today_work); getTbxInfo.put("fault_alarm", fault_alarm); getTbxInfo.put("monthly_fault_statistics", monthly_fault_statistics); - getTbxInfo.put("monthly_produce_statistics", monthly_produce_statistics); + getTbxInfo.put("monthly_produce_statistics", tbxMonthlyStatistics); return getTbxInfo; } + private static JSONObject getTargetProduction(JSONObject production) { + if (ObjectUtil.isEmpty(production)) { + production = new JSONObject(); + production.put("plan_production", "0"); + production.put("actual_production", "0"); + production.put("percentage", "0"); + } + return production; + } + /** * 固化室 + * * @return */ @Override @@ -262,39 +299,55 @@ public class CockpitServiceImpl implements CockpitService { JSONArray curing_summary = cockpitMapper.curingSummary(); //todo 近30天固化数据 List> monthly_gh_qty = cockpitMapper.getGhsQty("30"); - if (ObjectUtil.isEmpty(monthly_gh_qty)) { - for (int i = 0; i < 30; i++) { - Map item = new HashMap<>(); - item.put("region_name", "GH"); - item.put("total_qty", "0"); - item.put("date", today.minusDays(i).format(formatter)); - monthly_gh_qty.add(item); - } - } - //todo 近固化物料汇总 + List> monthly_gh_qty_default = new ArrayList<>(); + getWeekWorkStatistics(monthly_gh_qty, monthly_gh_qty_default, "GH", 30); + //今日固化任务 List> gh_material_summary = new ArrayList<>(); - if (ObjectUtil.isEmpty(gh_material_summary)) { + CompletableFuture> task3 = CompletableFuture.supplyAsync(() -> { + List tasks = new ArrayList<>(); + try { + tasks = getTasks(RegionCodeConstant.CURING_ZONE); + } catch (Exception e) { + TaskInfo taskInfo = new TaskInfo(); + taskInfo.setError_info(e.toString()); + tasks.add(taskInfo); + } + return tasks; + }, pool); + List taskInfos = task3.join(); + if (ObjectUtil.isNotEmpty(taskInfos )){ + taskInfos.forEach(r -> { + if (r.getError_info() != null) { + Map item = new HashMap<>(); + item.put("material_name", r.getMaterial_name()); + item.put("material_spec", r.getMaterial_spec()); + item.put("qty", r.getQty()); + item.put("type", r.getTask_type()); + gh_material_summary.add(item); + } + }); + } else { Map item1 = new HashMap<>(); - item1.put("material_name", "1.9A正"); + item1.put("material_name", "TS_1.9A正"); item1.put("material_spec", "正涂片极板/1.9A/大片"); - item1.put("qty", "2000"); + item1.put("qty", "100"); item1.put("type", "入库"); Map item2 = new HashMap<>(); - item2.put("material_name", "15A负"); + item2.put("material_name", "TS_15A负"); item2.put("material_spec", "负涂片极板/15A/大片"); - item2.put("qty", "3000"); + item2.put("qty", "100"); item2.put("type", "出库"); gh_material_summary.add(item1); gh_material_summary.add(item2); } //实时故障告警 - List> fault_alarm = cockpitMapper.FaultTime("GH"); - faultAlarmDefault(fault_alarm,"GHS02"); + List> fault_alarm = cockpitMapper.FaultTime("GH"); + faultAlarmDefault(fault_alarm, "TS_GHS02"); //近30日故障统计 JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH"); - monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); + monthlyFaultStatisticsDefault(monthly_fault_statistics, "TS_GHS02"); getGhsInfo.put("curing_summary", curing_summary); - getGhsInfo.put("monthly_gh_qty", monthly_gh_qty); + getGhsInfo.put("monthly_gh_qty", monthly_gh_qty_default); getGhsInfo.put("gh_material_summary", gh_material_summary); getGhsInfo.put("fault_alarm", fault_alarm); getGhsInfo.put("monthly_fault_statistics", monthly_fault_statistics); @@ -331,55 +384,62 @@ public class CockpitServiceImpl implements CockpitService { JSONObject getHandlingInfo = new JSONObject(); //设备运行状态 JSONObject device_status = new JSONObject(); - // //状态信息 - // List> agv_info = cockpitMapper.statusInfo(); - // //状态信息 - // List> rgv_info = cockpitMapper.statusInfo(); - // //状态信息 - // List> conveyor_info = cockpitMapper.statusInfo(); - List> agv_info = new ArrayList<>(); - List> rgv_info = new ArrayList<>(); - List> conveyor_info = new ArrayList<>(); + //todo 点位状态信息状态信息 + List> agv_info = cockpitMapper.statusInfo(); + List> rgv_info = cockpitMapper.statusInfo(); + List> conveyor_info = cockpitMapper.statusInfo(); if (ObjectUtil.isEmpty(agv_info) || ObjectUtil.isEmpty(rgv_info)) { Map item1 = new HashMap<>(); - item1.put("item_name", "0"); - item1.put("item_qty", "5"); + item1.put("item_name", "1"); + item1.put("item_qty", "8"); Map item2 = new HashMap<>(); - item2.put("item_name", "1"); - item2.put("item_qty", "8"); + item2.put("item_name", "2"); + item2.put("item_qty", "2"); + Map item3 = new HashMap<>(); + item3.put("item_name", "1"); + item3.put("item_qty", "9"); + Map item4 = new HashMap<>(); + item4.put("item_name", "2"); + item4.put("item_qty", "1"); if (ObjectUtil.isEmpty(agv_info)) { agv_info.add(item1); agv_info.add(item2); } if (ObjectUtil.isEmpty(rgv_info)) { - rgv_info.add(item1); - rgv_info.add(item2); + rgv_info.add(item3); + rgv_info.add(item4); } } if (ObjectUtil.isEmpty(conveyor_info)) { Map item1 = new HashMap<>(); - item1.put("item_name", "1"); - item1.put("item_qty", "10"); + item1.put("item_name", "3"); + item1.put("item_qty", "6"); Map item2 = new HashMap<>(); - item2.put("item_name", "2"); - item2.put("item_qty", "8"); + item2.put("item_name", "4"); + item2.put("item_qty", "7"); Map item3 = new HashMap<>(); - item3.put("item_name", "3"); - item3.put("item_qty", "5"); + item3.put("item_name", "5"); + item3.put("item_qty", "8"); conveyor_info.add(item1); conveyor_info.add(item2); conveyor_info.add(item3); } - device_status.put("status_info", agv_info); - device_status.put("status_info", rgv_info); - device_status.put("status_info", conveyor_info); + device_status.put("agv_info", agv_info); + device_status.put("rgv_info", rgv_info); + device_status.put("conveyor_info", conveyor_info); + + //实时故障告警 List> fault_alarm = cockpitMapper.faultAlarm(); - faultAlarmDefault(fault_alarm, "RGV02"); + faultAlarmDefault(fault_alarm, "TS_RGV02"); //近30日故障统计 - //JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); - JSONArray monthly_fault_statistics = new JSONArray(); - monthlyFaultStatisticsDefault(monthly_fault_statistics, "RGV01"); + JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); + if (ObjectUtil.isEmpty(monthly_fault_statistics)) { + JSONObject item = new JSONObject(); + item.put("region_name", "TS_GHS"); + item.put("alarm_qty", "1"); + monthly_fault_statistics.add(item); + } getHandlingInfo.put("device_status", device_status); getHandlingInfo.put("fault_alarm", fault_alarm); getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics); @@ -401,7 +461,7 @@ public class CockpitServiceImpl implements CockpitService { switch (point.getRegion_code()) { case RegionCodeConstant.COATED_PLATE_LINE_AREA: // hint: 涂板线是作为一整台设备显示。point:设备点 - JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian"); + JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian1"); points = pointService.getSubSites(deviceCode); res.put("device_code", deviceCode); res.put("device_name", point.getPoint_name()); @@ -423,7 +483,7 @@ public class CockpitServiceImpl implements CockpitService { JSONObject one = new JSONObject(); one.put("device_code", pointObj.getPoint_code()); one.put("device_name", pointObj.getPoint_name()); -// one.put("mode", "2"); + // one.put("mode", "2"); for (Object object : baoshijian) { JSONObject jsonObject = (JSONObject) object; if (pointObj.getPoint_code().equals(jsonObject.getString("device_code"))) { @@ -449,7 +509,7 @@ public class CockpitServiceImpl implements CockpitService { case RegionCodeConstant.CURING_ZONE: // hint: 固化室,需要显示整个设备+内部位置明细 points = pointService.getSubSites(deviceCode); // 小固化位置以及进出口(入口是不管的) - JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi"); + JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi1"); for (Object object : guhuashi) { res.put("device_code", deviceCode); res.put("device_name", point.getPoint_name()); @@ -510,8 +570,8 @@ public class CockpitServiceImpl implements CockpitService { // 货位直接显示,获取组盘信息,组装数据反馈 res.put("device_code", deviceCode); res.put("device_name", point.getPoint_name()); -// res.put("vehicle_code", ObjectUtil.isNotEmpty(point.getVehicle_code()) ? point.getVehicle_code() : "-"); -// res.put("vehicle_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-"); + // res.put("vehicle_code", ObjectUtil.isNotEmpty(point.getVehicle_code()) ? point.getVehicle_code() : "-"); + // res.put("vehicle_type", ObjectUtil.isNotEmpty(point.getVehicle_type()) ? point.getVehicle_type() : "-"); if (ObjectUtil.isNotEmpty(point.getVehicle_type()) && ObjectUtil.isNotEmpty(point.getVehicle_code())) { JSONObject groupInfo = cockpitMapper.getVehicleGroupInfo(point.getVehicle_code(), point.getVehicle_type()); if (ObjectUtil.isNotEmpty(groupInfo)) { @@ -519,6 +579,8 @@ public class CockpitServiceImpl implements CockpitService { } } break; + default: + break; } return res; } @@ -565,20 +627,19 @@ public class CockpitServiceImpl implements CockpitService { @Override public JSONArray allDeviceStatus() { JSONArray array = new JSONArray(); - Random random = new Random(); - int lowerBound = 10000; - int upperBound = 18000; - JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian"); - JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi"); - JSONArray AGV = (JSONArray) redisUtils.get("AGV"); - // - JSONArray RGV = (JSONArray) redisUtils.get("RGV"); - JSONArray site = (JSONArray) redisUtils.get("site"); - // array.add(baoshijian); - // array.add(guhuashi); - // array.add(AGV); - // array.add(RGV); - + // Random random = new Random(); + // int lowerBound = 10000; + // int upperBound = 18000; + JSONArray baoshijian = (JSONArray) redisUtils.get("baoshijian1"); + JSONArray guhuashi = (JSONArray) redisUtils.get("guhuashi1"); + JSONArray AGV = (JSONArray) redisUtils.get("AGV1"); + JSONArray RGV = (JSONArray) redisUtils.get("RGV1"); + JSONArray site = (JSONArray) redisUtils.get("site1"); + array.add(baoshijian); + array.add(guhuashi); + array.add(AGV); + array.add(RGV); + array.add(site); // 固化室详情 JSONArray ghsInteriorList = cockpitMapper.getGHSInteriorList(); JSONObject ghsDetail = new JSONObject(); @@ -676,20 +737,16 @@ public class CockpitServiceImpl implements CockpitService { * 今日任务 */ public List getTasks(String type) { - // 获取今天的日期时间范围 - LocalDateTime startOfDay = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0).withNano(0); - LocalDateTime endOfDay = startOfDay.plusDays(1).minusNanos(1); List tasks = new ArrayList<>(); if (RegionCodeConstant.CURING_ZONE.equals(type)) { // 固化室当天出入库任务 - List todayTasks = taskService.list(new LambdaUpdateWrapper().eq(SchBaseTask::getIs_delete, 0).between(SchBaseTask::getCreate_time, startOfDay, endOfDay).and(wrapper -> wrapper.eq(SchBaseTask::getConfig_code, "1").or().eq(SchBaseTask::getConfig_code, "2"))); - tasks = ColaBeanUtils.copyListProperties(todayTasks, TaskInfo::new); + tasks = cockpitMapper.gettodayGhTaskList(); } else if (RegionCodeConstant.STAGING_AREA.equals(type)) { // 暂存区当天出入库任务 - List inTasks = cockpitMapper.getTemporaryInTask(); - List outTasks = cockpitMapper.getTemporaryOutTask(); - tasks.addAll(inTasks); - tasks.addAll(outTasks); + List inTaskList = cockpitMapper.getTemporaryInTask(); + List outTaskList = cockpitMapper.getTemporaryOutTask(); + tasks.addAll(inTaskList); + tasks.addAll(outTaskList); } return tasks; } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.java index d718e32..62e8e7d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.java @@ -8,9 +8,7 @@ import org.apache.ibatis.annotations.Select; import org.nl.wms.cockpit.service.dao.DasDeviceFault; import org.nl.wms.cockpit.service.dao.home.DayData; import org.nl.wms.cockpit.service.dao.home.TargetAchievement; -import org.nl.wms.cockpit.service.dao.zcq.Inventory; import org.nl.wms.cockpit.service.dao.zcq.TaskInfo; -import org.nl.wms.cockpit.service.dao.zcq.ZcqInfo; import java.util.List; import java.util.Map; @@ -49,6 +47,8 @@ public interface CockpitMapper { List getGhActualProduction(@Param("days") Integer days); + List gettodayGhTaskList(); + @Select("SELECT COUNT(*) AS totalFaults, " + " (COUNT(*) / 30.0) * 100 AS faultRate " + "FROM das_device_fault " + @@ -73,33 +73,53 @@ public interface CockpitMapper { */ JSONArray getGHSInteriorList(); + JSONArray getSSXInteriorList(); JSONArray getZCList(); JSONArray getKJList(); + //目前是获取当天的错误数据 JSONArray getError(); + //获取生产中的工单数据 JSONObject getProductTarget(); + //获取暂存库库存信息 List> getZcMaterialmsg(); + + //获取暂存库库存信息 + JSONObject getProductionsummary(); + + //库位使用占比 String percent(); + //获取今日创建的每一条工单的信息 List> getTdWorkmsg(); + //7天涂板实际生产 - List> getTxQty(String days); + List> getTxQty(String days, String region); + //7天固化室实际生产 List> getGhsQty(String days); + + //获取连涂普涂月统计数 + List> getTbxMonthlyStatistics(); + //查询所传设备当前生产的工单信息 JSONObject getDeviceWorker(String devicecode); + //根据所传的物料id获取物料名称 String getMaterialName(String material_id); + //根据所传设备得到该设备日产量 JSONArray getProductionDay(String devicecode); + //根据所传设备得到该设备班产量 JSONArray getProductionTeam(String devicecode); + //根据所传设备得到该设备30天生产记录 JSONArray getProductionHistory(String devicecode); //今日生产连涂生产 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.xml index ec4c8d2..286e14a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/mapper/CockpitMapper.xml @@ -62,6 +62,25 @@ + + +