看板年月日逻辑

master
wws 1 year ago
parent 0c5cf3f18f
commit 76a507c240

@ -19,12 +19,11 @@ public class DeviceApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(DeviceApplication.class, args); SpringApplication.run(DeviceApplication.class, args);
System.err.println("设备服务启动成功\n" System.err.println("设备服务启动成功\n"
+ " | | \r\n" + "________ .__ \n" +
+ " ___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___ \r\n" "\\______ \\ _______ _|__| ____ ____ \n" +
+ " / _ \\| '_ \\______/ __| | | / __| __/ _ \\ '_ ` _ \\ \r\n" " | | \\_/ __ \\ \\/ / |/ ___\\/ __ \\ \n" +
+ "| (_) | |_) | \\__ \\ |_| \\__ \\ || __/ | | | | |\r\n" " | ` \\ ___/\\ /| \\ \\__\\ ___/ \n" +
+ " \\___/| .__/ |___/\\__, |___/\\__\\___|_| |_| |_|\r\n" "/_______ /\\___ >\\_/ |__|\\___ >___ >\n" +
+ " | | __/ | \r\n" " \\/ \\/ \\/ \\/");
+ " |_| |___/ \r\n");
} }
} }

@ -35,8 +35,8 @@ public class DeviceInterfaceController {
* @return * @return
*/ */
@GetMapping("/getEquipmentInfo") @GetMapping("/getEquipmentInfo")
public AjaxResult getEquipmentInfo() { public AjaxResult getEquipmentInfo(EquOperation equOperation) {
return deviceInterfaceService.getEquipmentInfo(); return deviceInterfaceService.getEquipmentInfo(equOperation);
} }
/** /**
@ -45,8 +45,8 @@ public class DeviceInterfaceController {
* @return * @return
*/ */
@GetMapping("/getRepairQuantity") @GetMapping("/getRepairQuantity")
public AjaxResult getRepairQuantity() { public AjaxResult getRepairQuantity(EquOperation equOperation) {
return deviceInterfaceService.getRepairQuantity(); return deviceInterfaceService.getRepairQuantity(equOperation);
} }
/** /**

@ -56,23 +56,23 @@ public class EquOrder extends BaseEntity {
private String planLoopType; private String planLoopType;
/** 循环执行时间开始 */ /** 循环执行时间开始 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "循环执行时间开始", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "循环执行时间开始", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date planLoopStart; private Date planLoopStart;
/** 循环执行时间结束 */ /** 循环执行时间结束 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "循环执行时间结束", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "循环执行时间结束", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date planLoopEnd; private Date planLoopEnd;
/** 实际开始时间 */ /** 实际开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实际开始时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "实际开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date orderStart; private Date orderStart;
/** 实际结束时间 */ /** 实际结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "实际结束时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "实际结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date orderEnd; private Date orderEnd;
/** 设备编码 */ /** 设备编码 */

@ -23,7 +23,7 @@ public interface DeviceInterfaceMapper {
* *
* @return * @return
*/ */
List<IEquipmentVO> selectEquipmentList(); List<IEquipmentVO> selectEquipmentList(EquOperation equOperation);
/** /**
* *

@ -18,13 +18,13 @@ public interface IDeviceInterfaceService {
* *
* @return * @return
*/ */
AjaxResult getEquipmentInfo(); AjaxResult getEquipmentInfo(EquOperation equOperation);
/** /**
* TOP10 * TOP10
* @return * @return
*/ */
AjaxResult getRepairQuantity(); AjaxResult getRepairQuantity(EquOperation equOperation);
/** /**
* MTBF / * MTBF /

@ -59,9 +59,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult getEquipmentInfo() { public AjaxResult getEquipmentInfo(EquOperation equOperation) {
if (equOperation.getTimeDimension() == null) {
equOperation.setTimeDimension("dd");
}
// 获取所有设备信息 // 获取所有设备信息
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation);
return success(equipmentVOList); return success(equipmentVOList);
} }
@ -73,10 +76,12 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult getRepairQuantity() { public AjaxResult getRepairQuantity(EquOperation equOperation) {
equOperation.setTimeDimension("yyyy");
// 获取维修工单中的设备列表 // 获取维修工单中的设备列表
List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList(); List<IEquipmentVO> equipmentVOList = deviceInterfaceMapper.selectEquipmentList(equOperation);
for (IEquipmentVO equipmentVO : equipmentVOList) { for (IEquipmentVO equipmentVO : equipmentVOList) {
// 通过该设备code获取设备维修记录(只获取开始时间、结束时间) // 通过该设备code获取设备维修记录(只获取开始时间、结束时间)
@ -118,7 +123,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
//查询所有设备(设备停用的除外) //查询所有设备(设备停用的除外)
//判断查询年/月/日 //判断查询年/月/日
equOperation.setCreateTime(DateUtils.getNowDate()); equOperation.setCreateTime(DateUtils.getNowDate());
if(equOperation.getTimeDimension()==null){ if (equOperation.getTimeDimension() == null) {
equOperation.setTimeDimension("dd"); equOperation.setTimeDimension("dd");
} }
List<EquOperation> equipmentList = deviceInterfaceMapper.getMTBFList(equOperation); List<EquOperation> equipmentList = deviceInterfaceMapper.getMTBFList(equOperation);
@ -152,6 +157,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
/** /**
* -线 * -线
*
* @return * @return
*/ */
@Override @Override
@ -162,9 +168,9 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
// 初始化返回对象信息(获取当前月份,设置好数组长度) // 初始化返回对象信息(获取当前月份,设置好数组长度)
for (IEquFaultVO faultVO : faultVOList) { for (IEquFaultVO faultVO : faultVOList) {
// 通过组线编码查询当年设备每月故障数 // 通过组线编码查询当年设备每月故障数
List<Map<String,Integer>> monthFault = deviceInterfaceMapper.selectEquipmentFaultNumForMonth(faultVO.getCode()); List<Map<String, Integer>> monthFault = deviceInterfaceMapper.selectEquipmentFaultNumForMonth(faultVO.getCode());
if (monthFault!=null) { if (monthFault != null) {
for (Map<String,Integer> data : monthFault) { for (Map<String, Integer> data : monthFault) {
int[] source = faultVO.getData(); int[] source = faultVO.getData();
int index = data.get("month") - 1; int index = data.get("month") - 1;
source[index] = data.get("count"); source[index] = data.get("count");

@ -324,10 +324,6 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equOrder.setPlanPerson(SecurityContextHolder.getUserName());// 设置负责人 equOrder.setPlanPerson(SecurityContextHolder.getUserName());// 设置负责人
equOrder.setOrderEnd(DateUtils.getNowDate());// 设置检查时间结束 equOrder.setOrderEnd(DateUtils.getNowDate());// 设置检查时间结束
equOrder.setOrderStart(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; boolean checkRepair = false;

@ -157,12 +157,6 @@ public class EquOrderServiceImpl implements IEquOrderService {
order.setWorkCenterName(center.getFactoryName()); order.setWorkCenterName(center.getFactoryName());
} }
} }
order.setEquipmentName(equOrderMapper.selectEquipmentNameByEquCode(order.getEquipmentCode()));
// 设置计划名称
String planName = equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode());
if (planName!=null) {
order.setPlanName(planName);
}
} }
return orderList; return orderList;
} }

@ -1,10 +1,8 @@
Spring Boot Version: ${spring-boot.version} Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name} Spring Application Name: ${spring.application.name}
_ ________ .__
| | ____ ______ \______ \ _______ _|__| ____ ____
___ _ __ ______ ___ _ _ ___| |_ ___ _ __ ___ / _ \\____ \ ______ | | \_/ __ \ \/ / |/ ___\/ __ \
/ _ \| '_ \______/ __| | | / __| __/ _ \ '_ ` _ \ ( <_> ) |_> > /_____/ | ` \ ___/\ /| \ \__\ ___/
| (_) | |_) | \__ \ |_| \__ \ || __/ | | | | | \____/| __/ /_______ /\___ >\_/ |__|\___ >___ >
\___/| .__/ |___/\__, |___/\__\___|_| |_| |_| |__| \/ \/ \/ \/
| | __/ |
|_| |___/

@ -20,23 +20,26 @@
where wo.work_status = '0' where wo.work_status = '0'
</select> </select>
<select id="selectEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO"> <select id="selectEquipmentList" parameterType="EquOperation" resultType="com.op.device.domain.vo.IEquipmentVO">
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName',be.equipment_status AS 'equipmentStatus', (SELECT ROUND( select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName',be.equipment_status AS
SUM(CAST(fault_time AS FLOAT)) / 'equipmentStatus', (SELECT ROUND(
SUM(CAST(actual_operation_time AS FLOAT)), SUM(CAST(fault_time AS FLOAT)) /
2) SUM(CAST(actual_operation_time AS FLOAT)),
FROM equ_operation 2)
WHERE equipment_code = be.equipment_code) AS 'failureRate', ( FROM equ_operation
SELECT ROUND(SUM(mrw.quantity_feedback) / SUM(mrw.quantity), 2) WHERE equipment_code = be.equipment_code) AS 'failureRate', (
FROM mes_report_work mrw SELECT ROUND(SUM(mrw.quantity_feedback) / SUM(mrw.quantity), 2)
WHERE mrw.del_flag = '0' FROM mes_report_work mrw
AND mrw.status = 'PREPARE' WHERE mrw.del_flag = '0'
AND mrw.machine_code = be.equipment_code AND mrw.status = 'PREPARE'
AND mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE()) AND mrw.machine_code = be.equipment_code
) AS 'utilizationRatio' <if test="timeDimension == 'dd' ">AND mrw.feedback_time >= DATEADD(DAY, -1, GETDATE())</if>
<if test="timeDimension == 'mm' ">AND mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE())</if>
<if test="timeDimension == 'yyyy' ">AND mrw.feedback_time >= DATEADD(YEAR, -1, GETDATE())</if>
) AS 'utilizationRatio'
from base_equipment be from base_equipment be
where be.del_flag = '0' where be.del_flag = '0'
and be.equipment_category = '0' and be.equipment_category = '0'
</select> </select>
<select id="selectRepairEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO"> <select id="selectRepairEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO">

@ -61,53 +61,72 @@
</sql> </sql>
<select id="selectEquOrderList" parameterType="EquOrder" resultMap="EquOrderResult"> <select id="selectEquOrderList" parameterType="EquOrder" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/> 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
<where> <where>
<if test="planId != null and planId != ''"> and plan_id = #{planId}</if> <if test="planId != null and planId != ''">and eo.plan_id = #{planId}</if>
<if test="planCode != null and planCode != ''"> and plan_code like concat('%', #{planCode}, '%')</if> <if test="planCode != null and planCode != ''">and eo.plan_code like concat('%', #{planCode}, '%')</if>
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if> <if test="planType != null and planType != ''">and eo.plan_type = #{planType}</if>
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if> <if test="orderCode != null and orderCode != ''">and eo.order_code like concat('%', #{orderCode}, '%')</if>
<if test="planWorkshop != null and planWorkshop != ''"> and plan_workshop = #{planWorkshop}</if> <if test="planWorkshop != null and planWorkshop != ''">and eo.plan_workshop = #{planWorkshop}</if>
<if test="planProdLine != null and planProdLine != ''"> and plan_prod_line = #{planProdLine}</if> <if test="planProdLine != null and planProdLine != ''">and eo.plan_prod_line = #{planProdLine}</if>
<if test="planLoop != null and planLoop != ''"> and plan_loop = #{planLoop}</if> <if test="planLoop != null and planLoop != ''">and eo.plan_loop = #{planLoop}</if>
<if test="planLoopType != null and planLoopType != ''"> and plan_loop_type = #{planLoopType}</if> <if test="planLoopType != null and planLoopType != ''">and eo.plan_loop_type = #{planLoopType}</if>
<if test="equipmentCode != null and equipmentCode != ''"> and equipment_code like concat('%', #{equipmentCode}, '%')</if> <if test="equipmentCode != null and equipmentCode != ''">and eo.equipment_code like concat('%',
<if test="planLoopStart != null "> and plan_loop_start = #{planLoopStart}</if> #{equipmentCode}, '%')
<if test="planLoopEnd != null "> and plan_loop_end = #{planLoopEnd}</if> </if>
<if test="orderStart != null "> and order_start = #{orderStart}</if> <if test="equipmentName != null and equipmentName != ''">and be.equipment_name like concat('%',
<if test="orderEnd != null "> and order_end = #{ord5erEnd}</if> #{equipmentName}, '%')
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> </if>
<if test="orderCost != null "> and order_cost = #{orderCost}</if> <if test="planLoopStart != null ">and eo.plan_loop_start = #{planLoopStart}</if>
<if test="planPerson != null and planPerson != ''"> and plan_person like concat('%', #{planPerson}, '%')</if> <if test="planLoopEnd != null ">and eo.plan_loop_end = #{planLoopEnd}</if>
<if test="orderCostTime != null and orderCostTime != ''"> and order_cost_time = #{orderCostTime}</if> <if test="orderStart != null ">and CONVERT(date,eo.order_start) = #{orderStart}</if>
<if test="orderSignPerson != null and orderSignPerson != ''"> and order_sign_person = #{orderSignPerson}</if> <if test="orderEnd != null ">and eo.order_end = #{ord5erEnd}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if> <if test="orderStatus != null and orderStatus != ''">and eo.order_status = #{orderStatus}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if> <if test="orderCost != null ">and eo.order_cost = #{orderCost}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if> <if test="planPerson != null and planPerson != ''">and eo.plan_person like concat('%', #{planPerson}, '%')
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if> </if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if> <if test="orderCostTime != null and orderCostTime != ''">and eo.order_cost_time = #{orderCostTime}</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if> <if test="orderSignPerson != null and orderSignPerson != ''">and eo.order_sign_person = #{orderSignPerson}
<if test="createTime != null "> and CONVERT(date,create_time) = #{createTime}</if> </if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if> <if test="factoryCode != null and factoryCode != ''">and eo.factory_code = #{factoryCode}</if>
<if test="updateTime != null "> and CONVERT(date,update_time) = #{updateTime}</if> <if test="attr1 != null and attr1 != ''">and eo.attr1 = #{attr1}</if>
<if test="upkeep != null "> and upkeep = #{upkeep}</if> <if test="attr2 != null and attr2 != ''">and eo.attr2 = #{attr2}</if>
<if test="calculationRule != null "> and calculation_rule = #{calculationRule}</if> <if test="attr3 != null and attr3 != ''">and eo.attr3 = #{attr3}</if>
<if test="shutDown != null "> and shut_down = #{shutDown}</if> <if test="delFlag != null and delFlag != ''">and eo.del_flag = #{delFlag}</if>
<if test="orderInspect != null "> and order_inspect = #{orderInspect}</if> <if test="createBy != null and createBy != ''">and eo.create_by like concat('%', #{createBy}, '%')</if>
<if test="repairCode != null "> and repair_code = #{repairCode}</if> <if test="createTime != null ">and CONVERT(date,eo.create_time) = #{createTime}</if>
<if test="outsourceCode != null "> and outsource_code = #{outsourceCode}</if> <if test="updateBy != null and updateBy != ''">and eo.update_by like concat('%', #{updateBy}, '%')</if>
<if test="workCode != null "> and work_code = #{workCode}</if> <if test="updateTime != null ">and CONVERT(date,eo.update_time) = #{updateTime}</if>
<if test="loopStart != null "> and CONVERT(date,plan_loop_start) >= #{loopStart}</if> <if test="upkeep != null ">and eo.upkeep = #{upkeep}</if>
<if test="loopEnd != null "> and #{loopEnd} >= CONVERT(date,plan_loop_start)</if> <if test="calculationRule != null ">and eo.calculation_rule = #{calculationRule}</if>
<if test="loopEndArrayStart != null "> and CONVERT(date,plan_loop_end) >= #{loopEndArrayStart}</if> <if test="shutDown != null ">and eo.shut_down = #{shutDown}</if>
<if test="getLoopEndArrayEnd != null "> and #{getLoopEndArrayEnd} >= CONVERT(date,plan_loop_end)</if> <if test="orderInspect != null ">and eo.order_inspect = #{orderInspect}</if>
<if test="orderStartArrayStart != null "> and CONVERT(date,order_start) >= #{orderStartArrayStart}</if> <if test="repairCode != null ">and eo.repair_code = #{repairCode}</if>
<if test="orderStartArrayEnd != null "> and #{orderStartArrayEnd} >= CONVERT(date,order_start)</if> <if test="outsourceCode != null ">and eo.outsource_code = #{outsourceCode}</if>
<if test="orderEndArrayStart != null "> and CONVERT(date,order_end) >= #{orderEndArrayStart}</if> <if test="workCode != null ">and eo.work_code = #{workCode}</if>
<if test="orderEndArrayEnd != null "> and #{orderEndArrayEnd} >= CONVERT(date,order_end)</if> <if test="loopStart != null ">and CONVERT(date,eo.plan_loop_start) >= #{loopStart}</if>
and del_flag = '0' <if test="loopEnd != null ">and #{loopEnd} >= CONVERT(date,eo.plan_loop_start)</if>
<if test="loopEndArrayStart != null ">and CONVERT(date,eo.plan_loop_end) >= #{loopEndArrayStart}</if>
<if test="getLoopEndArrayEnd != null ">and #{getLoopEndArrayEnd} >= CONVERT(date,eo.plan_loop_end)</if>
<if test="orderStartArrayStart != null ">and CONVERT(date,eo.order_start) >= #{orderStartArrayStart}</if>
<if test="orderStartArrayEnd != null ">and #{orderStartArrayEnd} >= CONVERT(date,eo.order_start)</if>
<if test="orderEndArrayStart != null ">and CONVERT(date,eo.order_end) >= #{orderEndArrayStart}</if>
<if test="orderEndArrayEnd != null ">and #{orderEndArrayEnd} >= CONVERT(date,eo.order_end)</if>
and eo.del_flag = '0' and be.del_flag = '0' and ep.del_flag = '0'
</where> </where>
order by create_time desc order by eo.create_time desc
</select> </select>
<select id="selectEquOrderByOrderCode" parameterType="String" resultMap="EquOrderResult"> <select id="selectEquOrderByOrderCode" parameterType="String" resultMap="EquOrderResult">

Loading…
Cancel
Save