大理片笼:钢化任务缺少工程号bug解决。备注:钢化小片表新增字段过程后需要再批量保存方法内加入新增的字段
钢化:按照玻璃id和格子号更新玻璃的状态
6个文件已修改
78 ■■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/resources/mapper/TemperingGlassInfoMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageDetailsServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/entity/UpdateBigStorageCageDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
@@ -67,7 +67,7 @@
     */
    List<SlotSequenceDTO> queryGlassMaxAndMin(String engineerId, Integer temperingLayoutId);
    boolean TemperingGlass(String temperingLayoutId, String engineerId);
    boolean temperingGlass(String temperingLayoutId, String engineerId);
    List<Map<String, Object>> selectTemperingGlass();
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;
@@ -23,8 +25,10 @@
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;
@@ -59,6 +63,12 @@
    private GlassInfoMapper glassInfoMapper;
    @Resource
    private GlassInfoService glassInfoService;
    @Resource
    private TemperingGlassInfoService temperingGlassInfoService;
    @Resource
    private DamageService damageService;
    @Value("${mes.minCount}")
@@ -69,6 +79,9 @@
    @Value("${mes.glassGap}")
    private Integer glassGap;
    @Value("${mes.sequence.order}")
    private boolean sequenceOrder;
    /**
     * 查询进/出片任务
@@ -354,37 +367,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() {
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragetask/entity/UpdateBigStorageCageDTO.java
@@ -13,6 +13,4 @@
    private String glassId;
    private int targetSlot;
    private Integer startSlot;
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -245,7 +245,7 @@
        log.info("大理片笼空车进片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime());
    }
    @Scheduled(fixedDelay = 300)
    @Scheduled(fixedDelay = 5000)
    public void plcToHomeEdgOutTask() {
        Date startDate = new Date();
        log.info("大理片笼空车进片任务开始执行时间:{}", startDate);
@@ -357,7 +357,7 @@
                List<String> inSuccessGlassIds = inSuccessGlass.stream().map(BigStorageCageFeedTask::getGlassId).collect(Collectors.toList());
                List<UpdateBigStorageCageDTO> storageCageDTOList = inSuccessGlass.stream().map(e -> {
                    UpdateBigStorageCageDTO storageCageDTO = new UpdateBigStorageCageDTO();
                    BeanUtils.copyProperties(inSuccessGlass, storageCageDTO);
                    BeanUtils.copyProperties(e, storageCageDTO);
                    return storageCageDTO;
                }).collect(Collectors.toList());
                bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
@@ -385,12 +385,13 @@
            log.info("2、获取所有正在出片的玻璃信息id:{}", list);
            List<String> glassIds = list.stream().map(String::valueOf).collect(Collectors.toList());
            List<BigStorageCageOutTask> outSuccessGlass = bigStorageCageOutTaskService.list(new LambdaQueryWrapper<BigStorageCageOutTask>()
                    .select(BigStorageCageOutTask::getGlassId).in(BigStorageCageOutTask::getGlassId, glassIds).in(BigStorageCageOutTask::getTaskState, Const.BIG_STORAGE_OUT_ALL));
                    .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();
                    BeanUtils.copyProperties(outSuccessGlass, storageCageDTO);
                    storageCageDTO.setGlassId(e.getGlassId());
                    storageCageDTO.setTargetSlot(e.getStartSlot());
                    return storageCageDTO;
                }).collect(Collectors.toList());
                bigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT);
@@ -633,6 +634,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;