1、原片仓储新增任务完成/任务失败接口供用户异常情况恢复处理
2、原片仓储新增历史任务查询按钮
3、卧式理片新增任务完成/任务失败接口供用户异常情况恢复处理
4、大理片笼临时修改:10mm及以上厚度的玻璃走直通任务,厚度可按照实际情况进行配置
5、fixbug:中空理片笼10mm厚度玻璃进入理片笼小格子异常问题查询,同一个流程卡同一层出现2种厚度,导致厚度赋值异常,目前已改为查询最后一次导入的为准
| | |
| | | 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 |
| | |
| | | } |
| | | //按照玻璃厚度分组,判断剩余格子是否可以存放 |
| | | 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()); |
| | |
| | | } |
| | | 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)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | * fixedRate : 上一个调用开始后再次调用的延时(不用等待上一次调用完成) |
| | | * fixedDelay : 上一个调用结束后再次调用的延时 |
| | | */ |
| | | |
| | | @Scheduled(fixedDelay = 300) |
| | | public void plcLoadGlassTask() throws InterruptedException { |
| | | try { |
| | |
| | | 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; |