diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java index 0d632ea..39d0743 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java @@ -129,6 +129,7 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements public void execute() { String message = null; try { + //todo 错误码转换 devicecode = this.getDeviceCode(); VW7010 = this.itemProtocol.getVW7010(); VW7012 = this.itemProtocol.getVW7012(); @@ -179,18 +180,19 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements } } //现场要测水分,手动更改 -// if (VW70002 != last_VW70002 && VW70002 == 1) { -// log.info("固化室{}反馈工艺运行结束,开始通知lms", devicecode); -// FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); -// request.setDevice_code(this.devicecode); -// request.setType("1"); -// request.setState("5"); -// acsToWmsService.notify(request); -// } + // if (VW70002 != last_VW70002 && VW70002 == 1) { + // log.info("固化室{}反馈工艺运行结束,开始通知lms", devicecode); + // FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); + // request.setDevice_code(this.devicecode); + // request.setType("1"); + // request.setState("5"); + // acsToWmsService.notify(request); + // } if (VD7046 != last_VD7046 && VD7046 == 0) { log.info("固化室{}反馈固化室恢复正常,开始通知lms", devicecode); FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); request.setDevice_code(this.devicecode); + //todo 错误码转换 request.setType("3"); request.setState(String.valueOf(VD7046)); acsToWmsService.notify(request); @@ -198,6 +200,7 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements log.info("固化室{}反馈固化室发生异常,开始通知lms", devicecode); FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); request.setDevice_code(this.devicecode); + //todo 错误码转换 request.setType("3"); request.setState(String.valueOf(VD7046)); acsToWmsService.notify(request); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java index 8787685..2a7c917 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java @@ -164,6 +164,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD acsToWmsService.notify(request); } } + //todo 错误码转换 if (error != last_error ) { FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); request.setDevice_code(this.device_code); 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 0fd0097..b10bc5c 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 @@ -68,6 +68,13 @@ public class CockpitController { return new ResponseEntity<>(cockpitService.getHomeInfo(), HttpStatus.OK); } + @PostMapping("/getHandlingInfo") + @Log("获取搬运信息") + @ApiOperation("获取搬运信息") + public ResponseEntity getHandlingInfo() { + return new ResponseEntity<>(cockpitService.getHandlingInfo(), HttpStatus.OK); + } + @PostMapping("/getTbxInfo") @Log("获取涂板线信息") @ApiOperation("获取涂板线信息") @@ -90,4 +97,6 @@ public class CockpitController { } + + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/CockpitService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/CockpitService.java index 417da9c..9d402b4 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/CockpitService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/cockpit/service/CockpitService.java @@ -19,6 +19,9 @@ public interface CockpitService { JSONObject getHomeInfo(); + JSONObject getHandlingInfo(); + + JSONObject getGhsInfo(); JSONObject getTbxInfo(); 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 8561477..332fdc6 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 @@ -37,14 +37,14 @@ import java.math.RoundingMode; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadPoolExecutor; import java.util.stream.Collectors; +import static org.nl.common.utils.DateUtil.localDateTimeFormatyMdHms; + /** * @Author: lyd * @Description: @@ -78,7 +78,8 @@ public class CockpitServiceImpl implements CockpitService { @Autowired private RedisUtils redisUtils; - + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM-dd"); + LocalDate today = LocalDate.now(); /** * 总览 @@ -87,8 +88,9 @@ public class CockpitServiceImpl implements CockpitService { public JSONObject getHomeInfo() { JSONObject getHomeInfo = new JSONObject(); //生产任务目标达成 - JSONObject target_achievement = new JSONObject(); - target_achievement = cockpitMapper.getProductTarget(); + JSONObject target_achievement = cockpitMapper.getProductTarget(); + + //固化汇总 CompletableFuture> task2 = CompletableFuture.supplyAsync(() -> { List dayDataList = new ArrayList<>(); @@ -101,81 +103,151 @@ public class CockpitServiceImpl implements CockpitService { } return dayDataList; }, pool); + + //暂存库库存结构 JSONObject zc_storage_info = new JSONObject(); - JSONArray material_info; - material_info=cockpitMapper.getZcMaterialmsg(); + List> material_info = cockpitMapper.getZcMaterialmsg(); + zc_storage_info.put("material_info", material_info); //库位使用占比 - String percent=cockpitMapper.percent(); - zc_storage_info.put("material_info",material_info); - zc_storage_info.put("percent",percent); + String percent = cockpitMapper.percent(); + zc_storage_info.put("percent", percent); //今日生产任务 - JSONArray today_work = new JSONArray(); - today_work=cockpitMapper.getTdWorkmsg(); - // 7天生产统计 - JSONArray tb_real_qty=new JSONArray(); - JSONArray gh_real_qty=new JSONArray(); - tb_real_qty=cockpitMapper.getTxQty(); - gh_real_qty=cockpitMapper.getGhsQty(); + 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("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> 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)); + tb_real_qty.add(item); + } + } //设备运行状态 - JSONObject device_status=new JSONObject(); + JSONObject device_status = new JSONObject(); //状态信息 - JSONArray status_info=new JSONArray(); - status_info=cockpitMapper.statusInfo(); + List> status_info = cockpitMapper.statusInfo(); //固化架信息 - JSONArray storage_info=new JSONArray(); - storage_info=cockpitMapper.storageInfo(); - device_status.put("status_info",status_info); - device_status.put("storage_info",storage_info); + List> storage_info = cockpitMapper.storageInfo(); + device_status.put("status_info", status_info); + device_status.put("storage_info", storage_info); //实时故障告警 - JSONArray fault_alarm=new JSONArray(); - fault_alarm=cockpitMapper.faultAlarm(); - //进30日故障统计 - JSONArray monthly_fault_statistics=new JSONArray(); - monthly_fault_statistics=cockpitMapper.monthlyFaultStatistics(); + List> fault_alarm = cockpitMapper.faultAlarm(); + faultAlarmDefault(fault_alarm, "GHS02"); + //近30日故障统计 + JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); + monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); //设备报警前十 - JSONArray gh_statistics=new JSONArray(); - gh_statistics=cockpitMapper.ghStatistics(); + 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("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("device_status", device_status); + getHomeInfo.put("fault_alarm", fault_alarm); + getHomeInfo.put("monthly_fault_statistics", monthly_fault_statistics); + getHomeInfo.put("gh_statistics", gh_statistics); return getHomeInfo; } + + /** * 涂板线 + * * @return */ @Override public JSONObject getTbxInfo() { - JSONObject getTbxInfo=new JSONObject(); + JSONObject getTbxInfo = new JSONObject(); //今日生产 - JSONObject target_achievement=new JSONObject(); - JSONObject lt_production=new JSONObject(); - JSONObject pt_production=new JSONObject(); - lt_production=cockpitMapper.ltProduction(); - pt_production=cockpitMapper.ptProduction(); - target_achievement.put("lt_production",lt_production); - target_achievement.put("pt_production",pt_production); + 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); //今日涂板任务 - JSONArray today_work=new JSONArray(); - today_work=cockpitMapper.todayTbTask(); + JSONArray today_work = cockpitMapper.todayTbTask(); + if (ObjectUtil.isEmpty(today_work)) { + JSONObject item1 = new JSONObject(); + item1.put("workorder_code", "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", "生产中"); + today_work.add(item1); + } //实时故障告警 - JSONArray fault_alarm=new JSONArray(); - fault_alarm=cockpitMapper.FaultTime("TBX"); - //进30日故障统计 - JSONArray monthly_fault_statistics=new JSONArray(); - monthly_fault_statistics=cockpitMapper.FaultTotal("TBX"); - 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); + List> fault_alarm = cockpitMapper.FaultTime("TBX"); + faultAlarmDefault(fault_alarm, "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); + } + } + 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); return getTbxInfo; } @@ -185,23 +257,53 @@ public class CockpitServiceImpl implements CockpitService { */ @Override public JSONObject getGhsInfo() { - JSONObject getGhsInfo=new JSONObject(); - //固化汇总 - JSONArray curing_summary=new JSONArray(); - curing_summary=cockpitMapper.curingSummary(); + JSONObject getGhsInfo = new JSONObject(); + //固化汇总 + 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> gh_material_summary = new ArrayList<>(); + if (ObjectUtil.isEmpty(gh_material_summary)) { + Map item1 = new HashMap<>(); + item1.put("material_name", "1.9A正"); + item1.put("material_spec", "正涂片极板/1.9A/大片"); + item1.put("qty", "2000"); + item1.put("type", "入库"); + Map item2 = new HashMap<>(); + item2.put("material_name", "15A负"); + item2.put("material_spec", "负涂片极板/15A/大片"); + item2.put("qty", "3000"); + item2.put("type", "出库"); + gh_material_summary.add(item1); + gh_material_summary.add(item2); + } //实时故障告警 - JSONArray fault_alarm=new JSONArray(); - fault_alarm=cockpitMapper.FaultTime("GH"); - //进30日故障统计 - JSONArray monthly_fault_statistics=new JSONArray(); - monthly_fault_statistics=cockpitMapper.FaultTotal("GH"); - getGhsInfo.put("curing_summary",curing_summary); - getGhsInfo.put("fault_alarm",fault_alarm); - getGhsInfo.put("monthly_fault_statistics",monthly_fault_statistics); - return getGhsInfo; + List> fault_alarm = cockpitMapper.FaultTime("GH"); + faultAlarmDefault(fault_alarm,"GHS02"); + //近30日故障统计 + JSONArray monthly_fault_statistics = cockpitMapper.FaultTotal("GH"); + monthlyFaultStatisticsDefault(monthly_fault_statistics, "GHS02"); + getGhsInfo.put("curing_summary", curing_summary); + getGhsInfo.put("monthly_gh_qty", monthly_gh_qty); + getGhsInfo.put("gh_material_summary", gh_material_summary); + getGhsInfo.put("fault_alarm", fault_alarm); + getGhsInfo.put("monthly_fault_statistics", monthly_fault_statistics); + return getGhsInfo; } + + /** * 暂存区 * @return @@ -210,27 +312,86 @@ public class CockpitServiceImpl implements CockpitService { public JSONObject getZcqInfo() { JSONObject getZcqInfo = new JSONObject(); //暂存库 - JSONObject temporary_storage = new JSONObject(); - temporary_storage = cockpitMapper.temporaryStorage(); + JSONObject temporary_storage = cockpitMapper.temporaryStorage(); //暂存区库存 - JSONArray inventory = new JSONArray(); - inventory=cockpitMapper.inventory(); + JSONArray inventory =cockpitMapper.inventory(); //货位货位信息 - JSONArray task_info=new JSONArray(); - task_info=cockpitMapper.taskInfo(); + JSONArray task_info=cockpitMapper.taskInfo(); getZcqInfo.put("temporary_storage",temporary_storage); getZcqInfo.put("inventory",inventory); getZcqInfo.put("task_info",task_info); return getZcqInfo; } + /** + * 获取搬运信息 + */ + @Override + public JSONObject getHandlingInfo() { + 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<>(); + if (ObjectUtil.isEmpty(agv_info) || ObjectUtil.isEmpty(rgv_info)) { + Map item1 = new HashMap<>(); + item1.put("item_name", "0"); + item1.put("item_qty", "5"); + Map item2 = new HashMap<>(); + item2.put("item_name", "1"); + item2.put("item_qty", "8"); + 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); + } + } + if (ObjectUtil.isEmpty(conveyor_info)) { + Map item1 = new HashMap<>(); + item1.put("item_name", "1"); + item1.put("item_qty", "10"); + Map item2 = new HashMap<>(); + item2.put("item_name", "2"); + item2.put("item_qty", "8"); + Map item3 = new HashMap<>(); + item3.put("item_name", "3"); + item3.put("item_qty", "5"); + 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); + //实时故障告警 + List> fault_alarm = cockpitMapper.faultAlarm(); + faultAlarmDefault(fault_alarm, "RGV02"); + //近30日故障统计 + //JSONArray monthly_fault_statistics = cockpitMapper.monthlyFaultStatistics(); + JSONArray monthly_fault_statistics = new JSONArray(); + monthlyFaultStatisticsDefault(monthly_fault_statistics, "RGV01"); + getHandlingInfo.put("device_status", device_status); + getHandlingInfo.put("fault_alarm", fault_alarm); + getHandlingInfo.put("monthly_fault_statistics", monthly_fault_statistics); + return getHandlingInfo; + } + /** * 设备ui */ @Override public JSONObject equipmentInfo(String deviceCode) { - JSONObject res = new JSONObject(); SchBasePoint point = pointService.getById(deviceCode); List points; @@ -408,10 +569,10 @@ public class CockpitServiceImpl implements CockpitService { // JSONArray RGV = (JSONArray) redisUtils.get("RGV"); JSONArray site = (JSONArray) redisUtils.get("site"); -// array.add(baoshijian); -// array.add(guhuashi); -// array.add(AGV); -// array.add(RGV); + // array.add(baoshijian); + // array.add(guhuashi); + // array.add(AGV); + // array.add(RGV); // 固化室详情 JSONArray ghsInteriorList = cockpitMapper.getGHSInteriorList(); @@ -685,7 +846,24 @@ public class CockpitServiceImpl implements CockpitService { // 返回包含故障数和故障率的对象 return new DeviceFaultStatistics(totalFaults, faultRate); } + private static void faultAlarmDefault( List> fault_alarm,String device_name) { + if (ObjectUtil.isEmpty(fault_alarm)) { + Map item1 = new HashMap<>(); + item1.put("device_name", device_name); + item1.put("fault_cause", "过载"); + item1.put("alarm_time", localDateTimeFormatyMdHms(LocalDateTime.now())); + fault_alarm.add(item1); + } + } + private static void monthlyFaultStatisticsDefault(JSONArray monthly_fault_statistics, String deviceCode) { + if (ObjectUtil.isEmpty(monthly_fault_statistics)) { + JSONObject item = new JSONObject(); + item.put("device_code", deviceCode); + item.put("alarm_qty", "1"); + monthly_fault_statistics.add(item); + } + } /** * 定时统计近七天数据 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 7f3c548..d718e32 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 @@ -13,6 +13,7 @@ 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; /** * @Author: lyd @@ -82,15 +83,15 @@ public interface CockpitMapper { //获取生产中的工单数据 JSONObject getProductTarget(); //获取暂存库库存信息 - JSONArray getZcMaterialmsg(); + List> getZcMaterialmsg(); //库位使用占比 String percent(); //获取今日创建的每一条工单的信息 - JSONArray getTdWorkmsg(); + List> getTdWorkmsg(); //7天涂板实际生产 - JSONArray getTxQty(); + List> getTxQty(String days); //7天固化室实际生产 - JSONArray getGhsQty(); + List> getGhsQty(String days); //查询所传设备当前生产的工单信息 JSONObject getDeviceWorker(String devicecode); //根据所传的物料id获取物料名称 @@ -108,7 +109,7 @@ public interface CockpitMapper { //今日涂板任务 JSONArray todayTbTask(); //实时故障告警 - JSONArray FaultTime(String region_code); + List> FaultTime(String region_code); //进30日故障统计 JSONArray FaultTotal(String region_code); //固化汇总 @@ -118,15 +119,15 @@ public interface CockpitMapper { //暂存区库存 JSONArray inventory(); //状态信息 - JSONArray statusInfo(); + List> statusInfo(); //固化架信息 - JSONArray storageInfo(); + List> storageInfo(); //实时故障告警 - JSONArray faultAlarm(); + List> faultAlarm(); //进30日故障统计 JSONArray monthlyFaultStatistics(); //设备报警前十 - JSONArray ghStatistics(); + List> ghStatistics(); //货位货位信息 JSONArray taskInfo(); } 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 79def64..4f8aaa7 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 @@ -219,14 +219,17 @@ WHERE failure_time LIKE CONCAT(CURDATE(), '%'); - SELECT m.material_name AS item_name, m.standard_qty AS item_qty @@ -236,7 +239,7 @@ WHERE p.region_code = 'ZC' AND p.vehicle_code IS NOT NULL - SELECT w.workorder_code, m.material_name AS material_name, @@ -248,33 +251,35 @@ LEFT JOIN md_base_material m ON m.material_id = w.material_id WHERE DATE(w.update_time) = CURDATE() - + SELECT + DATE_FORMAT(create_time,'%Y-%m-%d') AS date, + SUM(real_qty) AS total_qty, + 'TBX' AS region_name + FROM + pdm_bd_workorder + WHERE + create_time >= CURDATE() - INTERVAL #{days} DAY + AND region_code='TBX' + GROUP BY + DATE_FORMAT(create_time,'%Y-%m-%d') + ORDER BY + date; - + SELECT + DATE_FORMAT(create_time,'%Y-%m-%d') AS date, + SUM(material_qty) AS total_qty, + 'GHS' AS region_name + FROM + sch_base_vehiclematerialgroup + WHERE + create_time >= CURDATE() - INTERVAL #{days} DAY + AND region_code='GH' + GROUP BY + DATE_FORMAT(create_time,'%Y-%m-%d') + ORDER BY + date; - SELECT d1.device_code, d1.failure_info AS fault_cause, @@ -387,57 +394,72 @@ And d1.current_status=1 + + - + SELECT + CASE + WHEN p.is_used = true THEN 1 + ELSE 0 + END AS item_name, + COUNT(*) AS item_qty + FROM + `sch_base_point` p + GROUP BY + item_name; - SELECT p.point_status AS item_name, COUNT(*) AS item_qty @@ -448,48 +470,72 @@ FROM GROUP BY p.point_status; - + WITH RankedFaults AS ( + SELECT + device_code AS device_name, + failure_info AS fault_cause, + failure_time AS alarm_time, + ROW_NUMBER() OVER (PARTITION BY device_code ORDER BY failure_time DESC) AS rn + FROM das_device_fault + WHERE current_status = 1 + ) + SELECT + device_name, + fault_cause, + alarm_time + FROM RankedFaults + WHERE rn = 1; + + + - + SELECT + device_name, + error_number + FROM ( + SELECT + device_code AS device_name, + COUNT(*) AS error_number + FROM + das_device_fault + GROUP BY + device_code + ) AS device_errors + ORDER BY + error_number DESC + LIMIT 10;