| | |
| | | @ApiModelProperty(value = "设备种类") |
| | | private String deviceCategory; |
| | | |
| | | /** |
| | | * 设备属性(普通/重要) |
| | | */ |
| | | @Excel(name = "设备属性", width = 15) |
| | | @ApiModelProperty(value = "设备属性(普通/重要)") |
| | | private String attribute; |
| | | |
| | | /**部门名称*/ |
| | | @Excel(name = "部门名称", width = 15) |
| | | private transient String orgCodeTxt; |
| | |
| | | |
| | | 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; |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private String medId; |
| | | /** |
| | | * 单元 |
| | | */ |
| | | @ApiModelProperty(value = "单元") |
| | | private String dept; |
| | | /** |
| | | * 车间(分厂) |
| | | */ |
| | | @ApiModelProperty(value = "车间") |
| | | private String workshop; |
| | | /** |
| | | * 版本号(工艺规程版次) |
| | | */ |
| | | @ApiModelProperty(value = "版本号") |
| | | private String revisionNo; |
| | | /** |
| | | * 零件名称 |
| | | */ |
| | | @ApiModelProperty(value = "零件名称") |
| | | private String mdsItemId; |
| | | /** |
| | | * 零件号 |
| | | */ |
| | | @ApiModelProperty(value = "零件号") |
| | | private String mdsItemCode; |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @ApiModelProperty(value = "订单号") |
| | | private String taskCode; |
| | | /** |
| | | * 流卡号 |
| | | */ |
| | | @ApiModelProperty(value = "流卡号") |
| | | private String ewoNo; |
| | | /** |
| | | * 批次号 |
| | | */ |
| | | @ApiModelProperty(value = "批次号") |
| | | private String batchNo; |
| | | /** |
| | | * 批次数量(计划数) |
| | | */ |
| | | @ApiModelProperty(value = "批次数量") |
| | | private String batchNum; |
| | | /** |
| | | * 合格数 |
| | | */ |
| | | @ApiModelProperty(value = "合格数") |
| | | private Integer qualifiedQty; |
| | | /** |
| | | * 报废数 |
| | | */ |
| | | @ApiModelProperty(value = "报废数") |
| | | private Integer scrapQty; |
| | | /** |
| | | * 工序号 |
| | | */ |
| | | @ApiModelProperty(value = "工序号") |
| | | private String opreationSeqNo; |
| | | /** |
| | | * 派工日期 |
| | | */ |
| | | @ApiModelProperty(value = "派工日期") |
| | | private String dispatchDate; |
| | | /** |
| | | * 设备编号 |
| | | */ |
| | | @ApiModelProperty(value = "设备编号") |
| | | private String equipmentId; |
| | | /** |
| | | * 1 正常 2 取消 3 删除 |
| | | */ |
| | | @ApiModelProperty(value = "控制系统类型") |
| | | private String taskType; |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentDaySummary; |
| | | |
| | | public interface MdcEquipmentDaySummaryMapper extends BaseMapper<MdcEquipmentDaySummary> { |
| | | |
| | | MdcEquipmentDaySummary statisticsQty(@Param("productionId") String productionId); |
| | | } |
| | |
| | | <if test="vo.deviceCategory != null and vo.deviceCategory != '' "> |
| | | AND t2.device_category = #{vo.deviceCategory} |
| | | </if> |
| | | <if test="vo.attribute != null and vo.attribute != '' "> |
| | | AND t2.attribute = #{vo.attribute} |
| | | </if> |
| | | <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 "> |
| | | AND t2.equipment_id IN |
| | | <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=","> |
| | |
| | | <!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.MdcEquipmentDaySummaryMapper"> |
| | | |
| | | <select id="statisticsQty" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentDaySummary"> |
| | | SELECT SUM(t1.plan_qty) AS planQty, |
| | | SUM(t1.qualified_qty) AS qualifiedQty |
| | | FROM mdc_equipment_day_summary t1 |
| | | INNER JOIN mdc_equipment t2 |
| | | ON t1.equipment_code = t2.equipment_id |
| | | INNER JOIN mdc_production_equipment t3 |
| | | ON t2.id = t3.equipment_id |
| | | INNER JOIN mdc_production t4 |
| | | ON t3.production_id = t4.id |
| | | WHERE t4.parent_id = #{productionId} |
| | | AND TO_CHAR(t1.create_time, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM'); |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentDaySummary; |
| | | |
| | | public interface IMdcEquipmentDaySummaryService extends IService<MdcEquipmentDaySummary> { |
| | | |
| | | MdcEquipmentDaySummary statisticsQty(String productionId); |
| | | } |
| | |
| | | // |
| | | List<MdcUtilizationResultDto> list = new ArrayList<>(); |
| | | for (String date : dateList) { |
| | | Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | list.add(this.utilizationRate(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | if ("00:00".equals(startString) && "23:59".equals(endString)) { |
| | | list.add(this.utilizationRateTrend(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), date, mdcUtilizationRateList)); |
| | | } else { |
| | | Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | list.add(this.utilizationRate(mdcEquDepDto.getEquipmentId(), mdcEquDepDto.getEquipmentName(), mdcEquDepDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | } |
| | | } |
| | | mdcUtilizationRateListDto.setDataList(list); |
| | | listDtos.add(mdcUtilizationRateListDto); |
| | |
| | | // |
| | | List<MdcUtilizationResultDto> list = new ArrayList<>(); |
| | | for (String date : dateList) { |
| | | Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | list.add(this.utilizationRate(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | if ("00:00".equals(startString) && "23:59".equals(endString)) { |
| | | list.add(this.utilizationRateTrend(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), date, mdcUtilizationRateList)); |
| | | } else { |
| | | Date startTime = DateUtils.toDate(date + " " + startString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | Date endTime = DateUtils.toDate(date + " " + endString + ":00", DateUtils.STR_DATE_TIME_SMALL); |
| | | list.add(this.utilizationRate(mdcEquProDto.getEquipmentId(), mdcEquProDto.getEquipmentName(), mdcEquProDto.getEquipmentType(), startTime, endTime, date, mdcUtilizationRateList)); |
| | | } |
| | | } |
| | | mdcEfficiencyListDto.setDataList(list); |
| | | listDtos.add(mdcEfficiencyListDto); |
| | |
| | | */ |
| | | @Service |
| | | public class MdcEquipmentDaySummaryServiceImpl extends ServiceImpl<MdcEquipmentDaySummaryMapper, MdcEquipmentDaySummary> implements IMdcEquipmentDaySummaryService { |
| | | @Override |
| | | public MdcEquipmentDaySummary statisticsQty(String productionId) { |
| | | return this.baseMapper.statisticsQty(productionId); |
| | | } |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveMdcEquipment(MdcEquipment mdcEquipment, String selectedDeparts, String selectedProduction) { |
| | | //step.1 保存设备 |
| | | if (StringUtils.isBlank(mdcEquipment.getAttribute())) { |
| | | mdcEquipment.setAttribute("0"); |
| | | } |
| | | this.save(mdcEquipment); |
| | | //step.2 保存所属部门 |
| | | if (oConvertUtils.isNotEmpty(selectedDeparts)) { |
| | |
| | | if (StringUtils.isNotEmpty(vo.getDeviceCategory())) { |
| | | queryWrapper.in(MdcEquipment::getDeviceCategory, Arrays.asList(vo.getDeviceCategory().split(","))); |
| | | } |
| | | if (StringUtils.isNotBlank(vo.getAttribute())) { |
| | | queryWrapper.eq(MdcEquipment::getAttribute, vo.getAttribute()); |
| | | } |
| | | List<MdcEquipment> list = super.list(queryWrapper); |
| | | // List<MdcEquipment> list = super.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentType, equipmentType).in(MdcEquipment::getEquipmentId, equipmentIdList)); |
| | | return list.stream().map(MdcEquipment::getEquipmentId).collect(Collectors.toList()); |
| | |
| | | * 设备种类 |
| | | */ |
| | | private String deviceCategory; |
| | | /** |
| | | * 设备属性 |
| | | */ |
| | | private String attribute; |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public String equipmentDaySchedule(String msg) { |
| | | log.info("MES上报日计划原始数据 === {}", msg); |
| | | log.info("接收MES上报日计划原始数据 === {}", msg); |
| | | List<EquipmentDaySchedule> equipmentDayScheduleList = JSONObject.parseArray(msg, EquipmentDaySchedule.class); |
| | | if (equipmentDayScheduleList == null || equipmentDayScheduleList.isEmpty()) { |
| | | WsResult wsResult = new WsResult("0", "json解析失败"); |
| | |
| | | } |
| | | mdcEquipmentDayScheduleService.saveBatch(mdcEquipmentDayScheduleList); |
| | | |
| | | log.info("MES上报日计划数据成功!"); |
| | | log.info("接收MES上报日计划数据成功!"); |
| | | WsResult wsResult = new WsResult("1", "成功"); |
| | | return JSONObject.toJSONString(wsResult); |
| | | } |
| | | |
| | | @Override |
| | | public String equipmentDaySummary(String msg) { |
| | | log.info("MES上报日汇总原始数据 === {}", msg); |
| | | log.info("接收MES上报日汇总原始数据 === {}", msg); |
| | | List<EquipmentDaySummary> equipmentDaySummaryList = JSONObject.parseArray(msg, EquipmentDaySummary.class); |
| | | if (equipmentDaySummaryList == null || equipmentDaySummaryList.isEmpty()) { |
| | | WsResult wsResult = new WsResult("0", "json解析失败"); |
| | |
| | | mdcEquipmentDaySummaryList.add(mdcEquipmentDaySummary); |
| | | } |
| | | mdcEquipmentDaySummaryService.saveBatch(mdcEquipmentDaySummaryList); |
| | | log.info("MES上报日汇总数据成功!"); |
| | | log.info("接收MES上报日汇总数据成功!"); |
| | | WsResult wsResult = new WsResult("1", "成功"); |
| | | return JSONObject.toJSONString(wsResult); |
| | | } |
| | |
| | | * 关机数 |
| | | */ |
| | | private Integer closeCount = 0; |
| | | /** |
| | | * 完成量 |
| | | */ |
| | | private Integer qualifiedQty = 0; |
| | | /** |
| | | * 任务量 |
| | | */ |
| | | private Integer planQty = 0; |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.DictModel; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentDaySummary; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.service.IEquipmentAlarmService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentDaySummaryService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentService; |
| | | import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Resource |
| | | private IEquipmentAlarmService equipmentAlarmService; |
| | | |
| | | @Resource |
| | | private IMdcEquipmentDaySummaryService mdcEquipmentDaySummaryService; |
| | | |
| | | /** |
| | | * 设备状态情况 |
| | | * |
| | |
| | | @Override |
| | | public EquipmentStatusOverview equipmentStatusOverview(String productionId) { |
| | | EquipmentStatusOverview equipmentStatusOverview = new EquipmentStatusOverview(); |
| | | // 设备状态 |
| | | List<MdcEquipmentMonitor> equipmentMonitorList = mdcEquipmentService.getEquipmentMonitorList(productionId); |
| | | if (equipmentMonitorList != null && !equipmentMonitorList.isEmpty()) { |
| | | equipmentStatusOverview.setEquipmentCount(equipmentMonitorList.size()); |
| | |
| | | } |
| | | } |
| | | } |
| | | // mes产量 |
| | | MdcEquipmentDaySummary mdcEquipmentDaySummary = mdcEquipmentDaySummaryService.statisticsQty(productionId); |
| | | if (mdcEquipmentDaySummary != null) { |
| | | equipmentStatusOverview.setQualifiedQty(mdcEquipmentDaySummary.getQualifiedQty()); |
| | | equipmentStatusOverview.setPlanQty(mdcEquipmentDaySummary.getPlanQty()); |
| | | } |
| | | return equipmentStatusOverview; |
| | | } |
| | | |