From 423c836f9a0b15033b048c9d2666d3440fecdca0 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 18 三月 2025 16:05:40 +0800 Subject: [PATCH] 零件加工管理和OEE页面接口 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml | 5 lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java | 4 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPartProcessInfoService.java | 73 +++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java | 71 ++-- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPartProcessInfo.java | 71 +++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java | 18 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPartProcessInfoMapper.xml | 51 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPartProcessInfoController.java | 163 +++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPartProcessInfoServiceImpl.java | 204 ++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPartProcessInfoMapper.java | 52 +++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java | 9 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPartProcessInfoVo.java | 20 + 18 files changed, 758 insertions(+), 39 deletions(-) diff --git a/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java b/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java index 83520de..83f6f51 100644 --- a/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java +++ b/lxzn-boot-base-core/src/main/java/org/jeecg/common/constant/CommonConstant.java @@ -603,9 +603,9 @@ Integer DOWNTIME_STATUS_0 = 0; Integer DOWNTIME_STATUS_1 = 1; /** - * 鍋滄満绫诲瀷 1(璁″垝鍋滄満) 2 (闈炶鍒掑仠鏈�) + * 鍋滄満绫诲瀷 0(璁″垝鍋滄満) 1 (闈炶鍒掑仠鏈�) */ + String CLOSE_TYPE_0 = "0"; String CLOSE_TYPE_1 = "1"; - String CLOSE_TYPE_2 = "2"; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPartProcessInfoController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPartProcessInfoController.java new file mode 100644 index 0000000..d0b6413 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcPartProcessInfoController.java @@ -0,0 +1,163 @@ +package org.jeecg.modules.mdc.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.entity.MdcPartProcessInfo; +import org.jeecg.modules.mdc.service.IMdcPartProcessInfoService; +import org.jeecg.modules.mdc.vo.MdcPartProcessInfoVo; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + +/** + * @Description: 闆朵欢鍔犲伐鏁版嵁琛� + * @Author: lius + * @Date: 2024-12-11 + */ +@Slf4j +@Api(tags = "闆朵欢鍔犲伐鏁版嵁琛�") +@RestController +@RequestMapping("/mdc/mdcPartProcessInfo") +public class MdcPartProcessInfoController extends JeecgController<MdcPartProcessInfo, IMdcPartProcessInfoService> { + + @Resource + private IMdcPartProcessInfoService mdcPartProcessInfoService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mdcPartProcessInfo + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-鍒嗛〉鍒楄〃鏌ヨ", notes = "闆朵欢鍔犲伐鏁版嵁琛�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<?> queryPageList(MdcPartProcessInfoVo mdcPartProcessInfo, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + Page<MdcPartProcessInfo> page = new Page<MdcPartProcessInfo>(pageNo, pageSize); + IPage<MdcPartProcessInfo> pageList = mdcPartProcessInfoService.pageList(userId, page, mdcPartProcessInfo, req); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param mdcPartProcessInfo + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-娣诲姞") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-娣诲姞", notes = "闆朵欢鍔犲伐鏁版嵁琛�-娣诲姞") + @PostMapping(value = "/add") + public Result<?> add(@RequestBody MdcPartProcessInfoVo mdcPartProcessInfo) { + if (StringUtils.isBlank(mdcPartProcessInfo.getEquipmentIds())) { + return Result.error("鏈�夋嫨璁惧锛岃鎺掓煡锛�"); + } + boolean result = mdcPartProcessInfoService.addPartProcess(mdcPartProcessInfo); + if (!result) { + return Result.error("娣诲姞澶辫触锛�"); + } + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param mdcPartProcessInfo + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-缂栬緫") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-缂栬緫", notes = "闆朵欢鍔犲伐鏁版嵁琛�-缂栬緫") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<?> edit(@RequestBody MdcPartProcessInfo mdcPartProcessInfo) { + mdcPartProcessInfoService.updateById(mdcPartProcessInfo); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鍒犻櫎") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鍒犻櫎", notes = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鍒犻櫎") + @DeleteMapping(value = "/delete") + public Result<?> delete(@RequestParam(name = "id", required = true) String id) { + mdcPartProcessInfoService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-鎵归噺鍒犻櫎") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-鎵归噺鍒犻櫎", notes = "闆朵欢鍔犲伐鏁版嵁琛�-鎵归噺鍒犻櫎") + @DeleteMapping(value = "/deleteBatch") + public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.mdcPartProcessInfoService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛锛�"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + @AutoLog(value = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鏌ヨ") + @ApiOperation(value = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鏌ヨ", notes = "闆朵欢鍔犲伐鏁版嵁琛�-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { + MdcPartProcessInfo mdcPartProcessInfo = mdcPartProcessInfoService.getById(id); + return Result.OK(mdcPartProcessInfo); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param mdcPartProcessInfo + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MdcPartProcessInfoVo mdcPartProcessInfo) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + return mdcPartProcessInfoService.exportXls(userId, mdcPartProcessInfo); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MdcPartProcessInfo.class); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPartProcessInfo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPartProcessInfo.java new file mode 100644 index 0000000..b4792d7 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcPartProcessInfo.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.mdc.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecg.common.system.base.entity.JeecgEntity; +import org.jeecgframework.poi.excel.annotation.Excel; + +import java.io.Serializable; + +/** + * @Description: 闆朵欢鍔犲伐鏁版嵁琛� + * @Author: lius + * @Date: 2024-12-11 + */ +@Data +@TableName("mdc_part_process_info") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_part_process_info瀵硅薄", description = "闆朵欢鍔犲伐鏁版嵁琛�") +public class MdcPartProcessInfo extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = -5287766951707976335L; + + /** + * 鏃ユ湡 + */ + @Excel(name = "鏃ユ湡", width = 15) + @ApiModelProperty(value = "鏃ユ湡") + private String theDate; + /** + * 璁惧缂栧彿 + */ + @Excel(name = "璁惧缂栧彿", width = 20) + @ApiModelProperty(value = "璁惧缂栧彿") + private String equipmentId; + /** + * 闆朵欢鍙� + */ + @Excel(name = "闆朵欢鍙�", width = 20) + @ApiModelProperty(value = "闆朵欢鍙�") + private String partId; + /** + * 鏍囧噯鍔犲伐鏃堕暱锛坢in锛� + */ + @Excel(name = "鏍囧噯鍔犲伐鏃堕暱锛坢in锛�", width = 20) + @ApiModelProperty(value = "鏍囧噯鍔犲伐鏃堕暱锛坢in锛�") + private Integer standardProcessLong; + /** + * 鍔犲伐闆朵欢鏁伴噺 + */ + @Excel(name = "鍔犲伐闆朵欢鏁伴噺", width = 15) + @ApiModelProperty(value = "鍔犲伐闆朵欢鏁伴噺") + private Integer processCount; + /** + * 鍚堟牸闆朵欢鏁伴噺 + */ + @Excel(name = "鍚堟牸闆朵欢鏁伴噺", width = 15) + @ApiModelProperty(value = "鍚堟牸闆朵欢鏁伴噺") + private Integer passCount; + /** + * 鍔犲伐鎬绘椂闀�(min) + */ + @Excel(name = "鍔犲伐鎬绘椂闀�(min)", width = 18) + @ApiModelProperty(value = "鍔犲伐鎬绘椂闀�(min)") + private Integer totalProcessLong; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java index 561ba66..5446655 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDowntimeMapper.java @@ -8,6 +8,8 @@ import org.jeecg.modules.mdc.entity.MdcDowntime; import org.jeecg.modules.mdc.vo.MdcDowntimeVo; +import java.util.List; + /** * @Description: 寰呮満鍋滄満琛� * @Author: lius @@ -16,4 +18,6 @@ public interface MdcDowntimeMapper extends BaseMapper<MdcDowntime> { IPage<MdcDowntimeDto> pageList(Page<MdcDowntimeDto> page, @Param("mdcDowntimeVo") MdcDowntimeVo mdcDowntimeVo); + + List<MdcDowntime> findPlanTimeDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate, @Param("closeType") String closeType); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java index c542e18..3815783 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java @@ -16,4 +16,13 @@ * 鑾峰彇璁惧鏈�鏂版棩鏈熺殑杩愯鏁版嵁 */ MdcEquipmentStatisticalInfo getMaxStaticsData(@Param("equipmentId") String equipmentId); + + /** + * 鏌ヨ璁惧杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPartProcessInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPartProcessInfoMapper.java new file mode 100644 index 0000000..148619f --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPartProcessInfoMapper.java @@ -0,0 +1,52 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mdc.entity.MdcPartProcessInfo; +import org.jeecg.modules.mdc.vo.MdcPartProcessInfoVo; + +/** + * @Description: 闆朵欢鍔犲伐鏁版嵁琛� + * @Author: lius + * @Date: 2024-12-11 + */ +public interface MdcPartProcessInfoMapper extends BaseMapper<MdcPartProcessInfo> { + + /** + * 鍒嗛〉鍒楄〃 + * + * @param page + * @param mdcPartProcessInfo + * @return + */ + IPage<MdcPartProcessInfo> pageList(Page<MdcPartProcessInfo> page, @Param("mdcPartProcessInfo") MdcPartProcessInfoVo mdcPartProcessInfo); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ椂闂� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalProcessCount(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ュ悎鏍兼暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalPassCount(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml index cbad115..e5adea6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDowntimeMapper.xml @@ -27,4 +27,17 @@ </where> ORDER BY t1.create_time DESC </select> + + <select id="findPlanTimeDuration" resultType="org.jeecg.modules.mdc.entity.MdcDowntime"> + SELECT + t1.* + FROM + mdc_downtime t1 + LEFT JOIN mdc_downtime_reason t2 ON t1.reason_id = t2.id + WHERE + t1.status = 1 + AND t1.equipment_id = #{equipmentId} + AND t2.downtime_type = #{closeType} + AND t1.the_date = #{validDate} + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml index 77c17f3..e5d1c6b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml @@ -7,4 +7,9 @@ <select id="getMaxStaticsData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo"> SELECT TOP 1 * FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC </select> + + <!--鏌ヨ璁惧杩愯鏃堕棿--> + <select id="selectProcessLong" resultType="java.lang.Integer"> + SELECT TOP 1 process_long FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPartProcessInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPartProcessInfoMapper.xml new file mode 100644 index 0000000..2f3b308 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPartProcessInfoMapper.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.jeecg.modules.mdc.mapper.MdcPartProcessInfoMapper"> + + <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcPartProcessInfo"> + SELECT + * + FROM + mdc_part_process_info + <where> + <if test="mdcPartProcessInfo.equipmentId != null and mdcPartProcessInfo.equipmentId != ''"> + AND equipment_id = #{ mdcPartProcessInfo.equipmentId } + </if> + <if test="mdcPartProcessInfo.partId != null and mdcPartProcessInfo.partId != ''"> + AND part_id = #{ mdcPartProcessInfo.partId } + </if> + <if test="mdcPartProcessInfo.theDate != null and mdcPartProcessInfo.theDate != ''"> + AND the_date LIKE CONCAT('%',#{ mdcPartProcessInfo.theDate },'%') + </if> + <if test="mdcPartProcessInfo.startTime != null and mdcPartProcessInfo.startTime != ''"> + AND the_date >= #{ mdcPartProcessInfo.startTime } + </if> + <if test="mdcPartProcessInfo.endTime != null and mdcPartProcessInfo.endTime != ''"> + AND the_date <= #{mdcPartProcessInfo.endTime } + </if> + <if test="mdcPartProcessInfo.equipmentIdList != null and mdcPartProcessInfo.equipmentIdList.size() > 0 "> + AND equipment_id IN + <foreach collection="mdcPartProcessInfo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + ORDER BY the_date DESC, equipment_id ASC + </select> + + <!--鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ椂闂�--> + <select id="selectTotalProcessLong" resultType="java.lang.Integer"> + SELECT sum(total_process_long) FROM mdc_part_process_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} + </select> + + <!--鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ暟閲�--> + <select id="selectTotalProcessCount" resultType="java.lang.Integer"> + SELECT sum(process_count) FROM mdc_part_process_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} + </select> + + <!--鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ュ悎鏍兼暟閲�--> + <select id="selectTotalPassCount" resultType="java.lang.Integer"> + SELECT sum(pass_count) FROM mdc_part_process_info WHERE equipment_id = #{equipmentId} AND the_date = #{validDate} + </select> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java index 4e1eb31..80807ff 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDowntimeService.java @@ -26,4 +26,13 @@ * @return */ IPage<MdcDowntimeDto> pageList(String userId, Page<MdcDowntimeDto> page, MdcDowntimeVo mdcDowntimeVo, HttpServletRequest req); + + /** + * 鏌ヨ鍋滄満鏃堕暱 + * @param equipmentId + * @param validDate + * @param closeType + * @return + */ + Integer findPlanTimeDuration(String equipmentId, String validDate, String closeType); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java index 51473ea..51d56e6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java @@ -17,4 +17,13 @@ * @param dateTime */ void runningAllEquipmentStatisticalProcess(String dateTime); + + /** + * 鏌ヨ璁惧杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectProcessLong(String equipmentId, String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPartProcessInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPartProcessInfoService.java new file mode 100644 index 0000000..ca744d1 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPartProcessInfoService.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.MdcPartProcessInfo; +import org.jeecg.modules.mdc.vo.MdcPartProcessInfoVo; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; + +/** + * @Description: 闆朵欢鍔犲伐鏁版嵁琛� + * @Author: lius + * @Date: 2024-12-11 + */ +public interface IMdcPartProcessInfoService extends IService<MdcPartProcessInfo> { + + /** + * 鍒嗛〉鏌ヨ + * + * @param userId + * @param page + * @param mdcPartProcessInfo + * @param req + * @return + */ + IPage<MdcPartProcessInfo> pageList(String userId, Page<MdcPartProcessInfo> page, MdcPartProcessInfoVo mdcPartProcessInfo, HttpServletRequest req); + + /** + * 娣诲姞 + * + * @param mdcPartProcessInfo + * @return + */ + boolean addPartProcess(MdcPartProcessInfoVo mdcPartProcessInfo); + + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcPartProcessInfo + * @return + */ + ModelAndView exportXls(String userId, MdcPartProcessInfoVo mdcPartProcessInfo); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ椂闂� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalProcessLong(String equipmentId, String validDate); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalProcessCount(String equipmentId, String validDate); + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ュ悎鏍兼暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + Integer selectTotalPassCount(String equipmentId, String validDate); +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java index 135181e..8826b16 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java @@ -9,6 +9,7 @@ import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper; import org.jeecg.modules.mdc.service.IMdcDowntimeService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcDowntimeVo; import org.springframework.stereotype.Service; @@ -55,6 +56,18 @@ return this.baseMapper.pageList(page, mdcDowntimeVo); } + @Override + public Integer findPlanTimeDuration(String equipmentId, String validDate, String closeType) { + int result = 0; + List<MdcDowntime> mdcDowntimeList = this.baseMapper.findPlanTimeDuration(equipmentId, validDate, closeType); + if (mdcDowntimeList != null && !mdcDowntimeList.isEmpty()) { + for (MdcDowntime mdcDowntime : mdcDowntimeList) { + result = DateUtils.differentMinutes(mdcDowntime.getStartDate(), mdcDowntime.getEndDate()) + result; + } + } + return result; + } + private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) { if (StringUtils.isNotEmpty(mdcDowntimeVo.getEquipmentId())) { return Collections.singletonList(mdcDowntimeVo.getEquipmentId()); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java index 5f89d3e..7bbf531 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java @@ -14,6 +14,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; /** @@ -299,4 +300,21 @@ } return equipmentStatisticalInfos; } + + /** + * 鏌ヨ璁惧杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public Integer selectProcessLong(String equipmentId, String validDate) { + Integer processLong = this.baseMapper.selectProcessLong(equipmentId, validDate); + if (processLong == null) { + return 0; + } else { + return Integer.parseInt(new BigDecimal(processLong).divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).toString()); + } + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java index 86f5b09..d166372 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java @@ -11,10 +11,7 @@ import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcOeeInfo; import org.jeecg.modules.mdc.mapper.MdcOeeInfoMapper; -import org.jeecg.modules.mdc.service.IMdcEquipmentService; -import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; -import org.jeecg.modules.mdc.service.IMdcOeeInfoService; -import org.jeecg.modules.mdc.service.IMdcPlanCloseService; +import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; import org.jeecg.modules.mdc.vo.MdcOeeComputeVo; import org.jeecg.modules.mdc.vo.MdcOeeInfoVo; @@ -46,10 +43,10 @@ private IMdcEquipmentService mdcEquipmentService; @Resource - private IMdcPlanCloseService mdcPlanCloseService; + private IMdcDowntimeService mdcDowntimeService; -// @Resource -// private IMdcPartProcessInfoService mdcPartProcessInfoService; + @Resource + private IMdcPartProcessInfoService mdcPartProcessInfoService; @Resource private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService; @@ -191,53 +188,53 @@ // 宸ヤ綔鏃ュ巻鏃堕棿(min) --- 鎸夋瘡澶�24灏忔椂绠� mdcOeeInfo.setCalendarLong(1440); // 璁″垝鍋滄満鏃堕棿(min) --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶╂�绘椂闀� -// Integer planCloseLong = mdcPlanCloseService.findPlanTimeDuration(equipmentId, validDate, CommonConstant.CLOSE_TYPE_1); -// mdcOeeInfo.setPlanCloseLong(planCloseLong); + Integer planCloseLong = mdcDowntimeService.findPlanTimeDuration(equipmentId, validDate, CommonConstant.CLOSE_TYPE_0); + mdcOeeInfo.setPlanCloseLong(planCloseLong); // 璐熻嵎鏃堕棿(min) --- 鏃ュ巻宸ヤ綔鏃堕棿-璁″垝鍋滄満鏃堕棿 -// Integer loadLong = mdcOeeInfo.getCalendarLong() - planCloseLong; -// mdcOeeInfo.setLoadLong(loadLong); + Integer loadLong = mdcOeeInfo.getCalendarLong() - planCloseLong; + mdcOeeInfo.setLoadLong(loadLong); // 闈炶鍒掑仠鏈烘椂闂�(min) --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶╂�绘椂闀� -// Integer noPlanCloseLong = mdcPlanCloseService.findPlanTimeDuration(equipmentId, validDate, CommonConstant.CLOSE_TYPE_2); -// mdcOeeInfo.setNoplanCloseLong(noPlanCloseLong); + Integer noPlanCloseLong = mdcDowntimeService.findPlanTimeDuration(equipmentId, validDate, CommonConstant.CLOSE_TYPE_1); + mdcOeeInfo.setNoplanCloseLong(noPlanCloseLong); // 寮�鍔ㄦ椂闂�(min) --- 璐熻嵎鏃堕棿-闈炶鍒掑仠鏈烘椂闂� -// int actuateLong = loadLong - noPlanCloseLong; -// mdcOeeInfo.setActuateLong(actuateLong); + int actuateLong = loadLong - noPlanCloseLong; + mdcOeeInfo.setActuateLong(actuateLong); // 鏃堕棿寮�鍔ㄧ巼 --- 寮�鍔ㄦ椂闂�/璐熻嵎鏃堕棿 -// BigDecimal timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); -// mdcOeeInfo.setTimeActuationRate(timeActuationRate); + BigDecimal timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); + mdcOeeInfo.setTimeActuationRate(timeActuationRate); // 鏈夋晥杩愯鏃堕棿 --- 鎸夐渶姹傜淮鎶ら浂浠跺姞宸ユ�绘椂闀縷|绯荤粺涓昏酱璐熻浇鏃堕棿 Integer effectiveRunLong = 0; -// Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate); -// if (totalProcessLong == 0) { -// //鏌ヨ璁惧杩愯鏃堕棿 -// effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", "")); -// } else { -// effectiveRunLong = totalProcessLong; -// } + Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate); + if (totalProcessLong == 0) { + //鏌ヨ璁惧杩愯鏃堕棿 + effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", "")); + } else { + effectiveRunLong = totalProcessLong; + } mdcOeeInfo.setEffectiveRunLong(effectiveRunLong); // 鎬ц兘寮�鍔ㄧ巼 --- 鏈夋晥杩愯鏃堕棿/寮�鍔ㄦ椂闂� BigDecimal performanceRate = BigDecimal.ZERO; -// if (effectiveRunLong != 0 && actuateLong != 0) { -// performanceRate = new BigDecimal(effectiveRunLong).divide(new BigDecimal(actuateLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); -// } + if (effectiveRunLong != 0 && actuateLong != 0) { + performanceRate = new BigDecimal(effectiveRunLong).divide(new BigDecimal(actuateLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); + } mdcOeeInfo.setPerformanceRate(performanceRate); // 鍔犲伐闆朵欢鏁伴噺 --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶� -// Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate); -// mdcOeeInfo.setProcessCount(processCount); + Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate); + mdcOeeInfo.setProcessCount(processCount); // 鍚堟牸闆朵欢鏁伴噺 --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶� -// Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate); -// mdcOeeInfo.setPassCount(passCount); + Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate); + mdcOeeInfo.setPassCount(passCount); // 鍚堟牸鐜� --- 鍚堟牸鏁�/鍔犲伐鏁� BigDecimal passRate = BigDecimal.ZERO; -// if (processCount != 0 && passCount != 0) { -// passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); -// } + if (processCount != 0 && passCount != 0) { + passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP); + } mdcOeeInfo.setPassRate(passRate); // OEE --- 鏃堕棿寮�鍔ㄧ巼 * 鎬ц兘寮�鍔ㄧ巼 * 涓�娆″悎鏍肩巼 BigDecimal oee = BigDecimal.ZERO; -// if (!timeActuationRate.equals(BigDecimal.ZERO) && !performanceRate.equals(BigDecimal.ZERO) && !passRate.equals(BigDecimal.ZERO)) { -// oee = timeActuationRate.multiply(performanceRate).multiply(passRate).divide(new BigDecimal("10000"), 4, RoundingMode.HALF_UP); -// } + if (!timeActuationRate.equals(BigDecimal.ZERO) && !performanceRate.equals(BigDecimal.ZERO) && !passRate.equals(BigDecimal.ZERO)) { + oee = timeActuationRate.multiply(performanceRate).multiply(passRate).divide(new BigDecimal("10000"), 4, RoundingMode.HALF_UP); + } mdcOeeInfo.setOee(oee); result.add(mdcOeeInfo); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPartProcessInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPartProcessInfoServiceImpl.java new file mode 100644 index 0000000..2d41fb1 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPartProcessInfoServiceImpl.java @@ -0,0 +1,204 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.entity.MdcPartProcessInfo; +import org.jeecg.modules.mdc.mapper.MdcPartProcessInfoMapper; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.service.IMdcPartProcessInfoService; +import org.jeecg.modules.mdc.vo.MdcPartProcessInfoVo; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * @Description: 闆朵欢鍔犲伐鏁版嵁琛� + * @Author: lius + * @Date: 2024-12-11 + */ +@Service +public class MdcPartProcessInfoServiceImpl extends ServiceImpl<MdcPartProcessInfoMapper, MdcPartProcessInfo> implements IMdcPartProcessInfoService { + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + /** + * 鍒嗛〉鏌ヨ + * + * @param userId + * @param page + * @param mdcPartProcessInfo + * @param req + * @return + */ + @Override + public IPage<MdcPartProcessInfo> pageList(String userId, Page<MdcPartProcessInfo> page, MdcPartProcessInfoVo mdcPartProcessInfo, HttpServletRequest req) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcPartProcessInfo.getParentId()) && StringUtils.isEmpty(mdcPartProcessInfo.getEquipmentId())) { + if ("2".equals(mdcPartProcessInfo.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPartProcessInfo.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPartProcessInfo.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcPartProcessInfo.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcPartProcessInfo.setEquipmentIdList(Collections.singletonList(mdcPartProcessInfo.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcPartProcessInfo.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (mdcPartProcessInfo.getEquipmentIdList() == null || mdcPartProcessInfo.getEquipmentIdList().isEmpty()) { + mdcPartProcessInfo.setEquipmentIdList(equipmentIds); + } + + if (mdcPartProcessInfo.getEquipmentIdList() == null || mdcPartProcessInfo.getEquipmentIdList().isEmpty()) { + return null; + } + return this.baseMapper.pageList(page, mdcPartProcessInfo); + } + + @Override + public boolean addPartProcess(MdcPartProcessInfoVo mdcPartProcessInfo) { + String[] equipmentIdList = mdcPartProcessInfo.getEquipmentIds().split(","); + List<MdcPartProcessInfo> partProcessInfoList = new ArrayList<>(); + for (String equipmentId : equipmentIdList) { + MdcPartProcessInfo mppi = new MdcPartProcessInfo(); + BeanUtils.copyProperties(mdcPartProcessInfo, mppi); + mppi.setEquipmentId(equipmentId); + partProcessInfoList.add(mppi); + } + this.saveBatch(partProcessInfoList); + return true; + } + + @Override + public ModelAndView exportXls(String userId, MdcPartProcessInfoVo mdcPartProcessInfo) { + LambdaQueryWrapper<MdcPartProcessInfo> queryWrapper = new LambdaQueryWrapper<>(); + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcPartProcessInfo.getParentId()) && StringUtils.isEmpty(mdcPartProcessInfo.getEquipmentId())) { + if ("2".equals(mdcPartProcessInfo.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcPartProcessInfo.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcPartProcessInfo.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcPartProcessInfo.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcPartProcessInfo.setEquipmentIdList(Collections.singletonList(mdcPartProcessInfo.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcPartProcessInfo.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (mdcPartProcessInfo.getEquipmentIdList() == null || mdcPartProcessInfo.getEquipmentIdList().isEmpty()) { + mdcPartProcessInfo.setEquipmentIdList(equipmentIds); + } + + if (mdcPartProcessInfo.getEquipmentIdList() == null || mdcPartProcessInfo.getEquipmentIdList().isEmpty()) { + return null; + } else { + queryWrapper.in(MdcPartProcessInfo::getEquipmentId, mdcPartProcessInfo.getEquipmentIdList()); + } + if (StringUtils.isNotEmpty(mdcPartProcessInfo.getEquipmentId())) { + queryWrapper.eq(MdcPartProcessInfo::getEquipmentId, mdcPartProcessInfo.getEquipmentId()); + } + if (StringUtils.isNotEmpty(mdcPartProcessInfo.getPartId())) { + queryWrapper.eq(MdcPartProcessInfo::getPartId, mdcPartProcessInfo.getPartId()); + } + if (StringUtils.isNotEmpty(mdcPartProcessInfo.getStartTime()) && StringUtils.isNotEmpty(mdcPartProcessInfo.getEndTime())) { + queryWrapper.between(MdcPartProcessInfo::getTheDate, mdcPartProcessInfo.getStartTime(), mdcPartProcessInfo.getEndTime()); + } + queryWrapper.orderByDesc(MdcPartProcessInfo::getTheDate).orderByDesc(MdcPartProcessInfo::getEquipmentId); + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<MdcPartProcessInfo> mdcPartProcessInfos = this.baseMapper.selectList(queryWrapper); + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "闆朵欢鍔犲伐鏁版嵁鍒楄〃"); + mv.addObject(NormalExcelConstants.CLASS, MdcPartProcessInfo.class); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("闆朵欢鍔犲伐鏁版嵁鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "闆朵欢鍔犲伐鏁版嵁")); + //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + mv.addObject(NormalExcelConstants.DATA_LIST, mdcPartProcessInfos); + return mv; + } + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ椂闂� + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public Integer selectTotalProcessLong(String equipmentId, String validDate) { + Integer totalProcessLong = this.baseMapper.selectTotalProcessLong(equipmentId, validDate); + if (totalProcessLong == null) { + return 0; + } else { + return totalProcessLong; + } + } + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ユ暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public Integer selectTotalProcessCount(String equipmentId, String validDate) { + Integer totalProcessCount = this.baseMapper.selectTotalProcessCount(equipmentId, validDate); + if (totalProcessCount == null) { + return 0; + } else { + return totalProcessCount; + } + } + + /** + * 鏌ヨ璁惧鏌愬ぉ鎬诲姞宸ュ悎鏍兼暟閲� + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public Integer selectTotalPassCount(String equipmentId, String validDate) { + Integer totalPassCount = this.baseMapper.selectTotalPassCount(equipmentId, validDate); + if (totalPassCount == null) { + return 0; + } else { + return totalPassCount; + } + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java index 75c7f8e..fafdbf7 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/DateUtils.java @@ -4,6 +4,7 @@ import io.swagger.models.auth.In; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -83,6 +84,13 @@ } /** + * @return 鑾峰彇涓や釜date鐨勬椂闂村樊锛岀粨鏋滀负鍒嗛挓 + */ + public static Integer differentMinutes(Date startDate, Date endDate) { + return new BigDecimal(endDate.getTime() - startDate.getTime()).divide(new BigDecimal("60000"), 0, RoundingMode.HALF_UP).intValue(); + } + + /** * @return 杩斿洖浼犲叆鏃堕棿鐨�0鐐�0鍒�0绉� */ public static Date getTodayZero(Date d) { diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPartProcessInfoVo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPartProcessInfoVo.java new file mode 100644 index 0000000..9992b3b --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcPartProcessInfoVo.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.mdc.vo; + +import lombok.Data; +import org.jeecg.modules.mdc.entity.MdcPartProcessInfo; + +import java.util.List; + +/** + * @author Lius + * @date 2024/12/11 15:47 + */ +@Data +public class MdcPartProcessInfoVo extends MdcPartProcessInfo { + private String startTime; + private String endTime; + private String parentId; + private String typeTree; + private List<String> equipmentIdList; + private String equipmentIds; +} -- Gitblit v1.9.3