diff --git a/op-modules/op-device/src/main/java/com/op/device/DeviceApplication.java b/op-modules/op-device/src/main/java/com/op/device/DeviceApplication.java index e832dec7..557c10cf 100644 --- a/op-modules/op-device/src/main/java/com/op/device/DeviceApplication.java +++ b/op-modules/op-device/src/main/java/com/op/device/DeviceApplication.java @@ -19,12 +19,11 @@ public class DeviceApplication { public static void main(String[] args) { SpringApplication.run(DeviceApplication.class, args); System.err.println("设备服务启动成功\n" - + " | | \r\n" - + " ___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___ \r\n" - + " / _ \\| '_ \\______/ __| | | / __| __/ _ \\ '_ ` _ \\ \r\n" - + "| (_) | |_) | \\__ \\ |_| \\__ \\ || __/ | | | | |\r\n" - + " \\___/| .__/ |___/\\__, |___/\\__\\___|_| |_| |_|\r\n" - + " | | __/ | \r\n" - + " |_| |___/ \r\n"); + + "________ .__ \n" + + "\\______ \\ _______ _|__| ____ ____ \n" + + " | | \\_/ __ \\ \\/ / |/ ___\\/ __ \\ \n" + + " | ` \\ ___/\\ /| \\ \\__\\ ___/ \n" + + "/_______ /\\___ >\\_/ |__|\\___ >___ >\n" + + " \\/ \\/ \\/ \\/"); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/DeviceInterfaceController.java b/op-modules/op-device/src/main/java/com/op/device/controller/DeviceInterfaceController.java index 230388cd..83c4b7f0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/DeviceInterfaceController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/DeviceInterfaceController.java @@ -35,8 +35,8 @@ public class DeviceInterfaceController { * @return */ @GetMapping("/getEquipmentInfo") - public AjaxResult getEquipmentInfo() { - return deviceInterfaceService.getEquipmentInfo(); + public AjaxResult getEquipmentInfo(EquOperation equOperation) { + return deviceInterfaceService.getEquipmentInfo(equOperation); } /** @@ -45,8 +45,8 @@ public class DeviceInterfaceController { * @return */ @GetMapping("/getRepairQuantity") - public AjaxResult getRepairQuantity() { - return deviceInterfaceService.getRepairQuantity(); + public AjaxResult getRepairQuantity(EquOperation equOperation) { + return deviceInterfaceService.getRepairQuantity(equOperation); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java index 9d56f45c..be615ddd 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java @@ -56,23 +56,23 @@ public class EquOrder extends BaseEntity { private String planLoopType; /** 循环执行时间开始 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "循环执行时间开始", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "循环执行时间开始", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date planLoopStart; /** 循环执行时间结束 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "循环执行时间结束", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "循环执行时间结束", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date planLoopEnd; /** 实际开始时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "实际开始时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "实际开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date orderStart; /** 实际结束时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "实际结束时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "实际结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date orderEnd; /** 设备编码 */ diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java index a21f1edf..33a357d2 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/DeviceInterfaceMapper.java @@ -23,7 +23,7 @@ public interface DeviceInterfaceMapper { * 获取所有设备信息 * @return */ - List selectEquipmentList(); + List selectEquipmentList(EquOperation equOperation); /** * 获取维修工单中设备信息 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IDeviceInterfaceService.java b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceInterfaceService.java index 775ae764..63e2da6d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IDeviceInterfaceService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IDeviceInterfaceService.java @@ -18,13 +18,13 @@ public interface IDeviceInterfaceService { * 获取设备信息 * @return */ - AjaxResult getEquipmentInfo(); + AjaxResult getEquipmentInfo(EquOperation equOperation); /** * 设备维修质量TOP10 * @return */ - AjaxResult getRepairQuantity(); + AjaxResult getRepairQuantity(EquOperation equOperation); /** * 设备稳定性MTBF 实际运转时间/停止次数 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index 2e248f6c..ff917fbc 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -59,9 +59,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { */ @Override @DS("#header.poolName") - public AjaxResult getEquipmentInfo() { + public AjaxResult getEquipmentInfo(EquOperation equOperation) { + if (equOperation.getTimeDimension() == null) { + equOperation.setTimeDimension("dd"); + } // 获取所有设备信息 - List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); + List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation); return success(equipmentVOList); } @@ -73,10 +76,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { */ @Override @DS("#header.poolName") - public AjaxResult getRepairQuantity() { + public AjaxResult getRepairQuantity(EquOperation equOperation) { + + equOperation.setTimeDimension("yyyy"); // 获取维修工单中的设备列表 - List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); + List equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation); for (IEquipmentVO equipmentVO : equipmentVOList) { // 通过该设备code获取设备维修记录(只获取开始时间、结束时间) @@ -118,7 +123,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { //查询所有设备(设备停用的除外) //判断查询年/月/日 equOperation.setCreateTime(DateUtils.getNowDate()); - if(equOperation.getTimeDimension()==null){ + if (equOperation.getTimeDimension() == null) { equOperation.setTimeDimension("dd"); } List equipmentList = deviceInterfaceMapper.getMTBFList(equOperation); @@ -152,6 +157,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { /** * 首页-组线设备月故障数 + * * @return */ @Override @@ -162,9 +168,9 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { // 初始化返回对象信息(获取当前月份,设置好数组长度) for (IEquFaultVO faultVO : faultVOList) { // 通过组线编码查询当年设备每月故障数 - List> monthFault = deviceInterfaceMapper.selectEquipmentFaultNumForMonth(faultVO.getCode()); - if (monthFault!=null) { - for (Map data : monthFault) { + List> monthFault = deviceInterfaceMapper.selectEquipmentFaultNumForMonth(faultVO.getCode()); + if (monthFault != null) { + for (Map data : monthFault) { int[] source = faultVO.getData(); int index = data.get("month") - 1; source[index] = data.get("count"); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index 791fcedf..78b74187 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -324,10 +324,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equOrder.setPlanPerson(SecurityContextHolder.getUserName());// 设置负责人 equOrder.setOrderEnd(DateUtils.getNowDate());// 设置检查时间结束 equOrder.setOrderStart(DateUtils.getNowDate());// 设置检查时间开始 - if (equOrder.getTimeArray().size() > 0) { - equOrder.setOrderStart(equOrder.getTimeArray().get(0));// 工单开始时间 - equOrder.setOrderEnd(equOrder.getTimeArray().get(1));// 工单结束时间 - } // 是否存在报修单 boolean checkRepair = false; diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java index 11d5ced0..87089a89 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java @@ -157,12 +157,6 @@ public class EquOrderServiceImpl implements IEquOrderService { order.setWorkCenterName(center.getFactoryName()); } } - order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode())); - // 设置计划名称 - String planName = equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode()); - if (planName!=null) { - order.setPlanName(planName); - } } return orderList; } diff --git a/op-modules/op-device/src/main/resources/banner.txt b/op-modules/op-device/src/main/resources/banner.txt index e8a75ab1..001456d3 100644 --- a/op-modules/op-device/src/main/resources/banner.txt +++ b/op-modules/op-device/src/main/resources/banner.txt @@ -1,10 +1,8 @@ Spring Boot Version: ${spring-boot.version} Spring Application Name: ${spring.application.name} - _ - | | - ___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___ - / _ \| '_ \______/ __| | | / __| __/ _ \ '_ ` _ \ -| (_) | |_) | \__ \ |_| \__ \ || __/ | | | | | - \___/| .__/ |___/\__, |___/\__\___|_| |_| |_| - | | __/ | - |_| |___/ + ________ .__ + ____ ______ \______ \ _______ _|__| ____ ____ + / _ \\____ \ ______ | | \_/ __ \ \/ / |/ ___\/ __ \ +( <_> ) |_> > /_____/ | ` \ ___/\ /| \ \__\ ___/ + \____/| __/ /_______ /\___ >\_/ |__|\___ >___ > + |__| \/ \/ \/ \/ diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 88eb010a..2d2b1d42 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -20,23 +20,26 @@ where wo.work_status = '0' - + select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName',be.equipment_status AS + 'equipmentStatus', (SELECT ROUND( + SUM(CAST(fault_time AS FLOAT)) / + SUM(CAST(actual_operation_time AS FLOAT)), + 2) + FROM equ_operation + WHERE equipment_code = be.equipment_code) AS 'failureRate', ( + SELECT ROUND(SUM(mrw.quantity_feedback) / SUM(mrw.quantity), 2) + FROM mes_report_work mrw + WHERE mrw.del_flag = '0' + AND mrw.status = 'PREPARE' + AND mrw.machine_code = be.equipment_code + AND mrw.feedback_time >= DATEADD(DAY, -1, GETDATE()) + AND mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE()) + AND mrw.feedback_time >= DATEADD(YEAR, -1, GETDATE()) + ) AS 'utilizationRatio' from base_equipment be where be.del_flag = '0' - and be.equipment_category = '0' + and be.equipment_category = '0' - + select eo.order_id, eo.plan_id, eo.plan_code, eo.plan_type, eo.order_code, eo.plan_workshop, eo.plan_prod_line, + eo.plan_loop, + eo.plan_loop_type, + eo.plan_loop_start, eo.plan_loop_end, eo.order_start, eo.order_end, eo.equipment_code, eo.order_status, + eo.order_cost, eo.plan_person, eo.order_cost_time, eo.order_sign_person, + eo.factory_code, eo.attr1, eo.attr2, eo.attr3, eo.del_flag, eo.create_by, eo.create_time, + eo.update_by, + eo.update_time,eo.upkeep,eo.calculation_rule,eo.shut_down,eo.order_inspect,eo.repair_code,eo.work_code,eo.outsource_code, + be.equipment_name, + ep.plan_name planName + from equ_order eo + left join base_equipment be on be.equipment_code = eo.equipment_code + left join equ_plan ep on ep.plan_code = eo.plan_code - and plan_id = #{planId} - and plan_code like concat('%', #{planCode}, '%') - and plan_type = #{planType} - and order_code like concat('%', #{orderCode}, '%') - and plan_workshop = #{planWorkshop} - and plan_prod_line = #{planProdLine} - and plan_loop = #{planLoop} - and plan_loop_type = #{planLoopType} - and equipment_code like concat('%', #{equipmentCode}, '%') - and plan_loop_start = #{planLoopStart} - and plan_loop_end = #{planLoopEnd} - and order_start = #{orderStart} - and order_end = #{ord5erEnd} - and order_status = #{orderStatus} - and order_cost = #{orderCost} - and plan_person like concat('%', #{planPerson}, '%') - and order_cost_time = #{orderCostTime} - and order_sign_person = #{orderSignPerson} - and factory_code = #{factoryCode} - and attr1 = #{attr1} - and attr2 = #{attr2} - and attr3 = #{attr3} - and del_flag = #{delFlag} - and create_by like concat('%', #{createBy}, '%') - and CONVERT(date,create_time) = #{createTime} - and update_by like concat('%', #{updateBy}, '%') - and CONVERT(date,update_time) = #{updateTime} - and upkeep = #{upkeep} - and calculation_rule = #{calculationRule} - and shut_down = #{shutDown} - and order_inspect = #{orderInspect} - and repair_code = #{repairCode} - and outsource_code = #{outsourceCode} - and work_code = #{workCode} - and CONVERT(date,plan_loop_start) >= #{loopStart} - and #{loopEnd} >= CONVERT(date,plan_loop_start) - and CONVERT(date,plan_loop_end) >= #{loopEndArrayStart} - and #{getLoopEndArrayEnd} >= CONVERT(date,plan_loop_end) - and CONVERT(date,order_start) >= #{orderStartArrayStart} - and #{orderStartArrayEnd} >= CONVERT(date,order_start) - and CONVERT(date,order_end) >= #{orderEndArrayStart} - and #{orderEndArrayEnd} >= CONVERT(date,order_end) - and del_flag = '0' + and eo.plan_id = #{planId} + and eo.plan_code like concat('%', #{planCode}, '%') + and eo.plan_type = #{planType} + and eo.order_code like concat('%', #{orderCode}, '%') + and eo.plan_workshop = #{planWorkshop} + and eo.plan_prod_line = #{planProdLine} + and eo.plan_loop = #{planLoop} + and eo.plan_loop_type = #{planLoopType} + and eo.equipment_code like concat('%', + #{equipmentCode}, '%') + + and be.equipment_name like concat('%', + #{equipmentName}, '%') + + and eo.plan_loop_start = #{planLoopStart} + and eo.plan_loop_end = #{planLoopEnd} + and CONVERT(date,eo.order_start) = #{orderStart} + and eo.order_end = #{ord5erEnd} + and eo.order_status = #{orderStatus} + and eo.order_cost = #{orderCost} + and eo.plan_person like concat('%', #{planPerson}, '%') + + and eo.order_cost_time = #{orderCostTime} + and eo.order_sign_person = #{orderSignPerson} + + and eo.factory_code = #{factoryCode} + and eo.attr1 = #{attr1} + and eo.attr2 = #{attr2} + and eo.attr3 = #{attr3} + and eo.del_flag = #{delFlag} + and eo.create_by like concat('%', #{createBy}, '%') + and CONVERT(date,eo.create_time) = #{createTime} + and eo.update_by like concat('%', #{updateBy}, '%') + and CONVERT(date,eo.update_time) = #{updateTime} + and eo.upkeep = #{upkeep} + and eo.calculation_rule = #{calculationRule} + and eo.shut_down = #{shutDown} + and eo.order_inspect = #{orderInspect} + and eo.repair_code = #{repairCode} + and eo.outsource_code = #{outsourceCode} + and eo.work_code = #{workCode} + and CONVERT(date,eo.plan_loop_start) >= #{loopStart} + and #{loopEnd} >= CONVERT(date,eo.plan_loop_start) + and CONVERT(date,eo.plan_loop_end) >= #{loopEndArrayStart} + and #{getLoopEndArrayEnd} >= CONVERT(date,eo.plan_loop_end) + and CONVERT(date,eo.order_start) >= #{orderStartArrayStart} + and #{orderStartArrayEnd} >= CONVERT(date,eo.order_start) + and CONVERT(date,eo.order_end) >= #{orderEndArrayStart} + and #{orderEndArrayEnd} >= CONVERT(date,eo.order_end) + and eo.del_flag = '0' and be.del_flag = '0' and ep.del_flag = '0' - order by create_time desc + order by eo.create_time desc