hangzhoumesParent/common/servicebase/src/main/java/com/mes/common/config/Const.java
@@ -42,7 +42,6 @@ * 卧式理片笼详情表玻璃状态 * 进片任务1 * 出片任务2 * 出片任务2 */ public static final Integer GLASS_CACHE_TYPE_IN = 1; public static final Integer GLASS_CACHE_TYPE_OUT = 2; hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/edgstoragecage/service/EdgStorageCageService.java
@@ -19,6 +19,7 @@ /** * 查询笼内离指定格子最近空格 * flag :是否为直通 * * @return */ hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/CacheGlassTask.java
@@ -182,8 +182,8 @@ * @return */ public GlassInfo queryAndChangeGlass(String glassId) { GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId) .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); // .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); Assert.isFalse(null == glassInfo, "玻璃信息不存在"); //按照玻璃尺寸 LambdaQueryWrapper<GlassInfo> queryWrapper = new LambdaQueryWrapper<GlassInfo>() @@ -277,8 +277,8 @@ List<EdgStorageCageDetails> list = edgStorageCageDetailsService.list(wrapper); if (CollectionUtil.isEmpty(list)) { MPJQueryWrapper<GlassInfo> queryWrapper = new MPJQueryWrapper<GlassInfo>() .selectAll(GlassInfo.class).eq("t.glass_id", glassId) .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); .selectAll(GlassInfo.class).eq("t.glass_id", glassId); // .inSql("t.engineer_id", "select engineer_id from engineering where state = 1"); if (endcell == Const.A10_OUT_TARGET_POSITION) { queryWrapper.innerJoin("(select glass_id, case when height <= width then width else height end as first_length, " + "case when width < height then width else height end as second_length from glass_info) t1 " + @@ -347,8 +347,8 @@ //todo: 获取正在执行的工程信息 if (StringUtils.isNotBlank(glassId)) { GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() .eq(GlassInfo::getGlassId, glassId) .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); .eq(GlassInfo::getGlassId, glassId)); // .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1")); EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); BeanUtils.copyProperties(one, resultDetails); glassList.add(resultDetails); @@ -401,7 +401,7 @@ } GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>() .eq(GlassInfo::getGlassId, glassId) .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1") // .inSql(GlassInfo::getEngineerId, "select engineer_id from engineering where state = 1") ); EdgStorageCageDetails resultDetails = new EdgStorageCageDetails(); BeanUtils.copyProperties(one, resultDetails); @@ -451,7 +451,8 @@ return null; } return edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>().eq(EdgStorageCageDetails::getGlassId, taskCache.getGlassId()) .inSql(EdgStorageCageDetails::getEngineerId, "select engineer_id from engineering where state = 1").last(" limit 1 ")); // .inSql(EdgStorageCageDetails::getEngineerId, "select engineer_id from engineering where state = 1") .last(" limit 1 ")); } /** hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassInfo.java
@@ -2,9 +2,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import org.springframework.data.annotation.Id; import org.springframework.stereotype.Component; import java.io.Serializable; @@ -35,6 +33,11 @@ private String flowCardId; /** * 层号 */ private Integer layer; /** * 顺序 */ private Integer sequence; hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassTask.java
@@ -28,6 +28,12 @@ private Long id; /** * 玻璃id */ private String glassId; /** * 起始 */ private String startCell; @@ -71,11 +77,6 @@ * 任务状态 0 未开始 1正在进行 2完成 */ private Integer taskStauts; /** * 玻璃id */ private String glassId; /** * 创建时间 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/mapper/DownGlassInfoMapper.java
@@ -1,14 +1,20 @@ package com.mes.downglassinfo.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.github.yulichang.base.MPJBaseMapper; import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.glassinfo.entity.GlassInfo; import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo>, MPJBaseMapper<DownGlassInfo> { public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo> { DownGlassInfoDTO queryDownGlassMaxLayer(@Param(value = "flowCardId") String flowCardId); Integer queryMaxSequence(@Param(value = "flowCardId") String flowCardId, @Param(value = "layer") int layer); List<DownGlassInfoDTO> queryWorkStationNotIn(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java
@@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; import java.util.List; public interface DownGlassInfoService extends IService<DownGlassInfo> { @@ -18,4 +21,9 @@ void insertDownGlassInfo(DownGlassInfo downGlassInfo); DownGlassInfoDTO queryDownGlassMaxLayer(String flowCardId); Integer queryMaxSequence(String flowCardId, int layer); List<DownGlassInfoDTO> queryWorkStationNotIn(); } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -6,12 +6,17 @@ import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downglassinfo.mapper.DownGlassInfoMapper; import com.mes.downglassinfo.service.DownGlassInfoService; import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; import org.springframework.stereotype.Service; import java.util.List; @Service public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService { // 根据流程卡号查询最大序号 /** * 根据流程卡号查询最大序号 */ @Override public Integer getMaxSequenceByFlowCardId(String flowCardId) { LambdaQueryWrapper<DownGlassInfo> lambdaQueryWrapper = Wrappers.lambdaQuery(); @@ -24,14 +29,23 @@ return downGlassInfo != null ? downGlassInfo.getSequence() : 0; } @Override public void insertDownGlassInfo(DownGlassInfo downGlassInfo) { baseMapper.insert(downGlassInfo); } @Override public DownGlassInfoDTO queryDownGlassMaxLayer(String flowCardId) { return baseMapper.queryDownGlassMaxLayer(flowCardId); } @Override public Integer queryMaxSequence(String flowCardId, int layer) { return baseMapper.queryMaxSequence(flowCardId, layer); } @Override public List<DownGlassInfoDTO> queryWorkStationNotIn() { return baseMapper.queryWorkStationNotIn(); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/DownStorageCageService.java
@@ -1,6 +1,5 @@ package com.mes.downstorage.service; import com.baomidou.mybatisplus.extension.service.IService; import com.github.yulichang.base.MPJBaseService; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downstorage.entity.DownStorageCage; @@ -21,12 +20,15 @@ public interface DownStorageCageService extends MPJBaseService<DownStorageCage> { DownGlassTask createDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, String taskType); DownGlassTask createDownGlassTask(DownStorageCageDetails glassInfo, String startCell, String endCell, String taskType); // List<Map<String, Object>> selectCacheLeisure(); /** * @return 找到空格子 */ DownStorageCage selectCacheEmpty(int currentSlot, boolean flag); /** * @return 找到空格子 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -1,17 +1,13 @@ package com.mes.downstorage.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.toolkit.JoinWrappers; import com.github.yulichang.wrapper.MPJLambdaWrapper; //import com.mes.device.PlcParameterObject; import com.google.common.base.Functions; import com.mes.common.config.Const; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downstorage.entity.DownStorageCage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.downstorage.entity.DownStorageCageDetails; import com.mes.downstorage.mapper.DownStorageCageDetailsMapper; import com.mes.downstorage.mapper.DownStorageCageMapper; @@ -19,9 +15,7 @@ import com.mes.downstorage.service.DownStorageCageService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import com.mes.pp.entity.OptimizeDetail; import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.statement.select.SelectItem; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -77,22 +71,40 @@ } //找到空格子 @Override public List<DownStorageCageDetails> selectCacheEmpty() { return baseMapper.selectJoinList(DownStorageCageDetails.class, return this.selectJoinList(DownStorageCageDetails.class, JoinWrappers.lambda(DownStorageCage.class) .selectAll(DownStorageCage.class) .select(DownStorageCageDetails::getWidth, DownStorageCageDetails::getHeight, DownStorageCageDetails::getGlassId) .leftJoin(DownStorageCageDetails.class, on -> on .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot) .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN) ) .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)) .isNull(DownStorageCageDetails::getSlot) ); } //找到空格子 @Override public DownStorageCage selectCacheEmpty(int currentSlot, boolean flag) { List<DownStorageCage> emptyList = this.selectJoinList(DownStorageCage.class, JoinWrappers.lambda(DownStorageCage.class) .selectAll(DownStorageCage.class) .leftJoin(DownStorageCageDetails.class, on -> on .eq(DownStorageCageDetails::getDeviceId, DownStorageCage::getDeviceId) .eq(DownStorageCageDetails::getSlot, DownStorageCage::getSlot) .eq(DownStorageCageDetails::getState, Const.GLASS_STATE_IN)) .isNull(DownStorageCageDetails::getSlot) .last("order by abs(t.slot - " + currentSlot + ") asc limit 2") ); if (flag && CollectionUtil.isNotEmpty(emptyList)) { return emptyList.get(0); } if (CollectionUtil.isEmpty(emptyList) || emptyList.size() == 1) { return null; } return emptyList.get(0); } @Override @@ -113,12 +125,6 @@ ); } @Override hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstation.java
@@ -53,6 +53,11 @@ */ private Integer workState; /** * 层数 */ private Integer layer; /** * 总数量 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/dto/DownGlassInfoDTO.java
New file @@ -0,0 +1,32 @@ package com.mes.downworkstation.entity.dto; import com.mes.glassinfo.entity.GlassInfo; import lombok.Data; import java.util.List; /** * @Author : zhoush * @Date: 2024/6/21 16:06 * @Description: */ @Data public class DownGlassInfoDTO { /** * 流程卡号 */ private String flowCardId; /** * 层数 */ private Integer layer; /** * 落架数量 */ private Integer count; /** * 流程卡未进片的玻璃信息 */ private List<GlassInfo> glassInfoList; } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/DownLoadCacheGlassTask.java
New file @@ -0,0 +1,226 @@ package com.mes.job; import cn.hutool.core.lang.Assert; import cn.smallbun.screw.core.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mes.common.S7object; import com.mes.common.config.Const; import com.mes.device.PlcParameterObject; import com.mes.downglassinfo.entity.DownGlassInfo; import com.mes.downglassinfo.entity.DownGlassTask; import com.mes.downglassinfo.service.DownGlassInfoService; import com.mes.downglassinfo.service.DownGlassTaskService; import com.mes.downstorage.entity.DownStorageCage; import com.mes.downstorage.service.DownStorageCageDetailsService; import com.mes.downstorage.service.DownStorageCageService; import com.mes.downworkstation.entity.DownWorkstation; import com.mes.downworkstation.entity.dto.DownGlassInfoDTO; import com.mes.downworkstation.service.DownWorkstationService; import com.mes.downworkstation.service.DownWorkstationTaskService; import com.mes.glassinfo.entity.GlassInfo; import com.mes.glassinfo.service.GlassInfoService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.util.Date; import java.util.List; /** * @Author : zhoush * @Date: 2024/5/8 8:17 * @Description: */ @Component @Slf4j public class DownLoadCacheGlassTask { @Autowired DownGlassTaskService downGlassTaskService; @Autowired GlassInfoService glassInfoService; @Autowired DownStorageCageDetailsService downStorageCageDetailsService; @Autowired DownStorageCageService downStorageCageService; @Autowired DownWorkstationService downWorkstationService; @Autowired DownGlassInfoService downGlassInfoService; @Autowired private DownWorkstationTaskService downWorkstationTaskService; @Scheduled(fixedDelay = 1000) public void plcHomeEdgTask() { PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; String taskRequestTypeValue = plcParameterObject.getPlcParameter("RequestWord").getValue(); String glassIdeValue = plcParameterObject.getPlcParameter("G04ID").getValue(); String confirmationWrodValue = plcParameterObject.getPlcParameter("MES_confirmation_word").getValue(); //A08 A09表示线路相同 可做等价 无数据转int异常 String out08Glassstate = plcParameterObject.getPlcParameter("A08_glass_status").getValue(); String out10Glassstate = plcParameterObject.getPlcParameter("A10_glass_status").getValue(); String confirmationWrodAddress = plcParameterObject.getPlcParameter("MES_confirmation_word").getAddress(); String currentSlot = plcParameterObject.getPlcParameter("Current_slot").getValue(); log.info("1、获取到的请求字为:{},获取到的扫描ID为:{},获取到的确认字为:{},获取到的出片状态分别为:A09:{}、A10:{},当前格子号为:{}", taskRequestTypeValue, glassIdeValue, confirmationWrodValue, out08Glassstate, out10Glassstate, currentSlot); if ("0".equals(taskRequestTypeValue)) { if ("0".equals(confirmationWrodValue)) { log.info("2、获取到的请求字为0,且确认字为0,不执行任务"); return; } log.info("2、获取到的请求字为0,将确认字改为0"); S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 0); return; } if (!"0".equals(confirmationWrodValue)) { log.info("2、获取到的请求字不为0,将确认字不为0,直接结束"); return; } if ("1".equals(taskRequestTypeValue)) { log.info("2、进片请求,且确认字为0,执行进片任务"); inTo(glassIdeValue, confirmationWrodAddress, currentSlot); } else if ("2".equals(taskRequestTypeValue)) { //09空闲 :1 10空闲 :2 都空闲:3 其他0 log.info("2、出片请求,且确认字为0,执行进片任务"); // outTo(Integer.parseInt(out08Glassstate), // Integer.parseInt(out10Glassstate), confirmationWrodAddress, "", 0); } else if ("3".equals(taskRequestTypeValue)) { log.info("2、进片和出片都空闲,执行出片任务"); //加笼子里面是否有玻璃,有先出,无玻璃先进 // boolean outFlase = outTo(Integer.parseInt(out08Glassstate), // Integer.parseInt(out10Glassstate), confirmationWrodAddress, glassIdeValue, Integer.parseInt(currentSlot)); // log.info("出片任务是否完成:{},失败且玻璃id:{}不为空则执行进片任务", outFlase, glassIdeValue); // if (!outFlase && StringUtils.isNotBlank(glassIdeValue)) { // inTo(glassIdeValue, confirmationWrodAddress, currentSlot); // } } } private void inTo(String glassId, String confirmationWrodAddress, String currentSlot) { log.info("1、按照玻璃id:{}获取玻璃小片信息,当前格子为:{}", glassId, currentSlot); //添加进片任务 查找空格 DownStorageCage nearestEmpty = downStorageCageService.selectCacheEmpty(Integer.parseInt(currentSlot), Boolean.FALSE); Assert.isTrue(null != nearestEmpty, "格子已满"); log.info("2、查询卧式理片笼里面的空格:{}", nearestEmpty); GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId)); Assert.isFalse(null == glassInfo, "玻璃信息不存在"); //获取该玻璃的流程卡是否已绑定架子 DownWorkstation one = downWorkstationService.getOne(new LambdaQueryWrapper<DownWorkstation>() .eq(DownWorkstation::getLayer, glassInfo.getLayer()) .eq(DownWorkstation::getFlowCardId, glassInfo.getFlowCardId())); Boolean checkFlag = Boolean.TRUE; GlassInfo tempGlassInfo = null; if (null != one) { log.info("该流程卡已绑定架子"); checkFlag = multilayerCheck(glassInfo); } else { log.info("该玻璃的流程卡未绑定架子,获取是否有空架子"); List<DownWorkstation> list = downWorkstationService.list(new LambdaQueryWrapper<DownWorkstation>().isNull(DownWorkstation::getFlowCardId)); if (CollectionUtils.isNotEmpty(list)) { log.info("有空架子,将流程卡与架子好绑定,执行进片任务 结束"); checkFlag = Boolean.TRUE; } else { log.info("无空架子,获取已绑定架子的流程卡信息,查看玻璃信息是否可被对调"); List<DownGlassInfoDTO> downGlassInfoDTOList = downGlassInfoService.queryWorkStationNotIn(); log.info("获取架子上已绑定流程卡落架的数量及未落架的玻璃数据:{}", downGlassInfoDTOList); Assert.isTrue(CollectionUtils.isNotEmpty(downGlassInfoDTOList), "已绑定流程卡均无未落架玻璃,请及时处理架子上的玻璃,清除流程卡"); endLoop: for (DownGlassInfoDTO e : downGlassInfoDTOList) { List<GlassInfo> glassInfoList = e.getGlassInfoList(); for (GlassInfo item : glassInfoList) { if (item.getWidth().equals(glassInfo.getWidth()) && item.getHeight().equals(glassInfo.getHeight()) && item.getThickness().equals(glassInfo.getThickness()) && item.getFilmsid().equals(glassInfo.getFilmsid())) { //todo:玻璃是否为多层 checkFlag = multilayerCheck(item); if (checkFlag) { //玻璃替换 仅替换流程卡id及层数 String tempFlowCardId = item.getFlowCardId(); Integer tempLayer = item.getLayer(); String flowCardId = glassInfo.getFlowCardId(); Integer layer = glassInfo.getLayer(); log.info("替换流程卡信息,当前玻璃信息:{}的流程卡号{}及层数{},替换后玻璃信息:{}的流程卡号{}及层数{}", tempGlassInfo, glassInfo, flowCardId, layer, tempFlowCardId, tempLayer); glassInfo.setFlowCardId(tempFlowCardId); glassInfo.setLayer(tempLayer); glassInfoService.updateById(glassInfo); item.setFlowCardId(flowCardId); item.setLayer(layer); glassInfoService.updateById(item); break endLoop; } } } } } if (checkFlag) { //生成进片任务 执行进片操作 initDownGlassTask(glassInfo, nearestEmpty.getSlot() + "", null, Const.GLASS_CACHE_TYPE_IN); } } // log.info("3、将玻璃信息插入卧式理片笼,当前玻璃信息:{}", glassInfo); // EdgStorageCageDetails details = new EdgStorageCageDetails(); // BeanUtils.copyProperties(glassInfo, details); // details.setState(Const.GLASS_STATE_IN); // details.setSlot(nearestEmpty.getSlot()); // details.setDeviceId(nearestEmpty.getDeviceId()); // edgStorageCageDetailsService.save(details); // log.info("4、玻璃信息已存入理片笼详情表,玻璃信息为{}", details); // //添加进片任务 // boolean taskCache = saveTaskCache(details.getGlassId(), 0, nearestEmpty.getSlot(), Const.GLASS_CACHE_TYPE_IN); // log.info("5、生成进片任务信息存入任务表是否完成:{}", taskCache); // // S7object.getinstance().plccontrol.writeWord(confirmationWrodAddress, (short) 1); // log.info("6、发送确认字完成"); } private Boolean multilayerCheck(GlassInfo glassInfo) { //查询该流程卡是否为多层 if (glassInfo.getTotalLayer() > 1) { log.info("按照流程卡获取当前流程卡各层已落架数量"); DownGlassInfoDTO downGlassInfoDTO = downGlassInfoService.queryDownGlassMaxLayer(glassInfo.getFlowCardId()); if (null == downGlassInfoDTO) { log.info("架子已经占满,多层玻璃无法找到对应的格子,需执行替换玻璃的操作"); return Boolean.FALSE; } if (downGlassInfoDTO.getLayer().equals(glassInfo.getLayer())) { log.info("当前玻璃的流程在架子上落架最多 直接进片"); return Boolean.TRUE; } Integer sequence = downGlassInfoService.queryMaxSequence(glassInfo.getFlowCardId(), glassInfo.getLayer()); log.info("获取当前玻璃需要放的次序:笼内同流程 同层数的通达次序+1:{}", sequence); DownGlassInfo downGlassInfo = downGlassInfoService.getOne(new LambdaQueryWrapper<DownGlassInfo>() .eq(DownGlassInfo::getFlowCardId, downGlassInfoDTO.getFlowCardId()) .eq(DownGlassInfo::getLayer, downGlassInfoDTO.getLayer()).eq(DownGlassInfo::getSequence, sequence)); log.info("拿当前版序获取玻璃信息{},按照次序判断当前玻璃是否尺寸对应的上(与数量最多的次序比较)。", downGlassInfo); if (null != downGlassInfoDTO && downGlassInfo.getWidth().equals(glassInfo.getWidth()) && downGlassInfo.getHeight().equals(glassInfo.getHeight())) { log.info("相同次序玻璃对应上,可执行进片任务"); return Boolean.TRUE; } else { log.info("同次序玻璃对应不上,需执行替换玻璃的操作"); return Boolean.FALSE; } } else { log.info("非多层玻璃,直接进片"); return Boolean.TRUE; } } private Boolean initDownGlassTask(GlassInfo glassInfo, String startCell, String endCell, Integer taskType) { DownGlassTask downGlassTask = new DownGlassTask(); BeanUtils.copyProperties(glassInfo, downGlassTask); downGlassTask.setStartCell(startCell); downGlassTask.setEndCell(endCell); downGlassTask.setTaskType(taskType + ""); downGlassTask.setTaskStauts(0); downGlassTask.setCreateTime(new Date()); return downGlassTaskService.save(downGlassTask); } } hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml
New file @@ -0,0 +1,69 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.mes.downglassinfo.mapper.DownGlassInfoMapper"> <resultMap id="downGlassInfoDTO" type="com.mes.downworkstation.entity.dto.DownGlassInfoDTO"> <result column="flow_card_id" property="flowCardId"/> <result column="layer" property="layer"/> <result column="count" property="count"/> </resultMap> <resultMap id="downGlassInfo" type="com.mes.downworkstation.entity.dto.DownGlassInfoDTO"> <result column="flow_card_id" property="flowCardId"/> <result column="layer" property="layer"/> <result column="count" property="count"/> <collection property="glassInfoList" ofType="com.mes.glassinfo.entity.GlassInfo"> <id column="id" property="id"/> <result column="flow_card_id" property="flowCardId"/> <result column="glass_type" property="glassType"/> <result column="width" property="width"/> <result column="height" property="height"/> <result column="thickness" property="thickness"/> <result column="filmsid" property="filmsid"/> <result column="total_layer" property="totalLayer"/> <result column="layer" property="layer"/> </collection> </resultMap> <select id="queryDownGlassMaxLayer" resultMap="downGlassInfoDTO"> SELECT flow_card_id, layer, COUNT(layer) AS count FROM down_glass_info WHERE flow_card_id = #{flowCardId} GROUP BY flow_card_id, layer order by count desc limit 1 </select> <select id="queryMaxSequence" resultType="java.lang.Integer"> SELECT max(sequence) + 1 as sequence FROM down_glass_info WHERE flow_card_id = #{flowCardId} AND layer = #{layer} </select> <select id="queryWorkStationNotIn" resultMap="downGlassInfo"> SELECT T.*, T1.* FROM ( SELECT T.FLOW_CARD_ID, T.LAYER, COUNT(T.LAYER) AS COUNT FROM DOWN_GLASS_INFO T INNER JOIN DOWN_WORKSTATION T1 ON T.FLOW_CARD_ID = T1.FLOW_CARD_ID AND T.LAYER = T1.LAYER GROUP BY T.FLOW_CARD_ID, T.LAYER ) T INNER JOIN GLASS_INFO T1 ON T.FLOW_CARD_ID = T1.FLOW_CARD_ID AND T.LAYER = T1.LAYER LEFT JOIN DOWN_GLASS_INFO T2 ON T1.GLASS_ID = T2.GLASS_ID WHERE T2.GLASS_ID IS NULL order by t.count desc </select> </mapper>