From 094a9290c836827bc1f45fd3549e7cd2ea1e1e45 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期二, 07 十一月 2023 09:45:36 +0800 Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcNoplanCloseMapper.xml | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java | 18 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentStatisticalInfo.java | 62 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverallEquipmentEfficiencyService.java | 14 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPassRateMapper.xml | 22 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java | 39 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentRunningTrace.java | 60 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverallEquipmentEfficiencyMapper.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java | 33 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml | 35 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPassRateService.java | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentStatisticalInfoMapper.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java | 184 ++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java | 15 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml | 12 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java | 187 ++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java | 12 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java | 4 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java | 22 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentStatisticalInfoService.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java | 34 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java | 64 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java | 51 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentRunningTraceMapper.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java | 64 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcNoplanCloseService.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java | 10 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcNoplanCloseMapper.java | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentRunningTraceService.java | 11 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java | 94 ++- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentRunningTraceImpl.java | 15 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentRunningTraceMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverallEquipmentEfficiencyMapper.xml | 5 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java | 13 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java | 34 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java | 8 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java | 54 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPassRateMapper.java | 20 42 files changed, 1,233 insertions(+), 75 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java new file mode 100644 index 0000000..231bbd5 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/constant/MdcConstant.java @@ -0,0 +1,54 @@ +package org.jeecg.modules.mdc.constant; + +/** + * @author Lius + * @date 2023/11/1 16:05 + */ +public class MdcConstant { + + /** + * 鏁呴殰鍋滄満 + */ + public static final String BREAKDOWN_DOWN = "鏁呴殰鍋滄満"; + + /** + * 鎹㈠瀷璋冭瘯 + */ + public static final String CONVERSION_DEBUG = "鎹㈠瀷璋冭瘯"; + + /** + * 鐗╂枡鐭己 + */ + public static final String MATERIAL_SHORTAGE = "鐗╂枡鐭己"; + + /** + * 璁″垝绛変换鍔� + */ + public static final String PLANNED_TASK = "璁″垝绛変换鍔�"; + + /** + * 妫�楠� + */ + public static final String INSPECT = "妫�楠�"; + + /** + * 鍏跺畠 + */ + public static final String OTHER = "鍏跺畠"; + + /** + * 璁″垝淇濆吇 + */ + public static final String PLANNED_MAINTENANCE = "鏃ヤ繚,鍛ㄤ繚"; + + /** + * 浼氳鍩硅 + */ + public static final String CONFERENCE_TRAINING = "OPL鍩硅,鐝墠浼�"; + + /** + * 鍏朵粬浼戞伅 + */ + public static final String OTHER_REST = "浼戞伅鐢ㄩ,棰勯槻鎬х淮淇�"; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java index 15326dc..c50dffd 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentOvertimeController.java @@ -1,7 +1,7 @@ package org.jeecg.modules.mdc.controller; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.Api; @@ -11,7 +11,6 @@ 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.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; @@ -21,7 +20,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; /** * @Description: 璁惧鍔犵彮绠$悊 @@ -71,7 +72,18 @@ @ApiOperation(value = "璁惧鍔犵彮绠$悊-娣诲姞", notes = "璁惧鍔犵彮绠$悊-娣诲姞") @PostMapping(value = "/add") public Result<?> add(@RequestBody MdcEquipmentOvertime mdcEquipmentOvertime) { - mdcEquipmentOvertimeService.save(mdcEquipmentOvertime); + String[] calendarIdList = mdcEquipmentOvertime.getCalendarId().split(","); + List<MdcEquipmentOvertime> equipmentOvertimeList = new ArrayList<>(); + mdcEquipmentOvertimeService.remove(new LambdaQueryWrapper<MdcEquipmentOvertime>().in(MdcEquipmentOvertime::getCalendarId, Arrays.asList(calendarIdList))); + for (String calendarId : calendarIdList) { + MdcEquipmentOvertime equipmentOvertime = new MdcEquipmentOvertime(); + equipmentOvertime.setCalendarId(calendarId); + equipmentOvertime.setStartTime(mdcEquipmentOvertime.getStartTime()); + equipmentOvertime.setEndTime(mdcEquipmentOvertime.getEndTime()); + equipmentOvertime.setRemark(mdcEquipmentOvertime.getRemark()); + equipmentOvertimeList.add(equipmentOvertime); + } + mdcEquipmentOvertimeService.saveBatch(equipmentOvertimeList); return Result.OK("娣诲姞鎴愬姛锛�"); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentRunningTrace.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentRunningTrace.java new file mode 100644 index 0000000..619fa34 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentRunningTrace.java @@ -0,0 +1,60 @@ +package org.jeecg.modules.mdc.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author Lius + * @date 2023/10/24 10:39 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("EquipmentRunningTrace") +public class EquipmentRunningTrace implements Serializable { + + private static final long serialVersionUID = 2229764130687476736L; + + private Long sequence; + + /** + * 鎶ヨ + */ + private String alarm; + + @TableField(value = "createTime") + private Date createTime; + + private long duration; + + @TableField(value = "endTime") + private Date endTime; + + @TableField(value = "startTime") + private Date startTime; + + /** + * 鐘舵��,0:鍏虫満,1:寮�鏈�,2:寰呮満,3:宸ヤ綔,22:鎶ヨ + */ + private int status; + + /** + * 璁惧 + */ + private String equipment; + + private String beltline; + + /** + * 绋嬪簭鍙� + */ + @TableField(value = "Sequencenumber") + private String Sequencenumber; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentStatisticalInfo.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentStatisticalInfo.java new file mode 100644 index 0000000..272da6a --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/EquipmentStatisticalInfo.java @@ -0,0 +1,62 @@ +package org.jeecg.modules.mdc.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("EquipmentStatisticalInfo") +public class EquipmentStatisticalInfo implements Serializable { + /** + * 璁惧ID + */ + private String equipment; + /** + * 鐢熶骇绾� + */ + private String beltline; + /** + * 寮�鏈烘椂闀� + */ + @TableField(value = "openingLong") + private BigDecimal openingLong = new BigDecimal("0"); + /** + * 寰呮満鏃堕暱 + */ + @TableField(value = "waitingLong") + private BigDecimal waitingLong = new BigDecimal("0"); + /** + * 鍔犲伐鏃堕暱 + */ + @TableField(value = "processingLong") + private BigDecimal processingLong = new BigDecimal("0"); + /** + * 鎶ヨ + */ + @TableField(value = "erroringLong") + private BigDecimal erroringLong = new BigDecimal("0"); + /** + * 鍏虫満鏃堕暱 + */ + @TableField(value = "closedLong") + private BigDecimal closedLong = new BigDecimal("0"); + /** + * 鏃ユ湡 + */ + @TableField(value = "theDate") + private String theDate; + /** + * 鍚屾鏃堕棿 + */ + @TableField(value = "createTime") + private Date createTime = new Date(System.currentTimeMillis()); + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java new file mode 100644 index 0000000..3f82318 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcOverallEquipmentEfficiency.java @@ -0,0 +1,184 @@ +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; +import java.math.BigDecimal; + +/** + * @author Lius + * @date 2023/10/18 16:13 + */ +@Data +@TableName("mdc_overall_equipment_efficiency") +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value = "mdc_overall_equipment_efficiency瀵硅薄", description = "璁惧缁煎悎鏁堢巼OEE琛�") +public class MdcOverallEquipmentEfficiency extends JeecgEntity implements Serializable { + + private static final long serialVersionUID = 9185809666187247226L; + + /** + * 璁惧缂栧彿 + */ + @Excel(name = "璁惧缂栧彿", width = 15) + @ApiModelProperty(value = "璁惧缂栧彿") + private String equipmentId; + /** + * 璁惧鍚嶇О + */ + @Excel(name = "璁惧鍚嶇О", width = 15) + @ApiModelProperty(value = "璁惧鍚嶇О") + private String equipmentName; + /** + * 璁惧鍨嬪彿 + */ + @Excel(name = "璁惧鍨嬪彿", width = 15) + @ApiModelProperty(value = "璁惧鍨嬪彿") + private String equipmentModel; + /** + * 鏈夋晥鏃ユ湡 + */ + @Excel(name = "鏈夋晥鏃ユ湡", width = 15) + @ApiModelProperty(value = "鏈夋晥鏃ユ湡") + private String validDate; + /** + * 鐝id + */ + @ApiModelProperty(value = "鐝id") + private String shiftSubId; + /** + * 姣忕彮灏忔椂 + */ + @Excel(name = "姣忕彮灏忔椂", width = 15) + @ApiModelProperty(value = "姣忕彮灏忔椂") + private BigDecimal shiftTimeCount; + /** + * 鍔犵彮鏃堕棿 + */ + @Excel(name = "鍔犵彮鏃堕棿", width = 15) + @ApiModelProperty(value = "鍔犵彮鏃堕棿") + private BigDecimal overtime; + /** + * 瀹為檯鐝骇澶╂暟 + */ + @Excel(name = "瀹為檯鐝骇澶╂暟", width = 15) + @ApiModelProperty(value = "瀹為檯鐝骇澶╂暟") + private BigDecimal actualWorkDayCount; + /** + * 鏈堝害瀹為檯鐝骇鎬绘椂闂� + */ + @Excel(name = "鏈堝害瀹為檯鐝骇鎬绘椂闂�", width = 15) + @ApiModelProperty(value = "鏈堝害瀹為檯鐝骇鎬绘椂闂�") + private BigDecimal monthActualWorkDayTimeCount; + /** + * 鏁呴殰鍋滄満鏃堕暱(鍒嗛挓) + */ + @Excel(name = "鏁呴殰鍋滄満鏃堕暱", width = 15) + @ApiModelProperty(value = "鏁呴殰鍋滄満鏃堕暱(鍒嗛挓)") + private BigDecimal breakdownDownDuration; + /** + * 鎹㈠瀷璋冭瘯鏃堕暱(鍒嗛挓) + */ + @Excel(name = "鎹㈠瀷璋冭瘯鏃堕暱(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "鎹㈠瀷璋冭瘯鏃堕暱(鍒嗛挓)") + private BigDecimal conversionDebugDuration; + /** + * 鐗╂枡鐭己鏃堕暱(鍒嗛挓) + */ + @Excel(name = "鐗╂枡鐭己鏃堕暱(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "鐗╂枡鐭己鏃堕暱(鍒嗛挓)") + private BigDecimal materialShortageDuration; + /** + * 璁″垝绛変换鍔�(鍒嗛挓) + */ + @Excel(name = "璁″垝绛変换鍔�(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "璁″垝绛変换鍔�(鍒嗛挓)") + private BigDecimal plannedTaskDuration; + /** + * 妫�楠�(鍒嗛挓) + */ + @Excel(name = "妫�楠�(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "妫�楠�(鍒嗛挓)") + private BigDecimal inspectDuration; + /** + * 鍏朵粬(鍒嗛挓) + */ + @Excel(name = "鍏朵粬(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "鍏朵粬(鍒嗛挓)") + private BigDecimal otherDuration; + /** + * 璁″垝淇濆吇 + */ + @Excel(name = "璁″垝淇濆吇", width = 15) + @ApiModelProperty(value = "璁″垝淇濆吇") + private BigDecimal plannedMaintenanceDuration; + /** + * 浼氳鍩硅鏃堕暱 + */ + @Excel(name = "浼氳鍩硅鏃堕暱", width = 15) + @ApiModelProperty(value = "浼氳鍩硅鏃堕暱") + private BigDecimal conferenceTrainingDuration; + /** + * 鍏朵粬浼戞伅鏃堕暱 + */ + @Excel(name = "鍏朵粬浼戞伅鏃堕暱", width = 15) + @ApiModelProperty(value = "鍏朵粬浼戞伅鏃堕暱") + private BigDecimal otherRestDuration; + /** + * 璐熻嵎鏃堕棿 + */ + @Excel(name = "璐熻嵎鏃堕棿", width = 15) + @ApiModelProperty(value = "璐熻嵎鏃堕棿") + private BigDecimal loadTime; + /** + * 鏃堕棿寮�鍔ㄧ巼 + */ + @Excel(name = "鏃堕棿寮�鍔ㄧ巼", width = 15) + @ApiModelProperty(value = "鏃堕棿寮�鍔ㄧ巼") + private BigDecimal timeActuationRate; + /** + * 鍔犲伐闆朵欢鏁� + */ + @Excel(name = "鍔犲伐闆朵欢鏁�", width = 15) + @ApiModelProperty(value = "鍔犲伐闆朵欢鏁�") + private BigDecimal processQuantity; + /** + * 鏍囧噯鍔犲伐鏃堕棿(鍒嗛挓) + */ + @Excel(name = "鏍囧噯鍔犲伐鏃堕棿(鍒嗛挓)", width = 15) + @ApiModelProperty(value = "鏍囧噯鍔犲伐鏃堕棿(鍒嗛挓)") + private BigDecimal standardProcessDuration; + /** + * 鎬ц兘寮�鍔ㄧ巼 + */ + @Excel(name = "鎬ц兘寮�鍔ㄧ巼", width = 15) + @ApiModelProperty(value = "鎬ц兘寮�鍔ㄧ巼") + private BigDecimal performanceRate; + /** + * 搴熷搧鏁� + */ + @Excel(name = "搴熷搧鏁�", width = 15) + @ApiModelProperty(value = "搴熷搧鏁�") + private BigDecimal unqualifiedQuantity; + /** + * 鍚堟牸鐜� + */ + @Excel(name = "鍚堟牸鐜�", width = 15) + @ApiModelProperty(value = "鍚堟牸鐜�") + private BigDecimal passRate; + /** + * 璁惧缁煎悎鏁堢巼 + */ + @Excel(name = "璁惧缁煎悎鏁堢巼", width = 15) + @ApiModelProperty(value = "璁惧缁煎悎鏁堢巼") + private BigDecimal overallEquipmentEfficiency; + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java index 7a0e517..290f6f2 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java @@ -1,22 +1,20 @@ package org.jeecg.modules.mdc.entity; -import java.io.Serializable; -import java.util.Date; -import java.util.List; - import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import com.fasterxml.jackson.annotation.JsonFormat; import org.jeecg.common.system.base.entity.JeecgEntity; -import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; /** * @Description: 鍔犲伐鏁伴噺琛� diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java new file mode 100644 index 0000000..0186ee7 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/job/RunningOverallEquipmentEfficiencyJob.java @@ -0,0 +1,64 @@ +package org.jeecg.modules.mdc.job; + +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.mdc.service.IMdcOverallEquipmentEfficiencyService; +import org.jeecg.modules.mdc.util.ThrowableUtil; +import org.jeecg.modules.quartz.entity.QuartzJob; +import org.jeecg.modules.quartz.entity.SysQuartzLog; +import org.jeecg.modules.quartz.service.IQuartzJobService; +import org.jeecg.modules.quartz.service.ISysQuartzLogService; +import org.jeecg.modules.system.service.ISysAnnouncementService; +import org.quartz.*; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @Description: 瀹氭椂璁$畻璁惧缁煎悎鏁堢巼OEE浠诲姟 + * @author: LiuS + * @create: 2023-07-24 10:26 + */ +@PersistJobDataAfterExecution +@DisallowConcurrentExecution +@Slf4j +public class RunningOverallEquipmentEfficiencyJob implements Job { + + @Resource + private IQuartzJobService quartzJobService; + + @Resource + private ISysAnnouncementService sysAnnouncementService; + + @Resource + private ISysQuartzLogService sysQuartzLogService; + + @Resource + private IMdcOverallEquipmentEfficiencyService mdcOverallEquipmentEfficiencyService; + + @Override + public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + SysQuartzLog quartzLog = new SysQuartzLog(); + quartzLog.setCreateTime(new Date()); + List<QuartzJob> byJobClassName = this.quartzJobService.findByJobClassName(this.getClass().getName()); + if (byJobClassName != null && !byJobClassName.isEmpty()) { + quartzLog.setJobId(byJobClassName.get(0).getId()); + } + log.info("瀹氭椂璁$畻璁惧缁煎悎鏁堢巼OEE浠诲姟 RunningOverallEquipmentEfficiencyJob start! 鏃堕棿:" + DateUtils.now()); + long startTime = System.currentTimeMillis(); + try { + mdcOverallEquipmentEfficiencyService.runningOverallEquipmentEfficiency(); + quartzLog.setIsSuccess(0); + } catch (Exception e) { + quartzLog.setIsSuccess(-1); + quartzLog.setExceptionDetail(ThrowableUtil.getStackTrace(e)); + // 鍙戦�佹秷鎭�氱煡 + sysAnnouncementService.jobSendMessage("瀹氭椂缁熻娈垫椂闂翠换鍔�", quartzLog.getExceptionDetail()); + } + long endTime = System.currentTimeMillis(); + quartzLog.setExecutionTime(Integer.parseInt(String.valueOf(endTime - startTime))); + sysQuartzLogService.save(quartzLog); + } + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentRunningTraceMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentRunningTraceMapper.java new file mode 100644 index 0000000..c9fcee3 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentRunningTraceMapper.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; + +/** + * @author Lius + * @date 2023/10/26 16:46 + */ +public interface EquipmentRunningTraceMapper extends BaseMapper<EquipmentRunningTrace> { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentStatisticalInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentStatisticalInfoMapper.java new file mode 100644 index 0000000..330a18a --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentStatisticalInfoMapper.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; + +/** + * @author Lius + * @date 2023/10/24 14:05 + */ +public interface EquipmentStatisticalInfoMapper extends BaseMapper<EquipmentStatisticalInfo> { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java index 4c332a2..92246e7 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcDeviceCalendarMapper.java @@ -1,13 +1,12 @@ package org.jeecg.modules.mdc.mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; -import java.util.Date; import java.util.List; /** @@ -24,4 +23,9 @@ List<MdcDeviceCalendarVo> findAcquiesceShift(); + List<String> computeActualWorkDayCount(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); + + List<String> findShiftSort(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); + + Integer computeShiftTimeCount(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java index 14f3a7c..321ef29 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentOvertimeMapper.java @@ -28,9 +28,17 @@ /** * list鍒楄〃 + * * @param mdcEquipmentOvertime * @return */ List<MdcEquipmentOvertime> list(@Param("mdcEquipmentOvertime") MdcEquipmentOvertime mdcEquipmentOvertime); + /** + * 鏌ヨ鍔犵彮鏃堕暱 + * @param equipmentId + * @param validDate + * @return + */ + List<MdcEquipmentOvertime> computeOvertime(@Param("shiftSubId") String shiftSubId, @Param("equipmentId") String equipmentId, @Param("validDate") String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java index 8a3fc71..2723cde 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalShiftInfoMapper.java @@ -4,6 +4,8 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; +import java.math.BigDecimal; + /** * @author: LiuS * @create: 2023-07-24 11:23 @@ -17,4 +19,6 @@ * @return */ MdcEquipmentStatisticalShiftInfo getMaxStaticsData(@Param("equipmentId") String equipmentid); + + BigDecimal findSpindleRunDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate, @Param("shiftSubId") String shiftSubId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcNoplanCloseMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcNoplanCloseMapper.java index 22e9f2a..44be7ab 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcNoplanCloseMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcNoplanCloseMapper.java @@ -7,6 +7,8 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcNoplanClose; +import java.util.List; + /** * @Description: 闈炶鍒掑仠鏈虹淮鎶よ〃 * @Author: Lius @@ -24,5 +26,14 @@ */ IPage<MdcNoplanClose> pageList(Page<MdcNoplanClose> page, @Param("mdcNoplanClose") MdcNoplanClose mdcNoplanClose); - + /** + * 鏌ヨ闈炶鍒掑仠鏈虹鐞嗘崯澶� + * + * @param equipmentId + * @param noplanType + * @param startDate + * @param endDate + * @return + */ + List<MdcNoplanClose> findNoplanTimeDuration(@Param("equipmentId") String equipmentId, @Param("noplanType") String noplanType, @Param("startDate") String startDate, @Param("endDate") String endDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverallEquipmentEfficiencyMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverallEquipmentEfficiencyMapper.java new file mode 100644 index 0000000..ffc1042 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOverallEquipmentEfficiencyMapper.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mdc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; + +/** + * @author Lius + * @date 2023/11/3 14:29 + */ +public interface MdcOverallEquipmentEfficiencyMapper extends BaseMapper<MdcOverallEquipmentEfficiency> { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPassRateMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPassRateMapper.java index 0db11a4..5776b4e 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPassRateMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcPassRateMapper.java @@ -23,4 +23,24 @@ * @return */ IPage<MdcPassRate> pageList(Page<MdcPassRate> page, @Param("mdcPassRate") MdcPassRate mdcPassRate); + + /** + * 璁$畻鍔犲伐鏁伴噺 + * + * @param equipmentId + * @param startTime + * @param endTime + * @return + */ + Integer findProcessQuantity(@Param("equipmentId") String equipmentId, @Param("startTime") String startTime, @Param("endTime") String endTime); + + /** + * 璁$畻搴熷搧鏁伴噺 + * + * @param equipmentId + * @param startTime + * @param endTime + * @return + */ + Integer findUnqualifiedQuantity(@Param("equipmentId") String equipmentId, @Param("startTime") String startTime, @Param("endTime") String endTime); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentRunningTraceMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentRunningTraceMapper.xml new file mode 100644 index 0000000..520d8bd --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentRunningTraceMapper.xml @@ -0,0 +1,5 @@ +<?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.EquipmentRunningTraceMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml new file mode 100644 index 0000000..50e63d3 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml @@ -0,0 +1,5 @@ +<?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.EquipmentStatisticalInfoMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml index 2528e52..6131c89 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcDeviceCalendarMapper.xml @@ -84,4 +84,39 @@ WHERE t1.default_shift = 'true' </select> + <!--璁$畻瀹為檯鐝骇澶╂暟--> + <select id="computeActualWorkDayCount" resultType="java.lang.String"> + SELECT DISTINCT + effective_date + FROM + mdc_device_calendar + WHERE + effective_date LIKE CONCAT(#{ validDate }, '%') + AND equipment_id = #{ equipmentId } + AND shift_sub_id = #{ shiftSubId } + </select> + + <!--鏌ヨ鐝鍒嗙被--> + <select id="findShiftSort" resultType="java.lang.String"> + SELECT + DISTINCT shift_sub_id + FROM + mdc_device_calendar + WHERE + effective_date LIKE CONCAT(#{ validDate }, '%') + AND equipment_id = #{ equipmentId } + </select> + + <!--鏌ヨ鐝鏁伴噺--> + <select id="computeShiftTimeCount" resultType="java.lang.Integer"> + SELECT + COUNT(*) + FROM + mdc_device_calendar + WHERE + effective_date LIKE CONCAT(#{ validDate }, '%') + AND equipment_id = #{ equipmentId } + AND shift_sub_id = #{ shiftSubId } + </select> + </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml index 65a66dd..686c7f3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentOvertimeMapper.xml @@ -77,4 +77,17 @@ </where> order by t2.effective_date asc </select> + + <!--鏌ヨ鍔犵彮鏃堕暱--> + <select id="computeOvertime" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentOvertime"> + SELECT + meo.* + FROM + mdc_equipment_overtime meo + LEFT JOIN mdc_device_calendar mdc ON meo.calendar_id = mdc.id + WHERE + mdc.effective_date LIKE CONCAT(#{ validDate }, '%') + AND mdc.equipment_id = #{ equipmentId } + AND mdc.shift_sub_id = #{ shiftSubId } + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml index 4168205..f016ab5 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalShiftInfoMapper.xml @@ -6,4 +6,16 @@ <select id="getMaxStaticsData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo"> SELECT TOP 1 * FROM mdc_equipment_statistical_shift_info WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC </select> + + <!--鏌ヨ涓昏酱杩愯鏃堕棿--> + <select id="findSpindleRunDuration" resultType="java.math.BigDecimal"> + SELECT + SUM(process_long) + FROM + mdc_equipment_statistical_shift_info + WHERE + equipment_id = #{ equipmentId } + AND shift_sub_id = #{ shiftSubId } + AND the_date LIKE CONCAT(#{ validDate },'%') + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcNoplanCloseMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcNoplanCloseMapper.xml index 2a4548c..bfcf755 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcNoplanCloseMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcNoplanCloseMapper.xml @@ -30,4 +30,18 @@ </where> ORDER BY start_time ASC </select> + + + <select id="findNoplanTimeDuration" resultType="org.jeecg.modules.mdc.entity.MdcNoplanClose"> + SELECT + * + FROM + mdc_noplan_close + WHERE + equipment_id = #{ equipmentId } + AND ( ( start_time BETWEEN #{ startDate } AND #{ endDate } ) OR ( end_time BETWEEN #{ startDate } AND #{ endDate } ) ) + AND noplan_type = #{ noplanType } + ORDER BY + start_time ASC + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverallEquipmentEfficiencyMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverallEquipmentEfficiencyMapper.xml new file mode 100644 index 0000000..6e4a36c --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOverallEquipmentEfficiencyMapper.xml @@ -0,0 +1,5 @@ +<?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.MdcOverallEquipmentEfficiencyMapper"> + +</mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPassRateMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPassRateMapper.xml index 0883a6f..b3f063a 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPassRateMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcPassRateMapper.xml @@ -24,4 +24,26 @@ </where> ORDER BY equipment_name ASC, efficient_date DESC </select> + + <!--璁$畻鍔犲伐鏁伴噺--> + <select id="findProcessQuantity" resultType="java.lang.Integer"> + SELECT + SUM( process_quantity ) + FROM + mdc_pass_rate + WHERE + equipment_id = #{ equipmentId } + AND efficient_date BETWEEN #{ startTime } AND #{endTime} + </select> + + <!--璁$畻搴熷搧鏁伴噺--> + <select id="findUnqualifiedQuantity" resultType="java.lang.Integer"> + SELECT + SUM( unqualified_quantity ) + FROM + mdc_pass_rate + WHERE + equipment_id = #{ equipmentId } + AND efficient_date BETWEEN #{ startTime } AND #{endTime} + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentRunningTraceService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentRunningTraceService.java new file mode 100644 index 0000000..aa8d369 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentRunningTraceService.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; + +/** + * @author Lius + * @date 2023/10/26 16:45 + */ +public interface IEquipmentRunningTraceService extends IService<EquipmentRunningTrace> { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentStatisticalInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentStatisticalInfoService.java new file mode 100644 index 0000000..9e236d0 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IEquipmentStatisticalInfoService.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mdc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; + +/** + * @author Lius + * @date 2023/10/24 14:04 + */ +public interface IEquipmentStatisticalInfoService extends IService<EquipmentStatisticalInfo> { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java index 659ea8d..a8a00ee 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDeviceCalendarService.java @@ -1,14 +1,14 @@ package org.jeecg.modules.mdc.service; import com.baomidou.mybatisplus.core.metadata.IPage; -import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.entity.MdcDeviceCalendar; import org.jeecg.modules.mdc.vo.EquipmentCalendarVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarQueryVo; import org.jeecg.modules.mdc.vo.MdcDeviceCalendarVo; import javax.servlet.http.HttpServletRequest; -import java.util.Date; +import java.math.BigDecimal; import java.util.List; /** @@ -37,4 +37,33 @@ * @return */ List<MdcDeviceCalendarVo> listByEquipmentAndDate(String equipmentid, List<String> stringDates); + + /** + * 璁$畻瀹為檯鐝骇澶╂暟 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + BigDecimal computeActualWorkDayCount(String shiftSubId, String equipmentId, String validDate); + + /** + * 鏌ヨ鐝鍒嗙被 + * + * @param equipmentId + * @param validDate + * @return + */ + List<String> findShiftSort(String equipmentId, String validDate); + + /** + * 璁$畻鐝鏃堕棿 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java index 6282eac..f8991b6 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentOvertimeService.java @@ -8,6 +8,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; /** * @Description: 璁惧鍔犵彮绠$悊 @@ -37,4 +38,13 @@ */ ModelAndView exportXls(String userId, MdcEquipmentOvertime mdcEquipmentOvertime); + /** + * 璁$畻鍔犵彮鏃堕棿 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + BigDecimal computeOvertime(String shiftSubId, String equipmentId, String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java index 1a5a86e..c3048e1 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalShiftInfoService.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalShiftInfo; +import java.math.BigDecimal; + /** * @Description: 璁惧鍗曟棩鐝杩愯鏁版嵁琛� * @author: LiuS @@ -16,4 +18,15 @@ * @param dateTime */ void runningAllEquipmentShiftStatisticalProcess(String dateTime); + + /** + * 鏌ヨ涓昏酱杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @param shiftSubId + * @return + */ + BigDecimal findSpindleRunDuration(String equipmentId, String validDate, String shiftSubId); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcNoplanCloseService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcNoplanCloseService.java index 6026075..5a60998 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcNoplanCloseService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcNoplanCloseService.java @@ -9,6 +9,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; /** * @Description: 闈炶鍒掑仠鏈虹淮鎶よ〃 @@ -53,4 +54,6 @@ * @return */ ModelAndView exportXls(String userId, MdcNoplanClose mdcNoplanClose); + + BigDecimal findNoplanTimeDuration(String equipmentId, String validDate, String noplanType); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverallEquipmentEfficiencyService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverallEquipmentEfficiencyService.java new file mode 100644 index 0000000..2f9385e --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOverallEquipmentEfficiencyService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mdc.service; + +/** + * @author: LiuS + * @create: 2023-10-18 09:25 + */ +public interface IMdcOverallEquipmentEfficiencyService { + + /** + * 璁$畻璁惧缁煎悎鏁堢巼OEE + */ + void runningOverallEquipmentEfficiency(); + +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPassRateService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPassRateService.java index 334a27b..0420255 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPassRateService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcPassRateService.java @@ -8,6 +8,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; /** * @Description: 鍚堟牸鐜囪〃 @@ -52,4 +53,8 @@ * @return */ ModelAndView exportXls(String userId, MdcPassRate mdcPassRate); + + BigDecimal findProcessQuantity(String equipmentId, String validDate); + + BigDecimal findUnqualifiedQuantity(String equipmentId, String validDate); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentRunningTraceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentRunningTraceImpl.java new file mode 100644 index 0000000..a53e8c3 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentRunningTraceImpl.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.entity.EquipmentRunningTrace; +import org.jeecg.modules.mdc.mapper.EquipmentRunningTraceMapper; +import org.jeecg.modules.mdc.service.IEquipmentRunningTraceService; +import org.springframework.stereotype.Service; + +/** + * @author Lius + * @date 2023/10/26 16:45 + */ +@Service +public class EquipmentRunningTraceImpl extends ServiceImpl<EquipmentRunningTraceMapper, EquipmentRunningTrace> implements IEquipmentRunningTraceService { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java new file mode 100644 index 0000000..5a350c8 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentStatisticalInfoServiceImpl.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.entity.EquipmentStatisticalInfo; +import org.jeecg.modules.mdc.mapper.EquipmentStatisticalInfoMapper; +import org.jeecg.modules.mdc.service.IEquipmentStatisticalInfoService; +import org.springframework.stereotype.Service; + +/** + * @author Lius + * @date 2023/10/24 14:04 + */ +@Service +public class EquipmentStatisticalInfoServiceImpl extends ServiceImpl<EquipmentStatisticalInfoMapper, EquipmentStatisticalInfo> implements IEquipmentStatisticalInfoService { +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java index db49109..5d3eec2 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDeviceCalendarServiceImpl.java @@ -19,7 +19,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; -import java.util.*; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** * @Description: 璁惧宸ヤ綔鏃ュ巻琛� @@ -110,20 +113,21 @@ List<MdcDeviceCalendarVo> result = new ArrayList<>(); try { //鏌ヨ榛樿鐝埗 - List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); +// List<MdcDeviceCalendarVo> acquiesceShift = this.baseMapper.findAcquiesceShift(); for (String stringDate : stringDates) { List<MdcDeviceCalendarVo> mdcDeviceCalendarVos = this.baseMapper.listByEquipmentAndDate(equipmentId, stringDate); if (mdcDeviceCalendarVos != null && !mdcDeviceCalendarVos.isEmpty()) { result.addAll(mdcDeviceCalendarVos); - } else { - acquiesceShift.forEach(mdcDeviceCalendarVo -> { - mdcDeviceCalendarVo.setEquipmentId(equipmentId); - mdcDeviceCalendarVo.setEffectiveDate(stringDate); - }); - // 璁剧疆榛樿鐝埗 - result.addAll(acquiesceShift); } +// else { +// acquiesceShift.forEach(mdcDeviceCalendarVo -> { +// mdcDeviceCalendarVo.setEquipmentId(equipmentId); +// mdcDeviceCalendarVo.setEffectiveDate(stringDate); +// }); +// // 璁剧疆榛樿鐝埗 +// result.addAll(acquiesceShift); +// } } } catch (Exception e) { e.printStackTrace(); @@ -132,4 +136,46 @@ return result; } + /** + * 璁$畻瀹為檯鐝骇澶╂暟 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + @Override + public BigDecimal computeActualWorkDayCount(String shiftSubId, String equipmentId, String validDate) { + validDate = validDate.replaceAll("-", ""); + List<String> validDateList = this.baseMapper.computeActualWorkDayCount(shiftSubId, equipmentId, validDate); + return new BigDecimal(validDateList.size()); + } + + /** + * 鏌ヨ鐝鍒嗙被 + * + * @param equipmentId + * @param validDate + * @return + */ + @Override + public List<String> findShiftSort(String equipmentId, String validDate) { + validDate = validDate.replaceAll("-", ""); + return this.baseMapper.findShiftSort(equipmentId, validDate); + } + + /** + * 璁$畻鐝鏃堕棿 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + @Override + public BigDecimal computeShiftTimeCount(String shiftSubId, String equipmentId, String validDate) { + Integer shiftCount = this.baseMapper.computeShiftTimeCount(shiftSubId, equipmentId, validDate); + return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java index 07d569a..b5a1eb8 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentOvertimeServiceImpl.java @@ -8,10 +8,10 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipmentOvertime; -import org.jeecg.modules.mdc.entity.MdcNoplanClose; import org.jeecg.modules.mdc.mapper.MdcEquipmentOvertimeMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentOvertimeService; import org.jeecg.modules.mdc.service.IMdcEquipmentService; +import org.jeecg.modules.mdc.util.DateUtils; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; @@ -20,6 +20,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -119,9 +123,35 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犵彮绠$悊鍒楄〃鏁版嵁", "瀵煎嚭浜�:"+user.getRealname(), "鍔犵彮绠$悊")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犵彮绠$悊鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "鍔犵彮绠$悊")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcEquipmentOvertimes); return mv; } + + /** + * 璁$畻鍔犵彮鏃堕棿锛堝垎閽燂級 + * + * @param shiftSubId + * @param equipmentId + * @param validDate + * @return + */ + @Override + public BigDecimal computeOvertime(String shiftSubId, String equipmentId, String validDate) { + List<MdcEquipmentOvertime> list = this.baseMapper.computeOvertime(shiftSubId, equipmentId, validDate); + BigDecimal result = new BigDecimal("0"); + if (list != null && !list.isEmpty()) { + for (MdcEquipmentOvertime equipmentOvertime : list) { + String date = DateUtils.format(DateUtils.toDate(validDate + "-01", DateUtils.STR_DATE), DateUtils.STR_DATE) + " "; + String startTime = date + equipmentOvertime.getStartTime(); + String endTime = date + equipmentOvertime.getEndTime(); + LocalDateTime localStartTime = LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL)); + LocalDateTime localEndTime = LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern(DateUtils.STR_DATE_TIME_SMALL)); + int minutes = Math.toIntExact(Duration.between(localStartTime, localEndTime).toMinutes()); + result = result.add(new BigDecimal(minutes)); + } + } + return result; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java index 2fa8719..c155000 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; +import org.jeecg.common.system.vo.DictModel; import org.jeecg.modules.mdc.dto.EquipmentMachingDto; import org.jeecg.modules.mdc.dto.MdcEquipmentRunningSectionDto; import org.jeecg.modules.mdc.entity.*; @@ -12,6 +13,7 @@ import org.jeecg.modules.mdc.util.TimeFieldUtils; import org.jeecg.modules.mdc.vo.MdcAlarmAnalyzeQueryVo; import org.jeecg.modules.mdc.vo.MdcEquipmentRunningSectionVo; +import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -39,6 +41,12 @@ @Resource private IEquipmentWorkLineService equipmentWorkLineService; + + @Resource + private ISysDictService sysDictService; + + @Resource + private IEquipmentRunningTraceService equipmentRunningTraceService; @Override public List<MdcEquipmentRunningSectionDto> logList(MdcEquipmentRunningSectionVo equipmentRunningSectionVo) { @@ -483,10 +491,53 @@ //save errorList super.saveBatch(errorList); } + List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); + if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { + this.dataSynchronizationHandler(list, errorList); + } } } /** + * 鏁版嵁鍚屾澶勭悊 + * @param list + * @param errorList + */ + private void dataSynchronizationHandler(List<MdcEquipmentRunningSection> list, List<MdcEquipmentRunningSection> errorList) { + // 鏁版嵁杞崲 + List<EquipmentRunningTrace> equipList = new ArrayList<>(); + if (list != null && !list.isEmpty()) { + list.forEach(item -> { + EquipmentRunningTrace equipmentRunningSection = new EquipmentRunningTrace(); + equipmentRunningSection.setEquipment(item.getEquipmentId()); + equipmentRunningSection.setAlarm(item.getAlarm()); + equipmentRunningSection.setCreateTime(item.getCreateTime()); + equipmentRunningSection.setDuration(item.getDuration()); + equipmentRunningSection.setEndTime(item.getEndTime()); + equipmentRunningSection.setStartTime(item.getStartTime()); + equipmentRunningSection.setStatus(item.getStatus()); + equipmentRunningSection.setSequencenumber(item.getSequenceNumber()); + equipList.add(equipmentRunningSection); + }); + } + if (errorList != null && !errorList.isEmpty()) { + errorList.forEach(item -> { + EquipmentRunningTrace equipmentRunningSection = new EquipmentRunningTrace(); + equipmentRunningSection.setEquipment(item.getEquipmentId()); + equipmentRunningSection.setAlarm(item.getAlarm()); + equipmentRunningSection.setCreateTime(item.getCreateTime()); + equipmentRunningSection.setDuration(item.getDuration()); + equipmentRunningSection.setEndTime(item.getEndTime()); + equipmentRunningSection.setStartTime(item.getStartTime()); + equipmentRunningSection.setStatus(item.getStatus()); + equipmentRunningSection.setSequencenumber(item.getSequenceNumber()); + equipList.add(equipmentRunningSection); + }); + } + equipmentRunningTraceService.saveBatch(equipList); + } + + /** * 鑾峰彇璁惧杩愯璁板綍鏈�鏃╃殑鏁版嵁 */ @Override 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 7d337b3..5f89d3e 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 @@ -3,16 +3,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang.StringUtils; -import org.jeecg.modules.mdc.entity.Equipment; -import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection; -import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; -import org.jeecg.modules.mdc.entity.MdcSystemParameters; +import org.jeecg.common.system.vo.DictModel; +import org.jeecg.modules.mdc.entity.*; import org.jeecg.modules.mdc.mapper.MdcEquipmentStatisticalInfoMapper; -import org.jeecg.modules.mdc.service.IEquipmentService; -import org.jeecg.modules.mdc.service.IMdcEquipmentRunningSectionService; -import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; -import org.jeecg.modules.mdc.service.IMdcSystemParametersService; +import org.jeecg.modules.mdc.service.*; import org.jeecg.modules.mdc.util.DateUtils; +import org.jeecg.modules.system.service.ISysDictService; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -37,6 +33,12 @@ @Resource private IMdcSystemParametersService mdcSystemParametersService; + + @Resource + private ISysDictService sysDictService; + + @Resource + private IEquipmentStatisticalInfoService equipmentStatisticalInfoService; /** * 璁$畻璁惧鍗曟棩杩愯鏁版嵁 @@ -65,9 +67,30 @@ } if (!result.isEmpty()) { this.saveBatch(result); + List<DictModel> dictList = sysDictService.queryDictItemsByCode("data_synchronization_flag"); + if (dictList != null && !dictList.isEmpty() && "0".equals(dictList.get(0).getValue())) { + List<EquipmentStatisticalInfo> list = this.dataHandle(result); + equipmentStatisticalInfoService.saveBatch(list); + } } } + private List<EquipmentStatisticalInfo> dataHandle(List<MdcEquipmentStatisticalInfo> list) { + List<EquipmentStatisticalInfo> result = new ArrayList<>(); + list.forEach(item -> { + EquipmentStatisticalInfo equipmentStatisticalInfo = new EquipmentStatisticalInfo(); + equipmentStatisticalInfo.setEquipment(item.getEquipmentId()); + equipmentStatisticalInfo.setTheDate(item.getTheDate()); + equipmentStatisticalInfo.setClosedLong(item.getCloseLong()); + equipmentStatisticalInfo.setOpeningLong(item.getOpenLong()); + equipmentStatisticalInfo.setErroringLong(item.getErrorLong()); + equipmentStatisticalInfo.setProcessingLong(item.getProcessLong()); + equipmentStatisticalInfo.setWaitingLong(item.getWaitLong()); + result.add(equipmentStatisticalInfo); + }); + return result; + } + private List<MdcEquipmentStatisticalInfo> equipmentStatisticalProcess(Equipment equipment, String dateTime) { Date initDate = null; //鍙栨渶鍚庣殑缁熻鏁版嵁 diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java index ac902e9..a24c990 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalShiftInfoServiceImpl.java @@ -18,6 +18,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; +import java.math.RoundingMode; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; @@ -71,6 +72,25 @@ } if (!result.isEmpty()) { this.saveBatch(result); + } + } + + /** + * 鏌ヨ涓昏酱杩愯鏃堕棿 + * + * @param equipmentId + * @param validDate + * @param shiftSubId + * @return + */ + @Override + public BigDecimal findSpindleRunDuration(String equipmentId, String validDate, String shiftSubId) { + validDate = validDate.replaceAll("-", ""); + BigDecimal duration = this.baseMapper.findSpindleRunDuration(equipmentId, validDate, shiftSubId); + if (duration != null && duration.compareTo(BigDecimal.ZERO) != 0) { + return duration.divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP); + } else { + return new BigDecimal("0"); } } @@ -173,10 +193,10 @@ MdcEquipmentStatisticalShiftInfo shiftInfo = mdcRateEquipment(equipmentid, dates.getStartDate(), dates.getEndDate()); return shiftInfo; } else { - if (repairList.size() == 1 ) { + if (repairList.size() == 1) { long start = repairList.get(0).getStartTime().getTime(); long end = repairList.get(0).getEndTime().getTime(); - if ( start > dates.getStart() && end < dates.getEnd() ) { + if (start > dates.getStart() && end < dates.getEnd()) { MdcDateVo d1 = new MdcDateVo(); d1.setStartTime(dates.getStartDate()); d1.setEndTime(repairList.get(0).getStartTime()); @@ -185,7 +205,7 @@ d2.setStartTime(repairList.get(0).getEndTime()); d2.setEndTime(dates.getEndDate()); dateList.add(d2); - } else if (start == dates.getStart() && end < dates.getEnd()){ + } else if (start == dates.getStart() && end < dates.getEnd()) { MdcDateVo d2 = new MdcDateVo(); d2.setStartTime(repairList.get(0).getEndTime()); d2.setEndTime(dates.getEndDate()); @@ -208,11 +228,11 @@ } } else { long s = dates.getStartDate().getTime(); - for (int i = 0 ; i < repairList.size(); i ++) { + for (int i = 0; i < repairList.size(); i++) { long start = repairList.get(i).getStartTime().getTime(); long end = repairList.get(i).getEndTime().getTime(); - if (start > s ) { + if (start > s) { MdcDateVo d = new MdcDateVo(); d.setStartTime(dates.getStartDate()); d.setEndTime(repairList.get(i).getStartTime()); @@ -223,8 +243,8 @@ } else if (start == s) { dates.setStartDate(repairList.get(i).getEndTime()); } - if(i == repairList.size() -1 ) { - if(dates.getStartDate().getTime() >= end) { + if (i == repairList.size() - 1) { + if (dates.getStartDate().getTime() >= end) { MdcDateVo d = new MdcDateVo(); d.setStartTime(repairList.get(i).getEndTime()); d.setEndTime(dates.getEndDate()); @@ -259,7 +279,7 @@ if (runningSections == null || runningSections.isEmpty()) { runningSections = mdcEquipmentRunningSectionService.listRunningSectionFromLog(equipmentid, startDate.getTime(), endDate.getTime()); } - if(runningSections == null || runningSections.isEmpty()) { + if (runningSections == null || runningSections.isEmpty()) { runningSections = new ArrayList<>(); } List<MdcEquipmentRunningSection> sectionErrors = mdcEquipmentRunningSectionService.listEquipmentRunningSectionError(equipmentid, startDate.getTime(), endDate.getTime()); @@ -299,7 +319,7 @@ /*鏁呴殰鏃堕棿 errs => 鍏虫満鏁版嵁 + 鎶ヨ鏁版嵁 */ BigDecimal faultLong = new BigDecimal("0"); - faultLong = faultLongInfo(errs); + faultLong = faultLongInfo(errs); //鎶ヨ鏁版嵁 List<MdcEquipmentRunningSection> alarms = errs.stream().filter(section -> section.getStatus() == 22).collect(Collectors.toList()); @@ -381,75 +401,75 @@ //TODO return null; } - Long startMdc = mdcDate.getStartTime().getTime(); - Long endMdc = mdcDate.getEndTime().getTime(); + Long startMdc = mdcDate.getStartTime().getTime(); + Long endMdc = mdcDate.getEndTime().getTime(); if (sRun != null && !sRun.isEmpty()) { - for (int i = 0 ; i < sRun.size() ; i ++) { + for (int i = 0; i < sRun.size(); i++) { Long start = sRun.get(i).getStartTime().getTime(); - Long end = sRun.get(i).getEndTime().getTime(); - if (startMdc <= start ) { - sRun.get(i).setStartTime( sRun.get(i).getStartTime()); + Long end = sRun.get(i).getEndTime().getTime(); + if (startMdc <= start) { + sRun.get(i).setStartTime(sRun.get(i).getStartTime()); } else { sRun.get(i).setStartTime(mdcDate.getStartTime()); } if (endMdc >= end) { - sRun.get(i).setEndTime( sRun.get(i).getEndTime()); + sRun.get(i).setEndTime(sRun.get(i).getEndTime()); } else { sRun.get(i).setEndTime(mdcDate.getEndTime()); } - Long sen = DateUtils.differentSecond( sRun.get(i).getStartTime(), + Long sen = DateUtils.differentSecond(sRun.get(i).getStartTime(), sRun.get(i).getEndTime()); if (sen <= 0) { sRun.remove(i); i--; } else { sRun.get(i).setDuration(sen); - sRun.get(i).setStartLong( sRun.get(i).getStartTime().getTime()); - sRun.get(i).setEndLong( sRun.get(i).getEndTime().getTime()); + sRun.get(i).setStartLong(sRun.get(i).getStartTime().getTime()); + sRun.get(i).setEndLong(sRun.get(i).getEndTime().getTime()); } } } //閮ㄥ垎鏁版嵁鏄淮淇� 1銆佽繍琛岀姸鎬佷笅鎶ヨ鎯呭喌 List<MdcEquipmentRunningSection> faultRun = new ArrayList<>(); //鍒跺害鏃堕棿娈靛唴鎶ヨ鏁版嵁 - if (errors != null && !errors.isEmpty() ) { - for (int i = 0 ; i < errors.size() ; i ++) { + if (errors != null && !errors.isEmpty()) { + for (int i = 0; i < errors.size(); i++) { Long start = errors.get(i).getStartTime().getTime(); - Long end = errors.get(i).getEndTime().getTime(); - if (startMdc <= start ) { - errors.get(i).setStartTime( errors.get(i).getStartTime()); + Long end = errors.get(i).getEndTime().getTime(); + if (startMdc <= start) { + errors.get(i).setStartTime(errors.get(i).getStartTime()); } else { errors.get(i).setStartTime(mdcDate.getStartTime()); } if (endMdc >= end) { - errors.get(i).setEndTime( errors.get(i).getEndTime()); + errors.get(i).setEndTime(errors.get(i).getEndTime()); } else { errors.get(i).setEndTime(mdcDate.getEndTime()); } - Long sen = DateUtils.differentSecond( errors.get(i).getStartTime(), + Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), errors.get(i).getEndTime()); if (sen <= 0) { errors.remove(i); i--; } else { errors.get(i).setDuration(sen); - errors.get(i).setStartLong( errors.get(i).getStartTime().getTime()); - errors.get(i).setEndLong( errors.get(i).getEndTime().getTime()); + errors.get(i).setStartLong(errors.get(i).getStartTime().getTime()); + errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); } } //鎶婅繍琛屼腑瀛樺湪鐨勬姤璀﹀墧闄ゆ帀 for (MdcEquipmentRunningSection se : sRun) { long runStart = se.getStartTime().getTime(); - long runEnd = se.getEndTime().getTime(); + long runEnd = se.getEndTime().getTime(); if (se.getStatus() == 3) { - if (errors != null && !errors.isEmpty() ) { + if (errors != null && !errors.isEmpty()) { //澶勭悊鎶ヨ鏁版嵁 - for (int i = 0 ; i < errors.size(); i ++ ) { + for (int i = 0; i < errors.size(); i++) { long errStart = errors.get(i).getStartTime().getTime(); long errEnd = errors.get(i).getEndTime().getTime(); // 鎶ヨ寮�濮� 灏忎簬 杩愯寮�濮� 鎶ヨ缁撴潫 灏忎簬杩愯缁撴潫 鎶ヨ缁撴潫 澶т簬 杩愯寮�濮� - if ( errStart < runStart && errEnd <= runEnd && errEnd > runStart ) { + if (errStart < runStart && errEnd <= runEnd && errEnd > runStart) { errors.get(i).setEndTime(se.getStartTime()); Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), errors.get(i).getEndTime()); @@ -458,7 +478,7 @@ errors.get(i).setEndLong(errors.get(i).getEndTime().getTime()); } // 鎶ヨ寮�濮� 澶т簬 杩愯寮�濮� 锛� 鎶ヨ寮�濮� 灏忎簬 杩愯缁撴潫 锛屾姤璀︾粨鏉� 澶т簬 杩愯缁撴潫 - else if (errStart >= runStart && errStart < runEnd && errEnd > runEnd ) { + else if (errStart >= runStart && errStart < runEnd && errEnd > runEnd) { errors.get(i).setStartTime(se.getEndTime()); Long sen = DateUtils.differentSecond(errors.get(i).getStartTime(), errors.get(i).getEndTime()); @@ -468,13 +488,13 @@ } // 鎶ヨ寮�濮� 澶т簬 杩愯寮�濮� 锛� 鎶ヨ寮�濮� 灏忎簬 杩愯缁撴潫 锛屾姤璀︾粨鏉� 澶т簬 杩愯寮�濮嬶紝鎶ヨ缁撴潫 灏忎簬 杩愯缁撴潫 else if (errStart >= runStart && errStart < runEnd && - errEnd > runStart && errEnd <= runEnd ){ + errEnd > runStart && errEnd <= runEnd) { errors.remove(i); i--; } //濡傛灉瓒呭嚭鑼冨洿 else if (errStart <= runStart && errStart < runEnd && - errEnd > runStart && errEnd >= runEnd ) { + errEnd > runStart && errEnd >= runEnd) { MdcEquipmentRunningSection errOne = new MdcEquipmentRunningSection(); errOne.setEndTime(errors.get(i).getEndTime()); @@ -498,9 +518,9 @@ errOne.setEndLong(errOne.getEndTime().getTime()); if (sen <= 0) { errors.remove(i); - errors.add(i,errOne); + errors.add(i, errOne); } else { - errors.add(i+1,errOne); + errors.add(i + 1, errOne); i++; } } else { diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java index 6ca849d..661dc7c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcNoplanCloseServiceImpl.java @@ -9,9 +9,7 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipment; -import org.jeecg.modules.mdc.entity.MdcEquipmentRepair; import org.jeecg.modules.mdc.entity.MdcNoplanClose; -import org.jeecg.modules.mdc.entity.MdcTorqueConfig; import org.jeecg.modules.mdc.mapper.MdcNoplanCloseMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcNoplanCloseService; @@ -25,6 +23,10 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.ZoneId; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -312,9 +314,35 @@ //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("闈炶鍒掑仠鏈虹淮鎶ゅ垪琛ㄦ暟鎹�", "瀵煎嚭浜�:"+user.getRealname(), "闈炶鍒掑仠鏈虹淮鎶�")); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("闈炶鍒掑仠鏈虹淮鎶ゅ垪琛ㄦ暟鎹�", "瀵煎嚭浜�:" + user.getRealname(), "闈炶鍒掑仠鏈虹淮鎶�")); //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ mv.addObject(NormalExcelConstants.DATA_LIST, mdcNoplanCloses); return mv; } + + @Override + public BigDecimal findNoplanTimeDuration(String equipmentId, String validDate, String noplanType) { + BigDecimal result = new BigDecimal("0"); + String startDate = DateUtils.format(DateUtils.toDate(validDate + "-01", DateUtils.STR_DATE), DateUtils.STR_DATE) + " 00:00:00"; + Date startTime = DateUtils.toDate(startDate, DateUtils.STR_DATE_TIME_SMALL); + String endDate = DateUtils.format(DateUtils.addMonth(1, DateUtils.toDate(startDate, DateUtils.STR_DATE_TIME_SMALL)), DateUtils.STR_DATE_TIME_SMALL); + Date endTime = DateUtils.toDate(endDate, DateUtils.STR_DATE_TIME_SMALL); + List<MdcNoplanClose> mdcNoplanCloseList = this.baseMapper.findNoplanTimeDuration(equipmentId, noplanType, startDate, endDate); + // 鏃堕棿淇 骞惰绠� + if (mdcNoplanCloseList != null && !mdcNoplanCloseList.isEmpty()) { + for (MdcNoplanClose mdcNoplanClose : mdcNoplanCloseList) { + if (mdcNoplanClose.getStartTime().before(startTime)) { + mdcNoplanClose.setStartTime(startTime); + } + if (mdcNoplanClose.getEndTime().after(endTime)) { + mdcNoplanClose.setEndTime(endTime); + } + LocalDateTime localStartDate = LocalDateTime.ofInstant(mdcNoplanClose.getStartTime().toInstant(), ZoneId.systemDefault()); + LocalDateTime localEndDate = LocalDateTime.ofInstant(mdcNoplanClose.getEndTime().toInstant(), ZoneId.systemDefault()); + int minutes = Math.toIntExact(Duration.between(localStartDate, localEndDate).toMinutes()); + result = result.add(new BigDecimal(minutes)); + } + } + return result; + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java new file mode 100644 index 0000000..c7a87ab --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOverallEquipmentEfficiencyServiceImpl.java @@ -0,0 +1,187 @@ +package org.jeecg.modules.mdc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.modules.mdc.constant.MdcConstant; +import org.jeecg.modules.mdc.entity.MdcEquipment; +import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; +import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; +import org.jeecg.modules.mdc.mapper.MdcOverallEquipmentEfficiencyMapper; +import org.jeecg.modules.mdc.service.*; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.YearMonth; +import java.util.ArrayList; +import java.util.List; + +/** + * @author: LiuS + * @create: 2023-10-18 09:25 + */ +@Service +public class MdcOverallEquipmentEfficiencyServiceImpl extends ServiceImpl<MdcOverallEquipmentEfficiencyMapper, MdcOverallEquipmentEfficiency> implements IMdcOverallEquipmentEfficiencyService { + + @Resource + private IMdcEquipmentService mdcEquipmentService; + + @Resource + private IMdcEquipmentOvertimeService mdcEquipmentOvertimeService; + + @Resource + private IMdcDeviceCalendarService mdcDeviceCalendarService; + + @Resource + private IMdcNoplanCloseService mdcNoplanCloseService; + + @Resource + private IMdcPlanCloseService mdcPlanCloseService; + + @Resource + private IMdcPassRateService mdcPassRateService; + + @Resource + private IMdcStandardProcessDurationService mdcStandardProcessDurationService; + + @Resource + private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; + + /** + * 璁$畻璁惧缁煎悎鏁堢巼OEE + */ + @Override + public void runningOverallEquipmentEfficiency() { + /* + OEE = 鏃堕棿寮�鍔ㄧ巼 脳 鎬ц兘寮�鍔ㄧ巼 脳 鍚堟牸鍝佺巼 + 鏃堕棿寮�鍔ㄧ巼 = 锛堣礋鑽锋椂闂� - 闈炶鍒掑仠鏈烘椂闂达級 / 璐熻嵎鏃堕棿 脳 100% + 鎬ц兘寮�鍔ㄧ巼 = 鍑�寮�鍔ㄦ椂闂� / 寮�鍔ㄦ椂闂� 脳 100% + 鍚堟牸鍝佺巼 = 鍔犲伐鏁伴噺 - 涓嶅悎鏍兼暟閲� / 鍔犲伐鏁伴噺 + 璐熻嵎鏃堕棿 = 鏃ュ巻宸ヤ綔鏃堕棿 - 璁″垝鍋滄満鏃堕棿 + 闈炶鍒掑仠鏈烘椂闂� = 璐熻嵎鏃堕棿 - 涓昏酱杩愯浆鏃堕棿 + 宸ヤ綔鏃ュ巻鏃堕棿 = 鏃ュ巻鏃堕棿 - 娉曞畾鍋囨棩 - 鍙屼紤鏃� + 鍔犵彮鏃堕棿 + 鍑�寮�鍔ㄦ椂闂� = 鏍囧噯鍔犲伐鏃堕棿 脳 鍔犲伐鏁伴噺 + */ + List<MdcOverallEquipmentEfficiency> result = new ArrayList<>(); + // 鑾峰彇鏈夋晥鏃ユ湡 鏍煎紡 yyyy-MM + String validDate = YearMonth.now().minusMonths(1).toString(); + // 鑾峰彇璁惧鍒楄〃 + List<MdcEquipment> equipmentList = mdcEquipmentService.list(); + for (MdcEquipment mdcEquipment : equipmentList) { + String equipmentId = mdcEquipment.getEquipmentId(); + // 鏌ヨ鐝鍒嗙被 + List<String> shiftSubIdList = mdcDeviceCalendarService.findShiftSort(equipmentId, validDate); + // 鏁呴殰鍋滄満鏃堕暱缁熻(鍒嗛挓) + BigDecimal breakdownDownDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.BREAKDOWN_DOWN); + // 鎹㈠瀷璋冭瘯鏃堕暱缁熻(鍒嗛挓) + BigDecimal conversionDebugDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.CONVERSION_DEBUG); + // 鐗╂枡鐭己鏃堕暱缁熻(鍒嗛挓) + BigDecimal materialShortageDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.MATERIAL_SHORTAGE); + // 璁″垝绛変换鍔℃椂闀跨粺璁�(鍒嗛挓) + BigDecimal plannedTaskDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.PLANNED_TASK); + // 妫�楠屾椂闀跨粺璁�(鍒嗛挓) + BigDecimal inspectDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.INSPECT); + // 鍏朵粬鏃堕暱缁熻(鍒嗛挓) + BigDecimal otherDuration = mdcNoplanCloseService.findNoplanTimeDuration(equipmentId, validDate, MdcConstant.OTHER); + // 璁″垝淇濆吇鏃堕暱缁熻(鍒嗛挓) + BigDecimal plannedMaintenanceDuration = new BigDecimal("0"); + // 浼氳/鍩硅鏃堕暱缁熻(鍒嗛挓) + BigDecimal conferenceTrainingDuration = new BigDecimal("0"); + // 鍏跺畠浼戞伅鏃堕暱缁熻(鍒嗛挓) + BigDecimal otherRestDuration = new BigDecimal("0"); + if (shiftSubIdList != null && !shiftSubIdList.isEmpty()) { + for (String shiftSubId : shiftSubIdList) { + MdcOverallEquipmentEfficiency mdcOverallEquipmentEfficiency = new MdcOverallEquipmentEfficiency(); + // 鏃堕棿寮�鍔ㄧ巼璁$畻 + mdcOverallEquipmentEfficiency.setEquipmentId(equipmentId); + mdcOverallEquipmentEfficiency.setEquipmentName(mdcEquipment.getEquipmentName()); + mdcOverallEquipmentEfficiency.setEquipmentModel(mdcEquipment.getEquipmentModel()); + mdcOverallEquipmentEfficiency.setValidDate(validDate); + // 鐝 鐝鏃堕棿 + mdcOverallEquipmentEfficiency.setShiftSubId(shiftSubId); + BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(shiftSubId, equipmentId, validDate); + mdcOverallEquipmentEfficiency.setShiftTimeCount(shiftTimeCount); + // 璁$畻鍔犵彮鏃堕棿 + BigDecimal overtime = mdcEquipmentOvertimeService.computeOvertime(shiftSubId, equipmentId, validDate); + mdcOverallEquipmentEfficiency.setOvertime(overtime); + // 璁$畻瀹為檯鐝骇澶╂暟 + BigDecimal actualWorkDayCount = mdcDeviceCalendarService.computeActualWorkDayCount(shiftSubId, equipmentId, validDate); + mdcOverallEquipmentEfficiency.setActualWorkDayCount(actualWorkDayCount); + // 鏈堝害瀹為檯鐝骇鎬绘椂闂�(鍒嗛挓) + mdcOverallEquipmentEfficiency.setMonthActualWorkDayTimeCount(mdcOverallEquipmentEfficiency.getShiftTimeCount().add(overtime)); + // 鏁呴殰鍋滄満鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setBreakdownDownDuration(breakdownDownDuration); + // 鎹㈠瀷璋冭瘯鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setConversionDebugDuration(conversionDebugDuration); + // 鐗╂枡鐭己鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setMaterialShortageDuration(materialShortageDuration); + // 璁″垝绛変换鍔℃椂闀跨粺璁�(鍒嗛挓) + mdcOverallEquipmentEfficiency.setPlannedTaskDuration(plannedTaskDuration); + // 妫�楠屾椂闀跨粺璁�(鍒嗛挓) + mdcOverallEquipmentEfficiency.setInspectDuration(inspectDuration); + // 鍏朵粬鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setOtherDuration(otherDuration); + // 璁″垝淇濆吇鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setPlannedMaintenanceDuration(plannedMaintenanceDuration); + // 浼氳/鍩硅鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setConferenceTrainingDuration(conferenceTrainingDuration); + // 鍏跺畠浼戞伅鏃堕暱缁熻(鍒嗛挓) + mdcOverallEquipmentEfficiency.setOtherRestDuration(otherRestDuration); + /* + 璐熻嵎鏃堕棿(灏忔椂) = 宸ヤ綔鏃ュ巻鏃堕棿 - 璁″垝鍋滄満鏃堕棿 + 宸ヤ綔鏃ュ巻鏃堕棿 = 鏃ュ巻鏃堕棿 - 娉曞畾鍋囨棩 - 鍙屼紤鏃� + 鍔犵彮鏃堕棿 + 璁″垝鍋滄満鏃堕棿 = 璁″垝淇濆吇鏃堕暱 + 浼氳/鍩硅鏃堕暱 + 浼氳/鍩硅鏃堕暱 + */ + // mdcOverallEquipmentEfficiency.getShiftTimeCount() - plannedMaintenanceDuration - conferenceTrainingDuration - otherRestDuration + // 璐熻嵎鏃堕棿(鍒嗛挓) + BigDecimal loadTime = mdcOverallEquipmentEfficiency.getShiftTimeCount().subtract(plannedMaintenanceDuration).subtract(conferenceTrainingDuration).subtract(otherRestDuration); + mdcOverallEquipmentEfficiency.setLoadTime(loadTime.divide(new BigDecimal("60"), 1, RoundingMode.HALF_UP)); + // 鏃堕棿寮�鍔ㄧ巼 + BigDecimal timeActuationRate = BigDecimal.ZERO; + if (loadTime.compareTo(BigDecimal.ZERO) == 0) { + mdcOverallEquipmentEfficiency.setTimeActuationRate(BigDecimal.ZERO); + } else { + timeActuationRate = (loadTime.subtract(breakdownDownDuration).subtract(conversionDebugDuration).subtract(materialShortageDuration).subtract(plannedTaskDuration).subtract(inspectDuration).subtract(otherDuration)).divide(loadTime, 4, RoundingMode.HALF_UP); + mdcOverallEquipmentEfficiency.setTimeActuationRate(timeActuationRate); + } + // 鍔犲伐闆朵欢鏁�(浠�) processQuantity + BigDecimal processQuantity = mdcPassRateService.findProcessQuantity(equipmentId, validDate); + mdcOverallEquipmentEfficiency.setProcessQuantity(processQuantity); + // 鏍囧噯鍔犲伐鏃堕棿(鍒嗛挓) + MdcStandardProcessDuration mdcStandardProcessDuration = mdcStandardProcessDurationService.getOne(new LambdaQueryWrapper<MdcStandardProcessDuration>().eq(MdcStandardProcessDuration::getEquipmentId, equipmentId)); + if (mdcStandardProcessDuration != null) { + mdcOverallEquipmentEfficiency.setStandardProcessDuration(new BigDecimal(mdcStandardProcessDuration.getDuration()).multiply(processQuantity)); + } else { + mdcOverallEquipmentEfficiency.setStandardProcessDuration(BigDecimal.ZERO); + } + + // 鎬ц兘寮�鍔ㄧ巼 = 涓昏酱杩愯鏃堕棿/璐熻嵎鏃堕棿 + // 鏌ヨ涓昏酱杩愯鏃堕棿(鍒嗛挓) + BigDecimal spindleRunDuration = mdcEquipmentStatisticalShiftInfoService.findSpindleRunDuration(equipmentId, validDate, shiftSubId); + if (spindleRunDuration.compareTo(BigDecimal.ZERO) != 0) { + mdcOverallEquipmentEfficiency.setPerformanceRate(spindleRunDuration.divide(loadTime, 4, RoundingMode.HALF_UP)); + } else { + mdcOverallEquipmentEfficiency.setPerformanceRate(BigDecimal.ZERO); + } + // 搴熷搧鏁� unqualifiedQuantity + BigDecimal unqualifiedQuantity = mdcPassRateService.findUnqualifiedQuantity(equipmentId, validDate); + mdcOverallEquipmentEfficiency.setUnqualifiedQuantity(unqualifiedQuantity); + // 鍚堟牸鐜� + if (processQuantity.compareTo(BigDecimal.ZERO) == 0) { + mdcOverallEquipmentEfficiency.setPassRate(BigDecimal.ONE); + } else { + mdcOverallEquipmentEfficiency.setPassRate((processQuantity.subtract(unqualifiedQuantity)).divide(processQuantity, 4, RoundingMode.HALF_UP)); + } + // 璁惧缁煎悎鏁堢巼 = 鏃堕棿寮�鍔ㄧ巼 脳 鎬ц兘寮�鍔ㄧ巼 脳 鍚堟牸鍝佺巼 + mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(timeActuationRate.multiply(mdcOverallEquipmentEfficiency.getPerformanceRate()).multiply(mdcOverallEquipmentEfficiency.getPassRate())); + if (mdcOverallEquipmentEfficiency.getOverallEquipmentEfficiency().compareTo(BigDecimal.ZERO) == 0) { + mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(BigDecimal.ONE); + } + result.add(mdcOverallEquipmentEfficiency); + } + } + } + super.saveBatch(result); + } +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java index e5916d1..f2e5f4b 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPassRateServiceImpl.java @@ -10,10 +10,10 @@ import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcPassRate; -import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; import org.jeecg.modules.mdc.mapper.MdcPassRateMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcPassRateService; +import org.jeecg.modules.mdc.util.DateUtils; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; @@ -24,6 +24,8 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -193,4 +195,22 @@ mv.addObject(NormalExcelConstants.DATA_LIST, mdcPassRates); return mv; } + + @Override + public BigDecimal findProcessQuantity(String equipmentId, String validDate) { + String startTime = DateUtils.format(DateUtils.toDate(validDate + "-01 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); + LocalDate localDate = LocalDate.of(Integer.parseInt(validDate.split("-")[0]), Integer.parseInt(validDate.split("-")[1]), Integer.parseInt("01")).plusMonths(1); + String endTime = DateUtils.format(DateUtils.toDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); + Integer result = this.baseMapper.findProcessQuantity(equipmentId, startTime, endTime); + return result == null ? new BigDecimal("0") : new BigDecimal(result); + } + + @Override + public BigDecimal findUnqualifiedQuantity(String equipmentId, String validDate) { + String startTime = DateUtils.format(DateUtils.toDate(validDate + "-01 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); + LocalDate localDate = LocalDate.of(Integer.parseInt(validDate.split("-")[0]), Integer.parseInt(validDate.split("-")[1]), Integer.parseInt("01")).plusMonths(1); + String endTime = DateUtils.format(DateUtils.toDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + " 00:00:00", DateUtils.STR_DATE_TIME_SMALL), DateUtils.STR_DATE_TIME_SMALL); + Integer result = this.baseMapper.findUnqualifiedQuantity(equipmentId, startTime, endTime); + return result == null ? new BigDecimal("0") : new BigDecimal(result); + } } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java index b63a0e6..80c305b 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/entity/SysDepart.java @@ -89,9 +89,11 @@ private Date updateTime; /**浣跨敤閮ㄩ棬缂栫爜*/ + @TableField(exist = false) private String useDepartNum; /**缁翠慨閮ㄩ棬缂栫爜*/ + @TableField(exist = false) private String repairDepartNum; //update-begin---author:wangshuai ---date:20200308 for锛歔JTC-119]鍦ㄩ儴闂ㄧ鐞嗚彍鍗曚笅璁剧疆閮ㄩ棬璐熻矗浜猴紝鏂板瀛楁璐熻矗浜篿ds鍜屾棫鐨勮礋璐d汉ids -- Gitblit v1.9.3