1、中空线初步版本,待优化 2、fixbug 钢化后摆片顺序错乱
New file |
| | |
| | | package com.mes.base.entity; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @Author : zhoush |
| | | * @Date: 2024/6/21 9:40 |
| | | * @Description: |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageCageBaseInfo { |
| | | |
| | | /** |
| | | * 工程号 |
| | | */ |
| | | @ApiModelProperty(value = "工程号", position = 16) |
| | | private String engineerId; |
| | | /** |
| | | * 玻璃id |
| | | */ |
| | | @ApiModelProperty(value = "玻璃id") |
| | | private String glassId; |
| | | /** |
| | | * 钢化版图id |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图id", position = 12) |
| | | private Integer temperingLayoutId; |
| | | |
| | | /** |
| | | * 钢化版图片序 |
| | | */ |
| | | @ApiModelProperty(value = "钢化版图片序", position = 13) |
| | | private Integer temperingFeedSequence; |
| | | |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty(value = "宽") |
| | | private double width; |
| | | /** |
| | | * 宽 |
| | | */ |
| | | @ApiModelProperty(value = "高") |
| | | private double height; |
| | | |
| | | /** |
| | | * 格子号 |
| | | */ |
| | | @ApiModelProperty(value = "玻璃id") |
| | | private Integer slot; |
| | | |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer layer; |
| | | |
| | | /** |
| | | * 格子号 |
| | | */ |
| | | @ApiModelProperty(value = "玻璃id") |
| | | |
| | | private Integer isPair; |
| | | } |
| | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Value("${mes.sequence.order}") |
| | | private boolean sequenceOrder; |
| | | @Value("${mes.temperingOutTargetPosition}") |
| | | private Integer temperingOutTargetPosition; |
| | | @Value("${mes.artificialOutTargetPosition}") |
| | |
| | | //是否允许钢化 |
| | | //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息 |
| | | // 获取当前钢化任务未完成出片的玻璃信息 |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW)); |
| | | List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>() |
| | | .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) { |
| | | // List<String> glassIdList = unFinishTemperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList()); |
| | | // List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>() |
| | |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId()) |
| | | .eq(GlassInfo::getEngineerId, item.getEngineerId()) |
| | | .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence)); |
| | | .orderByAsc(GlassInfo::getTemperingFeedSequence)); |
| | | if (CollectionUtil.isNotEmpty(temperingGlassInfos)) { |
| | | temperingGlassInfoService.saveBatch(temperingGlassInfos); |
| | | computeOutGlassInfoByVirtualSlot(temperingGlassInfos, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT); |
| | |
| | | log.info("将出片玻璃{}玻璃状态改为出片中", glassIds); |
| | | bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, state) |
| | | .set(Const.RAW_GLASS_TASK_TYPE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .set(Const.BIG_STORAGE_BEFORE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(BigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | |
| | | |
| | | @ApiOperation("领取任务") |
| | | @PostMapping("/receiveTask") |
| | | public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell) { |
| | | return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell)); |
| | | public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell, int totalPairQuantity) { |
| | | return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @since 2024-11-21 09:23:12 |
| | | */ |
| | | @Data |
| | | public class HollowBigStorageCageDetails extends BigStorageCageBaseInfo { |
| | | public class HollowBigStorageCageDetails extends HollowBigStorageCageBaseInfo { |
| | | /** |
| | | * /*大理片笼详情表id |
| | | */ |
| | |
| | | * /*层号 |
| | | */ |
| | | private Integer hollowSequence; |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer layer; |
| | | |
| | | /** |
| | | * 创建时间 |
| | |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | private Integer state; |
| | | /** |
| | | * 总配对数量 |
| | | */ |
| | | private Integer totalPairQuantity; |
| | | /** |
| | | * 已完成配对数量 |
| | | */ |
| | | private Integer pairQuantity; |
| | | /** |
| | | * /*创建时间 |
| | | */ |
| | | private Date createTime; |
| | |
| | | */ |
| | | private String flowCardId; |
| | | /** |
| | | * 层号 |
| | | */ |
| | | private Integer layer; |
| | | /** |
| | | * /*虚拟格子 |
| | | */ |
| | | private Integer virtualSlot; |
| | |
| | | |
| | | List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO); |
| | | |
| | | List<HollowBigStorageCageDetails> queryOutGlassList(@Param("flowCardId") String flowCardId, @Param("cell") int cell); |
| | | } |
| | | |
| | |
| | | |
| | | List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO); |
| | | |
| | | List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell); |
| | | } |
| | | |
| | |
| | | */ |
| | | public interface HollowGlassOutRelationInfoService extends IService<HollowGlassOutRelationInfo> { |
| | | |
| | | HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell); |
| | | HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity); |
| | | } |
| | | |
| | |
| | | public List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO) { |
| | | return baseMapper.queryNeedDispatchSlot(flowCardVirtualSlotDTO); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell) { |
| | | return baseMapper.queryOutGlassList(flowCardId, cell); |
| | | } |
| | | } |
| | | |
| | |
| | | GlassInfoService glassInfoService; |
| | | |
| | | @Override |
| | | public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell) { |
| | | public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity) { |
| | | GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId).last("limit 1")); |
| | | HollowGlassOutRelationInfo info = new HollowGlassOutRelationInfo(); |
| | | if (null == glassInfo) { |
| | |
| | | info.setTotalLayer(glassInfo.getTotalLayer()); |
| | | info.setTotalLayer(glassInfo.getTotalLayer()); |
| | | info.setState(Const.HOLLOW_FLOW_CARD_NEW); |
| | | info.setTotalPairQuantity(totalPairQuantity); |
| | | this.save(info); |
| | | return info; |
| | | } |
| | |
| | | |
| | | @ApiOperation("强制出片") |
| | | @PostMapping("/forceOutGlass") |
| | | public Result<String> forceOutGlass(String flowCardId, int cell) { |
| | | hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell); |
| | | return Result.success("success"); |
| | | } |
| | | |
| | | @ApiOperation("切换线路强制出片") |
| | | @PostMapping("/changeForceOutGlass") |
| | | public Result<String> changeForceOutGlass(String flowCardId, int cell) { |
| | | hollowGlassQueueInfoService.changeForceOutGlass(flowCardId, cell); |
| | | public Result<String> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) { |
| | | hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity); |
| | | return Result.success("success"); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | |
| | | * @since 2024-11-30 10:19:55 |
| | | */ |
| | | @Data |
| | | public class HollowGlassQueueInfo extends BigStorageCageBaseInfo { |
| | | public class HollowGlassQueueInfo extends HollowBigStorageCageBaseInfo { |
| | | /** |
| | | * /*大理片笼详情表id |
| | | */ |
| | |
| | | * /*总层号 |
| | | */ |
| | | private Integer totalLayer; |
| | | /** |
| | | * /*层号 |
| | | */ |
| | | private Integer layer; |
| | | /** |
| | | * /*创建时间 |
| | | */ |
| | |
| | | */ |
| | | public interface HollowGlassQueueInfoService extends IService<HollowGlassQueueInfo> { |
| | | |
| | | void forceOutGlass(String flowCardId, int cell); |
| | | |
| | | void changeForceOutGlass(String flowCardId, int cell); |
| | | void forceOutGlass(String flowCardId, int cell, int totalPairQuantity); |
| | | |
| | | List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell); |
| | | } |
| | |
| | | HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService; |
| | | |
| | | @Override |
| | | public void forceOutGlass(String flowCardId, int cell) { |
| | | hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell); |
| | | public void forceOutGlass(String flowCardId, int cell, int totalPairQuantity) { |
| | | hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity); |
| | | hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId) |
| | | .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId) |
| | | .orderByAsc(HollowBigStorageCageDetails::getVirtualSlot) |
| | | .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getSequence) |
| | | .orderByAsc(HollowBigStorageCageDetails::getHollowSequence) |
| | | ); |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell); |
| | | |
| | | List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | |
| | | }).collect(Collectors.toList()); |
| | | this.saveBatch(hollowQueues); |
| | | } |
| | | |
| | | @Override |
| | | public void changeForceOutGlass(String flowCardId, int cell) { |
| | | hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId) |
| | | .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START) |
| | | ); |
| | | //情况历史任务中未做完的玻璃信息 |
| | | this.remove(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, flowCardId) |
| | | .eq(HollowGlassQueueInfo::getCell, cell) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | ); |
| | | //按照线路重新去理片笼查询玻璃信息 |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId) |
| | | .orderByAsc(HollowBigStorageCageDetails::getVirtualSlot) |
| | | .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getSequence) |
| | | .orderByAsc(HollowBigStorageCageDetails::getHollowSequence) |
| | | ); |
| | | |
| | | List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | | BeanUtils.copyProperties(queue, queueInfo); |
| | | queueInfo.setState(Const.TEMPERING_NEW); |
| | | queueInfo.setCell(cell); |
| | | return queueInfo; |
| | | }).collect(Collectors.toList()); |
| | | this.saveBatch(hollowQueues); |
| | | } |
| | | |
| | | @Override |
| | | public List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell) { |
| | | HollowGlassOutRelationInfo one = hollowGlassOutRelationInfoService.getOne(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.kangaroohy.milo.model.ReadWriteEntity; |
| | | import com.kangaroohy.milo.service.MiloService; |
| | | import com.mes.base.entity.BigStorageCageBaseInfo; |
| | | import com.mes.base.entity.HollowBigStorageCageBaseInfo; |
| | | import com.mes.bigstoragecagetask.entity.BigStorageCageTask; |
| | | import com.mes.bigstoragecagetask.service.BigStorageCageTaskService; |
| | | import com.mes.common.config.Const; |
| | |
| | | private HollowGlassQueueInfoService hollowGlassQueueInfoService; |
| | | @Resource |
| | | private HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService; |
| | | |
| | | private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task"; |
| | | private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task"; |
| | | @Autowired(required = false) |
| | | MiloService miloService; |
| | | @Resource |
| | |
| | | |
| | | @Value("${mes.outCarMaxSize}") |
| | | private Integer outCarMaxSize; |
| | | |
| | | @Value("${mes.sequence.order}") |
| | | private boolean sequenceOrder; |
| | | |
| | | @Value("${mes.temperingOutTargetPosition}") |
| | | private Integer temperingOutTargetPosition; |
| | | @Value("${mes.artificialOutTargetPosition}") |
| | | private Integer artificialOutTargetPosition; |
| | | |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void inBigStorageTask() throws Exception { |
| | |
| | | .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot())); |
| | | task.setTargetSlot(bigStorageDTO.getSlot()); |
| | | task.setGlassId(info.getGlassId()); |
| | | bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task); |
| | | bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task); |
| | | //存放历史任务 |
| | | HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask(); |
| | | BeanUtils.copyProperties(task, historyTask); |
| | |
| | | return; |
| | | } |
| | | //获取出片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_two_task"); |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | if (CollectionUtil.isNotEmpty(outTaskList)) { |
| | | log.info("有正在执行的出片任务,结束本次出片任务"); |
| | | return; |
| | |
| | | List<HollowGlassQueueInfo> unFinishHollowQueueList = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>() |
| | | .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId()) |
| | | .eq(HollowGlassQueueInfo::getCell, cell) |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)); |
| | | .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW) |
| | | .orderByAsc(HollowGlassQueueInfo::getHollowSequence)); |
| | | if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) { |
| | | log.info("有正在出片的中空任务"); |
| | | computeOutGlassInfo(unFinishHollowQueueList, "big_storage_cage_out_two_task", hollowGlassOutRelationInfo.getCell(), Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT); |
| | | Integer isPair = unFinishHollowQueueList.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer()); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | |
| | | //玻璃到齐包括已出片的 |
| | | //到齐,将玻璃小片数据存入中空小片表,逻辑生成出片任务 结束 |
| | | for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) { |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | .eq(HollowBigStorageCageDetails::getFlowCardId, item.getFlowCardId()) |
| | | .orderByAsc(HollowBigStorageCageDetails::getHollowSequence) |
| | | .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getLayer) |
| | | ); |
| | | List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell); |
| | | int finalCell = cell; |
| | | List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> { |
| | | HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo(); |
| | |
| | | }).collect(Collectors.toList()); |
| | | if (CollectionUtil.isNotEmpty(hollowQueues)) { |
| | | hollowGlassQueueInfoService.saveBatch(hollowQueues); |
| | | computeOutGlassInfo(hollowQueues, "big_storage_cage_out_two_task", cell, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT); |
| | | Integer isPair = hollowQueues.get(0).getIsPair(); |
| | | hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer()); |
| | | //将中空任务状态改为开始 |
| | | hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>() |
| | | .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId()) |
| | |
| | | } |
| | | } |
| | | } |
| | | //是否有人工下片任务 有直接出 |
| | | List<HollowBigStorageCageDetails> artificialList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) |
| | | .orderByAsc(HollowBigStorageCageDetails::getSlot) |
| | | .orderByAsc(HollowBigStorageCageDetails::getId).last("limit " + outCarMaxSize)); |
| | | if (CollectionUtil.isNotEmpty(artificialList)) { |
| | | computeOutGlassInfo(artificialList, "big_storage_cage_out_two_task", artificialOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT); |
| | | Date endDate = new Date(); |
| | | log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime()); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // redisUtil.setCacheObject("dispatchHollowSwitch",true); |
| | | //是否存在需要内部调度的格子:执行内部调度任务 |
| | | if (redisUtil.getCacheObject("dispatchHollowSwitch")) { |
| | | //todo:获取笼内单格已经到齐的玻璃格子信息 |
| | |
| | | int targetSlot = item.getSlot(); |
| | | list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>() |
| | | .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot)); |
| | | computeOutGlassInfo(list, "big_storage_cage_out_two_task", targetSlot, Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_AFTER_DISPATCH); |
| | | hollowOutGlassByIsPair(list, targetSlot, 0, 0); |
| | | List<Integer> slotList = new ArrayList<>(); |
| | | slotList.add(targetSlot); |
| | | updateSlotRemainBySlots(slotList); |
| | |
| | | return; |
| | | } |
| | | //获取进片任务表 |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task"); |
| | | List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | if (CollectionUtil.isEmpty(outTaskList)) { |
| | | log.info("当前大车无进片玻璃,结束完成进片任务"); |
| | | return; |
| | |
| | | } |
| | | } |
| | | // 重置任务表数据 |
| | | bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task"); |
| | | bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK); |
| | | //清空启动状态 |
| | | //向opc发送启动信号 |
| | | miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0)); |
| | |
| | | log.info("出片任务-无动作执行完成"); |
| | | } |
| | | |
| | | |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer) { |
| | | List<T> resultList = new ArrayList<>(); |
| | | int taskType = Const.BIG_STORAGE_AFTER_OUT; |
| | | int taskState = Const.GLASS_STATE_OUT_ING; |
| | | for (T t : list) { |
| | | if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) { |
| | | resultList.add(t); |
| | | } |
| | | } |
| | | if (isPair == 0) { |
| | | taskType = Const.BIG_STORAGE_AFTER_DISPATCH; |
| | | taskState = Const.GLASS_STATE_SCHEDULE_ING; |
| | | totalLayer = 0; |
| | | } |
| | | return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer); |
| | | } |
| | | |
| | | /** |
| | | * 出片一次仅生成一车玻璃 |
| | | * |
| | | * @param list |
| | | * @param <T> |
| | | * @param list |
| | | * @param totalLayer |
| | | * @return |
| | | */ |
| | | private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType) { |
| | | private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer) { |
| | | //任务数据:获取车子存放玻璃最大数量,玻璃间隔 |
| | | List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>(); |
| | | List<BigStorageCageTask> tempList = new ArrayList<>(); |
| | | List<T> tempTList = new ArrayList<>(); |
| | | //打车剩余尺寸 |
| | | Integer remainWidth = carWidth; |
| | | for (T e : list) { |
| | | if (bigStorageCageTaskList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) { |
| | | if (tempList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) { |
| | | break; |
| | | } |
| | | //计算当前出片车剩尺寸 |
| | | remainWidth = remainWidth - Math.max((int) e.getWidth(), (int) e.getHeight()) - glassGap; |
| | | bigStorageCageTaskList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot, |
| | | tempTList.add(e); |
| | | tempList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot, |
| | | 0)); |
| | | } |
| | | Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", bigStorageCageTaskList.size()); |
| | | Assert.isFalse(CollectionUtil.isEmpty(tempList), "未获取出片数据,结束出片任务"); |
| | | log.info("获取出片任务数据{}条,执行保存", tempList.size()); |
| | | List<BigStorageCageTask> bigStorageCageTaskList = tempList; |
| | | if (taskType == Const.BIG_STORAGE_AFTER_OUT) { |
| | | if (tempList.size() <= totalLayer) { |
| | | bigStorageCageTaskList = tempList; |
| | | } else { |
| | | int remainCount = tempList.size() % totalLayer; |
| | | // tempList.subList(0,) |
| | | } |
| | | } |
| | | List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList()); |
| | | int glassCount = bigStorageCageTaskList.size(); |
| | | //生成出片任务条数不足6补全 |
| | |
| | | log.info("将出片玻璃{}玻璃状态改为出片中", glassIds); |
| | | hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>() |
| | | .set(HollowBigStorageCageDetails::getState, state) |
| | | .set(Const.RAW_GLASS_TASK_TYPE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot) |
| | | .set(Const.BIG_STORAGE_AFTER_DISPATCH.equals(taskType), HollowBigStorageCageDetails::getSlot, targetSlot) |
| | | .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT) |
| | | .in(HollowBigStorageCageDetails::getGlassId, glassIds)); |
| | | try { |
| | |
| | | .value(value) |
| | | .build(); |
| | | } |
| | | // |
| | | // private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) { |
| | | //// if (target == 931){} |
| | | // if (taskList.get(0).get) |
| | | // return null; |
| | | // } |
| | | } |
| | |
| | | </resultMap> |
| | | <resultMap id="virtualSlotSequenceDTO" type="com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO"> |
| | | <result column="flow_card_id" property="flowCardId"/> |
| | | <result column="layer" property="layer"/> |
| | | <result column="virtual_slot" property="virtualSlot"/> |
| | | </resultMap> |
| | | <resultMap id="baseSlotSequenceDTO" type="com.mes.hollow.entity.dto.BigStorageSequenceDTO"> |
| | |
| | | |
| | | <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO"> |
| | | with relation_temp as ( |
| | | select flow_card_id, virtual_slot, count(1) as slot_count |
| | | select flow_card_id, layer, virtual_slot, count(1) as slot_count |
| | | from hollow_glass_relation_info |
| | | group by flow_card_id, virtual_slot |
| | | group by flow_card_id, layer, virtual_slot |
| | | ), |
| | | details_temp as ( |
| | | select flow_card_id, virtual_slot, count(1) as slot_count |
| | | select flow_card_id, layer, virtual_slot, count(1) as slot_count |
| | | from hollow_big_storage_cage_details |
| | | where state = 100 |
| | | group by flow_card_id, virtual_slot |
| | | group by flow_card_id, layer, virtual_slot |
| | | ), |
| | | result_one as ( |
| | | select t.*, t1.slot_count as tslot_count |
| | | from relation_temp t |
| | | INNER JOIN details_temp t1 on t.flow_card_id = t1.flow_card_id and |
| | | t.layer = t1.layer and |
| | | t.virtual_slot = t1.virtual_slot |
| | | where t.slot_count = t1.slot_count |
| | | ) |
| | | select flow_card_id, virtual_slot |
| | | select flow_card_id, layer, virtual_slot |
| | | from result_one |
| | | order by flow_card_id, virtual_slot |
| | | order by flow_card_id, layer, virtual_slot |
| | | </select> |
| | | |
| | | <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO"> |
| | | with glass_id_temp as ( |
| | | select glass_id |
| | | from big_storage_glass_relation_info |
| | | where (flow_card_id, virtual_slot) = |
| | | (#{flowCardId}, #{virtualSlot}) |
| | | ) |
| | | select slot, max(sequence) as max_sequence, min(sequence) as min_sequence |
| | | from big_storage_cage_details |
| | | where glass_id in (select * from glass_id_temp) |
| | | and state = 100 |
| | | from hollow_big_storage_cage_details |
| | | where (flow_card_id, layer, virtual_slot) = (#{flowCardId}, #{layer}, #{virtualSlot}) |
| | | group by slot |
| | | order by max_sequence |
| | | </select> |
| | | <select id="queryOutGlassList" resultType="com.mes.hollow.entity.HollowBigStorageCageDetails"> |
| | | with flow_card_id_layer as ( |
| | | select flow_card_id, max(total_layer) as total_layer |
| | | FROM hollow_big_storage_cage_details |
| | | group by flow_card_id |
| | | ), |
| | | details_sequence_count_temp as ( |
| | | SELECT flow_card_id, hollow_sequence, count(1) as max_count |
| | | FROM hollow_big_storage_cage_details |
| | | and state = 100 |
| | | group by flow_card_id, hollow_sequence |
| | | ), |
| | | glass_out_temp as ( |
| | | select t1.*, case when t.total_layer = t1.max_count then 1 else 0 end is_pair |
| | | from flow_card_id_layer t |
| | | inner join details_sequence_count_temp t1 on t.flow_card_id = t1.flow_card_id |
| | | ), |
| | | result_detail as ( |
| | | select t.id, |
| | | t.device_id, |
| | | t.virtual_slot, |
| | | t.slot, |
| | | t.glass_id, |
| | | t.sequence, |
| | | t.flow_card_id, |
| | | t.glass_type, |
| | | t.width, |
| | | t.height, |
| | | t.thickness, |
| | | t.tempering_layout_id, |
| | | t.tempering_feed_sequence, |
| | | t.state, |
| | | t.gap, |
| | | t.engineer_id, |
| | | t.total_layer, |
| | | t.layer, |
| | | t.create_time, |
| | | t.update_time, |
| | | t.hollow_sequence, |
| | | t.films_id, |
| | | t1.is_pair |
| | | from hollow_big_storage_cage_details t |
| | | INNER JOIN glass_out_temp t1 |
| | | on t.flow_card_id = t1.flow_card_id and t.hollow_sequence = t1.hollow_sequence |
| | | where t.state = 100 |
| | | and t.flow_card_id = #{flowCardId} |
| | | ) |
| | | select * |
| | | from result_detail |
| | | order by flow_card_id, hollow_sequence |
| | | <if test="cell != 931"> |
| | | desc |
| | | </if> |
| | | </select> |
| | | </mapper> |