ZengTao
2024-07-29 e95543888fce8eb09d1d7d140158514ae1b93ff5
Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes
8个文件已修改
1个文件已添加
259 ■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/resources/mapper/TemperingGlassInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/entity/UpdateBigStorageCageDTO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
@@ -40,6 +40,7 @@
     * 出片任务101
     * 人工下片102
     * 出片中103
     * 调度中104
     * 拿走200
     * 破损201
     */
@@ -48,6 +49,7 @@
    public static final Integer GLASS_STATE_OUT = 101;
    public static final Integer GLASS_STATE_ARTIFICIAL = 102;
    public static final Integer GLASS_STATE_OUT_ING = 103;
    public static final Integer GLASS_STATE_SCHEDULE_ING = 104;
    public static final Integer GLASS_STATE_TAKE = 200;
    public static final Integer GLASS_STATE_DAMAGE = 201;
    public static final List<Integer> GLASS_STATE_IN_ALL = Arrays.asList(100, 102, 103);
hangzhoumesParent/common/servicebase/src/main/resources/mapper/TemperingGlassInfoMapper.xml
@@ -4,12 +4,12 @@
    <insert id="saveBatch">
        INSERT INTO tempering_glass_info (glass_id, flow_card_id, glass_type, width, height, thickness, filmsid,
        ishorizontal, tempering_layout_id,
        tempering_feed_sequence, x_coordinate, y_coordinate, angle, state, slot ) VALUES
        tempering_feed_sequence, x_coordinate, y_coordinate, angle, state, slot, engineer_id) VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.glassId}, #{item.flowCardId}, #{item.glassType}, #{item.width}, #{item.height}, #{item.thickness},
            #{item.filmsid},#{item.ishorizontal},
            #{item.temperingLayoutId}, #{item.temperingFeedSequence}, #{item.xCoordinate}, #{item.yCoordinate},
            #{item.angle}, #{item.state}, #{item.slot})
            #{item.angle}, #{item.state}, #{item.slot}, #{item.engineerId})
        </foreach>
    </insert>
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
@@ -1,4 +1,5 @@
package com.mes.bigstorage.controller;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
@@ -6,7 +7,10 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
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;
import java.util.Map;
@@ -78,8 +82,8 @@
    @ApiOperation("指定钢化")
    @PostMapping("/TemperingGlass")
    public Result TemperingGlass(@RequestBody BigStorageCageDetails bigStorageCageDetails) {
        boolean result=bigStorageCageDetailsService.TemperingGlass(bigStorageCageDetails.getTemperingLayoutId().toString(),bigStorageCageDetails.getEngineerId());
    public Result temperingGlass(@RequestBody BigStorageCageDetails bigStorageCageDetails) {
        boolean result = bigStorageCageDetailsService.temperingGlass(bigStorageCageDetails.getTemperingLayoutId().toString(), bigStorageCageDetails.getEngineerId());
        if(result==true){
            return Result.build(200,"指定钢化成功",1);
        }else {
@@ -92,5 +96,11 @@
    public Result selectTemperingGlass() {
        return Result.build(200,"查询成功",bigStorageCageDetailsService.selectTemperingGlass());
    }
    @ApiOperation("是否钢化开关")
    @PostMapping("/temperingSwitch")
    public Result temperingSwitch(Boolean flag) {
        return Result.build(200, "查询成功", bigStorageCageDetailsService.temperingSwitch(flag));
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
@@ -4,6 +4,7 @@
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -35,4 +36,12 @@
    List<SlotSequenceDTO> queryGlassMaxAndMin(@Param(value = "engineerId") String engineerId, @Param(value = "temperingLayoutId") Integer temperingLayoutId);
    /**
     * 按照玻璃id和目标格子更新笼内玻璃信息
     *
     * @param glassList
     * @param state
     */
    void updateBySlot(@Param(value = "list") List<UpdateBigStorageCageDTO> glassList, @Param(value = "state") int state);
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
@@ -5,6 +5,7 @@
import com.mes.bigstorage.entity.BigStorageDTO;
import com.mes.bigstorage.entity.dto.SlotSequenceDTO;
import com.mes.bigstorage.entity.dto.TemperingLayoutDTO;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.glassinfo.entity.GlassInfo;
import java.util.List;
@@ -66,7 +67,11 @@
     */
    List<SlotSequenceDTO> queryGlassMaxAndMin(String engineerId, Integer temperingLayoutId);
    boolean TemperingGlass(String temperingLayoutId, String engineerId);
    boolean temperingGlass(String temperingLayoutId, String engineerId);
    List<Map<String, Object>> selectTemperingGlass();
    void updateBySlot(List<UpdateBigStorageCageDTO> glassList, int state);
    String temperingSwitch(Boolean flag);
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java
@@ -3,7 +3,9 @@
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
@@ -15,15 +17,19 @@
import com.mes.bigstorage.service.BigStorageCageService;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import com.mes.bigstoragetask.entity.BigStorageCageOutTask;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.bigstoragetask.mapper.BigStorageCageFeedTaskMapper;
import com.mes.bigstoragetask.mapper.BigStorageCageOutTaskMapper;
import com.mes.common.config.Const;
import com.mes.common.utils.RedisUtil;
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.mapper.GlassInfoMapper;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.mapper.TemperingGlassInfoMapper;
import com.mes.temperingglass.service.TemperingGlassInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -58,7 +64,15 @@
    private GlassInfoMapper glassInfoMapper;
    @Resource
    private GlassInfoService glassInfoService;
    @Resource
    private TemperingGlassInfoService temperingGlassInfoService;
    @Resource
    private DamageService damageService;
    @Resource
    private RedisUtil redisUtil;
    @Value("${mes.minCount}")
    private int minCount;
@@ -68,6 +82,10 @@
    @Value("${mes.glassGap}")
    private Integer glassGap;
    @Value("${mes.sequence.order}")
    private boolean sequenceOrder;
    /**
     * 查询进/出片任务
@@ -292,6 +310,7 @@
        bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
                .eq(BigStorageCage::getRemainWidth, slotWidth)
                .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0")
                .inSql(BigStorageCage::getDeviceId,
                        "select distinct device_id from big_storage_cage_details where tempering_layout_id = " + glassInfo.getTemperingLayoutId())
                .last("limit 1"));
@@ -307,6 +326,7 @@
        bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                .eq(BigStorageCage::getRemainWidth, slotWidth)
                .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
                .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0")
                .notInSql(BigStorageCage::getDeviceId,
                        "select distinct device_id from big_storage_cage_details where state in (100,102,103)")
                .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness())
@@ -321,6 +341,7 @@
        }
        bigStorageCage = bigStorageCageService.getOne(new LambdaQueryWrapper<BigStorageCage>()
                .eq(BigStorageCage::getRemainWidth, slotWidth)
                .notInSql(BigStorageCage::getSlot, "select distinct slot from big_storage_cage_details where state = 0")
                .eq(BigStorageCage::getEnableState, Const.SLOT_ON)
                .ge(BigStorageCage::getMaxThickness, glassInfo.getThickness())
                .orderByAsc(BigStorageCage::getDeviceId)
@@ -350,39 +371,30 @@
    }
    @Override
    public boolean TemperingGlass(String temperingLayoutId, String engineerId) {
    public boolean temperingGlass(String temperingLayoutId, String engineerId) {
        LambdaQueryWrapper<TemperingGlassInfo> temperingGlassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        temperingGlassInfoLambdaQueryWrapper
                .eq(TemperingGlassInfo::getState,Const.TEMPERING_NEW);
        List<TemperingGlassInfo> temperingGlassInfoList=temperingGlassInfoMapper.selectList(temperingGlassInfoLambdaQueryWrapper);
        if(temperingGlassInfoList.size()==0){
            LambdaQueryWrapper<BigStorageCageDetails> wrapper =new LambdaQueryWrapper<>();
            wrapper.eq(BigStorageCageDetails::getTemperingLayoutId,temperingLayoutId)
                    .eq(BigStorageCageDetails::getEngineerId,engineerId)
                    .in(BigStorageCageDetails::getState,Const.GLASS_STATE_IN,Const.GLASS_STATE_ARTIFICIAL);
            List<BigStorageCageDetails> bigStorageCageDetailsList=baseMapper.selectList(wrapper);
            for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList
            ) {
                TemperingGlassInfo temperingGlassInfo = new TemperingGlassInfo();
                LambdaQueryWrapper<GlassInfo> glassInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
                glassInfoLambdaQueryWrapper.eq(GlassInfo::getGlassId, bigStorageCageDetails.getGlassId());
                GlassInfo glassInfo = glassInfoMapper.selectOne(glassInfoLambdaQueryWrapper);
                BeanUtils.copyProperties(glassInfo, temperingGlassInfo);
                temperingGlassInfo.setAngle((int) glassInfo.getAngle());
                temperingGlassInfo.setState(Const.TEMPERING_NEW);
                temperingGlassInfo.setSlot(bigStorageCageDetails.getSlot());
                temperingGlassInfoMapper.insert(temperingGlassInfo);
            }
            List<TemperingGlassInfo> temperingGlassInfos = glassInfoService.selectJoinList(TemperingGlassInfo.class, JoinWrappers.lambda(GlassInfo.class)
                    .selectAll(GlassInfo.class)
                    .select("-1 as state")
                    .selectAs(BigStorageCageDetails::getSlot, TemperingGlassInfo::getSlot)
                    .innerJoin(BigStorageCageDetails.class, BigStorageCageDetails::getGlassId, GlassInfo::getGlassId)
                    .eq(GlassInfo::getTemperingLayoutId, temperingLayoutId)
                    .eq(GlassInfo::getEngineerId, engineerId)
                    .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                    .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence));
            if (CollectionUtils.isNotEmpty(temperingGlassInfos)) {
                temperingGlassInfoService.saveBatch(temperingGlassInfos);
            return true;
        } else {
            }
        }
            return false;
        }
    }
    @Override
    public List<Map<String, Object>> selectTemperingGlass(){
@@ -393,4 +405,15 @@
        List<Map<String, Object>> TemperingGlass = baseMapper.selectMaps(wrapper);
        return TemperingGlass;
    }
    @Override
    public void updateBySlot(List<UpdateBigStorageCageDTO> glassList, int state) {
        baseMapper.updateBySlot(glassList, state);
    }
    @Override
    public String temperingSwitch(Boolean flag) {
        redisUtil.setCacheObject("temperingSwitch", flag);
        return "success";
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/entity/UpdateBigStorageCageDTO.java
New file
@@ -0,0 +1,16 @@
package com.mes.bigstoragetask.entity;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2024/7/26 9:05
 * @Description:
 */
@Data
public class UpdateBigStorageCageDTO {
    private String glassId;
    private int targetSlot;
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -16,10 +16,12 @@
import com.mes.bigstorage.service.BigStorageCageService;
import com.mes.bigstoragetask.entity.BigStorageCageFeedTask;
import com.mes.bigstoragetask.entity.BigStorageCageOutTask;
import com.mes.bigstoragetask.entity.UpdateBigStorageCageDTO;
import com.mes.bigstoragetask.service.BigStorageCageFeedTaskService;
import com.mes.bigstoragetask.service.BigStorageCageOutTaskService;
import com.mes.common.S7object;
import com.mes.common.config.Const;
import com.mes.common.utils.RedisUtil;
import com.mes.damage.entity.Damage;
import com.mes.damage.service.DamageService;
import com.mes.device.PlcParameterObject;
@@ -64,6 +66,9 @@
    private TemperingGlassInfoService temperingGlassInfoService;
    @Resource
    private DamageService damageService;
    @Resource
    private RedisUtil redisUtil;
    private static final String REQUEST_WORD = "1";
@@ -178,11 +183,6 @@
        String d01Id = plcParameterObject.getPlcParameter("D01ID").getValue();
        String d04Id = plcParameterObject.getPlcParameter("D04ID").getValue();
        log.info("1、获取d01Id扫描ID为:{};获取d04Id扫描ID为:{};", d01Id, d04Id);
        //两条线都有进卧转立任务,直接结束
//        if (StringUtils.isNotBlank(d01Id) && StringUtils.isNotBlank(d04Id)) {
//            log.info("两条线都存在进片任务,结束任务");
//            return;
//        }
        //获取两条线卧转立是否有玻璃,且任务状态为1/2
        List<Integer> lineList = bigStorageCageFeedTaskService.querySitToUpGlass();
        if (CollectionUtils.isEmpty(lineList)) {
@@ -244,20 +244,24 @@
        log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime());
    }
    @Scheduled(fixedDelay = 300)
    @Scheduled(fixedDelay = 5000)
    public void plcToHomeEdgOutTask() {
        Date startDate = new Date();
        log.info("大理片笼空车进片任务开始执行时间:{}", startDate);
        PlcParameterObject plcMesObject = S7object.getinstance().PlcMesObject;
        String e02State = plcMesObject.getPlcParameter("E02State").getAddress();
        String e02State = plcMesObject.getPlcParameter("E02State").getValue();
        if (REQUEST_WORD.equals(e02State)) {
            log.info("出片忙碌,结束出片任务");
            return;
        }
        String mesToPLCAddress = plcMesObject.getPlcParameter("MESToPLC").getAddress();
        List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>().eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_NEW));
        Assert.isTrue(CollectionUtils.isEmpty(outingList), "有正在执行出片的任务,结束当前出片线程");
        List<BigStorageCageOutTask> outingList = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>()
                .eq(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_NEW));
        if (CollectionUtils.isNotEmpty(outingList)) {
            log.info("有正在执行出片的任务,结束当前出片线程");
            return;
        }
        if (redisUtil.getCacheObject("temperingSwitch")) {
        //是否有正在钢化的玻璃
        List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.selectJoinList(TemperingGlassInfo.class, new MPJLambdaWrapper<TemperingGlassInfo>()
                .selectAll(TemperingGlassInfo.class)
@@ -305,7 +309,8 @@
                }
            }
        }
        //未到齐 执行内部调度任务
        }
        //执行内部调度任务
        TemperingLayoutDTO temperingOccupySlot = bigStorageCageDetailsService.queryTemperingOccupySlot();
        if (null != temperingOccupySlot) {
            List<SlotSequenceDTO> slotSequenceList = bigStorageCageDetailsService.queryGlassMaxAndMin(temperingOccupySlot.getEngineerId(), temperingOccupySlot.getTemperingLayoutId());
@@ -314,12 +319,25 @@
                SlotSequenceDTO second = slotSequenceList.get(i + 1);
                int slotWidth = carWidth - first.getRemainWidth() - glassGap;
                if (first.getMinSequence() == second.getMaxSequence() + 1
                        && second.getRemainWidth() > slotWidth) {
                        && second.getRemainWidth() > slotWidth && slotWidth >= 0) {
                    List<BigStorageCageDetails> list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                            .eq(BigStorageCageDetails::getSlot, first.getSlot()).eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN));
                    List<BigStorageCageOutTask> outTasks = list.stream().map(e -> new BigStorageCageOutTask(e.getGlassId(), first.getSlot(), second.getSlot(),
                            e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1)).collect(Collectors.toList());
                            .eq(BigStorageCageDetails::getSlot, first.getSlot()).eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                            .orderBy(Boolean.TRUE, sequenceOrder, BigStorageCageDetails::getTemperingFeedSequence));
                    if (CollectionUtils.isNotEmpty(list)) {
                        List<BigStorageCageOutTask> outTasks = new ArrayList<>();
                        int serialNumber = 1;
                        for (BigStorageCageDetails item : list) {
                            outTasks.add(new BigStorageCageOutTask(item.getGlassId(), first.getSlot(), second.getSlot(),
                                    item.getWidth() * 10, item.getHeight() * 10, 1, serialNumber++, Const.BIG_STORAGE_OUT_NEW));
                        }
                        //新增调度任务
                    bigStorageCageOutTaskService.saveBatch(outTasks);
                        //更新理片笼详情表调度的后的玻璃位置信息:生成任务后先将玻璃格子位置进行调整,玻璃状态改为调度中,新增调度完成任务,处理调度完成后玻璃状态改为100.
                        List<String> glassList = list.stream().map(BigStorageCageDetails::getGlassId).collect(Collectors.toList());
                        bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>().set(BigStorageCageDetails::getState, Const.GLASS_STATE_SCHEDULE_ING)
                                .set(BigStorageCageBaseInfo::getSlot, second.getSlot()).eq(BigStorageCageDetails::getGlassId, glassList));
                    }
                    //向plc写入确认字
                    int returnData = 0;
@@ -348,14 +366,18 @@
        if (CollectionUtils.isNotEmpty(list)) {
            log.info("2、获取所有正在进片的玻璃信息id:{}", list);
            List<String> glassIds = list.stream().map(String::valueOf).collect(Collectors.toList());
            List<Object> inSuccessGlassIdsObj = bigStorageCageFeedTaskService.listObjs(new LambdaQueryWrapper<BigStorageCageFeedTask>()
                    .select(BigStorageCageFeedTask::getGlassId).in(BigStorageCageFeedTask::getGlassId, glassIds)
            List<BigStorageCageFeedTask> inSuccessGlass = bigStorageCageFeedTaskService.list(new LambdaQueryWrapper<BigStorageCageFeedTask>()
                    .in(BigStorageCageFeedTask::getGlassId, glassIds)
                    .in(BigStorageCageFeedTask::getTaskState, Const.BIG_STORAGE_IN_SLOT));
            List<String> inSuccessGlassIds = inSuccessGlassIdsObj.stream().map(String::valueOf).collect(Collectors.toList());
            if (CollectionUtils.isNotEmpty(inSuccessGlassIds)) {
                log.info("3、获取进片已完成的玻璃信息id:{}", inSuccessGlassIds);
                bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
                        .set(BigStorageCageDetails::getState, Const.GLASS_STATE_IN).in(BigStorageCageDetails::getGlassId, inSuccessGlassIds));
            if (CollectionUtils.isNotEmpty(inSuccessGlass)) {
                log.info("3、获取进片已完成的玻璃信息id:{}", inSuccessGlass);
                List<String> inSuccessGlassIds = inSuccessGlass.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList());
                List<UpdateBigStorageCageDTO> storageCageDTOList = inSuccessGlass.stream().map(e -> {
                    UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO();
                    BeanUtils.copyProperties(e, storageCageDTO);
                    return storageCageDTO;
                }).collect(Collectors.toList());
                bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
                log.info("4、大理片笼进片状态已完成已完成的玻璃信息id:{}", inSuccessGlassIds);
                //更新理片笼玻璃尺寸
                updateSlotRemain(inSuccessGlassIds, Boolean.TRUE);
@@ -379,14 +401,19 @@
        if (CollectionUtils.isNotEmpty(list)) {
            log.info("2、获取所有正在出片的玻璃信息id:{}", list);
            List<String> glassIds = list.stream().map(String::valueOf).collect(Collectors.toList());
            List<Object> outSuccessGlassIdsObj = bigStorageCageOutTaskService.listObjs(new LambdaQueryWrapper<BigStorageCageOutTask>()
                    .select(BigStorageCageOutTask::getGlassId).in(BigStorageCageOutTask::getGlassId, glassIds).in(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_ALL));
            List<String> outSuccessGlassIds = outSuccessGlassIdsObj.stream().map(String::valueOf).collect(Collectors.toList());
            if (CollectionUtils.isNotEmpty(outSuccessGlassIds)) {
                log.info("3、获取出片已完成的玻璃信息id:{}", outSuccessGlassIdsObj);
                bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
                        .set(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT).in(BigStorageCageDetails::getGlassId, outSuccessGlassIds));
                log.info("4、大理片笼出片状态已完成已完成的玻璃信息id:{}", outSuccessGlassIdsObj);
            List<BigStorageCageOutTask> outSuccessGlass = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>()
                    .in(BigStorageCageOutTask::getGlassId, glassIds).in(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_ALL));
            if (CollectionUtils.isNotEmpty(outSuccessGlass)) {
                log.info("3、获取出片已完成的玻璃信息id:{}", outSuccessGlass);
                List<UpdateBigStorageCageDTO> storageCageDTOList = outSuccessGlass.stream().map(e -> {
                    UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO();
                    storageCageDTO.setGlassId(e.getGlassId());
                    storageCageDTO.setTargetSlot(e.getStartSlot());
                    return storageCageDTO;
                }).collect(Collectors.toList());
                bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT);
                List<String> outSuccessGlassIds = outSuccessGlass.stream().map(BigStorageCageOutTask::getGlassId).collect(Collectors.toList());
                log.info("4、大理片笼出片状态已完成已完成的玻璃信息id:{}", outSuccessGlassIds);
                //更新理片笼玻璃尺寸
                updateSlotRemain(outSuccessGlassIds, Boolean.FALSE);
                log.info("5、大理片笼进片目标格子尺寸更新完成");
@@ -624,6 +651,7 @@
        for (int i = 1; i <= taskList.size(); i++) {
            s7control.writeWord(plcMesObject.getPlcParameter("StartAddToImport" + i).getAddress(), taskList.get(i - 1).getLine());
            s7control.writeWord(plcMesObject.getPlcParameter("TargetAddToImport" + i).getAddress(), taskList.get(i - 1).getTargetSlot());
            log.info("向plc发送第{}片玻璃已完成", i);
        }
        int returnData = 0;
        int count = 1;
@@ -639,27 +667,36 @@
        List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>();
        //打车剩余尺寸
        Integer remainWidth = carWidth;
        int trainNumber = 1;
        int serialNumber = 1;
        int maxX = 0;
        for (T e : list) {
            if (bigStorageCageOutTaskList.size() >= outCarMaxSize || e.getWidth() > remainWidth) {
                break;
            int maxLength = Math.max((int) e.getWidth(), (int) e.getHeight());
            if (bigStorageCageOutTaskList.size() >= outCarMaxSize || maxLength > remainWidth) {
                remainWidth = carWidth;
                trainNumber = trainNumber + 1;
                serialNumber = 1;
                maxX = 0;
                continue;
            }
            remainWidth = remainWidth - (int) e.getWidth() - glassGap;
            remainWidth = remainWidth - maxLength - glassGap;
            if (isTempering) {
                int minLength = Math.min((int) e.getWidth(), (int) e.getHeight());
                if (maxX + minLength <= xMaxSize) {
                    bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION,
                            e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1));
                            e.getWidth() * 10, e.getHeight() * 10, trainNumber, serialNumber++, 1));
                    maxX = Math.max(maxX, e.getXCoordinate());
                } else {
                    break;
                    remainWidth = carWidth;
                    trainNumber = trainNumber + 1;
                    serialNumber = 1;
                    maxX = 0;
                    continue;
                }
            } else {
                bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION,
                        e.getWidth() * 10, e.getHeight(), 0, 0, 1));
                        e.getWidth() * 10, e.getHeight(), trainNumber, serialNumber++, 1));
            }
        }
        Assert.isFalse(CollectionUtils.isEmpty(bigStorageCageOutTaskList), "未获取出片数据,结束出片任务");
        log.info("获取出片任务数据{}条,执行保存", bigStorageCageOutTaskList.size());
@@ -669,9 +706,6 @@
        bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
                .set(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT_ING)
                .in(BigStorageCageDetails::getGlassId, glassIds));
        //更新笼子内格子的剩余尺寸(移至出片任务完成后)
//        updateSlotRemain(list, glassIds);
        int returnData = 0;
        int count = 1;
        while (returnData == 0) {
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -44,13 +44,15 @@
    </select>
    <select id="queryTemperingOccupySlot" resultMap="temperingLayoutDTO">
        SELECT TEMPERING_LAYOUT_ID,
        SELECT ENGINEER_ID,
               TEMPERING_LAYOUT_ID,
               COUNT(DISTINCT SLOT) as SLOT_COUNT
        FROM BIG_STORAGE_CAGE_DETAILS
        WHERE STATE = 100
        GROUP BY ENGINEER_ID,
                 TEMPERING_LAYOUT_ID
        HAVING SLOT_COUNT &gt;= #{count} LIMIT 1
        HAVING SLOT_COUNT &gt;= #{count}
        ORDER BY SLOT_COUNT DESC LIMIT 1
    </select>
    <select id="queryGlassMaxAndMin" resultMap="slotSequenceDTO">
        SELECT T.*,
@@ -71,4 +73,18 @@
                 INNER JOIN BIG_STORAGE_CAGE T1 ON T.SLOT = T1.SLOT
        ORDER BY T.MAX_SEQUENCE DESC
    </select>
    <update id="updateBySlot">
        update big_storage_cage_details
        <set>
            state = #{state}
        </set>
        <where>
            (glass_id,slot) in (
            <foreach collection="list" item="item" separator=",">
                (#{item.glassId}, #{item.targetSlot})
            </foreach>
            )
        </where>
    </update>
</mapper>