ZengTao
2024-04-15 98255c411252fa465231a33a516bcab54119c97f
Merge branch 'master' of http://10.153.19.25:10101/r/HangZhouMes

# Conflicts:
# hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageController.java
# hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageService.java
# hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageServiceImpl.java
10个文件已修改
262 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageController.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCage.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageService.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageServiceImpl.java 127 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/component/PlcStorageCage.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/temperingglass/service/TemperingGlassInfoService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageController.java
@@ -1,14 +1,11 @@
package com.mes.bigstorage.controller;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import com.mes.bigstorage.service.BigStorageCageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@@ -25,8 +22,8 @@
@RequestMapping("/bigStorageCage")
public class BigStorageCageController {
    @Autowired
    private BigStorageCageService bigStorageCageService;
    private BigStorageCageDetailsService bigStorageCageDetailsService;
    //todo: 实例代码 待删除
    @ApiOperation("测试")
@@ -37,25 +34,13 @@
    @ApiOperation("理片笼信息")
    @GetMapping("/bigStorageCage")
    public List<BigStorageCage> bigStorageCage() {
        return bigStorageCageService.list();
    }
    @ApiOperation("理片笼详情")
    @GetMapping("/bigStorageCageDetails")
    public List<BigStorageCageDetails> bigStorageCageDetails() {
        return bigStorageCageDetailsService.list();
    }
    @ApiOperation("小车实时位置")
    @GetMapping("/carPosition")
    public List<Integer> CarPosition() {
        return bigStorageCageDetailsService.getCarposition();
    public List<BigStorageCage> querybigStorageCageDetail() {
        return bigStorageCageService.querybigStorageCageDetail();
    }
    @ApiOperation("手动完成任务")
    @GetMapping("/finishTask")
    public void FinishTask(int type, int id) {
    public void finishTask(int type, int id) {
        //    bigStorageCageDetailsService.FinishTask();
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/controller/BigStorageCageDetailsController.java
@@ -1,21 +1,39 @@
package com.mes.bigstorage.controller;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.service.BigStorageCageDetailsService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
@ApiModel(description = "理片笼详情")
@RestController
@RequestMapping("/bigStorageCageDetails")
public class BigStorageCageDetailsController {
    @Autowired
    private BigStorageCageDetailsService bigStorageCageDetailsService;
    @ApiOperation("理片笼详情")
    @GetMapping("/bigStorageCageDetails")
    public List<BigStorageCageDetails> bigStorageCageDetails() {
        return bigStorageCageDetailsService.list();
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/BigStorageCage.java
@@ -1,14 +1,17 @@
package com.mes.bigstorage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
 * <p>
 *
 *
 * </p>
 *
 * @author zhoush
@@ -46,5 +49,8 @@
     */
    private Integer remainWidth;
    @TableField(exist = false)
    private List<BigStorageCageDetails> bigStorageCageDetails;
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageDetailsMapper.java
@@ -7,7 +7,7 @@
/**
 * <p>
 *  Mapper 接口
 * Mapper 接口
 * </p>
 *
 * @author zhoush
@@ -15,7 +15,4 @@
 */
public interface BigStorageCageDetailsMapper extends BaseMapper<BigStorageCageDetails> {
//    BigStorageCageDetails SelectTemperingFeedSlot(@Param("bigStorageCageDetails") BigStorageCageDetails bigStorageCageDetails);
//
//    BigStorageCageDetails SelectEmptyFeedSlot();
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/mapper/BigStorageCageMapper.java
@@ -10,7 +10,7 @@
/**
 * <p>
 *  Mapper 接口
 * Mapper 接口
 * </p>
 *
 * @author zhoush
@@ -18,15 +18,4 @@
 */
public interface BigStorageCageMapper extends BaseMapper<BigStorageCage> {
    BigStorageCageDetails SelectEmptyFeedSlot();
    @Update("update big_storage_cage set remain_width = #{width} where slot=#{slot}")
    public void UpdateRemainWidth(int slot,int width);
    BigStorageCageDetails SelectOtherFeedSlot();
    List<String> selectTemperingId();
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageDetailsService.java
@@ -2,9 +2,6 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.bigstorage.mapper.BigStorageCageMapper;
import java.util.List;
/**
 * <p>
@@ -15,7 +12,5 @@
 * @since 2024-03-27
 */
public interface BigStorageCageDetailsService extends IService<BigStorageCageDetails> {
    public boolean getTemperingGlass();
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/BigStorageCageService.java
@@ -4,10 +4,13 @@
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.entity.GlassInfo;
import java.util.List;
/**
 * <p>
 *  服务类
 * 服务类
 * </p>
 *
 * @author zhoush
@@ -15,7 +18,13 @@
 */
public interface BigStorageCageService extends IService<BigStorageCage> {
    public void updateRemainWidth(int Slot);
    void updateRemainWidth(int Slot);
    public BigStorageCageDetails FeedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails);
    BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails);
    boolean outGlass();
    List<BigStorageCage> querybigStorageCageDetail();
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/service/impl/BigStorageCageServiceImpl.java
@@ -1,6 +1,7 @@
package com.mes.bigstorage.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.bigstorage.entity.BigStorageCage;
import com.mes.bigstorage.entity.BigStorageCageDetails;
@@ -8,11 +9,17 @@
import com.mes.bigstorage.mapper.BigStorageCageMapper;
import com.mes.bigstorage.service.BigStorageCageService;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import lombok.extern.slf4j.Slf4j;
import com.mes.glassinfo.entity.GlassInfo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -24,70 +31,124 @@
 * @since 2024-03-27
 */
@Service
@Slf4j
public class BigStorageCageServiceImpl extends ServiceImpl<BigStorageCageMapper, BigStorageCage> implements BigStorageCageService {
    @Resource
    private BigStorageCageMapper bigStorageCageMapper;
    @Resource
    private BigStorageCageDetailsMapper bigStorageCageDetailsMapper;
    @Override
    public BigStorageCageDetails FeedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails) {
    public BigStorageCageDetails feedGlass(GlassInfo glassInfo, BigStorageCageDetails bigStorageCageDetails) {
        //1、查询理片笼内玻璃片序等于当前玻璃片序-1的玻璃
        LambdaQueryWrapper<BigStorageCageDetails> wapper = new LambdaQueryWrapper<>();
        wapper.eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
        LambdaQueryWrapper<BigStorageCageDetails> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BigStorageCageDetails::getTemperingLayoutId, glassInfo.getTemperingLayoutId())
                .eq(BigStorageCageDetails::getTemperingFeedSequence, glassInfo.getTemperingFeedSequence() + 1);
        BigStorageCageDetails layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(wapper);
        bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot());
        bigStorageCageDetails.setGlassId(bigStorageCageDetails.getGlassId());
        bigStorageCageDetails.setFlowCardId(glassInfo.getFlowcardId());
        bigStorageCageDetails.setGlassType(glassInfo.getGlassType());
        bigStorageCageDetails.setWidth(glassInfo.getWidth());
        bigStorageCageDetails.setHeight(glassInfo.getHeight());
        bigStorageCageDetails.setThickness(glassInfo.getThickness());
        bigStorageCageDetails.setTemperingLayoutId(glassInfo.getTemperingLayoutId());
        bigStorageCageDetails.setTemperingFeedSequence(glassInfo.getTemperingFeedSequence());
        BigStorageCageDetails layoutSlotInfo = bigStorageCageDetailsMapper.selectOne(wrapper);
        BeanUtils.copyProperties(glassInfo, bigStorageCageDetails);
        bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot());
        //2、有符合条件的格子活片序为1时
        if (layoutSlotInfo.getSlot() != null ) {
            //将玻璃信息填入理片笼详情表
            bigStorageCageDetailsMapper.updateById(bigStorageCageDetails);
        if (layoutSlotInfo.getSlot() != null) {
            bigStorageCageDetails.setSlot(layoutSlotInfo.getSlot());
        } else {
            //获取不到时:
//            LambdaQueryWrapper<BigStorageCageDetails> BigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>();
//            BigStorageCageDetailslambdaQueryWrapper
//                    .select(BigStorageCageDetails::getTemperingLayoutId)
//                    .groupBy(BigStorageCageDetails::getTemperingLayoutId);
//            List<Map<String, Object>> temperingLayoutIdList= bigStorageCageDetailsMapper.selectMaps(BigStorageCageDetailslambdaQueryWrapper);
//            for (Map<String, Object> map : temperingLayoutIdList) {
//                for (Map.Entry<String, Object> entry : map.entrySet()) {
//                    String prefix = entry.getKey().substring(0, entry.getKey().indexOf('-'));
//                    String suffix = entry.getKey().substring(entry.getKey().indexOf('-') + 1);
//                    if(suffix.equals(entry.getValue())){
//
//                    }
//                }
//            }
            //获取可进片格子信息
            BigStorageCageDetails EmptySlotInfo = bigStorageCageMapper.SelectEmptyFeedSlot();
            if (EmptySlotInfo != null) {
                bigStorageCageDetails.setSlot(EmptySlotInfo.getSlot());
            } else {
                //获取其他笼格子-
                BigStorageCageDetails OtherSlotInfo = bigStorageCageMapper.SelectOtherFeedSlot();
                bigStorageCageDetails.setSlot(OtherSlotInfo.getSlot());
            }
//            BigStorageCageDetails EmptySlotInfo = bigStorageCageMapper.selectEmptyFeedSlot();
//            if (EmptySlotInfo != null) {
//                bigStorageCageDetails.setSlot(EmptySlotInfo.getSlot());
//            } else {
//                //获取其他笼格子-
//                BigStorageCageDetails OtherSlotInfo = bigStorageCageMapper.selectOtherFeedSlot();
//                bigStorageCageDetails.setSlot(OtherSlotInfo.getSlot());
//            }
            //将玻璃信息放入该格子
        }
        updateRemainWidth(bigStorageCageDetails.getSlot());
        if (bigStorageCageDetails.getSlot() != null) {
            bigStorageCageDetailsMapper.insert(bigStorageCageDetails);
            updateRemainWidth(bigStorageCageDetails.getSlot());
        }
        return bigStorageCageDetails;
    }
    @Override
    public boolean outGlass() {
//        // 1、查询钢化小片任务表是否有待出玻璃
//        List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.SelectTemperingGlassInfo();
//        //没有可出的玻璃时
//        if (temperingGlassInfoList != null) {
//            //查询是否有小片全部到齐的钢化版图
//        } else {
//            //继续当前钢化版图的任务
//        }
        LambdaQueryWrapper<BigStorageCageDetails> bigStorageCageDetailslambdaQueryWrapper = new LambdaQueryWrapper<>();
        bigStorageCageDetailslambdaQueryWrapper
                .select(BigStorageCageDetails::getTemperingLayoutId)
                .groupBy(BigStorageCageDetails::getTemperingLayoutId);
        List<Map<String, Object>> temperingLayoutIdList = bigStorageCageDetailsMapper.selectMaps(bigStorageCageDetailslambdaQueryWrapper);
        for (Map<String, Object> map : temperingLayoutIdList) {
            for (Map.Entry<String, Object> entry : map.entrySet()) {
                String prefix = entry.getKey().substring(0, entry.getKey().indexOf('-'));
                String suffix = entry.getKey().substring(entry.getKey().indexOf('-') + 1);
                if (suffix.equals(entry.getValue())) {
                }
            }
        }
        return true;
    }
    //修改格子剩余宽度
    @Override
    public void updateRemainWidth(int Slot) {
    public void updateRemainWidth(int slot) {
        //获取该格子内玻璃信息
        int width = 5000;
        List<BigStorageCageDetails> bigStorageCageDetailsList = Collections.singletonList(bigStorageCageDetailsMapper.selectById(Slot));
        Integer width = 5000;
        List<BigStorageCageDetails> bigStorageCageDetailsList = Collections.singletonList(bigStorageCageDetailsMapper.selectById(slot));
        for (BigStorageCageDetails bigStorageCageDetails : bigStorageCageDetailsList
        ) {
            width -= Integer.parseInt(bigStorageCageDetails.getWidth().toString()) + bigStorageCageDetails.getGap();
        }
        //修改格子剩余宽度
        bigStorageCageMapper.UpdateRemainWidth(Slot, width);
        BigStorageCage bigStorageCage = new BigStorageCage();
        bigStorageCage.setRemainWidth(width);
        UpdateWrapper<BigStorageCage> bigStorageCageWrapper = new UpdateWrapper<>();
        bigStorageCageWrapper.eq("remain_width", width);
        bigStorageCageMapper.update(bigStorageCage, bigStorageCageWrapper);
    }
    @Override
    public List<BigStorageCage> querybigStorageCageDetail() {
        //1、获取大理片笼信息
        List<BigStorageCage> bigStorageCages = bigStorageCageMapper.selectList(null);
        log.info("1、获取大理片笼信息完成,获取到的数据{}", bigStorageCages.size());
        //2获取理片笼所有信息
        List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsMapper.selectList(null);
        Map<Integer, List<BigStorageCageDetails>> listMap = bigStorageCageDetailsList.stream().collect(Collectors.groupingBy(BigStorageCageDetails::getSlot));
        for (BigStorageCage bigStorageCage : bigStorageCages) {
            List<BigStorageCageDetails> bigStorageCageDetails = listMap.get(bigStorageCage.getSlot());
            bigStorageCage.setBigStorageCageDetails(bigStorageCageDetails);
        }
        return bigStorageCages;
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/component/PlcStorageCage.java
@@ -21,48 +21,37 @@
    private TemperingGlassInfoService temperingGlassInfoService;
    @Autowired
    private GlassInfoService glassInfoService;
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(500);
                String plcFeedReq ="0";
                String plcFeedGlassid ="111";
                String plcFeedReq = "0";
                String plcFeedGlassid = "111";
                //Plc进片请求时
                if("1".equals(plcFeedReq)){
                    BigStorageCageDetails bigStorageCageDetails=new BigStorageCageDetails();
                if ("1".equals(plcFeedReq)) {
                    BigStorageCageDetails bigStorageCageDetails = new BigStorageCageDetails();
                    //传入玻璃id
                    GlassInfo glassInfo=glassInfoService.getById(plcFeedGlassid);
                    GlassInfo glassInfo = glassInfoService.getById(plcFeedGlassid);
                    BigStorageCageDetails SlotInfo=bigStorageCageService.FeedGlass(glassInfo,bigStorageCageDetails);
                    if(SlotInfo!=null){
                    BigStorageCageDetails SlotInfo = bigStorageCageService.feedGlass(glassInfo, bigStorageCageDetails);
                    if (SlotInfo != null) {
                        //plc任务发送字
                    }
                }
                //出片请求
                String plcOutReq ="0";
                boolean result=false;
                if("1".equals(plcOutReq)){
                String plcOutReq = "0";
                boolean result = false;
                if ("1".equals(plcOutReq)) {
                    //获取钢化小片表未出笼信息
                    List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.SelectTemperingGlassInfo();
                    //没有可出的玻璃时
                    if(temperingGlassInfoList!=null){
                        //查询是否有小片全部到齐的钢化版图
                        result = bigStorageCageDetailsService.getTemperingGlass();
                    }else{
                        //继续当前钢化版图的任务
                        temperingGlassInfoService.addOutTask(temperingGlassInfoList);
                        result=true;
                    }
                    if(result==true){
                    if (result == true) {
                        //plc任务发送字
                    }
                }
            } catch (Exception e) {
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/temperingglass/service/TemperingGlassInfoService.java
@@ -7,7 +7,7 @@
/**
 * <p>
 *  服务类
 * 服务类
 * </p>
 *
 * @author zhoush
@@ -15,5 +15,6 @@
 */
public interface TemperingGlassInfoService extends IService<TemperingGlassInfo> {
    public void addOutTask(List<TemperingGlassInfo> temperingGlassInfoList);
    public List<TemperingGlassInfo> SelectTemperingGlassInfo();
}