Merge remote-tracking branch 'origin/master'
| | |
| | | String shelfReset(Long slot); |
| | | |
| | | List<RawGlassStorageDetailsDTO> patternUsage(String width, String height, String thickness, String films); |
| | | |
| | | RawGlassStorageDetails generateDetails(RawGlassStorageDetails details, Integer targetSlot); |
| | | } |
| | |
| | | import com.mes.rawglassdetails.entity.request.RawGlassRequest; |
| | | import com.mes.rawglassdetails.mapper.RawGlassStorageDetailsMapper; |
| | | import com.mes.rawglassdetails.service.RawGlassStorageDetailsService; |
| | | import com.mes.rawglassstation.entity.RawGlassStorageStation; |
| | | import com.mes.rawglassstation.service.RawGlassStorageStationService; |
| | | import com.mes.rawglasstask.entity.RawGlassStorageTask; |
| | | import com.mes.rawglasstask.service.RawGlassStorageTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Autowired |
| | | RawGlassStorageTaskService rawGlassStorageTaskService; |
| | | |
| | | @Autowired |
| | | RawGlassStorageStationService rawGlassStorageStationService; |
| | | |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | |
| | | public List<RawGlassStorageDetailsDTO> patternUsage(String width, String height, String thickness, String films){ |
| | | return baseMapper.patternUsage(width, height, thickness, films); |
| | | } |
| | | |
| | | @Override |
| | | public RawGlassStorageDetails generateDetails(RawGlassStorageDetails details, Integer targetSlot) { |
| | | RawGlassStorageDetails targetDetails = new RawGlassStorageDetails(); |
| | | RawGlassStorageStation station = rawGlassStorageStationService.getOne(new LambdaQueryWrapper<RawGlassStorageStation>() |
| | | .eq(RawGlassStorageStation::getSlot, targetSlot)); |
| | | targetDetails.setDeviceId(station.getDeviceId()); |
| | | targetDetails.setSlot(targetSlot); |
| | | targetDetails.setShelf(details.getShelf()); |
| | | targetDetails.setPatternWidth(details.getPatternWidth()); |
| | | targetDetails.setPatternHeight(details.getPatternHeight()); |
| | | targetDetails.setPatternThickness(details.getPatternThickness()); |
| | | targetDetails.setFilmsId(details.getFilmsId()); |
| | | targetDetails.setRemainQuantity(details.getRemainQuantity()); |
| | | targetDetails.setCreateTime(new Date()); |
| | | targetDetails.setState(Const.RAW_GLASS_STATE_IN); |
| | | return targetDetails; |
| | | } |
| | | } |
| | |
| | | package com.mes.rawglasstask.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mes.rawglassdetails.entity.RawGlassStorageDetails; |
| | | import com.mes.rawglasstask.entity.RawGlassStorageTask; |
| | | import com.mes.rawglasstask.entity.request.RawGlassTaskRequest; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | String setRawGlassTaskRequest(RawGlassTaskRequest request); |
| | | |
| | | Boolean taskSuccess(Long taskId); |
| | | |
| | | Boolean taskError(Long taskId); |
| | | |
| | | List<RawGlassStorageTask> queryRawGlassHistoryTask(RawGlassTaskRequest request); |
| | | } |
| | |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.rawglassdetails.entity.RawGlassStorageDetails; |
| | | import com.mes.rawglassdetails.service.RawGlassStorageDetailsService; |
| | | import com.mes.rawglassstation.entity.RawGlassStorageStation; |
| | | import com.mes.rawglasstask.entity.RawGlassStorageTask; |
| | | import com.mes.rawglasstask.entity.request.RawGlassTaskRequest; |
| | | import com.mes.rawglasstask.mapper.RawGlassStorageTaskMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | RedisUtil redisUtil; |
| | | |
| | | @Resource |
| | | RawGlassStorageDetailsService rawGlassStorageDetailsService; |
| | | |
| | | @Override |
| | | public List<RawGlassStorageTask> listRawGlassTask() { |
| | | RawGlassTaskRequest request = redisUtil.getCacheObject("rawGlassTaskRequest"); |
| | | public List<RawGlassStorageTask> queryRawGlassHistoryTask(RawGlassTaskRequest request) { |
| | | if (null == request) { |
| | | request = new RawGlassTaskRequest(); |
| | | } |
| | |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskState()), RawGlassStorageTask::getTaskState, request.getTaskState()) |
| | | .in(CollectionUtil.isNotEmpty(request.getTaskType()), RawGlassStorageTask::getTaskType, request.getTaskType()) |
| | | .orderByDesc(RawGlassStorageTask::getCreateTime)); |
| | | } |
| | | |
| | | // return list(new QueryWrapper<RawGlassStorageTask>() |
| | | // .in(CollectionUtil.isNotEmpty(request.getTaskState()), "task_state", request.getTaskState()) |
| | | // .in(CollectionUtil.isNotEmpty(request.getTaskType()), "task_type", request.getTaskType()) |
| | | // .between("create_time", request.getBeginDate(), request.getEndDate()) |
| | | // .orderByDesc("create_time")); |
| | | @Override |
| | | public List<RawGlassStorageTask> listRawGlassTask() { |
| | | RawGlassTaskRequest request = redisUtil.getCacheObject("rawGlassTaskRequest"); |
| | | return queryRawGlassHistoryTask(request); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | log.info("前端传入参数:{}", request); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean taskSuccess(Long taskId) { |
| | | //获取任务正在执行的任务信息 |
| | | RawGlassStorageTask task = this.getById(taskId); |
| | | //去详情表获取正在执行的原片详情信息 |
| | | RawGlassStorageDetails details = rawGlassStorageDetailsService.getOne(new LambdaQueryWrapper<RawGlassStorageDetails>() |
| | | .ne(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_OUT).eq(RawGlassStorageDetails::getSlot, task.getStartSlot()) |
| | | ); |
| | | RawGlassStorageDetails targetDetails = rawGlassStorageDetailsService.generateDetails(details, task.getEndSlot()); |
| | | int deviceId = details.getDeviceId(); |
| | | Integer taskType = task.getTaskType(); |
| | | log.info("将详情表的状态改为已出库"); |
| | | rawGlassStorageDetailsService.update(new LambdaUpdateWrapper<RawGlassStorageDetails>() |
| | | .set(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_OUT) |
| | | .ne(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_OUT) |
| | | .eq(RawGlassStorageDetails::getSlot, task.getStartSlot())); |
| | | log.info("任务状态已更改为:已完成"); |
| | | this.update(new LambdaUpdateWrapper<RawGlassStorageTask>() |
| | | .eq(RawGlassStorageTask::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .set(RawGlassStorageTask::getTaskState, Const.RAW_GLASS_TASK_SUCCESS)); |
| | | switch (taskType) { |
| | | case 1: |
| | | case 3: |
| | | log.info("1、入库,3、调度任务。{}", taskType); |
| | | if (details.getRemainQuantity() > 0) { |
| | | rawGlassStorageDetailsService.save(targetDetails); |
| | | } |
| | | break; |
| | | case 2: |
| | | case 4: |
| | | log.info("2、出片,4、入库请求。{}", taskType); |
| | | targetDetails = new RawGlassStorageDetails(); |
| | | targetDetails.setSlot(task.getEndSlot()); |
| | | targetDetails.setDeviceId(deviceId); |
| | | targetDetails.setShelf(task.getStartSlot()); |
| | | targetDetails.setState(Const.RAW_GLASS_STATE_IN); |
| | | rawGlassStorageDetailsService.save(targetDetails); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Boolean taskError(Long taskId) { |
| | | //获取任务正在执行的任务信息 |
| | | RawGlassStorageTask task = this.getById(taskId); |
| | | Integer taskType = task.getTaskType(); |
| | | if (taskType.equals(Const.RAW_GLASS_TASK_TYPE_IN_REQUEST)) { |
| | | rawGlassStorageDetailsService.update(new LambdaUpdateWrapper<RawGlassStorageDetails>() |
| | | .set(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_OUT) |
| | | .eq(RawGlassStorageDetails::getSlot, task.getStartSlot()) |
| | | .in(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_RUNNING, Const.RAW_GLASS_STATE_CAR)); |
| | | } else { |
| | | rawGlassStorageDetailsService.update(new LambdaUpdateWrapper<RawGlassStorageDetails>() |
| | | .set(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_IN) |
| | | .eq(RawGlassStorageDetails::getSlot, task.getStartSlot()) |
| | | .in(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_RUNNING, Const.RAW_GLASS_STATE_CAR)); |
| | | } |
| | | this.update(new LambdaUpdateWrapper<RawGlassStorageTask>() |
| | | .eq(RawGlassStorageTask::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .set(RawGlassStorageTask::getTaskState, Const.RAW_GLASS_TASK_FAILURE)); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.mes.edgstoragecage.entity.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2025/3/9 23:18 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class EdgSlotRemainVO { |
| | | |
| | | private int deviceId; |
| | | |
| | | private int slot; |
| | | |
| | | private int remainWidth; |
| | | } |
| | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.CutDrawingVO; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.security.core.parameters.P; |
| | | |
| | |
| | | EdgStorageCageDetails queryEdgStorageDetailsBySize(int deviceId, int currentSlot, double width, double height); |
| | | |
| | | List<CutDrawingVO> queryCutDrawingByEngineerId(@Param("engineerId") String engineerId, @Param("patternSequence") int patternSequence, @Param("isAll") int isAll); |
| | | |
| | | List<EdgSlotRemainVO> querySlotRemainWidth(@Param("cellLength") int cellLength, @Param("glassGap") int glassGap); |
| | | } |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @return |
| | | */ |
| | | EdgStorageCage getEdgStorageCageBySize(@Param("deviceId") int deviceId, @Param("width") double width, @Param("height") double height, @Param("slot") int slot); |
| | | |
| | | void resetSlotRemainWidth(@Param("list") List<EdgSlotRemainVO> list); |
| | | } |
| | |
| | | import com.mes.damage.entity.request.DamageRequest; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.CutDrawingVO; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | EdgStorageCageDetails queryEdgStorageDetailsBySize(int deviceId, int currentSlot, double width, double height); |
| | | |
| | | String edgDetailsOperate(DamageRequest request); |
| | | |
| | | List<EdgSlotRemainVO> querySlotRemainWidth(int cellLength, int glassGap); |
| | | } |
| | |
| | | import com.github.yulichang.base.MPJBaseService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import com.mes.edgstoragecage.entity.vo.EdgStorageCageVO; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | EdgStorageCage getEdgStorageCageBySize(int deviceId, double width, double height, int slot); |
| | | |
| | | void resetSlotRemainWidth(List<EdgSlotRemainVO> edgSlotRemainVOS); |
| | | } |
| | |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.CutDrawingVO; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | |
| | | patternSequence = lastGlass.getPatternSequence() + 1; |
| | | } else { |
| | | //当前版图是否有剩余,有剩余显示当前版图 |
| | | patternSequence = lastGlass.getPatternSequence(); } |
| | | patternSequence = lastGlass.getPatternSequence(); |
| | | } |
| | | } |
| | | return baseMapper.queryCutDrawingByEngineerId(engineering.getEngineerId(), patternSequence, 0); |
| | | } |
| | |
| | | public String edgDetailsOperate(DamageRequest request) { |
| | | //卧式理片笼爆破损 |
| | | damageService.autoSubmitReport(request.getGlassId(), request.getLine(), request.getWorkingProcedure(), "卧式理片笼", request.getState()); |
| | | this.remove(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId,request.getGlassId())); |
| | | this.remove(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, request.getGlassId())); |
| | | return "success"; |
| | | } |
| | | |
| | | @Override |
| | | public List<EdgSlotRemainVO> querySlotRemainWidth(int cellLength, int glassGap) { |
| | | return this.baseMapper.querySlotRemainWidth(cellLength, glassGap); |
| | | } |
| | | } |
| | |
| | | import com.mes.damage.service.DamageService; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import com.mes.edgstoragecage.entity.vo.EdgStorageCageVO; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageDetailsMapper; |
| | | import com.mes.edgstoragecage.mapper.EdgStorageCageMapper; |
| | |
| | | return baseMapper.getEdgStorageCageBySize(deviceId, width, height, slot); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void resetSlotRemainWidth(List<EdgSlotRemainVO> edgSlotRemainVOS) { |
| | | baseMapper.resetSlotRemainWidth(edgSlotRemainVOS); |
| | | } |
| | | } |
| | |
| | | @Resource |
| | | private EdgStorageDeviceTaskService edgStorageDeviceTaskService; |
| | | |
| | | @ApiOperation(value = "重置任务:按照设备id重置任务") |
| | | @ApiOperation(value = "重置任务/任务失败处理:按照设备id重置任务") |
| | | @PostMapping("/resetTask") |
| | | public Result<Boolean> resetTask(Integer deviceId) { |
| | | Boolean flag = edgStorageDeviceTaskService.resetTask(deviceId); |
| | |
| | | return Result.build(200, "无任务,无需重置", flag); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("任务成功处理") |
| | | @PostMapping("/taskSuccess") |
| | | public Result<Boolean> taskSuccess(Integer deviceId) { |
| | | return Result.build(200, "处理成功", edgStorageDeviceTaskService.taskSuccess(deviceId)); |
| | | } |
| | | } |
| | |
| | | |
| | | Boolean resetTask(Integer deviceId); |
| | | |
| | | Boolean taskSuccess(Integer deviceId); |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCage; |
| | | import com.mes.edgstoragecage.entity.EdgStorageCageDetails; |
| | | import com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageDetailsService; |
| | | import com.mes.edgstoragecage.service.EdgStorageCageService; |
| | | import com.mes.job.OpcCacheGlassTask; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTask; |
| | | import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; |
| | | import com.mes.opctask.mapper.EdgStorageDeviceTaskMapper; |
| | | import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService; |
| | | import com.mes.opctask.service.EdgStorageDeviceTaskService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | |
| | | @Resource |
| | | private EdgStorageCageDetailsService edgStorageCageDetailsService; |
| | | @Resource |
| | | EdgStorageDeviceTaskMapper edgStorageDeviceTaskMapper; |
| | | private EdgStorageCageService edgStorageCageService; |
| | | @Resource |
| | | OpcCacheGlassTask opcCacheGlassTask; |
| | | EdgStorageDeviceTaskMapper edgStorageDeviceTaskMapper; |
| | | |
| | | @Value("${mes.glassGap}") |
| | | private int glassGap; |
| | | @Value("${mes.cellLength}") |
| | | private int cellLength; |
| | | |
| | | @Override |
| | | public EdgStorageDeviceTask queryTaskMessage(String tableName) { |
| | |
| | | .eq(EdgStorageCageDetails::getGlassId, glassId)); |
| | | } |
| | | |
| | | opcCacheGlassTask.updateCellRemainWidth(cell, deviceId, taskHistory); |
| | | edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>() |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, deviceId) |
| | | .set(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_FAILURE) |
| | | ); |
| | | //计算每个各自的剩余尺寸信息 |
| | | resetSlotRemainWidth(); |
| | | //最后更新任务,保证任务前的动作都做完 |
| | | EdgStorageDeviceTask task = new EdgStorageDeviceTask(); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY); |
| | |
| | | this.updateTaskMessage(tableName, task); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean taskSuccess(Integer deviceId) { |
| | | String tableName = deviceId == 1 ? EDG_STORAGE_DEVICE_ONE_TASK : EDG_STORAGE_DEVICE_TWO_TASK; |
| | | edgStorageDeviceTaskHistoryService.update(new LambdaUpdateWrapper<EdgStorageDeviceTaskHistory>() |
| | | .set(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_SUCCESS) |
| | | .eq(EdgStorageDeviceTaskHistory::getTaskState, Const.RAW_GLASS_TASK_NEW) |
| | | .eq(EdgStorageDeviceTaskHistory::getDeviceId, deviceId)); |
| | | //计算每个各自的剩余尺寸信息 |
| | | resetSlotRemainWidth(); |
| | | //最后更新任务,保证任务前的动作都做完 |
| | | EdgStorageDeviceTask task = new EdgStorageDeviceTask(); |
| | | task.setTaskRunning(Const.GLASS_CACHE_TYPE_EMPTY); |
| | | task.setGlassIdOut(""); |
| | | task.setStartCell(0); |
| | | this.updateTaskMessage(tableName, task); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | private boolean resetSlotRemainWidth() { |
| | | //将尺寸重置为原始尺寸 |
| | | edgStorageCageService.update(new LambdaUpdateWrapper<EdgStorageCage>().set(EdgStorageCage::getRemainWidth, cellLength)); |
| | | //获取笼内的详情数据 |
| | | List<EdgSlotRemainVO> edgSlotRemainVOS = edgStorageCageDetailsService.querySlotRemainWidth(cellLength, glassGap); |
| | | //按照查询结果对笼内现有玻璃的格子尺寸进行更新 |
| | | edgStorageCageService.resetSlotRemainWidth(edgSlotRemainVOS); |
| | | return Boolean.TRUE; |
| | | } |
| | | } |
| | |
| | | </if> |
| | | |
| | | </select> |
| | | <select id="querySlotRemainWidth" resultType="com.mes.edgstoragecage.entity.vo.EdgSlotRemainVO"> |
| | | select device_id,slot, if(#{cellLength} - sum(GREATEST(width,height)+#{glassGap}) < 0 ,0,#{cellLength} - |
| | | sum(GREATEST(width,height)+#{glassGap}) )as |
| | | remain_width from edg_storage_cage_details where state = 100 group by device_id,slot |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="remain_width" property="remainWidth" jdbcType="INTEGER"/> |
| | | </resultMap> |
| | | |
| | | <update id="resetSlotRemainWidth"> |
| | | <foreach collection="list" item="item" separator=";" open="begin" close=";end;"> |
| | | update edg_storage_cage set remain_width = #{item.remainWidth} where |
| | | device_id = #{item.deviceId} and slot = #{item.slot} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <select id="getEdgStorageCageBySize" resultMap="baseMap"> |
| | | select t.* |
| | | from edg_storage_cage t |
New file |
| | |
| | | package com.mes.bigstorage.entity.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/6/11 16:45 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class BigStorageSummaryDTO { |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | private String engineerId; |
| | | |
| | | /** |
| | | * 笼内总炉数 |
| | | */ |
| | | private Integer countTemp; |
| | | |
| | | /** |
| | | * 笼内玻璃数量 |
| | | */ |
| | | private Integer countGlass; |
| | | |
| | | /** |
| | | * 面积 |
| | | */ |
| | | private Double area; |
| | | |
| | | /** |
| | | * 满炉数 |
| | | */ |
| | | private Integer fullTemp; |
| | | |
| | | /** |
| | | * 占用格子数 |
| | | */ |
| | | private Integer countSlot; |
| | | |
| | | /** |
| | | * 进度 |
| | | */ |
| | | private Double percent; |
| | | |
| | | } |
| | |
| | | |
| | | import com.github.yulichang.base.MPJBaseMapper; |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | public interface BigStorageCageMapper extends MPJBaseMapper<BigStorageCage> { |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(@Param(value = "thickness") double thickness); |
| | | |
| | | List<BigStorageSummaryDTO> selectBigStorageSummary(); |
| | | // |
| | | // List<Integer> queryFreeDeviceByNotUsed(@Param(value = "thickness") double thickness); |
| | | } |
| | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageAndDetailsDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO; |
| | | import com.mes.bigstorage.entity.vo.BigStorageDetailsQueryVO; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | |
| | |
| | | |
| | | List<Integer> queryFreeDeviceByUsed(double thickness); |
| | | |
| | | List<BigStorageSummaryDTO> selectBigStorageSummary(); |
| | | |
| | | // List<Integer> queryFreeDeviceByNotUsed(double thickness); |
| | | } |
| | |
| | | import com.mes.bigstorage.entity.BigStorageCage; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageAndDetailsDTO; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO; |
| | | import com.mes.bigstorage.entity.vo.BigStorageDetailsQueryVO; |
| | | import com.mes.bigstorage.mapper.BigStorageCageDetailsMapper; |
| | | import com.mes.bigstorage.mapper.BigStorageCageMapper; |
| | |
| | | return baseMapper.queryFreeDeviceByUsed(thickness); |
| | | } |
| | | |
| | | @Override |
| | | public List<BigStorageSummaryDTO> selectBigStorageSummary() { |
| | | return baseMapper.selectBigStorageSummary(); |
| | | } |
| | | |
| | | // @Override |
| | | // public List<Integer> queryFreeDeviceByNotUsed(double thickness) { |
| | | // return baseMapper.queryFreeDeviceByNotUsed(thickness); |
| | |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.BigStorageSummaryDTO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | |
| | | List<Map<String, Object>> bigStorageCageUsage = bigStorageCageService.selectBigStorageCageUsage(); |
| | | jsonObject.append("bigStorageCageUsage", bigStorageCageUsage); |
| | | |
| | | //大理片汇总信息 |
| | | List<BigStorageSummaryDTO> bigStorageSummary = bigStorageCageService.selectBigStorageSummary(); |
| | | jsonObject.append("bigStorageSummary", bigStorageSummary); |
| | | |
| | | //打印开关 |
| | | boolean autoPrint = false; |
| | |
| | | } |
| | | //按照玻璃厚度分组,判断剩余格子是否可以存放 |
| | | Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting())); |
| | | for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) { |
| | | int count = bigStorageCageService.count(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .le(BigStorageCage::getMinThickness, entry.getKey()) |
| | | .ge(BigStorageCage::getMaxThickness, entry.getKey())); |
| | | if (count < entry.getValue()) { |
| | | log.info("笼内格子剩余数量不足,结束本次进片"); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | if(glassInfoList.get(0).getThickness() < slotMaxthickness){ |
| | | for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) { |
| | | int count = bigStorageCageService.count(new LambdaQueryWrapper<BigStorageCage>() |
| | | .eq(BigStorageCage::getEnableState, Const.SLOT_ON).eq(BigStorageCage::getRemainWidth, slotWidth) |
| | | .le(BigStorageCage::getMinThickness, entry.getKey()) |
| | | .ge(BigStorageCage::getMaxThickness, entry.getKey())); |
| | | if (count < entry.getValue()) { |
| | | log.info("笼内格子剩余数量不足,结束本次进片"); |
| | | //todo:向plc发送报警 |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | //todo:超大尺寸 |
| | | if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() > slotMaxthickness) { |
| | | if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) { |
| | | int count = bigStorageCageDetailsService.count(new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getSlot, THROUGH_SLOT) |
| | | .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)); |
| | |
| | | //计算目标格子 |
| | | List<BigStorageCageHistoryTask> historyTasks = new ArrayList<>(); |
| | | //超大尺寸与正常尺寸玻璃计算方式不一样 |
| | | if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight())) { |
| | | if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) { |
| | | for (BigStorageCageTask task : inTaskList) { |
| | | GlassInfo info = glassListMap.get(task.getGlassId()).get(0); |
| | | BigStorageDTO bigStorageDTO = bigStorageGlassInfoService.queryBigStorageTargetSlot(info.getEngineerId(), info.getTemperingLayoutId(), info.getTemperingFeedSequence()); |
| | |
| | | <?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="com.mes.bigstorage.mapper.BigStorageCageMapper"> |
| | | <resultMap id="downStorageCageDetails" type="com.mes.bigstorage.entity.dto.BigStorageSummaryDTO"> |
| | | <result column="engineer_id" property="engineerId"/> |
| | | <result column="countTemp" property="countTemp"/> |
| | | <result column="countGlass" property="countGlass"/> |
| | | <result column="area" property="area"/> |
| | | <result column="fullTemp" property="fullTemp"/> |
| | | <result column="countSlot" property="countSlot"/> |
| | | <result column="percent" property="percent"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <select id="queryFreeDeviceByUsed" resultType="java.lang.Integer"> |
| | |
| | | COUNT(DISTINCT T1.SLOT) |
| | | </select> |
| | | |
| | | <select id="selectBigStorageSummary" resultType="com.mes.bigstorage.entity.dto.BigStorageSummaryDTO"> |
| | | SELECT |
| | | engineer_id as engineerId, |
| | | count( tempering_layout_id ) AS countTemp, |
| | | sum( countGlass ) AS countGlass, |
| | | round( sum( area ), 2 ) as area, |
| | | sum( fullTemp ) AS fullTemp, |
| | | sum( countSlot ) AS countSlot, |
| | | sum( countGlass )/ sum( countGlass1 )* 100 AS percent, |
| | | thickness |
| | | FROM |
| | | ( |
| | | SELECT |
| | | bscd.engineer_id, |
| | | bscd.tempering_layout_id, |
| | | count(*) AS countGlass, |
| | | sum( bscd.width * bscd.height / 1000000 ) AS area, |
| | | IF |
| | | ( gi.countGlass1 = count(*), 1, 0 ) AS fullTemp, |
| | | count( DISTINCT bscd.slot ) AS countSlot, |
| | | countGlass1, |
| | | gi.thickness |
| | | FROM |
| | | big_storage_cage_details bscd |
| | | INNER JOIN ( SELECT engineer_id, tempering_layout_id, count(*) AS countGlass1, thickness FROM glass_info GROUP BY engineer_id, tempering_layout_id ) gi ON bscd.engineer_id = gi.engineer_id |
| | | AND bscd.tempering_layout_id = gi.tempering_layout_id |
| | | WHERE |
| | | bscd.state = 100 |
| | | GROUP BY |
| | | bscd.engineer_id, |
| | | bscd.tempering_layout_id |
| | | ) AS cageSummary |
| | | GROUP BY |
| | | engineer_id |
| | | ORDER BY |
| | | percent DESC, |
| | | thickness DESC, |
| | | countSlot DESC |
| | | </select> |
| | | |
| | | |
| | | |
| | | <!-- <select id="queryFreeDeviceByNotUsed" resultType="java.lang.Integer">--> |
| | | <!-- SELECT T.DEVICE_ID--> |
| | | <!-- FROM BIG_STORAGE_CAGE T--> |
| | |
| | | } |
| | | rawGlassStorageDetailsService.update(new LambdaUpdateWrapper<RawGlassStorageDetails>().eq(RawGlassStorageDetails::getId, one.getId()) |
| | | .set(RawGlassStorageDetails::getState, Const.RAW_GLASS_STATE_CAR)); |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | |
| | | } |
| | | RawGlassStorageTask task = rawGlassStorageTaskService.getOne(new LambdaQueryWrapper<RawGlassStorageTask>() |
| | | .in(RawGlassStorageTask::getTaskState, Const.RAW_GLASS_TASK_NEW)); |
| | | RawGlassStorageDetails targetDetails = generateDetails(details, task.getEndSlot()); |
| | | RawGlassStorageDetails targetDetails = rawGlassStorageDetailsService.generateDetails(details, task.getEndSlot()); |
| | | int deviceId = details.getDeviceId(); |
| | | Integer taskType = task.getTaskType(); |
| | | if ("1".equals(value)) { |
| | |
| | | } |
| | | //生成复位任务 |
| | | |
| | | rawGlassStorageDetailsService.generateTask(rawGlassList.get(0).getSlot(), rawGlassList.get(0).getShelf(), rawGlassList.get(0).getShelf(), rawGlassList.get(0).getRemainQuantity(), Const.RAW_GLASS_TASK_TYPE_DISPATCH); |
| | | // rawGlassStorageDetailsService.generatask(rawGlassList.get(0).getSlot(), rawGlassList.get(0).getShelf(), rawGlassList.get(0).getShelf(), rawGlassList.get(0).getRemainQuantity(), Const.RAW_GLASS_TASK_TYPE_DISPATCH); |
| | | |
| | | // List<ReadWriteEntity> list = new ArrayList<>(); |
| | | // list.add(generateReadWriteEntity("CC.CC.taskWord", 1)); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | private RawGlassStorageDetails generateDetails(RawGlassStorageDetails details, Integer targetSlot) { |
| | | RawGlassStorageDetails targetDetails = new RawGlassStorageDetails(); |
| | | RawGlassStorageStation station = rawGlassStorageStationService.getOne(new LambdaQueryWrapper<RawGlassStorageStation>() |
| | | .eq(RawGlassStorageStation::getSlot, targetSlot)); |
| | | targetDetails.setDeviceId(station.getDeviceId()); |
| | | targetDetails.setSlot(targetSlot); |
| | | targetDetails.setShelf(details.getShelf()); |
| | | targetDetails.setPatternWidth(details.getPatternWidth()); |
| | | targetDetails.setPatternHeight(details.getPatternHeight()); |
| | | targetDetails.setPatternThickness(details.getPatternThickness()); |
| | | targetDetails.setFilmsId(details.getFilmsId()); |
| | | targetDetails.setRemainQuantity(details.getRemainQuantity()); |
| | | targetDetails.setCreateTime(new Date()); |
| | | targetDetails.setState(Const.RAW_GLASS_STATE_IN); |
| | | return targetDetails; |
| | | } |
| | | |
| | | |
| | | private ReadWriteEntity generateReadWriteEntity(String identifier, int value) { |
| | | ReadWriteEntity readWriteEntity = new ReadWriteEntity(); |
| | |
| | | package com.mes.rawglasstask.controller; |
| | | |
| | | |
| | | import com.mes.rawglasstask.entity.RawGlassStorageTask; |
| | | import com.mes.rawglasstask.entity.request.RawGlassTaskRequest; |
| | | import com.mes.rawglasstask.service.RawGlassStorageTaskService; |
| | | import com.mes.utils.Result; |
| | |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | return Result.build(200, "查询成功", rawGlassStorageTaskService.setRawGlassTaskRequest(request)); |
| | | } |
| | | |
| | | @ApiOperation("按照条件查看仓储历史任务") |
| | | @PostMapping("/queryRawGlassHistoryTask") |
| | | public Result<List<RawGlassStorageTask>> queryRawGlassHistoryTask(@RequestBody RawGlassTaskRequest request) { |
| | | return Result.build(200, "查询成功", rawGlassStorageTaskService.queryRawGlassHistoryTask(request)); |
| | | } |
| | | |
| | | @ApiOperation("任务成功处理") |
| | | @PostMapping("/taskSuccess") |
| | | public Result<Boolean> taskSuccess(@RequestBody Long taskId) { |
| | | return Result.build(200, "查询成功", rawGlassStorageTaskService.taskSuccess(taskId)); |
| | | } |
| | | |
| | | @ApiOperation("任务失败处理") |
| | | @PostMapping("/taskError") |
| | | public Result<Boolean> taskError(@RequestBody Long taskId) { |
| | | return Result.build(200, "查询成功", rawGlassStorageTaskService.taskError(taskId)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.engineering.entity.Engineering; |
| | | import com.mes.engineering.service.EngineeringService; |
| | | import com.mes.opctask.entity.LoadGlassDeviceTask; |
| | | import com.mes.opctask.service.LoadGlassDeviceTaskService; |
| | | import com.mes.pp.service.OptimizeProjectService; |
| | | import com.mes.tools.DateUtil; |
| | | import com.mes.tools.WebSocketServer; |
| | | import com.mes.uppattenusage.entity.UpPattenUsage; |
| | | import com.mes.uppattenusage.service.UpPattenUsageService; |
| | |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | private OptimizeProjectService optimizeProjectService; |
| | | @Autowired |
| | | RedisUtil redisUtil; |
| | | @Resource |
| | | private LoadGlassDeviceTaskService loadGlassDeviceTaskService; |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | |
| | | private static final String LOAD_GLASS_DEVICE_ONE_TASK = "load_glass_device_one_task"; |
| | | |
| | | private static final String LOAD_GLASS_DEVICE_TWO_TASK = "load_glass_device_two_task"; |
| | | |
| | | /** |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | | //获取联机状态 |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | // @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassReport() { |
| | | //获取是否有汇报 |
| | | String loadStatus = plcParameterObject.getPlcParameter("PlcStatus").getValue(); |
| | |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void loadGlassHome() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | if(upPattenUsages!=null){ |
| | | jsonObject.append("prioritylist", upPattenUsages); |
| | | } |
| | | //查询1号线的任务 |
| | | Engineering request = redisUtil.getCacheObject("loadGlassRequest"); |
| | | if (request == null) { |
| | | request = new Engineering(); |
| | | request.setStationCell(5); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages1 = upPattenUsageService.selectLoadTask(request); |
| | | jsonObject.append("loadTask1", upPattenUsages1); |
| | | //查询2号线的任务 |
| | | Engineering request2 = redisUtil.getCacheObject("loadGlassRequest2"); |
| | | if (request2 == null) { |
| | | request2 = new Engineering(); |
| | | request2.setStationCell(6); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages2 = upPattenUsageService.selectLoadTask(request2); |
| | | jsonObject.append("loadTask2", upPattenUsages2); |
| | | //查询工位任务 |
| | | |
| | | try { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | | List<UpPattenUsage> upPattenUsages = upPattenUsageService.prioritylist(); |
| | | if(upPattenUsages!=null){ |
| | | jsonObject.append("prioritylist", upPattenUsages); |
| | | } |
| | | //查询1号线的任务 |
| | | Engineering request = redisUtil.getCacheObject("loadGlassRequest"); |
| | | if (request == null) { |
| | | request = new Engineering(); |
| | | request.setStationCell(5); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages1 = upPattenUsageService.selectLoadTask(request); |
| | | jsonObject.append("loadTask1", upPattenUsages1); |
| | | //查询2号线的任务 |
| | | Engineering request2 = redisUtil.getCacheObject("loadGlassRequest2"); |
| | | if (request2 == null) { |
| | | request2 = new Engineering(); |
| | | request2.setStationCell(6); |
| | | } |
| | | List<UpPattenUsage> upPattenUsages2 = upPattenUsageService.selectLoadTask(request2); |
| | | jsonObject.append("loadTask2", upPattenUsages2); |
| | | // 查询工位任务 |
| | | //联机状态 |
| | | LoadGlassDeviceTask LoadOneState = loadGlassDeviceTaskService.queryTaskMessage(LOAD_GLASS_DEVICE_ONE_TASK); |
| | | LoadGlassDeviceTask LoadTwoState = loadGlassDeviceTaskService.queryTaskMessage(LOAD_GLASS_DEVICE_TWO_TASK); |
| | | jsonObject.append("LoadOneState", LoadOneState.getInkageState()); |
| | | jsonObject.append("LoadTwoervice", LoadTwoState.getInkageState()); |
| | | |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | jsonObject.append("list", upWorkstations); |
| | | //工位信息 |
| | | List<UpWorkstation> upWorkstations = upWorkstationService.list(); |
| | | jsonObject.append("list", upWorkstations); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("loadGlass"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | // } |
| | | } else { |
| | | log.info("loadGlass is closed"); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void send() { |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("mainMes"); |
| | | if (sendwServer != null) { |
| | | //推送服务器当前时间 |
| | | JSONObject jsonObject = new JSONObject(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | jsonObject.append("globalDate", sdf.format(DateUtil.getEndDate())); |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | // List<String> messages = webserver.getMessages(); |
| | | // if (!messages.isEmpty()) { |
| | | // // // 将最后一个消息转换为整数类型的列表 |
| | | // webserver.clearMessages(); |
| | | // } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | log.info("mainMes is closed"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedDelay = 5000) |
| | | // @Scheduled(fixedDelay = 5000) |
| | | public void loadGlassStatus() { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | //正在进行的任务 |
| | |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | log.info("loadGlass is closed"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | } else { |
| | | log.info("Home is closed"); |
| | | log.info("loadGlassIsRun is closed"); |
| | | } |
| | | } |
| | | } |
| | |
| | | * 缺少数量 |
| | | */ |
| | | private int lackCount; |
| | | /** |
| | | * 占用格子 |
| | | */ |
| | | private int slotCount; |
| | | } |
| | |
| | | |
| | | Map<String, List<FlowCardGlassInfoDTO>> queryHollowAllFlowCard(HollowBigStorageDetailsQueryVO query); |
| | | |
| | | Map<String, FlowCardGlassInfoDTO> queryHollowAllFlowCardSummary(HollowBigStorageDetailsQueryVO query); |
| | | |
| | | Map<Integer, List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId); |
| | | |
| | | int queryLayerByFlowCardId(String flowCardId); |
| | |
| | | public void generateHollowGlassInfo(String flowCardId, int totalLayer, int layer) { |
| | | |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId) |
| | | .eq(GlassInfo::getLayer, layer).last("limit 1")); |
| | | .eq(GlassInfo::getLayer, layer).orderByDesc(GlassInfo::getId).last("limit 1")); |
| | | if (null == glassInfo) { |
| | | log.info("当前流程卡信息为导入mes系统流程卡:{},层数{}", flowCardId, layer); |
| | | return; |
| | |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | dtos.addAll(hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE)); |
| | | }); |
| | | Map<String, FlowCardGlassInfoDTO> result = dtos.stream() |
| | | .collect(Collectors.toMap( |
| | | FlowCardGlassInfoDTO::getFlowCardId, |
| | | dto -> { |
| | | FlowCardGlassInfoDTO newDto = new FlowCardGlassInfoDTO(); |
| | | newDto.setFlowCardId(dto.getFlowCardId()); |
| | | newDto.setSumCount(dto.getSumCount()); |
| | | newDto.setPairCount(dto.getPairCount()); |
| | | newDto.setRealCount(dto.getRealCount()); |
| | | newDto.setLayer(dto.getLayer()); |
| | | return newDto; |
| | | }, |
| | | (dto1, dto2) -> { |
| | | dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 累加 realCount |
| | | dto1.setLayer(Math.max(dto1.getLayer(),dto2.getLayer())); // 累加 最大层数 |
| | | return dto1; // 返回合并后的对象 |
| | | } |
| | | )); |
| | | return dtos.stream().collect(Collectors.groupingBy(FlowCardGlassInfoDTO::getFlowCardId)); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, FlowCardGlassInfoDTO> queryHollowAllFlowCardSummary(HollowBigStorageDetailsQueryVO query) { |
| | | List<HollowBigStorageCageDetails> detailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .like(StringUtils.isNotBlank(query.getFilmsId()), HollowBigStorageCageDetails::getFilmsId, query.getFilmsId()) |
| | | .like(StringUtils.isNotBlank(query.getFlowCardId()), HollowBigStorageCageDetails::getFlowCardId, query.getFlowCardId()) |
| | | .eq(query.getThickness() != 0, HollowBigStorageCageDetails::getThickness, query.getThickness()) |
| | | .orderByAsc(HollowBigStorageCageDetails::getFlowCardId) |
| | | ); |
| | | if (CollectionUtil.isEmpty(detailsList)) { |
| | | log.info("笼内无玻璃"); |
| | | return new HashMap<>(); |
| | | } |
| | | Map<String, List<HollowBigStorageCageDetails>> listMap = detailsList.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getFlowCardId)); |
| | | List<FlowCardGlassInfoDTO> dtos = new ArrayList<>(); |
| | | listMap.forEach((e, v) -> { |
| | | HollowBigStorageCageDetails cageDetails = v.get(0); |
| | | dtos.addAll(hollowBigStorageCageDetailsService.hollowIsAll(e, cageDetails.getTotalLayer(), Boolean.FALSE)); |
| | | }); |
| | | Map<String, FlowCardGlassInfoDTO> result = dtos.stream() |
| | | .collect(Collectors.toMap( |
| | | FlowCardGlassInfoDTO::getFlowCardId, |
| | | dto -> { |
| | | FlowCardGlassInfoDTO newDto = new FlowCardGlassInfoDTO(); |
| | | newDto.setFlowCardId(dto.getFlowCardId()); |
| | | newDto.setSumCount(dto.getSumCount()); |
| | | newDto.setPairCount(dto.getPairCount()); |
| | | newDto.setRealCount(dto.getRealCount()); |
| | | newDto.setLayer(dto.getLayer()); |
| | | newDto.setSlotCount(dto.getSlotCount()); |
| | | return newDto; |
| | | }, |
| | | (dto1, dto2) -> { |
| | | dto1.setRealCount(dto1.getRealCount() + dto2.getRealCount()); // 累加 realCount |
| | | dto1.setLayer(Math.max(dto1.getLayer(),dto2.getLayer())); // 累加 最大层数 |
| | | dto1.setSlotCount(dto1.getSlotCount() + dto2.getSlotCount()); |
| | | return dto1; // 返回合并后的对象 |
| | | } |
| | | )); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId) { |
| | | List<LackDetailsDTO> lackDetailsList = this.baseMapper.queryLackByFlowCard(flowCardId); |
| | | Map<Integer, List<LackDetailsDTO>> listMap = lackDetailsList.stream().collect(Collectors.groupingBy(LackDetailsDTO::getLayer)); |
| | |
| | | import com.mes.common.config.Const; |
| | | import com.mes.hollow.entity.HollowBigStorageCageDetails; |
| | | import com.mes.hollow.entity.HollowGlassOutRelationInfo; |
| | | import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO; |
| | | import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO; |
| | | import com.mes.hollow.service.HollowBigStorageCageDetailsService; |
| | | import com.mes.hollow.service.HollowBigStorageCageService; |
| | | import com.mes.hollow.service.HollowGlassOutRelationInfoService; |
| | | import com.mes.hollow.service.HollowGlassRelationInfoService; |
| | | import com.mes.hollowqueue.entity.HollowGlassQueueInfo; |
| | | import com.mes.hollowqueue.service.HollowGlassQueueInfoService; |
| | | import com.mes.tools.WebSocketServer; |
| | |
| | | HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService; |
| | | @Resource |
| | | BigStorageCageTaskService bigStorageCageTaskService; |
| | | @Resource |
| | | HollowGlassRelationInfoService hollowGlassRelationInfoService; |
| | | |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | |
| | | //理片笼使用情况 |
| | | List<Map<String, Object>> bigStorageCageUsage = hollowBigStorageCageService.selectBigStorageCageUsage(); |
| | | jsonObject.append("bigStorageCageUsage", bigStorageCageUsage); |
| | | |
| | | //理片笼使用情况汇总 |
| | | HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO=new HollowBigStorageDetailsQueryVO(); |
| | | Map<String, FlowCardGlassInfoDTO> bigStorageCageUsageSummary= hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO); |
| | | jsonObject.append("bigStorageCageUsageSummary", bigStorageCageUsageSummary); |
| | | } |
| | | |
| | | } |
| | |
| | | <select id="hollowIsAll" resultMap="baseMap"> |
| | | WITH sum_flow_layer_count AS ( SELECT flow_card_id, layer, min( films_id ) AS films_id, min(thickness) as |
| | | thickness,count(*) AS sum_count FROM hollow_glass_relation_info GROUP BY flow_card_id, layer ), |
| | | real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count FROM |
| | | real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count, count(distinct slot) as slot_count FROM |
| | | hollow_big_storage_cage_details t WHERE state = 100 GROUP BY flow_card_id, layer ), |
| | | damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) as |
| | | damage_count FROM damage where type in(8,9) GROUP BY process_id, technology_number ), |
| | |
| | | IFNULL( t3.pair_count, 0 ) AS pair_count, |
| | | IFNULL( real_count, 0 ) AS real_count, |
| | | IFNULL( damage_count, 0 ) AS damage_count, |
| | | IFNULL( lack_count, 0 ) AS lack_count |
| | | IFNULL( lack_count, 0 ) AS lack_count, |
| | | IFNULL(slot_count,0) AS slot_count |
| | | FROM |
| | | sum_flow_layer_count t |
| | | LEFT JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id |